Merge branch 'master' into asyncmacro
This commit is contained in:
commit
ab534804c6
37 changed files with 1737 additions and 1328 deletions
|
|
@ -795,6 +795,9 @@ const
|
||||||
|
|
||||||
skLocalVars* = {skVar, skLet, skForVar, skParam, skResult}
|
skLocalVars* = {skVar, skLet, skForVar, skParam, skResult}
|
||||||
|
|
||||||
|
lfFullExternalName* = lfParamCopy # \
|
||||||
|
# only used when 'gCmd == cmdPretty': Indicates that the symbol has been
|
||||||
|
# imported via 'importc: "fullname"' and no format string.
|
||||||
|
|
||||||
# creator procs:
|
# creator procs:
|
||||||
proc NewSym*(symKind: TSymKind, Name: PIdent, owner: PSym,
|
proc NewSym*(symKind: TSymKind, Name: PIdent, owner: PSym,
|
||||||
|
|
|
||||||
|
|
@ -701,6 +701,7 @@ proc genTry(p: BProc, t: PNode, d: var TLoc) =
|
||||||
#
|
#
|
||||||
if not isEmptyType(t.typ) and d.k == locNone:
|
if not isEmptyType(t.typ) and d.k == locNone:
|
||||||
getTemp(p, t.typ, d)
|
getTemp(p, t.typ, d)
|
||||||
|
discard lists.IncludeStr(p.module.headerFiles, "<setjmp.h>")
|
||||||
genLineDir(p, t)
|
genLineDir(p, t)
|
||||||
var safePoint = getTempName()
|
var safePoint = getTempName()
|
||||||
discard cgsym(p.module, "E_Base")
|
discard cgsym(p.module, "E_Base")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nimrod Compiler
|
# The Nimrod Compiler
|
||||||
# (c) Copyright 2012 Andreas Rumpf
|
# (c) Copyright 2013 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
|
|
@ -10,48 +10,35 @@
|
||||||
# This module handles the conditional symbols.
|
# This module handles the conditional symbols.
|
||||||
|
|
||||||
import
|
import
|
||||||
ast, astalgo, hashes, platform, strutils, idents
|
strtabs, platform, strutils, idents
|
||||||
|
|
||||||
var gSymbols*: TStrTable
|
# We need to use a PStringTable here as defined symbols are always guaranteed
|
||||||
|
# to be style insensitive. Otherwise hell would break lose.
|
||||||
|
var gSymbols: PStringTable
|
||||||
|
|
||||||
proc DefineSymbol*(symbol: string) =
|
proc DefineSymbol*(symbol: string) =
|
||||||
var i = getIdent(symbol)
|
gSymbols[symbol] = "true"
|
||||||
var sym = StrTableGet(gSymbols, i)
|
|
||||||
if sym == nil:
|
|
||||||
new(sym) # circumvent the ID mechanism
|
|
||||||
sym.kind = skConditional
|
|
||||||
sym.name = i
|
|
||||||
StrTableAdd(gSymbols, sym)
|
|
||||||
sym.position = 1
|
|
||||||
|
|
||||||
proc UndefSymbol*(symbol: string) =
|
proc UndefSymbol*(symbol: string) =
|
||||||
var sym = StrTableGet(gSymbols, getIdent(symbol))
|
gSymbols[symbol] = "false"
|
||||||
if sym != nil: sym.position = 0
|
|
||||||
|
|
||||||
proc isDefined*(symbol: PIdent): bool =
|
|
||||||
var sym = StrTableGet(gSymbols, symbol)
|
|
||||||
result = sym != nil and sym.position == 1
|
|
||||||
|
|
||||||
proc isDefined*(symbol: string): bool =
|
proc isDefined*(symbol: string): bool =
|
||||||
result = isDefined(getIdent(symbol))
|
if gSymbols.hasKey(symbol):
|
||||||
|
result = gSymbols[symbol] == "true"
|
||||||
|
|
||||||
|
proc isDefined*(symbol: PIdent): bool = isDefined(symbol.s)
|
||||||
|
|
||||||
iterator definedSymbolNames*: string =
|
iterator definedSymbolNames*: string =
|
||||||
var it: TTabIter
|
for key, val in pairs(gSymbols):
|
||||||
var s = InitTabIter(it, gSymbols)
|
if val == "true": yield key
|
||||||
while s != nil:
|
|
||||||
if s.position == 1: yield s.name.s
|
|
||||||
s = nextIter(it, gSymbols)
|
|
||||||
|
|
||||||
proc countDefinedSymbols*(): int =
|
proc countDefinedSymbols*(): int =
|
||||||
var it: TTabIter
|
|
||||||
var s = InitTabIter(it, gSymbols)
|
|
||||||
result = 0
|
result = 0
|
||||||
while s != nil:
|
for key, val in pairs(gSymbols):
|
||||||
if s.position == 1: inc(result)
|
if val == "true": inc(result)
|
||||||
s = nextIter(it, gSymbols)
|
|
||||||
|
|
||||||
proc InitDefines*() =
|
proc InitDefines*() =
|
||||||
initStrTable(gSymbols)
|
gSymbols = newStringTable(modeStyleInsensitive)
|
||||||
DefineSymbol("nimrod") # 'nimrod' is always defined
|
DefineSymbol("nimrod") # 'nimrod' is always defined
|
||||||
# for bootstrapping purposes and old code:
|
# for bootstrapping purposes and old code:
|
||||||
DefineSymbol("nimhygiene")
|
DefineSymbol("nimhygiene")
|
||||||
|
|
@ -66,7 +53,7 @@ proc InitDefines*() =
|
||||||
of cpuI386: DefineSymbol("x86")
|
of cpuI386: DefineSymbol("x86")
|
||||||
of cpuIa64: DefineSymbol("itanium")
|
of cpuIa64: DefineSymbol("itanium")
|
||||||
of cpuAmd64: DefineSymbol("x8664")
|
of cpuAmd64: DefineSymbol("x8664")
|
||||||
else: nil
|
else: discard
|
||||||
case targetOS
|
case targetOS
|
||||||
of osDOS:
|
of osDOS:
|
||||||
DefineSymbol("msdos")
|
DefineSymbol("msdos")
|
||||||
|
|
@ -92,12 +79,10 @@ proc InitDefines*() =
|
||||||
DefineSymbol("macintosh")
|
DefineSymbol("macintosh")
|
||||||
DefineSymbol("unix")
|
DefineSymbol("unix")
|
||||||
DefineSymbol("posix")
|
DefineSymbol("posix")
|
||||||
else: nil
|
else: discard
|
||||||
DefineSymbol("cpu" & $cpu[targetCPU].bit)
|
DefineSymbol("cpu" & $cpu[targetCPU].bit)
|
||||||
DefineSymbol(normalize(endianToStr[cpu[targetCPU].endian]))
|
DefineSymbol(normalize(endianToStr[cpu[targetCPU].endian]))
|
||||||
DefineSymbol(cpu[targetCPU].name)
|
DefineSymbol(cpu[targetCPU].name)
|
||||||
DefineSymbol(platform.os[targetOS].name)
|
DefineSymbol(platform.os[targetOS].name)
|
||||||
if platform.OS[targetOS].props.contains(ospLacksThreadVars):
|
if platform.OS[targetOS].props.contains(ospLacksThreadVars):
|
||||||
DefineSymbol("emulatedthreadvars")
|
DefineSymbol("emulatedthreadvars")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -889,17 +889,10 @@ proc evalRepr(c: PEvalContext, n: PNode): PNode =
|
||||||
proc isEmpty(n: PNode): bool =
|
proc isEmpty(n: PNode): bool =
|
||||||
result = n != nil and n.kind == nkEmpty
|
result = n != nil and n.kind == nkEmpty
|
||||||
|
|
||||||
# The lexer marks multi-line strings as residing at the line where they
|
|
||||||
# are closed. This function returns the line where the string begins
|
|
||||||
# Maybe the lexer should mark both the beginning and the end of expressions,
|
|
||||||
# then this function could be removed.
|
|
||||||
proc stringStartingLine(s: PNode): int =
|
|
||||||
result = s.info.line.int - countLines(s.strVal)
|
|
||||||
|
|
||||||
proc evalParseExpr(c: PEvalContext, n: PNode): PNode =
|
proc evalParseExpr(c: PEvalContext, n: PNode): PNode =
|
||||||
var code = evalAux(c, n.sons[1], {})
|
var code = evalAux(c, n.sons[1], {})
|
||||||
var ast = parseString(code.getStrValue, code.info.toFilename,
|
var ast = parseString(code.getStrValue, code.info.toFilename,
|
||||||
code.stringStartingLine)
|
code.info.line.int)
|
||||||
if sonsLen(ast) != 1:
|
if sonsLen(ast) != 1:
|
||||||
GlobalError(code.info, errExprExpected, "multiple statements")
|
GlobalError(code.info, errExprExpected, "multiple statements")
|
||||||
result = ast.sons[0]
|
result = ast.sons[0]
|
||||||
|
|
@ -908,7 +901,7 @@ proc evalParseExpr(c: PEvalContext, n: PNode): PNode =
|
||||||
proc evalParseStmt(c: PEvalContext, n: PNode): PNode =
|
proc evalParseStmt(c: PEvalContext, n: PNode): PNode =
|
||||||
var code = evalAux(c, n.sons[1], {})
|
var code = evalAux(c, n.sons[1], {})
|
||||||
result = parseString(code.getStrValue, code.info.toFilename,
|
result = parseString(code.getStrValue, code.info.toFilename,
|
||||||
code.stringStartingLine)
|
code.info.line.int)
|
||||||
#result.typ = newType(tyStmt, c.module)
|
#result.typ = newType(tyStmt, c.module)
|
||||||
|
|
||||||
proc evalTypeTrait*(n: PNode, context: PSym): PNode =
|
proc evalTypeTrait*(n: PNode, context: PSym): PNode =
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ type
|
||||||
# or float literals
|
# or float literals
|
||||||
literal*: string # the parsed (string) literal; and
|
literal*: string # the parsed (string) literal; and
|
||||||
# documentation comments are here too
|
# documentation comments are here too
|
||||||
|
line*, col*: int
|
||||||
|
|
||||||
TLexer* = object of TBaseLexer
|
TLexer* = object of TBaseLexer
|
||||||
fileIdx*: int32
|
fileIdx*: int32
|
||||||
|
|
@ -124,8 +125,10 @@ proc isKeyword*(kind: TTokType): bool
|
||||||
proc openLexer*(lex: var TLexer, fileidx: int32, inputstream: PLLStream)
|
proc openLexer*(lex: var TLexer, fileidx: int32, inputstream: PLLStream)
|
||||||
proc rawGetTok*(L: var TLexer, tok: var TToken)
|
proc rawGetTok*(L: var TLexer, tok: var TToken)
|
||||||
# reads in the next token into tok and skips it
|
# reads in the next token into tok and skips it
|
||||||
proc getColumn*(L: TLexer): int
|
|
||||||
proc getLineInfo*(L: TLexer): TLineInfo
|
proc getLineInfo*(L: TLexer, tok: TToken): TLineInfo {.inline.} =
|
||||||
|
newLineInfo(L.fileIdx, tok.line, tok.col)
|
||||||
|
|
||||||
proc closeLexer*(lex: var TLexer)
|
proc closeLexer*(lex: var TLexer)
|
||||||
proc PrintTok*(tok: TToken)
|
proc PrintTok*(tok: TToken)
|
||||||
proc tokToStr*(tok: TToken): string
|
proc tokToStr*(tok: TToken): string
|
||||||
|
|
@ -702,6 +705,8 @@ proc rawGetTok(L: var TLexer, tok: var TToken) =
|
||||||
tok.indent = -1
|
tok.indent = -1
|
||||||
skip(L, tok)
|
skip(L, tok)
|
||||||
var c = L.buf[L.bufpos]
|
var c = L.buf[L.bufpos]
|
||||||
|
tok.line = L.linenumber
|
||||||
|
tok.col = getColNumber(L, L.bufpos)
|
||||||
if c in SymStartChars - {'r', 'R', 'l'}:
|
if c in SymStartChars - {'r', 'R', 'l'}:
|
||||||
getSymbol(L, tok)
|
getSymbol(L, tok)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ import
|
||||||
wordrecg, sem, semdata, idents, passes, docgen, extccomp,
|
wordrecg, sem, semdata, idents, passes, docgen, extccomp,
|
||||||
cgen, jsgen, json, nversion,
|
cgen, jsgen, json, nversion,
|
||||||
platform, nimconf, importer, passaux, depends, evals, types, idgen,
|
platform, nimconf, importer, passaux, depends, evals, types, idgen,
|
||||||
tables, docgen2, service, parser, modules, ccgutils, sigmatch, ropes, lists
|
tables, docgen2, service, parser, modules, ccgutils, sigmatch, ropes, lists,
|
||||||
|
pretty
|
||||||
|
|
||||||
from magicsys import SystemModule, resetSysTypes
|
from magicsys import SystemModule, resetSysTypes
|
||||||
|
|
||||||
|
|
@ -162,12 +163,19 @@ proc commandEval(exp: string) =
|
||||||
var echoExp = "echo \"eval\\t\", " & "repr(" & exp & ")"
|
var echoExp = "echo \"eval\\t\", " & "repr(" & exp & ")"
|
||||||
evalNim(echoExp.parseString, makeStdinModule())
|
evalNim(echoExp.parseString, makeStdinModule())
|
||||||
|
|
||||||
proc CommandPretty =
|
proc CommandPrettyOld =
|
||||||
var projectFile = addFileExt(mainCommandArg(), NimExt)
|
var projectFile = addFileExt(mainCommandArg(), NimExt)
|
||||||
var module = parseFile(projectFile.fileInfoIdx)
|
var module = parseFile(projectFile.fileInfoIdx)
|
||||||
if module != nil:
|
if module != nil:
|
||||||
renderModule(module, getOutFile(mainCommandArg(), "pretty." & NimExt))
|
renderModule(module, getOutFile(mainCommandArg(), "pretty." & NimExt))
|
||||||
|
|
||||||
|
proc CommandPretty =
|
||||||
|
msgs.gErrorMax = high(int) # do not stop after first error
|
||||||
|
semanticPasses()
|
||||||
|
registerPass(prettyPass)
|
||||||
|
compileProject()
|
||||||
|
pretty.overwriteFiles()
|
||||||
|
|
||||||
proc CommandScan =
|
proc CommandScan =
|
||||||
var f = addFileExt(mainCommandArg(), nimExt)
|
var f = addFileExt(mainCommandArg(), nimExt)
|
||||||
var stream = LLStreamOpen(f, fmRead)
|
var stream = LLStreamOpen(f, fmRead)
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ proc checkSymbol(L: TLexer, tok: TToken) =
|
||||||
proc parseAssignment(L: var TLexer, tok: var TToken) =
|
proc parseAssignment(L: var TLexer, tok: var TToken) =
|
||||||
if tok.ident.id == getIdent("-").id or tok.ident.id == getIdent("--").id:
|
if tok.ident.id == getIdent("-").id or tok.ident.id == getIdent("--").id:
|
||||||
confTok(L, tok) # skip unnecessary prefix
|
confTok(L, tok) # skip unnecessary prefix
|
||||||
var info = getLineInfo(L) # safe for later in case of an error
|
var info = getLineInfo(L, tok) # safe for later in case of an error
|
||||||
checkSymbol(L, tok)
|
checkSymbol(L, tok)
|
||||||
var s = tokToStr(tok)
|
var s = tokToStr(tok)
|
||||||
confTok(L, tok) # skip symbol
|
confTok(L, tok) # skip symbol
|
||||||
|
|
@ -176,7 +176,7 @@ proc parseAssignment(L: var TLexer, tok: var TToken) =
|
||||||
add(val, tokToStr(tok))
|
add(val, tokToStr(tok))
|
||||||
confTok(L, tok)
|
confTok(L, tok)
|
||||||
if tok.tokType == tkBracketRi: confTok(L, tok)
|
if tok.tokType == tkBracketRi: confTok(L, tok)
|
||||||
else: lexMessage(L, errTokenExpected, "\']\'")
|
else: lexMessage(L, errTokenExpected, "']'")
|
||||||
add(val, ']')
|
add(val, ']')
|
||||||
if tok.tokType in {tkColon, tkEquals}:
|
if tok.tokType in {tkColon, tkEquals}:
|
||||||
if len(val) > 0: add(val, ':')
|
if len(val) > 0: add(val, ':')
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ proc Eat(p: var TParser, TokType: TTokType) =
|
||||||
else: lexMessage(p.lex, errTokenExpected, TokTypeToStr[tokType])
|
else: lexMessage(p.lex, errTokenExpected, TokTypeToStr[tokType])
|
||||||
|
|
||||||
proc parLineInfo(p: TParser): TLineInfo =
|
proc parLineInfo(p: TParser): TLineInfo =
|
||||||
result = getLineInfo(p.lex)
|
result = getLineInfo(p.lex, p.tok)
|
||||||
|
|
||||||
proc indAndComment(p: var TParser, n: PNode) =
|
proc indAndComment(p: var TParser, n: PNode) =
|
||||||
if p.tok.indent > p.currInd:
|
if p.tok.indent > p.currInd:
|
||||||
|
|
@ -154,7 +154,7 @@ proc indAndComment(p: var TParser, n: PNode) =
|
||||||
skipComment(p, n)
|
skipComment(p, n)
|
||||||
|
|
||||||
proc newNodeP(kind: TNodeKind, p: TParser): PNode =
|
proc newNodeP(kind: TNodeKind, p: TParser): PNode =
|
||||||
result = newNodeI(kind, getLineInfo(p.lex))
|
result = newNodeI(kind, parLineInfo(p))
|
||||||
|
|
||||||
proc newIntNodeP(kind: TNodeKind, intVal: BiggestInt, p: TParser): PNode =
|
proc newIntNodeP(kind: TNodeKind, intVal: BiggestInt, p: TParser): PNode =
|
||||||
result = newNodeP(kind, p)
|
result = newNodeP(kind, p)
|
||||||
|
|
@ -350,7 +350,7 @@ proc exprList(p: var TParser, endTok: TTokType, result: PNode) =
|
||||||
|
|
||||||
proc dotExpr(p: var TParser, a: PNode): PNode =
|
proc dotExpr(p: var TParser, a: PNode): PNode =
|
||||||
#| dotExpr = expr '.' optInd ('type' | 'addr' | symbol)
|
#| dotExpr = expr '.' optInd ('type' | 'addr' | symbol)
|
||||||
var info = p.lex.getlineInfo
|
var info = p.parLineInfo
|
||||||
getTok(p)
|
getTok(p)
|
||||||
optInd(p, a)
|
optInd(p, a)
|
||||||
case p.tok.tokType
|
case p.tok.tokType
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ proc pragmaAsm*(c: PContext, n: PNode): char =
|
||||||
if n != nil:
|
if n != nil:
|
||||||
for i in countup(0, sonsLen(n) - 1):
|
for i in countup(0, sonsLen(n) - 1):
|
||||||
let it = n.sons[i]
|
let it = n.sons[i]
|
||||||
if (it.kind == nkExprColonExpr) and (it.sons[0].kind == nkIdent):
|
if it.kind == nkExprColonExpr and it.sons[0].kind == nkIdent:
|
||||||
case whichKeyword(it.sons[0].ident)
|
case whichKeyword(it.sons[0].ident)
|
||||||
of wSubsChar:
|
of wSubsChar:
|
||||||
if it.sons[1].kind == nkCharLit: result = chr(int(it.sons[1].intVal))
|
if it.sons[1].kind == nkCharLit: result = chr(int(it.sons[1].intVal))
|
||||||
|
|
@ -86,6 +86,9 @@ proc pragmaAsm*(c: PContext, n: PNode): char =
|
||||||
|
|
||||||
proc setExternName(s: PSym, extname: string) =
|
proc setExternName(s: PSym, extname: string) =
|
||||||
s.loc.r = toRope(extname % s.name.s)
|
s.loc.r = toRope(extname % s.name.s)
|
||||||
|
if gCmd == cmdPretty and '$' notin extname:
|
||||||
|
# note that '{.importc.}' is transformed into '{.importc: "$1".}'
|
||||||
|
s.loc.flags.incl(lfFullExternalName)
|
||||||
|
|
||||||
proc MakeExternImport(s: PSym, extname: string) =
|
proc MakeExternImport(s: PSym, extname: string) =
|
||||||
setExternName(s, extname)
|
setExternName(s, extname)
|
||||||
|
|
@ -513,11 +516,11 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||||
if k in validPragmas:
|
if k in validPragmas:
|
||||||
case k
|
case k
|
||||||
of wExportc:
|
of wExportc:
|
||||||
makeExternExport(sym, getOptionalStr(c, it, sym.name.s))
|
makeExternExport(sym, getOptionalStr(c, it, "$1"))
|
||||||
incl(sym.flags, sfUsed) # avoid wrong hints
|
incl(sym.flags, sfUsed) # avoid wrong hints
|
||||||
of wImportc: makeExternImport(sym, getOptionalStr(c, it, sym.name.s))
|
of wImportc: makeExternImport(sym, getOptionalStr(c, it, "$1"))
|
||||||
of wImportCompilerProc:
|
of wImportCompilerProc:
|
||||||
processImportCompilerProc(sym, getOptionalStr(c, it, sym.name.s))
|
processImportCompilerProc(sym, getOptionalStr(c, it, "$1"))
|
||||||
of wExtern: setExternName(sym, expectStrLit(c, it))
|
of wExtern: setExternName(sym, expectStrLit(c, it))
|
||||||
of wImmediate:
|
of wImmediate:
|
||||||
if sym.kind in {skTemplate, skMacro}: incl(sym.flags, sfImmediate)
|
if sym.kind in {skTemplate, skMacro}: incl(sym.flags, sfImmediate)
|
||||||
|
|
@ -526,9 +529,9 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||||
if sym.kind == skTemplate: incl(sym.flags, sfDirty)
|
if sym.kind == skTemplate: incl(sym.flags, sfDirty)
|
||||||
else: invalidPragma(it)
|
else: invalidPragma(it)
|
||||||
of wImportCpp:
|
of wImportCpp:
|
||||||
processImportCpp(sym, getOptionalStr(c, it, sym.name.s))
|
processImportCpp(sym, getOptionalStr(c, it, "$1"))
|
||||||
of wImportObjC:
|
of wImportObjC:
|
||||||
processImportObjC(sym, getOptionalStr(c, it, sym.name.s))
|
processImportObjC(sym, getOptionalStr(c, it, "$1"))
|
||||||
of wAlign:
|
of wAlign:
|
||||||
if sym.typ == nil: invalidPragma(it)
|
if sym.typ == nil: invalidPragma(it)
|
||||||
var align = expectIntLit(c, it)
|
var align = expectIntLit(c, it)
|
||||||
|
|
@ -598,7 +601,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
|
||||||
processDynLib(c, it, sym)
|
processDynLib(c, it, sym)
|
||||||
of wCompilerProc:
|
of wCompilerProc:
|
||||||
noVal(it) # compilerproc may not get a string!
|
noVal(it) # compilerproc may not get a string!
|
||||||
makeExternExport(sym, sym.name.s)
|
makeExternExport(sym, "$1")
|
||||||
incl(sym.flags, sfCompilerProc)
|
incl(sym.flags, sfCompilerProc)
|
||||||
incl(sym.flags, sfUsed) # suppress all those stupid warnings
|
incl(sym.flags, sfUsed) # suppress all those stupid warnings
|
||||||
registerCompilerProc(sym)
|
registerCompilerProc(sym)
|
||||||
|
|
|
||||||
180
compiler/pretty.nim
Normal file
180
compiler/pretty.nim
Normal file
|
|
@ -0,0 +1,180 @@
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# The Nimrod Compiler
|
||||||
|
# (c) Copyright 2013 Andreas Rumpf
|
||||||
|
#
|
||||||
|
# See the file "copying.txt", included in this
|
||||||
|
# distribution, for details about the copyright.
|
||||||
|
#
|
||||||
|
|
||||||
|
## This module implements the code "prettifier". This is part of the toolchain
|
||||||
|
## to convert Nimrod code into a consistent style.
|
||||||
|
|
||||||
|
import
|
||||||
|
strutils, os, options, ast, astalgo, msgs, ropes, idents, passes,
|
||||||
|
intsets, strtabs
|
||||||
|
|
||||||
|
const
|
||||||
|
removeTP = false # when true, "nimrod pretty" converts TTyp to Typ.
|
||||||
|
|
||||||
|
type
|
||||||
|
TGen = object of TPassContext
|
||||||
|
module*: PSym
|
||||||
|
PGen = ref TGen
|
||||||
|
|
||||||
|
TSourceFile = object
|
||||||
|
lines: seq[string]
|
||||||
|
dirty: bool
|
||||||
|
fullpath: string
|
||||||
|
|
||||||
|
var
|
||||||
|
gSourceFiles: seq[TSourceFile] = @[]
|
||||||
|
rules: PStringTable
|
||||||
|
|
||||||
|
proc loadFile(info: TLineInfo) =
|
||||||
|
let i = info.fileIndex
|
||||||
|
if i >= gSourceFiles.len:
|
||||||
|
gSourceFiles.setLen(i+1)
|
||||||
|
if gSourceFiles[i].lines.isNil:
|
||||||
|
gSourceFiles[i].lines = @[]
|
||||||
|
let path = info.toFullPath
|
||||||
|
gSourceFiles[i].fullpath = path
|
||||||
|
# we want to die here for EIO:
|
||||||
|
for line in lines(path):
|
||||||
|
gSourceFiles[i].lines.add(line)
|
||||||
|
|
||||||
|
proc overwriteFiles*() =
|
||||||
|
for i in 0 .. high(gSourceFiles):
|
||||||
|
if not gSourceFiles[i].dirty: continue
|
||||||
|
let newFile = gSourceFiles[i].fullpath.changeFileExt(".pretty.nim")
|
||||||
|
try:
|
||||||
|
var f = open(newFile, fmWrite)
|
||||||
|
for line in gSourceFiles[i].lines:
|
||||||
|
f.writeln(line)
|
||||||
|
f.close
|
||||||
|
except EIO:
|
||||||
|
rawMessage(errCannotOpenFile, newFile)
|
||||||
|
|
||||||
|
proc beautifyName(s: string, k: TSymKind): string =
|
||||||
|
result = newStringOfCap(s.len)
|
||||||
|
var i = 0
|
||||||
|
case k
|
||||||
|
of skType, skGenericParam:
|
||||||
|
# skip leading 'T'
|
||||||
|
when removeTP:
|
||||||
|
if s[0] == 'T' and s[1] in {'A'..'Z'}:
|
||||||
|
i = 1
|
||||||
|
result.add toUpper(s[i])
|
||||||
|
of skConst, skEnumField:
|
||||||
|
# for 'const' we keep how it's spelt; either upper case or lower case:
|
||||||
|
result.add s[0]
|
||||||
|
else:
|
||||||
|
# as a special rule, don't transform 'L' to 'l'
|
||||||
|
if s.len == 1 and s[0] == 'L': result.add 'L'
|
||||||
|
else: result.add toLower(s[0])
|
||||||
|
inc i
|
||||||
|
let allUpper = allCharsInSet(s, {'A'..'Z', '0'..'9', '_'})
|
||||||
|
while i < s.len:
|
||||||
|
if s[i] == '_':
|
||||||
|
inc i
|
||||||
|
result.add toUpper(s[i])
|
||||||
|
elif allUpper:
|
||||||
|
result.add toLower(s[i])
|
||||||
|
else:
|
||||||
|
result.add s[i]
|
||||||
|
inc i
|
||||||
|
|
||||||
|
proc checkStyle*(info: TLineInfo, s: string, k: TSymKind) =
|
||||||
|
let beau = beautifyName(s, k)
|
||||||
|
if s != beau:
|
||||||
|
Message(info, errGenerated,
|
||||||
|
"name does not adhere to naming convention; should be: " & beau)
|
||||||
|
|
||||||
|
const
|
||||||
|
Letters = {'a'..'z', 'A'..'Z', '0'..'9', '\x80'..'\xFF', '_'}
|
||||||
|
|
||||||
|
proc identLen(line: string, start: int): int =
|
||||||
|
while start+result < line.len and line[start+result] in Letters:
|
||||||
|
inc result
|
||||||
|
|
||||||
|
proc differ(line: string, a, b: int, x: string): bool =
|
||||||
|
let y = line[a..b]
|
||||||
|
result = cmpIgnoreStyle(y, x) == 0 and y != x
|
||||||
|
when false:
|
||||||
|
var j = 0
|
||||||
|
for i in a..b:
|
||||||
|
if line[i] != x[j]: return true
|
||||||
|
inc j
|
||||||
|
return false
|
||||||
|
|
||||||
|
var cannotRename = initIntSet()
|
||||||
|
|
||||||
|
proc processSym(c: PPassContext, n: PNode): PNode =
|
||||||
|
result = n
|
||||||
|
var g = PGen(c)
|
||||||
|
case n.kind
|
||||||
|
of nkSym:
|
||||||
|
if n.info.fileIndex < 0: return
|
||||||
|
let s = n.sym
|
||||||
|
# operators stay as they are:
|
||||||
|
if s.kind in {skResult, skTemp} or s.name.s[0] notin Letters: return
|
||||||
|
if s.kind in {skType, skGenericParam} and sfAnon in s.flags: return
|
||||||
|
|
||||||
|
if s.id in cannotRename: return
|
||||||
|
|
||||||
|
let newName = if rules.hasKey(s.name.s): rules[s.name.s]
|
||||||
|
else: beautifyName(s.name.s, n.sym.kind)
|
||||||
|
|
||||||
|
loadFile(n.info)
|
||||||
|
|
||||||
|
let line = gSourceFiles[n.info.fileIndex].lines[n.info.line-1]
|
||||||
|
var first = n.info.col.int
|
||||||
|
if first < 0: return
|
||||||
|
#inc first, skipIgnoreCase(line, "proc ", first)
|
||||||
|
while first > 0 and line[first-1] in Letters: dec first
|
||||||
|
if line[first] == '`': inc first
|
||||||
|
|
||||||
|
if {sfImportc, sfExportc} * s.flags != {}:
|
||||||
|
# careful, we must ensure the resulting name still matches the external
|
||||||
|
# name:
|
||||||
|
if newName != s.name.s and newName != s.loc.r.ropeToStr and
|
||||||
|
lfFullExternalName notin s.loc.flags:
|
||||||
|
Message(n.info, errGenerated,
|
||||||
|
"cannot rename $# to $# due to external name" % [s.name.s, newName])
|
||||||
|
cannotRename.incl(s.id)
|
||||||
|
return
|
||||||
|
let last = first+identLen(line, first)-1
|
||||||
|
if last-first+1 != newName.len or differ(line, first, last, newName):
|
||||||
|
var x = line.subStr(0, first-1) & newName & line.substr(last+1)
|
||||||
|
when removeTP:
|
||||||
|
# the WinAPI module is full of 'TX = X' which after the substitution
|
||||||
|
# becomes 'X = X'. We remove those lines:
|
||||||
|
if x.match(peg"\s* {\ident} \s* '=' \s* y$1 ('#' .*)?"):
|
||||||
|
x = ""
|
||||||
|
|
||||||
|
system.shallowCopy(gSourceFiles[n.info.fileIndex].lines[n.info.line-1], x)
|
||||||
|
gSourceFiles[n.info.fileIndex].dirty = true
|
||||||
|
else:
|
||||||
|
for i in 0 .. <n.safeLen:
|
||||||
|
discard processSym(c, n.sons[i])
|
||||||
|
|
||||||
|
proc myOpen(module: PSym): PPassContext =
|
||||||
|
var g: PGen
|
||||||
|
new(g)
|
||||||
|
g.module = module
|
||||||
|
result = g
|
||||||
|
if rules.isNil:
|
||||||
|
rules = newStringTable(modeStyleInsensitive)
|
||||||
|
when removeTP:
|
||||||
|
# XXX activate when the T/P stuff is deprecated
|
||||||
|
let path = joinPath([getPrefixDir(), "config", "rename.rules.cfg"])
|
||||||
|
for line in lines(path):
|
||||||
|
if line.len > 0:
|
||||||
|
let colon = line.find(':')
|
||||||
|
if colon > 0:
|
||||||
|
rules[line.substr(0, colon-1)] = line.substr(colon+1)
|
||||||
|
else:
|
||||||
|
rules[line] = line
|
||||||
|
|
||||||
|
const prettyPass* = makePass(open = myOpen, process = processSym)
|
||||||
|
|
||||||
|
|
@ -45,14 +45,10 @@ proc addStmt(w: PRodWriter, n: PNode)
|
||||||
proc writeRod(w: PRodWriter)
|
proc writeRod(w: PRodWriter)
|
||||||
|
|
||||||
proc getDefines(): string =
|
proc getDefines(): string =
|
||||||
var it: TTabIter
|
|
||||||
var s = InitTabIter(it, gSymbols)
|
|
||||||
result = ""
|
result = ""
|
||||||
while s != nil:
|
for d in definedSymbolNames():
|
||||||
if s.position == 1:
|
if result.len != 0: add(result, " ")
|
||||||
if result.len != 0: add(result, " ")
|
add(result, d)
|
||||||
add(result, s.name.s)
|
|
||||||
s = nextIter(it, gSymbols)
|
|
||||||
|
|
||||||
proc fileIdx(w: PRodWriter, filename: string): int =
|
proc fileIdx(w: PRodWriter, filename: string): int =
|
||||||
for i in countup(0, high(w.files)):
|
for i in countup(0, high(w.files)):
|
||||||
|
|
|
||||||
|
|
@ -431,7 +431,7 @@ proc semConst(c: PContext, n: PNode): PNode =
|
||||||
var b = newNodeI(nkConstDef, a.info)
|
var b = newNodeI(nkConstDef, a.info)
|
||||||
if importantComments(): b.comment = a.comment
|
if importantComments(): b.comment = a.comment
|
||||||
addSon(b, newSymNode(v))
|
addSon(b, newSymNode(v))
|
||||||
addSon(b, ast.emptyNode) # no type description
|
addSon(b, a.sons[1])
|
||||||
addSon(b, copyTree(def))
|
addSon(b, copyTree(def))
|
||||||
addSon(result, b)
|
addSon(result, b)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -601,7 +601,7 @@ proc paramTypeClass(c: PContext, paramType: PType, procKind: TSymKind):
|
||||||
result.typ = newTypeS(tyExpr, c)
|
result.typ = newTypeS(tyExpr, c)
|
||||||
result.typ.sons = paramType.sons
|
result.typ.sons = paramType.sons
|
||||||
of tyTypeDesc:
|
of tyTypeDesc:
|
||||||
if tfInstantiated notin paramType.flags:
|
if tfInstantiated notin paramType.flags:
|
||||||
result.typ = newTypeS(tyTypeDesc, c)
|
result.typ = newTypeS(tyTypeDesc, c)
|
||||||
result.typ.sons = paramType.sons
|
result.typ.sons = paramType.sons
|
||||||
of tyDistinct:
|
of tyDistinct:
|
||||||
|
|
@ -719,8 +719,8 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
|
||||||
if skipTypes(typ, {tyGenericInst}).kind == tyEmpty: continue
|
if skipTypes(typ, {tyGenericInst}).kind == tyEmpty: continue
|
||||||
for j in countup(0, length-3):
|
for j in countup(0, length-3):
|
||||||
var arg = newSymG(skParam, a.sons[j], c)
|
var arg = newSymG(skParam, a.sons[j], c)
|
||||||
var finalType = liftParamType(c, kind, genericParams, typ,
|
var finalType = liftParamType(c, kind, genericParams, typ, arg.name.s,
|
||||||
arg.name.s, arg.info).skipIntLit
|
a.sons[length-2].info).skipIntLit
|
||||||
arg.typ = finalType
|
arg.typ = finalType
|
||||||
arg.position = counter
|
arg.position = counter
|
||||||
arg.constraint = constraint
|
arg.constraint = constraint
|
||||||
|
|
|
||||||
|
|
@ -205,13 +205,11 @@ proc findClosestCall(n: PNode): PNode =
|
||||||
if result != nil: return
|
if result != nil: return
|
||||||
|
|
||||||
proc isTracked(current: TLineInfo, tokenLen: int): bool =
|
proc isTracked(current: TLineInfo, tokenLen: int): bool =
|
||||||
# the column of an identifier is at its *end*, so we subtract to get the
|
|
||||||
# start of it.
|
|
||||||
for i in countup(0, high(checkPoints)):
|
for i in countup(0, high(checkPoints)):
|
||||||
if current.fileIndex == checkPoints[i].fileIndex:
|
if current.fileIndex == checkPoints[i].fileIndex:
|
||||||
if current.line == checkPoints[i].line:
|
if current.line == checkPoints[i].line:
|
||||||
let col = checkPoints[i].col
|
let col = checkPoints[i].col
|
||||||
if col >= current.col-tokenLen and col <= current.col:
|
if col >= current.col and col <= current.col+tokenLen-1:
|
||||||
return true
|
return true
|
||||||
|
|
||||||
proc findClosestSym(n: PNode): PNode =
|
proc findClosestSym(n: PNode): PNode =
|
||||||
|
|
|
||||||
153
compiler/vm.nim
153
compiler/vm.nim
|
|
@ -10,7 +10,11 @@
|
||||||
## This file implements the new evaluation engine for Nimrod code.
|
## This file implements the new evaluation engine for Nimrod code.
|
||||||
## An instruction is 1-2 int32s in memory, it is a register based VM.
|
## An instruction is 1-2 int32s in memory, it is a register based VM.
|
||||||
|
|
||||||
import ast, astalgo, msgs, vmdef, vmgen, nimsets, types, passes, unsigned
|
import
|
||||||
|
strutils, ast, astalgo, msgs, vmdef, vmgen, nimsets, types, passes, unsigned,
|
||||||
|
parser, vmdeps
|
||||||
|
|
||||||
|
from semfold import leValueConv
|
||||||
|
|
||||||
type
|
type
|
||||||
PStackFrame* = ref TStackFrame
|
PStackFrame* = ref TStackFrame
|
||||||
|
|
@ -70,6 +74,10 @@ template decodeBC(k: expr) {.immediate, dirty.} =
|
||||||
let rc = instr.regC
|
let rc = instr.regC
|
||||||
ensureKind(k)
|
ensureKind(k)
|
||||||
|
|
||||||
|
template declBC() {.immediate, dirty.} =
|
||||||
|
let rb = instr.regB
|
||||||
|
let rc = instr.regC
|
||||||
|
|
||||||
template decodeBImm(k: expr) {.immediate, dirty.} =
|
template decodeBImm(k: expr) {.immediate, dirty.} =
|
||||||
let rb = instr.regB
|
let rb = instr.regB
|
||||||
let imm = instr.regC - byteExcess
|
let imm = instr.regC - byteExcess
|
||||||
|
|
@ -79,10 +87,6 @@ template decodeBx(k: expr) {.immediate, dirty.} =
|
||||||
let rbx = instr.regBx - wordExcess
|
let rbx = instr.regBx - wordExcess
|
||||||
ensureKind(k)
|
ensureKind(k)
|
||||||
|
|
||||||
proc compile(c: PCtx, s: PSym): int =
|
|
||||||
result = vmgen.genProc(c, s)
|
|
||||||
c.echoCode
|
|
||||||
|
|
||||||
proc myreset(n: PNode) =
|
proc myreset(n: PNode) =
|
||||||
when defined(system.reset):
|
when defined(system.reset):
|
||||||
var oldInfo = n.info
|
var oldInfo = n.info
|
||||||
|
|
@ -130,18 +134,14 @@ proc pushSafePoint(f: PStackFrame; pc: int) =
|
||||||
|
|
||||||
proc popSafePoint(f: PStackFrame) = discard f.safePoints.pop()
|
proc popSafePoint(f: PStackFrame) = discard f.safePoints.pop()
|
||||||
|
|
||||||
proc nextSafePoint(f: PStackFrame): int =
|
|
||||||
var f = f
|
|
||||||
while f.safePoints.isNil or f.safePoints.len == 0:
|
|
||||||
f = f.next
|
|
||||||
if f.isNil: return -1
|
|
||||||
result = f.safePoints.pop
|
|
||||||
|
|
||||||
proc cleanUpOnException(c: PCtx; tos: PStackFrame; regs: TNodeSeq): int =
|
proc cleanUpOnException(c: PCtx; tos: PStackFrame; regs: TNodeSeq): int =
|
||||||
let raisedType = c.currentExceptionA.typ.skipTypes(abstractPtrs)
|
let raisedType = c.currentExceptionA.typ.skipTypes(abstractPtrs)
|
||||||
|
var f = tos
|
||||||
while true:
|
while true:
|
||||||
var pc2 = tos.nextSafePoint
|
while f.safePoints.isNil or f.safePoints.len == 0:
|
||||||
if pc2 == -1: return -1
|
f = f.next
|
||||||
|
if f.isNil: return -1
|
||||||
|
var pc2 = f.safePoints[f.safePoints.high]
|
||||||
|
|
||||||
var nextExceptOrFinally = -1
|
var nextExceptOrFinally = -1
|
||||||
if c.code[pc2].opcode == opcExcept:
|
if c.code[pc2].opcode == opcExcept:
|
||||||
|
|
@ -163,6 +163,8 @@ proc cleanUpOnException(c: PCtx; tos: PStackFrame; regs: TNodeSeq): int =
|
||||||
if c.code[pc2].opcode == opcFinally:
|
if c.code[pc2].opcode == opcFinally:
|
||||||
# execute the corresponding handler, but don't quit walking the stack:
|
# execute the corresponding handler, but don't quit walking the stack:
|
||||||
return pc2
|
return pc2
|
||||||
|
# not the right one:
|
||||||
|
discard f.safePoints.pop
|
||||||
|
|
||||||
proc cleanUpOnReturn(c: PCtx; f: PStackFrame): int =
|
proc cleanUpOnReturn(c: PCtx; f: PStackFrame): int =
|
||||||
if f.safePoints.isNil: return -1
|
if f.safePoints.isNil: return -1
|
||||||
|
|
@ -174,6 +176,10 @@ proc cleanUpOnReturn(c: PCtx; f: PStackFrame): int =
|
||||||
return pc
|
return pc
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
proc compile(c: PCtx, s: PSym): int =
|
||||||
|
result = vmgen.genProc(c, s)
|
||||||
|
#c.echoCode
|
||||||
|
|
||||||
proc execute(c: PCtx, start: int) =
|
proc execute(c: PCtx, start: int) =
|
||||||
var pc = start
|
var pc = start
|
||||||
var regs: TNodeSeq # alias to tos.slots for performance
|
var regs: TNodeSeq # alias to tos.slots for performance
|
||||||
|
|
@ -183,16 +189,17 @@ proc execute(c: PCtx, start: int) =
|
||||||
{.interpreterLoop.}
|
{.interpreterLoop.}
|
||||||
let instr = c.code[pc]
|
let instr = c.code[pc]
|
||||||
let ra = instr.regA
|
let ra = instr.regA
|
||||||
echo "PC ", pc, " ", c.code[pc].opcode, " ra ", ra
|
#echo "PC ", pc, " ", c.code[pc].opcode, " ra ", ra
|
||||||
case instr.opcode
|
case instr.opcode
|
||||||
of opcEof: break
|
of opcEof: break
|
||||||
of opcRet:
|
of opcRet:
|
||||||
# XXX perform any cleanup actions
|
# XXX perform any cleanup actions
|
||||||
|
pc = tos.comesFrom
|
||||||
tos = tos.next
|
tos = tos.next
|
||||||
if tos.isNil: return
|
if tos.isNil: return
|
||||||
|
|
||||||
let retVal = regs[0]
|
let retVal = regs[0]
|
||||||
move(regs, tos.slots)
|
move(regs, tos.slots)
|
||||||
pc = tos.comesFrom
|
|
||||||
assert c.code[pc].opcode in {opcIndCall, opcIndCallAsgn}
|
assert c.code[pc].opcode in {opcIndCall, opcIndCallAsgn}
|
||||||
if c.code[pc].opcode == opcIndCallAsgn:
|
if c.code[pc].opcode == opcIndCallAsgn:
|
||||||
regs[c.code[pc].regA] = retVal
|
regs[c.code[pc].regA] = retVal
|
||||||
|
|
@ -222,6 +229,10 @@ proc execute(c: PCtx, start: int) =
|
||||||
let idx = regs[rc].intVal
|
let idx = regs[rc].intVal
|
||||||
# XXX what if the array is not 0-based? -> codegen should insert a sub
|
# XXX what if the array is not 0-based? -> codegen should insert a sub
|
||||||
regs[ra] = regs[rb].sons[idx.int]
|
regs[ra] = regs[rb].sons[idx.int]
|
||||||
|
of opcLdStrIdx:
|
||||||
|
decodeBC(nkIntLit)
|
||||||
|
let idx = regs[rc].intVal
|
||||||
|
regs[ra].intVal = regs[rb].strVal[idx.int].ord
|
||||||
of opcWrArr:
|
of opcWrArr:
|
||||||
# a[b] = c
|
# a[b] = c
|
||||||
let rb = instr.regB
|
let rb = instr.regB
|
||||||
|
|
@ -277,7 +288,8 @@ proc execute(c: PCtx, start: int) =
|
||||||
regs[ra].intVal = regs[rb].intVal - imm
|
regs[ra].intVal = regs[rb].intVal - imm
|
||||||
of opcLenSeq:
|
of opcLenSeq:
|
||||||
decodeBImm(nkIntLit)
|
decodeBImm(nkIntLit)
|
||||||
assert regs[rb].kind == nkBracket
|
#assert regs[rb].kind == nkBracket
|
||||||
|
# also used by mNLen
|
||||||
regs[ra].intVal = regs[rb].len - imm
|
regs[ra].intVal = regs[rb].len - imm
|
||||||
of opcLenStr:
|
of opcLenStr:
|
||||||
decodeBImm(nkIntLit)
|
decodeBImm(nkIntLit)
|
||||||
|
|
@ -432,6 +444,15 @@ proc execute(c: PCtx, start: int) =
|
||||||
regs[ra].strVal = getstr(regs[rb])
|
regs[ra].strVal = getstr(regs[rb])
|
||||||
for i in rb+1..rb+rc-1:
|
for i in rb+1..rb+rc-1:
|
||||||
regs[ra].strVal.add getstr(regs[i])
|
regs[ra].strVal.add getstr(regs[i])
|
||||||
|
of opcAddStrCh:
|
||||||
|
decodeB(nkStrLit)
|
||||||
|
regs[ra].strVal.add(regs[rb].intVal.chr)
|
||||||
|
of opcAddStrStr:
|
||||||
|
decodeB(nkStrLit)
|
||||||
|
regs[ra].strVal.add(regs[rb].strVal)
|
||||||
|
of opcAddSeqElem:
|
||||||
|
decodeB(nkBracket)
|
||||||
|
regs[ra].add(copyTree(regs[rb]))
|
||||||
of opcEcho:
|
of opcEcho:
|
||||||
echo regs[ra].strVal
|
echo regs[ra].strVal
|
||||||
of opcContainsSet:
|
of opcContainsSet:
|
||||||
|
|
@ -444,6 +465,14 @@ proc execute(c: PCtx, start: int) =
|
||||||
let rd = c.code[pc].regA
|
let rd = c.code[pc].regA
|
||||||
regs[ra].strVal = substr(regs[rb].strVal, regs[rc].intVal.int,
|
regs[ra].strVal = substr(regs[rb].strVal, regs[rc].intVal.int,
|
||||||
regs[rd].intVal.int)
|
regs[rd].intVal.int)
|
||||||
|
of opcRangeChck:
|
||||||
|
let rb = instr.regB
|
||||||
|
let rc = instr.regC
|
||||||
|
if not (leValueConv(regs[rb], regs[ra]) and
|
||||||
|
leValueConv(regs[ra], regs[rc])):
|
||||||
|
stackTrace(c, tos, pc, errGenerated,
|
||||||
|
msgKindToString(errIllegalConvFromXtoY) % [
|
||||||
|
"unknown type" , "unknown type"])
|
||||||
of opcIndCall, opcIndCallAsgn:
|
of opcIndCall, opcIndCallAsgn:
|
||||||
# dest = call regStart, n; where regStart = fn, arg1, ...
|
# dest = call regStart, n; where regStart = fn, arg1, ...
|
||||||
let rb = instr.regB
|
let rb = instr.regB
|
||||||
|
|
@ -462,7 +491,8 @@ proc execute(c: PCtx, start: int) =
|
||||||
newFrame.slots[i] = newNode(nkEmpty)
|
newFrame.slots[i] = newNode(nkEmpty)
|
||||||
tos = newFrame
|
tos = newFrame
|
||||||
move(regs, newFrame.slots)
|
move(regs, newFrame.slots)
|
||||||
pc = newPc
|
# -1 for the following 'inc pc'
|
||||||
|
pc = newPc-1
|
||||||
of opcTJmp:
|
of opcTJmp:
|
||||||
# jump Bx if A != 0
|
# jump Bx if A != 0
|
||||||
let rbx = instr.regBx - wordExcess - 1 # -1 for the following 'inc pc'
|
let rbx = instr.regBx - wordExcess - 1 # -1 for the following 'inc pc'
|
||||||
|
|
@ -544,10 +574,95 @@ proc execute(c: PCtx, start: int) =
|
||||||
regs[ra] = getNullValue(typ, c.debug[pc])
|
regs[ra] = getNullValue(typ, c.debug[pc])
|
||||||
of opcLdConst:
|
of opcLdConst:
|
||||||
regs[ra] = c.constants.sons[instr.regBx - wordExcess]
|
regs[ra] = c.constants.sons[instr.regBx - wordExcess]
|
||||||
|
of opcAsgnConst:
|
||||||
|
let rb = instr.regBx - wordExcess
|
||||||
|
if regs[ra].isNil:
|
||||||
|
regs[ra] = copyTree(c.constants.sons[rb])
|
||||||
|
else:
|
||||||
|
asgnComplex(regs[ra], c.constants.sons[rb])
|
||||||
of opcNBindSym:
|
of opcNBindSym:
|
||||||
# trivial implementation:
|
# trivial implementation:
|
||||||
let rb = instr.regB
|
let rb = instr.regB
|
||||||
regs[ra] = regs[rb].sons[1]
|
regs[ra] = regs[rb].sons[1]
|
||||||
|
of opcNChild:
|
||||||
|
let rb = instr.regB
|
||||||
|
let rc = instr.regC
|
||||||
|
regs[ra] = regs[rb].sons[regs[rc].intVal.int]
|
||||||
|
of opcNSetChild:
|
||||||
|
let rb = instr.regB
|
||||||
|
let rc = instr.regC
|
||||||
|
regs[ra].sons[regs[rb].intVal.int] = regs[rc]
|
||||||
|
of opcNAdd:
|
||||||
|
declBC()
|
||||||
|
regs[rb].add(regs[rb])
|
||||||
|
regs[ra] = regs[rb]
|
||||||
|
of opcNAddMultiple:
|
||||||
|
declBC()
|
||||||
|
let x = regs[rc]
|
||||||
|
# XXX can be optimized:
|
||||||
|
for i in 0.. <x.len: regs[rb].add(x.sons[i])
|
||||||
|
regs[ra] = regs[rb]
|
||||||
|
of opcNKind:
|
||||||
|
decodeB(nkIntLit)
|
||||||
|
regs[ra].intVal = ord(regs[rb].kind)
|
||||||
|
of opcNIntVal:
|
||||||
|
decodeB(nkIntLit)
|
||||||
|
let a = regs[rb]
|
||||||
|
case a.kind
|
||||||
|
of nkCharLit..nkInt64Lit: regs[ra].intVal = a.intVal
|
||||||
|
else: stackTrace(c, tos, pc, errFieldXNotFound, "intVal")
|
||||||
|
of opcNFloatVal:
|
||||||
|
decodeB(nkFloatLit)
|
||||||
|
let a = regs[rb]
|
||||||
|
case a.kind
|
||||||
|
of nkFloatLit..nkFloat64Lit: regs[ra].floatVal = a.floatVal
|
||||||
|
else: stackTrace(c, tos, pc, errFieldXNotFound, "floatVal")
|
||||||
|
of opcNSymbol:
|
||||||
|
let rb = instr.regB
|
||||||
|
if regs[rb].kind != nkSym:
|
||||||
|
stackTrace(c, tos, pc, errFieldXNotFound, "symbol")
|
||||||
|
regs[ra] = regs[rb]
|
||||||
|
of opcNIdent:
|
||||||
|
let rb = instr.regB
|
||||||
|
if regs[rb].kind != nkIdent:
|
||||||
|
stackTrace(c, tos, pc, errFieldXNotFound, "ident")
|
||||||
|
regs[ra] = regs[rb]
|
||||||
|
of opcNGetType:
|
||||||
|
InternalError(c.debug[pc], "unknown opcode " & $instr.opcode)
|
||||||
|
of opcNStrVal:
|
||||||
|
decodeB(nkStrLit)
|
||||||
|
let a = regs[rb]
|
||||||
|
case a.kind
|
||||||
|
of nkStrLit..nkTripleStrLit: regs[ra].strVal = a.strVal
|
||||||
|
else: stackTrace(c, tos, pc, errFieldXNotFound, "strVal")
|
||||||
|
of opcSlurp:
|
||||||
|
decodeB(nkStrLit)
|
||||||
|
regs[ra].strVal = opSlurp(regs[rb].strVal, c.debug[pc], c.module)
|
||||||
|
of opcGorge:
|
||||||
|
decodeBC(nkStrLit)
|
||||||
|
regs[ra].strVal = opGorge(regs[rb].strVal, regs[rc].strVal)
|
||||||
|
of opcNError:
|
||||||
|
stackTrace(c, tos, pc, errUser, regs[ra].strVal)
|
||||||
|
of opcNWarning:
|
||||||
|
Message(c.debug[pc], warnUser, regs[ra].strVal)
|
||||||
|
of opcNHint:
|
||||||
|
Message(c.debug[pc], hintUser, regs[ra].strVal)
|
||||||
|
of opcParseExprToAst:
|
||||||
|
let rb = instr.regB
|
||||||
|
# c.debug[pc].line.int - countLines(regs[rb].strVal) ?
|
||||||
|
let ast = parseString(regs[rb].strVal, c.debug[pc].toFilename,
|
||||||
|
c.debug[pc].line.int)
|
||||||
|
if sonsLen(ast) != 1:
|
||||||
|
GlobalError(c.debug[pc], errExprExpected, "multiple statements")
|
||||||
|
regs[ra] = ast.sons[0]
|
||||||
|
of opcParseStmtToAst:
|
||||||
|
let rb = instr.regB
|
||||||
|
let ast = parseString(regs[rb].strVal, c.debug[pc].toFilename,
|
||||||
|
c.debug[pc].line.int)
|
||||||
|
regs[ra] = ast
|
||||||
|
of opcCallSite:
|
||||||
|
if c.callsite != nil: regs[ra] = c.callsite
|
||||||
|
else: stackTrace(c, tos, pc, errFieldXNotFound, "callsite")
|
||||||
else:
|
else:
|
||||||
InternalError(c.debug[pc], "unknown opcode " & $instr.opcode)
|
InternalError(c.debug[pc], "unknown opcode " & $instr.opcode)
|
||||||
inc pc
|
inc pc
|
||||||
|
|
@ -566,7 +681,7 @@ proc myOpen(module: PSym): PPassContext =
|
||||||
#var c = newEvalContext(module, emRepl)
|
#var c = newEvalContext(module, emRepl)
|
||||||
#c.features = {allowCast, allowFFI, allowInfiniteLoops}
|
#c.features = {allowCast, allowFFI, allowInfiniteLoops}
|
||||||
#pushStackFrame(c, newStackFrame())
|
#pushStackFrame(c, newStackFrame())
|
||||||
result = newCtx()
|
result = newCtx(module)
|
||||||
|
|
||||||
var oldErrorCount: int
|
var oldErrorCount: int
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,6 @@ type
|
||||||
TDest* = range[-1 .. 255]
|
TDest* = range[-1 .. 255]
|
||||||
TInstr* = distinct uint32
|
TInstr* = distinct uint32
|
||||||
|
|
||||||
TInstrFormat = enum
|
|
||||||
ifABC, # three registers
|
|
||||||
ifABx, # A + extended B
|
|
||||||
|
|
||||||
TOpcode* = enum
|
TOpcode* = enum
|
||||||
opcEof, # end of code
|
opcEof, # end of code
|
||||||
opcRet, # return
|
opcRet, # return
|
||||||
|
|
@ -46,6 +42,7 @@ type
|
||||||
opcAddr,
|
opcAddr,
|
||||||
opcDeref,
|
opcDeref,
|
||||||
opcWrStrIdx,
|
opcWrStrIdx,
|
||||||
|
opcLdStrIdx, # a = b[c]
|
||||||
|
|
||||||
opcAddInt,
|
opcAddInt,
|
||||||
opcAddImmInt,
|
opcAddImmInt,
|
||||||
|
|
@ -66,12 +63,39 @@ type
|
||||||
opcSwap, opcIsNil, opcOf,
|
opcSwap, opcIsNil, opcOf,
|
||||||
opcSubStr, opcConv, opcCast, opcQuit, opcReset,
|
opcSubStr, opcConv, opcCast, opcQuit, opcReset,
|
||||||
|
|
||||||
|
opcAddStrCh,
|
||||||
|
opcAddStrStr,
|
||||||
|
opcAddSeqElem,
|
||||||
|
opcRangeChck,
|
||||||
|
|
||||||
|
opcNAdd,
|
||||||
|
opcNAddMultiple,
|
||||||
|
opcNKind,
|
||||||
|
opcNIntVal,
|
||||||
|
opcNFloatVal,
|
||||||
|
opcNSymbol,
|
||||||
|
opcNIdent,
|
||||||
|
opcNGetType,
|
||||||
|
opcNStrVal,
|
||||||
|
|
||||||
|
opcSlurp,
|
||||||
|
opcGorge,
|
||||||
|
opcParseExprToAst,
|
||||||
|
opcParseStmtToAst,
|
||||||
|
opcNError,
|
||||||
|
opcNWarning,
|
||||||
|
opcNHint,
|
||||||
|
|
||||||
opcEcho,
|
opcEcho,
|
||||||
opcIndCall, # dest = call regStart, n; where regStart = fn, arg1, ...
|
opcIndCall, # dest = call regStart, n; where regStart = fn, arg1, ...
|
||||||
opcIndCallAsgn, # dest = call regStart, n; where regStart = fn, arg1, ...
|
opcIndCallAsgn, # dest = call regStart, n; where regStart = fn, arg1, ...
|
||||||
|
|
||||||
opcRaise,
|
opcRaise,
|
||||||
|
opcNChild,
|
||||||
|
opcNSetChild,
|
||||||
opcNBindSym, # opcodes for the AST manipulation following
|
opcNBindSym, # opcodes for the AST manipulation following
|
||||||
|
opcCallSite,
|
||||||
|
opcNewStr,
|
||||||
|
|
||||||
opcTJmp, # jump Bx if A != 0
|
opcTJmp, # jump Bx if A != 0
|
||||||
opcFJmp, # jump Bx if A == 0
|
opcFJmp, # jump Bx if A == 0
|
||||||
|
|
@ -83,9 +107,9 @@ type
|
||||||
opcFinallyEnd,
|
opcFinallyEnd,
|
||||||
opcNew,
|
opcNew,
|
||||||
opcNewSeq,
|
opcNewSeq,
|
||||||
opcNewStr,
|
|
||||||
opcLdNull, # dest = nullvalue(types[Bx])
|
opcLdNull, # dest = nullvalue(types[Bx])
|
||||||
opcLdConst, # dest = constants[Bx]
|
opcLdConst, # dest = constants[Bx]
|
||||||
|
opcAsgnConst, # dest = copy(constants[Bx])
|
||||||
opcLdGlobal, # dest = globals[Bx]
|
opcLdGlobal, # dest = globals[Bx]
|
||||||
opcLdImmInt, # dest = immediate value
|
opcLdImmInt, # dest = immediate value
|
||||||
opcWrGlobal,
|
opcWrGlobal,
|
||||||
|
|
@ -100,7 +124,8 @@ type
|
||||||
# temporary slot usage. This is required for the parameter
|
# temporary slot usage. This is required for the parameter
|
||||||
# passing implementation.
|
# passing implementation.
|
||||||
slotEmpty, # slot is unused
|
slotEmpty, # slot is unused
|
||||||
slotFixed, # slot is used for a fixed var/param/result
|
slotFixedVar, # slot is used for a fixed var/result (requires copy then)
|
||||||
|
slotFixedLet, # slot is used for a fixed param/let
|
||||||
slotTempUnknown, # slot but type unknown (argument of proc call)
|
slotTempUnknown, # slot but type unknown (argument of proc call)
|
||||||
slotTempInt, # some temporary int
|
slotTempInt, # some temporary int
|
||||||
slotTempFloat, # some temporary float
|
slotTempFloat, # some temporary float
|
||||||
|
|
@ -117,30 +142,28 @@ type
|
||||||
code*: seq[TInstr]
|
code*: seq[TInstr]
|
||||||
debug*: seq[TLineInfo] # line info for every instruction; kept separate
|
debug*: seq[TLineInfo] # line info for every instruction; kept separate
|
||||||
# to not slow down interpretation
|
# to not slow down interpretation
|
||||||
jumpTargets*: TIntSet # we need to mark instructions that are
|
|
||||||
# jump targets;
|
|
||||||
# we must not optimize over a jump target and we
|
|
||||||
# need to generate a label for a jump target when
|
|
||||||
# producing a VM listing
|
|
||||||
globals*: PNode #
|
globals*: PNode #
|
||||||
constants*: PNode # constant data
|
constants*: PNode # constant data
|
||||||
types*: seq[PType] # some instructions reference types (e.g. 'except')
|
types*: seq[PType] # some instructions reference types (e.g. 'except')
|
||||||
currentExceptionA*, currentExceptionB*: PNode
|
currentExceptionA*, currentExceptionB*: PNode
|
||||||
exceptionInstr*: int # index of instruction that raised the exception
|
exceptionInstr*: int # index of instruction that raised the exception
|
||||||
prc*: PProc
|
prc*: PProc
|
||||||
|
module*: PSym
|
||||||
|
callsite*: PNode
|
||||||
|
|
||||||
TPosition* = distinct int
|
TPosition* = distinct int
|
||||||
|
|
||||||
proc newCtx*(): PCtx =
|
proc newCtx*(module: PSym): PCtx =
|
||||||
PCtx(code: @[], debug: @[], jumpTargets: initIntSet(),
|
PCtx(code: @[], debug: @[],
|
||||||
globals: newNode(nkStmtList), constants: newNode(nkStmtList), types: @[],
|
globals: newNode(nkStmtList), constants: newNode(nkStmtList), types: @[],
|
||||||
prc: PProc(blocks: @[]))
|
prc: PProc(blocks: @[]), module: module)
|
||||||
|
|
||||||
const
|
const
|
||||||
firstABxInstr* = opcTJmp
|
firstABxInstr* = opcTJmp
|
||||||
largeInstrs* = { # instructions which use 2 int32s instead of 1:
|
largeInstrs* = { # instructions which use 2 int32s instead of 1:
|
||||||
opcSubstr, opcConv, opcCast, opcNewSeq, opcOf}
|
opcSubstr, opcConv, opcCast, opcNewSeq, opcOf}
|
||||||
slotSomeTemp* = slotTempUnknown
|
slotSomeTemp* = slotTempUnknown
|
||||||
|
relativeJumps* = {opcTJmp, opcFJmp, opcJmp}
|
||||||
|
|
||||||
template opcode*(x: TInstr): TOpcode {.immediate.} = TOpcode(x.uint32 and 0xff'u32)
|
template opcode*(x: TInstr): TOpcode {.immediate.} = TOpcode(x.uint32 and 0xff'u32)
|
||||||
template regA*(x: TInstr): TRegister {.immediate.} = TRegister(x.uint32 shr 8'u32 and 0xff'u32)
|
template regA*(x: TInstr): TRegister {.immediate.} = TRegister(x.uint32 shr 8'u32 and 0xff'u32)
|
||||||
|
|
|
||||||
108
compiler/vmdeps.nim
Normal file
108
compiler/vmdeps.nim
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# The Nimrod Compiler
|
||||||
|
# (c) Copyright 2013 Andreas Rumpf
|
||||||
|
#
|
||||||
|
# See the file "copying.txt", included in this
|
||||||
|
# distribution, for details about the copyright.
|
||||||
|
#
|
||||||
|
|
||||||
|
import ast, msgs, osproc, streams, options
|
||||||
|
|
||||||
|
proc readOutput(p: PProcess): string =
|
||||||
|
result = ""
|
||||||
|
var output = p.outputStream
|
||||||
|
discard p.waitForExit
|
||||||
|
while not output.atEnd:
|
||||||
|
result.add(output.readLine)
|
||||||
|
|
||||||
|
proc opGorge*(cmd, input: string): string =
|
||||||
|
var p = startCmd(cmd)
|
||||||
|
if input.len != 0:
|
||||||
|
p.inputStream.write(input)
|
||||||
|
p.inputStream.close()
|
||||||
|
result = p.readOutput
|
||||||
|
|
||||||
|
proc opSlurp*(file: string, info: TLineInfo, module: PSym): string =
|
||||||
|
try:
|
||||||
|
let filename = file.FindFile
|
||||||
|
result = readFile(filename)
|
||||||
|
# we produce a fake include statement for every slurped filename, so that
|
||||||
|
# the module dependencies are accurate:
|
||||||
|
appendToModule(module, newNode(nkIncludeStmt, info, @[
|
||||||
|
newStrNode(nkStrLit, filename)]))
|
||||||
|
except EIO:
|
||||||
|
result = ""
|
||||||
|
LocalError(info, errCannotOpenFile, file)
|
||||||
|
|
||||||
|
when false:
|
||||||
|
proc opExpandToAst*(c: PEvalContext, original: PNode): PNode =
|
||||||
|
var
|
||||||
|
n = original.copyTree
|
||||||
|
macroCall = n.sons[1]
|
||||||
|
expandedSym = macroCall.sons[0].sym
|
||||||
|
|
||||||
|
for i in countup(1, macroCall.sonsLen - 1):
|
||||||
|
macroCall.sons[i] = evalAux(c, macroCall.sons[i], {})
|
||||||
|
|
||||||
|
case expandedSym.kind
|
||||||
|
of skTemplate:
|
||||||
|
let genSymOwner = if c.tos != nil and c.tos.prc != nil:
|
||||||
|
c.tos.prc
|
||||||
|
else:
|
||||||
|
c.module
|
||||||
|
result = evalTemplate(macroCall, expandedSym, genSymOwner)
|
||||||
|
of skMacro:
|
||||||
|
# At this point macroCall.sons[0] is nkSym node.
|
||||||
|
# To be completely compatible with normal macro invocation,
|
||||||
|
# we want to replace it with nkIdent node featuring
|
||||||
|
# the original unmangled macro name.
|
||||||
|
macroCall.sons[0] = newIdentNode(expandedSym.name, expandedSym.info)
|
||||||
|
result = evalMacroCall(c, macroCall, original, expandedSym)
|
||||||
|
else:
|
||||||
|
InternalError(macroCall.info,
|
||||||
|
"ExpandToAst: expanded symbol is no macro or template")
|
||||||
|
result = emptyNode
|
||||||
|
|
||||||
|
proc opTypeTrait*(n: PNode, context: PSym): PNode =
|
||||||
|
## XXX: This should be pretty much guaranteed to be true
|
||||||
|
# by the type traits procs' signatures, but until the
|
||||||
|
# code is more mature it doesn't hurt to be extra safe
|
||||||
|
internalAssert n.len >= 2 and n.sons[1].kind == nkSym
|
||||||
|
|
||||||
|
let typ = n.sons[1].sym.typ.skipTypes({tyTypeDesc})
|
||||||
|
case n.sons[0].sym.name.s.normalize
|
||||||
|
of "name":
|
||||||
|
result = newStrNode(nkStrLit, typ.typeToString(preferExported))
|
||||||
|
result.typ = newType(tyString, context)
|
||||||
|
result.info = n.info
|
||||||
|
else:
|
||||||
|
internalAssert false
|
||||||
|
|
||||||
|
proc opIs*(n: PNode): PNode =
|
||||||
|
InternalAssert n.sonsLen == 3 and
|
||||||
|
n[1].kind == nkSym and n[1].sym.kind == skType and
|
||||||
|
n[2].kind in {nkStrLit..nkTripleStrLit, nkType}
|
||||||
|
|
||||||
|
let t1 = n[1].sym.typ
|
||||||
|
|
||||||
|
if n[2].kind in {nkStrLit..nkTripleStrLit}:
|
||||||
|
case n[2].strVal.normalize
|
||||||
|
of "closure":
|
||||||
|
let t = skipTypes(t1, abstractRange)
|
||||||
|
result = newIntNode(nkIntLit, ord(t.kind == tyProc and
|
||||||
|
t.callConv == ccClosure and
|
||||||
|
tfIterator notin t.flags))
|
||||||
|
of "iterator":
|
||||||
|
let t = skipTypes(t1, abstractRange)
|
||||||
|
result = newIntNode(nkIntLit, ord(t.kind == tyProc and
|
||||||
|
t.callConv == ccClosure and
|
||||||
|
tfIterator in t.flags))
|
||||||
|
else:
|
||||||
|
let t2 = n[2].typ
|
||||||
|
var match = if t2.kind == tyTypeClass: matchTypeClass(t2, t1)
|
||||||
|
else: sameType(t1, t2)
|
||||||
|
result = newIntNode(nkIntLit, ord(match))
|
||||||
|
|
||||||
|
result.typ = n.typ
|
||||||
|
|
||||||
|
|
@ -14,18 +14,32 @@ import
|
||||||
trees, intsets, rodread
|
trees, intsets, rodread
|
||||||
|
|
||||||
proc codeListing(c: PCtx, result: var string) =
|
proc codeListing(c: PCtx, result: var string) =
|
||||||
|
# first iteration: compute all necessary labels:
|
||||||
|
var jumpTargets = initIntSet()
|
||||||
|
|
||||||
|
for i in 0.. < c.code.len:
|
||||||
|
let x = c.code[i]
|
||||||
|
if x.opcode in relativeJumps:
|
||||||
|
jumpTargets.incl(i+x.regBx-wordExcess)
|
||||||
|
|
||||||
# for debugging purposes
|
# for debugging purposes
|
||||||
var i = 0
|
var i = 0
|
||||||
while i < c.code.len:
|
while i < c.code.len:
|
||||||
if i in c.jumpTargets: result.addf("L$1:\n", i)
|
if i in jumpTargets: result.addf("L$1:\n", i)
|
||||||
let x = c.code[i]
|
let x = c.code[i]
|
||||||
|
|
||||||
let opc = opcode(x)
|
let opc = opcode(x)
|
||||||
if opc < firstABxInstr:
|
if opc < firstABxInstr:
|
||||||
result.addf("\t$#\tr$#, r$#, r$#", ($opc).substr(3), x.regA,
|
result.addf("\t$#\tr$#, r$#, r$#", ($opc).substr(3), x.regA,
|
||||||
x.regB, x.regC)
|
x.regB, x.regC)
|
||||||
|
elif opc in relativeJumps:
|
||||||
|
result.addf("\t$#\tr$#, L$#", ($opc).substr(3), x.regA,
|
||||||
|
i+x.regBx-wordExcess)
|
||||||
|
elif opc in {opcLdConst, opcAsgnConst}:
|
||||||
|
result.addf("\t$#\tr$#, $#", ($opc).substr(3), x.regA,
|
||||||
|
c.constants[x.regBx-wordExcess].renderTree)
|
||||||
else:
|
else:
|
||||||
result.addf("\t$#\tr$#, r$#", ($opc).substr(3), x.regA, x.regBx-wordExcess)
|
result.addf("\t$#\tr$#, $#", ($opc).substr(3), x.regA, x.regBx-wordExcess)
|
||||||
result.add("\t#")
|
result.add("\t#")
|
||||||
result.add(toFileLine(c.debug[i]))
|
result.add(toFileLine(c.debug[i]))
|
||||||
result.add("\n")
|
result.add("\n")
|
||||||
|
|
@ -64,9 +78,9 @@ proc xjmp(c: PCtx; n: PNode; opc: TOpcode; a: TRegister = 0): TPosition =
|
||||||
|
|
||||||
proc genLabel(c: PCtx): TPosition =
|
proc genLabel(c: PCtx): TPosition =
|
||||||
result = TPosition(c.code.len)
|
result = TPosition(c.code.len)
|
||||||
c.jumpTargets.incl(c.code.len)
|
#c.jumpTargets.incl(c.code.len)
|
||||||
|
|
||||||
proc jmp(c: PCtx, n: PNode, opc: TOpcode, p = TPosition(0)) =
|
proc jmpBack(c: PCtx, n: PNode, opc: TOpcode, p = TPosition(0)) =
|
||||||
let dist = p.int - c.code.len
|
let dist = p.int - c.code.len
|
||||||
InternalAssert(-0x7fff < dist and dist < 0x7fff)
|
InternalAssert(-0x7fff < dist and dist < 0x7fff)
|
||||||
gABx(c, n, opc, 0, dist)
|
gABx(c, n, opc, 0, dist)
|
||||||
|
|
@ -75,12 +89,12 @@ proc patch(c: PCtx, p: TPosition) =
|
||||||
# patch with current index
|
# patch with current index
|
||||||
let p = p.int
|
let p = p.int
|
||||||
let diff = c.code.len - p
|
let diff = c.code.len - p
|
||||||
c.jumpTargets.incl(c.code.len)
|
#c.jumpTargets.incl(c.code.len)
|
||||||
InternalAssert(-0x7fff < diff and diff < 0x7fff)
|
InternalAssert(-0x7fff < diff and diff < 0x7fff)
|
||||||
let oldInstr = c.code[p]
|
let oldInstr = c.code[p]
|
||||||
# opcode and regA stay the same:
|
# opcode and regA stay the same:
|
||||||
c.code[p] = ((oldInstr.uint32 and 0xffff'u32) or
|
c.code[p] = ((oldInstr.uint32 and 0xffff'u32).uint32 or
|
||||||
uint32(diff+wordExcess) shr 16'u32).TInstr
|
uint32(diff+wordExcess) shl 16'u32).TInstr
|
||||||
|
|
||||||
proc getSlotKind(t: PType): TSlotKind =
|
proc getSlotKind(t: PType): TSlotKind =
|
||||||
case t.skipTypes(abstractRange).kind
|
case t.skipTypes(abstractRange).kind
|
||||||
|
|
@ -185,7 +199,7 @@ proc genWhile(c: PCtx; n: PNode) =
|
||||||
let L2 = c.xjmp(n, opcFJmp, tmp)
|
let L2 = c.xjmp(n, opcFJmp, tmp)
|
||||||
c.freeTemp(tmp)
|
c.freeTemp(tmp)
|
||||||
c.gen(n.sons[1])
|
c.gen(n.sons[1])
|
||||||
c.jmp(n, opcJmp, L1)
|
c.jmpBack(n, opcJmp, L1)
|
||||||
c.patch(L2)
|
c.patch(L2)
|
||||||
|
|
||||||
proc genBlock(c: PCtx; n: PNode; dest: var TDest) =
|
proc genBlock(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
|
|
@ -195,10 +209,11 @@ proc genBlock(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
proc genBreak(c: PCtx; n: PNode) =
|
proc genBreak(c: PCtx; n: PNode) =
|
||||||
let L1 = c.xjmp(n, opcJmp)
|
let L1 = c.xjmp(n, opcJmp)
|
||||||
if n.sons[0].kind == nkSym:
|
if n.sons[0].kind == nkSym:
|
||||||
|
echo cast[int](n.sons[0].sym)
|
||||||
for i in countdown(c.prc.blocks.len-1, 0):
|
for i in countdown(c.prc.blocks.len-1, 0):
|
||||||
if c.prc.blocks[i].label == n.sons[0].sym:
|
if c.prc.blocks[i].label == n.sons[0].sym:
|
||||||
c.prc.blocks[i].fixups.add L1
|
c.prc.blocks[i].fixups.add L1
|
||||||
break
|
return
|
||||||
InternalError(n.info, "cannot find 'break' target")
|
InternalError(n.info, "cannot find 'break' target")
|
||||||
else:
|
else:
|
||||||
c.prc.blocks[c.prc.blocks.high].fixups.add L1
|
c.prc.blocks[c.prc.blocks.high].fixups.add L1
|
||||||
|
|
@ -222,7 +237,7 @@ proc genIf(c: PCtx, n: PNode; dest: var TDest) =
|
||||||
withTemp(tmp, it.sons[0].typ):
|
withTemp(tmp, it.sons[0].typ):
|
||||||
c.gen(it.sons[0], tmp)
|
c.gen(it.sons[0], tmp)
|
||||||
let elsePos = c.xjmp(it.sons[0], opcFJmp, tmp) # if false
|
let elsePos = c.xjmp(it.sons[0], opcFJmp, tmp) # if false
|
||||||
c.gen(n.sons[1], dest) # then part
|
c.gen(it.sons[1], dest) # then part
|
||||||
if i < sonsLen(n)-1:
|
if i < sonsLen(n)-1:
|
||||||
endings.add(c.xjmp(it.sons[1], opcJmp, 0))
|
endings.add(c.xjmp(it.sons[1], opcJmp, 0))
|
||||||
c.patch(elsePos)
|
c.patch(elsePos)
|
||||||
|
|
@ -365,7 +380,10 @@ proc genCall(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
|
|
||||||
proc genNew(c: PCtx; n: PNode) =
|
proc genNew(c: PCtx; n: PNode) =
|
||||||
let dest = c.genx(n.sons[1])
|
let dest = c.genx(n.sons[1])
|
||||||
c.gABx(n, opcNew, dest, c.genType(n.sons[1].typ.skipTypes(abstractVar)))
|
# we use the ref's base type here as the VM conflates 'ref object'
|
||||||
|
# and 'object' since internally we already have a pointer.
|
||||||
|
c.gABx(n, opcNew, dest,
|
||||||
|
c.genType(n.sons[1].typ.skipTypes(abstractVar).sons[0]))
|
||||||
c.freeTemp(dest)
|
c.freeTemp(dest)
|
||||||
|
|
||||||
proc genNewSeq(c: PCtx; n: PNode) =
|
proc genNewSeq(c: PCtx; n: PNode) =
|
||||||
|
|
@ -382,6 +400,12 @@ proc genUnaryABC(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
||||||
c.gABC(n, opc, dest, tmp)
|
c.gABC(n, opc, dest, tmp)
|
||||||
c.freeTemp(tmp)
|
c.freeTemp(tmp)
|
||||||
|
|
||||||
|
proc genUnaryABI(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
||||||
|
let tmp = c.genx(n.sons[1])
|
||||||
|
if dest < 0: dest = c.getTemp(n.typ)
|
||||||
|
c.gABI(n, opc, dest, tmp, 0)
|
||||||
|
c.freeTemp(tmp)
|
||||||
|
|
||||||
proc genBinaryABC(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
proc genBinaryABC(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
||||||
let
|
let
|
||||||
tmp = c.genx(n.sons[1])
|
tmp = c.genx(n.sons[1])
|
||||||
|
|
@ -391,6 +415,18 @@ proc genBinaryABC(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
||||||
c.freeTemp(tmp)
|
c.freeTemp(tmp)
|
||||||
c.freeTemp(tmp2)
|
c.freeTemp(tmp2)
|
||||||
|
|
||||||
|
proc genBinaryStmt(c: PCtx; n: PNode; opc: TOpcode) =
|
||||||
|
let
|
||||||
|
dest = c.genx(n.sons[1])
|
||||||
|
tmp = c.genx(n.sons[2])
|
||||||
|
c.gABC(n, opc, dest, tmp, 0)
|
||||||
|
c.freeTemp(tmp)
|
||||||
|
|
||||||
|
proc genUnaryStmt(c: PCtx; n: PNode; opc: TOpcode) =
|
||||||
|
let tmp = c.genx(n.sons[2])
|
||||||
|
c.gABC(n, opc, tmp, 0, 0)
|
||||||
|
c.freeTemp(tmp)
|
||||||
|
|
||||||
proc genVarargsABC(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
proc genVarargsABC(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
||||||
if dest < 0: dest = getTemp(c, n.typ)
|
if dest < 0: dest = getTemp(c, n.typ)
|
||||||
var x = c.getTempRange(n.len-1, slotTempStr)
|
var x = c.getTempRange(n.len-1, slotTempStr)
|
||||||
|
|
@ -465,9 +501,9 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
c.gABC(n, opcNewStr, dest, tmp)
|
c.gABC(n, opcNewStr, dest, tmp)
|
||||||
c.freeTemp(tmp)
|
c.freeTemp(tmp)
|
||||||
of mLengthOpenArray, mLengthArray, mLengthSeq:
|
of mLengthOpenArray, mLengthArray, mLengthSeq:
|
||||||
genUnaryABC(c, n, dest, opcLenSeq)
|
genUnaryABI(c, n, dest, opcLenSeq)
|
||||||
of mLengthStr:
|
of mLengthStr:
|
||||||
genUnaryABC(c, n, dest, opcLenStr)
|
genUnaryABI(c, n, dest, opcLenStr)
|
||||||
of mIncl, mExcl:
|
of mIncl, mExcl:
|
||||||
unused(n, dest)
|
unused(n, dest)
|
||||||
var d = c.genx(n.sons[1])
|
var d = c.genx(n.sons[1])
|
||||||
|
|
@ -596,29 +632,47 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
var d = c.genx(n.sons[i])
|
var d = c.genx(n.sons[i])
|
||||||
c.gABC(n, opcEcho, d)
|
c.gABC(n, opcEcho, d)
|
||||||
c.freeTemp(d)
|
c.freeTemp(d)
|
||||||
of mAppendStrCh: InternalError(n.info, "cannot generate code for: " & $m)
|
of mAppendStrCh:
|
||||||
of mAppendStrStr: InternalError(n.info, "cannot generate code for: " & $m)
|
unused(n, dest)
|
||||||
of mAppendSeqElem: InternalError(n.info, "cannot generate code for: " & $m)
|
genBinaryStmt(c, n, opcAddStrCh)
|
||||||
of mParseExprToAst: InternalError(n.info, "cannot generate code for: " & $m)
|
of mAppendStrStr:
|
||||||
of mParseStmtToAst: InternalError(n.info, "cannot generate code for: " & $m)
|
unused(n, dest)
|
||||||
|
genBinaryStmt(c, n, opcAddStrStr)
|
||||||
|
of mAppendSeqElem:
|
||||||
|
unused(n, dest)
|
||||||
|
genBinaryStmt(c, n, opcAddSeqElem)
|
||||||
|
of mParseExprToAst:
|
||||||
|
genUnaryABC(c, n, dest, opcParseExprToAst)
|
||||||
|
of mParseStmtToAst:
|
||||||
|
genUnaryABC(c, n, dest, opcParseStmtToAst)
|
||||||
of mExpandToAst: InternalError(n.info, "cannot generate code for: " & $m)
|
of mExpandToAst: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mTypeTrait: InternalError(n.info, "cannot generate code for: " & $m)
|
of mTypeTrait: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mIs: InternalError(n.info, "cannot generate code for: " & $m)
|
of mIs: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mSlurp: InternalError(n.info, "cannot generate code for: " & $m)
|
of mSlurp: genUnaryABC(c, n, dest, opcSlurp)
|
||||||
of mStaticExec: InternalError(n.info, "cannot generate code for: " & $m)
|
of mStaticExec: genBinaryABC(c, n, dest, opcGorge)
|
||||||
of mNLen: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNLen: genUnaryABI(c, n, dest, opcLenSeq)
|
||||||
of mNChild: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNChild: genBinaryABC(c, n, dest, opcNChild)
|
||||||
of mNSetChild: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNSetChild:
|
||||||
of mNAdd: InternalError(n.info, "cannot generate code for: " & $m)
|
unused(n, dest)
|
||||||
of mNAddMultiple: InternalError(n.info, "cannot generate code for: " & $m)
|
var
|
||||||
of mNDel: InternalError(n.info, "cannot generate code for: " & $m)
|
tmp1 = c.genx(n.sons[1])
|
||||||
of mNKind: InternalError(n.info, "cannot generate code for: " & $m)
|
tmp2 = c.genx(n.sons[2])
|
||||||
of mNIntVal: InternalError(n.info, "cannot generate code for: " & $m)
|
tmp3 = c.genx(n.sons[3])
|
||||||
of mNFloatVal: InternalError(n.info, "cannot generate code for: " & $m)
|
c.gABC(n, opcNSetChild, tmp1, tmp2, tmp3)
|
||||||
of mNSymbol: InternalError(n.info, "cannot generate code for: " & $m)
|
c.freeTemp(tmp1)
|
||||||
of mNIdent: InternalError(n.info, "cannot generate code for: " & $m)
|
c.freeTemp(tmp2)
|
||||||
of mNGetType: InternalError(n.info, "cannot generate code for: " & $m)
|
c.freeTemp(tmp3)
|
||||||
of mNStrVal: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNAdd: genBinaryABC(c, n, dest, opcNAdd)
|
||||||
|
of mNAddMultiple: genBinaryABC(c, n, dest, opcNAddMultiple)
|
||||||
|
of mNDel:
|
||||||
|
InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
|
of mNKind: genUnaryABC(c, n, dest, opcNKind)
|
||||||
|
of mNIntVal: genUnaryABC(c, n, dest, opcNIntVal)
|
||||||
|
of mNFloatVal: genUnaryABC(c, n, dest, opcNFloatVal)
|
||||||
|
of mNSymbol: genUnaryABC(c, n, dest, opcNSymbol)
|
||||||
|
of mNIdent: genUnaryABC(c, n, dest, opcNIdent)
|
||||||
|
of mNGetType: genUnaryABC(c, n, dest, opcNGetType)
|
||||||
|
of mNStrVal: genUnaryABC(c, n, dest, opcNStrVal)
|
||||||
of mNSetIntVal: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNSetIntVal: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mNSetFloatVal: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNSetFloatVal: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mNSetSymbol: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNSetSymbol: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
|
|
@ -628,16 +682,24 @@ proc genMagic(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
of mNNewNimNode: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNNewNimNode: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mNCopyNimNode: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNCopyNimNode: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mNCopyNimTree: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNCopyNimTree: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mNBindSym: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNBindSym: genUnaryABC(c, n, dest, opcNBindSym)
|
||||||
of mStrToIdent: InternalError(n.info, "cannot generate code for: " & $m)
|
of mStrToIdent: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mIdentToStr: InternalError(n.info, "cannot generate code for: " & $m)
|
of mIdentToStr: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mEqIdent: InternalError(n.info, "cannot generate code for: " & $m)
|
of mEqIdent: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mEqNimrodNode: InternalError(n.info, "cannot generate code for: " & $m)
|
of mEqNimrodNode: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mNLineInfo: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNLineInfo: InternalError(n.info, "cannot generate code for: " & $m)
|
||||||
of mNHint: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNHint:
|
||||||
of mNWarning: InternalError(n.info, "cannot generate code for: " & $m)
|
unused(n, dest)
|
||||||
of mNError: InternalError(n.info, "cannot generate code for: " & $m)
|
genUnaryStmt(c, n, opcNHint)
|
||||||
of mNCallSite: InternalError(n.info, "cannot generate code for: " & $m)
|
of mNWarning:
|
||||||
|
unused(n, dest)
|
||||||
|
genUnaryStmt(c, n, opcNWarning)
|
||||||
|
of mNError:
|
||||||
|
unused(n, dest)
|
||||||
|
genUnaryStmt(c, n, opcNError)
|
||||||
|
of mNCallSite:
|
||||||
|
if dest < 0: dest = c.getTemp(n.typ)
|
||||||
|
c.gABC(n, opcCallSite, dest)
|
||||||
else:
|
else:
|
||||||
# XXX get rid of these: mMinI, mMaxI, mMinI64, mMaxI64, mMinF64, mMaxF64
|
# XXX get rid of these: mMinI, mMaxI, mMinI64, mMaxI64, mMinF64, mMaxF64
|
||||||
# mGCref, mGCunref, mEqCString, mAbsI, mAbsI64, mAbsF64
|
# mGCref, mGCunref, mEqCString, mAbsI, mAbsI64, mAbsF64
|
||||||
|
|
@ -664,18 +726,18 @@ proc requiresCopy(n: PNode): bool =
|
||||||
else:
|
else:
|
||||||
result = true
|
result = true
|
||||||
|
|
||||||
proc unnecessaryIndirection(n: PNode): bool =
|
proc unneededIndirection(n: PNode): bool =
|
||||||
n.typ.skipTypes(abstractInst).kind == tyRef
|
n.typ.skipTypes(abstractInst).kind == tyRef
|
||||||
|
|
||||||
proc skipDeref(n: PNode): PNode =
|
proc skipDeref(n: PNode): PNode =
|
||||||
if n.kind in {nkDerefExpr, nkHiddenDeref} and unnecessaryIndirection(n):
|
if n.kind in {nkDerefExpr, nkHiddenDeref} and unneededIndirection(n.sons[0]):
|
||||||
result = n.sons[0]
|
result = n.sons[0]
|
||||||
else:
|
else:
|
||||||
result = n
|
result = n
|
||||||
|
|
||||||
proc genAddrDeref(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
proc genAddrDeref(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
|
||||||
# a nop for certain types
|
# a nop for certain types
|
||||||
if unnecessaryIndirection(n):
|
if unneededIndirection(n.sons[0]):
|
||||||
gen(c, n.sons[0], dest)
|
gen(c, n.sons[0], dest)
|
||||||
else:
|
else:
|
||||||
let tmp = c.genx(n.sons[0])
|
let tmp = c.genx(n.sons[0])
|
||||||
|
|
@ -740,9 +802,11 @@ proc genAsgn(c: PCtx; le, ri: PNode; requiresCopy: bool) =
|
||||||
genAsgn(c, dest, ri, requiresCopy)
|
genAsgn(c, dest, ri, requiresCopy)
|
||||||
|
|
||||||
proc genLit(c: PCtx; n: PNode; dest: var TDest) =
|
proc genLit(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
|
var opc = opcLdConst
|
||||||
if dest < 0: dest = c.getTemp(n.typ)
|
if dest < 0: dest = c.getTemp(n.typ)
|
||||||
|
elif c.prc.slots[dest].kind == slotFixedVar: opc = opcAsgnConst
|
||||||
let lit = genLiteral(c, n)
|
let lit = genLiteral(c, n)
|
||||||
c.gABx(n, opcLdConst, dest, lit)
|
c.gABx(n, opc, dest, lit)
|
||||||
|
|
||||||
proc genRdVar(c: PCtx; n: PNode; dest: var TDest) =
|
proc genRdVar(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
let s = n.sym
|
let s = n.sym
|
||||||
|
|
@ -775,7 +839,10 @@ proc genObjAccess(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
genAccess(c, n, dest, opcLdObj)
|
genAccess(c, n, dest, opcLdObj)
|
||||||
|
|
||||||
proc genArrAccess(c: PCtx; n: PNode; dest: var TDest) =
|
proc genArrAccess(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
genAccess(c, n, dest, opcLdArr)
|
if n.sons[0].typ.skipTypes(abstractVarRange).kind in {tyString, tyCString}:
|
||||||
|
genAccess(c, n, dest, opcLdStrIdx)
|
||||||
|
else:
|
||||||
|
genAccess(c, n, dest, opcLdArr)
|
||||||
|
|
||||||
proc getNullValue*(typ: PType, info: TLineInfo): PNode
|
proc getNullValue*(typ: PType, info: TLineInfo): PNode
|
||||||
proc getNullValueAux(obj: PNode, result: PNode) =
|
proc getNullValueAux(obj: PNode, result: PNode) =
|
||||||
|
|
@ -827,7 +894,8 @@ proc setSlot(c: PCtx; v: PSym) =
|
||||||
# XXX generate type initialization here?
|
# XXX generate type initialization here?
|
||||||
if v.position == 0:
|
if v.position == 0:
|
||||||
v.position = c.prc.maxSlots
|
v.position = c.prc.maxSlots
|
||||||
c.prc.slots[v.position] = (inUse: true, kind: slotFixed)
|
c.prc.slots[v.position] = (inUse: true,
|
||||||
|
kind: if v.kind == skLet: slotFixedLet else: slotFixedVar)
|
||||||
inc c.prc.maxSlots
|
inc c.prc.maxSlots
|
||||||
|
|
||||||
proc genVarSection(c: PCtx; n: PNode) =
|
proc genVarSection(c: PCtx; n: PNode) =
|
||||||
|
|
@ -959,36 +1027,56 @@ proc gen(c: PCtx; n: PNode; dest: var TDest) =
|
||||||
let s = n.sons[namePos].sym
|
let s = n.sons[namePos].sym
|
||||||
discard genProc(c, s)
|
discard genProc(c, s)
|
||||||
genLit(c, n.sons[namePos], dest)
|
genLit(c, n.sons[namePos], dest)
|
||||||
|
of nkChckRangeF, nkChckRange64, nkChckRange:
|
||||||
|
let
|
||||||
|
tmp0 = c.genx(n.sons[0])
|
||||||
|
tmp1 = c.genx(n.sons[1])
|
||||||
|
tmp2 = c.genx(n.sons[2])
|
||||||
|
c.gABC(n, opcRangeChck, tmp0, tmp1, tmp2)
|
||||||
|
c.freeTemp(tmp1)
|
||||||
|
c.freeTemp(tmp2)
|
||||||
|
if dest >= 0:
|
||||||
|
gABC(c, n, whichAsgnOpc(n), dest, tmp0)
|
||||||
|
c.freeTemp(tmp0)
|
||||||
|
else:
|
||||||
|
dest = tmp0
|
||||||
of nkEmpty, nkCommentStmt, nkTypeSection, nkConstSection, nkPragma,
|
of nkEmpty, nkCommentStmt, nkTypeSection, nkConstSection, nkPragma,
|
||||||
nkTemplateDef, nkIncludeStmt, nkImportStmt:
|
nkTemplateDef, nkIncludeStmt, nkImportStmt:
|
||||||
unused(n, dest)
|
unused(n, dest)
|
||||||
|
of nkStringToCString, nkCStringToString:
|
||||||
|
gen(c, n.sons[0], dest)
|
||||||
else:
|
else:
|
||||||
#of nkCurly, nkBracket, nkPar:
|
#of nkCurly, nkBracket, nkPar:
|
||||||
InternalError n.info, "too implement " & $n.kind
|
InternalError n.info, "too implement " & $n.kind
|
||||||
|
|
||||||
proc genStmt*(c: PCtx; n: PNode): int =
|
proc removeLastEof(c: PCtx) =
|
||||||
result = c.code.len
|
|
||||||
var d: TDest = -1
|
|
||||||
gen(c, n, d)
|
|
||||||
let last = c.code.len-1
|
let last = c.code.len-1
|
||||||
if last >= 0 and c.code[last].opcode == opcEof:
|
if last >= 0 and c.code[last].opcode == opcEof:
|
||||||
# since we can re-use the EOF nothing happened:
|
# overwrite last EOF:
|
||||||
result = last
|
assert c.code.len == c.debug.len
|
||||||
else:
|
c.code.setLen(last)
|
||||||
gABC(c, n, opcEof)
|
c.debug.setLen(last)
|
||||||
|
|
||||||
|
proc genStmt*(c: PCtx; n: PNode): int =
|
||||||
|
c.removeLastEof
|
||||||
|
result = c.code.len
|
||||||
|
var d: TDest = -1
|
||||||
|
c.gen(n, d)
|
||||||
|
c.gABC(n, opcEof)
|
||||||
InternalAssert d < 0
|
InternalAssert d < 0
|
||||||
|
|
||||||
proc genParams(c: PCtx; params: PNode) =
|
proc genParams(c: PCtx; params: PNode) =
|
||||||
# res.sym.position is already 0
|
# res.sym.position is already 0
|
||||||
c.prc.slots[0] = (inUse: true, kind: slotFixed)
|
c.prc.slots[0] = (inUse: true, kind: slotFixedVar)
|
||||||
for i in 1.. <params.len:
|
for i in 1.. <params.len:
|
||||||
let param = params.sons[i].sym
|
let param = params.sons[i].sym
|
||||||
c.prc.slots[i] = (inUse: true, kind: slotFixed)
|
c.prc.slots[i] = (inUse: true, kind: slotFixedLet)
|
||||||
c.prc.maxSlots = max(params.len, 1)
|
c.prc.maxSlots = max(params.len, 1)
|
||||||
|
|
||||||
proc genProc(c: PCtx; s: PSym): int =
|
proc genProc(c: PCtx; s: PSym): int =
|
||||||
let x = s.ast.sons[optimizedCodePos]
|
let x = s.ast.sons[optimizedCodePos]
|
||||||
if x.kind == nkEmpty:
|
if x.kind == nkEmpty:
|
||||||
|
c.removeLastEof
|
||||||
result = c.code.len+1 # skip the jump instruction
|
result = c.code.len+1 # skip the jump instruction
|
||||||
s.ast.sons[optimizedCodePos] = newIntNode(nkIntLit, result)
|
s.ast.sons[optimizedCodePos] = newIntNode(nkIntLit, result)
|
||||||
# thanks to the jmp we can add top level statements easily and also nest
|
# thanks to the jmp we can add top level statements easily and also nest
|
||||||
|
|
@ -1004,6 +1092,7 @@ proc genProc(c: PCtx; s: PSym): int =
|
||||||
# generate final 'return' statement:
|
# generate final 'return' statement:
|
||||||
c.gABC(body, opcRet)
|
c.gABC(body, opcRet)
|
||||||
c.patch(procStart)
|
c.patch(procStart)
|
||||||
|
c.gABC(body, opcEof)
|
||||||
s.position = c.prc.maxSlots
|
s.position = c.prc.maxSlots
|
||||||
c.prc = oldPrc
|
c.prc = oldPrc
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
9
config/rename.rules.cfg
Normal file
9
config/rename.rules.cfg
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
TSignedInt
|
||||||
|
TUnsignedInt
|
||||||
|
TOrdinal
|
||||||
|
TReal
|
||||||
|
TNumber
|
||||||
|
TEnum
|
||||||
|
TObject
|
||||||
|
TResult
|
||||||
|
TOpenArray
|
||||||
|
|
@ -480,6 +480,9 @@ proc ExpectKind*(n: PNimrodNode; k: set[TNimrodNodeKind]) {.compileTime.} =
|
||||||
proc newProc*(name = newEmptyNode(); params: openarray[PNimrodNode] = [];
|
proc newProc*(name = newEmptyNode(); params: openarray[PNimrodNode] = [];
|
||||||
body: PNimrodNode = newStmtList(), procType = nnkProcDef): PNimrodNode {.compileTime.} =
|
body: PNimrodNode = newStmtList(), procType = nnkProcDef): PNimrodNode {.compileTime.} =
|
||||||
## shortcut for creating a new proc
|
## shortcut for creating a new proc
|
||||||
|
##
|
||||||
|
## The ``params`` array should start with the return type of the proc,
|
||||||
|
## followed by a list of IdentDefs which specify the params.
|
||||||
assert procType in RoutineNodes
|
assert procType in RoutineNodes
|
||||||
result = newNimNode(procType).add(
|
result = newNimNode(procType).add(
|
||||||
name,
|
name,
|
||||||
|
|
|
||||||
|
|
@ -360,7 +360,7 @@ proc drawEllipse*(sur: PSurface, CX, CY, XRadius, YRadius: Natural,
|
||||||
## of the ellipse.
|
## of the ellipse.
|
||||||
var
|
var
|
||||||
X, Y: Natural
|
X, Y: Natural
|
||||||
XChange, YChange: Natural
|
XChange, YChange: Int
|
||||||
EllipseError: Natural
|
EllipseError: Natural
|
||||||
TwoASquare, TwoBSquare: Natural
|
TwoASquare, TwoBSquare: Natural
|
||||||
StoppingX, StoppingY: Natural
|
StoppingX, StoppingY: Natural
|
||||||
|
|
@ -501,6 +501,7 @@ if sdl_ttf.Init() < 0: raiseEGraphics()
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
var surf = newScreenSurface(800, 600)
|
var surf = newScreenSurface(800, 600)
|
||||||
|
|
||||||
surf.fillSurface(colWhite)
|
surf.fillSurface(colWhite)
|
||||||
|
|
||||||
# Draw the shapes
|
# Draw the shapes
|
||||||
|
|
@ -545,6 +546,8 @@ when isMainModule:
|
||||||
if evk.keysym.sym == SDL.K_LEFT:
|
if evk.keysym.sym == SDL.K_LEFT:
|
||||||
surf.drawHorLine(395, 300, 50, colBlack)
|
surf.drawHorLine(395, 300, 50, colBlack)
|
||||||
echo("Drawing")
|
echo("Drawing")
|
||||||
|
elif evk.keysym.sym == SDL.K_ESCAPE:
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
echo(evk.keysym.sym)
|
echo(evk.keysym.sym)
|
||||||
of SDL.MOUSEBUTTONDOWN:
|
of SDL.MOUSEBUTTONDOWN:
|
||||||
|
|
|
||||||
|
|
@ -836,9 +836,11 @@ proc copyFile*(source, dest: string) {.rtl, extern: "nos$1",
|
||||||
##
|
##
|
||||||
## If this fails, `EOS` is raised. On the Windows platform this proc will
|
## If this fails, `EOS` is raised. On the Windows platform this proc will
|
||||||
## copy the source file's attributes into dest. On other platforms you need
|
## copy the source file's attributes into dest. On other platforms you need
|
||||||
## to use getFilePermissions and setFilePermissions to copy them by hand,
|
## to use getFilePermissions and setFilePermissions to copy them by hand (or
|
||||||
## otherwise `dest` will inherit the default permissions of a newly created
|
## use the convenience copyFileWithPermissions() proc), otherwise `dest` will
|
||||||
## file for the user.
|
## inherit the default permissions of a newly created file for the user. If
|
||||||
|
## `dest` already exists, the file attributes will be preserved and the
|
||||||
|
## content overwritten.
|
||||||
when defined(Windows):
|
when defined(Windows):
|
||||||
when useWinUnicode:
|
when useWinUnicode:
|
||||||
let s = newWideCString(source)
|
let s = newWideCString(source)
|
||||||
|
|
@ -1383,6 +1385,26 @@ proc setFilePermissions*(filename: string, permissions: set[TFilePermission]) {.
|
||||||
var res2 = SetFileAttributesA(filename, res)
|
var res2 = SetFileAttributesA(filename, res)
|
||||||
if res2 == - 1'i32: OSError(OSLastError())
|
if res2 == - 1'i32: OSError(OSLastError())
|
||||||
|
|
||||||
|
proc copyFileWithPermissions*(source, dest: string,
|
||||||
|
ignorePermissionErrors = true) =
|
||||||
|
## Copies a file from `source` to `dest` preserving file permissions.
|
||||||
|
##
|
||||||
|
## This is a wrapper proc around copyFile, getFilePermissions and
|
||||||
|
## setFilePermissions on non Windows platform. On windows this proc is just a
|
||||||
|
## wrapper for copyFile since that proc already copies attributes.
|
||||||
|
##
|
||||||
|
## On non windows systems permissions are copied after the file itself has
|
||||||
|
## been copied, which won't happen atomically and could lead to a race
|
||||||
|
## condition. If ignorePermissionErrors is true, errors while reading/setting
|
||||||
|
## file attributes will be ignored, otherwise will raise `OSError`.
|
||||||
|
copyFile(source, dest)
|
||||||
|
when not defined(Windows):
|
||||||
|
try:
|
||||||
|
setFilePermissions(dest, getFilePermissions(source))
|
||||||
|
except:
|
||||||
|
if not ignorePermissionErrors:
|
||||||
|
raise
|
||||||
|
|
||||||
proc inclFilePermissions*(filename: string,
|
proc inclFilePermissions*(filename: string,
|
||||||
permissions: set[TFilePermission]) {.
|
permissions: set[TFilePermission]) {.
|
||||||
rtl, extern: "nos$1", tags: [FReadDir, FWriteDir].} =
|
rtl, extern: "nos$1", tags: [FReadDir, FWriteDir].} =
|
||||||
|
|
@ -1403,6 +1425,9 @@ proc exclFilePermissions*(filename: string,
|
||||||
|
|
||||||
proc getHomeDir*(): string {.rtl, extern: "nos$1", tags: [FReadEnv].} =
|
proc getHomeDir*(): string {.rtl, extern: "nos$1", tags: [FReadEnv].} =
|
||||||
## Returns the home directory of the current user.
|
## Returns the home directory of the current user.
|
||||||
|
##
|
||||||
|
## This proc is wrapped by the expandTilde proc for the convenience of
|
||||||
|
## processing paths coming from user configuration files.
|
||||||
when defined(windows): return string(getEnv("USERPROFILE")) & "\\"
|
when defined(windows): return string(getEnv("USERPROFILE")) & "\\"
|
||||||
else: return string(getEnv("HOME")) & "/"
|
else: return string(getEnv("HOME")) & "/"
|
||||||
|
|
||||||
|
|
@ -1580,5 +1605,26 @@ proc findExe*(exe: string): string {.tags: [FReadDir, FReadEnv].} =
|
||||||
if ExistsFile(x): return x
|
if ExistsFile(x): return x
|
||||||
result = ""
|
result = ""
|
||||||
|
|
||||||
|
proc expandTilde*(path: string): string =
|
||||||
|
## Expands a path starting with ``~/`` to a full path.
|
||||||
|
##
|
||||||
|
## If `path` starts with the tilde character and is followed by `/` or `\\`
|
||||||
|
## this proc will return the reminder of the path appended to the result of
|
||||||
|
## the getHomeDir() proc, otherwise the input path will be returned without
|
||||||
|
## modification.
|
||||||
|
##
|
||||||
|
## The behaviour of this proc is the same on the Windows platform despite not
|
||||||
|
## having this convention. Example:
|
||||||
|
##
|
||||||
|
## .. code-block:: nimrod
|
||||||
|
## let configFile = expandTilde("~" / "appname.cfg")
|
||||||
|
## echo configFile
|
||||||
|
## # --> C:\Users\amber\appname.cfg
|
||||||
|
|
||||||
|
if len(path) > 1 and path[0] == '~' and (path[1] == '/' or path[1] == '\\'):
|
||||||
|
result = getHomeDir() / path[2..len(path)-1]
|
||||||
|
else:
|
||||||
|
result = path
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ type
|
||||||
PXmlAttributes* = PStringTable ## an alias for a string to string mapping
|
PXmlAttributes* = PStringTable ## an alias for a string to string mapping
|
||||||
|
|
||||||
TXmlNode {.pure, final, acyclic.} = object
|
TXmlNode {.pure, final, acyclic.} = object
|
||||||
case k: TXmlNodeKind
|
case k: TXmlNodeKind # private, use the kind() proc to read this field.
|
||||||
of xnText, xnComment, xnCData, xnEntity:
|
of xnText, xnComment, xnCData, xnEntity:
|
||||||
fText: string
|
fText: string
|
||||||
of xnElement:
|
of xnElement:
|
||||||
|
|
@ -297,3 +297,40 @@ proc attr*(n: PXmlNode, name: string): string =
|
||||||
assert n.kind == xnElement
|
assert n.kind == xnElement
|
||||||
if n.attrs == nil: return ""
|
if n.attrs == nil: return ""
|
||||||
return n.attrs[name]
|
return n.attrs[name]
|
||||||
|
|
||||||
|
proc findAll*(n: PXmlNode, tag: string, result: var seq[PXmlNode]) =
|
||||||
|
## Iterates over all the children of `n` returning those matching `tag`.
|
||||||
|
##
|
||||||
|
## Found nodes satisfying the condition will be appended to the `result`
|
||||||
|
## sequence, which can't be nil or the proc will crash. Usage example:
|
||||||
|
##
|
||||||
|
## .. code-block:: nimrod
|
||||||
|
## var
|
||||||
|
## html: PXmlNode
|
||||||
|
## tags: seq[PXmlNode] = @[]
|
||||||
|
##
|
||||||
|
## html = buildHtml()
|
||||||
|
## findAll(html, "img", tags)
|
||||||
|
## for imgTag in tags:
|
||||||
|
## process(imgTag)
|
||||||
|
assert isNil(result) == false
|
||||||
|
assert n.k == xnElement
|
||||||
|
for child in n.items():
|
||||||
|
if child.k != xnElement:
|
||||||
|
continue
|
||||||
|
if child.tag == tag:
|
||||||
|
result.add(child)
|
||||||
|
elif child.k == xnElement:
|
||||||
|
child.findAll(tag, result)
|
||||||
|
|
||||||
|
proc findAll*(n: PXmlNode, tag: string): seq[PXmlNode] =
|
||||||
|
## Shortcut version to assign in let blocks. Example:
|
||||||
|
##
|
||||||
|
## .. code-block:: nimrod
|
||||||
|
## var html: PXmlNode
|
||||||
|
##
|
||||||
|
## html = buildHtml(html)
|
||||||
|
## for imgTag in html.findAll("img"):
|
||||||
|
## process(imgTag)
|
||||||
|
newSeq(result, 0)
|
||||||
|
findAll(n, tag, result)
|
||||||
|
|
|
||||||
|
|
@ -1454,9 +1454,9 @@ proc `&` *[T](x: seq[T], y: T): seq[T] {.noSideEffect.} =
|
||||||
|
|
||||||
proc `&` *[T](x: T, y: seq[T]): seq[T] {.noSideEffect.} =
|
proc `&` *[T](x: T, y: seq[T]): seq[T] {.noSideEffect.} =
|
||||||
newSeq(result, y.len + 1)
|
newSeq(result, y.len + 1)
|
||||||
|
result[0] = x
|
||||||
for i in 0..y.len-1:
|
for i in 0..y.len-1:
|
||||||
result[i] = y[i]
|
result[i+1] = y[i]
|
||||||
result[y.len] = x
|
|
||||||
|
|
||||||
when not defined(NimrodVM):
|
when not defined(NimrodVM):
|
||||||
when not defined(JS):
|
when not defined(JS):
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ type
|
||||||
C_TextFileStar = ptr CTextFile
|
C_TextFileStar = ptr CTextFile
|
||||||
C_BinaryFileStar = ptr CBinaryFile
|
C_BinaryFileStar = ptr CBinaryFile
|
||||||
|
|
||||||
C_JmpBuf {.importc: "jmp_buf", header: "<setjmp.h>".} = array[0..31, int]
|
C_JmpBuf {.importc: "jmp_buf", header: "<setjmp.h>".} = object
|
||||||
|
|
||||||
var
|
var
|
||||||
c_stdin {.importc: "stdin", nodecl.}: C_TextFileStar
|
c_stdin {.importc: "stdin", nodecl.}: C_TextFileStar
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,7 @@
|
||||||
# October 2007
|
# October 2007
|
||||||
#
|
#
|
||||||
|
|
||||||
when defined(windows):
|
include "cairo_pragma.nim"
|
||||||
const LIB_CAIRO* = "libcairo-2.dll"
|
|
||||||
elif defined(macosx):
|
|
||||||
const LIB_CAIRO* = "libcairo.dylib"
|
|
||||||
else:
|
|
||||||
const LIB_CAIRO* = "libcairo.so(|.2)"
|
|
||||||
|
|
||||||
type
|
type
|
||||||
PByte = cstring
|
PByte = cstring
|
||||||
|
|
@ -220,499 +215,499 @@ type
|
||||||
num_rectangles: int32
|
num_rectangles: int32
|
||||||
|
|
||||||
|
|
||||||
proc version*(): int32{.cdecl, importc: "cairo_version", dynlib: LIB_CAIRO.}
|
proc version*(): int32{.cdecl, importc: "cairo_version", libcairo.}
|
||||||
proc version_string*(): cstring{.cdecl, importc: "cairo_version_string",
|
proc version_string*(): cstring{.cdecl, importc: "cairo_version_string",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
#Helper function to retrieve decoded version
|
#Helper function to retrieve decoded version
|
||||||
proc version*(major, minor, micro: var int32)
|
proc version*(major, minor, micro: var int32)
|
||||||
#* Functions for manipulating state objects
|
#* Functions for manipulating state objects
|
||||||
proc create*(target: PSurface): PContext{.cdecl, importc: "cairo_create",
|
proc create*(target: PSurface): PContext{.cdecl, importc: "cairo_create",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc reference*(cr: PContext): PContext{.cdecl, importc: "cairo_reference", dynlib: LIB_CAIRO.}
|
proc reference*(cr: PContext): PContext{.cdecl, importc: "cairo_reference", libcairo.}
|
||||||
proc destroy*(cr: PContext){.cdecl, importc: "cairo_destroy", dynlib: LIB_CAIRO.}
|
proc destroy*(cr: PContext){.cdecl, importc: "cairo_destroy", libcairo.}
|
||||||
proc get_reference_count*(cr: PContext): int32{.cdecl,
|
proc get_reference_count*(cr: PContext): int32{.cdecl,
|
||||||
importc: "cairo_get_reference_count", dynlib: LIB_CAIRO.}
|
importc: "cairo_get_reference_count", libcairo.}
|
||||||
proc get_user_data*(cr: PContext, key: PUserDataKey): pointer{.cdecl,
|
proc get_user_data*(cr: PContext, key: PUserDataKey): pointer{.cdecl,
|
||||||
importc: "cairo_get_user_data", dynlib: LIB_CAIRO.}
|
importc: "cairo_get_user_data", libcairo.}
|
||||||
proc set_user_data*(cr: PContext, key: PUserDataKey, user_data: Pointer,
|
proc set_user_data*(cr: PContext, key: PUserDataKey, user_data: Pointer,
|
||||||
destroy: TDestroyFunc): TStatus{.cdecl,
|
destroy: TDestroyFunc): TStatus{.cdecl,
|
||||||
importc: "cairo_set_user_data", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_user_data", libcairo.}
|
||||||
proc save*(cr: PContext){.cdecl, importc: "cairo_save", dynlib: LIB_CAIRO.}
|
proc save*(cr: PContext){.cdecl, importc: "cairo_save", libcairo.}
|
||||||
proc restore*(cr: PContext){.cdecl, importc: "cairo_restore", dynlib: LIB_CAIRO.}
|
proc restore*(cr: PContext){.cdecl, importc: "cairo_restore", libcairo.}
|
||||||
proc push_group*(cr: PContext){.cdecl, importc: "cairo_push_group", dynlib: LIB_CAIRO.}
|
proc push_group*(cr: PContext){.cdecl, importc: "cairo_push_group", libcairo.}
|
||||||
proc push_group_with_content*(cr: PContext, content: TContent){.cdecl,
|
proc push_group_with_content*(cr: PContext, content: TContent){.cdecl,
|
||||||
importc: "cairo_push_group_with_content", dynlib: LIB_CAIRO.}
|
importc: "cairo_push_group_with_content", libcairo.}
|
||||||
proc pop_group*(cr: PContext): PPattern{.cdecl, importc: "cairo_pop_group",
|
proc pop_group*(cr: PContext): PPattern{.cdecl, importc: "cairo_pop_group",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc pop_group_to_source*(cr: PContext){.cdecl, importc: "cairo_pop_group_to_source",
|
proc pop_group_to_source*(cr: PContext){.cdecl, importc: "cairo_pop_group_to_source",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
#* Modify state
|
#* Modify state
|
||||||
proc set_operator*(cr: PContext, op: TOperator){.cdecl, importc: "cairo_set_operator",
|
proc set_operator*(cr: PContext, op: TOperator){.cdecl, importc: "cairo_set_operator",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc set_source*(cr: PContext, source: PPattern){.cdecl, importc: "cairo_set_source",
|
proc set_source*(cr: PContext, source: PPattern){.cdecl, importc: "cairo_set_source",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc set_source_rgb*(cr: PContext, red, green, blue: float64){.cdecl,
|
proc set_source_rgb*(cr: PContext, red, green, blue: float64){.cdecl,
|
||||||
importc: "cairo_set_source_rgb", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_source_rgb", libcairo.}
|
||||||
proc set_source_rgba*(cr: PContext, red, green, blue, alpha: float64){.cdecl,
|
proc set_source_rgba*(cr: PContext, red, green, blue, alpha: float64){.cdecl,
|
||||||
importc: "cairo_set_source_rgba", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_source_rgba", libcairo.}
|
||||||
proc set_source*(cr: PContext, surface: PSurface, x, y: float64){.cdecl,
|
proc set_source*(cr: PContext, surface: PSurface, x, y: float64){.cdecl,
|
||||||
importc: "cairo_set_source_surface", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_source_surface", libcairo.}
|
||||||
proc set_tolerance*(cr: PContext, tolerance: float64){.cdecl,
|
proc set_tolerance*(cr: PContext, tolerance: float64){.cdecl,
|
||||||
importc: "cairo_set_tolerance", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_tolerance", libcairo.}
|
||||||
proc set_antialias*(cr: PContext, antialias: TAntialias){.cdecl,
|
proc set_antialias*(cr: PContext, antialias: TAntialias){.cdecl,
|
||||||
importc: "cairo_set_antialias", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_antialias", libcairo.}
|
||||||
proc set_fill_rule*(cr: PContext, fill_rule: TFillRule){.cdecl,
|
proc set_fill_rule*(cr: PContext, fill_rule: TFillRule){.cdecl,
|
||||||
importc: "cairo_set_fill_rule", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_fill_rule", libcairo.}
|
||||||
proc set_line_width*(cr: PContext, width: float64){.cdecl,
|
proc set_line_width*(cr: PContext, width: float64){.cdecl,
|
||||||
importc: "cairo_set_line_width", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_line_width", libcairo.}
|
||||||
proc set_line_cap*(cr: PContext, line_cap: TLineCap){.cdecl,
|
proc set_line_cap*(cr: PContext, line_cap: TLineCap){.cdecl,
|
||||||
importc: "cairo_set_line_cap", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_line_cap", libcairo.}
|
||||||
proc set_line_join*(cr: PContext, line_join: TLineJoin){.cdecl,
|
proc set_line_join*(cr: PContext, line_join: TLineJoin){.cdecl,
|
||||||
importc: "cairo_set_line_join", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_line_join", libcairo.}
|
||||||
proc set_dash*(cr: PContext, dashes: openarray[float64], offset: float64){.cdecl,
|
proc set_dash*(cr: PContext, dashes: openarray[float64], offset: float64){.cdecl,
|
||||||
importc: "cairo_set_dash", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_dash", libcairo.}
|
||||||
proc set_miter_limit*(cr: PContext, limit: float64){.cdecl,
|
proc set_miter_limit*(cr: PContext, limit: float64){.cdecl,
|
||||||
importc: "cairo_set_miter_limit", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_miter_limit", libcairo.}
|
||||||
proc translate*(cr: PContext, tx, ty: float64){.cdecl, importc: "cairo_translate",
|
proc translate*(cr: PContext, tx, ty: float64){.cdecl, importc: "cairo_translate",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc scale*(cr: PContext, sx, sy: float64){.cdecl, importc: "cairo_scale",
|
proc scale*(cr: PContext, sx, sy: float64){.cdecl, importc: "cairo_scale",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc rotate*(cr: PContext, angle: float64){.cdecl, importc: "cairo_rotate",
|
proc rotate*(cr: PContext, angle: float64){.cdecl, importc: "cairo_rotate",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc transform*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_transform",
|
proc transform*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_transform",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc set_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_set_matrix",
|
proc set_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_set_matrix",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc identity_matrix*(cr: PContext){.cdecl, importc: "cairo_identity_matrix",
|
proc identity_matrix*(cr: PContext){.cdecl, importc: "cairo_identity_matrix",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc user_to_device*(cr: PContext, x, y: var float64){.cdecl,
|
proc user_to_device*(cr: PContext, x, y: var float64){.cdecl,
|
||||||
importc: "cairo_user_to_device", dynlib: LIB_CAIRO.}
|
importc: "cairo_user_to_device", libcairo.}
|
||||||
proc user_to_device_distance*(cr: PContext, dx, dy: var float64){.cdecl,
|
proc user_to_device_distance*(cr: PContext, dx, dy: var float64){.cdecl,
|
||||||
importc: "cairo_user_to_device_distance", dynlib: LIB_CAIRO.}
|
importc: "cairo_user_to_device_distance", libcairo.}
|
||||||
proc device_to_user*(cr: PContext, x, y: var float64){.cdecl,
|
proc device_to_user*(cr: PContext, x, y: var float64){.cdecl,
|
||||||
importc: "cairo_device_to_user", dynlib: LIB_CAIRO.}
|
importc: "cairo_device_to_user", libcairo.}
|
||||||
proc device_to_user_distance*(cr: PContext, dx, dy: var float64){.cdecl,
|
proc device_to_user_distance*(cr: PContext, dx, dy: var float64){.cdecl,
|
||||||
importc: "cairo_device_to_user_distance", dynlib: LIB_CAIRO.}
|
importc: "cairo_device_to_user_distance", libcairo.}
|
||||||
#* Path creation functions
|
#* Path creation functions
|
||||||
proc new_path*(cr: PContext){.cdecl, importc: "cairo_new_path", dynlib: LIB_CAIRO.}
|
proc new_path*(cr: PContext){.cdecl, importc: "cairo_new_path", libcairo.}
|
||||||
proc move_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_move_to",
|
proc move_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_move_to",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc new_sub_path*(cr: PContext){.cdecl, importc: "cairo_new_sub_path",
|
proc new_sub_path*(cr: PContext){.cdecl, importc: "cairo_new_sub_path",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc line_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_line_to",
|
proc line_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_line_to",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc curve_to*(cr: PContext, x1, y1, x2, y2, x3, y3: float64){.cdecl,
|
proc curve_to*(cr: PContext, x1, y1, x2, y2, x3, y3: float64){.cdecl,
|
||||||
importc: "cairo_curve_to", dynlib: LIB_CAIRO.}
|
importc: "cairo_curve_to", libcairo.}
|
||||||
proc arc*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl,
|
proc arc*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl,
|
||||||
importc: "cairo_arc", dynlib: LIB_CAIRO.}
|
importc: "cairo_arc", libcairo.}
|
||||||
proc arc_negative*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl,
|
proc arc_negative*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl,
|
||||||
importc: "cairo_arc_negative", dynlib: LIB_CAIRO.}
|
importc: "cairo_arc_negative", libcairo.}
|
||||||
proc rel_move_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_move_to",
|
proc rel_move_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_move_to",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc rel_line_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_line_to",
|
proc rel_line_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_line_to",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc rel_curve_to*(cr: PContext, dx1, dy1, dx2, dy2, dx3, dy3: float64){.cdecl,
|
proc rel_curve_to*(cr: PContext, dx1, dy1, dx2, dy2, dx3, dy3: float64){.cdecl,
|
||||||
importc: "cairo_rel_curve_to", dynlib: LIB_CAIRO.}
|
importc: "cairo_rel_curve_to", libcairo.}
|
||||||
proc rectangle*(cr: PContext, x, y, width, height: float64){.cdecl,
|
proc rectangle*(cr: PContext, x, y, width, height: float64){.cdecl,
|
||||||
importc: "cairo_rectangle", dynlib: LIB_CAIRO.}
|
importc: "cairo_rectangle", libcairo.}
|
||||||
proc close_path*(cr: PContext){.cdecl, importc: "cairo_close_path", dynlib: LIB_CAIRO.}
|
proc close_path*(cr: PContext){.cdecl, importc: "cairo_close_path", libcairo.}
|
||||||
#* Painting functions
|
#* Painting functions
|
||||||
proc paint*(cr: PContext){.cdecl, importc: "cairo_paint", dynlib: LIB_CAIRO.}
|
proc paint*(cr: PContext){.cdecl, importc: "cairo_paint", libcairo.}
|
||||||
proc paint_with_alpha*(cr: PContext, alpha: float64){.cdecl,
|
proc paint_with_alpha*(cr: PContext, alpha: float64){.cdecl,
|
||||||
importc: "cairo_paint_with_alpha", dynlib: LIB_CAIRO.}
|
importc: "cairo_paint_with_alpha", libcairo.}
|
||||||
proc mask*(cr: PContext, pattern: PPattern){.cdecl, importc: "cairo_mask",
|
proc mask*(cr: PContext, pattern: PPattern){.cdecl, importc: "cairo_mask",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc mask*(cr: PContext, surface: PSurface, surface_x, surface_y: float64){.
|
proc mask*(cr: PContext, surface: PSurface, surface_x, surface_y: float64){.
|
||||||
cdecl, importc: "cairo_mask_surface", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_mask_surface", libcairo.}
|
||||||
proc stroke*(cr: PContext){.cdecl, importc: "cairo_stroke", dynlib: LIB_CAIRO.}
|
proc stroke*(cr: PContext){.cdecl, importc: "cairo_stroke", libcairo.}
|
||||||
proc stroke_preserve*(cr: PContext){.cdecl, importc: "cairo_stroke_preserve",
|
proc stroke_preserve*(cr: PContext){.cdecl, importc: "cairo_stroke_preserve",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc fill*(cr: PContext){.cdecl, importc: "cairo_fill", dynlib: LIB_CAIRO.}
|
proc fill*(cr: PContext){.cdecl, importc: "cairo_fill", libcairo.}
|
||||||
proc fill_preserve*(cr: PContext){.cdecl, importc: "cairo_fill_preserve",
|
proc fill_preserve*(cr: PContext){.cdecl, importc: "cairo_fill_preserve",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc copy_page*(cr: PContext){.cdecl, importc: "cairo_copy_page", dynlib: LIB_CAIRO.}
|
proc copy_page*(cr: PContext){.cdecl, importc: "cairo_copy_page", libcairo.}
|
||||||
proc show_page*(cr: PContext){.cdecl, importc: "cairo_show_page", dynlib: LIB_CAIRO.}
|
proc show_page*(cr: PContext){.cdecl, importc: "cairo_show_page", libcairo.}
|
||||||
#* Insideness testing
|
#* Insideness testing
|
||||||
proc in_stroke*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_stroke",
|
proc in_stroke*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_stroke",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc in_fill*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_fill",
|
proc in_fill*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_fill",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
#* Rectangular extents
|
#* Rectangular extents
|
||||||
proc stroke_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
proc stroke_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
||||||
importc: "cairo_stroke_extents", dynlib: LIB_CAIRO.}
|
importc: "cairo_stroke_extents", libcairo.}
|
||||||
proc fill_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
proc fill_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
||||||
importc: "cairo_fill_extents", dynlib: LIB_CAIRO.}
|
importc: "cairo_fill_extents", libcairo.}
|
||||||
#* Clipping
|
#* Clipping
|
||||||
proc reset_clip*(cr: PContext){.cdecl, importc: "cairo_reset_clip", dynlib: LIB_CAIRO.}
|
proc reset_clip*(cr: PContext){.cdecl, importc: "cairo_reset_clip", libcairo.}
|
||||||
proc clip*(cr: PContext){.cdecl, importc: "cairo_clip", dynlib: LIB_CAIRO.}
|
proc clip*(cr: PContext){.cdecl, importc: "cairo_clip", libcairo.}
|
||||||
proc clip_preserve*(cr: PContext){.cdecl, importc: "cairo_clip_preserve",
|
proc clip_preserve*(cr: PContext){.cdecl, importc: "cairo_clip_preserve",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc clip_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
proc clip_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
|
||||||
importc: "cairo_clip_extents", dynlib: LIB_CAIRO.}
|
importc: "cairo_clip_extents", libcairo.}
|
||||||
proc copy_clip_rectangle_list*(cr: PContext): PRectangleList{.cdecl,
|
proc copy_clip_rectangle_list*(cr: PContext): PRectangleList{.cdecl,
|
||||||
importc: "cairo_copy_clip_rectangle_list", dynlib: LIB_CAIRO.}
|
importc: "cairo_copy_clip_rectangle_list", libcairo.}
|
||||||
proc rectangle_list_destroy*(rectangle_list: PRectangleList){.cdecl,
|
proc rectangle_list_destroy*(rectangle_list: PRectangleList){.cdecl,
|
||||||
importc: "cairo_rectangle_list_destroy", dynlib: LIB_CAIRO.}
|
importc: "cairo_rectangle_list_destroy", libcairo.}
|
||||||
#* Font/Text functions
|
#* Font/Text functions
|
||||||
proc font_options_create*(): PFontOptions{.cdecl,
|
proc font_options_create*(): PFontOptions{.cdecl,
|
||||||
importc: "cairo_font_options_create", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_create", libcairo.}
|
||||||
proc copy*(original: PFontOptions): PFontOptions{.cdecl,
|
proc copy*(original: PFontOptions): PFontOptions{.cdecl,
|
||||||
importc: "cairo_font_options_copy", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_copy", libcairo.}
|
||||||
proc destroy*(options: PFontOptions){.cdecl,
|
proc destroy*(options: PFontOptions){.cdecl,
|
||||||
importc: "cairo_font_options_destroy", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_destroy", libcairo.}
|
||||||
proc status*(options: PFontOptions): TStatus{.cdecl,
|
proc status*(options: PFontOptions): TStatus{.cdecl,
|
||||||
importc: "cairo_font_options_status", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_status", libcairo.}
|
||||||
proc merge*(options, other: PFontOptions){.cdecl,
|
proc merge*(options, other: PFontOptions){.cdecl,
|
||||||
importc: "cairo_font_options_merge", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_merge", libcairo.}
|
||||||
proc equal*(options, other: PFontOptions): TBool{.cdecl,
|
proc equal*(options, other: PFontOptions): TBool{.cdecl,
|
||||||
importc: "cairo_font_options_equal", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_equal", libcairo.}
|
||||||
proc hash*(options: PFontOptions): int32{.cdecl,
|
proc hash*(options: PFontOptions): int32{.cdecl,
|
||||||
importc: "cairo_font_options_hash", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_hash", libcairo.}
|
||||||
proc set_antialias*(options: PFontOptions, antialias: TAntialias){.
|
proc set_antialias*(options: PFontOptions, antialias: TAntialias){.
|
||||||
cdecl, importc: "cairo_font_options_set_antialias", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_font_options_set_antialias", libcairo.}
|
||||||
proc get_antialias*(options: PFontOptions): TAntialias{.cdecl,
|
proc get_antialias*(options: PFontOptions): TAntialias{.cdecl,
|
||||||
importc: "cairo_font_options_get_antialias", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_get_antialias", libcairo.}
|
||||||
proc set_subpixel_order*(options: PFontOptions,
|
proc set_subpixel_order*(options: PFontOptions,
|
||||||
subpixel_order: TSubpixelOrder){.cdecl,
|
subpixel_order: TSubpixelOrder){.cdecl,
|
||||||
importc: "cairo_font_options_set_subpixel_order", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_set_subpixel_order", libcairo.}
|
||||||
proc get_subpixel_order*(options: PFontOptions): TSubpixelOrder{.
|
proc get_subpixel_order*(options: PFontOptions): TSubpixelOrder{.
|
||||||
cdecl, importc: "cairo_font_options_get_subpixel_order", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_font_options_get_subpixel_order", libcairo.}
|
||||||
proc set_hint_style*(options: PFontOptions, hint_style: THintStyle){.
|
proc set_hint_style*(options: PFontOptions, hint_style: THintStyle){.
|
||||||
cdecl, importc: "cairo_font_options_set_hint_style", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_font_options_set_hint_style", libcairo.}
|
||||||
proc get_hint_style*(options: PFontOptions): THintStyle{.cdecl,
|
proc get_hint_style*(options: PFontOptions): THintStyle{.cdecl,
|
||||||
importc: "cairo_font_options_get_hint_style", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_get_hint_style", libcairo.}
|
||||||
proc set_hint_metrics*(options: PFontOptions,
|
proc set_hint_metrics*(options: PFontOptions,
|
||||||
hint_metrics: THintMetrics){.cdecl,
|
hint_metrics: THintMetrics){.cdecl,
|
||||||
importc: "cairo_font_options_set_hint_metrics", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_set_hint_metrics", libcairo.}
|
||||||
proc get_hint_metrics*(options: PFontOptions): THintMetrics{.cdecl,
|
proc get_hint_metrics*(options: PFontOptions): THintMetrics{.cdecl,
|
||||||
importc: "cairo_font_options_get_hint_metrics", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_options_get_hint_metrics", libcairo.}
|
||||||
#* This interface is for dealing with text as text, not caring about the
|
#* This interface is for dealing with text as text, not caring about the
|
||||||
# font object inside the the TCairo.
|
# font object inside the the TCairo.
|
||||||
proc select_font_face*(cr: PContext, family: cstring, slant: TFontSlant,
|
proc select_font_face*(cr: PContext, family: cstring, slant: TFontSlant,
|
||||||
weight: TFontWeight){.cdecl,
|
weight: TFontWeight){.cdecl,
|
||||||
importc: "cairo_select_font_face", dynlib: LIB_CAIRO.}
|
importc: "cairo_select_font_face", libcairo.}
|
||||||
proc set_font_size*(cr: PContext, size: float64){.cdecl,
|
proc set_font_size*(cr: PContext, size: float64){.cdecl,
|
||||||
importc: "cairo_set_font_size", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_font_size", libcairo.}
|
||||||
proc set_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl,
|
proc set_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl,
|
||||||
importc: "cairo_set_font_matrix", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_font_matrix", libcairo.}
|
||||||
proc get_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl,
|
proc get_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl,
|
||||||
importc: "cairo_get_font_matrix", dynlib: LIB_CAIRO.}
|
importc: "cairo_get_font_matrix", libcairo.}
|
||||||
proc set_font_options*(cr: PContext, options: PFontOptions){.cdecl,
|
proc set_font_options*(cr: PContext, options: PFontOptions){.cdecl,
|
||||||
importc: "cairo_set_font_options", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_font_options", libcairo.}
|
||||||
proc get_font_options*(cr: PContext, options: PFontOptions){.cdecl,
|
proc get_font_options*(cr: PContext, options: PFontOptions){.cdecl,
|
||||||
importc: "cairo_get_font_options", dynlib: LIB_CAIRO.}
|
importc: "cairo_get_font_options", libcairo.}
|
||||||
proc set_font_face*(cr: PContext, font_face: PFontFace){.cdecl,
|
proc set_font_face*(cr: PContext, font_face: PFontFace){.cdecl,
|
||||||
importc: "cairo_set_font_face", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_font_face", libcairo.}
|
||||||
proc get_font_face*(cr: PContext): PFontFace{.cdecl, importc: "cairo_get_font_face",
|
proc get_font_face*(cr: PContext): PFontFace{.cdecl, importc: "cairo_get_font_face",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc set_scaled_font*(cr: PContext, scaled_font: PScaledFont){.cdecl,
|
proc set_scaled_font*(cr: PContext, scaled_font: PScaledFont){.cdecl,
|
||||||
importc: "cairo_set_scaled_font", dynlib: LIB_CAIRO.}
|
importc: "cairo_set_scaled_font", libcairo.}
|
||||||
proc get_scaled_font*(cr: PContext): PScaledFont{.cdecl,
|
proc get_scaled_font*(cr: PContext): PScaledFont{.cdecl,
|
||||||
importc: "cairo_get_scaled_font", dynlib: LIB_CAIRO.}
|
importc: "cairo_get_scaled_font", libcairo.}
|
||||||
proc show_text*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_show_text",
|
proc show_text*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_show_text",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc show_glyphs*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl,
|
proc show_glyphs*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl,
|
||||||
importc: "cairo_show_glyphs", dynlib: LIB_CAIRO.}
|
importc: "cairo_show_glyphs", libcairo.}
|
||||||
proc text_path*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_text_path",
|
proc text_path*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_text_path",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc glyph_path*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl,
|
proc glyph_path*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl,
|
||||||
importc: "cairo_glyph_path", dynlib: LIB_CAIRO.}
|
importc: "cairo_glyph_path", libcairo.}
|
||||||
proc text_extents*(cr: PContext, utf8: cstring, extents: PTextExtents){.cdecl,
|
proc text_extents*(cr: PContext, utf8: cstring, extents: PTextExtents){.cdecl,
|
||||||
importc: "cairo_text_extents", dynlib: LIB_CAIRO.}
|
importc: "cairo_text_extents", libcairo.}
|
||||||
proc glyph_extents*(cr: PContext, glyphs: PGlyph, num_glyphs: int32,
|
proc glyph_extents*(cr: PContext, glyphs: PGlyph, num_glyphs: int32,
|
||||||
extents: PTextExtents){.cdecl,
|
extents: PTextExtents){.cdecl,
|
||||||
importc: "cairo_glyph_extents", dynlib: LIB_CAIRO.}
|
importc: "cairo_glyph_extents", libcairo.}
|
||||||
proc font_extents*(cr: PContext, extents: PFontExtents){.cdecl,
|
proc font_extents*(cr: PContext, extents: PFontExtents){.cdecl,
|
||||||
importc: "cairo_font_extents", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_extents", libcairo.}
|
||||||
#* Generic identifier for a font style
|
#* Generic identifier for a font style
|
||||||
proc reference*(font_face: PFontFace): PFontFace{.cdecl,
|
proc reference*(font_face: PFontFace): PFontFace{.cdecl,
|
||||||
importc: "cairo_font_face_reference", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_face_reference", libcairo.}
|
||||||
proc destroy*(font_face: PFontFace){.cdecl,
|
proc destroy*(font_face: PFontFace){.cdecl,
|
||||||
importc: "cairo_font_face_destroy", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_face_destroy", libcairo.}
|
||||||
proc get_reference_count*(font_face: PFontFace): int32{.cdecl,
|
proc get_reference_count*(font_face: PFontFace): int32{.cdecl,
|
||||||
importc: "cairo_font_face_get_reference_count", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_face_get_reference_count", libcairo.}
|
||||||
proc status*(font_face: PFontFace): TStatus{.cdecl,
|
proc status*(font_face: PFontFace): TStatus{.cdecl,
|
||||||
importc: "cairo_font_face_status", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_face_status", libcairo.}
|
||||||
proc get_type*(font_face: PFontFace): TFontType{.cdecl,
|
proc get_type*(font_face: PFontFace): TFontType{.cdecl,
|
||||||
importc: "cairo_font_face_get_type", dynlib: LIB_CAIRO.}
|
importc: "cairo_font_face_get_type", libcairo.}
|
||||||
proc get_user_data*(font_face: PFontFace, key: PUserDataKey): pointer{.
|
proc get_user_data*(font_face: PFontFace, key: PUserDataKey): pointer{.
|
||||||
cdecl, importc: "cairo_font_face_get_user_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_font_face_get_user_data", libcairo.}
|
||||||
proc set_user_data*(font_face: PFontFace, key: PUserDataKey,
|
proc set_user_data*(font_face: PFontFace, key: PUserDataKey,
|
||||||
user_data: pointer, destroy: TDestroyFunc): TStatus{.
|
user_data: pointer, destroy: TDestroyFunc): TStatus{.
|
||||||
cdecl, importc: "cairo_font_face_set_user_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_font_face_set_user_data", libcairo.}
|
||||||
#* Portable interface to general font features
|
#* Portable interface to general font features
|
||||||
proc scaled_font_create*(font_face: PFontFace, font_matrix: PMatrix,
|
proc scaled_font_create*(font_face: PFontFace, font_matrix: PMatrix,
|
||||||
ctm: PMatrix, options: PFontOptions): PScaledFont{.
|
ctm: PMatrix, options: PFontOptions): PScaledFont{.
|
||||||
cdecl, importc: "cairo_scaled_font_create", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_scaled_font_create", libcairo.}
|
||||||
proc reference*(scaled_font: PScaledFont): PScaledFont{.cdecl,
|
proc reference*(scaled_font: PScaledFont): PScaledFont{.cdecl,
|
||||||
importc: "cairo_scaled_font_reference", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_reference", libcairo.}
|
||||||
proc destroy*(scaled_font: PScaledFont){.cdecl,
|
proc destroy*(scaled_font: PScaledFont){.cdecl,
|
||||||
importc: "cairo_scaled_font_destroy", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_destroy", libcairo.}
|
||||||
proc get_reference_count*(scaled_font: PScaledFont): int32{.cdecl,
|
proc get_reference_count*(scaled_font: PScaledFont): int32{.cdecl,
|
||||||
importc: "cairo_scaled_font_get_reference_count", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_get_reference_count", libcairo.}
|
||||||
proc status*(scaled_font: PScaledFont): TStatus{.cdecl,
|
proc status*(scaled_font: PScaledFont): TStatus{.cdecl,
|
||||||
importc: "cairo_scaled_font_status", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_status", libcairo.}
|
||||||
proc get_type*(scaled_font: PScaledFont): TFontType{.cdecl,
|
proc get_type*(scaled_font: PScaledFont): TFontType{.cdecl,
|
||||||
importc: "cairo_scaled_font_get_type", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_get_type", libcairo.}
|
||||||
proc get_user_data*(scaled_font: PScaledFont, key: PUserDataKey): Pointer{.
|
proc get_user_data*(scaled_font: PScaledFont, key: PUserDataKey): Pointer{.
|
||||||
cdecl, importc: "cairo_scaled_font_get_user_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_scaled_font_get_user_data", libcairo.}
|
||||||
proc set_user_data*(scaled_font: PScaledFont, key: PUserDataKey,
|
proc set_user_data*(scaled_font: PScaledFont, key: PUserDataKey,
|
||||||
user_data: Pointer, destroy: TDestroyFunc): TStatus{.
|
user_data: Pointer, destroy: TDestroyFunc): TStatus{.
|
||||||
cdecl, importc: "cairo_scaled_font_set_user_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_scaled_font_set_user_data", libcairo.}
|
||||||
proc extents*(scaled_font: PScaledFont, extents: PFontExtents){.
|
proc extents*(scaled_font: PScaledFont, extents: PFontExtents){.
|
||||||
cdecl, importc: "cairo_scaled_font_extents", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_scaled_font_extents", libcairo.}
|
||||||
proc text_extents*(scaled_font: PScaledFont, utf8: cstring,
|
proc text_extents*(scaled_font: PScaledFont, utf8: cstring,
|
||||||
extents: PTextExtents){.cdecl,
|
extents: PTextExtents){.cdecl,
|
||||||
importc: "cairo_scaled_font_text_extents", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_text_extents", libcairo.}
|
||||||
proc glyph_extents*(scaled_font: PScaledFont, glyphs: PGlyph,
|
proc glyph_extents*(scaled_font: PScaledFont, glyphs: PGlyph,
|
||||||
num_glyphs: int32, extents: PTextExtents){.
|
num_glyphs: int32, extents: PTextExtents){.
|
||||||
cdecl, importc: "cairo_scaled_font_glyph_extents", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_scaled_font_glyph_extents", libcairo.}
|
||||||
proc get_font_face*(scaled_font: PScaledFont): PFontFace{.cdecl,
|
proc get_font_face*(scaled_font: PScaledFont): PFontFace{.cdecl,
|
||||||
importc: "cairo_scaled_font_get_font_face", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_get_font_face", libcairo.}
|
||||||
proc get_font_matrix*(scaled_font: PScaledFont, font_matrix: PMatrix){.
|
proc get_font_matrix*(scaled_font: PScaledFont, font_matrix: PMatrix){.
|
||||||
cdecl, importc: "cairo_scaled_font_get_font_matrix", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_scaled_font_get_font_matrix", libcairo.}
|
||||||
proc get_ctm*(scaled_font: PScaledFont, ctm: PMatrix){.cdecl,
|
proc get_ctm*(scaled_font: PScaledFont, ctm: PMatrix){.cdecl,
|
||||||
importc: "cairo_scaled_font_get_ctm", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_get_ctm", libcairo.}
|
||||||
proc get_font_options*(scaled_font: PScaledFont,
|
proc get_font_options*(scaled_font: PScaledFont,
|
||||||
options: PFontOptions){.cdecl,
|
options: PFontOptions){.cdecl,
|
||||||
importc: "cairo_scaled_font_get_font_options", dynlib: LIB_CAIRO.}
|
importc: "cairo_scaled_font_get_font_options", libcairo.}
|
||||||
#* Query functions
|
#* Query functions
|
||||||
proc get_operator*(cr: PContext): TOperator{.cdecl, importc: "cairo_get_operator",
|
proc get_operator*(cr: PContext): TOperator{.cdecl, importc: "cairo_get_operator",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_source*(cr: PContext): PPattern{.cdecl, importc: "cairo_get_source",
|
proc get_source*(cr: PContext): PPattern{.cdecl, importc: "cairo_get_source",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_tolerance*(cr: PContext): float64{.cdecl, importc: "cairo_get_tolerance",
|
proc get_tolerance*(cr: PContext): float64{.cdecl, importc: "cairo_get_tolerance",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_antialias*(cr: PContext): TAntialias{.cdecl, importc: "cairo_get_antialias",
|
proc get_antialias*(cr: PContext): TAntialias{.cdecl, importc: "cairo_get_antialias",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_current_point*(cr: PContext, x, y: var float64){.cdecl,
|
proc get_current_point*(cr: PContext, x, y: var float64){.cdecl,
|
||||||
importc: "cairo_get_current_point", dynlib: LIB_CAIRO.}
|
importc: "cairo_get_current_point", libcairo.}
|
||||||
proc get_fill_rule*(cr: PContext): TFillRule{.cdecl, importc: "cairo_get_fill_rule",
|
proc get_fill_rule*(cr: PContext): TFillRule{.cdecl, importc: "cairo_get_fill_rule",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_line_width*(cr: PContext): float64{.cdecl, importc: "cairo_get_line_width",
|
proc get_line_width*(cr: PContext): float64{.cdecl, importc: "cairo_get_line_width",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_line_cap*(cr: PContext): TLineCap{.cdecl, importc: "cairo_get_line_cap",
|
proc get_line_cap*(cr: PContext): TLineCap{.cdecl, importc: "cairo_get_line_cap",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_line_join*(cr: PContext): TLineJoin{.cdecl, importc: "cairo_get_line_join",
|
proc get_line_join*(cr: PContext): TLineJoin{.cdecl, importc: "cairo_get_line_join",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_miter_limit*(cr: PContext): float64{.cdecl, importc: "cairo_get_miter_limit",
|
proc get_miter_limit*(cr: PContext): float64{.cdecl, importc: "cairo_get_miter_limit",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_dash_count*(cr: PContext): int32{.cdecl, importc: "cairo_get_dash_count",
|
proc get_dash_count*(cr: PContext): int32{.cdecl, importc: "cairo_get_dash_count",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_dash*(cr: PContext, dashes, offset: var float64){.cdecl,
|
proc get_dash*(cr: PContext, dashes, offset: var float64){.cdecl,
|
||||||
importc: "cairo_get_dash", dynlib: LIB_CAIRO.}
|
importc: "cairo_get_dash", libcairo.}
|
||||||
proc get_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_get_matrix",
|
proc get_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_get_matrix",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_target*(cr: PContext): PSurface{.cdecl, importc: "cairo_get_target",
|
proc get_target*(cr: PContext): PSurface{.cdecl, importc: "cairo_get_target",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc get_group_target*(cr: PContext): PSurface{.cdecl,
|
proc get_group_target*(cr: PContext): PSurface{.cdecl,
|
||||||
importc: "cairo_get_group_target", dynlib: LIB_CAIRO.}
|
importc: "cairo_get_group_target", libcairo.}
|
||||||
proc copy_path*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path",
|
proc copy_path*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc copy_path_flat*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path_flat",
|
proc copy_path_flat*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path_flat",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc append_path*(cr: PContext, path: PPath){.cdecl, importc: "cairo_append_path",
|
proc append_path*(cr: PContext, path: PPath){.cdecl, importc: "cairo_append_path",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc destroy*(path: PPath){.cdecl, importc: "cairo_path_destroy",
|
proc destroy*(path: PPath){.cdecl, importc: "cairo_path_destroy",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
#* Error status queries
|
#* Error status queries
|
||||||
proc status*(cr: PContext): TStatus{.cdecl, importc: "cairo_status", dynlib: LIB_CAIRO.}
|
proc status*(cr: PContext): TStatus{.cdecl, importc: "cairo_status", libcairo.}
|
||||||
proc status_to_string*(status: TStatus): cstring{.cdecl,
|
proc status_to_string*(status: TStatus): cstring{.cdecl,
|
||||||
importc: "cairo_status_to_string", dynlib: LIB_CAIRO.}
|
importc: "cairo_status_to_string", libcairo.}
|
||||||
#* Surface manipulation
|
#* Surface manipulation
|
||||||
proc surface_create_similar*(other: PSurface, content: TContent,
|
proc surface_create_similar*(other: PSurface, content: TContent,
|
||||||
width, height: int32): PSurface{.cdecl,
|
width, height: int32): PSurface{.cdecl,
|
||||||
importc: "cairo_surface_create_similar", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_create_similar", libcairo.}
|
||||||
proc reference*(surface: PSurface): PSurface{.cdecl,
|
proc reference*(surface: PSurface): PSurface{.cdecl,
|
||||||
importc: "cairo_surface_reference", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_reference", libcairo.}
|
||||||
proc finish*(surface: PSurface){.cdecl, importc: "cairo_surface_finish",
|
proc finish*(surface: PSurface){.cdecl, importc: "cairo_surface_finish",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc destroy*(surface: PSurface){.cdecl,
|
proc destroy*(surface: PSurface){.cdecl,
|
||||||
importc: "cairo_surface_destroy", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_destroy", libcairo.}
|
||||||
proc get_reference_count*(surface: PSurface): int32{.cdecl,
|
proc get_reference_count*(surface: PSurface): int32{.cdecl,
|
||||||
importc: "cairo_surface_get_reference_count", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_get_reference_count", libcairo.}
|
||||||
proc status*(surface: PSurface): TStatus{.cdecl,
|
proc status*(surface: PSurface): TStatus{.cdecl,
|
||||||
importc: "cairo_surface_status", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_status", libcairo.}
|
||||||
proc get_type*(surface: PSurface): TSurfaceType{.cdecl,
|
proc get_type*(surface: PSurface): TSurfaceType{.cdecl,
|
||||||
importc: "cairo_surface_get_type", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_get_type", libcairo.}
|
||||||
proc get_content*(surface: PSurface): TContent{.cdecl,
|
proc get_content*(surface: PSurface): TContent{.cdecl,
|
||||||
importc: "cairo_surface_get_content", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_get_content", libcairo.}
|
||||||
proc write_to_png*(surface: PSurface, filename: cstring): TStatus{.
|
proc write_to_png*(surface: PSurface, filename: cstring): TStatus{.
|
||||||
cdecl, importc: "cairo_surface_write_to_png", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_surface_write_to_png", libcairo.}
|
||||||
proc write_to_png*(surface: PSurface, write_func: TWriteFunc,
|
proc write_to_png*(surface: PSurface, write_func: TWriteFunc,
|
||||||
closure: pointer): TStatus{.cdecl,
|
closure: pointer): TStatus{.cdecl,
|
||||||
importc: "cairo_surface_write_to_png_stream", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_write_to_png_stream", libcairo.}
|
||||||
proc get_user_data*(surface: PSurface, key: PUserDataKey): pointer{.
|
proc get_user_data*(surface: PSurface, key: PUserDataKey): pointer{.
|
||||||
cdecl, importc: "cairo_surface_get_user_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_surface_get_user_data", libcairo.}
|
||||||
proc set_user_data*(surface: PSurface, key: PUserDataKey,
|
proc set_user_data*(surface: PSurface, key: PUserDataKey,
|
||||||
user_data: pointer, destroy: TDestroyFunc): TStatus{.
|
user_data: pointer, destroy: TDestroyFunc): TStatus{.
|
||||||
cdecl, importc: "cairo_surface_set_user_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_surface_set_user_data", libcairo.}
|
||||||
proc get_font_options*(surface: PSurface, options: PFontOptions){.cdecl,
|
proc get_font_options*(surface: PSurface, options: PFontOptions){.cdecl,
|
||||||
importc: "cairo_surface_get_font_options", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_get_font_options", libcairo.}
|
||||||
proc flush*(surface: PSurface){.cdecl, importc: "cairo_surface_flush",
|
proc flush*(surface: PSurface){.cdecl, importc: "cairo_surface_flush",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc mark_dirty*(surface: PSurface){.cdecl,
|
proc mark_dirty*(surface: PSurface){.cdecl,
|
||||||
importc: "cairo_surface_mark_dirty", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_mark_dirty", libcairo.}
|
||||||
proc mark_dirty_rectangle*(surface: PSurface, x, y, width, height: int32){.
|
proc mark_dirty_rectangle*(surface: PSurface, x, y, width, height: int32){.
|
||||||
cdecl, importc: "cairo_surface_mark_dirty_rectangle", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_surface_mark_dirty_rectangle", libcairo.}
|
||||||
proc set_device_offset*(surface: PSurface, x_offset, y_offset: float64){.
|
proc set_device_offset*(surface: PSurface, x_offset, y_offset: float64){.
|
||||||
cdecl, importc: "cairo_surface_set_device_offset", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_surface_set_device_offset", libcairo.}
|
||||||
proc get_device_offset*(surface: PSurface,
|
proc get_device_offset*(surface: PSurface,
|
||||||
x_offset, y_offset: var float64){.cdecl,
|
x_offset, y_offset: var float64){.cdecl,
|
||||||
importc: "cairo_surface_get_device_offset", dynlib: LIB_CAIRO.}
|
importc: "cairo_surface_get_device_offset", libcairo.}
|
||||||
proc set_fallback_resolution*(surface: PSurface, x_pixels_per_inch,
|
proc set_fallback_resolution*(surface: PSurface, x_pixels_per_inch,
|
||||||
y_pixels_per_inch: float64){.cdecl, importc: "cairo_surface_set_fallback_resolution",
|
y_pixels_per_inch: float64){.cdecl, importc: "cairo_surface_set_fallback_resolution",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
#* Image-surface functions
|
#* Image-surface functions
|
||||||
proc image_surface_create*(format: TFormat, width, height: int32): PSurface{.
|
proc image_surface_create*(format: TFormat, width, height: int32): PSurface{.
|
||||||
cdecl, importc: "cairo_image_surface_create", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_image_surface_create", libcairo.}
|
||||||
proc image_surface_create*(data: Pbyte, format: TFormat,
|
proc image_surface_create*(data: Pbyte, format: TFormat,
|
||||||
width, height, stride: int32): PSurface{.
|
width, height, stride: int32): PSurface{.
|
||||||
cdecl, importc: "cairo_image_surface_create_for_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_image_surface_create_for_data", libcairo.}
|
||||||
proc get_data*(surface: PSurface): cstring{.cdecl,
|
proc get_data*(surface: PSurface): cstring{.cdecl,
|
||||||
importc: "cairo_image_surface_get_data", dynlib: LIB_CAIRO.}
|
importc: "cairo_image_surface_get_data", libcairo.}
|
||||||
proc get_format*(surface: PSurface): TFormat{.cdecl,
|
proc get_format*(surface: PSurface): TFormat{.cdecl,
|
||||||
importc: "cairo_image_surface_get_format", dynlib: LIB_CAIRO.}
|
importc: "cairo_image_surface_get_format", libcairo.}
|
||||||
proc get_width*(surface: PSurface): int32{.cdecl,
|
proc get_width*(surface: PSurface): int32{.cdecl,
|
||||||
importc: "cairo_image_surface_get_width", dynlib: LIB_CAIRO.}
|
importc: "cairo_image_surface_get_width", libcairo.}
|
||||||
proc get_height*(surface: PSurface): int32{.cdecl,
|
proc get_height*(surface: PSurface): int32{.cdecl,
|
||||||
importc: "cairo_image_surface_get_height", dynlib: LIB_CAIRO.}
|
importc: "cairo_image_surface_get_height", libcairo.}
|
||||||
proc get_stride*(surface: PSurface): int32{.cdecl,
|
proc get_stride*(surface: PSurface): int32{.cdecl,
|
||||||
importc: "cairo_image_surface_get_stride", dynlib: LIB_CAIRO.}
|
importc: "cairo_image_surface_get_stride", libcairo.}
|
||||||
proc image_surface_create_from_png*(filename: cstring): PSurface{.cdecl,
|
proc image_surface_create_from_png*(filename: cstring): PSurface{.cdecl,
|
||||||
importc: "cairo_image_surface_create_from_png", dynlib: LIB_CAIRO.}
|
importc: "cairo_image_surface_create_from_png", libcairo.}
|
||||||
proc image_surface_create_from_png*(read_func: TReadFunc,
|
proc image_surface_create_from_png*(read_func: TReadFunc,
|
||||||
closure: pointer): PSurface{.cdecl, importc: "cairo_image_surface_create_from_png_stream",
|
closure: pointer): PSurface{.cdecl, importc: "cairo_image_surface_create_from_png_stream",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
#* Pattern creation functions
|
#* Pattern creation functions
|
||||||
proc pattern_create_rgb*(red, green, blue: float64): PPattern{.cdecl,
|
proc pattern_create_rgb*(red, green, blue: float64): PPattern{.cdecl,
|
||||||
importc: "cairo_pattern_create_rgb", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_create_rgb", libcairo.}
|
||||||
proc pattern_create_rgba*(red, green, blue, alpha: float64): PPattern{.cdecl,
|
proc pattern_create_rgba*(red, green, blue, alpha: float64): PPattern{.cdecl,
|
||||||
importc: "cairo_pattern_create_rgba", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_create_rgba", libcairo.}
|
||||||
proc pattern_create_for_surface*(surface: PSurface): PPattern{.cdecl,
|
proc pattern_create_for_surface*(surface: PSurface): PPattern{.cdecl,
|
||||||
importc: "cairo_pattern_create_for_surface", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_create_for_surface", libcairo.}
|
||||||
proc pattern_create_linear*(x0, y0, x1, y1: float64): PPattern{.cdecl,
|
proc pattern_create_linear*(x0, y0, x1, y1: float64): PPattern{.cdecl,
|
||||||
importc: "cairo_pattern_create_linear", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_create_linear", libcairo.}
|
||||||
proc pattern_create_radial*(cx0, cy0, radius0, cx1, cy1, radius1: float64): PPattern{.
|
proc pattern_create_radial*(cx0, cy0, radius0, cx1, cy1, radius1: float64): PPattern{.
|
||||||
cdecl, importc: "cairo_pattern_create_radial", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_create_radial", libcairo.}
|
||||||
proc reference*(pattern: PPattern): PPattern{.cdecl,
|
proc reference*(pattern: PPattern): PPattern{.cdecl,
|
||||||
importc: "cairo_pattern_reference", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_reference", libcairo.}
|
||||||
proc destroy*(pattern: PPattern){.cdecl,
|
proc destroy*(pattern: PPattern){.cdecl,
|
||||||
importc: "cairo_pattern_destroy", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_destroy", libcairo.}
|
||||||
proc get_reference_count*(pattern: PPattern): int32{.cdecl,
|
proc get_reference_count*(pattern: PPattern): int32{.cdecl,
|
||||||
importc: "cairo_pattern_get_reference_count", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_get_reference_count", libcairo.}
|
||||||
proc status*(pattern: PPattern): TStatus{.cdecl,
|
proc status*(pattern: PPattern): TStatus{.cdecl,
|
||||||
importc: "cairo_pattern_status", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_status", libcairo.}
|
||||||
proc get_user_data*(pattern: PPattern, key: PUserDataKey): Pointer{.
|
proc get_user_data*(pattern: PPattern, key: PUserDataKey): Pointer{.
|
||||||
cdecl, importc: "cairo_pattern_get_user_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_get_user_data", libcairo.}
|
||||||
proc set_user_data*(pattern: PPattern, key: PUserDataKey,
|
proc set_user_data*(pattern: PPattern, key: PUserDataKey,
|
||||||
user_data: Pointer, destroy: TDestroyFunc): TStatus{.
|
user_data: Pointer, destroy: TDestroyFunc): TStatus{.
|
||||||
cdecl, importc: "cairo_pattern_set_user_data", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_set_user_data", libcairo.}
|
||||||
proc get_type*(pattern: PPattern): TPatternType{.cdecl,
|
proc get_type*(pattern: PPattern): TPatternType{.cdecl,
|
||||||
importc: "cairo_pattern_get_type", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_get_type", libcairo.}
|
||||||
proc add_color_stop_rgb*(pattern: PPattern,
|
proc add_color_stop_rgb*(pattern: PPattern,
|
||||||
offset, red, green, blue: float64){.cdecl,
|
offset, red, green, blue: float64){.cdecl,
|
||||||
importc: "cairo_pattern_add_color_stop_rgb", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_add_color_stop_rgb", libcairo.}
|
||||||
proc add_color_stop_rgba*(pattern: PPattern,
|
proc add_color_stop_rgba*(pattern: PPattern,
|
||||||
offset, red, green, blue, alpha: float64){.
|
offset, red, green, blue, alpha: float64){.
|
||||||
cdecl, importc: "cairo_pattern_add_color_stop_rgba", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_add_color_stop_rgba", libcairo.}
|
||||||
proc set_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl,
|
proc set_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl,
|
||||||
importc: "cairo_pattern_set_matrix", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_set_matrix", libcairo.}
|
||||||
proc get_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl,
|
proc get_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl,
|
||||||
importc: "cairo_pattern_get_matrix", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_get_matrix", libcairo.}
|
||||||
proc set_extend*(pattern: PPattern, extend: TExtend){.cdecl,
|
proc set_extend*(pattern: PPattern, extend: TExtend){.cdecl,
|
||||||
importc: "cairo_pattern_set_extend", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_set_extend", libcairo.}
|
||||||
proc get_extend*(pattern: PPattern): TExtend{.cdecl,
|
proc get_extend*(pattern: PPattern): TExtend{.cdecl,
|
||||||
importc: "cairo_pattern_get_extend", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_get_extend", libcairo.}
|
||||||
proc set_filter*(pattern: PPattern, filter: TFilter){.cdecl,
|
proc set_filter*(pattern: PPattern, filter: TFilter){.cdecl,
|
||||||
importc: "cairo_pattern_set_filter", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_set_filter", libcairo.}
|
||||||
proc get_filter*(pattern: PPattern): TFilter{.cdecl,
|
proc get_filter*(pattern: PPattern): TFilter{.cdecl,
|
||||||
importc: "cairo_pattern_get_filter", dynlib: LIB_CAIRO.}
|
importc: "cairo_pattern_get_filter", libcairo.}
|
||||||
proc get_rgba*(pattern: PPattern,
|
proc get_rgba*(pattern: PPattern,
|
||||||
red, green, blue, alpha: var float64): TStatus{.
|
red, green, blue, alpha: var float64): TStatus{.
|
||||||
cdecl, importc: "cairo_pattern_get_rgba", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_get_rgba", libcairo.}
|
||||||
proc get_surface*(pattern: PPattern, surface: PPSurface): TStatus{.
|
proc get_surface*(pattern: PPattern, surface: PPSurface): TStatus{.
|
||||||
cdecl, importc: "cairo_pattern_get_surface", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_get_surface", libcairo.}
|
||||||
proc get_color_stop_rgba*(pattern: PPattern, index: int32,
|
proc get_color_stop_rgba*(pattern: PPattern, index: int32,
|
||||||
offset, red, green, blue, alpha: var float64): TStatus{.
|
offset, red, green, blue, alpha: var float64): TStatus{.
|
||||||
cdecl, importc: "cairo_pattern_get_color_stop_rgba", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_get_color_stop_rgba", libcairo.}
|
||||||
proc get_color_stop_count*(pattern: PPattern, count: var int32): TStatus{.
|
proc get_color_stop_count*(pattern: PPattern, count: var int32): TStatus{.
|
||||||
cdecl, importc: "cairo_pattern_get_color_stop_count", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_get_color_stop_count", libcairo.}
|
||||||
proc get_linear_points*(pattern: PPattern,
|
proc get_linear_points*(pattern: PPattern,
|
||||||
x0, y0, x1, y1: var float64): TStatus{.
|
x0, y0, x1, y1: var float64): TStatus{.
|
||||||
cdecl, importc: "cairo_pattern_get_linear_points", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_get_linear_points", libcairo.}
|
||||||
proc get_radial_circles*(pattern: PPattern,
|
proc get_radial_circles*(pattern: PPattern,
|
||||||
x0, y0, r0, x1, y1, r1: var float64): TStatus{.
|
x0, y0, r0, x1, y1, r1: var float64): TStatus{.
|
||||||
cdecl, importc: "cairo_pattern_get_radial_circles", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pattern_get_radial_circles", libcairo.}
|
||||||
#* Matrix functions
|
#* Matrix functions
|
||||||
proc init*(matrix: PMatrix, xx, yx, xy, yy, x0, y0: float64){.cdecl,
|
proc init*(matrix: PMatrix, xx, yx, xy, yy, x0, y0: float64){.cdecl,
|
||||||
importc: "cairo_matrix_init", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_init", libcairo.}
|
||||||
proc init_identity*(matrix: PMatrix){.cdecl,
|
proc init_identity*(matrix: PMatrix){.cdecl,
|
||||||
importc: "cairo_matrix_init_identity", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_init_identity", libcairo.}
|
||||||
proc init_translate*(matrix: PMatrix, tx, ty: float64){.cdecl,
|
proc init_translate*(matrix: PMatrix, tx, ty: float64){.cdecl,
|
||||||
importc: "cairo_matrix_init_translate", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_init_translate", libcairo.}
|
||||||
proc init_scale*(matrix: PMatrix, sx, sy: float64){.cdecl,
|
proc init_scale*(matrix: PMatrix, sx, sy: float64){.cdecl,
|
||||||
importc: "cairo_matrix_init_scale", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_init_scale", libcairo.}
|
||||||
proc init_rotate*(matrix: PMatrix, radians: float64){.cdecl,
|
proc init_rotate*(matrix: PMatrix, radians: float64){.cdecl,
|
||||||
importc: "cairo_matrix_init_rotate", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_init_rotate", libcairo.}
|
||||||
proc translate*(matrix: PMatrix, tx, ty: float64){.cdecl,
|
proc translate*(matrix: PMatrix, tx, ty: float64){.cdecl,
|
||||||
importc: "cairo_matrix_translate", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_translate", libcairo.}
|
||||||
proc scale*(matrix: PMatrix, sx, sy: float64){.cdecl,
|
proc scale*(matrix: PMatrix, sx, sy: float64){.cdecl,
|
||||||
importc: "cairo_matrix_scale", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_scale", libcairo.}
|
||||||
proc rotate*(matrix: PMatrix, radians: float64){.cdecl,
|
proc rotate*(matrix: PMatrix, radians: float64){.cdecl,
|
||||||
importc: "cairo_matrix_rotate", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_rotate", libcairo.}
|
||||||
proc invert*(matrix: PMatrix): TStatus{.cdecl,
|
proc invert*(matrix: PMatrix): TStatus{.cdecl,
|
||||||
importc: "cairo_matrix_invert", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_invert", libcairo.}
|
||||||
proc multiply*(result, a, b: PMatrix){.cdecl,
|
proc multiply*(result, a, b: PMatrix){.cdecl,
|
||||||
importc: "cairo_matrix_multiply", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_multiply", libcairo.}
|
||||||
proc transform_distance*(matrix: PMatrix, dx, dy: var float64){.cdecl,
|
proc transform_distance*(matrix: PMatrix, dx, dy: var float64){.cdecl,
|
||||||
importc: "cairo_matrix_transform_distance", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_transform_distance", libcairo.}
|
||||||
proc transform_point*(matrix: PMatrix, x, y: var float64){.cdecl,
|
proc transform_point*(matrix: PMatrix, x, y: var float64){.cdecl,
|
||||||
importc: "cairo_matrix_transform_point", dynlib: LIB_CAIRO.}
|
importc: "cairo_matrix_transform_point", libcairo.}
|
||||||
#* PDF functions
|
#* PDF functions
|
||||||
proc pdf_surface_create*(filename: cstring,
|
proc pdf_surface_create*(filename: cstring,
|
||||||
width_in_points, height_in_points: float64): PSurface{.
|
width_in_points, height_in_points: float64): PSurface{.
|
||||||
cdecl, importc: "cairo_pdf_surface_create", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pdf_surface_create", libcairo.}
|
||||||
proc pdf_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
proc pdf_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
||||||
width_in_points, height_in_points: float64): PSurface{.
|
width_in_points, height_in_points: float64): PSurface{.
|
||||||
cdecl, importc: "cairo_pdf_surface_create_for_stream", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_pdf_surface_create_for_stream", libcairo.}
|
||||||
proc pdf_surface_set_size*(surface: PSurface,
|
proc pdf_surface_set_size*(surface: PSurface,
|
||||||
width_in_points, height_in_points: float64){.cdecl,
|
width_in_points, height_in_points: float64){.cdecl,
|
||||||
importc: "cairo_pdf_surface_set_size", dynlib: LIB_CAIRO.}
|
importc: "cairo_pdf_surface_set_size", libcairo.}
|
||||||
#* PS functions
|
#* PS functions
|
||||||
proc ps_surface_create*(filename: cstring,
|
proc ps_surface_create*(filename: cstring,
|
||||||
width_in_points, height_in_points: float64): PSurface{.
|
width_in_points, height_in_points: float64): PSurface{.
|
||||||
cdecl, importc: "cairo_ps_surface_create", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_ps_surface_create", libcairo.}
|
||||||
proc ps_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
proc ps_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
||||||
width_in_points, height_in_points: float64): PSurface{.
|
width_in_points, height_in_points: float64): PSurface{.
|
||||||
cdecl, importc: "cairo_ps_surface_create_for_stream", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_ps_surface_create_for_stream", libcairo.}
|
||||||
proc ps_surface_set_size*(surface: PSurface,
|
proc ps_surface_set_size*(surface: PSurface,
|
||||||
width_in_points, height_in_points: float64){.cdecl,
|
width_in_points, height_in_points: float64){.cdecl,
|
||||||
importc: "cairo_ps_surface_set_size", dynlib: LIB_CAIRO.}
|
importc: "cairo_ps_surface_set_size", libcairo.}
|
||||||
proc ps_surface_dsc_comment*(surface: PSurface, comment: cstring){.cdecl,
|
proc ps_surface_dsc_comment*(surface: PSurface, comment: cstring){.cdecl,
|
||||||
importc: "cairo_ps_surface_dsc_comment", dynlib: LIB_CAIRO.}
|
importc: "cairo_ps_surface_dsc_comment", libcairo.}
|
||||||
proc ps_surface_dsc_begin_setup*(surface: PSurface){.cdecl,
|
proc ps_surface_dsc_begin_setup*(surface: PSurface){.cdecl,
|
||||||
importc: "cairo_ps_surface_dsc_begin_setup", dynlib: LIB_CAIRO.}
|
importc: "cairo_ps_surface_dsc_begin_setup", libcairo.}
|
||||||
proc ps_surface_dsc_begin_page_setup*(surface: PSurface){.cdecl,
|
proc ps_surface_dsc_begin_page_setup*(surface: PSurface){.cdecl,
|
||||||
importc: "cairo_ps_surface_dsc_begin_page_setup", dynlib: LIB_CAIRO.}
|
importc: "cairo_ps_surface_dsc_begin_page_setup", libcairo.}
|
||||||
#* SVG functions
|
#* SVG functions
|
||||||
proc svg_surface_create*(filename: cstring,
|
proc svg_surface_create*(filename: cstring,
|
||||||
width_in_points, height_in_points: float64): PSurface{.
|
width_in_points, height_in_points: float64): PSurface{.
|
||||||
cdecl, importc: "cairo_svg_surface_create", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_svg_surface_create", libcairo.}
|
||||||
proc svg_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
proc svg_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
|
||||||
width_in_points, height_in_points: float64): PSurface{.
|
width_in_points, height_in_points: float64): PSurface{.
|
||||||
cdecl, importc: "cairo_svg_surface_create_for_stream", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_svg_surface_create_for_stream", libcairo.}
|
||||||
proc svg_surface_restrict_to_version*(surface: PSurface, version: TSvgVersion){.
|
proc svg_surface_restrict_to_version*(surface: PSurface, version: TSvgVersion){.
|
||||||
cdecl, importc: "cairo_svg_surface_restrict_to_version", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_svg_surface_restrict_to_version", libcairo.}
|
||||||
#todo: see how translate this
|
#todo: see how translate this
|
||||||
#procedure cairo_svg_get_versions(TCairoSvgVersion const **versions,
|
#procedure cairo_svg_get_versions(TCairoSvgVersion const **versions,
|
||||||
# int *num_versions);
|
# int *num_versions);
|
||||||
proc svg_version_to_string*(version: TSvgVersion): cstring{.cdecl,
|
proc svg_version_to_string*(version: TSvgVersion): cstring{.cdecl,
|
||||||
importc: "cairo_svg_version_to_string", dynlib: LIB_CAIRO.}
|
importc: "cairo_svg_version_to_string", libcairo.}
|
||||||
#* Functions to be used while debugging (not intended for use in production code)
|
#* Functions to be used while debugging (not intended for use in production code)
|
||||||
proc debug_reset_static_data*(){.cdecl,
|
proc debug_reset_static_data*(){.cdecl,
|
||||||
importc: "cairo_debug_reset_static_data",
|
importc: "cairo_debug_reset_static_data",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
# implementation
|
# implementation
|
||||||
|
|
||||||
proc version(major, minor, micro: var int32) =
|
proc version(major, minor, micro: var int32) =
|
||||||
|
|
|
||||||
16
lib/wrappers/cairo/cairo_pragma.nim
Normal file
16
lib/wrappers/cairo/cairo_pragma.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
# included by cairo bindings
|
||||||
|
|
||||||
|
when defined(use_pkg_config) or defined(use_pkg_config_static):
|
||||||
|
{.pragma: libcairo, cdecl.}
|
||||||
|
when defined(use_pkg_config_static):
|
||||||
|
{.passl: gorge("pkg-config cairo --libs --static").}
|
||||||
|
else:
|
||||||
|
{.passl: gorge("pkg-config cairo --libs").}
|
||||||
|
else:
|
||||||
|
when defined(windows):
|
||||||
|
const LIB_CAIRO* = "libcairo-2.dll"
|
||||||
|
elif defined(macosx):
|
||||||
|
const LIB_CAIRO* = "libcairo.dylib"
|
||||||
|
else:
|
||||||
|
const LIB_CAIRO* = "libcairo.so(|.2)"
|
||||||
|
{.pragma: libcairo, cdecl, dynlib: LIB_CAIRO.}
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
import
|
import
|
||||||
cairo, freetypeh
|
cairo, freetypeh
|
||||||
|
|
||||||
|
include "cairo_pragma.nim"
|
||||||
#todo: properly define FcPattern:
|
#todo: properly define FcPattern:
|
||||||
#It will require translate FontConfig header
|
#It will require translate FontConfig header
|
||||||
|
|
||||||
|
|
@ -23,13 +24,13 @@ type
|
||||||
FcPattern* = Pointer
|
FcPattern* = Pointer
|
||||||
PFcPattern* = ptr FcPattern
|
PFcPattern* = ptr FcPattern
|
||||||
|
|
||||||
proc ft_font_face_create_for_pattern*(pattern: PFcPattern): PFontFace{.cdecl,
|
proc ft_font_face_create_for_pattern*(pattern: PFcPattern): PFontFace{.libcairo,
|
||||||
importc: "cairo_ft_font_face_create_for_pattern", dynlib: LIB_CAIRO.}
|
importc: "cairo_ft_font_face_create_for_pattern".}
|
||||||
proc ft_font_options_substitute*(options: PFontOptions, pattern: PFcPattern){.
|
proc ft_font_options_substitute*(options: PFontOptions, pattern: PFcPattern){.
|
||||||
cdecl, importc: "cairo_ft_font_options_substitute", dynlib: LIB_CAIRO.}
|
libcairo, importc: "cairo_ft_font_options_substitute".}
|
||||||
proc ft_font_face_create_for_ft_face*(face: TFT_Face, load_flags: int32): PFontFace{.
|
proc ft_font_face_create_for_ft_face*(face: TFT_Face, load_flags: int32): PFontFace{.libcairo,
|
||||||
cdecl, importc: "cairo_ft_font_face_create_for_ft_face", dynlib: LIB_CAIRO.}
|
importc: "cairo_ft_font_face_create_for_ft_face".}
|
||||||
proc ft_scaled_font_lock_face*(scaled_font: PScaledFont): TFT_Face{.cdecl,
|
proc ft_scaled_font_lock_face*(scaled_font: PScaledFont): TFT_Face{.libcairo,
|
||||||
importc: "cairo_ft_scaled_font_lock_face", dynlib: LIB_CAIRO.}
|
importc: "cairo_ft_scaled_font_lock_face".}
|
||||||
proc ft_scaled_font_unlock_face*(scaled_font: PScaledFont){.cdecl,
|
proc ft_scaled_font_unlock_face*(scaled_font: PScaledFont){.libcairo,
|
||||||
importc: "cairo_ft_scaled_font_unlock_face", dynlib: LIB_CAIRO.}
|
importc: "cairo_ft_scaled_font_unlock_face".}
|
||||||
|
|
|
||||||
|
|
@ -7,33 +7,35 @@
|
||||||
import
|
import
|
||||||
cairo, x, xlib, xrender
|
cairo, x, xlib, xrender
|
||||||
|
|
||||||
|
include "cairo_pragma.nim"
|
||||||
|
|
||||||
proc xlib_surface_create*(dpy: PDisplay, drawable: TDrawable, visual: PVisual,
|
proc xlib_surface_create*(dpy: PDisplay, drawable: TDrawable, visual: PVisual,
|
||||||
width, height: int32): PSurface{.cdecl,
|
width, height: int32): PSurface{.cdecl,
|
||||||
importc: "cairo_xlib_surface_create", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_create", libcairo.}
|
||||||
proc xlib_surface_create_for_bitmap*(dpy: PDisplay, bitmap: TPixmap,
|
proc xlib_surface_create_for_bitmap*(dpy: PDisplay, bitmap: TPixmap,
|
||||||
screen: PScreen, width, height: int32): PSurface{.
|
screen: PScreen, width, height: int32): PSurface{.
|
||||||
cdecl, importc: "cairo_xlib_surface_create_for_bitmap", dynlib: LIB_CAIRO.}
|
cdecl, importc: "cairo_xlib_surface_create_for_bitmap", libcairo.}
|
||||||
proc xlib_surface_create_with_xrender_format*(dpy: PDisplay,
|
proc xlib_surface_create_with_xrender_format*(dpy: PDisplay,
|
||||||
drawable: TDrawable, screen: PScreen, format: PXRenderPictFormat,
|
drawable: TDrawable, screen: PScreen, format: PXRenderPictFormat,
|
||||||
width, height: int32): PSurface{.cdecl, importc: "cairo_xlib_surface_create_with_xrender_format",
|
width, height: int32): PSurface{.cdecl, importc: "cairo_xlib_surface_create_with_xrender_format",
|
||||||
dynlib: LIB_CAIRO.}
|
libcairo.}
|
||||||
proc xlib_surface_get_depth*(surface: PSurface): int32{.cdecl,
|
proc xlib_surface_get_depth*(surface: PSurface): int32{.cdecl,
|
||||||
importc: "cairo_xlib_surface_get_depth", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_get_depth", libcairo.}
|
||||||
proc xlib_surface_get_display*(surface: PSurface): PDisplay{.cdecl,
|
proc xlib_surface_get_display*(surface: PSurface): PDisplay{.cdecl,
|
||||||
importc: "cairo_xlib_surface_get_display", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_get_display", libcairo.}
|
||||||
proc xlib_surface_get_drawable*(surface: PSurface): TDrawable{.cdecl,
|
proc xlib_surface_get_drawable*(surface: PSurface): TDrawable{.cdecl,
|
||||||
importc: "cairo_xlib_surface_get_drawable", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_get_drawable", libcairo.}
|
||||||
proc xlib_surface_get_height*(surface: PSurface): int32{.cdecl,
|
proc xlib_surface_get_height*(surface: PSurface): int32{.cdecl,
|
||||||
importc: "cairo_xlib_surface_get_height", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_get_height", libcairo.}
|
||||||
proc xlib_surface_get_screen*(surface: PSurface): PScreen{.cdecl,
|
proc xlib_surface_get_screen*(surface: PSurface): PScreen{.cdecl,
|
||||||
importc: "cairo_xlib_surface_get_screen", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_get_screen", libcairo.}
|
||||||
proc xlib_surface_get_visual*(surface: PSurface): PVisual{.cdecl,
|
proc xlib_surface_get_visual*(surface: PSurface): PVisual{.cdecl,
|
||||||
importc: "cairo_xlib_surface_get_visual", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_get_visual", libcairo.}
|
||||||
proc xlib_surface_get_width*(surface: PSurface): int32{.cdecl,
|
proc xlib_surface_get_width*(surface: PSurface): int32{.cdecl,
|
||||||
importc: "cairo_xlib_surface_get_width", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_get_width", libcairo.}
|
||||||
proc xlib_surface_set_size*(surface: PSurface, width, height: int32){.cdecl,
|
proc xlib_surface_set_size*(surface: PSurface, width, height: int32){.cdecl,
|
||||||
importc: "cairo_xlib_surface_set_size", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_set_size", libcairo.}
|
||||||
proc xlib_surface_set_drawable*(surface: PSurface, drawable: TDrawable,
|
proc xlib_surface_set_drawable*(surface: PSurface, drawable: TDrawable,
|
||||||
width, height: int32){.cdecl,
|
width, height: int32){.cdecl,
|
||||||
importc: "cairo_xlib_surface_set_drawable", dynlib: LIB_CAIRO.}
|
importc: "cairo_xlib_surface_set_drawable", libcairo.}
|
||||||
# implementation
|
# implementation
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
{.deadCodeElim: on.}
|
{.deadCodeElim: on.}
|
||||||
|
import unsigned
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
const
|
const
|
||||||
LibName = "SDL.dll"
|
LibName = "SDL.dll"
|
||||||
|
|
@ -1807,7 +1808,7 @@ proc ListModes*(format: PPixelFormat, flags: int32): PPSDL_Rect{.cdecl,
|
||||||
# applications that redraw the entire screen on every update.
|
# applications that redraw the entire screen on every update.
|
||||||
#
|
#
|
||||||
# This function returns the video framebuffer surface, or NULL if it fails.
|
# This function returns the video framebuffer surface, or NULL if it fails.
|
||||||
proc SetVideoMode*(width, height, bpp: int, flags: int32): PSurface{.cdecl,
|
proc SetVideoMode*(width, height, bpp: int, flags: uint32): PSurface{.cdecl,
|
||||||
importc: "SDL_SetVideoMode", dynlib: LibName.}
|
importc: "SDL_SetVideoMode", dynlib: LibName.}
|
||||||
# Makes sure the given list of rectangles is updated on the given screen.
|
# Makes sure the given list of rectangles is updated on the given screen.
|
||||||
# If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
|
# If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,17 @@ proc IMG_Linked_Version*(): Pversion{.importc: "IMG_Linked_Version",
|
||||||
# surface afterwards by calling:
|
# surface afterwards by calling:
|
||||||
# SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey);
|
# SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey);
|
||||||
#
|
#
|
||||||
|
|
||||||
|
const
|
||||||
|
IMG_INIT_JPG* = 0x00000001
|
||||||
|
IMG_INIT_PNG* = 0x00000002
|
||||||
|
IMG_INIT_TIF* = 0x00000004
|
||||||
|
IMG_INIT_WEBP* = 0x00000008
|
||||||
|
|
||||||
|
proc IMG_Init*(flags: cint): int {.cdecl, importc: "IMG_Init",
|
||||||
|
dynlib: ImageLibName.}
|
||||||
|
proc IMG_Quit*() {.cdecl, importc: "IMG_Quit",
|
||||||
|
dynlib: ImageLibName.}
|
||||||
proc IMG_LoadTyped_RW*(src: PRWops, freesrc: cint, theType: cstring): PSurface{.
|
proc IMG_LoadTyped_RW*(src: PRWops, freesrc: cint, theType: cstring): PSurface{.
|
||||||
cdecl, importc: "IMG_LoadTyped_RW", dynlib: ImageLibName.}
|
cdecl, importc: "IMG_LoadTyped_RW", dynlib: ImageLibName.}
|
||||||
# Convenience functions
|
# Convenience functions
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
# x.h
|
# x.h
|
||||||
#
|
#
|
||||||
# Pointers to basic pascal types, inserted by h2pas conversion program.
|
# Pointers to basic pascal types, inserted by h2pas conversion program.
|
||||||
|
import unsigned
|
||||||
|
|
||||||
const
|
const
|
||||||
X_PROTOCOL* = 11
|
X_PROTOCOL* = 11
|
||||||
|
|
@ -47,6 +48,9 @@ type
|
||||||
PKeyCode* = ptr TKeyCode
|
PKeyCode* = ptr TKeyCode
|
||||||
TKeyCode* = cuchar
|
TKeyCode* = cuchar
|
||||||
|
|
||||||
|
proc `==`*(a, b: TAtom): bool =
|
||||||
|
return unsigned.`==`(a,b)
|
||||||
|
|
||||||
const
|
const
|
||||||
None* = 0
|
None* = 0
|
||||||
ParentRelative* = 1
|
ParentRelative* = 1
|
||||||
|
|
|
||||||
20
lib/wrappers/x11/x11pragma.nim
Normal file
20
lib/wrappers/x11/x11pragma.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
# included from xlib bindings
|
||||||
|
|
||||||
|
|
||||||
|
when defined(use_pkg_config) or defined(use_pkg_config_static):
|
||||||
|
{.pragma: libx11, cdecl, importc.}
|
||||||
|
{.pragma: libx11c, cdecl.}
|
||||||
|
when defined(use_pkg_config_static):
|
||||||
|
{.passl: gorge("pkg-config x11 --static --libs").}
|
||||||
|
else:
|
||||||
|
{.passl: gorge("pkg-config x11 --libs").}
|
||||||
|
else:
|
||||||
|
when defined(macosx):
|
||||||
|
const
|
||||||
|
libX11* = "libX11.dylib"
|
||||||
|
else:
|
||||||
|
const
|
||||||
|
libX11* = "libX11.so"
|
||||||
|
|
||||||
|
{.pragma: libx11, cdecl, dynlib: libX11, importc.}
|
||||||
|
{.pragma: libx11c, cdecl, dynlib: libX11.}
|
||||||
|
|
@ -71,6 +71,8 @@
|
||||||
import
|
import
|
||||||
X, Xlib
|
X, Xlib
|
||||||
|
|
||||||
|
include "x11pragma.nim"
|
||||||
|
|
||||||
proc XkbCharToInt*(v: int8): int16
|
proc XkbCharToInt*(v: int8): int16
|
||||||
proc XkbIntTo2Chars*(i: int16, h, L: var int8)
|
proc XkbIntTo2Chars*(i: int16, h, L: var int8)
|
||||||
proc Xkb2CharsToInt*(h, L: int8): int16
|
proc Xkb2CharsToInt*(h, L: int8): int16
|
||||||
|
|
@ -1700,224 +1702,200 @@ proc XkbSetKeyShape*(g: PXkbGeometryPtr, k: PXkbKeyPtr, s: PXkbShapeDoodadPtr)
|
||||||
proc XkbSetKeyColor*(g: PXkbGeometryPtr, k: PXkbKeyPtr, c: PXkbColorPtr)
|
proc XkbSetKeyColor*(g: PXkbGeometryPtr, k: PXkbKeyPtr, c: PXkbColorPtr)
|
||||||
proc XkbGeomColorIndex*(g: PXkbGeometryPtr, c: PXkbColorPtr): int32
|
proc XkbGeomColorIndex*(g: PXkbGeometryPtr, c: PXkbColorPtr): int32
|
||||||
proc XkbAddGeomProperty*(geom: PXkbGeometryPtr, name: cstring, value: cstring): PXkbPropertyPtr{.
|
proc XkbAddGeomProperty*(geom: PXkbGeometryPtr, name: cstring, value: cstring): PXkbPropertyPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomProperty".}
|
libx11c, importc: "XkbAddGeomProperty".}
|
||||||
proc XkbAddGeomKeyAlias*(geom: PXkbGeometryPtr, alias: cstring, float: cstring): PXkbKeyAliasPtr{.
|
proc XkbAddGeomKeyAlias*(geom: PXkbGeometryPtr, alias: cstring, float: cstring): PXkbKeyAliasPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomKeyAlias".}
|
libx11c, importc: "XkbAddGeomKeyAlias".}
|
||||||
proc XkbAddGeomColor*(geom: PXkbGeometryPtr, spec: cstring, pixel: int16): PXkbColorPtr{.
|
proc XkbAddGeomColor*(geom: PXkbGeometryPtr, spec: cstring, pixel: int16): PXkbColorPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomColor".}
|
libx11c, importc: "XkbAddGeomColor".}
|
||||||
proc XkbAddGeomOutline*(shape: PXkbShapePtr, sz_points: int16): PXkbOutlinePtr{.
|
proc XkbAddGeomOutline*(shape: PXkbShapePtr, sz_points: int16): PXkbOutlinePtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomOutline".}
|
libx11c, importc: "XkbAddGeomOutline".}
|
||||||
proc XkbAddGeomShape*(geom: PXkbGeometryPtr, name: TAtom, sz_outlines: int16): PXkbShapePtr{.
|
proc XkbAddGeomShape*(geom: PXkbGeometryPtr, name: TAtom, sz_outlines: int16): PXkbShapePtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomShape".}
|
libx11c, importc: "XkbAddGeomShape".}
|
||||||
proc XkbAddGeomKey*(row: PXkbRowPtr): PXkbKeyPtr{.cdecl, dynlib: libX11,
|
proc XkbAddGeomKey*(row: PXkbRowPtr): PXkbKeyPtr{.libx11c,
|
||||||
importc: "XkbAddGeomKey".}
|
importc: "XkbAddGeomKey".}
|
||||||
proc XkbAddGeomRow*(section: PXkbSectionPtr, sz_keys: int16): PXkbRowPtr{.cdecl,
|
proc XkbAddGeomRow*(section: PXkbSectionPtr, sz_keys: int16): PXkbRowPtr{.libx11c, importc: "XkbAddGeomRow".}
|
||||||
dynlib: libX11, importc: "XkbAddGeomRow".}
|
|
||||||
proc XkbAddGeomSection*(geom: PXkbGeometryPtr, name: TAtom, sz_rows: int16,
|
proc XkbAddGeomSection*(geom: PXkbGeometryPtr, name: TAtom, sz_rows: int16,
|
||||||
sz_doodads: int16, sz_overlays: int16): PXkbSectionPtr{.
|
sz_doodads: int16, sz_overlays: int16): PXkbSectionPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomSection".}
|
libx11c, importc: "XkbAddGeomSection".}
|
||||||
proc XkbAddGeomOverlay*(section: PXkbSectionPtr, name: TAtom, sz_rows: int16): PXkbOverlayPtr{.
|
proc XkbAddGeomOverlay*(section: PXkbSectionPtr, name: TAtom, sz_rows: int16): PXkbOverlayPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomOverlay".}
|
libx11c, importc: "XkbAddGeomOverlay".}
|
||||||
proc XkbAddGeomOverlayRow*(overlay: PXkbOverlayPtr, row_under: int16,
|
proc XkbAddGeomOverlayRow*(overlay: PXkbOverlayPtr, row_under: int16,
|
||||||
sz_keys: int16): PXkbOverlayRowPtr{.cdecl,
|
sz_keys: int16): PXkbOverlayRowPtr{.libx11c, importc: "XkbAddGeomOverlayRow".}
|
||||||
dynlib: libX11, importc: "XkbAddGeomOverlayRow".}
|
|
||||||
proc XkbAddGeomOverlayKey*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
|
proc XkbAddGeomOverlayKey*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
|
||||||
over: cstring, under: cstring): PXkbOverlayKeyPtr{.
|
over: cstring, under: cstring): PXkbOverlayKeyPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomOverlayKey".}
|
libx11c, importc: "XkbAddGeomOverlayKey".}
|
||||||
proc XkbAddGeomDoodad*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
|
proc XkbAddGeomDoodad*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
|
||||||
name: TAtom): PXkbDoodadPtr{.cdecl, dynlib: libX11,
|
name: TAtom): PXkbDoodadPtr{.libx11c,
|
||||||
importc: "XkbAddGeomDoodad".}
|
importc: "XkbAddGeomDoodad".}
|
||||||
proc XkbFreeGeomKeyAliases*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
proc XkbFreeGeomKeyAliases*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomKeyAliases".}
|
importc: "XkbFreeGeomKeyAliases".}
|
||||||
proc XkbFreeGeomColors*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
proc XkbFreeGeomColors*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomColors".}
|
importc: "XkbFreeGeomColors".}
|
||||||
proc XkbFreeGeomDoodads*(doodads: PXkbDoodadPtr, nDoodads: int16, freeAll: bool){.
|
proc XkbFreeGeomDoodads*(doodads: PXkbDoodadPtr, nDoodads: int16, freeAll: bool){.
|
||||||
cdecl, dynlib: libX11, importc: "XkbFreeGeomDoodads".}
|
libx11c, importc: "XkbFreeGeomDoodads".}
|
||||||
proc XkbFreeGeomProperties*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
proc XkbFreeGeomProperties*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomProperties".}
|
importc: "XkbFreeGeomProperties".}
|
||||||
proc XkbFreeGeomOverlayKeys*(row: PXkbOverlayRowPtr, first: int16, count: int16,
|
proc XkbFreeGeomOverlayKeys*(row: PXkbOverlayRowPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomOverlayKeys".}
|
importc: "XkbFreeGeomOverlayKeys".}
|
||||||
proc XkbFreeGeomOverlayRows*(overlay: PXkbOverlayPtr, first: int16,
|
proc XkbFreeGeomOverlayRows*(overlay: PXkbOverlayPtr, first: int16,
|
||||||
count: int16, freeAll: bool){.cdecl,
|
count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayRows".}
|
||||||
dynlib: libX11, importc: "XkbFreeGeomOverlayRows".}
|
|
||||||
proc XkbFreeGeomOverlays*(section: PXkbSectionPtr, first: int16, count: int16,
|
proc XkbFreeGeomOverlays*(section: PXkbSectionPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomOverlays".}
|
importc: "XkbFreeGeomOverlays".}
|
||||||
proc XkbFreeGeomKeys*(row: PXkbRowPtr, first: int16, count: int16, freeAll: bool){.
|
proc XkbFreeGeomKeys*(row: PXkbRowPtr, first: int16, count: int16, freeAll: bool){.
|
||||||
cdecl, dynlib: libX11, importc: "XkbFreeGeomKeys".}
|
libx11c, importc: "XkbFreeGeomKeys".}
|
||||||
proc XkbFreeGeomRows*(section: PXkbSectionPtr, first: int16, count: int16,
|
proc XkbFreeGeomRows*(section: PXkbSectionPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomRows".}
|
importc: "XkbFreeGeomRows".}
|
||||||
proc XkbFreeGeomSections*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
proc XkbFreeGeomSections*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomSections".}
|
importc: "XkbFreeGeomSections".}
|
||||||
proc XkbFreeGeomPoints*(outline: PXkbOutlinePtr, first: int16, count: int16,
|
proc XkbFreeGeomPoints*(outline: PXkbOutlinePtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomPoints".}
|
importc: "XkbFreeGeomPoints".}
|
||||||
proc XkbFreeGeomOutlines*(shape: PXkbShapePtr, first: int16, count: int16,
|
proc XkbFreeGeomOutlines*(shape: PXkbShapePtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomOutlines".}
|
importc: "XkbFreeGeomOutlines".}
|
||||||
proc XkbFreeGeomShapes*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
proc XkbFreeGeomShapes*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomShapes".}
|
importc: "XkbFreeGeomShapes".}
|
||||||
proc XkbFreeGeometry*(geom: PXkbGeometryPtr, which: int16, freeMap: bool){.
|
proc XkbFreeGeometry*(geom: PXkbGeometryPtr, which: int16, freeMap: bool){.
|
||||||
cdecl, dynlib: libX11, importc: "XkbFreeGeometry".}
|
libx11c, importc: "XkbFreeGeometry".}
|
||||||
proc XkbAllocGeomProps*(geom: PXkbGeometryPtr, nProps: int16): TStatus{.cdecl,
|
proc XkbAllocGeomProps*(geom: PXkbGeometryPtr, nProps: int16): TStatus{.libx11c, importc: "XkbAllocGeomProps".}
|
||||||
dynlib: libX11, importc: "XkbAllocGeomProps".}
|
|
||||||
proc XkbAllocGeomKeyAliases*(geom: PXkbGeometryPtr, nAliases: int16): TStatus{.
|
proc XkbAllocGeomKeyAliases*(geom: PXkbGeometryPtr, nAliases: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomKeyAliases".}
|
libx11c, importc: "XkbAllocGeomKeyAliases".}
|
||||||
proc XkbAllocGeomColors*(geom: PXkbGeometryPtr, nColors: int16): TStatus{.cdecl,
|
proc XkbAllocGeomColors*(geom: PXkbGeometryPtr, nColors: int16): TStatus{.libx11c, importc: "XkbAllocGeomColors".}
|
||||||
dynlib: libX11, importc: "XkbAllocGeomColors".}
|
proc XkbAllocGeomShapes*(geom: PXkbGeometryPtr, nShapes: int16): TStatus{.libx11c, importc: "XkbAllocGeomShapes".}
|
||||||
proc XkbAllocGeomShapes*(geom: PXkbGeometryPtr, nShapes: int16): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbAllocGeomShapes".}
|
|
||||||
proc XkbAllocGeomSections*(geom: PXkbGeometryPtr, nSections: int16): TStatus{.
|
proc XkbAllocGeomSections*(geom: PXkbGeometryPtr, nSections: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomSections".}
|
libx11c, importc: "XkbAllocGeomSections".}
|
||||||
proc XkbAllocGeomOverlays*(section: PXkbSectionPtr, num_needed: int16): TStatus{.
|
proc XkbAllocGeomOverlays*(section: PXkbSectionPtr, num_needed: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomOverlays".}
|
libx11c, importc: "XkbAllocGeomOverlays".}
|
||||||
proc XkbAllocGeomOverlayRows*(overlay: PXkbOverlayPtr, num_needed: int16): TStatus{.
|
proc XkbAllocGeomOverlayRows*(overlay: PXkbOverlayPtr, num_needed: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomOverlayRows".}
|
libx11c, importc: "XkbAllocGeomOverlayRows".}
|
||||||
proc XkbAllocGeomOverlayKeys*(row: PXkbOverlayRowPtr, num_needed: int16): TStatus{.
|
proc XkbAllocGeomOverlayKeys*(row: PXkbOverlayRowPtr, num_needed: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomOverlayKeys".}
|
libx11c, importc: "XkbAllocGeomOverlayKeys".}
|
||||||
proc XkbAllocGeomDoodads*(geom: PXkbGeometryPtr, nDoodads: int16): TStatus{.
|
proc XkbAllocGeomDoodads*(geom: PXkbGeometryPtr, nDoodads: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomDoodads".}
|
libx11c, importc: "XkbAllocGeomDoodads".}
|
||||||
proc XkbAllocGeomSectionDoodads*(section: PXkbSectionPtr, nDoodads: int16): TStatus{.
|
proc XkbAllocGeomSectionDoodads*(section: PXkbSectionPtr, nDoodads: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomSectionDoodads".}
|
libx11c, importc: "XkbAllocGeomSectionDoodads".}
|
||||||
proc XkbAllocGeomOutlines*(shape: PXkbShapePtr, nOL: int16): TStatus{.cdecl,
|
proc XkbAllocGeomOutlines*(shape: PXkbShapePtr, nOL: int16): TStatus{.libx11c, importc: "XkbAllocGeomOutlines".}
|
||||||
dynlib: libX11, importc: "XkbAllocGeomOutlines".}
|
proc XkbAllocGeomRows*(section: PXkbSectionPtr, nRows: int16): TStatus{.libx11c, importc: "XkbAllocGeomRows".}
|
||||||
proc XkbAllocGeomRows*(section: PXkbSectionPtr, nRows: int16): TStatus{.cdecl,
|
proc XkbAllocGeomPoints*(ol: PXkbOutlinePtr, nPts: int16): TStatus{.libx11c, importc: "XkbAllocGeomPoints".}
|
||||||
dynlib: libX11, importc: "XkbAllocGeomRows".}
|
proc XkbAllocGeomKeys*(row: PXkbRowPtr, nKeys: int16): TStatus{.libx11c, importc: "XkbAllocGeomKeys".}
|
||||||
proc XkbAllocGeomPoints*(ol: PXkbOutlinePtr, nPts: int16): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbAllocGeomPoints".}
|
|
||||||
proc XkbAllocGeomKeys*(row: PXkbRowPtr, nKeys: int16): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbAllocGeomKeys".}
|
|
||||||
proc XkbAllocGeometry*(xkb: PXkbDescPtr, sizes: PXkbGeometrySizesPtr): TStatus{.
|
proc XkbAllocGeometry*(xkb: PXkbDescPtr, sizes: PXkbGeometrySizesPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeometry".}
|
libx11c, importc: "XkbAllocGeometry".}
|
||||||
proc XkbSetGeometryProc*(dpy: PDisplay, deviceSpec: int16, geom: PXkbGeometryPtr): TStatus{.
|
proc XkbSetGeometryProc*(dpy: PDisplay, deviceSpec: int16, geom: PXkbGeometryPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSetGeometry".}
|
libx11c, importc: "XkbSetGeometry".}
|
||||||
proc XkbComputeShapeTop*(shape: PXkbShapePtr, bounds: PXkbBoundsPtr): bool{.
|
proc XkbComputeShapeTop*(shape: PXkbShapePtr, bounds: PXkbBoundsPtr): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbComputeShapeTop".}
|
libx11c, importc: "XkbComputeShapeTop".}
|
||||||
proc XkbComputeShapeBounds*(shape: PXkbShapePtr): bool{.cdecl, dynlib: libX11,
|
proc XkbComputeShapeBounds*(shape: PXkbShapePtr): bool{.libx11c,
|
||||||
importc: "XkbComputeShapeBounds".}
|
importc: "XkbComputeShapeBounds".}
|
||||||
proc XkbComputeRowBounds*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
|
proc XkbComputeRowBounds*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
|
||||||
row: PXkbRowPtr): bool{.cdecl, dynlib: libX11,
|
row: PXkbRowPtr): bool{.libx11c,
|
||||||
importc: "XkbComputeRowBounds".}
|
importc: "XkbComputeRowBounds".}
|
||||||
proc XkbComputeSectionBounds*(geom: PXkbGeometryPtr, section: PXkbSectionPtr): bool{.
|
proc XkbComputeSectionBounds*(geom: PXkbGeometryPtr, section: PXkbSectionPtr): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbComputeSectionBounds".}
|
libx11c, importc: "XkbComputeSectionBounds".}
|
||||||
proc XkbFindOverlayForKey*(geom: PXkbGeometryPtr, wanted: PXkbSectionPtr,
|
proc XkbFindOverlayForKey*(geom: PXkbGeometryPtr, wanted: PXkbSectionPtr,
|
||||||
under: cstring): cstring{.cdecl, dynlib: libX11,
|
under: cstring): cstring{.libx11c,
|
||||||
importc: "XkbFindOverlayForKey".}
|
importc: "XkbFindOverlayForKey".}
|
||||||
proc XkbGetGeometryProc*(dpy: PDisplay, xkb: PXkbDescPtr): TStatus{.cdecl,
|
proc XkbGetGeometryProc*(dpy: PDisplay, xkb: PXkbDescPtr): TStatus{.libx11c, importc: "XkbGetGeometry".}
|
||||||
dynlib: libX11, importc: "XkbGetGeometry".}
|
|
||||||
proc XkbGetNamedGeometry*(dpy: PDisplay, xkb: PXkbDescPtr, name: TAtom): TStatus{.
|
proc XkbGetNamedGeometry*(dpy: PDisplay, xkb: PXkbDescPtr, name: TAtom): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetNamedGeometry".}
|
libx11c, importc: "XkbGetNamedGeometry".}
|
||||||
when defined(XKB_IN_SERVER):
|
when defined(XKB_IN_SERVER):
|
||||||
proc SrvXkbAddGeomKeyAlias*(geom: PXkbGeometryPtr, alias: cstring,
|
proc SrvXkbAddGeomKeyAlias*(geom: PXkbGeometryPtr, alias: cstring,
|
||||||
float: cstring): PXkbKeyAliasPtr{.cdecl,
|
float: cstring): PXkbKeyAliasPtr{.libx11c, importc: "XkbAddGeomKeyAlias".}
|
||||||
dynlib: libX11, importc: "XkbAddGeomKeyAlias".}
|
|
||||||
proc SrvXkbAddGeomColor*(geom: PXkbGeometryPtr, spec: cstring, pixel: int16): PXkbColorPtr{.
|
proc SrvXkbAddGeomColor*(geom: PXkbGeometryPtr, spec: cstring, pixel: int16): PXkbColorPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomColor".}
|
libx11c, importc: "XkbAddGeomColor".}
|
||||||
proc SrvXkbAddGeomDoodad*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
|
proc SrvXkbAddGeomDoodad*(geom: PXkbGeometryPtr, section: PXkbSectionPtr,
|
||||||
name: TAtom): PXkbDoodadPtr{.cdecl, dynlib: libX11,
|
name: TAtom): PXkbDoodadPtr{.libx11c,
|
||||||
importc: "XkbAddGeomDoodad".}
|
importc: "XkbAddGeomDoodad".}
|
||||||
proc SrvXkbAddGeomKey*(geom: PXkbGeometryPtr, alias: cstring, float: cstring): PXkbKeyAliasPtr{.
|
proc SrvXkbAddGeomKey*(geom: PXkbGeometryPtr, alias: cstring, float: cstring): PXkbKeyAliasPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomKeyAlias".}
|
libx11c, importc: "XkbAddGeomKeyAlias".}
|
||||||
proc SrvXkbAddGeomOutline*(shape: PXkbShapePtr, sz_points: int16): PXkbOutlinePtr{.
|
proc SrvXkbAddGeomOutline*(shape: PXkbShapePtr, sz_points: int16): PXkbOutlinePtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomOutline".}
|
libx11c, importc: "XkbAddGeomOutline".}
|
||||||
proc SrvXkbAddGeomOverlay*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
|
proc SrvXkbAddGeomOverlay*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
|
||||||
over: cstring, under: cstring): PXkbOverlayKeyPtr{.
|
over: cstring, under: cstring): PXkbOverlayKeyPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomOverlayKey".}
|
libx11c, importc: "XkbAddGeomOverlayKey".}
|
||||||
proc SrvXkbAddGeomOverlayRow*(overlay: PXkbOverlayPtr, row_under: int16,
|
proc SrvXkbAddGeomOverlayRow*(overlay: PXkbOverlayPtr, row_under: int16,
|
||||||
sz_keys: int16): PXkbOverlayRowPtr{.cdecl,
|
sz_keys: int16): PXkbOverlayRowPtr{.libx11c, importc: "XkbAddGeomOverlayRow".}
|
||||||
dynlib: libX11, importc: "XkbAddGeomOverlayRow".}
|
|
||||||
proc SrvXkbAddGeomOverlayKey*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
|
proc SrvXkbAddGeomOverlayKey*(overlay: PXkbOverlayPtr, row: PXkbOverlayRowPtr,
|
||||||
over: cstring, under: cstring): PXkbOverlayKeyPtr{.
|
over: cstring, under: cstring): PXkbOverlayKeyPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomOverlayKey".}
|
libx11c, importc: "XkbAddGeomOverlayKey".}
|
||||||
proc SrvXkbAddGeomProperty*(geom: PXkbGeometryPtr, name: cstring,
|
proc SrvXkbAddGeomProperty*(geom: PXkbGeometryPtr, name: cstring,
|
||||||
value: cstring): PXkbPropertyPtr{.cdecl,
|
value: cstring): PXkbPropertyPtr{.libx11c, importc: "XkbAddGeomProperty".}
|
||||||
dynlib: libX11, importc: "XkbAddGeomProperty".}
|
|
||||||
proc SrvXkbAddGeomRow*(section: PXkbSectionPtr, sz_keys: int16): PXkbRowPtr{.
|
proc SrvXkbAddGeomRow*(section: PXkbSectionPtr, sz_keys: int16): PXkbRowPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomRow".}
|
libx11c, importc: "XkbAddGeomRow".}
|
||||||
proc SrvXkbAddGeomSection*(geom: PXkbGeometryPtr, name: TAtom, sz_rows: int16,
|
proc SrvXkbAddGeomSection*(geom: PXkbGeometryPtr, name: TAtom, sz_rows: int16,
|
||||||
sz_doodads: int16, sz_overlays: int16): PXkbSectionPtr{.
|
sz_doodads: int16, sz_overlays: int16): PXkbSectionPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddGeomSection".}
|
libx11c, importc: "XkbAddGeomSection".}
|
||||||
proc SrvXkbAddGeomShape*(geom: PXkbGeometryPtr, name: TAtom,
|
proc SrvXkbAddGeomShape*(geom: PXkbGeometryPtr, name: TAtom,
|
||||||
sz_outlines: int16): PXkbShapePtr{.cdecl,
|
sz_outlines: int16): PXkbShapePtr{.libx11c, importc: "XkbAddGeomShape".}
|
||||||
dynlib: libX11, importc: "XkbAddGeomShape".}
|
|
||||||
proc SrvXkbAllocGeomKeyAliases*(geom: PXkbGeometryPtr, nAliases: int16): TStatus{.
|
proc SrvXkbAllocGeomKeyAliases*(geom: PXkbGeometryPtr, nAliases: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomKeyAliases".}
|
libx11c, importc: "XkbAllocGeomKeyAliases".}
|
||||||
proc SrvXkbAllocGeomColors*(geom: PXkbGeometryPtr, nColors: int16): TStatus{.
|
proc SrvXkbAllocGeomColors*(geom: PXkbGeometryPtr, nColors: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomColors".}
|
libx11c, importc: "XkbAllocGeomColors".}
|
||||||
proc SrvXkbAllocGeomDoodads*(geom: PXkbGeometryPtr, nDoodads: int16): TStatus{.
|
proc SrvXkbAllocGeomDoodads*(geom: PXkbGeometryPtr, nDoodads: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomDoodads".}
|
libx11c, importc: "XkbAllocGeomDoodads".}
|
||||||
proc SrvXkbAllocGeomKeys*(row: PXkbRowPtr, nKeys: int16): TStatus{.cdecl,
|
proc SrvXkbAllocGeomKeys*(row: PXkbRowPtr, nKeys: int16): TStatus{.libx11c, importc: "XkbAllocGeomKeys".}
|
||||||
dynlib: libX11, importc: "XkbAllocGeomKeys".}
|
|
||||||
proc SrvXkbAllocGeomOutlines*(shape: PXkbShapePtr, nOL: int16): TStatus{.
|
proc SrvXkbAllocGeomOutlines*(shape: PXkbShapePtr, nOL: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomOutlines".}
|
libx11c, importc: "XkbAllocGeomOutlines".}
|
||||||
proc SrvXkbAllocGeomPoints*(ol: PXkbOutlinePtr, nPts: int16): TStatus{.cdecl,
|
proc SrvXkbAllocGeomPoints*(ol: PXkbOutlinePtr, nPts: int16): TStatus{.libx11c, importc: "XkbAllocGeomPoints".}
|
||||||
dynlib: libX11, importc: "XkbAllocGeomPoints".}
|
|
||||||
proc SrvXkbAllocGeomProps*(geom: PXkbGeometryPtr, nProps: int16): TStatus{.
|
proc SrvXkbAllocGeomProps*(geom: PXkbGeometryPtr, nProps: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomProps".}
|
libx11c, importc: "XkbAllocGeomProps".}
|
||||||
proc SrvXkbAllocGeomRows*(section: PXkbSectionPtr, nRows: int16): TStatus{.
|
proc SrvXkbAllocGeomRows*(section: PXkbSectionPtr, nRows: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomRows".}
|
libx11c, importc: "XkbAllocGeomRows".}
|
||||||
proc SrvXkbAllocGeomSectionDoodads*(section: PXkbSectionPtr, nDoodads: int16): TStatus{.
|
proc SrvXkbAllocGeomSectionDoodads*(section: PXkbSectionPtr, nDoodads: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomSectionDoodads".}
|
libx11c, importc: "XkbAllocGeomSectionDoodads".}
|
||||||
proc SrvXkbAllocGeomSections*(geom: PXkbGeometryPtr, nSections: int16): TStatus{.
|
proc SrvXkbAllocGeomSections*(geom: PXkbGeometryPtr, nSections: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomSections".}
|
libx11c, importc: "XkbAllocGeomSections".}
|
||||||
proc SrvXkbAllocGeomOverlays*(section: PXkbSectionPtr, num_needed: int16): TStatus{.
|
proc SrvXkbAllocGeomOverlays*(section: PXkbSectionPtr, num_needed: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomOverlays".}
|
libx11c, importc: "XkbAllocGeomOverlays".}
|
||||||
proc SrvXkbAllocGeomOverlayRows*(overlay: PXkbOverlayPtr, num_needed: int16): TStatus{.
|
proc SrvXkbAllocGeomOverlayRows*(overlay: PXkbOverlayPtr, num_needed: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomOverlayRows".}
|
libx11c, importc: "XkbAllocGeomOverlayRows".}
|
||||||
proc SrvXkbAllocGeomOverlayKeys*(row: PXkbOverlayRowPtr, num_needed: int16): TStatus{.
|
proc SrvXkbAllocGeomOverlayKeys*(row: PXkbOverlayRowPtr, num_needed: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomOverlayKeys".}
|
libx11c, importc: "XkbAllocGeomOverlayKeys".}
|
||||||
proc SrvXkbAllocGeomShapes*(geom: PXkbGeometryPtr, nShapes: int16): TStatus{.
|
proc SrvXkbAllocGeomShapes*(geom: PXkbGeometryPtr, nShapes: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeomShapes".}
|
libx11c, importc: "XkbAllocGeomShapes".}
|
||||||
proc SrvXkbAllocGeometry*(xkb: PXkbDescPtr, sizes: PXkbGeometrySizesPtr): TStatus{.
|
proc SrvXkbAllocGeometry*(xkb: PXkbDescPtr, sizes: PXkbGeometrySizesPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocGeometry".}
|
libx11c, importc: "XkbAllocGeometry".}
|
||||||
proc SrvXkbFreeGeomKeyAliases*(geom: PXkbGeometryPtr, first: int16,
|
proc SrvXkbFreeGeomKeyAliases*(geom: PXkbGeometryPtr, first: int16,
|
||||||
count: int16, freeAll: bool){.cdecl,
|
count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomKeyAliases".}
|
||||||
dynlib: libX11, importc: "XkbFreeGeomKeyAliases".}
|
|
||||||
proc SrvXkbFreeGeomColors*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
proc SrvXkbFreeGeomColors*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomColors".}
|
importc: "XkbFreeGeomColors".}
|
||||||
proc SrvXkbFreeGeomDoodads*(doodads: PXkbDoodadPtr, nDoodads: int16,
|
proc SrvXkbFreeGeomDoodads*(doodads: PXkbDoodadPtr, nDoodads: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomDoodads".}
|
importc: "XkbFreeGeomDoodads".}
|
||||||
proc SrvXkbFreeGeomProperties*(geom: PXkbGeometryPtr, first: int16,
|
proc SrvXkbFreeGeomProperties*(geom: PXkbGeometryPtr, first: int16,
|
||||||
count: int16, freeAll: bool){.cdecl,
|
count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomProperties".}
|
||||||
dynlib: libX11, importc: "XkbFreeGeomProperties".}
|
|
||||||
proc SrvXkbFreeGeomOverlayKeys*(row: PXkbOverlayRowPtr, first: int16,
|
proc SrvXkbFreeGeomOverlayKeys*(row: PXkbOverlayRowPtr, first: int16,
|
||||||
count: int16, freeAll: bool){.cdecl,
|
count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayKeys".}
|
||||||
dynlib: libX11, importc: "XkbFreeGeomOverlayKeys".}
|
|
||||||
proc SrvXkbFreeGeomOverlayRows*(overlay: PXkbOverlayPtr, first: int16,
|
proc SrvXkbFreeGeomOverlayRows*(overlay: PXkbOverlayPtr, first: int16,
|
||||||
count: int16, freeAll: bool){.cdecl,
|
count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlayRows".}
|
||||||
dynlib: libX11, importc: "XkbFreeGeomOverlayRows".}
|
|
||||||
proc SrvXkbFreeGeomOverlays*(section: PXkbSectionPtr, first: int16,
|
proc SrvXkbFreeGeomOverlays*(section: PXkbSectionPtr, first: int16,
|
||||||
count: int16, freeAll: bool){.cdecl,
|
count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomOverlays".}
|
||||||
dynlib: libX11, importc: "XkbFreeGeomOverlays".}
|
|
||||||
proc SrvXkbFreeGeomKeys*(row: PXkbRowPtr, first: int16, count: int16,
|
proc SrvXkbFreeGeomKeys*(row: PXkbRowPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomKeys".}
|
importc: "XkbFreeGeomKeys".}
|
||||||
proc SrvXkbFreeGeomRows*(section: PXkbSectionPtr, first: int16, count: int16,
|
proc SrvXkbFreeGeomRows*(section: PXkbSectionPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomRows".}
|
importc: "XkbFreeGeomRows".}
|
||||||
proc SrvXkbFreeGeomSections*(geom: PXkbGeometryPtr, first: int16,
|
proc SrvXkbFreeGeomSections*(geom: PXkbGeometryPtr, first: int16,
|
||||||
count: int16, freeAll: bool){.cdecl,
|
count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomSections".}
|
||||||
dynlib: libX11, importc: "XkbFreeGeomSections".}
|
|
||||||
proc SrvXkbFreeGeomPoints*(outline: PXkbOutlinePtr, first: int16,
|
proc SrvXkbFreeGeomPoints*(outline: PXkbOutlinePtr, first: int16,
|
||||||
count: int16, freeAll: bool){.cdecl,
|
count: int16, freeAll: bool){.libx11c, importc: "XkbFreeGeomPoints".}
|
||||||
dynlib: libX11, importc: "XkbFreeGeomPoints".}
|
|
||||||
proc SrvXkbFreeGeomOutlines*(shape: PXkbShapePtr, first: int16, count: int16,
|
proc SrvXkbFreeGeomOutlines*(shape: PXkbShapePtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomOutlines".}
|
importc: "XkbFreeGeomOutlines".}
|
||||||
proc SrvXkbFreeGeomShapes*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
proc SrvXkbFreeGeomShapes*(geom: PXkbGeometryPtr, first: int16, count: int16,
|
||||||
freeAll: bool){.cdecl, dynlib: libX11,
|
freeAll: bool){.libx11c,
|
||||||
importc: "XkbFreeGeomShapes".}
|
importc: "XkbFreeGeomShapes".}
|
||||||
proc SrvXkbFreeGeometry*(geom: PXkbGeometryPtr, which: int16, freeMap: bool){.
|
proc SrvXkbFreeGeometry*(geom: PXkbGeometryPtr, which: int16, freeMap: bool){.
|
||||||
cdecl, dynlib: libX11, importc: "XkbFreeGeometry".}
|
libx11c, importc: "XkbFreeGeometry".}
|
||||||
# implementation
|
# implementation
|
||||||
|
|
||||||
import #************************************ xkb ************************************
|
import #************************************ xkb ************************************
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,10 @@
|
||||||
import
|
import
|
||||||
X, Xlib, XKB
|
X, Xlib, XKB
|
||||||
|
|
||||||
|
|
||||||
|
include "x11pragma.nim"
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
PXkbAnyEvent* = ptr TXkbAnyEvent
|
PXkbAnyEvent* = ptr TXkbAnyEvent
|
||||||
TXkbAnyEvent*{.final.} = object
|
TXkbAnyEvent*{.final.} = object
|
||||||
|
|
@ -338,21 +342,18 @@ const
|
||||||
XkbLC_AllComposeControls* = 0xC0000000
|
XkbLC_AllComposeControls* = 0xC0000000
|
||||||
XkbLC_AllControls* = 0xC000001F
|
XkbLC_AllControls* = 0xC000001F
|
||||||
|
|
||||||
proc XkbIgnoreExtension*(ignore: bool): bool{.cdecl, dynlib: libX11,
|
proc XkbIgnoreExtension*(ignore: bool): bool{.libx11c,
|
||||||
importc: "XkbIgnoreExtension".}
|
importc: "XkbIgnoreExtension".}
|
||||||
proc XkbOpenDisplay*(name: cstring, ev_rtrn, err_rtrn, major_rtrn, minor_rtrn,
|
proc XkbOpenDisplay*(name: cstring, ev_rtrn, err_rtrn, major_rtrn, minor_rtrn,
|
||||||
reason: ptr int16): PDisplay{.cdecl,
|
reason: ptr int16): PDisplay{.libx11c, importc: "XkbOpenDisplay".}
|
||||||
dynlib: libX11, importc: "XkbOpenDisplay".}
|
|
||||||
proc XkbQueryExtension*(dpy: PDisplay, opcodeReturn, eventBaseReturn,
|
proc XkbQueryExtension*(dpy: PDisplay, opcodeReturn, eventBaseReturn,
|
||||||
errorBaseReturn, majorRtrn, minorRtrn: ptr int16): bool{.
|
errorBaseReturn, majorRtrn, minorRtrn: ptr int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbQueryExtension".}
|
libx11c, importc: "XkbQueryExtension".}
|
||||||
proc XkbUseExtension*(dpy: PDisplay, major_rtrn, minor_rtrn: ptr int16): bool{.
|
proc XkbUseExtension*(dpy: PDisplay, major_rtrn, minor_rtrn: ptr int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbUseExtension".}
|
libx11c, importc: "XkbUseExtension".}
|
||||||
proc XkbLibraryVersion*(libMajorRtrn, libMinorRtrn: ptr int16): bool{.cdecl,
|
proc XkbLibraryVersion*(libMajorRtrn, libMinorRtrn: ptr int16): bool{.libx11c, importc: "XkbLibraryVersion".}
|
||||||
dynlib: libX11, importc: "XkbLibraryVersion".}
|
proc XkbSetXlibControls*(dpy: PDisplay, affect, values: int16): int16{.libx11c, importc: "XkbSetXlibControls".}
|
||||||
proc XkbSetXlibControls*(dpy: PDisplay, affect, values: int16): int16{.cdecl,
|
proc XkbGetXlibControls*(dpy: PDisplay): int16{.libx11c,
|
||||||
dynlib: libX11, importc: "XkbSetXlibControls".}
|
|
||||||
proc XkbGetXlibControls*(dpy: PDisplay): int16{.cdecl, dynlib: libX11,
|
|
||||||
importc: "XkbGetXlibControls".}
|
importc: "XkbGetXlibControls".}
|
||||||
type
|
type
|
||||||
TXkbInternAtomFunc* = proc (dpy: PDisplay, name: cstring, only_if_exists: bool): TAtom{.
|
TXkbInternAtomFunc* = proc (dpy: PDisplay, name: cstring, only_if_exists: bool): TAtom{.
|
||||||
|
|
@ -362,68 +363,64 @@ type
|
||||||
TXkbGetAtomNameFunc* = proc (dpy: PDisplay, atom: TAtom): cstring{.cdecl.}
|
TXkbGetAtomNameFunc* = proc (dpy: PDisplay, atom: TAtom): cstring{.cdecl.}
|
||||||
|
|
||||||
proc XkbSetAtomFuncs*(getAtom: TXkbInternAtomFunc, getName: TXkbGetAtomNameFunc){.
|
proc XkbSetAtomFuncs*(getAtom: TXkbInternAtomFunc, getName: TXkbGetAtomNameFunc){.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSetAtomFuncs".}
|
libx11c, importc: "XkbSetAtomFuncs".}
|
||||||
proc XkbKeycodeToKeysym*(dpy: PDisplay, kc: TKeyCode, group, level: int16): TKeySym{.
|
proc XkbKeycodeToKeysym*(dpy: PDisplay, kc: TKeyCode, group, level: int16): TKeySym{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbKeycodeToKeysym".}
|
libx11c, importc: "XkbKeycodeToKeysym".}
|
||||||
proc XkbKeysymToModifiers*(dpy: PDisplay, ks: TKeySym): int16{.cdecl,
|
proc XkbKeysymToModifiers*(dpy: PDisplay, ks: TKeySym): int16{.libx11c, importc: "XkbKeysymToModifiers".}
|
||||||
dynlib: libX11, importc: "XkbKeysymToModifiers".}
|
|
||||||
proc XkbLookupKeySym*(dpy: PDisplay, keycode: TKeyCode,
|
proc XkbLookupKeySym*(dpy: PDisplay, keycode: TKeyCode,
|
||||||
modifiers, modifiers_return: int16, keysym_return: PKeySym): bool{.
|
modifiers, modifiers_return: int16, keysym_return: PKeySym): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbLookupKeySym".}
|
libx11c, importc: "XkbLookupKeySym".}
|
||||||
proc XkbLookupKeyBinding*(dpy: PDisplay, sym_rtrn: TKeySym, mods: int16,
|
proc XkbLookupKeyBinding*(dpy: PDisplay, sym_rtrn: TKeySym, mods: int16,
|
||||||
buffer: cstring, nbytes: int16, extra_rtrn: ptr int16): int16{.
|
buffer: cstring, nbytes: int16, extra_rtrn: ptr int16): int16{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbLookupKeyBinding".}
|
libx11c, importc: "XkbLookupKeyBinding".}
|
||||||
proc XkbTranslateKeyCode*(xkb: PXkbDescPtr, keycode: TKeyCode,
|
proc XkbTranslateKeyCode*(xkb: PXkbDescPtr, keycode: TKeyCode,
|
||||||
modifiers, modifiers_return: int16,
|
modifiers, modifiers_return: int16,
|
||||||
keysym_return: PKeySym): bool{.cdecl, dynlib: libX11,
|
keysym_return: PKeySym): bool{.libx11c,
|
||||||
importc: "XkbTranslateKeyCode".}
|
importc: "XkbTranslateKeyCode".}
|
||||||
proc XkbTranslateKeySym*(dpy: PDisplay, sym_return: TKeySym, modifiers: int16,
|
proc XkbTranslateKeySym*(dpy: PDisplay, sym_return: TKeySym, modifiers: int16,
|
||||||
buffer: cstring, nbytes: int16, extra_rtrn: ptr int16): int16{.
|
buffer: cstring, nbytes: int16, extra_rtrn: ptr int16): int16{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbTranslateKeySym".}
|
libx11c, importc: "XkbTranslateKeySym".}
|
||||||
proc XkbSetAutoRepeatRate*(dpy: PDisplay, deviceSpec, delay, interval: int16): bool{.
|
proc XkbSetAutoRepeatRate*(dpy: PDisplay, deviceSpec, delay, interval: int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSetAutoRepeatRate".}
|
libx11c, importc: "XkbSetAutoRepeatRate".}
|
||||||
proc XkbGetAutoRepeatRate*(dpy: PDisplay, deviceSpec: int16,
|
proc XkbGetAutoRepeatRate*(dpy: PDisplay, deviceSpec: int16,
|
||||||
delayRtrn, intervalRtrn: PWord): bool{.cdecl,
|
delayRtrn, intervalRtrn: PWord): bool{.libx11c, importc: "XkbGetAutoRepeatRate".}
|
||||||
dynlib: libX11, importc: "XkbGetAutoRepeatRate".}
|
|
||||||
proc XkbChangeEnabledControls*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
proc XkbChangeEnabledControls*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbChangeEnabledControls".}
|
libx11c, importc: "XkbChangeEnabledControls".}
|
||||||
proc XkbDeviceBell*(dpy: PDisplay, win: TWindow,
|
proc XkbDeviceBell*(dpy: PDisplay, win: TWindow,
|
||||||
deviceSpec, bellClass, bellID, percent: int16, name: TAtom): bool{.
|
deviceSpec, bellClass, bellID, percent: int16, name: TAtom): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbDeviceBell".}
|
libx11c, importc: "XkbDeviceBell".}
|
||||||
proc XkbForceDeviceBell*(dpy: PDisplay,
|
proc XkbForceDeviceBell*(dpy: PDisplay,
|
||||||
deviceSpec, bellClass, bellID, percent: int16): bool{.
|
deviceSpec, bellClass, bellID, percent: int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbForceDeviceBell".}
|
libx11c, importc: "XkbForceDeviceBell".}
|
||||||
proc XkbDeviceBellEvent*(dpy: PDisplay, win: TWindow,
|
proc XkbDeviceBellEvent*(dpy: PDisplay, win: TWindow,
|
||||||
deviceSpec, bellClass, bellID, percent: int16,
|
deviceSpec, bellClass, bellID, percent: int16,
|
||||||
name: TAtom): bool{.cdecl, dynlib: libX11,
|
name: TAtom): bool{.libx11c,
|
||||||
importc: "XkbDeviceBellEvent".}
|
importc: "XkbDeviceBellEvent".}
|
||||||
proc XkbBell*(dpy: PDisplay, win: TWindow, percent: int16, name: TAtom): bool{.
|
proc XkbBell*(dpy: PDisplay, win: TWindow, percent: int16, name: TAtom): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbBell".}
|
libx11c, importc: "XkbBell".}
|
||||||
proc XkbForceBell*(dpy: PDisplay, percent: int16): bool{.cdecl, dynlib: libX11,
|
proc XkbForceBell*(dpy: PDisplay, percent: int16): bool{.libx11c,
|
||||||
importc: "XkbForceBell".}
|
importc: "XkbForceBell".}
|
||||||
proc XkbBellEvent*(dpy: PDisplay, win: TWindow, percent: int16, name: TAtom): bool{.
|
proc XkbBellEvent*(dpy: PDisplay, win: TWindow, percent: int16, name: TAtom): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbBellEvent".}
|
libx11c, importc: "XkbBellEvent".}
|
||||||
proc XkbSelectEvents*(dpy: PDisplay, deviceID, affect, values: int16): bool{.
|
proc XkbSelectEvents*(dpy: PDisplay, deviceID, affect, values: int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSelectEvents".}
|
libx11c, importc: "XkbSelectEvents".}
|
||||||
proc XkbSelectEventDetails*(dpy: PDisplay, deviceID, eventType: int16,
|
proc XkbSelectEventDetails*(dpy: PDisplay, deviceID, eventType: int16,
|
||||||
affect, details: int32): bool{.cdecl,
|
affect, details: int32): bool{.libx11c, importc: "XkbSelectEventDetails".}
|
||||||
dynlib: libX11, importc: "XkbSelectEventDetails".}
|
|
||||||
proc XkbNoteMapChanges*(old: PXkbMapChangesPtr, new: PXkbMapNotifyEvent,
|
proc XkbNoteMapChanges*(old: PXkbMapChangesPtr, new: PXkbMapNotifyEvent,
|
||||||
wanted: int16){.cdecl, dynlib: libX11,
|
wanted: int16){.libx11c,
|
||||||
importc: "XkbNoteMapChanges".}
|
importc: "XkbNoteMapChanges".}
|
||||||
proc XkbNoteNameChanges*(old: PXkbNameChangesPtr, new: PXkbNamesNotifyEvent,
|
proc XkbNoteNameChanges*(old: PXkbNameChangesPtr, new: PXkbNamesNotifyEvent,
|
||||||
wanted: int16){.cdecl, dynlib: libX11,
|
wanted: int16){.libx11c,
|
||||||
importc: "XkbNoteNameChanges".}
|
importc: "XkbNoteNameChanges".}
|
||||||
proc XkbGetIndicatorState*(dpy: PDisplay, deviceSpec: int16, pStateRtrn: PWord): TStatus{.
|
proc XkbGetIndicatorState*(dpy: PDisplay, deviceSpec: int16, pStateRtrn: PWord): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetIndicatorState".}
|
libx11c, importc: "XkbGetIndicatorState".}
|
||||||
proc XkbGetDeviceIndicatorState*(dpy: PDisplay,
|
proc XkbGetDeviceIndicatorState*(dpy: PDisplay,
|
||||||
deviceSpec, ledClass, ledID: int16,
|
deviceSpec, ledClass, ledID: int16,
|
||||||
pStateRtrn: PWord): TStatus{.cdecl,
|
pStateRtrn: PWord): TStatus{.libx11c, importc: "XkbGetDeviceIndicatorState".}
|
||||||
dynlib: libX11, importc: "XkbGetDeviceIndicatorState".}
|
|
||||||
proc XkbGetIndicatorMap*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): TStatus{.
|
proc XkbGetIndicatorMap*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetIndicatorMap".}
|
libx11c, importc: "XkbGetIndicatorMap".}
|
||||||
proc XkbSetIndicatorMap*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): bool{.
|
proc XkbSetIndicatorMap*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSetIndicatorMap".}
|
libx11c, importc: "XkbSetIndicatorMap".}
|
||||||
proc XkbNoteIndicatorMapChanges*(o, n: PXkbIndicatorChangesPtr, w: int16)
|
proc XkbNoteIndicatorMapChanges*(o, n: PXkbIndicatorChangesPtr, w: int16)
|
||||||
proc XkbNoteIndicatorStateChanges*(o, n: PXkbIndicatorChangesPtr, w: int16)
|
proc XkbNoteIndicatorStateChanges*(o, n: PXkbIndicatorChangesPtr, w: int16)
|
||||||
proc XkbGetIndicatorMapChanges*(d: PDisplay, x: PXkbDescPtr,
|
proc XkbGetIndicatorMapChanges*(d: PDisplay, x: PXkbDescPtr,
|
||||||
|
|
@ -432,176 +429,151 @@ proc XkbChangeIndicatorMaps*(d: PDisplay, x: PXkbDescPtr,
|
||||||
c: PXkbIndicatorChangesPtr): bool
|
c: PXkbIndicatorChangesPtr): bool
|
||||||
proc XkbGetNamedIndicator*(dpy: PDisplay, name: TAtom, pNdxRtrn: ptr int16,
|
proc XkbGetNamedIndicator*(dpy: PDisplay, name: TAtom, pNdxRtrn: ptr int16,
|
||||||
pStateRtrn: ptr bool, pMapRtrn: PXkbIndicatorMapPtr,
|
pStateRtrn: ptr bool, pMapRtrn: PXkbIndicatorMapPtr,
|
||||||
pRealRtrn: ptr bool): bool{.cdecl, dynlib: libX11,
|
pRealRtrn: ptr bool): bool{.libx11c,
|
||||||
importc: "XkbGetNamedIndicator".}
|
importc: "XkbGetNamedIndicator".}
|
||||||
proc XkbGetNamedDeviceIndicator*(dpy: PDisplay,
|
proc XkbGetNamedDeviceIndicator*(dpy: PDisplay,
|
||||||
deviceSpec, ledClass, ledID: int16,
|
deviceSpec, ledClass, ledID: int16,
|
||||||
name: TAtom, pNdxRtrn: ptr int16,
|
name: TAtom, pNdxRtrn: ptr int16,
|
||||||
pStateRtrn: ptr bool,
|
pStateRtrn: ptr bool,
|
||||||
pMapRtrn: PXkbIndicatorMapPtr,
|
pMapRtrn: PXkbIndicatorMapPtr,
|
||||||
pRealRtrn: ptr bool): bool{.cdecl,
|
pRealRtrn: ptr bool): bool{.libx11c, importc: "XkbGetNamedDeviceIndicator".}
|
||||||
dynlib: libX11, importc: "XkbGetNamedDeviceIndicator".}
|
|
||||||
proc XkbSetNamedIndicator*(dpy: PDisplay, name: TAtom,
|
proc XkbSetNamedIndicator*(dpy: PDisplay, name: TAtom,
|
||||||
changeState, state, createNewMap: bool,
|
changeState, state, createNewMap: bool,
|
||||||
pMap: PXkbIndicatorMapPtr): bool{.cdecl,
|
pMap: PXkbIndicatorMapPtr): bool{.libx11c, importc: "XkbSetNamedIndicator".}
|
||||||
dynlib: libX11, importc: "XkbSetNamedIndicator".}
|
|
||||||
proc XkbSetNamedDeviceIndicator*(dpy: PDisplay,
|
proc XkbSetNamedDeviceIndicator*(dpy: PDisplay,
|
||||||
deviceSpec, ledClass, ledID: int16,
|
deviceSpec, ledClass, ledID: int16,
|
||||||
name: TAtom,
|
name: TAtom,
|
||||||
changeState, state, createNewMap: bool,
|
changeState, state, createNewMap: bool,
|
||||||
pMap: PXkbIndicatorMapPtr): bool{.cdecl,
|
pMap: PXkbIndicatorMapPtr): bool{.libx11c, importc: "XkbSetNamedDeviceIndicator".}
|
||||||
dynlib: libX11, importc: "XkbSetNamedDeviceIndicator".}
|
|
||||||
proc XkbLockModifiers*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
proc XkbLockModifiers*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbLockModifiers".}
|
libx11c, importc: "XkbLockModifiers".}
|
||||||
proc XkbLatchModifiers*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
proc XkbLatchModifiers*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbLatchModifiers".}
|
libx11c, importc: "XkbLatchModifiers".}
|
||||||
proc XkbLockGroup*(dpy: PDisplay, deviceSpec, group: int16): bool{.cdecl,
|
proc XkbLockGroup*(dpy: PDisplay, deviceSpec, group: int16): bool{.libx11c, importc: "XkbLockGroup".}
|
||||||
dynlib: libX11, importc: "XkbLockGroup".}
|
proc XkbLatchGroup*(dpy: PDisplay, deviceSpec, group: int16): bool{.libx11c, importc: "XkbLatchGroup".}
|
||||||
proc XkbLatchGroup*(dpy: PDisplay, deviceSpec, group: int16): bool{.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbLatchGroup".}
|
|
||||||
proc XkbSetServerInternalMods*(dpy: PDisplay, deviceSpec, affectReal,
|
proc XkbSetServerInternalMods*(dpy: PDisplay, deviceSpec, affectReal,
|
||||||
realValues, affectVirtual, virtualValues: int16): bool{.cdecl,
|
realValues, affectVirtual, virtualValues: int16): bool{.libx11c, importc: "XkbSetServerInternalMods".}
|
||||||
dynlib: libX11, importc: "XkbSetServerInternalMods".}
|
|
||||||
proc XkbSetIgnoreLockMods*(dpy: PDisplay, deviceSpec, affectReal, realValues,
|
proc XkbSetIgnoreLockMods*(dpy: PDisplay, deviceSpec, affectReal, realValues,
|
||||||
affectVirtual, virtualValues: int16): bool{.cdecl, dynlib: libX11,
|
affectVirtual, virtualValues: int16): bool{.libx11c,
|
||||||
importc: "XkbSetIgnoreLockMods".}
|
importc: "XkbSetIgnoreLockMods".}
|
||||||
proc XkbVirtualModsToReal*(dpy: PDisplay, virtual_mask: int16, mask_rtrn: PWord): bool{.
|
proc XkbVirtualModsToReal*(dpy: PDisplay, virtual_mask: int16, mask_rtrn: PWord): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbVirtualModsToReal".}
|
libx11c, importc: "XkbVirtualModsToReal".}
|
||||||
proc XkbComputeEffectiveMap*(xkb: PXkbDescPtr, theType: PXkbKeyTypePtr,
|
proc XkbComputeEffectiveMap*(xkb: PXkbDescPtr, theType: PXkbKeyTypePtr,
|
||||||
map_rtrn: PByte): bool{.cdecl, dynlib: libX11,
|
map_rtrn: PByte): bool{.libx11c,
|
||||||
importc: "XkbComputeEffectiveMap".}
|
importc: "XkbComputeEffectiveMap".}
|
||||||
proc XkbInitCanonicalKeyTypes*(xkb: PXkbDescPtr, which: int16, keypadVMod: int16): TStatus{.
|
proc XkbInitCanonicalKeyTypes*(xkb: PXkbDescPtr, which: int16, keypadVMod: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbInitCanonicalKeyTypes".}
|
libx11c, importc: "XkbInitCanonicalKeyTypes".}
|
||||||
proc XkbAllocKeyboard*(): PXkbDescPtr{.cdecl, dynlib: libX11,
|
proc XkbAllocKeyboard*(): PXkbDescPtr{.libx11c,
|
||||||
importc: "XkbAllocKeyboard".}
|
importc: "XkbAllocKeyboard".}
|
||||||
proc XkbFreeKeyboard*(xkb: PXkbDescPtr, which: int16, freeDesc: bool){.cdecl,
|
proc XkbFreeKeyboard*(xkb: PXkbDescPtr, which: int16, freeDesc: bool){.libx11c, importc: "XkbFreeKeyboard".}
|
||||||
dynlib: libX11, importc: "XkbFreeKeyboard".}
|
proc XkbAllocClientMap*(xkb: PXkbDescPtr, which, nTypes: int16): TStatus{.libx11c, importc: "XkbAllocClientMap".}
|
||||||
proc XkbAllocClientMap*(xkb: PXkbDescPtr, which, nTypes: int16): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbAllocClientMap".}
|
|
||||||
proc XkbAllocServerMap*(xkb: PXkbDescPtr, which, nActions: int16): TStatus{.
|
proc XkbAllocServerMap*(xkb: PXkbDescPtr, which, nActions: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocServerMap".}
|
libx11c, importc: "XkbAllocServerMap".}
|
||||||
proc XkbFreeClientMap*(xkb: PXkbDescPtr, what: int16, freeMap: bool){.cdecl,
|
proc XkbFreeClientMap*(xkb: PXkbDescPtr, what: int16, freeMap: bool){.libx11c, importc: "XkbFreeClientMap".}
|
||||||
dynlib: libX11, importc: "XkbFreeClientMap".}
|
proc XkbFreeServerMap*(xkb: PXkbDescPtr, what: int16, freeMap: bool){.libx11c, importc: "XkbFreeServerMap".}
|
||||||
proc XkbFreeServerMap*(xkb: PXkbDescPtr, what: int16, freeMap: bool){.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbFreeServerMap".}
|
|
||||||
proc XkbAddKeyType*(xkb: PXkbDescPtr, name: TAtom, map_count: int16,
|
proc XkbAddKeyType*(xkb: PXkbDescPtr, name: TAtom, map_count: int16,
|
||||||
want_preserve: bool, num_lvls: int16): PXkbKeyTypePtr{.
|
want_preserve: bool, num_lvls: int16): PXkbKeyTypePtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddKeyType".}
|
libx11c, importc: "XkbAddKeyType".}
|
||||||
proc XkbAllocIndicatorMaps*(xkb: PXkbDescPtr): TStatus{.cdecl, dynlib: libX11,
|
proc XkbAllocIndicatorMaps*(xkb: PXkbDescPtr): TStatus{.libx11c,
|
||||||
importc: "XkbAllocIndicatorMaps".}
|
importc: "XkbAllocIndicatorMaps".}
|
||||||
proc XkbFreeIndicatorMaps*(xkb: PXkbDescPtr){.cdecl, dynlib: libX11,
|
proc XkbFreeIndicatorMaps*(xkb: PXkbDescPtr){.libx11c,
|
||||||
importc: "XkbFreeIndicatorMaps".}
|
importc: "XkbFreeIndicatorMaps".}
|
||||||
proc XkbGetMap*(dpy: PDisplay, which, deviceSpec: int16): PXkbDescPtr{.cdecl,
|
proc XkbGetMap*(dpy: PDisplay, which, deviceSpec: int16): PXkbDescPtr{.libx11c, importc: "XkbGetMap".}
|
||||||
dynlib: libX11, importc: "XkbGetMap".}
|
|
||||||
proc XkbGetUpdatedMap*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
proc XkbGetUpdatedMap*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetUpdatedMap".}
|
libx11c, importc: "XkbGetUpdatedMap".}
|
||||||
proc XkbGetMapChanges*(dpy: PDisplay, xkb: PXkbDescPtr,
|
proc XkbGetMapChanges*(dpy: PDisplay, xkb: PXkbDescPtr,
|
||||||
changes: PXkbMapChangesPtr): TStatus{.cdecl,
|
changes: PXkbMapChangesPtr): TStatus{.libx11c, importc: "XkbGetMapChanges".}
|
||||||
dynlib: libX11, importc: "XkbGetMapChanges".}
|
proc XkbRefreshKeyboardMapping*(event: PXkbMapNotifyEvent): TStatus{.libx11c, importc: "XkbRefreshKeyboardMapping".}
|
||||||
proc XkbRefreshKeyboardMapping*(event: PXkbMapNotifyEvent): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbRefreshKeyboardMapping".}
|
|
||||||
proc XkbGetKeyTypes*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
proc XkbGetKeyTypes*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetKeyTypes".}
|
libx11c, importc: "XkbGetKeyTypes".}
|
||||||
proc XkbGetKeySyms*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
proc XkbGetKeySyms*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetKeySyms".}
|
libx11c, importc: "XkbGetKeySyms".}
|
||||||
proc XkbGetKeyActions*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
proc XkbGetKeyActions*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetKeyActions".}
|
libx11c, importc: "XkbGetKeyActions".}
|
||||||
proc XkbGetKeyBehaviors*(dpy: PDisplay, firstKey, nKeys: int16,
|
proc XkbGetKeyBehaviors*(dpy: PDisplay, firstKey, nKeys: int16,
|
||||||
desc: PXkbDescPtr): TStatus{.cdecl, dynlib: libX11,
|
desc: PXkbDescPtr): TStatus{.libx11c,
|
||||||
importc: "XkbGetKeyBehaviors".}
|
importc: "XkbGetKeyBehaviors".}
|
||||||
proc XkbGetVirtualMods*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
proc XkbGetVirtualMods*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetVirtualMods".}
|
libx11c, importc: "XkbGetVirtualMods".}
|
||||||
proc XkbGetKeyExplicitComponents*(dpy: PDisplay, firstKey, nKeys: int16,
|
proc XkbGetKeyExplicitComponents*(dpy: PDisplay, firstKey, nKeys: int16,
|
||||||
desc: PXkbDescPtr): TStatus{.cdecl,
|
desc: PXkbDescPtr): TStatus{.libx11c, importc: "XkbGetKeyExplicitComponents".}
|
||||||
dynlib: libX11, importc: "XkbGetKeyExplicitComponents".}
|
|
||||||
proc XkbGetKeyModifierMap*(dpy: PDisplay, firstKey, nKeys: int16,
|
proc XkbGetKeyModifierMap*(dpy: PDisplay, firstKey, nKeys: int16,
|
||||||
desc: PXkbDescPtr): TStatus{.cdecl, dynlib: libX11,
|
desc: PXkbDescPtr): TStatus{.libx11c,
|
||||||
importc: "XkbGetKeyModifierMap".}
|
importc: "XkbGetKeyModifierMap".}
|
||||||
proc XkbAllocControls*(xkb: PXkbDescPtr, which: int16): TStatus{.cdecl,
|
proc XkbAllocControls*(xkb: PXkbDescPtr, which: int16): TStatus{.libx11c, importc: "XkbAllocControls".}
|
||||||
dynlib: libX11, importc: "XkbAllocControls".}
|
proc XkbFreeControls*(xkb: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeControls".}
|
||||||
proc XkbFreeControls*(xkb: PXkbDescPtr, which: int16, freeMap: bool){.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbFreeControls".}
|
|
||||||
proc XkbGetControls*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): TStatus{.
|
proc XkbGetControls*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetControls".}
|
libx11c, importc: "XkbGetControls".}
|
||||||
proc XkbSetControls*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): bool{.
|
proc XkbSetControls*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSetControls".}
|
libx11c, importc: "XkbSetControls".}
|
||||||
proc XkbNoteControlsChanges*(old: PXkbControlsChangesPtr,
|
proc XkbNoteControlsChanges*(old: PXkbControlsChangesPtr,
|
||||||
new: PXkbControlsNotifyEvent, wanted: int16){.
|
new: PXkbControlsNotifyEvent, wanted: int16){.
|
||||||
cdecl, dynlib: libX11, importc: "XkbNoteControlsChanges".}
|
libx11c, importc: "XkbNoteControlsChanges".}
|
||||||
proc XkbGetControlsChanges*(d: PDisplay, x: PXkbDescPtr,
|
proc XkbGetControlsChanges*(d: PDisplay, x: PXkbDescPtr,
|
||||||
c: PXkbControlsChangesPtr): TStatus
|
c: PXkbControlsChangesPtr): TStatus
|
||||||
proc XkbChangeControls*(d: PDisplay, x: PXkbDescPtr, c: PXkbControlsChangesPtr): bool
|
proc XkbChangeControls*(d: PDisplay, x: PXkbDescPtr, c: PXkbControlsChangesPtr): bool
|
||||||
proc XkbAllocCompatMap*(xkb: PXkbDescPtr, which, nInterpret: int16): TStatus{.
|
proc XkbAllocCompatMap*(xkb: PXkbDescPtr, which, nInterpret: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocCompatMap".}
|
libx11c, importc: "XkbAllocCompatMap".}
|
||||||
proc XkbFreeCompatMap*(xkib: PXkbDescPtr, which: int16, freeMap: bool){.cdecl,
|
proc XkbFreeCompatMap*(xkib: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeCompatMap".}
|
||||||
dynlib: libX11, importc: "XkbFreeCompatMap".}
|
|
||||||
proc XkbGetCompatMap*(dpy: PDisplay, which: int16, xkb: PXkbDescPtr): TStatus{.
|
proc XkbGetCompatMap*(dpy: PDisplay, which: int16, xkb: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetCompatMap".}
|
libx11c, importc: "XkbGetCompatMap".}
|
||||||
proc XkbSetCompatMap*(dpy: PDisplay, which: int16, xkb: PXkbDescPtr,
|
proc XkbSetCompatMap*(dpy: PDisplay, which: int16, xkb: PXkbDescPtr,
|
||||||
updateActions: bool): bool{.cdecl, dynlib: libX11,
|
updateActions: bool): bool{.libx11c,
|
||||||
importc: "XkbSetCompatMap".}
|
importc: "XkbSetCompatMap".}
|
||||||
proc XkbAddSymInterpret*(xkb: PXkbDescPtr, si: PXkbSymInterpretPtr,
|
proc XkbAddSymInterpret*(xkb: PXkbDescPtr, si: PXkbSymInterpretPtr,
|
||||||
updateMap: bool, changes: PXkbChangesPtr): PXkbSymInterpretPtr{.
|
updateMap: bool, changes: PXkbChangesPtr): PXkbSymInterpretPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddSymInterpret".}
|
libx11c, importc: "XkbAddSymInterpret".}
|
||||||
proc XkbAllocNames*(xkb: PXkbDescPtr, which: int16,
|
proc XkbAllocNames*(xkb: PXkbDescPtr, which: int16,
|
||||||
nTotalRG, nTotalAliases: int16): TStatus{.cdecl,
|
nTotalRG, nTotalAliases: int16): TStatus{.libx11c, importc: "XkbAllocNames".}
|
||||||
dynlib: libX11, importc: "XkbAllocNames".}
|
|
||||||
proc XkbGetNames*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
proc XkbGetNames*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetNames".}
|
libx11c, importc: "XkbGetNames".}
|
||||||
proc XkbSetNames*(dpy: PDisplay, which, firstType, nTypes: int16,
|
proc XkbSetNames*(dpy: PDisplay, which, firstType, nTypes: int16,
|
||||||
desc: PXkbDescPtr): bool{.cdecl, dynlib: libX11,
|
desc: PXkbDescPtr): bool{.libx11c,
|
||||||
importc: "XkbSetNames".}
|
importc: "XkbSetNames".}
|
||||||
proc XkbChangeNames*(dpy: PDisplay, xkb: PXkbDescPtr,
|
proc XkbChangeNames*(dpy: PDisplay, xkb: PXkbDescPtr,
|
||||||
changes: PXkbNameChangesPtr): bool{.cdecl, dynlib: libX11,
|
changes: PXkbNameChangesPtr): bool{.libx11c,
|
||||||
importc: "XkbChangeNames".}
|
importc: "XkbChangeNames".}
|
||||||
proc XkbFreeNames*(xkb: PXkbDescPtr, which: int16, freeMap: bool){.cdecl,
|
proc XkbFreeNames*(xkb: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeNames".}
|
||||||
dynlib: libX11, importc: "XkbFreeNames".}
|
|
||||||
proc XkbGetState*(dpy: PDisplay, deviceSpec: int16, rtrnState: PXkbStatePtr): TStatus{.
|
proc XkbGetState*(dpy: PDisplay, deviceSpec: int16, rtrnState: PXkbStatePtr): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetState".}
|
libx11c, importc: "XkbGetState".}
|
||||||
proc XkbSetMap*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): bool{.cdecl,
|
proc XkbSetMap*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): bool{.libx11c, importc: "XkbSetMap".}
|
||||||
dynlib: libX11, importc: "XkbSetMap".}
|
|
||||||
proc XkbChangeMap*(dpy: PDisplay, desc: PXkbDescPtr, changes: PXkbMapChangesPtr): bool{.
|
proc XkbChangeMap*(dpy: PDisplay, desc: PXkbDescPtr, changes: PXkbMapChangesPtr): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbChangeMap".}
|
libx11c, importc: "XkbChangeMap".}
|
||||||
proc XkbSetDetectableAutoRepeat*(dpy: PDisplay, detectable: bool,
|
proc XkbSetDetectableAutoRepeat*(dpy: PDisplay, detectable: bool,
|
||||||
supported: ptr bool): bool{.cdecl,
|
supported: ptr bool): bool{.libx11c, importc: "XkbSetDetectableAutoRepeat".}
|
||||||
dynlib: libX11, importc: "XkbSetDetectableAutoRepeat".}
|
|
||||||
proc XkbGetDetectableAutoRepeat*(dpy: PDisplay, supported: ptr bool): bool{.
|
proc XkbGetDetectableAutoRepeat*(dpy: PDisplay, supported: ptr bool): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetDetectableAutoRepeat".}
|
libx11c, importc: "XkbGetDetectableAutoRepeat".}
|
||||||
proc XkbSetAutoResetControls*(dpy: PDisplay, changes: int16,
|
proc XkbSetAutoResetControls*(dpy: PDisplay, changes: int16,
|
||||||
auto_ctrls, auto_values: PWord): bool{.cdecl,
|
auto_ctrls, auto_values: PWord): bool{.libx11c, importc: "XkbSetAutoResetControls".}
|
||||||
dynlib: libX11, importc: "XkbSetAutoResetControls".}
|
|
||||||
proc XkbGetAutoResetControls*(dpy: PDisplay, auto_ctrls, auto_ctrl_values: PWord): bool{.
|
proc XkbGetAutoResetControls*(dpy: PDisplay, auto_ctrls, auto_ctrl_values: PWord): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetAutoResetControls".}
|
libx11c, importc: "XkbGetAutoResetControls".}
|
||||||
proc XkbSetPerClientControls*(dpy: PDisplay, change: int16, values: PWord): bool{.
|
proc XkbSetPerClientControls*(dpy: PDisplay, change: int16, values: PWord): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSetPerClientControls".}
|
libx11c, importc: "XkbSetPerClientControls".}
|
||||||
proc XkbGetPerClientControls*(dpy: PDisplay, ctrls: PWord): bool{.cdecl,
|
proc XkbGetPerClientControls*(dpy: PDisplay, ctrls: PWord): bool{.libx11c, importc: "XkbGetPerClientControls".}
|
||||||
dynlib: libX11, importc: "XkbGetPerClientControls".}
|
proc XkbCopyKeyType*(`from`, into: PXkbKeyTypePtr): TStatus{.libx11c, importc: "XkbCopyKeyType".}
|
||||||
proc XkbCopyKeyType*(`from`, into: PXkbKeyTypePtr): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc: "XkbCopyKeyType".}
|
|
||||||
proc XkbCopyKeyTypes*(`from`, into: PXkbKeyTypePtr, num_types: int16): TStatus{.
|
proc XkbCopyKeyTypes*(`from`, into: PXkbKeyTypePtr, num_types: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbCopyKeyTypes".}
|
libx11c, importc: "XkbCopyKeyTypes".}
|
||||||
proc XkbResizeKeyType*(xkb: PXkbDescPtr, type_ndx, map_count: int16,
|
proc XkbResizeKeyType*(xkb: PXkbDescPtr, type_ndx, map_count: int16,
|
||||||
want_preserve: bool, new_num_lvls: int16): TStatus{.
|
want_preserve: bool, new_num_lvls: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbResizeKeyType".}
|
libx11c, importc: "XkbResizeKeyType".}
|
||||||
proc XkbResizeKeySyms*(desc: PXkbDescPtr, forKey, symsNeeded: int16): PKeySym{.
|
proc XkbResizeKeySyms*(desc: PXkbDescPtr, forKey, symsNeeded: int16): PKeySym{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbResizeKeySyms".}
|
libx11c, importc: "XkbResizeKeySyms".}
|
||||||
proc XkbResizeKeyActions*(desc: PXkbDescPtr, forKey, actsNeeded: int16): PXkbAction{.
|
proc XkbResizeKeyActions*(desc: PXkbDescPtr, forKey, actsNeeded: int16): PXkbAction{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbResizeKeyActions".}
|
libx11c, importc: "XkbResizeKeyActions".}
|
||||||
proc XkbChangeTypesOfKey*(xkb: PXkbDescPtr, key, num_groups: int16,
|
proc XkbChangeTypesOfKey*(xkb: PXkbDescPtr, key, num_groups: int16,
|
||||||
groups: int16, newTypes: ptr int16,
|
groups: int16, newTypes: ptr int16,
|
||||||
pChanges: PXkbMapChangesPtr): TStatus{.cdecl,
|
pChanges: PXkbMapChangesPtr): TStatus{.libx11c, importc: "XkbChangeTypesOfKey".}
|
||||||
dynlib: libX11, importc: "XkbChangeTypesOfKey".}
|
|
||||||
|
|
||||||
proc XkbListComponents*(dpy: PDisplay, deviceSpec: int16,
|
proc XkbListComponents*(dpy: PDisplay, deviceSpec: int16,
|
||||||
ptrns: PXkbComponentNamesPtr, max_inout: ptr int16): PXkbComponentListPtr{.
|
ptrns: PXkbComponentNamesPtr, max_inout: ptr int16): PXkbComponentListPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbListComponents".}
|
libx11c, importc: "XkbListComponents".}
|
||||||
proc XkbFreeComponentList*(list: PXkbComponentListPtr){.cdecl, dynlib: libX11,
|
proc XkbFreeComponentList*(list: PXkbComponentListPtr){.libx11c,
|
||||||
importc: "XkbFreeComponentList".}
|
importc: "XkbFreeComponentList".}
|
||||||
proc XkbGetKeyboard*(dpy: PDisplay, which, deviceSpec: int16): PXkbDescPtr{.
|
proc XkbGetKeyboard*(dpy: PDisplay, which, deviceSpec: int16): PXkbDescPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetKeyboard".}
|
libx11c, importc: "XkbGetKeyboard".}
|
||||||
proc XkbGetKeyboardByName*(dpy: PDisplay, deviceSpec: int16,
|
proc XkbGetKeyboardByName*(dpy: PDisplay, deviceSpec: int16,
|
||||||
names: PXkbComponentNamesPtr, want, need: int16,
|
names: PXkbComponentNamesPtr, want, need: int16,
|
||||||
load: bool): PXkbDescPtr{.cdecl, dynlib: libX11,
|
load: bool): PXkbDescPtr{.libx11c,
|
||||||
importc: "XkbGetKeyboardByName".}
|
importc: "XkbGetKeyboardByName".}
|
||||||
|
|
||||||
proc XkbKeyTypesForCoreSymbols*(xkb: PXkbDescPtr,
|
proc XkbKeyTypesForCoreSymbols*(xkb: PXkbDescPtr,
|
||||||
|
|
@ -609,65 +581,55 @@ proc XkbKeyTypesForCoreSymbols*(xkb: PXkbDescPtr,
|
||||||
core_syms: PKeySym, # always mapWidth symbols
|
core_syms: PKeySym, # always mapWidth symbols
|
||||||
protected: int16, # explicit key types
|
protected: int16, # explicit key types
|
||||||
types_inout: ptr int16, # always four type indices
|
types_inout: ptr int16, # always four type indices
|
||||||
xkb_syms_rtrn: PKeySym): int16{.cdecl,
|
xkb_syms_rtrn: PKeySym): int16{.libx11c, importc: "XkbKeyTypesForCoreSymbols".}
|
||||||
dynlib: libX11, importc: "XkbKeyTypesForCoreSymbols".}
|
|
||||||
# must have enough space
|
# must have enough space
|
||||||
proc XkbApplyCompatMapToKey*(xkb: PXkbDescPtr,
|
proc XkbApplyCompatMapToKey*(xkb: PXkbDescPtr,
|
||||||
key: TKeyCode, # key to be updated
|
key: TKeyCode, # key to be updated
|
||||||
changes: PXkbChangesPtr): bool{.cdecl,
|
changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbApplyCompatMapToKey".}
|
||||||
dynlib: libX11, importc: "XkbApplyCompatMapToKey".}
|
|
||||||
# resulting changes to map
|
# resulting changes to map
|
||||||
proc XkbUpdateMapFromCore*(xkb: PXkbDescPtr,
|
proc XkbUpdateMapFromCore*(xkb: PXkbDescPtr,
|
||||||
first_key: TKeyCode, # first changed key
|
first_key: TKeyCode, # first changed key
|
||||||
num_keys,
|
num_keys,
|
||||||
map_width: int16,
|
map_width: int16,
|
||||||
core_keysyms: PKeySym, # symbols `from` core keymap
|
core_keysyms: PKeySym, # symbols `from` core keymap
|
||||||
changes: PXkbChangesPtr): bool{.cdecl,
|
changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbUpdateMapFromCore".}
|
||||||
dynlib: libX11, importc: "XkbUpdateMapFromCore".}
|
|
||||||
|
|
||||||
proc XkbAddDeviceLedInfo*(devi: PXkbDeviceInfoPtr, ledClass, ledId: int16): PXkbDeviceLedInfoPtr{.
|
proc XkbAddDeviceLedInfo*(devi: PXkbDeviceInfoPtr, ledClass, ledId: int16): PXkbDeviceLedInfoPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAddDeviceLedInfo".}
|
libx11c, importc: "XkbAddDeviceLedInfo".}
|
||||||
proc XkbResizeDeviceButtonActions*(devi: PXkbDeviceInfoPtr, newTotal: int16): TStatus{.
|
proc XkbResizeDeviceButtonActions*(devi: PXkbDeviceInfoPtr, newTotal: int16): TStatus{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbResizeDeviceButtonActions".}
|
libx11c, importc: "XkbResizeDeviceButtonActions".}
|
||||||
proc XkbAllocDeviceInfo*(deviceSpec, nButtons, szLeds: int16): PXkbDeviceInfoPtr{.
|
proc XkbAllocDeviceInfo*(deviceSpec, nButtons, szLeds: int16): PXkbDeviceInfoPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbAllocDeviceInfo".}
|
libx11c, importc: "XkbAllocDeviceInfo".}
|
||||||
proc XkbFreeDeviceInfo*(devi: PXkbDeviceInfoPtr, which: int16, freeDevI: bool){.
|
proc XkbFreeDeviceInfo*(devi: PXkbDeviceInfoPtr, which: int16, freeDevI: bool){.
|
||||||
cdecl, dynlib: libX11, importc: "XkbFreeDeviceInfo".}
|
libx11c, importc: "XkbFreeDeviceInfo".}
|
||||||
proc XkbNoteDeviceChanges*(old: PXkbDeviceChangesPtr,
|
proc XkbNoteDeviceChanges*(old: PXkbDeviceChangesPtr,
|
||||||
new: PXkbExtensionDeviceNotifyEvent, wanted: int16){.
|
new: PXkbExtensionDeviceNotifyEvent, wanted: int16){.
|
||||||
cdecl, dynlib: libX11, importc: "XkbNoteDeviceChanges".}
|
libx11c, importc: "XkbNoteDeviceChanges".}
|
||||||
proc XkbGetDeviceInfo*(dpy: PDisplay, which, deviceSpec, ledClass, ledID: int16): PXkbDeviceInfoPtr{.
|
proc XkbGetDeviceInfo*(dpy: PDisplay, which, deviceSpec, ledClass, ledID: int16): PXkbDeviceInfoPtr{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbGetDeviceInfo".}
|
libx11c, importc: "XkbGetDeviceInfo".}
|
||||||
proc XkbGetDeviceInfoChanges*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
proc XkbGetDeviceInfoChanges*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
||||||
changes: PXkbDeviceChangesPtr): TStatus{.cdecl,
|
changes: PXkbDeviceChangesPtr): TStatus{.libx11c, importc: "XkbGetDeviceInfoChanges".}
|
||||||
dynlib: libX11, importc: "XkbGetDeviceInfoChanges".}
|
|
||||||
proc XkbGetDeviceButtonActions*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
proc XkbGetDeviceButtonActions*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
||||||
all: bool, first, nBtns: int16): TStatus{.cdecl,
|
all: bool, first, nBtns: int16): TStatus{.libx11c, importc: "XkbGetDeviceButtonActions".}
|
||||||
dynlib: libX11, importc: "XkbGetDeviceButtonActions".}
|
|
||||||
proc XkbGetDeviceLedInfo*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
proc XkbGetDeviceLedInfo*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
||||||
ledClass, ledId, which: int16): TStatus{.cdecl,
|
ledClass, ledId, which: int16): TStatus{.libx11c, importc: "XkbGetDeviceLedInfo".}
|
||||||
dynlib: libX11, importc: "XkbGetDeviceLedInfo".}
|
|
||||||
proc XkbSetDeviceInfo*(dpy: PDisplay, which: int16, devi: PXkbDeviceInfoPtr): bool{.
|
proc XkbSetDeviceInfo*(dpy: PDisplay, which: int16, devi: PXkbDeviceInfoPtr): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSetDeviceInfo".}
|
libx11c, importc: "XkbSetDeviceInfo".}
|
||||||
proc XkbChangeDeviceInfo*(dpy: PDisplay, desc: PXkbDeviceInfoPtr,
|
proc XkbChangeDeviceInfo*(dpy: PDisplay, desc: PXkbDeviceInfoPtr,
|
||||||
changes: PXkbDeviceChangesPtr): bool{.cdecl,
|
changes: PXkbDeviceChangesPtr): bool{.libx11c, importc: "XkbChangeDeviceInfo".}
|
||||||
dynlib: libX11, importc: "XkbChangeDeviceInfo".}
|
|
||||||
proc XkbSetDeviceLedInfo*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
proc XkbSetDeviceLedInfo*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
||||||
ledClass, ledID, which: int16): bool{.cdecl,
|
ledClass, ledID, which: int16): bool{.libx11c, importc: "XkbSetDeviceLedInfo".}
|
||||||
dynlib: libX11, importc: "XkbSetDeviceLedInfo".}
|
|
||||||
proc XkbSetDeviceButtonActions*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
proc XkbSetDeviceButtonActions*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
||||||
first, nBtns: int16): bool{.cdecl,
|
first, nBtns: int16): bool{.libx11c, importc: "XkbSetDeviceButtonActions".}
|
||||||
dynlib: libX11, importc: "XkbSetDeviceButtonActions".}
|
|
||||||
|
|
||||||
proc XkbToControl*(c: int8): int8{.cdecl, dynlib: libX11,
|
proc XkbToControl*(c: int8): int8{.libx11c,
|
||||||
importc: "XkbToControl".}
|
importc: "XkbToControl".}
|
||||||
|
|
||||||
proc XkbSetDebuggingFlags*(dpy: PDisplay, mask, flags: int16, msg: cstring,
|
proc XkbSetDebuggingFlags*(dpy: PDisplay, mask, flags: int16, msg: cstring,
|
||||||
ctrls_mask, ctrls, rtrn_flags, rtrn_ctrls: int16): bool{.
|
ctrls_mask, ctrls, rtrn_flags, rtrn_ctrls: int16): bool{.
|
||||||
cdecl, dynlib: libX11, importc: "XkbSetDebuggingFlags".}
|
libx11c, importc: "XkbSetDebuggingFlags".}
|
||||||
proc XkbApplyVirtualModChanges*(xkb: PXkbDescPtr, changed: int16,
|
proc XkbApplyVirtualModChanges*(xkb: PXkbDescPtr, changed: int16,
|
||||||
changes: PXkbChangesPtr): bool{.cdecl,
|
changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbApplyVirtualModChanges".}
|
||||||
dynlib: libX11, importc: "XkbApplyVirtualModChanges".}
|
|
||||||
|
|
||||||
# implementation
|
# implementation
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -2,8 +2,24 @@
|
||||||
import
|
import
|
||||||
x, xlib
|
x, xlib
|
||||||
|
|
||||||
|
when defined(use_pkg_config) or defined(use_pkg_config_static):
|
||||||
|
{.pragma: libxrender, cdecl, importc.}
|
||||||
|
when defined(use_pkg_config):
|
||||||
|
{.passl: gorge("pkg-config xrender --libs").}
|
||||||
|
else:
|
||||||
|
{.passl: gorge("pkg-config xrender --static --libs").}
|
||||||
|
else:
|
||||||
|
when defined(macosx):
|
||||||
|
const
|
||||||
|
libXrender* = "libXrender.dylib"
|
||||||
|
else:
|
||||||
|
const
|
||||||
|
libXrender* = "libXrender.so"
|
||||||
|
|
||||||
|
|
||||||
|
{.pragma: libxrender, dynlib: libXrender, cdecl, importc.}
|
||||||
#const
|
#const
|
||||||
# libX11* = "libX11.so"
|
# libXrender* = "libXrender.so"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Automatically converted by H2Pas 0.99.15 from xrender.h
|
# Automatically converted by H2Pas 0.99.15 from xrender.h
|
||||||
|
|
@ -187,45 +203,39 @@ type
|
||||||
|
|
||||||
|
|
||||||
proc XRenderQueryExtension*(dpy: PDisplay, event_basep: ptr int32,
|
proc XRenderQueryExtension*(dpy: PDisplay, event_basep: ptr int32,
|
||||||
error_basep: ptr int32): TBool{.cdecl,
|
error_basep: ptr int32): TBool{.libxrender.}
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XRenderQueryVersion*(dpy: PDisplay, major_versionp: ptr int32,
|
proc XRenderQueryVersion*(dpy: PDisplay, major_versionp: ptr int32,
|
||||||
minor_versionp: ptr int32): TStatus{.cdecl,
|
minor_versionp: ptr int32): TStatus{.libxrender.}
|
||||||
dynlib: libX11, importc.}
|
proc XRenderQueryFormats*(dpy: PDisplay): TStatus{.libxrender.}
|
||||||
proc XRenderQueryFormats*(dpy: PDisplay): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XRenderFindVisualFormat*(dpy: PDisplay, visual: PVisual): PXRenderPictFormat{.
|
proc XRenderFindVisualFormat*(dpy: PDisplay, visual: PVisual): PXRenderPictFormat{.
|
||||||
cdecl, dynlib: libX11, importc.}
|
libxrender.}
|
||||||
proc XRenderFindFormat*(dpy: PDisplay, mask: int32,
|
proc XRenderFindFormat*(dpy: PDisplay, mask: int32,
|
||||||
`template`: PXRenderPictFormat, count: int32): PXRenderPictFormat{.
|
`template`: PXRenderPictFormat, count: int32): PXRenderPictFormat{.
|
||||||
cdecl, dynlib: libX11, importc.}
|
libxrender.}
|
||||||
proc XRenderCreatePicture*(dpy: PDisplay, drawable: TDrawable,
|
proc XRenderCreatePicture*(dpy: PDisplay, drawable: TDrawable,
|
||||||
format: PXRenderPictFormat, valuemask: int32,
|
format: PXRenderPictFormat, valuemask: int32,
|
||||||
attributes: PXRenderPictureAttributes): TPicture{.
|
attributes: PXRenderPictureAttributes): TPicture{.
|
||||||
cdecl, dynlib: libX11, importc.}
|
libxrender.}
|
||||||
proc XRenderChangePicture*(dpy: PDisplay, picture: TPicture, valuemask: int32,
|
proc XRenderChangePicture*(dpy: PDisplay, picture: TPicture, valuemask: int32,
|
||||||
attributes: PXRenderPictureAttributes){.cdecl,
|
attributes: PXRenderPictureAttributes){.libxrender.}
|
||||||
dynlib: libX11, importc.}
|
proc XRenderFreePicture*(dpy: PDisplay, picture: TPicture){.libxrender.}
|
||||||
proc XRenderFreePicture*(dpy: PDisplay, picture: TPicture){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XRenderComposite*(dpy: PDisplay, op: int32, src: TPicture, mask: TPicture,
|
proc XRenderComposite*(dpy: PDisplay, op: int32, src: TPicture, mask: TPicture,
|
||||||
dst: TPicture, src_x: int32, src_y: int32, mask_x: int32,
|
dst: TPicture, src_x: int32, src_y: int32, mask_x: int32,
|
||||||
mask_y: int32, dst_x: int32, dst_y: int32, width: int32,
|
mask_y: int32, dst_x: int32, dst_y: int32, width: int32,
|
||||||
height: int32){.cdecl, dynlib: libX11, importc.}
|
height: int32){.libxrender.}
|
||||||
proc XRenderCreateGlyphSet*(dpy: PDisplay, format: PXRenderPictFormat): TGlyphSet{.
|
proc XRenderCreateGlyphSet*(dpy: PDisplay, format: PXRenderPictFormat): TGlyphSet{.
|
||||||
cdecl, dynlib: libX11, importc.}
|
libxrender.}
|
||||||
proc XRenderReferenceGlyphSet*(dpy: PDisplay, existing: TGlyphSet): TGlyphSet{.
|
proc XRenderReferenceGlyphSet*(dpy: PDisplay, existing: TGlyphSet): TGlyphSet{.
|
||||||
cdecl, dynlib: libX11, importc.}
|
libxrender.}
|
||||||
proc XRenderFreeGlyphSet*(dpy: PDisplay, glyphset: TGlyphSet){.cdecl,
|
proc XRenderFreeGlyphSet*(dpy: PDisplay, glyphset: TGlyphSet){.libxrender.}
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XRenderAddGlyphs*(dpy: PDisplay, glyphset: TGlyphSet, gids: PGlyph,
|
proc XRenderAddGlyphs*(dpy: PDisplay, glyphset: TGlyphSet, gids: PGlyph,
|
||||||
glyphs: PXGlyphInfo, nglyphs: int32, images: cstring,
|
glyphs: PXGlyphInfo, nglyphs: int32, images: cstring,
|
||||||
nbyte_images: int32){.cdecl, dynlib: libX11, importc.}
|
nbyte_images: int32){.libxrender.}
|
||||||
proc XRenderFreeGlyphs*(dpy: PDisplay, glyphset: TGlyphSet, gids: PGlyph,
|
proc XRenderFreeGlyphs*(dpy: PDisplay, glyphset: TGlyphSet, gids: PGlyph,
|
||||||
nglyphs: int32){.cdecl, dynlib: libX11, importc.}
|
nglyphs: int32){.libxrender.}
|
||||||
proc XRenderCompositeString8*(dpy: PDisplay, op: int32, src: TPicture,
|
proc XRenderCompositeString8*(dpy: PDisplay, op: int32, src: TPicture,
|
||||||
dst: TPicture, maskFormat: PXRenderPictFormat,
|
dst: TPicture, maskFormat: PXRenderPictFormat,
|
||||||
glyphset: TGlyphSet, xSrc: int32, ySrc: int32,
|
glyphset: TGlyphSet, xSrc: int32, ySrc: int32,
|
||||||
xDst: int32, yDst: int32, str: cstring,
|
xDst: int32, yDst: int32, str: cstring,
|
||||||
nchar: int32){.cdecl, dynlib: libX11, importc.}
|
nchar: int32){.libxrender.}
|
||||||
# implementation
|
# implementation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue