remove tests/deps/ (#17132)
* remove tests/deps/ * fix tests * fix tests/manyloc/keineschweine/lib/zlib_helpers.nim * fixup
This commit is contained in:
parent
b1a3651ae4
commit
5d95137ce0
49 changed files with 26 additions and 27270 deletions
|
|
@ -47,7 +47,8 @@ proc initDefines*(symbols: StringTableRef) =
|
||||||
defineSymbol("nimparsebiggestfloatmagic") # deadcode
|
defineSymbol("nimparsebiggestfloatmagic") # deadcode
|
||||||
defineSymbol("nimalias") # deadcode
|
defineSymbol("nimalias") # deadcode
|
||||||
defineSymbol("nimlocks") # deadcode
|
defineSymbol("nimlocks") # deadcode
|
||||||
defineSymbol("nimnode") # deadcode pending tests/deps/opengl-1.1.0/opengl.nim
|
defineSymbol("nimnode") # deadcode pending `nimnode` reference in opengl package
|
||||||
|
# refs https://github.com/nim-lang/opengl/pull/79
|
||||||
defineSymbol("nimvarargstyped") # deadcode
|
defineSymbol("nimvarargstyped") # deadcode
|
||||||
defineSymbol("nimtypedescfixed") # deadcode
|
defineSymbol("nimtypedescfixed") # deadcode
|
||||||
defineSymbol("nimKnowsNimvm") # deadcode
|
defineSymbol("nimKnowsNimvm") # deadcode
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ Represents absolute paths, but using a symbolic variables (eg $nimr) which can b
|
||||||
resolved at runtime; this avoids hardcoding at compile time absolute paths so
|
resolved at runtime; this avoids hardcoding at compile time absolute paths so
|
||||||
that the project root can be relocated.
|
that the project root can be relocated.
|
||||||
|
|
||||||
xxx consider some refactoring with $nim/testament/lib/stdtest/specialpaths.nim;
|
xxx factor pending https://github.com/timotheecour/Nim/issues/616, see also
|
||||||
|
$nim/testament/lib/stdtest/specialpaths.nim
|
||||||
specialpaths is simpler because it doesn't need variables to be relocatable at
|
specialpaths is simpler because it doesn't need variables to be relocatable at
|
||||||
runtime (eg for use in testament)
|
runtime (eg for use in testament)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ Example "template" **to edit** and write a Testament unittest:
|
||||||
|
|
||||||
# Command the test should use to run. If left out or an empty string is
|
# Command the test should use to run. If left out or an empty string is
|
||||||
# provided, the command is taken to be:
|
# provided, the command is taken to be:
|
||||||
# "nim $target --hints:on -d:testing --nimblePath:tests/deps $options $file"
|
# "nim $target --hints:on -d:testing --nimblePath:build/deps/pkgs $options $file"
|
||||||
# You can use the $target, $options, and $file placeholders in your own
|
# You can use the $target, $options, and $file placeholders in your own
|
||||||
# command, too.
|
# command, too.
|
||||||
cmd: "nim c -r $file"
|
cmd: "nim c -r $file"
|
||||||
|
|
|
||||||
6
koch.nim
6
koch.nim
|
|
@ -538,6 +538,12 @@ proc runCI(cmd: string) =
|
||||||
else:
|
else:
|
||||||
buildTools()
|
buildTools()
|
||||||
|
|
||||||
|
for a in "zip opengl sdl1 jester@#head".split:
|
||||||
|
let buildDeps = "build"/"deps" # xxx factor pending https://github.com/timotheecour/Nim/issues/616
|
||||||
|
# if this gives `Additional info: "build/deps" [OSError]`, make sure nimble is >= v0.12.0,
|
||||||
|
# otherwise `absolutePath` is needed, refs https://github.com/nim-lang/nimble/issues/901
|
||||||
|
execFold("", "nimble install -y --nimbleDir:$# $#" % [buildDeps.quoteShell, a])
|
||||||
|
|
||||||
## run tests
|
## run tests
|
||||||
execFold("Test nimscript", "nim e tests/test_nimscript.nims")
|
execFold("Test nimscript", "nim e tests/test_nimscript.nims")
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#[
|
#[
|
||||||
todo: move findNimStdLibCompileTime, findNimStdLib here
|
todo: move findNimStdLibCompileTime, findNimStdLib here
|
||||||
xxx: consider moving this to $nim/compiler/relpaths.nim to get relocatable paths
|
xxx: factor pending https://github.com/timotheecour/Nim/issues/616
|
||||||
|
|
||||||
## note: $lib vs $nim
|
## note: $lib vs $nim
|
||||||
note: these can resolve to 3 different paths if running via `nim c --lib:lib foo`,
|
note: these can resolve to 3 different paths if running via `nim c --lib:lib foo`,
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ type
|
||||||
|
|
||||||
proc getCmd*(s: TSpec): string =
|
proc getCmd*(s: TSpec): string =
|
||||||
if s.cmd.len == 0:
|
if s.cmd.len == 0:
|
||||||
result = compilerPrefix & " $target --hints:on -d:testing --nimblePath:tests/deps $options $file"
|
result = compilerPrefix & " $target --hints:on -d:testing --clearNimblePath --nimblePath:build/deps/pkgs $options $file"
|
||||||
else:
|
else:
|
||||||
result = s.cmd
|
result = s.cmd
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
targets: "cpp"
|
targets: "cpp"
|
||||||
output: "hello"
|
output: "hello"
|
||||||
cmd: "nim cpp --nilseqs:on --nimblePath:tests/deps $file"
|
cmd: "nim cpp --nilseqs:on --clearNimblePath --nimblePath:build/deps/pkgs $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# bug #3299
|
# bug #3299
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,22 +0,0 @@
|
||||||
# Package
|
|
||||||
|
|
||||||
version = "0.4.3" # Be sure to update jester.jesterVer too!
|
|
||||||
author = "Dominik Picheta"
|
|
||||||
description = "A sinatra-like web framework for Nim."
|
|
||||||
license = "MIT"
|
|
||||||
|
|
||||||
skipFiles = @["todo.markdown"]
|
|
||||||
skipDirs = @["tests"]
|
|
||||||
|
|
||||||
# Deps
|
|
||||||
|
|
||||||
requires "nim >= 0.18.1"
|
|
||||||
|
|
||||||
when not defined(windows):
|
|
||||||
requires "httpbeast >= 0.2.2"
|
|
||||||
|
|
||||||
# For tests
|
|
||||||
requires "https://github.com/timotheecour/asynctools#pr_fix_compilation"
|
|
||||||
|
|
||||||
task test, "Runs the test suite.":
|
|
||||||
exec "nimble c -y -r tests/tester"
|
|
||||||
|
|
@ -1,141 +0,0 @@
|
||||||
# Copyright (C) 2012-2018 Dominik Picheta
|
|
||||||
# MIT License - Look at license.txt for details.
|
|
||||||
import parseutils, tables
|
|
||||||
type
|
|
||||||
NodeType* = enum
|
|
||||||
NodeText, NodeField
|
|
||||||
Node* = object
|
|
||||||
typ*: NodeType
|
|
||||||
text*: string
|
|
||||||
optional*: bool
|
|
||||||
|
|
||||||
Pattern* = seq[Node]
|
|
||||||
|
|
||||||
#/show/@id/?
|
|
||||||
proc parsePattern*(pattern: string): Pattern =
|
|
||||||
result = @[]
|
|
||||||
template addNode(result: var Pattern, theT: NodeType, theText: string,
|
|
||||||
isOptional: bool) =
|
|
||||||
block:
|
|
||||||
var newNode: Node
|
|
||||||
newNode.typ = theT
|
|
||||||
newNode.text = theText
|
|
||||||
newNode.optional = isOptional
|
|
||||||
result.add(newNode)
|
|
||||||
|
|
||||||
template `{}`(s: string, i: int): char =
|
|
||||||
if i >= len(s):
|
|
||||||
'\0'
|
|
||||||
else:
|
|
||||||
s[i]
|
|
||||||
|
|
||||||
var i = 0
|
|
||||||
var text = ""
|
|
||||||
while i < pattern.len():
|
|
||||||
case pattern[i]
|
|
||||||
of '@':
|
|
||||||
# Add the stored text.
|
|
||||||
if text != "":
|
|
||||||
result.addNode(NodeText, text, false)
|
|
||||||
text = ""
|
|
||||||
# Parse named parameter.
|
|
||||||
inc(i) # Skip @
|
|
||||||
var nparam = ""
|
|
||||||
i += pattern.parseUntil(nparam, {'/', '?'}, i)
|
|
||||||
var optional = pattern{i} == '?'
|
|
||||||
result.addNode(NodeField, nparam, optional)
|
|
||||||
if pattern{i} == '?': inc(i) # Only skip ?. / should not be skipped.
|
|
||||||
of '?':
|
|
||||||
var optionalChar = text[^1]
|
|
||||||
setLen(text, text.len-1) # Truncate ``text``.
|
|
||||||
# Add the stored text.
|
|
||||||
if text != "":
|
|
||||||
result.addNode(NodeText, text, false)
|
|
||||||
text = ""
|
|
||||||
# Add optional char.
|
|
||||||
inc(i) # Skip ?
|
|
||||||
result.addNode(NodeText, $optionalChar, true)
|
|
||||||
of '\\':
|
|
||||||
inc i # Skip \
|
|
||||||
if pattern[i] notin {'?', '@', '\\'}:
|
|
||||||
raise newException(ValueError,
|
|
||||||
"This character does not require escaping: " & pattern[i])
|
|
||||||
text.add(pattern{i})
|
|
||||||
inc i # Skip ``pattern[i]``
|
|
||||||
else:
|
|
||||||
text.add(pattern{i})
|
|
||||||
inc(i)
|
|
||||||
|
|
||||||
if text != "":
|
|
||||||
result.addNode(NodeText, text, false)
|
|
||||||
|
|
||||||
proc findNextText(pattern: Pattern, i: int, toNode: var Node): bool =
|
|
||||||
## Finds the next NodeText in the pattern, starts looking from ``i``.
|
|
||||||
result = false
|
|
||||||
for n in i..pattern.len()-1:
|
|
||||||
if pattern[n].typ == NodeText:
|
|
||||||
toNode = pattern[n]
|
|
||||||
return true
|
|
||||||
|
|
||||||
proc check(n: Node, s: string, i: int): bool =
|
|
||||||
let cutTo = (n.text.len-1)+i
|
|
||||||
if cutTo > s.len-1: return false
|
|
||||||
return s.substr(i, cutTo) == n.text
|
|
||||||
|
|
||||||
proc match*(pattern: Pattern, s: string):
|
|
||||||
tuple[matched: bool, params: Table[string, string]] =
|
|
||||||
var i = 0 # Location in ``s``.
|
|
||||||
|
|
||||||
result.matched = true
|
|
||||||
result.params = initTable[string, string]()
|
|
||||||
|
|
||||||
for ncount, node in pattern:
|
|
||||||
case node.typ
|
|
||||||
of NodeText:
|
|
||||||
if node.optional:
|
|
||||||
if check(node, s, i):
|
|
||||||
inc(i, node.text.len) # Skip over this optional character.
|
|
||||||
else:
|
|
||||||
# If it's not there, we have nothing to do. It's optional after all.
|
|
||||||
discard
|
|
||||||
else:
|
|
||||||
if check(node, s, i):
|
|
||||||
inc(i, node.text.len) # Skip over this
|
|
||||||
else:
|
|
||||||
# No match.
|
|
||||||
result.matched = false
|
|
||||||
return
|
|
||||||
of NodeField:
|
|
||||||
var nextTxtNode: Node
|
|
||||||
var stopChar = '/'
|
|
||||||
if findNextText(pattern, ncount, nextTxtNode):
|
|
||||||
stopChar = nextTxtNode.text[0]
|
|
||||||
var matchNamed = ""
|
|
||||||
i += s.parseUntil(matchNamed, stopChar, i)
|
|
||||||
result.params[node.text] = matchNamed
|
|
||||||
if matchNamed == "" and not node.optional:
|
|
||||||
result.matched = false
|
|
||||||
return
|
|
||||||
|
|
||||||
if s.len != i:
|
|
||||||
result.matched = false
|
|
||||||
|
|
||||||
when isMainModule:
|
|
||||||
let f = parsePattern("/show/@id/test/@show?/?")
|
|
||||||
doAssert match(f, "/show/12/test/hallo/").matched
|
|
||||||
doAssert match(f, "/show/2131726/test/jjjuuwąąss").matched
|
|
||||||
doAssert(not match(f, "/").matched)
|
|
||||||
doAssert(not match(f, "/show//test//").matched)
|
|
||||||
doAssert(match(f, "/show/asd/test//").matched)
|
|
||||||
doAssert(not match(f, "/show/asd/asd/test/jjj/").matched)
|
|
||||||
doAssert(match(f, "/show/@łę¶ŧ←/test/asd/").params["id"] == "@łę¶ŧ←")
|
|
||||||
|
|
||||||
let f2 = parsePattern("/test42/somefile.?@ext?/?")
|
|
||||||
doAssert(match(f2, "/test42/somefile/").params["ext"] == "")
|
|
||||||
doAssert(match(f2, "/test42/somefile.txt").params["ext"] == "txt")
|
|
||||||
doAssert(match(f2, "/test42/somefile.txt/").params["ext"] == "txt")
|
|
||||||
|
|
||||||
let f3 = parsePattern(r"/test32/\@\\\??")
|
|
||||||
doAssert(match(f3, r"/test32/@\").matched)
|
|
||||||
doAssert(not match(f3, r"/test32/@\\").matched)
|
|
||||||
doAssert(match(f3, r"/test32/@\?").matched)
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
# Copyright (C) 2012 Dominik Picheta
|
|
||||||
# MIT License - Look at license.txt for details.
|
|
||||||
import htmlgen
|
|
||||||
proc error*(err, jesterVer: string): string =
|
|
||||||
return html(head(title(err)),
|
|
||||||
body(h1(err),
|
|
||||||
"<hr/>",
|
|
||||||
p("Jester " & jesterVer),
|
|
||||||
style = "text-align: center;"
|
|
||||||
),
|
|
||||||
xmlns="http://www.w3.org/1999/xhtml")
|
|
||||||
|
|
||||||
proc routeException*(error: string, jesterVer: string): string =
|
|
||||||
return html(head(title("Jester route exception")),
|
|
||||||
body(
|
|
||||||
h1("An error has occured in one of your routes."),
|
|
||||||
p(b("Detail: "), error)
|
|
||||||
),
|
|
||||||
xmlns="http://www.w3.org/1999/xhtml")
|
|
||||||
|
|
@ -1,194 +0,0 @@
|
||||||
# Copyright (C) 2012 Dominik Picheta
|
|
||||||
# MIT License - Look at license.txt for details.
|
|
||||||
import parseutils, strtabs, strutils, tables, net, mimetypes, asyncdispatch, os
|
|
||||||
from cgi import decodeUrl
|
|
||||||
|
|
||||||
const
|
|
||||||
useHttpBeast* = false # not defined(windows) and not defined(useStdLib)
|
|
||||||
|
|
||||||
type
|
|
||||||
MultiData* = OrderedTable[string, tuple[fields: StringTableRef, body: string]]
|
|
||||||
|
|
||||||
Settings* = ref object
|
|
||||||
staticDir*: string # By default ./public
|
|
||||||
appName*: string
|
|
||||||
mimes*: MimeDb
|
|
||||||
port*: Port
|
|
||||||
bindAddr*: string
|
|
||||||
reusePort*: bool
|
|
||||||
futureErrorHandler*: proc (fut: Future[void]) {.closure, gcsafe.}
|
|
||||||
|
|
||||||
JesterError* = object of Exception
|
|
||||||
|
|
||||||
proc parseUrlQuery*(query: string, result: var Table[string, string])
|
|
||||||
{.deprecated: "use stdlib cgi/decodeData".} =
|
|
||||||
var i = 0
|
|
||||||
i = query.skip("?")
|
|
||||||
while i < query.len()-1:
|
|
||||||
var key = ""
|
|
||||||
var val = ""
|
|
||||||
i += query.parseUntil(key, '=', i)
|
|
||||||
if query[i] != '=':
|
|
||||||
raise newException(ValueError, "Expected '=' at " & $i &
|
|
||||||
" but got: " & $query[i])
|
|
||||||
inc(i) # Skip =
|
|
||||||
i += query.parseUntil(val, '&', i)
|
|
||||||
inc(i) # Skip &
|
|
||||||
result[decodeUrl(key)] = decodeUrl(val)
|
|
||||||
|
|
||||||
template parseContentDisposition(): typed =
|
|
||||||
var hCount = 0
|
|
||||||
while hCount < hValue.len()-1:
|
|
||||||
var key = ""
|
|
||||||
hCount += hValue.parseUntil(key, {';', '='}, hCount)
|
|
||||||
if hValue[hCount] == '=':
|
|
||||||
var value = hvalue.captureBetween('"', start = hCount)
|
|
||||||
hCount += value.len+2
|
|
||||||
inc(hCount) # Skip ;
|
|
||||||
hCount += hValue.skipWhitespace(hCount)
|
|
||||||
if key == "name": name = value
|
|
||||||
newPart[0][key] = value
|
|
||||||
else:
|
|
||||||
inc(hCount)
|
|
||||||
hCount += hValue.skipWhitespace(hCount)
|
|
||||||
|
|
||||||
proc parseMultiPart*(body: string, boundary: string): MultiData =
|
|
||||||
result = initOrderedTable[string, tuple[fields: StringTableRef, body: string]]()
|
|
||||||
var mboundary = "--" & boundary
|
|
||||||
|
|
||||||
var i = 0
|
|
||||||
var partsLeft = true
|
|
||||||
while partsLeft:
|
|
||||||
var firstBoundary = body.skip(mboundary, i)
|
|
||||||
if firstBoundary == 0:
|
|
||||||
raise newException(ValueError, "Expected boundary. Got: " & body.substr(i, i+25))
|
|
||||||
i += firstBoundary
|
|
||||||
i += body.skipWhitespace(i)
|
|
||||||
|
|
||||||
# Headers
|
|
||||||
var newPart: tuple[fields: StringTableRef, body: string] = ({:}.newStringTable, "")
|
|
||||||
var name = ""
|
|
||||||
while true:
|
|
||||||
if body[i] == '\c':
|
|
||||||
inc(i, 2) # Skip \c\L
|
|
||||||
break
|
|
||||||
var hName = ""
|
|
||||||
i += body.parseUntil(hName, ':', i)
|
|
||||||
if body[i] != ':':
|
|
||||||
raise newException(ValueError, "Expected : in headers.")
|
|
||||||
inc(i) # Skip :
|
|
||||||
i += body.skipWhitespace(i)
|
|
||||||
var hValue = ""
|
|
||||||
i += body.parseUntil(hValue, {'\c', '\L'}, i)
|
|
||||||
if toLowerAscii(hName) == "content-disposition":
|
|
||||||
parseContentDisposition()
|
|
||||||
newPart[0][hName] = hValue
|
|
||||||
i += body.skip("\c\L", i) # Skip *one* \c\L
|
|
||||||
|
|
||||||
# Parse body.
|
|
||||||
while true:
|
|
||||||
if body[i] == '\c' and body[i+1] == '\L' and
|
|
||||||
body.skip(mboundary, i+2) != 0:
|
|
||||||
if body.skip("--", i+2+mboundary.len) != 0:
|
|
||||||
partsLeft = false
|
|
||||||
break
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
newPart[1].add(body[i])
|
|
||||||
inc(i)
|
|
||||||
i += body.skipWhitespace(i)
|
|
||||||
|
|
||||||
result.add(name, newPart)
|
|
||||||
|
|
||||||
proc parseMPFD*(contentType: string, body: string): MultiData =
|
|
||||||
var boundaryEqIndex = contentType.find("boundary=")+9
|
|
||||||
var boundary = contentType.substr(boundaryEqIndex, contentType.len()-1)
|
|
||||||
return parseMultiPart(body, boundary)
|
|
||||||
|
|
||||||
proc parseCookies*(s: string): Table[string, string] =
|
|
||||||
## parses cookies into a string table.
|
|
||||||
##
|
|
||||||
## The proc is meant to parse the Cookie header set by a client, not the
|
|
||||||
## "Set-Cookie" header set by servers.
|
|
||||||
|
|
||||||
result = initTable[string, string]()
|
|
||||||
var i = 0
|
|
||||||
while true:
|
|
||||||
i += skipWhile(s, {' ', '\t'}, i)
|
|
||||||
var keystart = i
|
|
||||||
i += skipUntil(s, {'='}, i)
|
|
||||||
var keyend = i-1
|
|
||||||
if i >= len(s): break
|
|
||||||
inc(i) # skip '='
|
|
||||||
var valstart = i
|
|
||||||
i += skipUntil(s, {';'}, i)
|
|
||||||
result[substr(s, keystart, keyend)] = substr(s, valstart, i-1)
|
|
||||||
if i >= len(s): break
|
|
||||||
inc(i) # skip ';'
|
|
||||||
|
|
||||||
type
|
|
||||||
SameSite* = enum
|
|
||||||
None, Lax, Strict
|
|
||||||
|
|
||||||
proc makeCookie*(key, value, expires: string, domain = "", path = "",
|
|
||||||
secure = false, httpOnly = false,
|
|
||||||
sameSite = Lax): string =
|
|
||||||
result = ""
|
|
||||||
result.add key & "=" & value
|
|
||||||
if domain != "": result.add("; Domain=" & domain)
|
|
||||||
if path != "": result.add("; Path=" & path)
|
|
||||||
if expires != "": result.add("; Expires=" & expires)
|
|
||||||
if secure: result.add("; Secure")
|
|
||||||
if httpOnly: result.add("; HttpOnly")
|
|
||||||
if sameSite != None:
|
|
||||||
result.add("; SameSite=" & $sameSite)
|
|
||||||
|
|
||||||
when not declared(tables.getOrDefault):
|
|
||||||
template getOrDefault*(tab, key): untyped = tab[key]
|
|
||||||
|
|
||||||
when not declared(normalizePath) and not declared(normalizedPath):
|
|
||||||
proc normalizePath*(path: var string) =
|
|
||||||
## Normalize a path.
|
|
||||||
##
|
|
||||||
## Consecutive directory separators are collapsed, including an initial double slash.
|
|
||||||
##
|
|
||||||
## On relative paths, double dot (..) sequences are collapsed if possible.
|
|
||||||
## On absolute paths they are always collapsed.
|
|
||||||
##
|
|
||||||
## Warning: URL-encoded and Unicode attempts at directory traversal are not detected.
|
|
||||||
## Triple dot is not handled.
|
|
||||||
let isAbs = isAbsolute(path)
|
|
||||||
var stack: seq[string] = @[]
|
|
||||||
for p in split(path, {DirSep}):
|
|
||||||
case p
|
|
||||||
of "", ".":
|
|
||||||
continue
|
|
||||||
of "..":
|
|
||||||
if stack.len == 0:
|
|
||||||
if isAbs:
|
|
||||||
discard # collapse all double dots on absoluta paths
|
|
||||||
else:
|
|
||||||
stack.add(p)
|
|
||||||
elif stack[^1] == "..":
|
|
||||||
stack.add(p)
|
|
||||||
else:
|
|
||||||
discard stack.pop()
|
|
||||||
else:
|
|
||||||
stack.add(p)
|
|
||||||
|
|
||||||
if isAbs:
|
|
||||||
path = DirSep & join(stack, $DirSep)
|
|
||||||
elif stack.len > 0:
|
|
||||||
path = join(stack, $DirSep)
|
|
||||||
else:
|
|
||||||
path = "."
|
|
||||||
|
|
||||||
proc normalizedPath*(path: string): string =
|
|
||||||
## Returns a normalized path for the current OS. See `<#normalizePath>`_
|
|
||||||
result = path
|
|
||||||
normalizePath(result)
|
|
||||||
|
|
||||||
when false:
|
|
||||||
var r = {:}.newStringTable
|
|
||||||
parseUrlQuery("FirstName=Mickey", r)
|
|
||||||
echo r
|
|
||||||
|
|
@ -1,185 +0,0 @@
|
||||||
import uri, cgi, tables, logging, strutils, re, options
|
|
||||||
|
|
||||||
import jester/private/utils
|
|
||||||
|
|
||||||
when useHttpBeast:
|
|
||||||
import httpbeast except Settings
|
|
||||||
import options, httpcore
|
|
||||||
|
|
||||||
type
|
|
||||||
NativeRequest* = httpbeast.Request
|
|
||||||
else:
|
|
||||||
import asynchttpserver
|
|
||||||
|
|
||||||
type
|
|
||||||
NativeRequest* = asynchttpserver.Request
|
|
||||||
|
|
||||||
type
|
|
||||||
Request* = object
|
|
||||||
req: NativeRequest
|
|
||||||
patternParams: Option[Table[string, string]]
|
|
||||||
reMatches: array[MaxSubpatterns, string]
|
|
||||||
settings*: Settings
|
|
||||||
|
|
||||||
proc body*(req: Request): string =
|
|
||||||
## Body of the request, only for POST.
|
|
||||||
##
|
|
||||||
## You're probably looking for ``formData``
|
|
||||||
## instead.
|
|
||||||
when useHttpBeast:
|
|
||||||
req.req.body.get("")
|
|
||||||
else:
|
|
||||||
req.req.body
|
|
||||||
|
|
||||||
proc headers*(req: Request): HttpHeaders =
|
|
||||||
## Headers received with the request.
|
|
||||||
## Retrieving these is case insensitive.
|
|
||||||
when useHttpBeast:
|
|
||||||
if req.req.headers.isNone:
|
|
||||||
newHttpHeaders()
|
|
||||||
else:
|
|
||||||
req.req.headers.get()
|
|
||||||
else:
|
|
||||||
req.req.headers
|
|
||||||
|
|
||||||
proc path*(req: Request): string =
|
|
||||||
## Path of request without the query string.
|
|
||||||
when useHttpBeast:
|
|
||||||
let p = req.req.path.get("")
|
|
||||||
let queryStart = p.find('?')
|
|
||||||
if unlikely(queryStart != -1):
|
|
||||||
return p[0 .. queryStart-1]
|
|
||||||
else:
|
|
||||||
return p
|
|
||||||
else:
|
|
||||||
let u = req.req.url
|
|
||||||
return u.path
|
|
||||||
|
|
||||||
proc reqMethod*(req: Request): HttpMethod =
|
|
||||||
## Request method, e.g. HttpGet, HttpPost
|
|
||||||
when useHttpBeast:
|
|
||||||
req.req.httpMethod.get()
|
|
||||||
else:
|
|
||||||
req.req.reqMethod
|
|
||||||
|
|
||||||
proc reqMeth*(req: Request): HttpMethod {.deprecated.} =
|
|
||||||
req.reqMethod
|
|
||||||
|
|
||||||
proc ip*(req: Request): string =
|
|
||||||
## IP address of the requesting client.
|
|
||||||
when useHttpBeast:
|
|
||||||
result = req.req.ip
|
|
||||||
else:
|
|
||||||
result = req.req.hostname
|
|
||||||
|
|
||||||
let headers = req.headers
|
|
||||||
if headers.hasKey("REMOTE_ADDR"):
|
|
||||||
result = headers["REMOTE_ADDR"]
|
|
||||||
if headers.hasKey("x-forwarded-for"):
|
|
||||||
result = headers["x-forwarded-for"]
|
|
||||||
|
|
||||||
proc params*(req: Request): Table[string, string] =
|
|
||||||
## Parameters from the pattern and the query string.
|
|
||||||
if req.patternParams.isSome():
|
|
||||||
result = req.patternParams.get()
|
|
||||||
else:
|
|
||||||
result = initTable[string, string]()
|
|
||||||
|
|
||||||
when useHttpBeast:
|
|
||||||
let query = req.req.path.get("").parseUri().query
|
|
||||||
else:
|
|
||||||
let query = req.req.url.query
|
|
||||||
|
|
||||||
try:
|
|
||||||
for key, val in cgi.decodeData(query):
|
|
||||||
result[key] = val
|
|
||||||
except CgiError:
|
|
||||||
logging.warn("Incorrect query. Got: $1" % [query])
|
|
||||||
|
|
||||||
let contentType = req.headers.getOrDefault("Content-Type")
|
|
||||||
if contentType.startswith("application/x-www-form-urlencoded"):
|
|
||||||
try:
|
|
||||||
parseUrlQuery(req.body, result)
|
|
||||||
except:
|
|
||||||
logging.warn("Could not parse URL query.")
|
|
||||||
|
|
||||||
proc formData*(req: Request): MultiData =
|
|
||||||
let contentType = req.headers.getOrDefault("Content-Type")
|
|
||||||
if contentType.startsWith("multipart/form-data"):
|
|
||||||
result = parseMPFD(contentType, req.body)
|
|
||||||
|
|
||||||
proc matches*(req: Request): array[MaxSubpatterns, string] =
|
|
||||||
req.reMatches
|
|
||||||
|
|
||||||
proc secure*(req: Request): bool =
|
|
||||||
if req.headers.hasKey("x-forwarded-proto"):
|
|
||||||
let proto = req.headers["x-forwarded-proto"]
|
|
||||||
case proto.toLowerAscii()
|
|
||||||
of "https":
|
|
||||||
result = true
|
|
||||||
of "http":
|
|
||||||
result = false
|
|
||||||
else:
|
|
||||||
logging.warn("Unknown x-forwarded-proto ", proto)
|
|
||||||
|
|
||||||
proc port*(req: Request): int =
|
|
||||||
if (let p = req.headers.getOrDefault("SERVER_PORT"); p != ""):
|
|
||||||
result = p.parseInt
|
|
||||||
else:
|
|
||||||
result = if req.secure: 443 else: 80
|
|
||||||
|
|
||||||
proc host*(req: Request): string =
|
|
||||||
req.headers.getOrDefault("HOST")
|
|
||||||
|
|
||||||
proc appName*(req: Request): string =
|
|
||||||
## This is set by the user in ``run``, it is
|
|
||||||
## overriden by the "SCRIPT_NAME" scgi
|
|
||||||
## parameter.
|
|
||||||
req.settings.appName
|
|
||||||
|
|
||||||
proc stripAppName(path, appName: string): string =
|
|
||||||
result = path
|
|
||||||
if appname.len > 0:
|
|
||||||
var slashAppName = appName
|
|
||||||
if slashAppName[0] != '/' and path[0] == '/':
|
|
||||||
slashAppName = '/' & slashAppName
|
|
||||||
|
|
||||||
if path.startsWith(slashAppName):
|
|
||||||
if slashAppName.len() == path.len:
|
|
||||||
return "/"
|
|
||||||
else:
|
|
||||||
return path[slashAppName.len .. path.len-1]
|
|
||||||
else:
|
|
||||||
raise newException(ValueError,
|
|
||||||
"Expected script name at beginning of path. Got path: " &
|
|
||||||
path & " script name: " & slashAppName)
|
|
||||||
|
|
||||||
proc pathInfo*(req: Request): string =
|
|
||||||
## This is ``.path`` without ``.appName``.
|
|
||||||
req.path.stripAppName(req.appName)
|
|
||||||
|
|
||||||
# TODO: Can cookie keys be duplicated?
|
|
||||||
proc cookies*(req: Request): Table[string, string] =
|
|
||||||
## Cookies from the browser.
|
|
||||||
if (let cookie = req.headers.getOrDefault("Cookie"); cookie != ""):
|
|
||||||
result = parseCookies(cookie)
|
|
||||||
else:
|
|
||||||
result = initTable[string, string]()
|
|
||||||
|
|
||||||
#[ Protected procs ]#
|
|
||||||
|
|
||||||
proc initRequest*(req: NativeRequest, settings: Settings): Request {.inline.} =
|
|
||||||
Request(
|
|
||||||
req: req,
|
|
||||||
settings: settings
|
|
||||||
)
|
|
||||||
|
|
||||||
proc getNativeReq*(req: Request): NativeRequest =
|
|
||||||
req.req
|
|
||||||
|
|
||||||
#[ Only to be used by our route macro. ]#
|
|
||||||
proc setPatternParams*(req: var Request, p: Table[string, string]) =
|
|
||||||
req.patternParams = some(p)
|
|
||||||
|
|
||||||
proc setReMatches*(req: var Request, r: array[MaxSubpatterns, string]) =
|
|
||||||
req.reMatches = r
|
|
||||||
|
|
@ -1,326 +0,0 @@
|
||||||
#
|
|
||||||
#
|
|
||||||
# Adaption of the delphi3d.net OpenGL units to FreePascal
|
|
||||||
# Sebastian Guenther (sg@freepascal.org) in 2002
|
|
||||||
# These units are free to use
|
|
||||||
#******************************************************************************
|
|
||||||
# Converted to Delphi by Tom Nuydens (tom@delphi3d.net)
|
|
||||||
# For the latest updates, visit Delphi3D: http://www.delphi3d.net
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
import opengl
|
|
||||||
|
|
||||||
{.deadCodeElim: on.}
|
|
||||||
|
|
||||||
when defined(windows):
|
|
||||||
{.push, callconv: stdcall.}
|
|
||||||
else:
|
|
||||||
{.push, callconv: cdecl.}
|
|
||||||
|
|
||||||
when defined(windows):
|
|
||||||
const
|
|
||||||
dllname = "glu32.dll"
|
|
||||||
elif defined(macosx):
|
|
||||||
const
|
|
||||||
dllname = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib"
|
|
||||||
else:
|
|
||||||
const
|
|
||||||
dllname = "libGLU.so.1"
|
|
||||||
|
|
||||||
type
|
|
||||||
ViewPortArray* = array[0..3, GLint]
|
|
||||||
T16dArray* = array[0..15, GLdouble]
|
|
||||||
CallBack* = proc () {.cdecl.}
|
|
||||||
T3dArray* = array[0..2, GLdouble]
|
|
||||||
T4pArray* = array[0..3, pointer]
|
|
||||||
T4fArray* = array[0..3, GLfloat]
|
|
||||||
|
|
||||||
{.deprecated: [
|
|
||||||
TViewPortArray: ViewPortArray,
|
|
||||||
TCallBack: CallBack,
|
|
||||||
].}
|
|
||||||
|
|
||||||
type
|
|
||||||
GLUnurbs*{.final.} = ptr object
|
|
||||||
GLUquadric*{.final.} = ptr object
|
|
||||||
GLUtesselator*{.final.} = ptr object
|
|
||||||
GLUnurbsObj* = GLUnurbs
|
|
||||||
GLUquadricObj* = GLUquadric
|
|
||||||
GLUtesselatorObj* = GLUtesselator
|
|
||||||
GLUtriangulatorObj* = GLUtesselator
|
|
||||||
|
|
||||||
proc gluErrorString*(errCode: GLenum): cstring{.dynlib: dllname,
|
|
||||||
importc: "gluErrorString".}
|
|
||||||
when defined(Windows):
|
|
||||||
proc gluErrorUnicodeStringEXT*(errCode: GLenum): ptr int16{.dynlib: dllname,
|
|
||||||
importc: "gluErrorUnicodeStringEXT".}
|
|
||||||
proc gluGetString*(name: GLenum): cstring{.dynlib: dllname,
|
|
||||||
importc: "gluGetString".}
|
|
||||||
proc gluOrtho2D*(left, right, bottom, top: GLdouble){.dynlib: dllname,
|
|
||||||
importc: "gluOrtho2D".}
|
|
||||||
proc gluPerspective*(fovy, aspect, zNear, zFar: GLdouble){.dynlib: dllname,
|
|
||||||
importc: "gluPerspective".}
|
|
||||||
proc gluPickMatrix*(x, y, width, height: GLdouble, viewport: var ViewPortArray){.
|
|
||||||
dynlib: dllname, importc: "gluPickMatrix".}
|
|
||||||
proc gluLookAt*(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble){.
|
|
||||||
dynlib: dllname, importc: "gluLookAt".}
|
|
||||||
proc gluProject*(objx, objy, objz: GLdouble,
|
|
||||||
modelMatrix, projMatrix: var T16dArray,
|
|
||||||
viewport: var ViewPortArray, winx, winy, winz: ptr GLdouble): int{.
|
|
||||||
dynlib: dllname, importc: "gluProject".}
|
|
||||||
proc gluUnProject*(winx, winy, winz: GLdouble,
|
|
||||||
modelMatrix, projMatrix: var T16dArray,
|
|
||||||
viewport: var ViewPortArray, objx, objy, objz: ptr GLdouble): int{.
|
|
||||||
dynlib: dllname, importc: "gluUnProject".}
|
|
||||||
proc gluScaleImage*(format: GLenum, widthin, heightin: GLint, typein: GLenum,
|
|
||||||
datain: pointer, widthout, heightout: GLint,
|
|
||||||
typeout: GLenum, dataout: pointer): int{.dynlib: dllname,
|
|
||||||
importc: "gluScaleImage".}
|
|
||||||
proc gluBuild1DMipmaps*(target: GLenum, components, width: GLint,
|
|
||||||
format, atype: GLenum, data: pointer): int{.
|
|
||||||
dynlib: dllname, importc: "gluBuild1DMipmaps".}
|
|
||||||
proc gluBuild2DMipmaps*(target: GLenum, components, width, height: GLint,
|
|
||||||
format, atype: GLenum, data: pointer): int{.
|
|
||||||
dynlib: dllname, importc: "gluBuild2DMipmaps".}
|
|
||||||
proc gluNewQuadric*(): GLUquadric{.dynlib: dllname, importc: "gluNewQuadric".}
|
|
||||||
proc gluDeleteQuadric*(state: GLUquadric){.dynlib: dllname,
|
|
||||||
importc: "gluDeleteQuadric".}
|
|
||||||
proc gluQuadricNormals*(quadObject: GLUquadric, normals: GLenum){.
|
|
||||||
dynlib: dllname, importc: "gluQuadricNormals".}
|
|
||||||
proc gluQuadricTexture*(quadObject: GLUquadric, textureCoords: GLboolean){.
|
|
||||||
dynlib: dllname, importc: "gluQuadricTexture".}
|
|
||||||
proc gluQuadricOrientation*(quadObject: GLUquadric, orientation: GLenum){.
|
|
||||||
dynlib: dllname, importc: "gluQuadricOrientation".}
|
|
||||||
proc gluQuadricDrawStyle*(quadObject: GLUquadric, drawStyle: GLenum){.
|
|
||||||
dynlib: dllname, importc: "gluQuadricDrawStyle".}
|
|
||||||
proc gluCylinder*(qobj: GLUquadric, baseRadius, topRadius, height: GLdouble,
|
|
||||||
slices, stacks: GLint){.dynlib: dllname,
|
|
||||||
importc: "gluCylinder".}
|
|
||||||
proc gluDisk*(qobj: GLUquadric, innerRadius, outerRadius: GLdouble,
|
|
||||||
slices, loops: GLint){.dynlib: dllname, importc: "gluDisk".}
|
|
||||||
proc gluPartialDisk*(qobj: GLUquadric, innerRadius, outerRadius: GLdouble,
|
|
||||||
slices, loops: GLint, startAngle, sweepAngle: GLdouble){.
|
|
||||||
dynlib: dllname, importc: "gluPartialDisk".}
|
|
||||||
proc gluSphere*(qobj: GLuquadric, radius: GLdouble, slices, stacks: GLint){.
|
|
||||||
dynlib: dllname, importc: "gluSphere".}
|
|
||||||
proc gluQuadricCallback*(qobj: GLUquadric, which: GLenum, fn: CallBack){.
|
|
||||||
dynlib: dllname, importc: "gluQuadricCallback".}
|
|
||||||
proc gluNewTess*(): GLUtesselator{.dynlib: dllname, importc: "gluNewTess".}
|
|
||||||
proc gluDeleteTess*(tess: GLUtesselator){.dynlib: dllname,
|
|
||||||
importc: "gluDeleteTess".}
|
|
||||||
proc gluTessBeginPolygon*(tess: GLUtesselator, polygon_data: pointer){.
|
|
||||||
dynlib: dllname, importc: "gluTessBeginPolygon".}
|
|
||||||
proc gluTessBeginContour*(tess: GLUtesselator){.dynlib: dllname,
|
|
||||||
importc: "gluTessBeginContour".}
|
|
||||||
proc gluTessVertex*(tess: GLUtesselator, coords: var T3dArray, data: pointer){.
|
|
||||||
dynlib: dllname, importc: "gluTessVertex".}
|
|
||||||
proc gluTessEndContour*(tess: GLUtesselator){.dynlib: dllname,
|
|
||||||
importc: "gluTessEndContour".}
|
|
||||||
proc gluTessEndPolygon*(tess: GLUtesselator){.dynlib: dllname,
|
|
||||||
importc: "gluTessEndPolygon".}
|
|
||||||
proc gluTessProperty*(tess: GLUtesselator, which: GLenum, value: GLdouble){.
|
|
||||||
dynlib: dllname, importc: "gluTessProperty".}
|
|
||||||
proc gluTessNormal*(tess: GLUtesselator, x, y, z: GLdouble){.dynlib: dllname,
|
|
||||||
importc: "gluTessNormal".}
|
|
||||||
proc gluTessCallback*(tess: GLUtesselator, which: GLenum, fn: CallBack){.
|
|
||||||
dynlib: dllname, importc: "gluTessCallback".}
|
|
||||||
proc gluGetTessProperty*(tess: GLUtesselator, which: GLenum, value: ptr GLdouble){.
|
|
||||||
dynlib: dllname, importc: "gluGetTessProperty".}
|
|
||||||
proc gluNewNurbsRenderer*(): GLUnurbs{.dynlib: dllname,
|
|
||||||
importc: "gluNewNurbsRenderer".}
|
|
||||||
proc gluDeleteNurbsRenderer*(nobj: GLUnurbs){.dynlib: dllname,
|
|
||||||
importc: "gluDeleteNurbsRenderer".}
|
|
||||||
proc gluBeginSurface*(nobj: GLUnurbs){.dynlib: dllname,
|
|
||||||
importc: "gluBeginSurface".}
|
|
||||||
proc gluBeginCurve*(nobj: GLUnurbs){.dynlib: dllname, importc: "gluBeginCurve".}
|
|
||||||
proc gluEndCurve*(nobj: GLUnurbs){.dynlib: dllname, importc: "gluEndCurve".}
|
|
||||||
proc gluEndSurface*(nobj: GLUnurbs){.dynlib: dllname, importc: "gluEndSurface".}
|
|
||||||
proc gluBeginTrim*(nobj: GLUnurbs){.dynlib: dllname, importc: "gluBeginTrim".}
|
|
||||||
proc gluEndTrim*(nobj: GLUnurbs){.dynlib: dllname, importc: "gluEndTrim".}
|
|
||||||
proc gluPwlCurve*(nobj: GLUnurbs, count: GLint, aarray: ptr GLfloat,
|
|
||||||
stride: GLint, atype: GLenum){.dynlib: dllname,
|
|
||||||
importc: "gluPwlCurve".}
|
|
||||||
proc gluNurbsCurve*(nobj: GLUnurbs, nknots: GLint, knot: ptr GLfloat,
|
|
||||||
stride: GLint, ctlarray: ptr GLfloat, order: GLint,
|
|
||||||
atype: GLenum){.dynlib: dllname, importc: "gluNurbsCurve".}
|
|
||||||
proc gluNurbsSurface*(nobj: GLUnurbs, sknot_count: GLint, sknot: ptr GLfloat,
|
|
||||||
tknot_count: GLint, tknot: ptr GLfloat,
|
|
||||||
s_stride, t_stride: GLint, ctlarray: ptr GLfloat,
|
|
||||||
sorder, torder: GLint, atype: GLenum){.dynlib: dllname,
|
|
||||||
importc: "gluNurbsSurface".}
|
|
||||||
proc gluLoadSamplingMatrices*(nobj: GLUnurbs,
|
|
||||||
modelMatrix, projMatrix: var T16dArray,
|
|
||||||
viewport: var ViewPortArray){.dynlib: dllname,
|
|
||||||
importc: "gluLoadSamplingMatrices".}
|
|
||||||
proc gluNurbsProperty*(nobj: GLUnurbs, aproperty: GLenum, value: GLfloat){.
|
|
||||||
dynlib: dllname, importc: "gluNurbsProperty".}
|
|
||||||
proc gluGetNurbsProperty*(nobj: GLUnurbs, aproperty: GLenum, value: ptr GLfloat){.
|
|
||||||
dynlib: dllname, importc: "gluGetNurbsProperty".}
|
|
||||||
proc gluNurbsCallback*(nobj: GLUnurbs, which: GLenum, fn: CallBack){.
|
|
||||||
dynlib: dllname, importc: "gluNurbsCallback".}
|
|
||||||
#*** Callback function prototypes ***
|
|
||||||
type # gluQuadricCallback
|
|
||||||
GLUquadricErrorProc* = proc (p: GLenum) # gluTessCallback
|
|
||||||
GLUtessBeginProc* = proc (p: GLenum)
|
|
||||||
GLUtessEdgeFlagProc* = proc (p: GLboolean)
|
|
||||||
GLUtessVertexProc* = proc (p: pointer)
|
|
||||||
GLUtessEndProc* = proc ()
|
|
||||||
GLUtessErrorProc* = proc (p: GLenum)
|
|
||||||
GLUtessCombineProc* = proc (p1: var T3dArray, p2: T4pArray, p3: T4fArray,
|
|
||||||
p4: ptr pointer)
|
|
||||||
GLUtessBeginDataProc* = proc (p1: GLenum, p2: pointer)
|
|
||||||
GLUtessEdgeFlagDataProc* = proc (p1: GLboolean, p2: pointer)
|
|
||||||
GLUtessVertexDataProc* = proc (p1, p2: pointer)
|
|
||||||
GLUtessEndDataProc* = proc (p: pointer)
|
|
||||||
GLUtessErrorDataProc* = proc (p1: GLenum, p2: pointer)
|
|
||||||
GLUtessCombineDataProc* = proc (p1: var T3dArray, p2: var T4pArray,
|
|
||||||
p3: var T4fArray, p4: ptr pointer, p5: pointer) #
|
|
||||||
GLUnurbsErrorProc* = proc (p: GLenum) #*** Generic constants ****/
|
|
||||||
|
|
||||||
const # Version
|
|
||||||
GLU_VERSION_1_1* = 1
|
|
||||||
GLU_VERSION_1_2* = 1 # Errors: (return value 0 = no error)
|
|
||||||
GLU_INVALID_ENUM* = 100900
|
|
||||||
GLU_INVALID_VALUE* = 100901
|
|
||||||
GLU_OUT_OF_MEMORY* = 100902
|
|
||||||
GLU_INCOMPATIBLE_GL_VERSION* = 100903 # StringName
|
|
||||||
GLU_VERSION* = 100800
|
|
||||||
GLU_EXTENSIONS* = 100801 # Boolean
|
|
||||||
GLU_TRUE* = GL_TRUE
|
|
||||||
GLU_FALSE* = GL_FALSE #*** Quadric constants ****/
|
|
||||||
# QuadricNormal
|
|
||||||
GLU_SMOOTH* = 100000
|
|
||||||
GLU_FLAT* = 100001
|
|
||||||
GLU_NONE* = 100002 # QuadricDrawStyle
|
|
||||||
GLU_POINT* = 100010
|
|
||||||
GLU_LINE* = 100011
|
|
||||||
GLU_FILL* = 100012
|
|
||||||
GLU_SILHOUETTE* = 100013 # QuadricOrientation
|
|
||||||
GLU_OUTSIDE* = 100020
|
|
||||||
GLU_INSIDE* = 100021 # Callback types:
|
|
||||||
# GLU_ERROR = 100103;
|
|
||||||
#*** Tesselation constants ****/
|
|
||||||
GLU_TESS_MAX_COORD* = 1.00000e+150 # TessProperty
|
|
||||||
GLU_TESS_WINDING_RULE* = 100140
|
|
||||||
GLU_TESS_BOUNDARY_ONLY* = 100141
|
|
||||||
GLU_TESS_TOLERANCE* = 100142 # TessWinding
|
|
||||||
GLU_TESS_WINDING_ODD* = 100130
|
|
||||||
GLU_TESS_WINDING_NONZERO* = 100131
|
|
||||||
GLU_TESS_WINDING_POSITIVE* = 100132
|
|
||||||
GLU_TESS_WINDING_NEGATIVE* = 100133
|
|
||||||
GLU_TESS_WINDING_ABS_GEQ_TWO* = 100134 # TessCallback
|
|
||||||
GLU_TESS_BEGIN* = 100100 # void (CALLBACK*)(GLenum type)
|
|
||||||
constGLU_TESS_VERTEX* = 100101 # void (CALLBACK*)(void *data)
|
|
||||||
GLU_TESS_END* = 100102 # void (CALLBACK*)(void)
|
|
||||||
GLU_TESS_ERROR* = 100103 # void (CALLBACK*)(GLenum errno)
|
|
||||||
GLU_TESS_EDGE_FLAG* = 100104 # void (CALLBACK*)(GLboolean boundaryEdge)
|
|
||||||
GLU_TESS_COMBINE* = 100105 # void (CALLBACK*)(GLdouble coords[3],
|
|
||||||
# void *data[4],
|
|
||||||
# GLfloat weight[4],
|
|
||||||
# void **dataOut)
|
|
||||||
GLU_TESS_BEGIN_DATA* = 100106 # void (CALLBACK*)(GLenum type,
|
|
||||||
# void *polygon_data)
|
|
||||||
GLU_TESS_VERTEX_DATA* = 100107 # void (CALLBACK*)(void *data,
|
|
||||||
# void *polygon_data)
|
|
||||||
GLU_TESS_END_DATA* = 100108 # void (CALLBACK*)(void *polygon_data)
|
|
||||||
GLU_TESS_ERROR_DATA* = 100109 # void (CALLBACK*)(GLenum errno,
|
|
||||||
# void *polygon_data)
|
|
||||||
GLU_TESS_EDGE_FLAG_DATA* = 100110 # void (CALLBACK*)(GLboolean boundaryEdge,
|
|
||||||
# void *polygon_data)
|
|
||||||
GLU_TESS_COMBINE_DATA* = 100111 # void (CALLBACK*)(GLdouble coords[3],
|
|
||||||
# void *data[4],
|
|
||||||
# GLfloat weight[4],
|
|
||||||
# void **dataOut,
|
|
||||||
# void *polygon_data)
|
|
||||||
# TessError
|
|
||||||
GLU_TESS_ERROR1* = 100151
|
|
||||||
GLU_TESS_ERROR2* = 100152
|
|
||||||
GLU_TESS_ERROR3* = 100153
|
|
||||||
GLU_TESS_ERROR4* = 100154
|
|
||||||
GLU_TESS_ERROR5* = 100155
|
|
||||||
GLU_TESS_ERROR6* = 100156
|
|
||||||
GLU_TESS_ERROR7* = 100157
|
|
||||||
GLU_TESS_ERROR8* = 100158
|
|
||||||
GLU_TESS_MISSING_BEGIN_POLYGON* = GLU_TESS_ERROR1
|
|
||||||
GLU_TESS_MISSING_BEGIN_CONTOUR* = GLU_TESS_ERROR2
|
|
||||||
GLU_TESS_MISSING_END_POLYGON* = GLU_TESS_ERROR3
|
|
||||||
GLU_TESS_MISSING_END_CONTOUR* = GLU_TESS_ERROR4
|
|
||||||
GLU_TESS_COORD_TOO_LARGE* = GLU_TESS_ERROR5
|
|
||||||
GLU_TESS_NEED_COMBINE_CALLBACK* = GLU_TESS_ERROR6 #*** NURBS constants ****/
|
|
||||||
# NurbsProperty
|
|
||||||
GLU_AUTO_LOAD_MATRIX* = 100200
|
|
||||||
GLU_CULLING* = 100201
|
|
||||||
GLU_SAMPLING_TOLERANCE* = 100203
|
|
||||||
GLU_DISPLAY_MODE* = 100204
|
|
||||||
GLU_PARAMETRIC_TOLERANCE* = 100202
|
|
||||||
GLU_SAMPLING_METHOD* = 100205
|
|
||||||
GLU_U_STEP* = 100206
|
|
||||||
GLU_V_STEP* = 100207 # NurbsSampling
|
|
||||||
GLU_PATH_LENGTH* = 100215
|
|
||||||
GLU_PARAMETRIC_ERROR* = 100216
|
|
||||||
GLU_DOMAIN_DISTANCE* = 100217 # NurbsTrim
|
|
||||||
GLU_MAP1_TRIM_2* = 100210
|
|
||||||
GLU_MAP1_TRIM_3* = 100211 # NurbsDisplay
|
|
||||||
# GLU_FILL = 100012;
|
|
||||||
GLU_OUTLINE_POLYGON* = 100240
|
|
||||||
GLU_OUTLINE_PATCH* = 100241 # NurbsCallback
|
|
||||||
# GLU_ERROR = 100103;
|
|
||||||
# NurbsErrors
|
|
||||||
GLU_NURBS_ERROR1* = 100251
|
|
||||||
GLU_NURBS_ERROR2* = 100252
|
|
||||||
GLU_NURBS_ERROR3* = 100253
|
|
||||||
GLU_NURBS_ERROR4* = 100254
|
|
||||||
GLU_NURBS_ERROR5* = 100255
|
|
||||||
GLU_NURBS_ERROR6* = 100256
|
|
||||||
GLU_NURBS_ERROR7* = 100257
|
|
||||||
GLU_NURBS_ERROR8* = 100258
|
|
||||||
GLU_NURBS_ERROR9* = 100259
|
|
||||||
GLU_NURBS_ERROR10* = 100260
|
|
||||||
GLU_NURBS_ERROR11* = 100261
|
|
||||||
GLU_NURBS_ERROR12* = 100262
|
|
||||||
GLU_NURBS_ERROR13* = 100263
|
|
||||||
GLU_NURBS_ERROR14* = 100264
|
|
||||||
GLU_NURBS_ERROR15* = 100265
|
|
||||||
GLU_NURBS_ERROR16* = 100266
|
|
||||||
GLU_NURBS_ERROR17* = 100267
|
|
||||||
GLU_NURBS_ERROR18* = 100268
|
|
||||||
GLU_NURBS_ERROR19* = 100269
|
|
||||||
GLU_NURBS_ERROR20* = 100270
|
|
||||||
GLU_NURBS_ERROR21* = 100271
|
|
||||||
GLU_NURBS_ERROR22* = 100272
|
|
||||||
GLU_NURBS_ERROR23* = 100273
|
|
||||||
GLU_NURBS_ERROR24* = 100274
|
|
||||||
GLU_NURBS_ERROR25* = 100275
|
|
||||||
GLU_NURBS_ERROR26* = 100276
|
|
||||||
GLU_NURBS_ERROR27* = 100277
|
|
||||||
GLU_NURBS_ERROR28* = 100278
|
|
||||||
GLU_NURBS_ERROR29* = 100279
|
|
||||||
GLU_NURBS_ERROR30* = 100280
|
|
||||||
GLU_NURBS_ERROR31* = 100281
|
|
||||||
GLU_NURBS_ERROR32* = 100282
|
|
||||||
GLU_NURBS_ERROR33* = 100283
|
|
||||||
GLU_NURBS_ERROR34* = 100284
|
|
||||||
GLU_NURBS_ERROR35* = 100285
|
|
||||||
GLU_NURBS_ERROR36* = 100286
|
|
||||||
GLU_NURBS_ERROR37* = 100287 #*** Backwards compatibility for old tesselator ****/
|
|
||||||
|
|
||||||
proc gluBeginPolygon*(tess: GLUtesselator){.dynlib: dllname,
|
|
||||||
importc: "gluBeginPolygon".}
|
|
||||||
proc gluNextContour*(tess: GLUtesselator, atype: GLenum){.dynlib: dllname,
|
|
||||||
importc: "gluNextContour".}
|
|
||||||
proc gluEndPolygon*(tess: GLUtesselator){.dynlib: dllname,
|
|
||||||
importc: "gluEndPolygon".}
|
|
||||||
const # Contours types -- obsolete!
|
|
||||||
GLU_CW* = 100120
|
|
||||||
GLU_CCW* = 100121
|
|
||||||
GLU_INTERIOR* = 100122
|
|
||||||
GLU_EXTERIOR* = 100123
|
|
||||||
GLU_UNKNOWN* = 100124 # Names without "TESS_" prefix
|
|
||||||
GLU_BEGIN* = GLU_TESS_BEGIN
|
|
||||||
GLU_VERTEX* = constGLU_TESS_VERTEX
|
|
||||||
GLU_END* = GLU_TESS_END
|
|
||||||
GLU_ERROR* = GLU_TESS_ERROR
|
|
||||||
GLU_EDGE_FLAG* = GLU_TESS_EDGE_FLAG
|
|
||||||
|
|
||||||
{.pop.}
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,366 +0,0 @@
|
||||||
#
|
|
||||||
#
|
|
||||||
# Adaption of the delphi3d.net OpenGL units to FreePascal
|
|
||||||
# Sebastian Guenther (sg@freepascal.org) in 2002
|
|
||||||
# These units are free to use
|
|
||||||
#
|
|
||||||
|
|
||||||
# Copyright (c) Mark J. Kilgard, 1994, 1995, 1996.
|
|
||||||
# This program is freely distributable without licensing fees and is
|
|
||||||
# provided without guarantee or warrantee expressed or implied. This
|
|
||||||
# program is -not- in the public domain.
|
|
||||||
#******************************************************************************
|
|
||||||
# Converted to Delphi by Tom Nuydens (tom@delphi3d.net)
|
|
||||||
# Contributions by Igor Karpov (glygrik@hotbox.ru)
|
|
||||||
# For the latest updates, visit Delphi3D: http://www.delphi3d.net
|
|
||||||
#******************************************************************************
|
|
||||||
|
|
||||||
import opengl
|
|
||||||
|
|
||||||
{.deadCodeElim: on.}
|
|
||||||
|
|
||||||
when defined(windows):
|
|
||||||
const
|
|
||||||
dllname = "glut32.dll"
|
|
||||||
elif defined(macosx):
|
|
||||||
const
|
|
||||||
dllname = "/System/Library/Frameworks/GLUT.framework/GLUT"
|
|
||||||
else:
|
|
||||||
const
|
|
||||||
dllname = "libglut.so.3"
|
|
||||||
type
|
|
||||||
TGlutVoidCallback* = proc (){.cdecl.}
|
|
||||||
TGlut1IntCallback* = proc (value: cint){.cdecl.}
|
|
||||||
TGlut2IntCallback* = proc (v1, v2: cint){.cdecl.}
|
|
||||||
TGlut3IntCallback* = proc (v1, v2, v3: cint){.cdecl.}
|
|
||||||
TGlut4IntCallback* = proc (v1, v2, v3, v4: cint){.cdecl.}
|
|
||||||
TGlut1Char2IntCallback* = proc (c: int8, v1, v2: cint){.cdecl.}
|
|
||||||
TGlut1UInt3IntCallback* = proc (u, v1, v2, v3: cint){.cdecl.}
|
|
||||||
|
|
||||||
{.deprecated: [Pointer: pointer].}
|
|
||||||
|
|
||||||
const
|
|
||||||
GLUT_API_VERSION* = 3
|
|
||||||
GLUT_XLIB_IMPLEMENTATION* = 12 # Display mode bit masks.
|
|
||||||
GLUT_RGB* = 0
|
|
||||||
GLUT_RGBA* = GLUT_RGB
|
|
||||||
GLUT_INDEX* = 1
|
|
||||||
GLUT_SINGLE* = 0
|
|
||||||
GLUT_DOUBLE* = 2
|
|
||||||
GLUT_ACCUM* = 4
|
|
||||||
GLUT_ALPHA* = 8
|
|
||||||
GLUT_DEPTH* = 16
|
|
||||||
GLUT_STENCIL* = 32
|
|
||||||
GLUT_MULTISAMPLE* = 128
|
|
||||||
GLUT_STEREO* = 256
|
|
||||||
GLUT_LUMINANCE* = 512 # Mouse buttons.
|
|
||||||
GLUT_LEFT_BUTTON* = 0
|
|
||||||
GLUT_MIDDLE_BUTTON* = 1
|
|
||||||
GLUT_RIGHT_BUTTON* = 2 # Mouse button state.
|
|
||||||
GLUT_DOWN* = 0
|
|
||||||
GLUT_UP* = 1 # function keys
|
|
||||||
GLUT_KEY_F1* = 1
|
|
||||||
GLUT_KEY_F2* = 2
|
|
||||||
GLUT_KEY_F3* = 3
|
|
||||||
GLUT_KEY_F4* = 4
|
|
||||||
GLUT_KEY_F5* = 5
|
|
||||||
GLUT_KEY_F6* = 6
|
|
||||||
GLUT_KEY_F7* = 7
|
|
||||||
GLUT_KEY_F8* = 8
|
|
||||||
GLUT_KEY_F9* = 9
|
|
||||||
GLUT_KEY_F10* = 10
|
|
||||||
GLUT_KEY_F11* = 11
|
|
||||||
GLUT_KEY_F12* = 12 # directional keys
|
|
||||||
GLUT_KEY_LEFT* = 100
|
|
||||||
GLUT_KEY_UP* = 101
|
|
||||||
GLUT_KEY_RIGHT* = 102
|
|
||||||
GLUT_KEY_DOWN* = 103
|
|
||||||
GLUT_KEY_PAGE_UP* = 104
|
|
||||||
GLUT_KEY_PAGE_DOWN* = 105
|
|
||||||
GLUT_KEY_HOME* = 106
|
|
||||||
GLUT_KEY_END* = 107
|
|
||||||
GLUT_KEY_INSERT* = 108 # Entry/exit state.
|
|
||||||
GLUT_LEFT* = 0
|
|
||||||
GLUT_ENTERED* = 1 # Menu usage state.
|
|
||||||
GLUT_MENU_NOT_IN_USE* = 0
|
|
||||||
GLUT_MENU_IN_USE* = 1 # Visibility state.
|
|
||||||
GLUT_NOT_VISIBLE* = 0
|
|
||||||
GLUT_VISIBLE* = 1 # Window status state.
|
|
||||||
GLUT_HIDDEN* = 0
|
|
||||||
GLUT_FULLY_RETAINED* = 1
|
|
||||||
GLUT_PARTIALLY_RETAINED* = 2
|
|
||||||
GLUT_FULLY_COVERED* = 3 # Color index component selection values.
|
|
||||||
GLUT_RED* = 0
|
|
||||||
GLUT_GREEN* = 1
|
|
||||||
GLUT_BLUE* = 2 # Layers for use.
|
|
||||||
GLUT_NORMAL* = 0
|
|
||||||
GLUT_OVERLAY* = 1
|
|
||||||
|
|
||||||
when defined(Windows):
|
|
||||||
const # Stroke font constants (use these in GLUT program).
|
|
||||||
GLUT_STROKE_ROMAN* = cast[pointer](0)
|
|
||||||
GLUT_STROKE_MONO_ROMAN* = cast[pointer](1) # Bitmap font constants (use these in GLUT program).
|
|
||||||
GLUT_BITMAP_9_BY_15* = cast[pointer](2)
|
|
||||||
GLUT_BITMAP_8_BY_13* = cast[pointer](3)
|
|
||||||
GLUT_BITMAP_TIMES_ROMAN_10* = cast[pointer](4)
|
|
||||||
GLUT_BITMAP_TIMES_ROMAN_24* = cast[pointer](5)
|
|
||||||
GLUT_BITMAP_HELVETICA_10* = cast[pointer](6)
|
|
||||||
GLUT_BITMAP_HELVETICA_12* = cast[pointer](7)
|
|
||||||
GLUT_BITMAP_HELVETICA_18* = cast[pointer](8)
|
|
||||||
else:
|
|
||||||
var # Stroke font constants (use these in GLUT program).
|
|
||||||
GLUT_STROKE_ROMAN*: pointer
|
|
||||||
GLUT_STROKE_MONO_ROMAN*: pointer # Bitmap font constants (use these in GLUT program).
|
|
||||||
GLUT_BITMAP_9_BY_15*: pointer
|
|
||||||
GLUT_BITMAP_8_BY_13*: pointer
|
|
||||||
GLUT_BITMAP_TIMES_ROMAN_10*: pointer
|
|
||||||
GLUT_BITMAP_TIMES_ROMAN_24*: pointer
|
|
||||||
GLUT_BITMAP_HELVETICA_10*: pointer
|
|
||||||
GLUT_BITMAP_HELVETICA_12*: pointer
|
|
||||||
GLUT_BITMAP_HELVETICA_18*: pointer
|
|
||||||
const # glutGet parameters.
|
|
||||||
GLUT_WINDOW_X* = 100
|
|
||||||
GLUT_WINDOW_Y* = 101
|
|
||||||
GLUT_WINDOW_WIDTH* = 102
|
|
||||||
GLUT_WINDOW_HEIGHT* = 103
|
|
||||||
GLUT_WINDOW_BUFFER_SIZE* = 104
|
|
||||||
GLUT_WINDOW_STENCIL_SIZE* = 105
|
|
||||||
GLUT_WINDOW_DEPTH_SIZE* = 106
|
|
||||||
GLUT_WINDOW_RED_SIZE* = 107
|
|
||||||
GLUT_WINDOW_GREEN_SIZE* = 108
|
|
||||||
GLUT_WINDOW_BLUE_SIZE* = 109
|
|
||||||
GLUT_WINDOW_ALPHA_SIZE* = 110
|
|
||||||
GLUT_WINDOW_ACCUM_RED_SIZE* = 111
|
|
||||||
GLUT_WINDOW_ACCUM_GREEN_SIZE* = 112
|
|
||||||
GLUT_WINDOW_ACCUM_BLUE_SIZE* = 113
|
|
||||||
GLUT_WINDOW_ACCUM_ALPHA_SIZE* = 114
|
|
||||||
GLUT_WINDOW_DOUBLEBUFFER* = 115
|
|
||||||
GLUT_WINDOW_RGBA* = 116
|
|
||||||
GLUT_WINDOW_PARENT* = 117
|
|
||||||
GLUT_WINDOW_NUM_CHILDREN* = 118
|
|
||||||
GLUT_WINDOW_COLORMAP_SIZE* = 119
|
|
||||||
GLUT_WINDOW_NUM_SAMPLES* = 120
|
|
||||||
GLUT_WINDOW_STEREO* = 121
|
|
||||||
GLUT_WINDOW_CURSOR* = 122
|
|
||||||
GLUT_SCREEN_WIDTH* = 200
|
|
||||||
GLUT_SCREEN_HEIGHT* = 201
|
|
||||||
GLUT_SCREEN_WIDTH_MM* = 202
|
|
||||||
GLUT_SCREEN_HEIGHT_MM* = 203
|
|
||||||
GLUT_MENU_NUM_ITEMS* = 300
|
|
||||||
GLUT_DISPLAY_MODE_POSSIBLE* = 400
|
|
||||||
GLUT_INIT_WINDOW_X* = 500
|
|
||||||
GLUT_INIT_WINDOW_Y* = 501
|
|
||||||
GLUT_INIT_WINDOW_WIDTH* = 502
|
|
||||||
GLUT_INIT_WINDOW_HEIGHT* = 503
|
|
||||||
constGLUT_INIT_DISPLAY_MODE* = 504
|
|
||||||
GLUT_ELAPSED_TIME* = 700
|
|
||||||
GLUT_WINDOW_FORMAT_ID* = 123 # glutDeviceGet parameters.
|
|
||||||
GLUT_HAS_KEYBOARD* = 600
|
|
||||||
GLUT_HAS_MOUSE* = 601
|
|
||||||
GLUT_HAS_SPACEBALL* = 602
|
|
||||||
GLUT_HAS_DIAL_AND_BUTTON_BOX* = 603
|
|
||||||
GLUT_HAS_TABLET* = 604
|
|
||||||
GLUT_NUM_MOUSE_BUTTONS* = 605
|
|
||||||
GLUT_NUM_SPACEBALL_BUTTONS* = 606
|
|
||||||
GLUT_NUM_BUTTON_BOX_BUTTONS* = 607
|
|
||||||
GLUT_NUM_DIALS* = 608
|
|
||||||
GLUT_NUM_TABLET_BUTTONS* = 609
|
|
||||||
GLUT_DEVICE_IGNORE_KEY_REPEAT* = 610
|
|
||||||
GLUT_DEVICE_KEY_REPEAT* = 611
|
|
||||||
GLUT_HAS_JOYSTICK* = 612
|
|
||||||
GLUT_OWNS_JOYSTICK* = 613
|
|
||||||
GLUT_JOYSTICK_BUTTONS* = 614
|
|
||||||
GLUT_JOYSTICK_AXES* = 615
|
|
||||||
GLUT_JOYSTICK_POLL_RATE* = 616 # glutLayerGet parameters.
|
|
||||||
GLUT_OVERLAY_POSSIBLE* = 800
|
|
||||||
GLUT_LAYER_IN_USE* = 801
|
|
||||||
GLUT_HAS_OVERLAY* = 802
|
|
||||||
GLUT_TRANSPARENT_INDEX* = 803
|
|
||||||
GLUT_NORMAL_DAMAGED* = 804
|
|
||||||
GLUT_OVERLAY_DAMAGED* = 805 # glutVideoResizeGet parameters.
|
|
||||||
GLUT_VIDEO_RESIZE_POSSIBLE* = 900
|
|
||||||
GLUT_VIDEO_RESIZE_IN_USE* = 901
|
|
||||||
GLUT_VIDEO_RESIZE_X_DELTA* = 902
|
|
||||||
GLUT_VIDEO_RESIZE_Y_DELTA* = 903
|
|
||||||
GLUT_VIDEO_RESIZE_WIDTH_DELTA* = 904
|
|
||||||
GLUT_VIDEO_RESIZE_HEIGHT_DELTA* = 905
|
|
||||||
GLUT_VIDEO_RESIZE_X* = 906
|
|
||||||
GLUT_VIDEO_RESIZE_Y* = 907
|
|
||||||
GLUT_VIDEO_RESIZE_WIDTH* = 908
|
|
||||||
GLUT_VIDEO_RESIZE_HEIGHT* = 909 # glutGetModifiers return mask.
|
|
||||||
GLUT_ACTIVE_SHIFT* = 1
|
|
||||||
GLUT_ACTIVE_CTRL* = 2
|
|
||||||
GLUT_ACTIVE_ALT* = 4 # glutSetCursor parameters.
|
|
||||||
# Basic arrows.
|
|
||||||
GLUT_CURSOR_RIGHT_ARROW* = 0
|
|
||||||
GLUT_CURSOR_LEFT_ARROW* = 1 # Symbolic cursor shapes.
|
|
||||||
GLUT_CURSOR_INFO* = 2
|
|
||||||
GLUT_CURSOR_DESTROY* = 3
|
|
||||||
GLUT_CURSOR_HELP* = 4
|
|
||||||
GLUT_CURSOR_CYCLE* = 5
|
|
||||||
GLUT_CURSOR_SPRAY* = 6
|
|
||||||
GLUT_CURSOR_WAIT* = 7
|
|
||||||
GLUT_CURSOR_TEXT* = 8
|
|
||||||
GLUT_CURSOR_CROSSHAIR* = 9 # Directional cursors.
|
|
||||||
GLUT_CURSOR_UP_DOWN* = 10
|
|
||||||
GLUT_CURSOR_LEFT_RIGHT* = 11 # Sizing cursors.
|
|
||||||
GLUT_CURSOR_TOP_SIDE* = 12
|
|
||||||
GLUT_CURSOR_BOTTOM_SIDE* = 13
|
|
||||||
GLUT_CURSOR_LEFT_SIDE* = 14
|
|
||||||
GLUT_CURSOR_RIGHT_SIDE* = 15
|
|
||||||
GLUT_CURSOR_TOP_LEFT_CORNER* = 16
|
|
||||||
GLUT_CURSOR_TOP_RIGHT_CORNER* = 17
|
|
||||||
GLUT_CURSOR_BOTTOM_RIGHT_CORNER* = 18
|
|
||||||
GLUT_CURSOR_BOTTOM_LEFT_CORNER* = 19 # Inherit from parent window.
|
|
||||||
GLUT_CURSOR_INHERIT* = 100 # Blank cursor.
|
|
||||||
GLUT_CURSOR_NONE* = 101 # Fullscreen crosshair (if available).
|
|
||||||
GLUT_CURSOR_FULL_CROSSHAIR* = 102 # GLUT device control sub-API.
|
|
||||||
# glutSetKeyRepeat modes.
|
|
||||||
GLUT_KEY_REPEAT_OFF* = 0
|
|
||||||
GLUT_KEY_REPEAT_ON* = 1
|
|
||||||
GLUT_KEY_REPEAT_DEFAULT* = 2 # Joystick button masks.
|
|
||||||
GLUT_JOYSTICK_BUTTON_A* = 1
|
|
||||||
GLUT_JOYSTICK_BUTTON_B* = 2
|
|
||||||
GLUT_JOYSTICK_BUTTON_C* = 4
|
|
||||||
GLUT_JOYSTICK_BUTTON_D* = 8 # GLUT game mode sub-API.
|
|
||||||
# glutGameModeGet.
|
|
||||||
GLUT_GAME_MODE_ACTIVE* = 0
|
|
||||||
GLUT_GAME_MODE_POSSIBLE* = 1
|
|
||||||
GLUT_GAME_MODE_WIDTH* = 2
|
|
||||||
GLUT_GAME_MODE_HEIGHT* = 3
|
|
||||||
GLUT_GAME_MODE_PIXEL_DEPTH* = 4
|
|
||||||
GLUT_GAME_MODE_REFRESH_RATE* = 5
|
|
||||||
GLUT_GAME_MODE_DISPLAY_CHANGED* = 6 # GLUT initialization sub-API.
|
|
||||||
|
|
||||||
{.push dynlib: dllname, importc.}
|
|
||||||
proc glutInit*(argcp: ptr cint, argv: pointer)
|
|
||||||
|
|
||||||
proc glutInit*() =
|
|
||||||
## version that passes `argc` and `argc` implicitely.
|
|
||||||
var
|
|
||||||
cmdLine {.importc: "cmdLine".}: array[0..255, cstring]
|
|
||||||
cmdCount {.importc: "cmdCount".}: cint
|
|
||||||
glutInit(addr(cmdCount), addr(cmdLine))
|
|
||||||
|
|
||||||
proc glutInitDisplayMode*(mode: int16)
|
|
||||||
proc glutInitDisplayString*(str: cstring)
|
|
||||||
proc glutInitWindowPosition*(x, y: int)
|
|
||||||
proc glutInitWindowSize*(width, height: int)
|
|
||||||
proc glutMainLoop*()
|
|
||||||
# GLUT window sub-API.
|
|
||||||
proc glutCreateWindow*(title: cstring): int
|
|
||||||
proc glutCreateSubWindow*(win, x, y, width, height: int): int
|
|
||||||
proc glutDestroyWindow*(win: int)
|
|
||||||
proc glutPostRedisplay*()
|
|
||||||
proc glutPostWindowRedisplay*(win: int)
|
|
||||||
proc glutSwapBuffers*()
|
|
||||||
proc glutSetWindow*(win: int)
|
|
||||||
proc glutSetWindowTitle*(title: cstring)
|
|
||||||
proc glutSetIconTitle*(title: cstring)
|
|
||||||
proc glutPositionWindow*(x, y: int)
|
|
||||||
proc glutReshapeWindow*(width, height: int)
|
|
||||||
proc glutPopWindow*()
|
|
||||||
proc glutPushWindow*()
|
|
||||||
proc glutIconifyWindow*()
|
|
||||||
proc glutShowWindow*()
|
|
||||||
proc glutHideWindow*()
|
|
||||||
proc glutFullScreen*()
|
|
||||||
proc glutSetCursor*(cursor: int)
|
|
||||||
proc glutWarpPointer*(x, y: int)
|
|
||||||
# GLUT overlay sub-API.
|
|
||||||
proc glutEstablishOverlay*()
|
|
||||||
proc glutRemoveOverlay*()
|
|
||||||
proc glutUseLayer*(layer: GLenum)
|
|
||||||
proc glutPostOverlayRedisplay*()
|
|
||||||
proc glutPostWindowOverlayRedisplay*(win: int)
|
|
||||||
proc glutShowOverlay*()
|
|
||||||
proc glutHideOverlay*()
|
|
||||||
# GLUT menu sub-API.
|
|
||||||
proc glutCreateMenu*(callback: TGlut1IntCallback): int
|
|
||||||
proc glutDestroyMenu*(menu: int)
|
|
||||||
proc glutSetMenu*(menu: int)
|
|
||||||
proc glutAddMenuEntry*(caption: cstring, value: int)
|
|
||||||
proc glutAddSubMenu*(caption: cstring, submenu: int)
|
|
||||||
proc glutChangeToMenuEntry*(item: int, caption: cstring, value: int)
|
|
||||||
proc glutChangeToSubMenu*(item: int, caption: cstring, submenu: int)
|
|
||||||
proc glutRemoveMenuItem*(item: int)
|
|
||||||
proc glutAttachMenu*(button: int)
|
|
||||||
proc glutDetachMenu*(button: int)
|
|
||||||
# GLUT window callback sub-API.
|
|
||||||
proc glutDisplayFunc*(f: TGlutVoidCallback)
|
|
||||||
proc glutReshapeFunc*(f: TGlut2IntCallback)
|
|
||||||
proc glutKeyboardFunc*(f: TGlut1Char2IntCallback)
|
|
||||||
proc glutMouseFunc*(f: TGlut4IntCallback)
|
|
||||||
proc glutMotionFunc*(f: TGlut2IntCallback)
|
|
||||||
proc glutPassiveMotionFunc*(f: TGlut2IntCallback)
|
|
||||||
proc glutEntryFunc*(f: TGlut1IntCallback)
|
|
||||||
proc glutVisibilityFunc*(f: TGlut1IntCallback)
|
|
||||||
proc glutIdleFunc*(f: TGlutVoidCallback)
|
|
||||||
proc glutTimerFunc*(millis: int16, f: TGlut1IntCallback, value: int)
|
|
||||||
proc glutMenuStateFunc*(f: TGlut1IntCallback)
|
|
||||||
proc glutSpecialFunc*(f: TGlut3IntCallback)
|
|
||||||
proc glutSpaceballMotionFunc*(f: TGlut3IntCallback)
|
|
||||||
proc glutSpaceballRotateFunc*(f: TGlut3IntCallback)
|
|
||||||
proc glutSpaceballButtonFunc*(f: TGlut2IntCallback)
|
|
||||||
proc glutButtonBoxFunc*(f: TGlut2IntCallback)
|
|
||||||
proc glutDialsFunc*(f: TGlut2IntCallback)
|
|
||||||
proc glutTabletMotionFunc*(f: TGlut2IntCallback)
|
|
||||||
proc glutTabletButtonFunc*(f: TGlut4IntCallback)
|
|
||||||
proc glutMenuStatusFunc*(f: TGlut3IntCallback)
|
|
||||||
proc glutOverlayDisplayFunc*(f: TGlutVoidCallback)
|
|
||||||
proc glutWindowStatusFunc*(f: TGlut1IntCallback)
|
|
||||||
proc glutKeyboardUpFunc*(f: TGlut1Char2IntCallback)
|
|
||||||
proc glutSpecialUpFunc*(f: TGlut3IntCallback)
|
|
||||||
proc glutJoystickFunc*(f: TGlut1UInt3IntCallback, pollInterval: int)
|
|
||||||
# GLUT color index sub-API.
|
|
||||||
proc glutSetColor*(cell: int, red, green, blue: GLfloat)
|
|
||||||
proc glutGetColor*(ndx, component: int): GLfloat
|
|
||||||
proc glutCopyColormap*(win: int)
|
|
||||||
# GLUT state retrieval sub-API.
|
|
||||||
# GLUT extension support sub-API
|
|
||||||
proc glutExtensionSupported*(name: cstring): int
|
|
||||||
# GLUT font sub-API
|
|
||||||
proc glutBitmapCharacter*(font: pointer, character: int)
|
|
||||||
proc glutBitmapWidth*(font: pointer, character: int): int
|
|
||||||
proc glutStrokeCharacter*(font: pointer, character: int)
|
|
||||||
proc glutStrokeWidth*(font: pointer, character: int): int
|
|
||||||
proc glutBitmapLength*(font: pointer, str: cstring): int
|
|
||||||
proc glutStrokeLength*(font: pointer, str: cstring): int
|
|
||||||
# GLUT pre-built models sub-API
|
|
||||||
proc glutWireSphere*(radius: GLdouble, slices, stacks: GLint)
|
|
||||||
proc glutSolidSphere*(radius: GLdouble, slices, stacks: GLint)
|
|
||||||
proc glutWireCone*(base, height: GLdouble, slices, stacks: GLint)
|
|
||||||
proc glutSolidCone*(base, height: GLdouble, slices, stacks: GLint)
|
|
||||||
proc glutWireCube*(size: GLdouble)
|
|
||||||
proc glutSolidCube*(size: GLdouble)
|
|
||||||
proc glutWireTorus*(innerRadius, outerRadius: GLdouble, sides, rings: GLint)
|
|
||||||
proc glutSolidTorus*(innerRadius, outerRadius: GLdouble, sides, rings: GLint)
|
|
||||||
proc glutWireDodecahedron*()
|
|
||||||
proc glutSolidDodecahedron*()
|
|
||||||
proc glutWireTeapot*(size: GLdouble)
|
|
||||||
proc glutSolidTeapot*(size: GLdouble)
|
|
||||||
proc glutWireOctahedron*()
|
|
||||||
proc glutSolidOctahedron*()
|
|
||||||
proc glutWireTetrahedron*()
|
|
||||||
proc glutSolidTetrahedron*()
|
|
||||||
proc glutWireIcosahedron*()
|
|
||||||
proc glutSolidIcosahedron*()
|
|
||||||
# GLUT video resize sub-API.
|
|
||||||
proc glutVideoResizeGet*(param: GLenum): int
|
|
||||||
proc glutSetupVideoResizing*()
|
|
||||||
proc glutStopVideoResizing*()
|
|
||||||
proc glutVideoResize*(x, y, width, height: int)
|
|
||||||
proc glutVideoPan*(x, y, width, height: int)
|
|
||||||
# GLUT debugging sub-API.
|
|
||||||
proc glutReportErrors*()
|
|
||||||
# GLUT device control sub-API.
|
|
||||||
proc glutIgnoreKeyRepeat*(ignore: int)
|
|
||||||
proc glutSetKeyRepeat*(repeatMode: int)
|
|
||||||
proc glutForceJoystickFunc*()
|
|
||||||
# GLUT game mode sub-API.
|
|
||||||
#example glutGameModeString('1280x1024:32@75');
|
|
||||||
proc glutGameModeString*(AString: cstring)
|
|
||||||
proc glutLeaveGameMode*()
|
|
||||||
proc glutGameModeGet*(mode: GLenum): int
|
|
||||||
# implementation
|
|
||||||
{.pop.} # dynlib: dllname, importc
|
|
||||||
|
|
@ -1,154 +0,0 @@
|
||||||
#
|
|
||||||
#
|
|
||||||
# Translation of the Mesa GLX headers for FreePascal
|
|
||||||
# Copyright (C) 1999 Sebastian Guenther
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Mesa 3-D graphics library
|
|
||||||
# Version: 3.0
|
|
||||||
# Copyright (C) 1995-1998 Brian Paul
|
|
||||||
#
|
|
||||||
# This library is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU Library General Public
|
|
||||||
# License as published by the Free Software Foundation; either
|
|
||||||
# version 2 of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# Library General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Library General Public
|
|
||||||
# License along with this library; if not, write to the Free
|
|
||||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
#
|
|
||||||
|
|
||||||
import X, XLib, XUtil, opengl
|
|
||||||
|
|
||||||
{.deadCodeElim: on.}
|
|
||||||
|
|
||||||
when defined(windows):
|
|
||||||
const
|
|
||||||
dllname = "GL.dll"
|
|
||||||
elif defined(macosx):
|
|
||||||
const
|
|
||||||
dllname = "/usr/X11R6/lib/libGL.dylib"
|
|
||||||
else:
|
|
||||||
const
|
|
||||||
dllname = "libGL.so"
|
|
||||||
const
|
|
||||||
GLX_USE_GL* = 1'i32
|
|
||||||
GLX_BUFFER_SIZE* = 2'i32
|
|
||||||
GLX_LEVEL* = 3'i32
|
|
||||||
GLX_RGBA* = 4'i32
|
|
||||||
GLX_DOUBLEBUFFER* = 5'i32
|
|
||||||
GLX_STEREO* = 6'i32
|
|
||||||
GLX_AUX_BUFFERS* = 7'i32
|
|
||||||
GLX_RED_SIZE* = 8'i32
|
|
||||||
GLX_GREEN_SIZE* = 9'i32
|
|
||||||
GLX_BLUE_SIZE* = 10'i32
|
|
||||||
GLX_ALPHA_SIZE* = 11'i32
|
|
||||||
GLX_DEPTH_SIZE* = 12'i32
|
|
||||||
GLX_STENCIL_SIZE* = 13'i32
|
|
||||||
GLX_ACCUM_RED_SIZE* = 14'i32
|
|
||||||
GLX_ACCUM_GREEN_SIZE* = 15'i32
|
|
||||||
GLX_ACCUM_BLUE_SIZE* = 16'i32
|
|
||||||
GLX_ACCUM_ALPHA_SIZE* = 17'i32 # GLX_EXT_visual_info extension
|
|
||||||
GLX_X_VISUAL_TYPE_EXT* = 0x00000022
|
|
||||||
GLX_TRANSPARENT_TYPE_EXT* = 0x00000023
|
|
||||||
GLX_TRANSPARENT_INDEX_VALUE_EXT* = 0x00000024
|
|
||||||
GLX_TRANSPARENT_RED_VALUE_EXT* = 0x00000025
|
|
||||||
GLX_TRANSPARENT_GREEN_VALUE_EXT* = 0x00000026
|
|
||||||
GLX_TRANSPARENT_BLUE_VALUE_EXT* = 0x00000027
|
|
||||||
GLX_TRANSPARENT_ALPHA_VALUE_EXT* = 0x00000028 # Error codes returned by glXGetConfig:
|
|
||||||
GLX_BAD_SCREEN* = 1
|
|
||||||
GLX_BAD_ATTRIBUTE* = 2
|
|
||||||
GLX_NO_EXTENSION* = 3
|
|
||||||
GLX_BAD_VISUAL* = 4
|
|
||||||
GLX_BAD_CONTEXT* = 5
|
|
||||||
GLX_BAD_VALUE* = 6
|
|
||||||
GLX_BAD_ENUM* = 7 # GLX 1.1 and later:
|
|
||||||
GLX_VENDOR* = 1
|
|
||||||
GLX_VERSION* = 2
|
|
||||||
GLX_EXTENSIONS* = 3 # GLX_visual_info extension
|
|
||||||
GLX_TRUE_COLOR_EXT* = 0x00008002
|
|
||||||
GLX_DIRECT_COLOR_EXT* = 0x00008003
|
|
||||||
GLX_PSEUDO_COLOR_EXT* = 0x00008004
|
|
||||||
GLX_STATIC_COLOR_EXT* = 0x00008005
|
|
||||||
GLX_GRAY_SCALE_EXT* = 0x00008006
|
|
||||||
GLX_STATIC_GRAY_EXT* = 0x00008007
|
|
||||||
GLX_NONE_EXT* = 0x00008000
|
|
||||||
GLX_TRANSPARENT_RGB_EXT* = 0x00008008
|
|
||||||
GLX_TRANSPARENT_INDEX_EXT* = 0x00008009
|
|
||||||
|
|
||||||
type # From XLib:
|
|
||||||
XPixmap* = TXID
|
|
||||||
XFont* = TXID
|
|
||||||
XColormap* = TXID
|
|
||||||
GLXContext* = pointer
|
|
||||||
GLXPixmap* = TXID
|
|
||||||
GLXDrawable* = TXID
|
|
||||||
GLXContextID* = TXID
|
|
||||||
TXPixmap* = XPixmap
|
|
||||||
TXFont* = XFont
|
|
||||||
TXColormap* = XColormap
|
|
||||||
TGLXContext* = GLXContext
|
|
||||||
TGLXPixmap* = GLXPixmap
|
|
||||||
TGLXDrawable* = GLXDrawable
|
|
||||||
TGLXContextID* = GLXContextID
|
|
||||||
|
|
||||||
proc glXChooseVisual*(dpy: PDisplay, screen: int, attribList: ptr int32): PXVisualInfo{.
|
|
||||||
cdecl, dynlib: dllname, importc: "glXChooseVisual".}
|
|
||||||
proc glXCreateContext*(dpy: PDisplay, vis: PXVisualInfo, shareList: GLXContext,
|
|
||||||
direct: bool): GLXContext{.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXCreateContext".}
|
|
||||||
proc glXDestroyContext*(dpy: PDisplay, ctx: GLXContext){.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXDestroyContext".}
|
|
||||||
proc glXMakeCurrent*(dpy: PDisplay, drawable: GLXDrawable, ctx: GLXContext): bool{.
|
|
||||||
cdecl, dynlib: dllname, importc: "glXMakeCurrent".}
|
|
||||||
proc glXCopyContext*(dpy: PDisplay, src, dst: GLXContext, mask: int32){.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXCopyContext".}
|
|
||||||
proc glXSwapBuffers*(dpy: PDisplay, drawable: GLXDrawable){.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXSwapBuffers".}
|
|
||||||
proc glXCreateGLXPixmap*(dpy: PDisplay, visual: PXVisualInfo, pixmap: XPixmap): GLXPixmap{.
|
|
||||||
cdecl, dynlib: dllname, importc: "glXCreateGLXPixmap".}
|
|
||||||
proc glXDestroyGLXPixmap*(dpy: PDisplay, pixmap: GLXPixmap){.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXDestroyGLXPixmap".}
|
|
||||||
proc glXQueryExtension*(dpy: PDisplay, errorb, event: var int): bool{.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXQueryExtension".}
|
|
||||||
proc glXQueryVersion*(dpy: PDisplay, maj, min: var int): bool{.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXQueryVersion".}
|
|
||||||
proc glXIsDirect*(dpy: PDisplay, ctx: GLXContext): bool{.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXIsDirect".}
|
|
||||||
proc glXGetConfig*(dpy: PDisplay, visual: PXVisualInfo, attrib: int,
|
|
||||||
value: var int): int{.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXGetConfig".}
|
|
||||||
proc glXGetCurrentContext*(): GLXContext{.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXGetCurrentContext".}
|
|
||||||
proc glXGetCurrentDrawable*(): GLXDrawable{.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXGetCurrentDrawable".}
|
|
||||||
proc glXWaitGL*(){.cdecl, dynlib: dllname, importc: "glXWaitGL".}
|
|
||||||
proc glXWaitX*(){.cdecl, dynlib: dllname, importc: "glXWaitX".}
|
|
||||||
proc glXUseXFont*(font: XFont, first, count, list: int){.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXUseXFont".}
|
|
||||||
# GLX 1.1 and later
|
|
||||||
proc glXQueryExtensionsString*(dpy: PDisplay, screen: int): cstring{.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXQueryExtensionsString".}
|
|
||||||
proc glXQueryServerString*(dpy: PDisplay, screen, name: int): cstring{.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXQueryServerString".}
|
|
||||||
proc glXGetClientString*(dpy: PDisplay, name: int): cstring{.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXGetClientString".}
|
|
||||||
# Mesa GLX Extensions
|
|
||||||
proc glXCreateGLXPixmapMESA*(dpy: PDisplay, visual: PXVisualInfo,
|
|
||||||
pixmap: XPixmap, cmap: XColormap): GLXPixmap{.
|
|
||||||
cdecl, dynlib: dllname, importc: "glXCreateGLXPixmapMESA".}
|
|
||||||
proc glXReleaseBufferMESA*(dpy: PDisplay, d: GLXDrawable): bool{.cdecl,
|
|
||||||
dynlib: dllname, importc: "glXReleaseBufferMESA".}
|
|
||||||
proc glXCopySubBufferMESA*(dpy: PDisplay, drawbale: GLXDrawable,
|
|
||||||
x, y, width, height: int){.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXCopySubBufferMESA".}
|
|
||||||
proc glXGetVideoSyncSGI*(counter: var int32): int{.cdecl, dynlib: dllname,
|
|
||||||
importc: "glXGetVideoSyncSGI".}
|
|
||||||
proc glXWaitVideoSyncSGI*(divisor, remainder: int, count: var int32): int{.
|
|
||||||
cdecl, dynlib: dllname, importc: "glXWaitVideoSyncSGI".}
|
|
||||||
# implementation
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +0,0 @@
|
||||||
# Package
|
|
||||||
|
|
||||||
version = "1.1.0"
|
|
||||||
author = "Andreas Rumpf"
|
|
||||||
description = "an OpenGL wrapper"
|
|
||||||
license = "MIT"
|
|
||||||
|
|
||||||
srcDir = "src"
|
|
||||||
|
|
||||||
# Dependencies"
|
|
||||||
|
|
||||||
requires "nim >= 0.10.3", "x11"
|
|
||||||
|
|
@ -1,369 +0,0 @@
|
||||||
import opengl, windows
|
|
||||||
|
|
||||||
{.deadCodeElim: on.}
|
|
||||||
|
|
||||||
proc wglGetExtensionsStringARB*(hdc: HDC): cstring{.dynlib: dllname,
|
|
||||||
importc: "wglGetExtensionsStringARB".}
|
|
||||||
const
|
|
||||||
WGL_FRONT_COLOR_BUFFER_BIT_ARB* = 0x00000001
|
|
||||||
WGL_BACK_COLOR_BUFFER_BIT_ARB* = 0x00000002
|
|
||||||
WGL_DEPTH_BUFFER_BIT_ARB* = 0x00000004
|
|
||||||
WGL_STENCIL_BUFFER_BIT_ARB* = 0x00000008
|
|
||||||
|
|
||||||
proc WinChoosePixelFormat*(DC: HDC, p2: PPixelFormatDescriptor): int{.
|
|
||||||
dynlib: "gdi32", importc: "ChoosePixelFormat".}
|
|
||||||
proc wglCreateBufferRegionARB*(hDC: HDC, iLayerPlane: TGLint, uType: TGLuint): THandle{.
|
|
||||||
dynlib: dllname, importc: "wglCreateBufferRegionARB".}
|
|
||||||
proc wglDeleteBufferRegionARB*(hRegion: THandle){.dynlib: dllname,
|
|
||||||
importc: "wglDeleteBufferRegionARB".}
|
|
||||||
proc wglSaveBufferRegionARB*(hRegion: THandle, x: TGLint, y: TGLint,
|
|
||||||
width: TGLint, height: TGLint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglSaveBufferRegionARB".}
|
|
||||||
proc wglRestoreBufferRegionARB*(hRegion: THandle, x: TGLint, y: TGLint,
|
|
||||||
width: TGLint, height: TGLint, xSrc: TGLint,
|
|
||||||
ySrc: TGLint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglRestoreBufferRegionARB".}
|
|
||||||
proc wglAllocateMemoryNV*(size: TGLsizei, readFrequency: TGLfloat,
|
|
||||||
writeFrequency: TGLfloat, priority: TGLfloat): PGLvoid{.
|
|
||||||
dynlib: dllname, importc: "wglAllocateMemoryNV".}
|
|
||||||
proc wglFreeMemoryNV*(pointer: PGLvoid){.dynlib: dllname,
|
|
||||||
importc: "wglFreeMemoryNV".}
|
|
||||||
const
|
|
||||||
WGL_IMAGE_BUFFER_MIN_ACCESS_I3D* = 0x00000001
|
|
||||||
WGL_IMAGE_BUFFER_LOCK_I3D* = 0x00000002
|
|
||||||
|
|
||||||
proc wglCreateImageBufferI3D*(hDC: HDC, dwSize: DWORD, uFlags: UINT): PGLvoid{.
|
|
||||||
dynlib: dllname, importc: "wglCreateImageBufferI3D".}
|
|
||||||
proc wglDestroyImageBufferI3D*(hDC: HDC, pAddress: PGLvoid): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglDestroyImageBufferI3D".}
|
|
||||||
proc wglAssociateImageBufferEventsI3D*(hdc: HDC, pEvent: PHandle,
|
|
||||||
pAddress: PGLvoid, pSize: PDWORD,
|
|
||||||
count: UINT): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglAssociateImageBufferEventsI3D".}
|
|
||||||
proc wglReleaseImageBufferEventsI3D*(hdc: HDC, pAddress: PGLvoid, count: UINT): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglReleaseImageBufferEventsI3D".}
|
|
||||||
proc wglEnableFrameLockI3D*(): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglEnableFrameLockI3D".}
|
|
||||||
proc wglDisableFrameLockI3D*(): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglDisableFrameLockI3D".}
|
|
||||||
proc wglIsEnabledFrameLockI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglIsEnabledFrameLockI3D".}
|
|
||||||
proc wglQueryFrameLockMasterI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglQueryFrameLockMasterI3D".}
|
|
||||||
proc wglGetFrameUsageI3D*(pUsage: PGLfloat): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglGetFrameUsageI3D".}
|
|
||||||
proc wglBeginFrameTrackingI3D*(): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglBeginFrameTrackingI3D".}
|
|
||||||
proc wglEndFrameTrackingI3D*(): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglEndFrameTrackingI3D".}
|
|
||||||
proc wglQueryFrameTrackingI3D*(pFrameCount: PDWORD, pMissedFrames: PDWORD,
|
|
||||||
pLastMissedUsage: PGLfloat): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglQueryFrameTrackingI3D".}
|
|
||||||
const
|
|
||||||
WGL_NUMBER_PIXEL_FORMATS_ARB* = 0x00002000
|
|
||||||
WGL_DRAW_TO_WINDOW_ARB* = 0x00002001
|
|
||||||
WGL_DRAW_TO_BITMAP_ARB* = 0x00002002
|
|
||||||
WGL_ACCELERATION_ARB* = 0x00002003
|
|
||||||
WGL_NEED_PALETTE_ARB* = 0x00002004
|
|
||||||
WGL_NEED_SYSTEM_PALETTE_ARB* = 0x00002005
|
|
||||||
WGL_SWAP_LAYER_BUFFERS_ARB* = 0x00002006
|
|
||||||
WGL_SWAP_METHOD_ARB* = 0x00002007
|
|
||||||
WGL_NUMBER_OVERLAYS_ARB* = 0x00002008
|
|
||||||
WGL_NUMBER_UNDERLAYS_ARB* = 0x00002009
|
|
||||||
WGL_TRANSPARENT_ARB* = 0x0000200A
|
|
||||||
WGL_TRANSPARENT_RED_VALUE_ARB* = 0x00002037
|
|
||||||
WGL_TRANSPARENT_GREEN_VALUE_ARB* = 0x00002038
|
|
||||||
WGL_TRANSPARENT_BLUE_VALUE_ARB* = 0x00002039
|
|
||||||
WGL_TRANSPARENT_ALPHA_VALUE_ARB* = 0x0000203A
|
|
||||||
WGL_TRANSPARENT_INDEX_VALUE_ARB* = 0x0000203B
|
|
||||||
WGL_SHARE_DEPTH_ARB* = 0x0000200C
|
|
||||||
WGL_SHARE_STENCIL_ARB* = 0x0000200D
|
|
||||||
WGL_SHARE_ACCUM_ARB* = 0x0000200E
|
|
||||||
WGL_SUPPORT_GDI_ARB* = 0x0000200F
|
|
||||||
WGL_SUPPORT_OPENGL_ARB* = 0x00002010
|
|
||||||
WGL_DOUBLE_BUFFER_ARB* = 0x00002011
|
|
||||||
WGL_STEREO_ARB* = 0x00002012
|
|
||||||
WGL_PIXEL_TYPE_ARB* = 0x00002013
|
|
||||||
WGL_COLOR_BITS_ARB* = 0x00002014
|
|
||||||
WGL_RED_BITS_ARB* = 0x00002015
|
|
||||||
WGL_RED_SHIFT_ARB* = 0x00002016
|
|
||||||
WGL_GREEN_BITS_ARB* = 0x00002017
|
|
||||||
WGL_GREEN_SHIFT_ARB* = 0x00002018
|
|
||||||
WGL_BLUE_BITS_ARB* = 0x00002019
|
|
||||||
WGL_BLUE_SHIFT_ARB* = 0x0000201A
|
|
||||||
WGL_ALPHA_BITS_ARB* = 0x0000201B
|
|
||||||
WGL_ALPHA_SHIFT_ARB* = 0x0000201C
|
|
||||||
WGL_ACCUM_BITS_ARB* = 0x0000201D
|
|
||||||
WGL_ACCUM_RED_BITS_ARB* = 0x0000201E
|
|
||||||
WGL_ACCUM_GREEN_BITS_ARB* = 0x0000201F
|
|
||||||
WGL_ACCUM_BLUE_BITS_ARB* = 0x00002020
|
|
||||||
WGL_ACCUM_ALPHA_BITS_ARB* = 0x00002021
|
|
||||||
WGL_DEPTH_BITS_ARB* = 0x00002022
|
|
||||||
WGL_STENCIL_BITS_ARB* = 0x00002023
|
|
||||||
WGL_AUX_BUFFERS_ARB* = 0x00002024
|
|
||||||
WGL_NO_ACCELERATION_ARB* = 0x00002025
|
|
||||||
WGL_GENERIC_ACCELERATION_ARB* = 0x00002026
|
|
||||||
WGL_FULL_ACCELERATION_ARB* = 0x00002027
|
|
||||||
WGL_SWAP_EXCHANGE_ARB* = 0x00002028
|
|
||||||
WGL_SWAP_COPY_ARB* = 0x00002029
|
|
||||||
WGL_SWAP_UNDEFINED_ARB* = 0x0000202A
|
|
||||||
WGL_TYPE_RGBA_ARB* = 0x0000202B
|
|
||||||
WGL_TYPE_COLORINDEX_ARB* = 0x0000202C
|
|
||||||
|
|
||||||
proc wglGetPixelFormatAttribivARB*(hdc: HDC, iPixelFormat: TGLint,
|
|
||||||
iLayerPlane: TGLint, nAttributes: TGLuint,
|
|
||||||
piAttributes: PGLint, piValues: PGLint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGetPixelFormatAttribivARB".}
|
|
||||||
proc wglGetPixelFormatAttribfvARB*(hdc: HDC, iPixelFormat: TGLint,
|
|
||||||
iLayerPlane: TGLint, nAttributes: TGLuint,
|
|
||||||
piAttributes: PGLint, pfValues: PGLfloat): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGetPixelFormatAttribfvARB".}
|
|
||||||
proc wglChoosePixelFormatARB*(hdc: HDC, piAttribIList: PGLint,
|
|
||||||
pfAttribFList: PGLfloat, nMaxFormats: TGLuint,
|
|
||||||
piFormats: PGLint, nNumFormats: PGLuint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglChoosePixelFormatARB".}
|
|
||||||
const
|
|
||||||
WGL_ERROR_INVALID_PIXEL_TYPE_ARB* = 0x00002043
|
|
||||||
WGL_ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB* = 0x00002054
|
|
||||||
|
|
||||||
proc wglMakeContextCurrentARB*(hDrawDC: HDC, hReadDC: HDC, hglrc: HGLRC): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglMakeContextCurrentARB".}
|
|
||||||
proc wglGetCurrentReadDCARB*(): HDC{.dynlib: dllname,
|
|
||||||
importc: "wglGetCurrentReadDCARB".}
|
|
||||||
const
|
|
||||||
WGL_DRAW_TO_PBUFFER_ARB* = 0x0000202D # WGL_DRAW_TO_PBUFFER_ARB { already defined }
|
|
||||||
WGL_MAX_PBUFFER_PIXELS_ARB* = 0x0000202E
|
|
||||||
WGL_MAX_PBUFFER_WIDTH_ARB* = 0x0000202F
|
|
||||||
WGL_MAX_PBUFFER_HEIGHT_ARB* = 0x00002030
|
|
||||||
WGL_PBUFFER_LARGEST_ARB* = 0x00002033
|
|
||||||
WGL_PBUFFER_WIDTH_ARB* = 0x00002034
|
|
||||||
WGL_PBUFFER_HEIGHT_ARB* = 0x00002035
|
|
||||||
WGL_PBUFFER_LOST_ARB* = 0x00002036
|
|
||||||
|
|
||||||
proc wglCreatePbufferARB*(hDC: HDC, iPixelFormat: TGLint, iWidth: TGLint,
|
|
||||||
iHeight: TGLint, piAttribList: PGLint): THandle{.
|
|
||||||
dynlib: dllname, importc: "wglCreatePbufferARB".}
|
|
||||||
proc wglGetPbufferDCARB*(hPbuffer: THandle): HDC{.dynlib: dllname,
|
|
||||||
importc: "wglGetPbufferDCARB".}
|
|
||||||
proc wglReleasePbufferDCARB*(hPbuffer: THandle, hDC: HDC): TGLint{.
|
|
||||||
dynlib: dllname, importc: "wglReleasePbufferDCARB".}
|
|
||||||
proc wglDestroyPbufferARB*(hPbuffer: THandle): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglDestroyPbufferARB".}
|
|
||||||
proc wglQueryPbufferARB*(hPbuffer: THandle, iAttribute: TGLint, piValue: PGLint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglQueryPbufferARB".}
|
|
||||||
proc wglSwapIntervalEXT*(interval: TGLint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglSwapIntervalEXT".}
|
|
||||||
proc wglGetSwapIntervalEXT*(): TGLint{.dynlib: dllname,
|
|
||||||
importc: "wglGetSwapIntervalEXT".}
|
|
||||||
const
|
|
||||||
WGL_BIND_TO_TEXTURE_RGB_ARB* = 0x00002070
|
|
||||||
WGL_BIND_TO_TEXTURE_RGBA_ARB* = 0x00002071
|
|
||||||
WGL_TEXTURE_FORMAT_ARB* = 0x00002072
|
|
||||||
WGL_TEXTURE_TARGET_ARB* = 0x00002073
|
|
||||||
WGL_MIPMAP_TEXTURE_ARB* = 0x00002074
|
|
||||||
WGL_TEXTURE_RGB_ARB* = 0x00002075
|
|
||||||
WGL_TEXTURE_RGBA_ARB* = 0x00002076
|
|
||||||
WGL_NO_TEXTURE_ARB* = 0x00002077
|
|
||||||
WGL_TEXTURE_CUBE_MAP_ARB* = 0x00002078
|
|
||||||
WGL_TEXTURE_1D_ARB* = 0x00002079
|
|
||||||
WGL_TEXTURE_2D_ARB* = 0x0000207A # WGL_NO_TEXTURE_ARB { already defined }
|
|
||||||
WGL_MIPMAP_LEVEL_ARB* = 0x0000207B
|
|
||||||
WGL_CUBE_MAP_FACE_ARB* = 0x0000207C
|
|
||||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB* = 0x0000207D
|
|
||||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB* = 0x0000207E
|
|
||||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB* = 0x0000207F
|
|
||||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB* = 0x00002080
|
|
||||||
WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB* = 0x00002081
|
|
||||||
WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB* = 0x00002082
|
|
||||||
WGL_FRONT_LEFT_ARB* = 0x00002083
|
|
||||||
WGL_FRONT_RIGHT_ARB* = 0x00002084
|
|
||||||
WGL_BACK_LEFT_ARB* = 0x00002085
|
|
||||||
WGL_BACK_RIGHT_ARB* = 0x00002086
|
|
||||||
WGL_AUX0_ARB* = 0x00002087
|
|
||||||
WGL_AUX1_ARB* = 0x00002088
|
|
||||||
WGL_AUX2_ARB* = 0x00002089
|
|
||||||
WGL_AUX3_ARB* = 0x0000208A
|
|
||||||
WGL_AUX4_ARB* = 0x0000208B
|
|
||||||
WGL_AUX5_ARB* = 0x0000208C
|
|
||||||
WGL_AUX6_ARB* = 0x0000208D
|
|
||||||
WGL_AUX7_ARB* = 0x0000208E
|
|
||||||
WGL_AUX8_ARB* = 0x0000208F
|
|
||||||
WGL_AUX9_ARB* = 0x00002090
|
|
||||||
|
|
||||||
proc wglBindTexImageARB*(hPbuffer: THandle, iBuffer: TGLint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglBindTexImageARB".}
|
|
||||||
proc wglReleaseTexImageARB*(hPbuffer: THandle, iBuffer: TGLint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglReleaseTexImageARB".}
|
|
||||||
proc wglSetPbufferAttribARB*(hPbuffer: THandle, piAttribList: PGLint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglSetPbufferAttribARB".}
|
|
||||||
proc wglGetExtensionsStringEXT*(): cstring{.dynlib: dllname,
|
|
||||||
importc: "wglGetExtensionsStringEXT".}
|
|
||||||
proc wglMakeContextCurrentEXT*(hDrawDC: HDC, hReadDC: HDC, hglrc: HGLRC): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglMakeContextCurrentEXT".}
|
|
||||||
proc wglGetCurrentReadDCEXT*(): HDC{.dynlib: dllname,
|
|
||||||
importc: "wglGetCurrentReadDCEXT".}
|
|
||||||
const
|
|
||||||
WGL_DRAW_TO_PBUFFER_EXT* = 0x0000202D
|
|
||||||
WGL_MAX_PBUFFER_PIXELS_EXT* = 0x0000202E
|
|
||||||
WGL_MAX_PBUFFER_WIDTH_EXT* = 0x0000202F
|
|
||||||
WGL_MAX_PBUFFER_HEIGHT_EXT* = 0x00002030
|
|
||||||
WGL_OPTIMAL_PBUFFER_WIDTH_EXT* = 0x00002031
|
|
||||||
WGL_OPTIMAL_PBUFFER_HEIGHT_EXT* = 0x00002032
|
|
||||||
WGL_PBUFFER_LARGEST_EXT* = 0x00002033
|
|
||||||
WGL_PBUFFER_WIDTH_EXT* = 0x00002034
|
|
||||||
WGL_PBUFFER_HEIGHT_EXT* = 0x00002035
|
|
||||||
|
|
||||||
proc wglCreatePbufferEXT*(hDC: HDC, iPixelFormat: TGLint, iWidth: TGLint,
|
|
||||||
iHeight: TGLint, piAttribList: PGLint): THandle{.
|
|
||||||
dynlib: dllname, importc: "wglCreatePbufferEXT".}
|
|
||||||
proc wglGetPbufferDCEXT*(hPbuffer: THandle): HDC{.dynlib: dllname,
|
|
||||||
importc: "wglGetPbufferDCEXT".}
|
|
||||||
proc wglReleasePbufferDCEXT*(hPbuffer: THandle, hDC: HDC): TGLint{.
|
|
||||||
dynlib: dllname, importc: "wglReleasePbufferDCEXT".}
|
|
||||||
proc wglDestroyPbufferEXT*(hPbuffer: THandle): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglDestroyPbufferEXT".}
|
|
||||||
proc wglQueryPbufferEXT*(hPbuffer: THandle, iAttribute: TGLint, piValue: PGLint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglQueryPbufferEXT".}
|
|
||||||
const
|
|
||||||
WGL_NUMBER_PIXEL_FORMATS_EXT* = 0x00002000
|
|
||||||
WGL_DRAW_TO_WINDOW_EXT* = 0x00002001
|
|
||||||
WGL_DRAW_TO_BITMAP_EXT* = 0x00002002
|
|
||||||
WGL_ACCELERATION_EXT* = 0x00002003
|
|
||||||
WGL_NEED_PALETTE_EXT* = 0x00002004
|
|
||||||
WGL_NEED_SYSTEM_PALETTE_EXT* = 0x00002005
|
|
||||||
WGL_SWAP_LAYER_BUFFERS_EXT* = 0x00002006
|
|
||||||
WGL_SWAP_METHOD_EXT* = 0x00002007
|
|
||||||
WGL_NUMBER_OVERLAYS_EXT* = 0x00002008
|
|
||||||
WGL_NUMBER_UNDERLAYS_EXT* = 0x00002009
|
|
||||||
WGL_TRANSPARENT_EXT* = 0x0000200A
|
|
||||||
WGL_TRANSPARENT_VALUE_EXT* = 0x0000200B
|
|
||||||
WGL_SHARE_DEPTH_EXT* = 0x0000200C
|
|
||||||
WGL_SHARE_STENCIL_EXT* = 0x0000200D
|
|
||||||
WGL_SHARE_ACCUM_EXT* = 0x0000200E
|
|
||||||
WGL_SUPPORT_GDI_EXT* = 0x0000200F
|
|
||||||
WGL_SUPPORT_OPENGL_EXT* = 0x00002010
|
|
||||||
WGL_DOUBLE_BUFFER_EXT* = 0x00002011
|
|
||||||
WGL_STEREO_EXT* = 0x00002012
|
|
||||||
WGL_PIXEL_TYPE_EXT* = 0x00002013
|
|
||||||
WGL_COLOR_BITS_EXT* = 0x00002014
|
|
||||||
WGL_RED_BITS_EXT* = 0x00002015
|
|
||||||
WGL_RED_SHIFT_EXT* = 0x00002016
|
|
||||||
WGL_GREEN_BITS_EXT* = 0x00002017
|
|
||||||
WGL_GREEN_SHIFT_EXT* = 0x00002018
|
|
||||||
WGL_BLUE_BITS_EXT* = 0x00002019
|
|
||||||
WGL_BLUE_SHIFT_EXT* = 0x0000201A
|
|
||||||
WGL_ALPHA_BITS_EXT* = 0x0000201B
|
|
||||||
WGL_ALPHA_SHIFT_EXT* = 0x0000201C
|
|
||||||
WGL_ACCUM_BITS_EXT* = 0x0000201D
|
|
||||||
WGL_ACCUM_RED_BITS_EXT* = 0x0000201E
|
|
||||||
WGL_ACCUM_GREEN_BITS_EXT* = 0x0000201F
|
|
||||||
WGL_ACCUM_BLUE_BITS_EXT* = 0x00002020
|
|
||||||
WGL_ACCUM_ALPHA_BITS_EXT* = 0x00002021
|
|
||||||
WGL_DEPTH_BITS_EXT* = 0x00002022
|
|
||||||
WGL_STENCIL_BITS_EXT* = 0x00002023
|
|
||||||
WGL_AUX_BUFFERS_EXT* = 0x00002024
|
|
||||||
WGL_NO_ACCELERATION_EXT* = 0x00002025
|
|
||||||
WGL_GENERIC_ACCELERATION_EXT* = 0x00002026
|
|
||||||
WGL_FULL_ACCELERATION_EXT* = 0x00002027
|
|
||||||
WGL_SWAP_EXCHANGE_EXT* = 0x00002028
|
|
||||||
WGL_SWAP_COPY_EXT* = 0x00002029
|
|
||||||
WGL_SWAP_UNDEFINED_EXT* = 0x0000202A
|
|
||||||
WGL_TYPE_RGBA_EXT* = 0x0000202B
|
|
||||||
WGL_TYPE_COLORINDEX_EXT* = 0x0000202C
|
|
||||||
|
|
||||||
proc wglGetPixelFormatAttribivEXT*(hdc: HDC, iPixelFormat: TGLint,
|
|
||||||
iLayerPlane: TGLint, nAttributes: TGLuint,
|
|
||||||
piAttributes: PGLint, piValues: PGLint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGetPixelFormatAttribivEXT".}
|
|
||||||
proc wglGetPixelFormatAttribfvEXT*(hdc: HDC, iPixelFormat: TGLint,
|
|
||||||
iLayerPlane: TGLint, nAttributes: TGLuint,
|
|
||||||
piAttributes: PGLint, pfValues: PGLfloat): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGetPixelFormatAttribfvEXT".}
|
|
||||||
proc wglChoosePixelFormatEXT*(hdc: HDC, piAttribIList: PGLint,
|
|
||||||
pfAttribFList: PGLfloat, nMaxFormats: TGLuint,
|
|
||||||
piFormats: PGLint, nNumFormats: PGLuint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglChoosePixelFormatEXT".}
|
|
||||||
const
|
|
||||||
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D* = 0x00002050
|
|
||||||
WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D* = 0x00002051
|
|
||||||
WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D* = 0x00002052
|
|
||||||
WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D* = 0x00002053
|
|
||||||
|
|
||||||
proc wglGetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: TGLint,
|
|
||||||
piValue: PGLint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglGetDigitalVideoParametersI3D".}
|
|
||||||
proc wglSetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: TGLint,
|
|
||||||
piValue: PGLint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglSetDigitalVideoParametersI3D".}
|
|
||||||
const
|
|
||||||
WGL_GAMMA_TABLE_SIZE_I3D* = 0x0000204E
|
|
||||||
WGL_GAMMA_EXCLUDE_DESKTOP_I3D* = 0x0000204F
|
|
||||||
|
|
||||||
proc wglGetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint,
|
|
||||||
piValue: PGLint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglGetGammaTableParametersI3D".}
|
|
||||||
proc wglSetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint,
|
|
||||||
piValue: PGLint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglSetGammaTableParametersI3D".}
|
|
||||||
proc wglGetGammaTableI3D*(hDC: HDC, iEntries: TGLint, puRed: PGLUSHORT,
|
|
||||||
puGreen: PGLUSHORT, puBlue: PGLUSHORT): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGetGammaTableI3D".}
|
|
||||||
proc wglSetGammaTableI3D*(hDC: HDC, iEntries: TGLint, puRed: PGLUSHORT,
|
|
||||||
puGreen: PGLUSHORT, puBlue: PGLUSHORT): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglSetGammaTableI3D".}
|
|
||||||
const
|
|
||||||
WGL_GENLOCK_SOURCE_MULTIVIEW_I3D* = 0x00002044
|
|
||||||
WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D* = 0x00002045
|
|
||||||
WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D* = 0x00002046
|
|
||||||
WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D* = 0x00002047
|
|
||||||
WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D* = 0x00002048
|
|
||||||
WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D* = 0x00002049
|
|
||||||
WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D* = 0x0000204A
|
|
||||||
WGL_GENLOCK_SOURCE_EDGE_RISING_I3D* = 0x0000204B
|
|
||||||
WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D* = 0x0000204C
|
|
||||||
WGL_FLOAT_COMPONENTS_NV* = 0x000020B0
|
|
||||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV* = 0x000020B1
|
|
||||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV* = 0x000020B2
|
|
||||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV* = 0x000020B3
|
|
||||||
WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV* = 0x000020B4
|
|
||||||
WGL_TEXTURE_FLOAT_R_NV* = 0x000020B5
|
|
||||||
WGL_TEXTURE_FLOAT_RG_NV* = 0x000020B6
|
|
||||||
WGL_TEXTURE_FLOAT_RGB_NV* = 0x000020B7
|
|
||||||
WGL_TEXTURE_FLOAT_RGBA_NV* = 0x000020B8
|
|
||||||
|
|
||||||
proc wglEnableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglEnableGenlockI3D".}
|
|
||||||
proc wglDisableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglDisableGenlockI3D".}
|
|
||||||
proc wglIsEnabledGenlockI3D*(hDC: HDC, pFlag: PBOOL): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglIsEnabledGenlockI3D".}
|
|
||||||
proc wglGenlockSourceI3D*(hDC: HDC, uSource: TGLuint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglGenlockSourceI3D".}
|
|
||||||
proc wglGetGenlockSourceI3D*(hDC: HDC, uSource: PGLUINT): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglGetGenlockSourceI3D".}
|
|
||||||
proc wglGenlockSourceEdgeI3D*(hDC: HDC, uEdge: TGLuint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglGenlockSourceEdgeI3D".}
|
|
||||||
proc wglGetGenlockSourceEdgeI3D*(hDC: HDC, uEdge: PGLUINT): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGetGenlockSourceEdgeI3D".}
|
|
||||||
proc wglGenlockSampleRateI3D*(hDC: HDC, uRate: TGLuint): BOOL{.dynlib: dllname,
|
|
||||||
importc: "wglGenlockSampleRateI3D".}
|
|
||||||
proc wglGetGenlockSampleRateI3D*(hDC: HDC, uRate: PGLUINT): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGetGenlockSampleRateI3D".}
|
|
||||||
proc wglGenlockSourceDelayI3D*(hDC: HDC, uDelay: TGLuint): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGenlockSourceDelayI3D".}
|
|
||||||
proc wglGetGenlockSourceDelayI3D*(hDC: HDC, uDelay: PGLUINT): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglGetGenlockSourceDelayI3D".}
|
|
||||||
proc wglQueryGenlockMaxSourceDelayI3D*(hDC: HDC, uMaxLineDelay: PGLUINT,
|
|
||||||
uMaxPixelDelay: PGLUINT): BOOL{.
|
|
||||||
dynlib: dllname, importc: "wglQueryGenlockMaxSourceDelayI3D".}
|
|
||||||
const
|
|
||||||
WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV* = 0x000020A0
|
|
||||||
WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV* = 0x000020A1
|
|
||||||
WGL_TEXTURE_RECTANGLE_NV* = 0x000020A2
|
|
||||||
|
|
||||||
const
|
|
||||||
WGL_RGBA_FLOAT_MODE_ATI* = 0x00008820
|
|
||||||
WGL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI* = 0x00008835
|
|
||||||
WGL_TYPE_RGBA_FLOAT_ATI* = 0x000021A0
|
|
||||||
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
# $Xorg: cursorfont.h,v 1.4 2001/02/09 02:03:39 xorgcvs Exp $
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#Copyright 1987, 1998 The Open Group
|
|
||||||
#
|
|
||||||
#Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
#documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
#the above copyright notice appear in all copies and that both that
|
|
||||||
#copyright notice and this permission notice appear in supporting
|
|
||||||
#documentation.
|
|
||||||
#
|
|
||||||
#The above copyright notice and this permission notice shall be included
|
|
||||||
#in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
#OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
#IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
||||||
#OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
||||||
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
#OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
#Except as contained in this notice, the name of The Open Group shall
|
|
||||||
#not be used in advertising or otherwise to promote the sale, use or
|
|
||||||
#other dealings in this Software without prior written authorization
|
|
||||||
#from The Open Group.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
const
|
|
||||||
XC_num_glyphs* = 154
|
|
||||||
XC_X_cursor* = 0
|
|
||||||
XC_arrow* = 2
|
|
||||||
XC_based_arrow_down* = 4
|
|
||||||
XC_based_arrow_up* = 6
|
|
||||||
XC_boat* = 8
|
|
||||||
XC_bogosity* = 10
|
|
||||||
XC_bottom_left_corner* = 12
|
|
||||||
XC_bottom_right_corner* = 14
|
|
||||||
XC_bottom_side* = 16
|
|
||||||
XC_bottom_tee* = 18
|
|
||||||
XC_box_spiral* = 20
|
|
||||||
XC_center_ptr* = 22
|
|
||||||
XC_circle* = 24
|
|
||||||
XC_clock* = 26
|
|
||||||
XC_coffee_mug* = 28
|
|
||||||
XC_cross* = 30
|
|
||||||
XC_cross_reverse* = 32
|
|
||||||
XC_crosshair* = 34
|
|
||||||
XC_diamond_cross* = 36
|
|
||||||
XC_dot* = 38
|
|
||||||
XC_dotbox* = 40
|
|
||||||
XC_double_arrow* = 42
|
|
||||||
XC_draft_large* = 44
|
|
||||||
XC_draft_small* = 46
|
|
||||||
XC_draped_box* = 48
|
|
||||||
XC_exchange* = 50
|
|
||||||
XC_fleur* = 52
|
|
||||||
XC_gobbler* = 54
|
|
||||||
XC_gumby* = 56
|
|
||||||
XC_hand1* = 58
|
|
||||||
XC_hand2* = 60
|
|
||||||
XC_heart* = 62
|
|
||||||
XC_icon* = 64
|
|
||||||
XC_iron_cross* = 66
|
|
||||||
XC_left_ptr* = 68
|
|
||||||
XC_left_side* = 70
|
|
||||||
XC_left_tee* = 72
|
|
||||||
XC_leftbutton* = 74
|
|
||||||
XC_ll_angle* = 76
|
|
||||||
XC_lr_angle* = 78
|
|
||||||
XC_man* = 80
|
|
||||||
XC_middlebutton* = 82
|
|
||||||
XC_mouse* = 84
|
|
||||||
XC_pencil* = 86
|
|
||||||
XC_pirate* = 88
|
|
||||||
XC_plus* = 90
|
|
||||||
XC_question_arrow* = 92
|
|
||||||
XC_right_ptr* = 94
|
|
||||||
XC_right_side* = 96
|
|
||||||
XC_right_tee* = 98
|
|
||||||
XC_rightbutton* = 100
|
|
||||||
XC_rtl_logo* = 102
|
|
||||||
XC_sailboat* = 104
|
|
||||||
XC_sb_down_arrow* = 106
|
|
||||||
XC_sb_h_double_arrow* = 108
|
|
||||||
XC_sb_left_arrow* = 110
|
|
||||||
XC_sb_right_arrow* = 112
|
|
||||||
XC_sb_up_arrow* = 114
|
|
||||||
XC_sb_v_double_arrow* = 116
|
|
||||||
XC_shuttle* = 118
|
|
||||||
XC_sizing* = 120
|
|
||||||
XC_spider* = 122
|
|
||||||
XC_spraycan* = 124
|
|
||||||
XC_star* = 126
|
|
||||||
XC_target* = 128
|
|
||||||
XC_tcross* = 130
|
|
||||||
XC_top_left_arrow* = 132
|
|
||||||
XC_top_left_corner* = 134
|
|
||||||
XC_top_right_corner* = 136
|
|
||||||
XC_top_side* = 138
|
|
||||||
XC_top_tee* = 140
|
|
||||||
XC_trek* = 142
|
|
||||||
XC_ul_angle* = 144
|
|
||||||
XC_umbrella* = 146
|
|
||||||
XC_ur_angle* = 148
|
|
||||||
XC_watch* = 150
|
|
||||||
XC_xterm* = 152
|
|
||||||
|
|
||||||
# implementation
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,400 +0,0 @@
|
||||||
|
|
||||||
#
|
|
||||||
# Automatically converted by H2Pas 0.99.15 from x.h
|
|
||||||
# The following command line parameters were used:
|
|
||||||
# -p
|
|
||||||
# -T
|
|
||||||
# -S
|
|
||||||
# -d
|
|
||||||
# -c
|
|
||||||
# x.h
|
|
||||||
#
|
|
||||||
# Pointers to basic pascal types, inserted by h2pas conversion program.
|
|
||||||
|
|
||||||
const
|
|
||||||
X_PROTOCOL* = 11
|
|
||||||
X_PROTOCOL_REVISION* = 0
|
|
||||||
|
|
||||||
type
|
|
||||||
PXID* = ptr TXID
|
|
||||||
TXID* = culong
|
|
||||||
PMask* = ptr TMask
|
|
||||||
TMask* = culong
|
|
||||||
PPAtom* = ptr PAtom
|
|
||||||
PAtom* = ptr TAtom
|
|
||||||
TAtom* = culong
|
|
||||||
PVisualID* = ptr TVisualID
|
|
||||||
TVisualID* = culong
|
|
||||||
PTime* = ptr TTime
|
|
||||||
TTime* = culong
|
|
||||||
PPWindow* = ptr PWindow
|
|
||||||
PWindow* = ptr TWindow
|
|
||||||
TWindow* = TXID
|
|
||||||
PDrawable* = ptr TDrawable
|
|
||||||
TDrawable* = TXID
|
|
||||||
PFont* = ptr TFont
|
|
||||||
TFont* = TXID
|
|
||||||
PPixmap* = ptr TPixmap
|
|
||||||
TPixmap* = TXID
|
|
||||||
PCursor* = ptr TCursor
|
|
||||||
TCursor* = TXID
|
|
||||||
PColormap* = ptr TColormap
|
|
||||||
TColormap* = TXID
|
|
||||||
PGContext* = ptr TGContext
|
|
||||||
TGContext* = TXID
|
|
||||||
PKeySym* = ptr TKeySym
|
|
||||||
TKeySym* = TXID
|
|
||||||
PKeyCode* = ptr TKeyCode
|
|
||||||
TKeyCode* = cuchar
|
|
||||||
|
|
||||||
proc `==`*(a, b: TAtom): bool =
|
|
||||||
return system.`==`(a,b)
|
|
||||||
|
|
||||||
const
|
|
||||||
None* = 0
|
|
||||||
ParentRelative* = 1
|
|
||||||
CopyFromParent* = 0
|
|
||||||
PointerWindow* = 0
|
|
||||||
InputFocus* = 1
|
|
||||||
PointerRoot* = 1
|
|
||||||
AnyPropertyType* = 0
|
|
||||||
AnyKey* = 0
|
|
||||||
AnyButton* = 0
|
|
||||||
AllTemporary* = 0
|
|
||||||
CurrentTime* = 0
|
|
||||||
NoSymbol* = 0
|
|
||||||
NoEventMask* = 0
|
|
||||||
KeyPressMask* = 1 shl 0
|
|
||||||
KeyReleaseMask* = 1 shl 1
|
|
||||||
ButtonPressMask* = 1 shl 2
|
|
||||||
ButtonReleaseMask* = 1 shl 3
|
|
||||||
EnterWindowMask* = 1 shl 4
|
|
||||||
LeaveWindowMask* = 1 shl 5
|
|
||||||
PointerMotionMask* = 1 shl 6
|
|
||||||
PointerMotionHintMask* = 1 shl 7
|
|
||||||
Button1MotionMask* = 1 shl 8
|
|
||||||
Button2MotionMask* = 1 shl 9
|
|
||||||
Button3MotionMask* = 1 shl 10
|
|
||||||
Button4MotionMask* = 1 shl 11
|
|
||||||
Button5MotionMask* = 1 shl 12
|
|
||||||
ButtonMotionMask* = 1 shl 13
|
|
||||||
KeymapStateMask* = 1 shl 14
|
|
||||||
ExposureMask* = 1 shl 15
|
|
||||||
VisibilityChangeMask* = 1 shl 16
|
|
||||||
StructureNotifyMask* = 1 shl 17
|
|
||||||
ResizeRedirectMask* = 1 shl 18
|
|
||||||
SubstructureNotifyMask* = 1 shl 19
|
|
||||||
SubstructureRedirectMask* = 1 shl 20
|
|
||||||
FocusChangeMask* = 1 shl 21
|
|
||||||
PropertyChangeMask* = 1 shl 22
|
|
||||||
ColormapChangeMask* = 1 shl 23
|
|
||||||
OwnerGrabButtonMask* = 1 shl 24
|
|
||||||
KeyPress* = 2
|
|
||||||
KeyRelease* = 3
|
|
||||||
ButtonPress* = 4
|
|
||||||
ButtonRelease* = 5
|
|
||||||
MotionNotify* = 6
|
|
||||||
EnterNotify* = 7
|
|
||||||
LeaveNotify* = 8
|
|
||||||
FocusIn* = 9
|
|
||||||
FocusOut* = 10
|
|
||||||
KeymapNotify* = 11
|
|
||||||
Expose* = 12
|
|
||||||
GraphicsExpose* = 13
|
|
||||||
NoExpose* = 14
|
|
||||||
VisibilityNotify* = 15
|
|
||||||
CreateNotify* = 16
|
|
||||||
DestroyNotify* = 17
|
|
||||||
UnmapNotify* = 18
|
|
||||||
MapNotify* = 19
|
|
||||||
MapRequest* = 20
|
|
||||||
ReparentNotify* = 21
|
|
||||||
ConfigureNotify* = 22
|
|
||||||
ConfigureRequest* = 23
|
|
||||||
GravityNotify* = 24
|
|
||||||
ResizeRequest* = 25
|
|
||||||
CirculateNotify* = 26
|
|
||||||
CirculateRequest* = 27
|
|
||||||
PropertyNotify* = 28
|
|
||||||
SelectionClear* = 29
|
|
||||||
SelectionRequest* = 30
|
|
||||||
SelectionNotify* = 31
|
|
||||||
ColormapNotify* = 32
|
|
||||||
ClientMessage* = 33
|
|
||||||
MappingNotify* = 34
|
|
||||||
LASTEvent* = 35
|
|
||||||
ShiftMask* = 1 shl 0
|
|
||||||
LockMask* = 1 shl 1
|
|
||||||
ControlMask* = 1 shl 2
|
|
||||||
Mod1Mask* = 1 shl 3
|
|
||||||
Mod2Mask* = 1 shl 4
|
|
||||||
Mod3Mask* = 1 shl 5
|
|
||||||
Mod4Mask* = 1 shl 6
|
|
||||||
Mod5Mask* = 1 shl 7
|
|
||||||
ShiftMapIndex* = 0
|
|
||||||
LockMapIndex* = 1
|
|
||||||
ControlMapIndex* = 2
|
|
||||||
Mod1MapIndex* = 3
|
|
||||||
Mod2MapIndex* = 4
|
|
||||||
Mod3MapIndex* = 5
|
|
||||||
Mod4MapIndex* = 6
|
|
||||||
Mod5MapIndex* = 7
|
|
||||||
Button1Mask* = 1 shl 8
|
|
||||||
Button2Mask* = 1 shl 9
|
|
||||||
Button3Mask* = 1 shl 10
|
|
||||||
Button4Mask* = 1 shl 11
|
|
||||||
Button5Mask* = 1 shl 12
|
|
||||||
AnyModifier* = 1 shl 15
|
|
||||||
Button1* = 1
|
|
||||||
Button2* = 2
|
|
||||||
Button3* = 3
|
|
||||||
Button4* = 4
|
|
||||||
Button5* = 5
|
|
||||||
NotifyNormal* = 0
|
|
||||||
NotifyGrab* = 1
|
|
||||||
NotifyUngrab* = 2
|
|
||||||
NotifyWhileGrabbed* = 3
|
|
||||||
NotifyHint* = 1
|
|
||||||
NotifyAncestor* = 0
|
|
||||||
NotifyVirtual* = 1
|
|
||||||
NotifyInferior* = 2
|
|
||||||
NotifyNonlinear* = 3
|
|
||||||
NotifyNonlinearVirtual* = 4
|
|
||||||
NotifyPointer* = 5
|
|
||||||
NotifyPointerRoot* = 6
|
|
||||||
NotifyDetailNone* = 7
|
|
||||||
VisibilityUnobscured* = 0
|
|
||||||
VisibilityPartiallyObscured* = 1
|
|
||||||
VisibilityFullyObscured* = 2
|
|
||||||
PlaceOnTop* = 0
|
|
||||||
PlaceOnBottom* = 1
|
|
||||||
FamilyInternet* = 0
|
|
||||||
FamilyDECnet* = 1
|
|
||||||
FamilyChaos* = 2
|
|
||||||
FamilyInternet6* = 6
|
|
||||||
FamilyServerInterpreted* = 5
|
|
||||||
PropertyNewValue* = 0
|
|
||||||
PropertyDelete* = 1
|
|
||||||
ColormapUninstalled* = 0
|
|
||||||
ColormapInstalled* = 1
|
|
||||||
GrabModeSync* = 0
|
|
||||||
GrabModeAsync* = 1
|
|
||||||
GrabSuccess* = 0
|
|
||||||
AlreadyGrabbed* = 1
|
|
||||||
GrabInvalidTime* = 2
|
|
||||||
GrabNotViewable* = 3
|
|
||||||
GrabFrozen* = 4
|
|
||||||
AsyncPointer* = 0
|
|
||||||
SyncPointer* = 1
|
|
||||||
ReplayPointer* = 2
|
|
||||||
AsyncKeyboard* = 3
|
|
||||||
SyncKeyboard* = 4
|
|
||||||
ReplayKeyboard* = 5
|
|
||||||
AsyncBoth* = 6
|
|
||||||
SyncBoth* = 7
|
|
||||||
RevertToNone* = None
|
|
||||||
RevertToPointerRoot* = PointerRoot
|
|
||||||
RevertToParent* = 2
|
|
||||||
Success* = 0
|
|
||||||
BadRequest* = 1
|
|
||||||
BadValue* = 2
|
|
||||||
BadWindow* = 3
|
|
||||||
BadPixmap* = 4
|
|
||||||
BadAtom* = 5
|
|
||||||
BadCursor* = 6
|
|
||||||
BadFont* = 7
|
|
||||||
BadMatch* = 8
|
|
||||||
BadDrawable* = 9
|
|
||||||
BadAccess* = 10
|
|
||||||
BadAlloc* = 11
|
|
||||||
BadColor* = 12
|
|
||||||
BadGC* = 13
|
|
||||||
BadIDChoice* = 14
|
|
||||||
BadName* = 15
|
|
||||||
BadLength* = 16
|
|
||||||
BadImplementation* = 17
|
|
||||||
FirstExtensionError* = 128
|
|
||||||
LastExtensionError* = 255
|
|
||||||
InputOutput* = 1
|
|
||||||
InputOnly* = 2
|
|
||||||
CWBackPixmap* = 1 shl 0
|
|
||||||
CWBackPixel* = 1 shl 1
|
|
||||||
CWBorderPixmap* = 1 shl 2
|
|
||||||
CWBorderPixel* = 1 shl 3
|
|
||||||
CWBitGravity* = 1 shl 4
|
|
||||||
CWWinGravity* = 1 shl 5
|
|
||||||
CWBackingStore* = 1 shl 6
|
|
||||||
CWBackingPlanes* = 1 shl 7
|
|
||||||
CWBackingPixel* = 1 shl 8
|
|
||||||
CWOverrideRedirect* = 1 shl 9
|
|
||||||
CWSaveUnder* = 1 shl 10
|
|
||||||
CWEventMask* = 1 shl 11
|
|
||||||
CWDontPropagate* = 1 shl 12
|
|
||||||
CWColormap* = 1 shl 13
|
|
||||||
CWCursor* = 1 shl 14
|
|
||||||
CWX* = 1 shl 0
|
|
||||||
CWY* = 1 shl 1
|
|
||||||
CWWidth* = 1 shl 2
|
|
||||||
CWHeight* = 1 shl 3
|
|
||||||
CWBorderWidth* = 1 shl 4
|
|
||||||
CWSibling* = 1 shl 5
|
|
||||||
CWStackMode* = 1 shl 6
|
|
||||||
ForgetGravity* = 0
|
|
||||||
NorthWestGravity* = 1
|
|
||||||
NorthGravity* = 2
|
|
||||||
NorthEastGravity* = 3
|
|
||||||
WestGravity* = 4
|
|
||||||
CenterGravity* = 5
|
|
||||||
EastGravity* = 6
|
|
||||||
SouthWestGravity* = 7
|
|
||||||
SouthGravity* = 8
|
|
||||||
SouthEastGravity* = 9
|
|
||||||
StaticGravity* = 10
|
|
||||||
UnmapGravity* = 0
|
|
||||||
NotUseful* = 0
|
|
||||||
WhenMapped* = 1
|
|
||||||
Always* = 2
|
|
||||||
IsUnmapped* = 0
|
|
||||||
IsUnviewable* = 1
|
|
||||||
IsViewable* = 2
|
|
||||||
SetModeInsert* = 0
|
|
||||||
SetModeDelete* = 1
|
|
||||||
DestroyAll* = 0
|
|
||||||
RetainPermanent* = 1
|
|
||||||
RetainTemporary* = 2
|
|
||||||
Above* = 0
|
|
||||||
Below* = 1
|
|
||||||
TopIf* = 2
|
|
||||||
BottomIf* = 3
|
|
||||||
Opposite* = 4
|
|
||||||
RaiseLowest* = 0
|
|
||||||
LowerHighest* = 1
|
|
||||||
PropModeReplace* = 0
|
|
||||||
PropModePrepend* = 1
|
|
||||||
PropModeAppend* = 2
|
|
||||||
GXclear* = 0x00000000
|
|
||||||
GXand* = 0x00000001
|
|
||||||
GXandReverse* = 0x00000002
|
|
||||||
GXcopy* = 0x00000003
|
|
||||||
GXandInverted* = 0x00000004
|
|
||||||
GXnoop* = 0x00000005
|
|
||||||
GXxor* = 0x00000006
|
|
||||||
GXor* = 0x00000007
|
|
||||||
GXnor* = 0x00000008
|
|
||||||
GXequiv* = 0x00000009
|
|
||||||
GXinvert* = 0x0000000A
|
|
||||||
GXorReverse* = 0x0000000B
|
|
||||||
GXcopyInverted* = 0x0000000C
|
|
||||||
GXorInverted* = 0x0000000D
|
|
||||||
GXnand* = 0x0000000E
|
|
||||||
GXset* = 0x0000000F
|
|
||||||
LineSolid* = 0
|
|
||||||
LineOnOffDash* = 1
|
|
||||||
LineDoubleDash* = 2
|
|
||||||
CapNotLast* = 0
|
|
||||||
CapButt* = 1
|
|
||||||
CapRound* = 2
|
|
||||||
CapProjecting* = 3
|
|
||||||
JoinMiter* = 0
|
|
||||||
JoinRound* = 1
|
|
||||||
JoinBevel* = 2
|
|
||||||
FillSolid* = 0
|
|
||||||
FillTiled* = 1
|
|
||||||
FillStippled* = 2
|
|
||||||
FillOpaqueStippled* = 3
|
|
||||||
EvenOddRule* = 0
|
|
||||||
WindingRule* = 1
|
|
||||||
ClipByChildren* = 0
|
|
||||||
IncludeInferiors* = 1
|
|
||||||
Unsorted* = 0
|
|
||||||
YSorted* = 1
|
|
||||||
YXSorted* = 2
|
|
||||||
YXBanded* = 3
|
|
||||||
CoordModeOrigin* = 0
|
|
||||||
CoordModePrevious* = 1
|
|
||||||
Complex* = 0
|
|
||||||
Nonconvex* = 1
|
|
||||||
Convex* = 2
|
|
||||||
ArcChord* = 0
|
|
||||||
ArcPieSlice* = 1
|
|
||||||
GCFunction* = 1 shl 0
|
|
||||||
GCPlaneMask* = 1 shl 1
|
|
||||||
GCForeground* = 1 shl 2
|
|
||||||
GCBackground* = 1 shl 3
|
|
||||||
GCLineWidth* = 1 shl 4
|
|
||||||
GCLineStyle* = 1 shl 5
|
|
||||||
GCCapStyle* = 1 shl 6
|
|
||||||
GCJoinStyle* = 1 shl 7
|
|
||||||
GCFillStyle* = 1 shl 8
|
|
||||||
GCFillRule* = 1 shl 9
|
|
||||||
GCTile* = 1 shl 10
|
|
||||||
GCStipple* = 1 shl 11
|
|
||||||
GCTileStipXOrigin* = 1 shl 12
|
|
||||||
GCTileStipYOrigin* = 1 shl 13
|
|
||||||
GCFont* = 1 shl 14
|
|
||||||
GCSubwindowMode* = 1 shl 15
|
|
||||||
GCGraphicsExposures* = 1 shl 16
|
|
||||||
GCClipXOrigin* = 1 shl 17
|
|
||||||
GCClipYOrigin* = 1 shl 18
|
|
||||||
GCClipMask* = 1 shl 19
|
|
||||||
GCDashOffset* = 1 shl 20
|
|
||||||
GCDashList* = 1 shl 21
|
|
||||||
GCArcMode* = 1 shl 22
|
|
||||||
GCLastBit* = 22
|
|
||||||
FontLeftToRight* = 0
|
|
||||||
FontRightToLeft* = 1
|
|
||||||
FontChange* = 255
|
|
||||||
XYBitmap* = 0
|
|
||||||
XYPixmap* = 1
|
|
||||||
ZPixmap* = 2
|
|
||||||
AllocNone* = 0
|
|
||||||
AllocAll* = 1
|
|
||||||
DoRed* = 1 shl 0
|
|
||||||
DoGreen* = 1 shl 1
|
|
||||||
DoBlue* = 1 shl 2
|
|
||||||
CursorShape* = 0
|
|
||||||
TileShape* = 1
|
|
||||||
StippleShape* = 2
|
|
||||||
AutoRepeatModeOff* = 0
|
|
||||||
AutoRepeatModeOn* = 1
|
|
||||||
AutoRepeatModeDefault* = 2
|
|
||||||
LedModeOff* = 0
|
|
||||||
LedModeOn* = 1
|
|
||||||
KBKeyClickPercent* = 1 shl 0
|
|
||||||
KBBellPercent* = 1 shl 1
|
|
||||||
KBBellPitch* = 1 shl 2
|
|
||||||
KBBellDuration* = 1 shl 3
|
|
||||||
KBLed* = 1 shl 4
|
|
||||||
KBLedMode* = 1 shl 5
|
|
||||||
KBKey* = 1 shl 6
|
|
||||||
KBAutoRepeatMode* = 1 shl 7
|
|
||||||
MappingSuccess* = 0
|
|
||||||
MappingBusy* = 1
|
|
||||||
MappingFailed* = 2
|
|
||||||
MappingModifier* = 0
|
|
||||||
MappingKeyboard* = 1
|
|
||||||
MappingPointer* = 2
|
|
||||||
DontPreferBlanking* = 0
|
|
||||||
PreferBlanking* = 1
|
|
||||||
DefaultBlanking* = 2
|
|
||||||
DisableScreenSaver* = 0
|
|
||||||
DisableScreenInterval* = 0
|
|
||||||
DontAllowExposures* = 0
|
|
||||||
AllowExposures* = 1
|
|
||||||
DefaultExposures* = 2
|
|
||||||
ScreenSaverReset* = 0
|
|
||||||
ScreenSaverActive* = 1
|
|
||||||
HostInsert* = 0
|
|
||||||
HostDelete* = 1
|
|
||||||
EnableAccess* = 1
|
|
||||||
DisableAccess* = 0
|
|
||||||
StaticGray* = 0
|
|
||||||
GrayScale* = 1
|
|
||||||
StaticColor* = 2
|
|
||||||
PseudoColor* = 3
|
|
||||||
TrueColor* = 4
|
|
||||||
DirectColor* = 5
|
|
||||||
LSBFirst* = 0
|
|
||||||
MSBFirst* = 1
|
|
||||||
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
[Package]
|
|
||||||
name: "x11"
|
|
||||||
version: "1.0"
|
|
||||||
author: "Andreas Rumpf"
|
|
||||||
description: "Wrapper for X11"
|
|
||||||
license: "MIT"
|
|
||||||
|
|
||||||
srcDir: "src"
|
|
||||||
|
|
||||||
[Deps]
|
|
||||||
requires: "nimrod > 0.9.2"
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
# 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(|.6)"
|
|
||||||
|
|
||||||
{.pragma: libx11, cdecl, dynlib: libX11, importc.}
|
|
||||||
{.pragma: libx11c, cdecl, dynlib: libX11.}
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
#
|
|
||||||
# THIS IS A GENERATED FILE
|
|
||||||
#
|
|
||||||
# Do not change! Changing this file implies a protocol change!
|
|
||||||
#
|
|
||||||
|
|
||||||
import
|
|
||||||
X
|
|
||||||
|
|
||||||
const
|
|
||||||
XA_PRIMARY* = TAtom(1)
|
|
||||||
XA_SECONDARY* = TAtom(2)
|
|
||||||
XA_ARC* = TAtom(3)
|
|
||||||
XA_ATOM* = TAtom(4)
|
|
||||||
XA_BITMAP* = TAtom(5)
|
|
||||||
XA_CARDINAL* = TAtom(6)
|
|
||||||
XA_COLORMAP* = TAtom(7)
|
|
||||||
XA_CURSOR* = TAtom(8)
|
|
||||||
XA_CUT_BUFFER0* = TAtom(9)
|
|
||||||
XA_CUT_BUFFER1* = TAtom(10)
|
|
||||||
XA_CUT_BUFFER2* = TAtom(11)
|
|
||||||
XA_CUT_BUFFER3* = TAtom(12)
|
|
||||||
XA_CUT_BUFFER4* = TAtom(13)
|
|
||||||
XA_CUT_BUFFER5* = TAtom(14)
|
|
||||||
XA_CUT_BUFFER6* = TAtom(15)
|
|
||||||
XA_CUT_BUFFER7* = TAtom(16)
|
|
||||||
XA_DRAWABLE* = TAtom(17)
|
|
||||||
XA_FONT* = TAtom(18)
|
|
||||||
XA_INTEGER* = TAtom(19)
|
|
||||||
XA_PIXMAP* = TAtom(20)
|
|
||||||
XA_POINT* = TAtom(21)
|
|
||||||
XA_RECTANGLE* = TAtom(22)
|
|
||||||
XA_RESOURCE_MANAGER* = TAtom(23)
|
|
||||||
XA_RGB_COLOR_MAP* = TAtom(24)
|
|
||||||
XA_RGB_BEST_MAP* = TAtom(25)
|
|
||||||
XA_RGB_BLUE_MAP* = TAtom(26)
|
|
||||||
XA_RGB_DEFAULT_MAP* = TAtom(27)
|
|
||||||
XA_RGB_GRAY_MAP* = TAtom(28)
|
|
||||||
XA_RGB_GREEN_MAP* = TAtom(29)
|
|
||||||
XA_RGB_RED_MAP* = TAtom(30)
|
|
||||||
XA_STRING* = TAtom(31)
|
|
||||||
XA_VISUALID* = TAtom(32)
|
|
||||||
XA_WINDOW* = TAtom(33)
|
|
||||||
XA_WM_COMMAND* = TAtom(34)
|
|
||||||
XA_WM_HINTS* = TAtom(35)
|
|
||||||
XA_WM_CLIENT_MACHINE* = TAtom(36)
|
|
||||||
XA_WM_ICON_NAME* = TAtom(37)
|
|
||||||
XA_WM_ICON_SIZE* = TAtom(38)
|
|
||||||
XA_WM_NAME* = TAtom(39)
|
|
||||||
XA_WM_NORMAL_HINTS* = TAtom(40)
|
|
||||||
XA_WM_SIZE_HINTS* = TAtom(41)
|
|
||||||
XA_WM_ZOOM_HINTS* = TAtom(42)
|
|
||||||
XA_MIN_SPACE* = TAtom(43)
|
|
||||||
XA_NORM_SPACE* = TAtom(44)
|
|
||||||
XA_MAX_SPACE* = TAtom(45)
|
|
||||||
XA_END_SPACE* = TAtom(46)
|
|
||||||
XA_SUPERSCRIPT_X* = TAtom(47)
|
|
||||||
XA_SUPERSCRIPT_Y* = TAtom(48)
|
|
||||||
XA_SUBSCRIPT_X* = TAtom(49)
|
|
||||||
XA_SUBSCRIPT_Y* = TAtom(50)
|
|
||||||
XA_UNDERLINE_POSITION* = TAtom(51)
|
|
||||||
XA_UNDERLINE_THICKNESS* = TAtom(52)
|
|
||||||
XA_STRIKEOUT_ASCENT* = TAtom(53)
|
|
||||||
XA_STRIKEOUT_DESCENT* = TAtom(54)
|
|
||||||
XA_ITALIC_ANGLE* = TAtom(55)
|
|
||||||
XA_X_HEIGHT* = TAtom(56)
|
|
||||||
XA_QUAD_WIDTH* = TAtom(57)
|
|
||||||
XA_WEIGHT* = TAtom(58)
|
|
||||||
XA_POINT_SIZE* = TAtom(59)
|
|
||||||
XA_RESOLUTION* = TAtom(60)
|
|
||||||
XA_COPYRIGHT* = TAtom(61)
|
|
||||||
XA_NOTICE* = TAtom(62)
|
|
||||||
XA_FONT_NAME* = TAtom(63)
|
|
||||||
XA_FAMILY_NAME* = TAtom(64)
|
|
||||||
XA_FULL_NAME* = TAtom(65)
|
|
||||||
XA_CAP_HEIGHT* = TAtom(66)
|
|
||||||
XA_WM_CLASS* = TAtom(67)
|
|
||||||
XA_WM_TRANSIENT_FOR* = TAtom(68)
|
|
||||||
XA_LAST_PREDEFINED* = TAtom(68)
|
|
||||||
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,389 +0,0 @@
|
||||||
|
|
||||||
import
|
|
||||||
x, xlib
|
|
||||||
|
|
||||||
#const
|
|
||||||
# libX11* = "X11"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Automatically converted by H2Pas 0.99.15 from xcms.h
|
|
||||||
# The following command line parameters were used:
|
|
||||||
# -p
|
|
||||||
# -T
|
|
||||||
# -S
|
|
||||||
# -d
|
|
||||||
# -c
|
|
||||||
# xcms.h
|
|
||||||
#
|
|
||||||
|
|
||||||
const
|
|
||||||
XcmsFailure* = 0
|
|
||||||
XcmsSuccess* = 1
|
|
||||||
XcmsSuccessWithCompression* = 2
|
|
||||||
|
|
||||||
type
|
|
||||||
PXcmsColorFormat* = ptr TXcmsColorFormat
|
|
||||||
TXcmsColorFormat* = int32
|
|
||||||
|
|
||||||
proc XcmsUndefinedFormat*(): TXcmsColorFormat
|
|
||||||
proc XcmsCIEXYZFormat*(): TXcmsColorFormat
|
|
||||||
proc XcmsCIEuvYFormat*(): TXcmsColorFormat
|
|
||||||
proc XcmsCIExyYFormat*(): TXcmsColorFormat
|
|
||||||
proc XcmsCIELabFormat*(): TXcmsColorFormat
|
|
||||||
proc XcmsCIELuvFormat*(): TXcmsColorFormat
|
|
||||||
proc XcmsTekHVCFormat*(): TXcmsColorFormat
|
|
||||||
proc XcmsRGBFormat*(): TXcmsColorFormat
|
|
||||||
proc XcmsRGBiFormat*(): TXcmsColorFormat
|
|
||||||
const
|
|
||||||
XcmsInitNone* = 0x00000000
|
|
||||||
XcmsInitSuccess* = 0x00000001
|
|
||||||
XcmsInitFailure* = 0x000000FF
|
|
||||||
|
|
||||||
type
|
|
||||||
PXcmsFloat* = ptr TXcmsFloat
|
|
||||||
TXcmsFloat* = float64
|
|
||||||
PXcmsRGB* = ptr TXcmsRGB
|
|
||||||
TXcmsRGB*{.final.} = object
|
|
||||||
red*: int16
|
|
||||||
green*: int16
|
|
||||||
blue*: int16
|
|
||||||
|
|
||||||
PXcmsRGBi* = ptr TXcmsRGBi
|
|
||||||
TXcmsRGBi*{.final.} = object
|
|
||||||
red*: TXcmsFloat
|
|
||||||
green*: TXcmsFloat
|
|
||||||
blue*: TXcmsFloat
|
|
||||||
|
|
||||||
PXcmsCIEXYZ* = ptr TXcmsCIEXYZ
|
|
||||||
TXcmsCIEXYZ*{.final.} = object
|
|
||||||
X*: TXcmsFloat
|
|
||||||
Y*: TXcmsFloat
|
|
||||||
Z*: TXcmsFloat
|
|
||||||
|
|
||||||
PXcmsCIEuvY* = ptr TXcmsCIEuvY
|
|
||||||
TXcmsCIEuvY*{.final.} = object
|
|
||||||
u_prime*: TXcmsFloat
|
|
||||||
v_prime*: TXcmsFloat
|
|
||||||
Y*: TXcmsFloat
|
|
||||||
|
|
||||||
PXcmsCIExyY* = ptr TXcmsCIExyY
|
|
||||||
TXcmsCIExyY*{.final.} = object
|
|
||||||
x*: TXcmsFloat
|
|
||||||
y*: TXcmsFloat
|
|
||||||
theY*: TXcmsFloat
|
|
||||||
|
|
||||||
PXcmsCIELab* = ptr TXcmsCIELab
|
|
||||||
TXcmsCIELab*{.final.} = object
|
|
||||||
L_star*: TXcmsFloat
|
|
||||||
a_star*: TXcmsFloat
|
|
||||||
b_star*: TXcmsFloat
|
|
||||||
|
|
||||||
PXcmsCIELuv* = ptr TXcmsCIELuv
|
|
||||||
TXcmsCIELuv*{.final.} = object
|
|
||||||
L_star*: TXcmsFloat
|
|
||||||
u_star*: TXcmsFloat
|
|
||||||
v_star*: TXcmsFloat
|
|
||||||
|
|
||||||
PXcmsTekHVC* = ptr TXcmsTekHVC
|
|
||||||
TXcmsTekHVC*{.final.} = object
|
|
||||||
H*: TXcmsFloat
|
|
||||||
V*: TXcmsFloat
|
|
||||||
C*: TXcmsFloat
|
|
||||||
|
|
||||||
PXcmsPad* = ptr TXcmsPad
|
|
||||||
TXcmsPad*{.final.} = object
|
|
||||||
pad0*: TXcmsFloat
|
|
||||||
pad1*: TXcmsFloat
|
|
||||||
pad2*: TXcmsFloat
|
|
||||||
pad3*: TXcmsFloat
|
|
||||||
|
|
||||||
PXcmsColor* = ptr TXcmsColor
|
|
||||||
TXcmsColor*{.final.} = object # spec : record
|
|
||||||
# case longint of
|
|
||||||
# 0 : ( RGB : TXcmsRGB );
|
|
||||||
# 1 : ( RGBi : TXcmsRGBi );
|
|
||||||
# 2 : ( CIEXYZ : TXcmsCIEXYZ );
|
|
||||||
# 3 : ( CIEuvY : TXcmsCIEuvY );
|
|
||||||
# 4 : ( CIExyY : TXcmsCIExyY );
|
|
||||||
# 5 : ( CIELab : TXcmsCIELab );
|
|
||||||
# 6 : ( CIELuv : TXcmsCIELuv );
|
|
||||||
# 7 : ( TekHVC : TXcmsTekHVC );
|
|
||||||
# 8 : ( Pad : TXcmsPad );
|
|
||||||
# end;
|
|
||||||
pad*: TXcmsPad
|
|
||||||
pixel*: int32
|
|
||||||
format*: TXcmsColorFormat
|
|
||||||
|
|
||||||
PXcmsPerScrnInfo* = ptr TXcmsPerScrnInfo
|
|
||||||
TXcmsPerScrnInfo*{.final.} = object
|
|
||||||
screenWhitePt*: TXcmsColor
|
|
||||||
functionSet*: TXPointer
|
|
||||||
screenData*: TXPointer
|
|
||||||
state*: int8
|
|
||||||
pad*: array[0..2, char]
|
|
||||||
|
|
||||||
PXcmsCCC* = ptr TXcmsCCC
|
|
||||||
TXcmsCompressionProc* = proc (para1: PXcmsCCC, para2: PXcmsColor,
|
|
||||||
para3: int32, para4: int32, para5: PBool): TStatus{.
|
|
||||||
cdecl.}
|
|
||||||
TXcmsWhiteAdjustProc* = proc (para1: PXcmsCCC, para2: PXcmsColor,
|
|
||||||
para3: PXcmsColor, para4: TXcmsColorFormat,
|
|
||||||
para5: PXcmsColor, para6: int32, para7: PBool): TStatus{.
|
|
||||||
cdecl.}
|
|
||||||
TXcmsCCC*{.final.} = object
|
|
||||||
dpy*: PDisplay
|
|
||||||
screenNumber*: int32
|
|
||||||
visual*: PVisual
|
|
||||||
clientWhitePt*: TXcmsColor
|
|
||||||
gamutCompProc*: TXcmsCompressionProc
|
|
||||||
gamutCompClientData*: TXPointer
|
|
||||||
whitePtAdjProc*: TXcmsWhiteAdjustProc
|
|
||||||
whitePtAdjClientData*: TXPointer
|
|
||||||
pPerScrnInfo*: PXcmsPerScrnInfo
|
|
||||||
|
|
||||||
TXcmsCCCRec* = TXcmsCCC
|
|
||||||
PXcmsCCCRec* = ptr TXcmsCCCRec
|
|
||||||
TXcmsScreenInitProc* = proc (para1: PDisplay, para2: int32,
|
|
||||||
para3: PXcmsPerScrnInfo): TStatus{.cdecl.}
|
|
||||||
TXcmsScreenFreeProc* = proc (para1: TXPointer){.cdecl.}
|
|
||||||
TXcmsConversionProc* = proc (){.cdecl.}
|
|
||||||
PXcmsFuncListPtr* = ptr TXcmsFuncListPtr
|
|
||||||
TXcmsFuncListPtr* = TXcmsConversionProc
|
|
||||||
TXcmsParseStringProc* = proc (para1: cstring, para2: PXcmsColor): int32{.cdecl.}
|
|
||||||
PXcmsColorSpace* = ptr TXcmsColorSpace
|
|
||||||
TXcmsColorSpace*{.final.} = object
|
|
||||||
prefix*: cstring
|
|
||||||
id*: TXcmsColorFormat
|
|
||||||
parseString*: TXcmsParseStringProc
|
|
||||||
to_CIEXYZ*: TXcmsFuncListPtr
|
|
||||||
from_CIEXYZ*: TXcmsFuncListPtr
|
|
||||||
inverse_flag*: int32
|
|
||||||
|
|
||||||
PXcmsFunctionSet* = ptr TXcmsFunctionSet
|
|
||||||
TXcmsFunctionSet*{.final.} = object # error
|
|
||||||
#extern Status XcmsAddColorSpace (
|
|
||||||
#in declaration at line 323
|
|
||||||
DDColorSpaces*: ptr PXcmsColorSpace
|
|
||||||
screenInitProc*: TXcmsScreenInitProc
|
|
||||||
screenFreeProc*: TXcmsScreenFreeProc
|
|
||||||
|
|
||||||
|
|
||||||
proc XcmsAddFunctionSet*(para1: PXcmsFunctionSet): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsAllocColor*(para1: PDisplay, para2: TColormap, para3: PXcmsColor,
|
|
||||||
para4: TXcmsColorFormat): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsAllocNamedColor*(para1: PDisplay, para2: TColormap, para3: cstring,
|
|
||||||
para4: PXcmsColor, para5: PXcmsColor,
|
|
||||||
para6: TXcmsColorFormat): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCCCOfColormap*(para1: PDisplay, para2: TColormap): TXcmsCCC{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELabClipab*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELabClipL*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELabClipLab*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELabQueryMaxC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsCIELabQueryMaxL*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsCIELabQueryMaxLC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELabQueryMinL*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsCIELabToCIEXYZ*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELabWhiteShiftColors*(para1: TXcmsCCC, para2: PXcmsColor,
|
|
||||||
para3: PXcmsColor, para4: TXcmsColorFormat,
|
|
||||||
para5: PXcmsColor, para6: int32, para7: PBool): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELuvClipL*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELuvClipLuv*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELuvClipuv*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELuvQueryMaxC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsCIELuvQueryMaxL*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsCIELuvQueryMaxLC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELuvQueryMinL*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsCIELuvToCIEuvY*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIELuvWhiteShiftColors*(para1: TXcmsCCC, para2: PXcmsColor,
|
|
||||||
para3: PXcmsColor, para4: TXcmsColorFormat,
|
|
||||||
para5: PXcmsColor, para6: int32, para7: PBool): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIEXYZToCIELab*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIEXYZToCIEuvY*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIEXYZToCIExyY*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIEXYZToRGBi*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: PBool): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIEuvYToCIELuv*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIEuvYToCIEXYZ*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIEuvYToTekHVC*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsCIExyYToCIEXYZ*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsClientWhitePointOfCCC*(para1: TXcmsCCC): PXcmsColor{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsConvertColors*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: TXcmsColorFormat, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsCreateCCC*(para1: PDisplay, para2: int32, para3: PVisual,
|
|
||||||
para4: PXcmsColor, para5: TXcmsCompressionProc,
|
|
||||||
para6: TXPointer, para7: TXcmsWhiteAdjustProc,
|
|
||||||
para8: TXPointer): TXcmsCCC{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsDefaultCCC*(para1: PDisplay, para2: int32): TXcmsCCC{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsDisplayOfCCC*(para1: TXcmsCCC): PDisplay{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsFormatOfPrefix*(para1: cstring): TXcmsColorFormat{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsFreeCCC*(para1: TXcmsCCC){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsLookupColor*(para1: PDisplay, para2: TColormap, para3: cstring,
|
|
||||||
para4: PXcmsColor, para5: PXcmsColor,
|
|
||||||
para6: TXcmsColorFormat): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsPrefixOfFormat*(para1: TXcmsColorFormat): cstring{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsQueryBlack*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsQueryBlue*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsQueryColor*(para1: PDisplay, para2: TColormap, para3: PXcmsColor,
|
|
||||||
para4: TXcmsColorFormat): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsQueryColors*(para1: PDisplay, para2: TColormap, para3: PXcmsColor,
|
|
||||||
para4: int32, para5: TXcmsColorFormat): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsQueryGreen*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsQueryRed*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsQueryWhite*(para1: TXcmsCCC, para2: TXcmsColorFormat, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsRGBiToCIEXYZ*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: PBool): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsRGBiToRGB*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: PBool): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsRGBToRGBi*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: PBool): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsScreenNumberOfCCC*(para1: TXcmsCCC): int32{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsScreenWhitePointOfCCC*(para1: TXcmsCCC): PXcmsColor{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsSetCCCOfColormap*(para1: PDisplay, para2: TColormap, para3: TXcmsCCC): TXcmsCCC{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsSetCompressionProc*(para1: TXcmsCCC, para2: TXcmsCompressionProc,
|
|
||||||
para3: TXPointer): TXcmsCompressionProc{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsSetWhiteAdjustProc*(para1: TXcmsCCC, para2: TXcmsWhiteAdjustProc,
|
|
||||||
para3: TXPointer): TXcmsWhiteAdjustProc{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsSetWhitePoint*(para1: TXcmsCCC, para2: PXcmsColor): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsStoreColor*(para1: PDisplay, para2: TColormap, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsStoreColors*(para1: PDisplay, para2: TColormap, para3: PXcmsColor,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsTekHVCClipC*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsTekHVCClipV*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsTekHVCClipVC*(para1: TXcmsCCC, para2: PXcmsColor, para3: int32,
|
|
||||||
para4: int32, para5: PBool): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XcmsTekHVCQueryMaxC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsTekHVCQueryMaxV*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsTekHVCQueryMaxVC*(para1: TXcmsCCC, para2: TXcmsFloat, para3: PXcmsColor): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsTekHVCQueryMaxVSamples*(para1: TXcmsCCC, para2: TXcmsFloat,
|
|
||||||
para3: PXcmsColor, para4: int32): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsTekHVCQueryMinV*(para1: TXcmsCCC, para2: TXcmsFloat, para3: TXcmsFloat,
|
|
||||||
para4: PXcmsColor): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XcmsTekHVCToCIEuvY*(para1: TXcmsCCC, para2: PXcmsColor, para3: PXcmsColor,
|
|
||||||
para4: int32): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsTekHVCWhiteShiftColors*(para1: TXcmsCCC, para2: PXcmsColor,
|
|
||||||
para3: PXcmsColor, para4: TXcmsColorFormat,
|
|
||||||
para5: PXcmsColor, para6: int32, para7: PBool): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XcmsVisualOfCCC*(para1: TXcmsCCC): PVisual{.cdecl, dynlib: libX11, importc.}
|
|
||||||
# implementation
|
|
||||||
|
|
||||||
proc XcmsUndefinedFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x00000000'i32
|
|
||||||
|
|
||||||
proc XcmsCIEXYZFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x00000001'i32
|
|
||||||
|
|
||||||
proc XcmsCIEuvYFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x00000002'i32
|
|
||||||
|
|
||||||
proc XcmsCIExyYFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x00000003'i32
|
|
||||||
|
|
||||||
proc XcmsCIELabFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x00000004'i32
|
|
||||||
|
|
||||||
proc XcmsCIELuvFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x00000005'i32
|
|
||||||
|
|
||||||
proc XcmsTekHVCFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x00000006'i32
|
|
||||||
|
|
||||||
proc XcmsRGBFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x80000000'i32
|
|
||||||
|
|
||||||
proc XcmsRGBiFormat(): TXcmsColorFormat =
|
|
||||||
result = 0x80000001'i32
|
|
||||||
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc DisplayOfCCC(ccc: TXcmsCCC): PDisplay =
|
|
||||||
result = ccc.dpy
|
|
||||||
|
|
||||||
proc ScreenNumberOfCCC(ccc: TXcmsCCC): int32 =
|
|
||||||
result = ccc.screenNumber
|
|
||||||
|
|
||||||
proc VisualOfCCC(ccc: TXcmsCCC): PVisual =
|
|
||||||
result = ccc.visual
|
|
||||||
|
|
||||||
proc ClientWhitePointOfCCC(ccc: var TXcmsCCC): ptr TXcmsColor =
|
|
||||||
result = addr(ccc.clientWhitePt)
|
|
||||||
|
|
||||||
proc ScreenWhitePointOfCCC(ccc: var TXcmsCCC): ptr TXcmsColor =
|
|
||||||
result = addr(ccc.pPerScrnInfo.screenWhitePt)
|
|
||||||
|
|
||||||
proc FunctionSetOfCCC(ccc: TXcmsCCC): TXpointer =
|
|
||||||
result = ccc.pPerScrnInfo.functionSet
|
|
||||||
|
|
@ -1,235 +0,0 @@
|
||||||
#
|
|
||||||
# Copyright (c) 1999 XFree86 Inc
|
|
||||||
#
|
|
||||||
# $XFree86: xc/include/extensions/xf86dga.h,v 3.20 1999/10/13 04:20:48 dawes Exp $
|
|
||||||
|
|
||||||
import
|
|
||||||
x, xlib
|
|
||||||
|
|
||||||
const
|
|
||||||
libXxf86dga* = "libXxf86dga.so"
|
|
||||||
|
|
||||||
#type
|
|
||||||
# cfloat* = float32
|
|
||||||
|
|
||||||
# $XFree86: xc/include/extensions/xf86dga1.h,v 1.2 1999/04/17 07:05:41 dawes Exp $
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#Copyright (c) 1995 Jon Tombs
|
|
||||||
#Copyright (c) 1995 XFree86 Inc
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#************************************************************************
|
|
||||||
#
|
|
||||||
# THIS IS THE OLD DGA API AND IS OBSOLETE. PLEASE DO NOT USE IT ANYMORE
|
|
||||||
#
|
|
||||||
#************************************************************************
|
|
||||||
|
|
||||||
type
|
|
||||||
PPcchar* = ptr ptr cstring
|
|
||||||
|
|
||||||
const
|
|
||||||
X_XF86DGAQueryVersion* = 0
|
|
||||||
X_XF86DGAGetVideoLL* = 1
|
|
||||||
X_XF86DGADirectVideo* = 2
|
|
||||||
X_XF86DGAGetViewPortSize* = 3
|
|
||||||
X_XF86DGASetViewPort* = 4
|
|
||||||
X_XF86DGAGetVidPage* = 5
|
|
||||||
X_XF86DGASetVidPage* = 6
|
|
||||||
X_XF86DGAInstallColormap* = 7
|
|
||||||
X_XF86DGAQueryDirectVideo* = 8
|
|
||||||
X_XF86DGAViewPortChanged* = 9
|
|
||||||
XF86DGADirectPresent* = 0x00000001
|
|
||||||
XF86DGADirectGraphics* = 0x00000002
|
|
||||||
XF86DGADirectMouse* = 0x00000004
|
|
||||||
XF86DGADirectKeyb* = 0x00000008
|
|
||||||
XF86DGAHasColormap* = 0x00000100
|
|
||||||
XF86DGADirectColormap* = 0x00000200
|
|
||||||
|
|
||||||
proc XF86DGAQueryVersion*(dpy: PDisplay, majorVersion: Pcint,
|
|
||||||
minorVersion: Pcint): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAQueryExtension*(dpy: PDisplay, event_base: Pcint, error_base: Pcint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAGetVideoLL*(dpy: PDisplay, screen: cint, base_addr: Pcint,
|
|
||||||
width: Pcint, bank_size: Pcint, ram_size: Pcint): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAGetVideo*(dpy: PDisplay, screen: cint, base_addr: PPcchar,
|
|
||||||
width: Pcint, bank_size: Pcint, ram_size: Pcint): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGADirectVideo*(dpy: PDisplay, screen: cint, enable: cint): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGADirectVideoLL*(dpy: PDisplay, screen: cint, enable: cint): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAGetViewPortSize*(dpy: PDisplay, screen: cint, width: Pcint,
|
|
||||||
height: Pcint): TStatus{.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGASetViewPort*(dpy: PDisplay, screen: cint, x: cint, y: cint): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAGetVidPage*(dpy: PDisplay, screen: cint, vid_page: Pcint): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGASetVidPage*(dpy: PDisplay, screen: cint, vid_page: cint): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAInstallColormap*(dpy: PDisplay, screen: cint, Colormap: TColormap): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAForkApp*(screen: cint): cint{.cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAQueryDirectVideo*(dpy: PDisplay, screen: cint, flags: Pcint): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XF86DGAViewPortChanged*(dpy: PDisplay, screen: cint, n: cint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
const
|
|
||||||
X_XDGAQueryVersion* = 0 # 1 through 9 are in xf86dga1.pp
|
|
||||||
# 10 and 11 are reserved to avoid conflicts with rogue DGA extensions
|
|
||||||
X_XDGAQueryModes* = 12
|
|
||||||
X_XDGASetMode* = 13
|
|
||||||
X_XDGASetViewport* = 14
|
|
||||||
X_XDGAInstallColormap* = 15
|
|
||||||
X_XDGASelectInput* = 16
|
|
||||||
X_XDGAFillRectangle* = 17
|
|
||||||
X_XDGACopyArea* = 18
|
|
||||||
X_XDGACopyTransparentArea* = 19
|
|
||||||
X_XDGAGetViewportStatus* = 20
|
|
||||||
X_XDGASync* = 21
|
|
||||||
X_XDGAOpenFramebuffer* = 22
|
|
||||||
X_XDGACloseFramebuffer* = 23
|
|
||||||
X_XDGASetClientVersion* = 24
|
|
||||||
X_XDGAChangePixmapMode* = 25
|
|
||||||
X_XDGACreateColormap* = 26
|
|
||||||
XDGAConcurrentAccess* = 0x00000001
|
|
||||||
XDGASolidFillRect* = 0x00000002
|
|
||||||
XDGABlitRect* = 0x00000004
|
|
||||||
XDGABlitTransRect* = 0x00000008
|
|
||||||
XDGAPixmap* = 0x00000010
|
|
||||||
XDGAInterlaced* = 0x00010000
|
|
||||||
XDGADoublescan* = 0x00020000
|
|
||||||
XDGAFlipImmediate* = 0x00000001
|
|
||||||
XDGAFlipRetrace* = 0x00000002
|
|
||||||
XDGANeedRoot* = 0x00000001
|
|
||||||
XF86DGANumberEvents* = 7
|
|
||||||
XDGAPixmapModeLarge* = 0
|
|
||||||
XDGAPixmapModeSmall* = 1
|
|
||||||
XF86DGAClientNotLocal* = 0
|
|
||||||
XF86DGANoDirectVideoMode* = 1
|
|
||||||
XF86DGAScreenNotActive* = 2
|
|
||||||
XF86DGADirectNotActivated* = 3
|
|
||||||
XF86DGAOperationNotSupported* = 4
|
|
||||||
XF86DGANumberErrors* = (XF86DGAOperationNotSupported + 1)
|
|
||||||
|
|
||||||
type
|
|
||||||
PXDGAMode* = ptr TXDGAMode
|
|
||||||
TXDGAMode*{.final.} = object
|
|
||||||
num*: cint # A unique identifier for the mode (num > 0)
|
|
||||||
name*: cstring # name of mode given in the XF86Config
|
|
||||||
verticalRefresh*: cfloat
|
|
||||||
flags*: cint # DGA_CONCURRENT_ACCESS, etc...
|
|
||||||
imageWidth*: cint # linear accessible portion (pixels)
|
|
||||||
imageHeight*: cint
|
|
||||||
pixmapWidth*: cint # Xlib accessible portion (pixels)
|
|
||||||
pixmapHeight*: cint # both fields ignored if no concurrent access
|
|
||||||
bytesPerScanline*: cint
|
|
||||||
byteOrder*: cint # MSBFirst, LSBFirst
|
|
||||||
depth*: cint
|
|
||||||
bitsPerPixel*: cint
|
|
||||||
redMask*: culong
|
|
||||||
greenMask*: culong
|
|
||||||
blueMask*: culong
|
|
||||||
visualClass*: cshort
|
|
||||||
viewportWidth*: cint
|
|
||||||
viewportHeight*: cint
|
|
||||||
xViewportStep*: cint # viewport position granularity
|
|
||||||
yViewportStep*: cint
|
|
||||||
maxViewportX*: cint # max viewport origin
|
|
||||||
maxViewportY*: cint
|
|
||||||
viewportFlags*: cint # types of page flipping possible
|
|
||||||
reserved1*: cint
|
|
||||||
reserved2*: cint
|
|
||||||
|
|
||||||
PXDGADevice* = ptr TXDGADevice
|
|
||||||
TXDGADevice*{.final.} = object
|
|
||||||
mode*: TXDGAMode
|
|
||||||
data*: Pcuchar
|
|
||||||
pixmap*: TPixmap
|
|
||||||
|
|
||||||
PXDGAButtonEvent* = ptr TXDGAButtonEvent
|
|
||||||
TXDGAButtonEvent*{.final.} = object
|
|
||||||
theType*: cint
|
|
||||||
serial*: culong
|
|
||||||
display*: PDisplay
|
|
||||||
screen*: cint
|
|
||||||
time*: TTime
|
|
||||||
state*: cuint
|
|
||||||
button*: cuint
|
|
||||||
|
|
||||||
PXDGAKeyEvent* = ptr TXDGAKeyEvent
|
|
||||||
TXDGAKeyEvent*{.final.} = object
|
|
||||||
theType*: cint
|
|
||||||
serial*: culong
|
|
||||||
display*: PDisplay
|
|
||||||
screen*: cint
|
|
||||||
time*: TTime
|
|
||||||
state*: cuint
|
|
||||||
keycode*: cuint
|
|
||||||
|
|
||||||
PXDGAMotionEvent* = ptr TXDGAMotionEvent
|
|
||||||
TXDGAMotionEvent*{.final.} = object
|
|
||||||
theType*: cint
|
|
||||||
serial*: culong
|
|
||||||
display*: PDisplay
|
|
||||||
screen*: cint
|
|
||||||
time*: TTime
|
|
||||||
state*: cuint
|
|
||||||
dx*: cint
|
|
||||||
dy*: cint
|
|
||||||
|
|
||||||
PXDGAEvent* = ptr TXDGAEvent
|
|
||||||
TXDGAEvent*{.final.} = object
|
|
||||||
pad*: array[0..23, clong] # sorry you have to cast if you want access
|
|
||||||
#Case LongInt Of
|
|
||||||
# 0 : (_type : cint);
|
|
||||||
# 1 : (xbutton : TXDGAButtonEvent);
|
|
||||||
# 2 : (xkey : TXDGAKeyEvent);
|
|
||||||
# 3 : (xmotion : TXDGAMotionEvent);
|
|
||||||
# 4 : (pad : Array[0..23] Of clong);
|
|
||||||
|
|
||||||
|
|
||||||
proc XDGAQueryExtension*(dpy: PDisplay, eventBase: Pcint, erroBase: Pcint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGAQueryVersion*(dpy: PDisplay, majorVersion: Pcint, minorVersion: Pcint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGAQueryModes*(dpy: PDisplay, screen: cint, num: Pcint): PXDGAMode{.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGASetMode*(dpy: PDisplay, screen: cint, mode: cint): PXDGADevice{.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGAOpenFramebuffer*(dpy: PDisplay, screen: cint): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGACloseFramebuffer*(dpy: PDisplay, screen: cint){.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGASetViewport*(dpy: PDisplay, screen: cint, x: cint, y: cint, flags: cint){.
|
|
||||||
cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGAInstallColormap*(dpy: PDisplay, screen: cint, cmap: TColormap){.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGACreateColormap*(dpy: PDisplay, screen: cint, device: PXDGADevice,
|
|
||||||
alloc: cint): TColormap{.cdecl, dynlib: libXxf86dga,
|
|
||||||
importc.}
|
|
||||||
proc XDGASelectInput*(dpy: PDisplay, screen: cint, event_mask: clong){.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGAFillRectangle*(dpy: PDisplay, screen: cint, x: cint, y: cint,
|
|
||||||
width: cuint, height: cuint, color: culong){.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGACopyArea*(dpy: PDisplay, screen: cint, srcx: cint, srcy: cint,
|
|
||||||
width: cuint, height: cuint, dstx: cint, dsty: cint){.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGACopyTransparentArea*(dpy: PDisplay, screen: cint, srcx: cint,
|
|
||||||
srcy: cint, width: cuint, height: cuint,
|
|
||||||
dstx: cint, dsty: cint, key: culong){.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGAGetViewportStatus*(dpy: PDisplay, screen: cint): cint{.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGASync*(dpy: PDisplay, screen: cint){.cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGASetClientVersion*(dpy: PDisplay): TBool{.cdecl, dynlib: libXxf86dga,
|
|
||||||
importc.}
|
|
||||||
proc XDGAChangePixmapMode*(dpy: PDisplay, screen: cint, x: Pcint, y: Pcint,
|
|
||||||
mode: cint){.cdecl, dynlib: libXxf86dga, importc.}
|
|
||||||
proc XDGAKeyEventToXKeyEvent*(dk: PXDGAKeyEvent, xk: PXKeyEvent){.cdecl,
|
|
||||||
dynlib: libXxf86dga, importc.}
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,229 +0,0 @@
|
||||||
# $XFree86: xc/include/extensions/xf86vmode.h,v 3.30 2001/05/07 20:09:50 mvojkovi Exp $
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#Copyright 1995 Kaleb S. KEITHLEY
|
|
||||||
#
|
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
#a copy of this software and associated documentation files (the
|
|
||||||
#"Software"), to deal in the Software without restriction, including
|
|
||||||
#without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
#distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
#permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
#the following conditions:
|
|
||||||
#
|
|
||||||
#The above copyright notice and this permission notice shall be
|
|
||||||
#included in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
#EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
#IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
|
|
||||||
#OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
||||||
#ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
#OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
#Except as contained in this notice, the name of Kaleb S. KEITHLEY
|
|
||||||
#shall not be used in advertising or otherwise to promote the sale, use
|
|
||||||
#or other dealings in this Software without prior written authorization
|
|
||||||
#from Kaleb S. KEITHLEY
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# $Xorg: xf86vmode.h,v 1.3 2000/08/18 04:05:46 coskrey Exp $
|
|
||||||
# THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION
|
|
||||||
|
|
||||||
import
|
|
||||||
x, xlib
|
|
||||||
|
|
||||||
const
|
|
||||||
libXxf86vm* = "libXxf86vm.so"
|
|
||||||
|
|
||||||
type
|
|
||||||
PINT32* = ptr int32
|
|
||||||
|
|
||||||
const
|
|
||||||
X_XF86VidModeQueryVersion* = 0
|
|
||||||
X_XF86VidModeGetModeLine* = 1
|
|
||||||
X_XF86VidModeModModeLine* = 2
|
|
||||||
X_XF86VidModeSwitchMode* = 3
|
|
||||||
X_XF86VidModeGetMonitor* = 4
|
|
||||||
X_XF86VidModeLockModeSwitch* = 5
|
|
||||||
X_XF86VidModeGetAllModeLines* = 6
|
|
||||||
X_XF86VidModeAddModeLine* = 7
|
|
||||||
X_XF86VidModeDeleteModeLine* = 8
|
|
||||||
X_XF86VidModeValidateModeLine* = 9
|
|
||||||
X_XF86VidModeSwitchToMode* = 10
|
|
||||||
X_XF86VidModeGetViewPort* = 11
|
|
||||||
X_XF86VidModeSetViewPort* = 12 # new for version 2.x of this extension
|
|
||||||
X_XF86VidModeGetDotClocks* = 13
|
|
||||||
X_XF86VidModeSetClientVersion* = 14
|
|
||||||
X_XF86VidModeSetGamma* = 15
|
|
||||||
X_XF86VidModeGetGamma* = 16
|
|
||||||
X_XF86VidModeGetGammaRamp* = 17
|
|
||||||
X_XF86VidModeSetGammaRamp* = 18
|
|
||||||
X_XF86VidModeGetGammaRampSize* = 19
|
|
||||||
X_XF86VidModeGetPermissions* = 20
|
|
||||||
CLKFLAG_PROGRAMABLE* = 1
|
|
||||||
|
|
||||||
when defined(XF86VIDMODE_EVENTS):
|
|
||||||
const
|
|
||||||
XF86VidModeNotify* = 0
|
|
||||||
XF86VidModeNumberEvents* = (XF86VidModeNotify + 1)
|
|
||||||
XF86VidModeNotifyMask* = 0x00000001
|
|
||||||
XF86VidModeNonEvent* = 0
|
|
||||||
XF86VidModeModeChange* = 1
|
|
||||||
else:
|
|
||||||
const
|
|
||||||
XF86VidModeNumberEvents* = 0
|
|
||||||
const
|
|
||||||
XF86VidModeBadClock* = 0
|
|
||||||
XF86VidModeBadHTimings* = 1
|
|
||||||
XF86VidModeBadVTimings* = 2
|
|
||||||
XF86VidModeModeUnsuitable* = 3
|
|
||||||
XF86VidModeExtensionDisabled* = 4
|
|
||||||
XF86VidModeClientNotLocal* = 5
|
|
||||||
XF86VidModeZoomLocked* = 6
|
|
||||||
XF86VidModeNumberErrors* = (XF86VidModeZoomLocked + 1)
|
|
||||||
XF86VM_READ_PERMISSION* = 1
|
|
||||||
XF86VM_WRITE_PERMISSION* = 2
|
|
||||||
|
|
||||||
type
|
|
||||||
PXF86VidModeModeLine* = ptr TXF86VidModeModeLine
|
|
||||||
TXF86VidModeModeLine*{.final.} = object
|
|
||||||
hdisplay*: cushort
|
|
||||||
hsyncstart*: cushort
|
|
||||||
hsyncend*: cushort
|
|
||||||
htotal*: cushort
|
|
||||||
hskew*: cushort
|
|
||||||
vdisplay*: cushort
|
|
||||||
vsyncstart*: cushort
|
|
||||||
vsyncend*: cushort
|
|
||||||
vtotal*: cushort
|
|
||||||
flags*: cuint
|
|
||||||
privsize*: cint
|
|
||||||
c_private*: PINT32
|
|
||||||
|
|
||||||
PPPXF86VidModeModeInfo* = ptr PPXF86VidModeModeInfo
|
|
||||||
PPXF86VidModeModeInfo* = ptr PXF86VidModeModeInfo
|
|
||||||
PXF86VidModeModeInfo* = ptr TXF86VidModeModeInfo
|
|
||||||
TXF86VidModeModeInfo*{.final.} = object
|
|
||||||
dotclock*: cuint
|
|
||||||
hdisplay*: cushort
|
|
||||||
hsyncstart*: cushort
|
|
||||||
hsyncend*: cushort
|
|
||||||
htotal*: cushort
|
|
||||||
hskew*: cushort
|
|
||||||
vdisplay*: cushort
|
|
||||||
vsyncstart*: cushort
|
|
||||||
vsyncend*: cushort
|
|
||||||
vtotal*: cushort
|
|
||||||
flags*: cuint
|
|
||||||
privsize*: cint
|
|
||||||
c_private*: PINT32
|
|
||||||
|
|
||||||
PXF86VidModeSyncRange* = ptr TXF86VidModeSyncRange
|
|
||||||
TXF86VidModeSyncRange*{.final.} = object
|
|
||||||
hi*: cfloat
|
|
||||||
lo*: cfloat
|
|
||||||
|
|
||||||
PXF86VidModeMonitor* = ptr TXF86VidModeMonitor
|
|
||||||
TXF86VidModeMonitor*{.final.} = object
|
|
||||||
vendor*: cstring
|
|
||||||
model*: cstring
|
|
||||||
EMPTY*: cfloat
|
|
||||||
nhsync*: cuchar
|
|
||||||
hsync*: PXF86VidModeSyncRange
|
|
||||||
nvsync*: cuchar
|
|
||||||
vsync*: PXF86VidModeSyncRange
|
|
||||||
|
|
||||||
PXF86VidModeNotifyEvent* = ptr TXF86VidModeNotifyEvent
|
|
||||||
TXF86VidModeNotifyEvent*{.final.} = object
|
|
||||||
theType*: cint # of event
|
|
||||||
serial*: culong # # of last request processed by server
|
|
||||||
send_event*: TBool # true if this came from a SendEvent req
|
|
||||||
display*: PDisplay # Display the event was read from
|
|
||||||
root*: TWindow # root window of event screen
|
|
||||||
state*: cint # What happened
|
|
||||||
kind*: cint # What happened
|
|
||||||
forced*: TBool # extents of new region
|
|
||||||
time*: TTime # event timestamp
|
|
||||||
|
|
||||||
PXF86VidModeGamma* = ptr TXF86VidModeGamma
|
|
||||||
TXF86VidModeGamma*{.final.} = object
|
|
||||||
red*: cfloat # Red Gamma value
|
|
||||||
green*: cfloat # Green Gamma value
|
|
||||||
blue*: cfloat # Blue Gamma value
|
|
||||||
|
|
||||||
|
|
||||||
when defined(MACROS):
|
|
||||||
proc XF86VidModeSelectNextMode*(disp: PDisplay, scr: cint): TBool
|
|
||||||
proc XF86VidModeSelectPrevMode*(disp: PDisplay, scr: cint): TBool
|
|
||||||
proc XF86VidModeQueryVersion*(dpy: PDisplay, majorVersion: Pcint,
|
|
||||||
minorVersion: Pcint): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeQueryExtension*(dpy: PDisplay, event_base: Pcint,
|
|
||||||
error_base: Pcint): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeSetClientVersion*(dpy: PDisplay): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetModeLine*(dpy: PDisplay, screen: cint, dotclock: Pcint,
|
|
||||||
modeline: PXF86VidModeModeLine): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetAllModeLines*(dpy: PDisplay, screen: cint, modecount: Pcint,
|
|
||||||
modelinesPtr: PPPXF86VidModeModeInfo): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeAddModeLine*(dpy: PDisplay, screen: cint,
|
|
||||||
new_modeline: PXF86VidModeModeInfo,
|
|
||||||
after_modeline: PXF86VidModeModeInfo): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeDeleteModeLine*(dpy: PDisplay, screen: cint,
|
|
||||||
modeline: PXF86VidModeModeInfo): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeModModeLine*(dpy: PDisplay, screen: cint,
|
|
||||||
modeline: PXF86VidModeModeLine): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeValidateModeLine*(dpy: PDisplay, screen: cint,
|
|
||||||
modeline: PXF86VidModeModeInfo): TStatus{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeSwitchMode*(dpy: PDisplay, screen: cint, zoom: cint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeSwitchToMode*(dpy: PDisplay, screen: cint,
|
|
||||||
modeline: PXF86VidModeModeInfo): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeLockModeSwitch*(dpy: PDisplay, screen: cint, lock: cint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetMonitor*(dpy: PDisplay, screen: cint,
|
|
||||||
monitor: PXF86VidModeMonitor): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetViewPort*(dpy: PDisplay, screen: cint, x_return: Pcint,
|
|
||||||
y_return: Pcint): TBool{.cdecl, dynlib: libXxf86vm,
|
|
||||||
importc.}
|
|
||||||
proc XF86VidModeSetViewPort*(dpy: PDisplay, screen: cint, x: cint, y: cint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetDotClocks*(dpy: PDisplay, screen: cint, flags_return: Pcint,
|
|
||||||
number_of_clocks_return: Pcint,
|
|
||||||
max_dot_clock_return: Pcint, clocks_return: PPcint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetGamma*(dpy: PDisplay, screen: cint, Gamma: PXF86VidModeGamma): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeSetGamma*(dpy: PDisplay, screen: cint, Gamma: PXF86VidModeGamma): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeSetGammaRamp*(dpy: PDisplay, screen: cint, size: cint,
|
|
||||||
red_array: Pcushort, green_array: Pcushort,
|
|
||||||
blue_array: Pcushort): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetGammaRamp*(dpy: PDisplay, screen: cint, size: cint,
|
|
||||||
red_array: Pcushort, green_array: Pcushort,
|
|
||||||
blue_array: Pcushort): TBool{.cdecl,
|
|
||||||
dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetGammaRampSize*(dpy: PDisplay, screen: cint, size: Pcint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
proc XF86VidModeGetPermissions*(dpy: PDisplay, screen: cint, permissions: Pcint): TBool{.
|
|
||||||
cdecl, dynlib: libXxf86vm, importc.}
|
|
||||||
# implementation
|
|
||||||
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc XF86VidModeSelectNextMode(disp: PDisplay, scr: cint): TBool =
|
|
||||||
XF86VidModeSwitchMode(disp, scr, 1)
|
|
||||||
|
|
||||||
proc XF86VidModeSelectPrevMode(disp: PDisplay, scr: cint): TBool =
|
|
||||||
XF86VidModeSwitchMode(disp, scr, - 1)
|
|
||||||
|
|
@ -1,307 +0,0 @@
|
||||||
#
|
|
||||||
# $Xorg: XI.h,v 1.4 2001/02/09 02:03:23 xorgcvs Exp $
|
|
||||||
#
|
|
||||||
#************************************************************
|
|
||||||
#
|
|
||||||
#Copyright 1989, 1998 The Open Group
|
|
||||||
#
|
|
||||||
#Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
#documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
#the above copyright notice appear in all copies and that both that
|
|
||||||
#copyright notice and this permission notice appear in supporting
|
|
||||||
#documentation.
|
|
||||||
#
|
|
||||||
#The above copyright notice and this permission notice shall be included in
|
|
||||||
#all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
#OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
#AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
#CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
#Except as contained in this notice, the name of The Open Group shall not be
|
|
||||||
#used in advertising or otherwise to promote the sale, use or other dealings
|
|
||||||
#in this Software without prior written authorization from The Open Group.
|
|
||||||
#
|
|
||||||
#Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
|
||||||
#
|
|
||||||
# All Rights Reserved
|
|
||||||
#
|
|
||||||
#Permission to use, copy, modify, and distribute this software and its
|
|
||||||
#documentation for any purpose and without fee is hereby granted,
|
|
||||||
#provided that the above copyright notice appear in all copies and that
|
|
||||||
#both that copyright notice and this permission notice appear in
|
|
||||||
#supporting documentation, and that the name of Hewlett-Packard not be
|
|
||||||
#used in advertising or publicity pertaining to distribution of the
|
|
||||||
#software without specific, written prior permission.
|
|
||||||
#
|
|
||||||
#HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
||||||
#ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
||||||
#HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
||||||
#ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
||||||
#WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
||||||
#ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
||||||
#SOFTWARE.
|
|
||||||
#
|
|
||||||
#********************************************************/
|
|
||||||
# $XFree86: xc/include/extensions/XI.h,v 1.5 2001/12/14 19:53:28 dawes Exp $
|
|
||||||
#
|
|
||||||
# Definitions used by the server, library and client
|
|
||||||
#
|
|
||||||
# Pascal Convertion was made by Ido Kannner - kanerido@actcom.net.il
|
|
||||||
#
|
|
||||||
#Histroy:
|
|
||||||
# 2004/10/15 - Fixed a bug of accessing second based records by removing "paced record" and chnaged it to
|
|
||||||
# "reocrd" only.
|
|
||||||
# 2004/10/07 - Removed the "uses X;" line. The unit does not need it.
|
|
||||||
# 2004/10/03 - Conversion from C header to Pascal unit.
|
|
||||||
#
|
|
||||||
|
|
||||||
const
|
|
||||||
sz_xGetExtensionVersionReq* = 8
|
|
||||||
sz_xGetExtensionVersionReply* = 32
|
|
||||||
sz_xListInputDevicesReq* = 4
|
|
||||||
sz_xListInputDevicesReply* = 32
|
|
||||||
sz_xOpenDeviceReq* = 8
|
|
||||||
sz_xOpenDeviceReply* = 32
|
|
||||||
sz_xCloseDeviceReq* = 8
|
|
||||||
sz_xSetDeviceModeReq* = 8
|
|
||||||
sz_xSetDeviceModeReply* = 32
|
|
||||||
sz_xSelectExtensionEventReq* = 12
|
|
||||||
sz_xGetSelectedExtensionEventsReq* = 8
|
|
||||||
sz_xGetSelectedExtensionEventsReply* = 32
|
|
||||||
sz_xChangeDeviceDontPropagateListReq* = 12
|
|
||||||
sz_xGetDeviceDontPropagateListReq* = 8
|
|
||||||
sz_xGetDeviceDontPropagateListReply* = 32
|
|
||||||
sz_xGetDeviceMotionEventsReq* = 16
|
|
||||||
sz_xGetDeviceMotionEventsReply* = 32
|
|
||||||
sz_xChangeKeyboardDeviceReq* = 8
|
|
||||||
sz_xChangeKeyboardDeviceReply* = 32
|
|
||||||
sz_xChangePointerDeviceReq* = 8
|
|
||||||
sz_xChangePointerDeviceReply* = 32
|
|
||||||
sz_xGrabDeviceReq* = 20
|
|
||||||
sz_xGrabDeviceReply* = 32
|
|
||||||
sz_xUngrabDeviceReq* = 12
|
|
||||||
sz_xGrabDeviceKeyReq* = 20
|
|
||||||
sz_xGrabDeviceKeyReply* = 32
|
|
||||||
sz_xUngrabDeviceKeyReq* = 16
|
|
||||||
sz_xGrabDeviceButtonReq* = 20
|
|
||||||
sz_xGrabDeviceButtonReply* = 32
|
|
||||||
sz_xUngrabDeviceButtonReq* = 16
|
|
||||||
sz_xAllowDeviceEventsReq* = 12
|
|
||||||
sz_xGetDeviceFocusReq* = 8
|
|
||||||
sz_xGetDeviceFocusReply* = 32
|
|
||||||
sz_xSetDeviceFocusReq* = 16
|
|
||||||
sz_xGetFeedbackControlReq* = 8
|
|
||||||
sz_xGetFeedbackControlReply* = 32
|
|
||||||
sz_xChangeFeedbackControlReq* = 12
|
|
||||||
sz_xGetDeviceKeyMappingReq* = 8
|
|
||||||
sz_xGetDeviceKeyMappingReply* = 32
|
|
||||||
sz_xChangeDeviceKeyMappingReq* = 8
|
|
||||||
sz_xGetDeviceModifierMappingReq* = 8
|
|
||||||
sz_xSetDeviceModifierMappingReq* = 8
|
|
||||||
sz_xSetDeviceModifierMappingReply* = 32
|
|
||||||
sz_xGetDeviceButtonMappingReq* = 8
|
|
||||||
sz_xGetDeviceButtonMappingReply* = 32
|
|
||||||
sz_xSetDeviceButtonMappingReq* = 8
|
|
||||||
sz_xSetDeviceButtonMappingReply* = 32
|
|
||||||
sz_xQueryDeviceStateReq* = 8
|
|
||||||
sz_xQueryDeviceStateReply* = 32
|
|
||||||
sz_xSendExtensionEventReq* = 16
|
|
||||||
sz_xDeviceBellReq* = 8
|
|
||||||
sz_xSetDeviceValuatorsReq* = 8
|
|
||||||
sz_xSetDeviceValuatorsReply* = 32
|
|
||||||
sz_xGetDeviceControlReq* = 8
|
|
||||||
sz_xGetDeviceControlReply* = 32
|
|
||||||
sz_xChangeDeviceControlReq* = 8
|
|
||||||
sz_xChangeDeviceControlReply* = 32
|
|
||||||
|
|
||||||
const
|
|
||||||
INAME* = "XInputExtension"
|
|
||||||
|
|
||||||
const
|
|
||||||
XI_KEYBOARD* = "KEYBOARD"
|
|
||||||
XI_MOUSE* = "MOUSE"
|
|
||||||
XI_TABLET* = "TABLET"
|
|
||||||
XI_TOUCHSCREEN* = "TOUCHSCREEN"
|
|
||||||
XI_TOUCHPAD* = "TOUCHPAD"
|
|
||||||
XI_BARCODE* = "BARCODE"
|
|
||||||
XI_BUTTONBOX* = "BUTTONBOX"
|
|
||||||
XI_KNOB_BOX* = "KNOB_BOX"
|
|
||||||
XI_ONE_KNOB* = "ONE_KNOB"
|
|
||||||
XI_NINE_KNOB* = "NINE_KNOB"
|
|
||||||
XI_TRACKBALL* = "TRACKBALL"
|
|
||||||
XI_QUADRATURE* = "QUADRATURE"
|
|
||||||
XI_ID_MODULE* = "ID_MODULE"
|
|
||||||
XI_SPACEBALL* = "SPACEBALL"
|
|
||||||
XI_DATAGLOVE* = "DATAGLOVE"
|
|
||||||
XI_EYETRACKER* = "EYETRACKER"
|
|
||||||
XI_CURSORKEYS* = "CURSORKEYS"
|
|
||||||
XI_FOOTMOUSE* = "FOOTMOUSE"
|
|
||||||
|
|
||||||
const
|
|
||||||
Dont_Check* = 0
|
|
||||||
XInput_Initial_Release* = 1
|
|
||||||
XInput_Add_XDeviceBell* = 2
|
|
||||||
XInput_Add_XSetDeviceValuators* = 3
|
|
||||||
XInput_Add_XChangeDeviceControl* = 4
|
|
||||||
|
|
||||||
const
|
|
||||||
XI_Absent* = 0
|
|
||||||
XI_Present* = 1
|
|
||||||
|
|
||||||
const
|
|
||||||
XI_Initial_Release_Major* = 1
|
|
||||||
XI_Initial_Release_Minor* = 0
|
|
||||||
|
|
||||||
const
|
|
||||||
XI_Add_XDeviceBell_Major* = 1
|
|
||||||
XI_Add_XDeviceBell_Minor* = 1
|
|
||||||
|
|
||||||
const
|
|
||||||
XI_Add_XSetDeviceValuators_Major* = 1
|
|
||||||
XI_Add_XSetDeviceValuators_Minor* = 2
|
|
||||||
|
|
||||||
const
|
|
||||||
XI_Add_XChangeDeviceControl_Major* = 1
|
|
||||||
XI_Add_XChangeDeviceControl_Minor* = 3
|
|
||||||
|
|
||||||
const
|
|
||||||
DEVICE_RESOLUTION* = 1
|
|
||||||
|
|
||||||
const
|
|
||||||
NoSuchExtension* = 1
|
|
||||||
|
|
||||||
const
|
|
||||||
COUNT* = 0
|
|
||||||
CREATE* = 1
|
|
||||||
|
|
||||||
const
|
|
||||||
NewPointer* = 0
|
|
||||||
NewKeyboard* = 1
|
|
||||||
|
|
||||||
const
|
|
||||||
XPOINTER* = 0
|
|
||||||
XKEYBOARD* = 1
|
|
||||||
|
|
||||||
const
|
|
||||||
UseXKeyboard* = 0x000000FF
|
|
||||||
|
|
||||||
const
|
|
||||||
IsXPointer* = 0
|
|
||||||
IsXKeyboard* = 1
|
|
||||||
IsXExtensionDevice* = 2
|
|
||||||
|
|
||||||
const
|
|
||||||
AsyncThisDevice* = 0
|
|
||||||
SyncThisDevice* = 1
|
|
||||||
ReplayThisDevice* = 2
|
|
||||||
AsyncOtherDevices* = 3
|
|
||||||
AsyncAll* = 4
|
|
||||||
SyncAll* = 5
|
|
||||||
|
|
||||||
const
|
|
||||||
FollowKeyboard* = 3
|
|
||||||
RevertToFollowKeyboard* = 3
|
|
||||||
|
|
||||||
const
|
|
||||||
DvAccelNum* = int(1) shl 0
|
|
||||||
DvAccelDenom* = int(1) shl 1
|
|
||||||
DvThreshold* = int(1) shl 2
|
|
||||||
|
|
||||||
const
|
|
||||||
DvKeyClickPercent* = int(1) shl 0
|
|
||||||
DvPercent* = int(1) shl 1
|
|
||||||
DvPitch* = int(1) shl 2
|
|
||||||
DvDuration* = int(1) shl 3
|
|
||||||
DvLed* = int(1) shl 4
|
|
||||||
DvLedMode* = int(1) shl 5
|
|
||||||
DvKey* = int(1) shl 6
|
|
||||||
DvAutoRepeatMode* = 1 shl 7
|
|
||||||
|
|
||||||
const
|
|
||||||
DvString* = int(1) shl 0
|
|
||||||
|
|
||||||
const
|
|
||||||
DvInteger* = int(1) shl 0
|
|
||||||
|
|
||||||
const
|
|
||||||
DeviceMode* = int(1) shl 0
|
|
||||||
Relative* = 0
|
|
||||||
Absolute* = 1 # Merged from Metrolink tree for XINPUT stuff
|
|
||||||
TS_Raw* = 57
|
|
||||||
TS_Scaled* = 58
|
|
||||||
SendCoreEvents* = 59
|
|
||||||
DontSendCoreEvents* = 60 # End of merged section
|
|
||||||
|
|
||||||
const
|
|
||||||
ProximityState* = int(1) shl 1
|
|
||||||
InProximity* = int(0) shl 1
|
|
||||||
OutOfProximity* = int(1) shl 1
|
|
||||||
|
|
||||||
const
|
|
||||||
AddToList* = 0
|
|
||||||
DeleteFromList* = 1
|
|
||||||
|
|
||||||
const
|
|
||||||
KeyClass* = 0
|
|
||||||
ButtonClass* = 1
|
|
||||||
ValuatorClass* = 2
|
|
||||||
FeedbackClass* = 3
|
|
||||||
ProximityClass* = 4
|
|
||||||
FocusClass* = 5
|
|
||||||
OtherClass* = 6
|
|
||||||
|
|
||||||
const
|
|
||||||
KbdFeedbackClass* = 0
|
|
||||||
PtrFeedbackClass* = 1
|
|
||||||
StringFeedbackClass* = 2
|
|
||||||
IntegerFeedbackClass* = 3
|
|
||||||
LedFeedbackClass* = 4
|
|
||||||
BellFeedbackClass* = 5
|
|
||||||
|
|
||||||
const
|
|
||||||
devicePointerMotionHint* = 0
|
|
||||||
deviceButton1Motion* = 1
|
|
||||||
deviceButton2Motion* = 2
|
|
||||||
deviceButton3Motion* = 3
|
|
||||||
deviceButton4Motion* = 4
|
|
||||||
deviceButton5Motion* = 5
|
|
||||||
deviceButtonMotion* = 6
|
|
||||||
deviceButtonGrab* = 7
|
|
||||||
deviceOwnerGrabButton* = 8
|
|
||||||
noExtensionEvent* = 9
|
|
||||||
|
|
||||||
const
|
|
||||||
XI_BadDevice* = 0
|
|
||||||
XI_BadEvent* = 1
|
|
||||||
XI_BadMode* = 2
|
|
||||||
XI_DeviceBusy* = 3
|
|
||||||
XI_BadClass* = 4 # Make XEventClass be a CARD32 for 64 bit servers. Don't affect client
|
|
||||||
# definition of XEventClass since that would be a library interface change.
|
|
||||||
# See the top of X.h for more _XSERVER64 magic.
|
|
||||||
#
|
|
||||||
|
|
||||||
when defined(XSERVER64):
|
|
||||||
type
|
|
||||||
XEventClass* = CARD32
|
|
||||||
else:
|
|
||||||
type
|
|
||||||
XEventClass* = int32
|
|
||||||
#******************************************************************
|
|
||||||
# *
|
|
||||||
# * Extension version structure.
|
|
||||||
# *
|
|
||||||
#
|
|
||||||
|
|
||||||
type
|
|
||||||
PXExtensionVersion* = ptr TXExtensionVersion
|
|
||||||
TXExtensionVersion*{.final.} = object
|
|
||||||
present*: int16
|
|
||||||
major_version*: int16
|
|
||||||
minor_version*: int16
|
|
||||||
|
|
||||||
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
# Converted from X11/Xinerama.h
|
|
||||||
import
|
|
||||||
xlib
|
|
||||||
|
|
||||||
const
|
|
||||||
xineramaLib = "libXinerama.so"
|
|
||||||
|
|
||||||
type
|
|
||||||
PXineramaScreenInfo* = ptr TXineramaScreenInfo
|
|
||||||
TXineramaScreenInfo*{.final.} = object
|
|
||||||
screen_number*: cint
|
|
||||||
x_org*: int16
|
|
||||||
y_org*: int16
|
|
||||||
width*: int16
|
|
||||||
height*: int16
|
|
||||||
|
|
||||||
|
|
||||||
proc XineramaQueryExtension*(dpy: PDisplay, event_base: Pcint, error_base: Pcint): TBool{.
|
|
||||||
cdecl, dynlib: xineramaLib, importc.}
|
|
||||||
proc XineramaQueryVersion*(dpy: PDisplay, major: Pcint, minor: Pcint): TStatus{.
|
|
||||||
cdecl, dynlib: xineramaLib, importc.}
|
|
||||||
proc XineramaIsActive*(dpy: PDisplay): TBool{.cdecl, dynlib: xineramaLib, importc.}
|
|
||||||
proc XineramaQueryScreens*(dpy: PDisplay, number: Pcint): PXineramaScreenInfo{.
|
|
||||||
cdecl, dynlib: xineramaLib, importc.}
|
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,661 +0,0 @@
|
||||||
# $Xorg: XKBlib.h,v 1.6 2000/08/17 19:45:03 cpqbld Exp $
|
|
||||||
#************************************************************
|
|
||||||
#Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
|
||||||
#
|
|
||||||
#Permission to use, copy, modify, and distribute this
|
|
||||||
#software and its documentation for any purpose and without
|
|
||||||
#fee is hereby granted, provided that the above copyright
|
|
||||||
#notice appear in all copies and that both that copyright
|
|
||||||
#notice and this permission notice appear in supporting
|
|
||||||
#documentation, and that the name of Silicon Graphics not be
|
|
||||||
#used in advertising or publicity pertaining to distribution
|
|
||||||
#of the software without specific prior written permission.
|
|
||||||
#Silicon Graphics makes no representation about the suitability
|
|
||||||
#of this software for any purpose. It is provided "as is"
|
|
||||||
#without any express or implied warranty.
|
|
||||||
#
|
|
||||||
#SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
||||||
#SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
||||||
#AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
|
||||||
#GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
|
||||||
#DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING `from` LOSS OF USE,
|
|
||||||
#DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
||||||
#OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
|
||||||
#THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
#
|
|
||||||
#********************************************************/
|
|
||||||
# $XFree86: xc/lib/X11/XKBlib.h,v 3.3 2001/08/01 00:44:38 tsi Exp $
|
|
||||||
#
|
|
||||||
# Pascal Convertion was made by Ido Kannner - kanerido@actcom.net.il
|
|
||||||
#
|
|
||||||
#Thanks:
|
|
||||||
# I want to thanks to oliebol for putting up with all of the problems that was found
|
|
||||||
# while translating this code. ;)
|
|
||||||
#
|
|
||||||
# I want to thanks #fpc channel in freenode irc, for helping me, and to put up with my
|
|
||||||
# weird questions ;)
|
|
||||||
#
|
|
||||||
# Thanks for mmc in #xlib on freenode irc And so for the channel itself for the helping me to
|
|
||||||
# understanding some of the problems I had converting this headers and pointing me to resources
|
|
||||||
# that helped translating this headers.
|
|
||||||
#
|
|
||||||
# Ido
|
|
||||||
#
|
|
||||||
#History:
|
|
||||||
# 2004/10/15 - Fixed a bug of accessing second based records by removing "paced record" and
|
|
||||||
# chnaged it to "reocrd" only.
|
|
||||||
# 2004/10/10 - Added to TXkbGetAtomNameFunc and TXkbInternAtomFunc the cdecl call.
|
|
||||||
# 2004/10/06 - 09 - Convertion `from` the c header of XKBlib.h
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
import
|
|
||||||
X, Xlib, XKB
|
|
||||||
|
|
||||||
|
|
||||||
include "x11pragma.nim"
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbAnyEvent* = ptr TXkbAnyEvent
|
|
||||||
TXkbAnyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds;
|
|
||||||
xkb_type*: int16 # XKB event minor code
|
|
||||||
device*: int16 # device ID
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbNewKeyboardNotifyEvent* = ptr TXkbNewKeyboardNotifyEvent
|
|
||||||
TXkbNewKeyboardNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbNewKeyboardNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
old_device*: int16 # device ID of previous keyboard
|
|
||||||
min_key_code*: int16 # minimum key code
|
|
||||||
max_key_code*: int16 # maximum key code
|
|
||||||
old_min_key_code*: int16 # min key code of previous kbd
|
|
||||||
old_max_key_code*: int16 # max key code of previous kbd
|
|
||||||
changed*: int16 # changed aspects of the keyboard
|
|
||||||
req_major*: int8 # major and minor opcode of req
|
|
||||||
req_minor*: int8 # that caused change, if applicable
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbMapNotifyEvent* = ptr TXkbMapNotifyEvent
|
|
||||||
TXkbMapNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbMapNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
changed*: int16 # fields which have been changed
|
|
||||||
flags*: int16 # reserved
|
|
||||||
first_type*: int16 # first changed key type
|
|
||||||
num_types*: int16 # number of changed key types
|
|
||||||
min_key_code*: TKeyCode
|
|
||||||
max_key_code*: TKeyCode
|
|
||||||
first_key_sym*: TKeyCode
|
|
||||||
first_key_act*: TKeyCode
|
|
||||||
first_key_behavior*: TKeyCode
|
|
||||||
first_key_explicit*: TKeyCode
|
|
||||||
first_modmap_key*: TKeyCode
|
|
||||||
first_vmodmap_key*: TKeyCode
|
|
||||||
num_key_syms*: int16
|
|
||||||
num_key_acts*: int16
|
|
||||||
num_key_behaviors*: int16
|
|
||||||
num_key_explicit*: int16
|
|
||||||
num_modmap_keys*: int16
|
|
||||||
num_vmodmap_keys*: int16
|
|
||||||
vmods*: int16 # mask of changed virtual mods
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbStateNotifyEvent* = ptr TXkbStateNotifyEvent
|
|
||||||
TXkbStateNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbStateNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
changed*: int16 # mask of changed state components
|
|
||||||
group*: int16 # keyboard group
|
|
||||||
base_group*: int16 # base keyboard group
|
|
||||||
latched_group*: int16 # latched keyboard group
|
|
||||||
locked_group*: int16 # locked keyboard group
|
|
||||||
mods*: int16 # modifier state
|
|
||||||
base_mods*: int16 # base modifier state
|
|
||||||
latched_mods*: int16 # latched modifiers
|
|
||||||
locked_mods*: int16 # locked modifiers
|
|
||||||
compat_state*: int16 # compatibility state
|
|
||||||
grab_mods*: int8 # mods used for grabs
|
|
||||||
compat_grab_mods*: int8 # grab mods for non-XKB clients
|
|
||||||
lookup_mods*: int8 # mods sent to clients
|
|
||||||
compat_lookup_mods*: int8 # mods sent to non-XKB clients
|
|
||||||
ptr_buttons*: int16 # pointer button state
|
|
||||||
keycode*: TKeyCode # keycode that caused the change
|
|
||||||
event_type*: int8 # KeyPress or KeyRelease
|
|
||||||
req_major*: int8 # Major opcode of request
|
|
||||||
req_minor*: int8 # Minor opcode of request
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbControlsNotifyEvent* = ptr TXkbControlsNotifyEvent
|
|
||||||
TXkbControlsNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbControlsNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
changed_ctrls*: int16 # controls with changed sub-values
|
|
||||||
enabled_ctrls*: int16 # controls currently enabled
|
|
||||||
enabled_ctrl_changes*: int16 # controls just {en,dis}abled
|
|
||||||
num_groups*: int16 # total groups on keyboard
|
|
||||||
keycode*: TKeyCode # key that caused change or 0
|
|
||||||
event_type*: int8 # type of event that caused change
|
|
||||||
req_major*: int8 # if keycode==0, major and minor
|
|
||||||
req_minor*: int8 # opcode of req that caused change
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbIndicatorNotifyEvent* = ptr TXkbIndicatorNotifyEvent
|
|
||||||
TXkbIndicatorNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbIndicatorNotify
|
|
||||||
device*: int16 # device
|
|
||||||
changed*: int16 # indicators with new state or map
|
|
||||||
state*: int16 # current state of all indicators
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbNamesNotifyEvent* = ptr TXkbNamesNotifyEvent
|
|
||||||
TXkbNamesNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbNamesNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
changed*: int32 # names that have changed
|
|
||||||
first_type*: int16 # first key type with new name
|
|
||||||
num_types*: int16 # number of key types with new names
|
|
||||||
first_lvl*: int16 # first key type new new level names
|
|
||||||
num_lvls*: int16 # # of key types w/new level names
|
|
||||||
num_aliases*: int16 # total number of key aliases
|
|
||||||
num_radio_groups*: int16 # total number of radio groups
|
|
||||||
changed_vmods*: int16 # virtual modifiers with new names
|
|
||||||
changed_groups*: int16 # groups with new names
|
|
||||||
changed_indicators*: int16 # indicators with new names
|
|
||||||
first_key*: int16 # first key with new name
|
|
||||||
num_keys*: int16 # number of keys with new names
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbCompatMapNotifyEvent* = ptr TXkbCompatMapNotifyEvent
|
|
||||||
TXkbCompatMapNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbCompatMapNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
changed_groups*: int16 # groups with new compat maps
|
|
||||||
first_si*: int16 # first new symbol interp
|
|
||||||
num_si*: int16 # number of new symbol interps
|
|
||||||
num_total_si*: int16 # total # of symbol interps
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbBellNotifyEvent* = ptr TXkbBellNotifyEvent
|
|
||||||
TXkbBellNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbBellNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
percent*: int16 # requested volume as a % of maximum
|
|
||||||
pitch*: int16 # requested pitch in Hz
|
|
||||||
duration*: int16 # requested duration in useconds
|
|
||||||
bell_class*: int16 # (input extension) feedback class
|
|
||||||
bell_id*: int16 # (input extension) ID of feedback
|
|
||||||
name*: TAtom # "name" of requested bell
|
|
||||||
window*: TWindow # window associated with event
|
|
||||||
event_only*: bool # "event only" requested
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbActionMessageEvent* = ptr TXkbActionMessageEvent
|
|
||||||
TXkbActionMessageEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbActionMessage
|
|
||||||
device*: int16 # device ID
|
|
||||||
keycode*: TKeyCode # key that generated the event
|
|
||||||
press*: bool # true if act caused by key press
|
|
||||||
key_event_follows*: bool # true if key event also generated
|
|
||||||
group*: int16 # effective group
|
|
||||||
mods*: int16 # effective mods
|
|
||||||
message*: array[0..XkbActionMessageLength, char] # message -- leave space for NUL
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbAccessXNotifyEvent* = ptr TXkbAccessXNotifyEvent
|
|
||||||
TXkbAccessXNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbAccessXNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
detail*: int16 # XkbAXN_*
|
|
||||||
keycode*: int16 # key of event
|
|
||||||
sk_delay*: int16 # current slow keys delay
|
|
||||||
debounce_delay*: int16 # current debounce delay
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbExtensionDeviceNotifyEvent* = ptr TXkbExtensionDeviceNotifyEvent
|
|
||||||
TXkbExtensionDeviceNotifyEvent*{.final.} = object
|
|
||||||
theType*: int16 # XkbAnyEvent
|
|
||||||
serial*: int32 # of last req processed by server
|
|
||||||
send_event*: bool # is this `from` a SendEvent request?
|
|
||||||
display*: PDisplay # Display the event was read `from`
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
xkb_type*: int16 # XkbExtensionDeviceNotify
|
|
||||||
device*: int16 # device ID
|
|
||||||
reason*: int16 # reason for the event
|
|
||||||
supported*: int16 # mask of supported features
|
|
||||||
unsupported*: int16 # mask of unsupported features
|
|
||||||
# that some app tried to use
|
|
||||||
first_btn*: int16 # first button that changed
|
|
||||||
num_btns*: int16 # range of buttons changed
|
|
||||||
leds_defined*: int16 # indicators with names or maps
|
|
||||||
led_state*: int16 # current state of the indicators
|
|
||||||
led_class*: int16 # feedback class for led changes
|
|
||||||
led_id*: int16 # feedback id for led changes
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbEvent* = ptr TXkbEvent
|
|
||||||
TXkbEvent*{.final.} = object
|
|
||||||
theType*: int16
|
|
||||||
any*: TXkbAnyEvent
|
|
||||||
new_kbd*: TXkbNewKeyboardNotifyEvent
|
|
||||||
map*: TXkbMapNotifyEvent
|
|
||||||
state*: TXkbStateNotifyEvent
|
|
||||||
ctrls*: TXkbControlsNotifyEvent
|
|
||||||
indicators*: TXkbIndicatorNotifyEvent
|
|
||||||
names*: TXkbNamesNotifyEvent
|
|
||||||
compat*: TXkbCompatMapNotifyEvent
|
|
||||||
bell*: TXkbBellNotifyEvent
|
|
||||||
message*: TXkbActionMessageEvent
|
|
||||||
accessx*: TXkbAccessXNotifyEvent
|
|
||||||
device*: TXkbExtensionDeviceNotifyEvent
|
|
||||||
core*: TXEvent
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXkbKbdDpyStatePtr* = ptr TXkbKbdDpyStateRec
|
|
||||||
TXkbKbdDpyStateRec*{.final.} = object # XkbOpenDisplay error codes
|
|
||||||
|
|
||||||
const
|
|
||||||
XkbOD_Success* = 0
|
|
||||||
XkbOD_BadLibraryVersion* = 1
|
|
||||||
XkbOD_ConnectionRefused* = 2
|
|
||||||
XkbOD_NonXkbServer* = 3
|
|
||||||
XkbOD_BadServerVersion* = 4 # Values for XlibFlags
|
|
||||||
|
|
||||||
const
|
|
||||||
XkbLC_ForceLatin1Lookup* = 1 shl 0
|
|
||||||
XkbLC_ConsumeLookupMods* = 1 shl 1
|
|
||||||
XkbLC_AlwaysConsumeShiftAndLock* = 1 shl 2
|
|
||||||
XkbLC_IgnoreNewKeyboards* = 1 shl 3
|
|
||||||
XkbLC_ControlFallback* = 1 shl 4
|
|
||||||
XkbLC_ConsumeKeysOnComposeFail* = 1 shl 29
|
|
||||||
XkbLC_ComposeLED* = 1 shl 30
|
|
||||||
XkbLC_BeepOnComposeFail* = 1 shl 31
|
|
||||||
XkbLC_AllComposeControls* = 0xC0000000
|
|
||||||
XkbLC_AllControls* = 0xC000001F
|
|
||||||
|
|
||||||
proc XkbIgnoreExtension*(ignore: bool): bool{.libx11c,
|
|
||||||
importc: "XkbIgnoreExtension".}
|
|
||||||
proc XkbOpenDisplay*(name: cstring, ev_rtrn, err_rtrn, major_rtrn, minor_rtrn,
|
|
||||||
reason: ptr int16): PDisplay{.libx11c, importc: "XkbOpenDisplay".}
|
|
||||||
proc XkbQueryExtension*(dpy: PDisplay, opcodeReturn, eventBaseReturn,
|
|
||||||
errorBaseReturn, majorRtrn, minorRtrn: ptr int16): bool{.
|
|
||||||
libx11c, importc: "XkbQueryExtension".}
|
|
||||||
proc XkbUseExtension*(dpy: PDisplay, major_rtrn, minor_rtrn: ptr int16): bool{.
|
|
||||||
libx11c, importc: "XkbUseExtension".}
|
|
||||||
proc XkbLibraryVersion*(libMajorRtrn, libMinorRtrn: ptr int16): bool{.libx11c, importc: "XkbLibraryVersion".}
|
|
||||||
proc XkbSetXlibControls*(dpy: PDisplay, affect, values: int16): int16{.libx11c, importc: "XkbSetXlibControls".}
|
|
||||||
proc XkbGetXlibControls*(dpy: PDisplay): int16{.libx11c,
|
|
||||||
importc: "XkbGetXlibControls".}
|
|
||||||
type
|
|
||||||
TXkbInternAtomFunc* = proc (dpy: PDisplay, name: cstring, only_if_exists: bool): TAtom{.
|
|
||||||
cdecl.}
|
|
||||||
|
|
||||||
type
|
|
||||||
TXkbGetAtomNameFunc* = proc (dpy: PDisplay, atom: TAtom): cstring{.cdecl.}
|
|
||||||
|
|
||||||
proc XkbSetAtomFuncs*(getAtom: TXkbInternAtomFunc, getName: TXkbGetAtomNameFunc){.
|
|
||||||
libx11c, importc: "XkbSetAtomFuncs".}
|
|
||||||
proc XkbKeycodeToKeysym*(dpy: PDisplay, kc: TKeyCode, group, level: int16): TKeySym{.
|
|
||||||
libx11c, importc: "XkbKeycodeToKeysym".}
|
|
||||||
proc XkbKeysymToModifiers*(dpy: PDisplay, ks: TKeySym): int16{.libx11c, importc: "XkbKeysymToModifiers".}
|
|
||||||
proc XkbLookupKeySym*(dpy: PDisplay, keycode: TKeyCode,
|
|
||||||
modifiers, modifiers_return: int16, keysym_return: PKeySym): bool{.
|
|
||||||
libx11c, importc: "XkbLookupKeySym".}
|
|
||||||
proc XkbLookupKeyBinding*(dpy: PDisplay, sym_rtrn: TKeySym, mods: int16,
|
|
||||||
buffer: cstring, nbytes: int16, extra_rtrn: ptr int16): int16{.
|
|
||||||
libx11c, importc: "XkbLookupKeyBinding".}
|
|
||||||
proc XkbTranslateKeyCode*(xkb: PXkbDescPtr, keycode: TKeyCode,
|
|
||||||
modifiers, modifiers_return: int16,
|
|
||||||
keysym_return: PKeySym): bool{.libx11c,
|
|
||||||
importc: "XkbTranslateKeyCode".}
|
|
||||||
proc XkbTranslateKeySym*(dpy: PDisplay, sym_return: TKeySym, modifiers: int16,
|
|
||||||
buffer: cstring, nbytes: int16, extra_rtrn: ptr int16): int16{.
|
|
||||||
libx11c, importc: "XkbTranslateKeySym".}
|
|
||||||
proc XkbSetAutoRepeatRate*(dpy: PDisplay, deviceSpec, delay, interval: int16): bool{.
|
|
||||||
libx11c, importc: "XkbSetAutoRepeatRate".}
|
|
||||||
proc XkbGetAutoRepeatRate*(dpy: PDisplay, deviceSpec: int16,
|
|
||||||
delayRtrn, intervalRtrn: PWord): bool{.libx11c, importc: "XkbGetAutoRepeatRate".}
|
|
||||||
proc XkbChangeEnabledControls*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
|
||||||
libx11c, importc: "XkbChangeEnabledControls".}
|
|
||||||
proc XkbDeviceBell*(dpy: PDisplay, win: TWindow,
|
|
||||||
deviceSpec, bellClass, bellID, percent: int16, name: TAtom): bool{.
|
|
||||||
libx11c, importc: "XkbDeviceBell".}
|
|
||||||
proc XkbForceDeviceBell*(dpy: PDisplay,
|
|
||||||
deviceSpec, bellClass, bellID, percent: int16): bool{.
|
|
||||||
libx11c, importc: "XkbForceDeviceBell".}
|
|
||||||
proc XkbDeviceBellEvent*(dpy: PDisplay, win: TWindow,
|
|
||||||
deviceSpec, bellClass, bellID, percent: int16,
|
|
||||||
name: TAtom): bool{.libx11c,
|
|
||||||
importc: "XkbDeviceBellEvent".}
|
|
||||||
proc XkbBell*(dpy: PDisplay, win: TWindow, percent: int16, name: TAtom): bool{.
|
|
||||||
libx11c, importc: "XkbBell".}
|
|
||||||
proc XkbForceBell*(dpy: PDisplay, percent: int16): bool{.libx11c,
|
|
||||||
importc: "XkbForceBell".}
|
|
||||||
proc XkbBellEvent*(dpy: PDisplay, win: TWindow, percent: int16, name: TAtom): bool{.
|
|
||||||
libx11c, importc: "XkbBellEvent".}
|
|
||||||
proc XkbSelectEvents*(dpy: PDisplay, deviceID, affect, values: int16): bool{.
|
|
||||||
libx11c, importc: "XkbSelectEvents".}
|
|
||||||
proc XkbSelectEventDetails*(dpy: PDisplay, deviceID, eventType: int16,
|
|
||||||
affect, details: int32): bool{.libx11c, importc: "XkbSelectEventDetails".}
|
|
||||||
proc XkbNoteMapChanges*(old: PXkbMapChangesPtr, new: PXkbMapNotifyEvent,
|
|
||||||
wanted: int16){.libx11c,
|
|
||||||
importc: "XkbNoteMapChanges".}
|
|
||||||
proc XkbNoteNameChanges*(old: PXkbNameChangesPtr, new: PXkbNamesNotifyEvent,
|
|
||||||
wanted: int16){.libx11c,
|
|
||||||
importc: "XkbNoteNameChanges".}
|
|
||||||
proc XkbGetIndicatorState*(dpy: PDisplay, deviceSpec: int16, pStateRtrn: PWord): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetIndicatorState".}
|
|
||||||
proc XkbGetDeviceIndicatorState*(dpy: PDisplay,
|
|
||||||
deviceSpec, ledClass, ledID: int16,
|
|
||||||
pStateRtrn: PWord): TStatus{.libx11c, importc: "XkbGetDeviceIndicatorState".}
|
|
||||||
proc XkbGetIndicatorMap*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetIndicatorMap".}
|
|
||||||
proc XkbSetIndicatorMap*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): bool{.
|
|
||||||
libx11c, importc: "XkbSetIndicatorMap".}
|
|
||||||
proc XkbNoteIndicatorMapChanges*(o, n: PXkbIndicatorChangesPtr, w: int16)
|
|
||||||
proc XkbNoteIndicatorStateChanges*(o, n: PXkbIndicatorChangesPtr, w: int16)
|
|
||||||
proc XkbGetIndicatorMapChanges*(d: PDisplay, x: PXkbDescPtr,
|
|
||||||
c: PXkbIndicatorChangesPtr): TStatus
|
|
||||||
proc XkbChangeIndicatorMaps*(d: PDisplay, x: PXkbDescPtr,
|
|
||||||
c: PXkbIndicatorChangesPtr): bool
|
|
||||||
proc XkbGetNamedIndicator*(dpy: PDisplay, name: TAtom, pNdxRtrn: ptr int16,
|
|
||||||
pStateRtrn: ptr bool, pMapRtrn: PXkbIndicatorMapPtr,
|
|
||||||
pRealRtrn: ptr bool): bool{.libx11c,
|
|
||||||
importc: "XkbGetNamedIndicator".}
|
|
||||||
proc XkbGetNamedDeviceIndicator*(dpy: PDisplay,
|
|
||||||
deviceSpec, ledClass, ledID: int16,
|
|
||||||
name: TAtom, pNdxRtrn: ptr int16,
|
|
||||||
pStateRtrn: ptr bool,
|
|
||||||
pMapRtrn: PXkbIndicatorMapPtr,
|
|
||||||
pRealRtrn: ptr bool): bool{.libx11c, importc: "XkbGetNamedDeviceIndicator".}
|
|
||||||
proc XkbSetNamedIndicator*(dpy: PDisplay, name: TAtom,
|
|
||||||
changeState, state, createNewMap: bool,
|
|
||||||
pMap: PXkbIndicatorMapPtr): bool{.libx11c, importc: "XkbSetNamedIndicator".}
|
|
||||||
proc XkbSetNamedDeviceIndicator*(dpy: PDisplay,
|
|
||||||
deviceSpec, ledClass, ledID: int16,
|
|
||||||
name: TAtom,
|
|
||||||
changeState, state, createNewMap: bool,
|
|
||||||
pMap: PXkbIndicatorMapPtr): bool{.libx11c, importc: "XkbSetNamedDeviceIndicator".}
|
|
||||||
proc XkbLockModifiers*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
|
||||||
libx11c, importc: "XkbLockModifiers".}
|
|
||||||
proc XkbLatchModifiers*(dpy: PDisplay, deviceSpec, affect, values: int16): bool{.
|
|
||||||
libx11c, importc: "XkbLatchModifiers".}
|
|
||||||
proc XkbLockGroup*(dpy: PDisplay, deviceSpec, group: int16): bool{.libx11c, importc: "XkbLockGroup".}
|
|
||||||
proc XkbLatchGroup*(dpy: PDisplay, deviceSpec, group: int16): bool{.libx11c, importc: "XkbLatchGroup".}
|
|
||||||
proc XkbSetServerInternalMods*(dpy: PDisplay, deviceSpec, affectReal,
|
|
||||||
realValues, affectVirtual, virtualValues: int16): bool{.libx11c, importc: "XkbSetServerInternalMods".}
|
|
||||||
proc XkbSetIgnoreLockMods*(dpy: PDisplay, deviceSpec, affectReal, realValues,
|
|
||||||
affectVirtual, virtualValues: int16): bool{.libx11c,
|
|
||||||
importc: "XkbSetIgnoreLockMods".}
|
|
||||||
proc XkbVirtualModsToReal*(dpy: PDisplay, virtual_mask: int16, mask_rtrn: PWord): bool{.
|
|
||||||
libx11c, importc: "XkbVirtualModsToReal".}
|
|
||||||
proc XkbComputeEffectiveMap*(xkb: PXkbDescPtr, theType: PXkbKeyTypePtr,
|
|
||||||
map_rtrn: PByte): bool{.libx11c,
|
|
||||||
importc: "XkbComputeEffectiveMap".}
|
|
||||||
proc XkbInitCanonicalKeyTypes*(xkb: PXkbDescPtr, which: int16, keypadVMod: int16): TStatus{.
|
|
||||||
libx11c, importc: "XkbInitCanonicalKeyTypes".}
|
|
||||||
proc XkbAllocKeyboard*(): PXkbDescPtr{.libx11c,
|
|
||||||
importc: "XkbAllocKeyboard".}
|
|
||||||
proc XkbFreeKeyboard*(xkb: PXkbDescPtr, which: int16, freeDesc: bool){.libx11c, importc: "XkbFreeKeyboard".}
|
|
||||||
proc XkbAllocClientMap*(xkb: PXkbDescPtr, which, nTypes: int16): TStatus{.libx11c, importc: "XkbAllocClientMap".}
|
|
||||||
proc XkbAllocServerMap*(xkb: PXkbDescPtr, which, nActions: int16): TStatus{.
|
|
||||||
libx11c, importc: "XkbAllocServerMap".}
|
|
||||||
proc XkbFreeClientMap*(xkb: PXkbDescPtr, what: int16, freeMap: bool){.libx11c, importc: "XkbFreeClientMap".}
|
|
||||||
proc XkbFreeServerMap*(xkb: PXkbDescPtr, what: int16, freeMap: bool){.libx11c, importc: "XkbFreeServerMap".}
|
|
||||||
proc XkbAddKeyType*(xkb: PXkbDescPtr, name: TAtom, map_count: int16,
|
|
||||||
want_preserve: bool, num_lvls: int16): PXkbKeyTypePtr{.
|
|
||||||
libx11c, importc: "XkbAddKeyType".}
|
|
||||||
proc XkbAllocIndicatorMaps*(xkb: PXkbDescPtr): TStatus{.libx11c,
|
|
||||||
importc: "XkbAllocIndicatorMaps".}
|
|
||||||
proc XkbFreeIndicatorMaps*(xkb: PXkbDescPtr){.libx11c,
|
|
||||||
importc: "XkbFreeIndicatorMaps".}
|
|
||||||
proc XkbGetMap*(dpy: PDisplay, which, deviceSpec: int16): PXkbDescPtr{.libx11c, importc: "XkbGetMap".}
|
|
||||||
proc XkbGetUpdatedMap*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetUpdatedMap".}
|
|
||||||
proc XkbGetMapChanges*(dpy: PDisplay, xkb: PXkbDescPtr,
|
|
||||||
changes: PXkbMapChangesPtr): TStatus{.libx11c, importc: "XkbGetMapChanges".}
|
|
||||||
proc XkbRefreshKeyboardMapping*(event: PXkbMapNotifyEvent): TStatus{.libx11c, importc: "XkbRefreshKeyboardMapping".}
|
|
||||||
proc XkbGetKeyTypes*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetKeyTypes".}
|
|
||||||
proc XkbGetKeySyms*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetKeySyms".}
|
|
||||||
proc XkbGetKeyActions*(dpy: PDisplay, first, num: int16, xkb: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetKeyActions".}
|
|
||||||
proc XkbGetKeyBehaviors*(dpy: PDisplay, firstKey, nKeys: int16,
|
|
||||||
desc: PXkbDescPtr): TStatus{.libx11c,
|
|
||||||
importc: "XkbGetKeyBehaviors".}
|
|
||||||
proc XkbGetVirtualMods*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetVirtualMods".}
|
|
||||||
proc XkbGetKeyExplicitComponents*(dpy: PDisplay, firstKey, nKeys: int16,
|
|
||||||
desc: PXkbDescPtr): TStatus{.libx11c, importc: "XkbGetKeyExplicitComponents".}
|
|
||||||
proc XkbGetKeyModifierMap*(dpy: PDisplay, firstKey, nKeys: int16,
|
|
||||||
desc: PXkbDescPtr): TStatus{.libx11c,
|
|
||||||
importc: "XkbGetKeyModifierMap".}
|
|
||||||
proc XkbAllocControls*(xkb: PXkbDescPtr, which: int16): TStatus{.libx11c, importc: "XkbAllocControls".}
|
|
||||||
proc XkbFreeControls*(xkb: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeControls".}
|
|
||||||
proc XkbGetControls*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetControls".}
|
|
||||||
proc XkbSetControls*(dpy: PDisplay, which: int32, desc: PXkbDescPtr): bool{.
|
|
||||||
libx11c, importc: "XkbSetControls".}
|
|
||||||
proc XkbNoteControlsChanges*(old: PXkbControlsChangesPtr,
|
|
||||||
new: PXkbControlsNotifyEvent, wanted: int16){.
|
|
||||||
libx11c, importc: "XkbNoteControlsChanges".}
|
|
||||||
proc XkbGetControlsChanges*(d: PDisplay, x: PXkbDescPtr,
|
|
||||||
c: PXkbControlsChangesPtr): TStatus
|
|
||||||
proc XkbChangeControls*(d: PDisplay, x: PXkbDescPtr, c: PXkbControlsChangesPtr): bool
|
|
||||||
proc XkbAllocCompatMap*(xkb: PXkbDescPtr, which, nInterpret: int16): TStatus{.
|
|
||||||
libx11c, importc: "XkbAllocCompatMap".}
|
|
||||||
proc XkbFreeCompatMap*(xkib: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeCompatMap".}
|
|
||||||
proc XkbGetCompatMap*(dpy: PDisplay, which: int16, xkb: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetCompatMap".}
|
|
||||||
proc XkbSetCompatMap*(dpy: PDisplay, which: int16, xkb: PXkbDescPtr,
|
|
||||||
updateActions: bool): bool{.libx11c,
|
|
||||||
importc: "XkbSetCompatMap".}
|
|
||||||
proc XkbAddSymInterpret*(xkb: PXkbDescPtr, si: PXkbSymInterpretPtr,
|
|
||||||
updateMap: bool, changes: PXkbChangesPtr): PXkbSymInterpretPtr{.
|
|
||||||
libx11c, importc: "XkbAddSymInterpret".}
|
|
||||||
proc XkbAllocNames*(xkb: PXkbDescPtr, which: int16,
|
|
||||||
nTotalRG, nTotalAliases: int16): TStatus{.libx11c, importc: "XkbAllocNames".}
|
|
||||||
proc XkbGetNames*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetNames".}
|
|
||||||
proc XkbSetNames*(dpy: PDisplay, which, firstType, nTypes: int16,
|
|
||||||
desc: PXkbDescPtr): bool{.libx11c,
|
|
||||||
importc: "XkbSetNames".}
|
|
||||||
proc XkbChangeNames*(dpy: PDisplay, xkb: PXkbDescPtr,
|
|
||||||
changes: PXkbNameChangesPtr): bool{.libx11c,
|
|
||||||
importc: "XkbChangeNames".}
|
|
||||||
proc XkbFreeNames*(xkb: PXkbDescPtr, which: int16, freeMap: bool){.libx11c, importc: "XkbFreeNames".}
|
|
||||||
proc XkbGetState*(dpy: PDisplay, deviceSpec: int16, rtrnState: PXkbStatePtr): TStatus{.
|
|
||||||
libx11c, importc: "XkbGetState".}
|
|
||||||
proc XkbSetMap*(dpy: PDisplay, which: int16, desc: PXkbDescPtr): bool{.libx11c, importc: "XkbSetMap".}
|
|
||||||
proc XkbChangeMap*(dpy: PDisplay, desc: PXkbDescPtr, changes: PXkbMapChangesPtr): bool{.
|
|
||||||
libx11c, importc: "XkbChangeMap".}
|
|
||||||
proc XkbSetDetectableAutoRepeat*(dpy: PDisplay, detectable: bool,
|
|
||||||
supported: ptr bool): bool{.libx11c, importc: "XkbSetDetectableAutoRepeat".}
|
|
||||||
proc XkbGetDetectableAutoRepeat*(dpy: PDisplay, supported: ptr bool): bool{.
|
|
||||||
libx11c, importc: "XkbGetDetectableAutoRepeat".}
|
|
||||||
proc XkbSetAutoResetControls*(dpy: PDisplay, changes: int16,
|
|
||||||
auto_ctrls, auto_values: PWord): bool{.libx11c, importc: "XkbSetAutoResetControls".}
|
|
||||||
proc XkbGetAutoResetControls*(dpy: PDisplay, auto_ctrls, auto_ctrl_values: PWord): bool{.
|
|
||||||
libx11c, importc: "XkbGetAutoResetControls".}
|
|
||||||
proc XkbSetPerClientControls*(dpy: PDisplay, change: int16, values: PWord): bool{.
|
|
||||||
libx11c, importc: "XkbSetPerClientControls".}
|
|
||||||
proc XkbGetPerClientControls*(dpy: PDisplay, ctrls: PWord): bool{.libx11c, importc: "XkbGetPerClientControls".}
|
|
||||||
proc XkbCopyKeyType*(`from`, into: PXkbKeyTypePtr): TStatus{.libx11c, importc: "XkbCopyKeyType".}
|
|
||||||
proc XkbCopyKeyTypes*(`from`, into: PXkbKeyTypePtr, num_types: int16): TStatus{.
|
|
||||||
libx11c, importc: "XkbCopyKeyTypes".}
|
|
||||||
proc XkbResizeKeyType*(xkb: PXkbDescPtr, type_ndx, map_count: int16,
|
|
||||||
want_preserve: bool, new_num_lvls: int16): TStatus{.
|
|
||||||
libx11c, importc: "XkbResizeKeyType".}
|
|
||||||
proc XkbResizeKeySyms*(desc: PXkbDescPtr, forKey, symsNeeded: int16): PKeySym{.
|
|
||||||
libx11c, importc: "XkbResizeKeySyms".}
|
|
||||||
proc XkbResizeKeyActions*(desc: PXkbDescPtr, forKey, actsNeeded: int16): PXkbAction{.
|
|
||||||
libx11c, importc: "XkbResizeKeyActions".}
|
|
||||||
proc XkbChangeTypesOfKey*(xkb: PXkbDescPtr, key, num_groups: int16,
|
|
||||||
groups: int16, newTypes: ptr int16,
|
|
||||||
pChanges: PXkbMapChangesPtr): TStatus{.libx11c, importc: "XkbChangeTypesOfKey".}
|
|
||||||
|
|
||||||
proc XkbListComponents*(dpy: PDisplay, deviceSpec: int16,
|
|
||||||
ptrns: PXkbComponentNamesPtr, max_inout: ptr int16): PXkbComponentListPtr{.
|
|
||||||
libx11c, importc: "XkbListComponents".}
|
|
||||||
proc XkbFreeComponentList*(list: PXkbComponentListPtr){.libx11c,
|
|
||||||
importc: "XkbFreeComponentList".}
|
|
||||||
proc XkbGetKeyboard*(dpy: PDisplay, which, deviceSpec: int16): PXkbDescPtr{.
|
|
||||||
libx11c, importc: "XkbGetKeyboard".}
|
|
||||||
proc XkbGetKeyboardByName*(dpy: PDisplay, deviceSpec: int16,
|
|
||||||
names: PXkbComponentNamesPtr, want, need: int16,
|
|
||||||
load: bool): PXkbDescPtr{.libx11c,
|
|
||||||
importc: "XkbGetKeyboardByName".}
|
|
||||||
|
|
||||||
proc XkbKeyTypesForCoreSymbols*(xkb: PXkbDescPtr,
|
|
||||||
map_width: int16, # keyboard device
|
|
||||||
core_syms: PKeySym, # always mapWidth symbols
|
|
||||||
protected: int16, # explicit key types
|
|
||||||
types_inout: ptr int16, # always four type indices
|
|
||||||
xkb_syms_rtrn: PKeySym): int16{.libx11c, importc: "XkbKeyTypesForCoreSymbols".}
|
|
||||||
# must have enough space
|
|
||||||
proc XkbApplyCompatMapToKey*(xkb: PXkbDescPtr,
|
|
||||||
key: TKeyCode, # key to be updated
|
|
||||||
changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbApplyCompatMapToKey".}
|
|
||||||
# resulting changes to map
|
|
||||||
proc XkbUpdateMapFromCore*(xkb: PXkbDescPtr,
|
|
||||||
first_key: TKeyCode, # first changed key
|
|
||||||
num_keys,
|
|
||||||
map_width: int16,
|
|
||||||
core_keysyms: PKeySym, # symbols `from` core keymap
|
|
||||||
changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbUpdateMapFromCore".}
|
|
||||||
|
|
||||||
proc XkbAddDeviceLedInfo*(devi: PXkbDeviceInfoPtr, ledClass, ledId: int16): PXkbDeviceLedInfoPtr{.
|
|
||||||
libx11c, importc: "XkbAddDeviceLedInfo".}
|
|
||||||
proc XkbResizeDeviceButtonActions*(devi: PXkbDeviceInfoPtr, newTotal: int16): TStatus{.
|
|
||||||
libx11c, importc: "XkbResizeDeviceButtonActions".}
|
|
||||||
proc XkbAllocDeviceInfo*(deviceSpec, nButtons, szLeds: int16): PXkbDeviceInfoPtr{.
|
|
||||||
libx11c, importc: "XkbAllocDeviceInfo".}
|
|
||||||
proc XkbFreeDeviceInfo*(devi: PXkbDeviceInfoPtr, which: int16, freeDevI: bool){.
|
|
||||||
libx11c, importc: "XkbFreeDeviceInfo".}
|
|
||||||
proc XkbNoteDeviceChanges*(old: PXkbDeviceChangesPtr,
|
|
||||||
new: PXkbExtensionDeviceNotifyEvent, wanted: int16){.
|
|
||||||
libx11c, importc: "XkbNoteDeviceChanges".}
|
|
||||||
proc XkbGetDeviceInfo*(dpy: PDisplay, which, deviceSpec, ledClass, ledID: int16): PXkbDeviceInfoPtr{.
|
|
||||||
libx11c, importc: "XkbGetDeviceInfo".}
|
|
||||||
proc XkbGetDeviceInfoChanges*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
|
||||||
changes: PXkbDeviceChangesPtr): TStatus{.libx11c, importc: "XkbGetDeviceInfoChanges".}
|
|
||||||
proc XkbGetDeviceButtonActions*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
|
||||||
all: bool, first, nBtns: int16): TStatus{.libx11c, importc: "XkbGetDeviceButtonActions".}
|
|
||||||
proc XkbGetDeviceLedInfo*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
|
||||||
ledClass, ledId, which: int16): TStatus{.libx11c, importc: "XkbGetDeviceLedInfo".}
|
|
||||||
proc XkbSetDeviceInfo*(dpy: PDisplay, which: int16, devi: PXkbDeviceInfoPtr): bool{.
|
|
||||||
libx11c, importc: "XkbSetDeviceInfo".}
|
|
||||||
proc XkbChangeDeviceInfo*(dpy: PDisplay, desc: PXkbDeviceInfoPtr,
|
|
||||||
changes: PXkbDeviceChangesPtr): bool{.libx11c, importc: "XkbChangeDeviceInfo".}
|
|
||||||
proc XkbSetDeviceLedInfo*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
|
||||||
ledClass, ledID, which: int16): bool{.libx11c, importc: "XkbSetDeviceLedInfo".}
|
|
||||||
proc XkbSetDeviceButtonActions*(dpy: PDisplay, devi: PXkbDeviceInfoPtr,
|
|
||||||
first, nBtns: int16): bool{.libx11c, importc: "XkbSetDeviceButtonActions".}
|
|
||||||
|
|
||||||
proc XkbToControl*(c: int8): int8{.libx11c,
|
|
||||||
importc: "XkbToControl".}
|
|
||||||
|
|
||||||
proc XkbSetDebuggingFlags*(dpy: PDisplay, mask, flags: int16, msg: cstring,
|
|
||||||
ctrls_mask, ctrls, rtrn_flags, rtrn_ctrls: int16): bool{.
|
|
||||||
libx11c, importc: "XkbSetDebuggingFlags".}
|
|
||||||
proc XkbApplyVirtualModChanges*(xkb: PXkbDescPtr, changed: int16,
|
|
||||||
changes: PXkbChangesPtr): bool{.libx11c, importc: "XkbApplyVirtualModChanges".}
|
|
||||||
|
|
||||||
# implementation
|
|
||||||
|
|
||||||
proc XkbNoteIndicatorMapChanges(o, n: PXkbIndicatorChangesPtr, w: int16) =
|
|
||||||
##define XkbNoteIndicatorMapChanges(o,n,w) ((o)->map_changes|=((n)->map_changes&(w)))
|
|
||||||
o.map_changes = o.map_changes or (n.map_changes and w)
|
|
||||||
|
|
||||||
proc XkbNoteIndicatorStateChanges(o, n: PXkbIndicatorChangesPtr, w: int16) =
|
|
||||||
##define XkbNoteIndicatorStateChanges(o,n,w) ((o)->state_changes|=((n)->state_changes&(w)))
|
|
||||||
o.state_changes = o.state_changes or (n.state_changes and (w))
|
|
||||||
|
|
||||||
proc XkbGetIndicatorMapChanges(d: PDisplay, x: PXkbDescPtr,
|
|
||||||
c: PXkbIndicatorChangesPtr): TStatus =
|
|
||||||
##define XkbGetIndicatorMapChanges(d,x,c) (XkbGetIndicatorMap((d),(c)->map_changes,x)
|
|
||||||
result = XkbGetIndicatorMap(d, c.map_changes, x)
|
|
||||||
|
|
||||||
proc XkbChangeIndicatorMaps(d: PDisplay, x: PXkbDescPtr,
|
|
||||||
c: PXkbIndicatorChangesPtr): bool =
|
|
||||||
##define XkbChangeIndicatorMaps(d,x,c) (XkbSetIndicatorMap((d),(c)->map_changes,x))
|
|
||||||
result = XkbSetIndicatorMap(d, c.map_changes, x)
|
|
||||||
|
|
||||||
proc XkbGetControlsChanges(d: PDisplay, x: PXkbDescPtr,
|
|
||||||
c: PXkbControlsChangesPtr): TStatus =
|
|
||||||
##define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x)
|
|
||||||
result = XkbGetControls(d, c.changed_ctrls, x)
|
|
||||||
|
|
||||||
proc XkbChangeControls(d: PDisplay, x: PXkbDescPtr, c: PXkbControlsChangesPtr): bool =
|
|
||||||
##define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x)
|
|
||||||
result = XkbSetControls(d, c.changed_ctrls, x)
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,194 +0,0 @@
|
||||||
#
|
|
||||||
# $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $
|
|
||||||
#
|
|
||||||
# Copyright (C) 2000 Compaq Computer Corporation, Inc.
|
|
||||||
# Copyright (C) 2002 Hewlett-Packard Company, Inc.
|
|
||||||
#
|
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
# documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
# the above copyright notice appear in all copies and that both that
|
|
||||||
# copyright notice and this permission notice appear in supporting
|
|
||||||
# documentation, and that the name of Compaq not be used in advertising or
|
|
||||||
# publicity pertaining to distribution of the software without specific,
|
|
||||||
# written prior permission. HP makes no representations about the
|
|
||||||
# suitability of this software for any purpose. It is provided "as is"
|
|
||||||
# without express or implied warranty.
|
|
||||||
#
|
|
||||||
# HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
|
|
||||||
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
||||||
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
||||||
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
#
|
|
||||||
# Author: Jim Gettys, HP Labs, HP.
|
|
||||||
#
|
|
||||||
|
|
||||||
import
|
|
||||||
x, xlib
|
|
||||||
|
|
||||||
const
|
|
||||||
libXrandr* = "libXrandr.so"
|
|
||||||
|
|
||||||
# * $XFree86: xc/include/extensions/randr.h,v 1.4 2001/11/24 07:24:58 keithp Exp $
|
|
||||||
# *
|
|
||||||
# * Copyright (C) 2000, Compaq Computer Corporation,
|
|
||||||
# * Copyright (C) 2002, Hewlett Packard, Inc.
|
|
||||||
# *
|
|
||||||
# * Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
# * documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
# * the above copyright notice appear in all copies and that both that
|
|
||||||
# * copyright notice and this permission notice appear in supporting
|
|
||||||
# * documentation, and that the name of Compaq or HP not be used in advertising
|
|
||||||
# * or publicity pertaining to distribution of the software without specific,
|
|
||||||
# * written prior permission. HP makes no representations about the
|
|
||||||
# * suitability of this software for any purpose. It is provided "as is"
|
|
||||||
# * without express or implied warranty.
|
|
||||||
# *
|
|
||||||
# * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
|
||||||
# * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
|
|
||||||
# * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
# * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
||||||
# * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
||||||
# * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
# *
|
|
||||||
# * Author: Jim Gettys, HP Labs, Hewlett-Packard, Inc.
|
|
||||||
# *
|
|
||||||
|
|
||||||
type
|
|
||||||
PRotation* = ptr TRotation
|
|
||||||
TRotation* = cushort
|
|
||||||
PSizeID* = ptr TSizeID
|
|
||||||
TSizeID* = cushort
|
|
||||||
PSubpixelOrder* = ptr TSubpixelOrder
|
|
||||||
TSubpixelOrder* = cushort
|
|
||||||
|
|
||||||
const
|
|
||||||
RANDR_NAME* = "RANDR"
|
|
||||||
RANDR_MAJOR* = 1
|
|
||||||
RANDR_MINOR* = 1
|
|
||||||
RRNumberErrors* = 0
|
|
||||||
RRNumberEvents* = 1
|
|
||||||
constX_RRQueryVersion* = 0 # we skip 1 to make old clients fail pretty immediately
|
|
||||||
X_RROldGetScreenInfo* = 1
|
|
||||||
X_RR1_0SetScreenConfig* = 2 # V1.0 apps share the same set screen config request id
|
|
||||||
constX_RRSetScreenConfig* = 2
|
|
||||||
X_RROldScreenChangeSelectInput* = 3 # 3 used to be ScreenChangeSelectInput; deprecated
|
|
||||||
constX_RRSelectInput* = 4
|
|
||||||
constX_RRGetScreenInfo* = 5 # used in XRRSelectInput
|
|
||||||
RRScreenChangeNotifyMask* = 1 shl 0
|
|
||||||
RRScreenChangeNotify* = 0 # used in the rotation field; rotation and reflection in 0.1 proto.
|
|
||||||
RR_Rotate_0* = 1
|
|
||||||
RR_Rotate_90* = 2
|
|
||||||
RR_Rotate_180* = 4
|
|
||||||
RR_Rotate_270* = 8 # new in 1.0 protocol, to allow reflection of screen
|
|
||||||
RR_Reflect_X* = 16
|
|
||||||
RR_Reflect_Y* = 32
|
|
||||||
RRSetConfigSuccess* = 0
|
|
||||||
RRSetConfigInvalidConfigTime* = 1
|
|
||||||
RRSetConfigInvalidTime* = 2
|
|
||||||
RRSetConfigFailed* = 3
|
|
||||||
|
|
||||||
type
|
|
||||||
PXRRScreenSize* = ptr TXRRScreenSize
|
|
||||||
TXRRScreenSize*{.final.} = object #
|
|
||||||
# Events.
|
|
||||||
#
|
|
||||||
width*, height*: cint
|
|
||||||
mwidth*, mheight*: cint
|
|
||||||
|
|
||||||
TXRRScreenChangeNotifyEvent*{.final.} = object # internal representation is private to the library
|
|
||||||
typ*: cint # event base
|
|
||||||
serial*: culong # # of last request processed by server
|
|
||||||
send_event*: TBool # true if this came from a SendEvent request
|
|
||||||
display*: PDisplay # Display the event was read from
|
|
||||||
window*: TWindow # window which selected for this event
|
|
||||||
root*: TWindow # Root window for changed screen
|
|
||||||
timestamp*: TTime # when the screen change occurred
|
|
||||||
config_timestamp*: TTime # when the last configuration change
|
|
||||||
size_index*: TSizeID
|
|
||||||
subpixel_order*: TSubpixelOrder
|
|
||||||
rotation*: TRotation
|
|
||||||
width*: cint
|
|
||||||
height*: cint
|
|
||||||
mwidth*: cint
|
|
||||||
mheight*: cint
|
|
||||||
|
|
||||||
PXRRScreenConfiguration* = ptr TXRRScreenConfiguration
|
|
||||||
TXRRScreenConfiguration*{.final.} = object
|
|
||||||
|
|
||||||
proc XRRQueryExtension*(dpy: PDisplay, event_basep, error_basep: Pcint): TBool{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRQueryVersion*(dpy: PDisplay, major_versionp: Pcint,
|
|
||||||
minor_versionp: Pcint): TStatus{.cdecl, dynlib: libXrandr,
|
|
||||||
importc.}
|
|
||||||
proc XRRGetScreenInfo*(dpy: PDisplay, draw: TDrawable): PXRRScreenConfiguration{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRFreeScreenConfigInfo*(config: PXRRScreenConfiguration){.cdecl,
|
|
||||||
dynlib: libXrandr, importc.}
|
|
||||||
#
|
|
||||||
# Note that screen configuration changes are only permitted if the client can
|
|
||||||
# prove it has up to date configuration information. We are trying to
|
|
||||||
# insist that it become possible for screens to change dynamically, so
|
|
||||||
# we want to ensure the client knows what it is talking about when requesting
|
|
||||||
# changes.
|
|
||||||
#
|
|
||||||
proc XRRSetScreenConfig*(dpy: PDisplay, config: PXRRScreenConfiguration,
|
|
||||||
draw: TDrawable, size_index: cint, rotation: TRotation,
|
|
||||||
timestamp: TTime): TStatus{.cdecl, dynlib: libXrandr,
|
|
||||||
importc.}
|
|
||||||
# added in v1.1, sorry for the lame name
|
|
||||||
proc XRRSetScreenConfigAndRate*(dpy: PDisplay, config: PXRRScreenConfiguration,
|
|
||||||
draw: TDrawable, size_index: cint,
|
|
||||||
rotation: TRotation, rate: cshort,
|
|
||||||
timestamp: TTime): TStatus{.cdecl,
|
|
||||||
dynlib: libXrandr, importc.}
|
|
||||||
proc XRRConfigRotations*(config: PXRRScreenConfiguration,
|
|
||||||
current_rotation: PRotation): TRotation{.cdecl,
|
|
||||||
dynlib: libXrandr, importc.}
|
|
||||||
proc XRRConfigTimes*(config: PXRRScreenConfiguration, config_timestamp: PTime): TTime{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRConfigSizes*(config: PXRRScreenConfiguration, nsizes: Pcint): PXRRScreenSize{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRConfigRates*(config: PXRRScreenConfiguration, sizeID: cint,
|
|
||||||
nrates: Pcint): ptr int16{.cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRConfigCurrentConfiguration*(config: PXRRScreenConfiguration,
|
|
||||||
rotation: PRotation): TSizeID{.cdecl,
|
|
||||||
dynlib: libXrandr, importc.}
|
|
||||||
proc XRRConfigCurrentRate*(config: PXRRScreenConfiguration): cshort{.cdecl,
|
|
||||||
dynlib: libXrandr, importc.}
|
|
||||||
proc XRRRootToScreen*(dpy: PDisplay, root: TWindow): cint{.cdecl,
|
|
||||||
dynlib: libXrandr, importc.}
|
|
||||||
#
|
|
||||||
# returns the screen configuration for the specified screen; does a lazy
|
|
||||||
# evalution to delay getting the information, and caches the result.
|
|
||||||
# These routines should be used in preference to XRRGetScreenInfo
|
|
||||||
# to avoid unneeded round trips to the X server. These are new
|
|
||||||
# in protocol version 0.1.
|
|
||||||
#
|
|
||||||
proc XRRScreenConfig*(dpy: PDisplay, screen: cint): PXRRScreenConfiguration{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRConfig*(screen: PScreen): PXRRScreenConfiguration{.cdecl,
|
|
||||||
dynlib: libXrandr, importc.}
|
|
||||||
proc XRRSelectInput*(dpy: PDisplay, window: TWindow, mask: cint){.cdecl,
|
|
||||||
dynlib: libXrandr, importc.}
|
|
||||||
#
|
|
||||||
# the following are always safe to call, even if RandR is not implemented
|
|
||||||
# on a screen
|
|
||||||
#
|
|
||||||
proc XRRRotations*(dpy: PDisplay, screen: cint, current_rotation: PRotation): TRotation{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRSizes*(dpy: PDisplay, screen: cint, nsizes: Pcint): PXRRScreenSize{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRRates*(dpy: PDisplay, screen: cint, sizeID: cint, nrates: Pcint): ptr int16{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
proc XRRTimes*(dpy: PDisplay, screen: cint, config_timestamp: PTime): TTime{.
|
|
||||||
cdecl, dynlib: libXrandr, importc.}
|
|
||||||
#
|
|
||||||
# intended to take RRScreenChangeNotify, or
|
|
||||||
# ConfigureNotify (on the root window)
|
|
||||||
# returns 1 if it is an event type it understands, 0 if not
|
|
||||||
#
|
|
||||||
proc XRRUpdateConfiguration*(event: PXEvent): cint{.cdecl, dynlib: libXrandr,
|
|
||||||
importc.}
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,241 +0,0 @@
|
||||||
|
|
||||||
import
|
|
||||||
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
|
|
||||||
# libXrender* = "libXrender.so"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Automatically converted by H2Pas 0.99.15 from xrender.h
|
|
||||||
# The following command line parameters were used:
|
|
||||||
# -p
|
|
||||||
# -T
|
|
||||||
# -S
|
|
||||||
# -d
|
|
||||||
# -c
|
|
||||||
# xrender.h
|
|
||||||
#
|
|
||||||
|
|
||||||
type
|
|
||||||
PGlyph* = ptr TGlyph
|
|
||||||
TGlyph* = int32
|
|
||||||
PGlyphSet* = ptr TGlyphSet
|
|
||||||
TGlyphSet* = int32
|
|
||||||
PPicture* = ptr TPicture
|
|
||||||
TPicture* = int32
|
|
||||||
PPictFormat* = ptr TPictFormat
|
|
||||||
TPictFormat* = int32
|
|
||||||
|
|
||||||
const
|
|
||||||
RENDER_NAME* = "RENDER"
|
|
||||||
RENDER_MAJOR* = 0
|
|
||||||
RENDER_MINOR* = 0
|
|
||||||
constX_RenderQueryVersion* = 0
|
|
||||||
X_RenderQueryPictFormats* = 1
|
|
||||||
X_RenderQueryPictIndexValues* = 2
|
|
||||||
X_RenderQueryDithers* = 3
|
|
||||||
constX_RenderCreatePicture* = 4
|
|
||||||
constX_RenderChangePicture* = 5
|
|
||||||
X_RenderSetPictureClipRectangles* = 6
|
|
||||||
constX_RenderFreePicture* = 7
|
|
||||||
constX_RenderComposite* = 8
|
|
||||||
X_RenderScale* = 9
|
|
||||||
X_RenderTrapezoids* = 10
|
|
||||||
X_RenderTriangles* = 11
|
|
||||||
X_RenderTriStrip* = 12
|
|
||||||
X_RenderTriFan* = 13
|
|
||||||
X_RenderColorTrapezoids* = 14
|
|
||||||
X_RenderColorTriangles* = 15
|
|
||||||
X_RenderTransform* = 16
|
|
||||||
constX_RenderCreateGlyphSet* = 17
|
|
||||||
constX_RenderReferenceGlyphSet* = 18
|
|
||||||
constX_RenderFreeGlyphSet* = 19
|
|
||||||
constX_RenderAddGlyphs* = 20
|
|
||||||
constX_RenderAddGlyphsFromPicture* = 21
|
|
||||||
constX_RenderFreeGlyphs* = 22
|
|
||||||
constX_RenderCompositeGlyphs8* = 23
|
|
||||||
constX_RenderCompositeGlyphs16* = 24
|
|
||||||
constX_RenderCompositeGlyphs32* = 25
|
|
||||||
BadPictFormat* = 0
|
|
||||||
BadPicture* = 1
|
|
||||||
BadPictOp* = 2
|
|
||||||
BadGlyphSet* = 3
|
|
||||||
BadGlyph* = 4
|
|
||||||
RenderNumberErrors* = BadGlyph + 1
|
|
||||||
PictTypeIndexed* = 0
|
|
||||||
PictTypeDirect* = 1
|
|
||||||
PictOpClear* = 0
|
|
||||||
PictOpSrc* = 1
|
|
||||||
PictOpDst* = 2
|
|
||||||
PictOpOver* = 3
|
|
||||||
PictOpOverReverse* = 4
|
|
||||||
PictOpIn* = 5
|
|
||||||
PictOpInReverse* = 6
|
|
||||||
PictOpOut* = 7
|
|
||||||
PictOpOutReverse* = 8
|
|
||||||
PictOpAtop* = 9
|
|
||||||
PictOpAtopReverse* = 10
|
|
||||||
PictOpXor* = 11
|
|
||||||
PictOpAdd* = 12
|
|
||||||
PictOpSaturate* = 13
|
|
||||||
PictOpMaximum* = 13
|
|
||||||
PolyEdgeSharp* = 0
|
|
||||||
PolyEdgeSmooth* = 1
|
|
||||||
PolyModePrecise* = 0
|
|
||||||
PolyModeImprecise* = 1
|
|
||||||
CPRepeat* = 1 shl 0
|
|
||||||
CPAlphaMap* = 1 shl 1
|
|
||||||
CPAlphaXOrigin* = 1 shl 2
|
|
||||||
CPAlphaYOrigin* = 1 shl 3
|
|
||||||
CPClipXOrigin* = 1 shl 4
|
|
||||||
CPClipYOrigin* = 1 shl 5
|
|
||||||
CPClipMask* = 1 shl 6
|
|
||||||
CPGraphicsExposure* = 1 shl 7
|
|
||||||
CPSubwindowMode* = 1 shl 8
|
|
||||||
CPPolyEdge* = 1 shl 9
|
|
||||||
CPPolyMode* = 1 shl 10
|
|
||||||
CPDither* = 1 shl 11
|
|
||||||
CPLastBit* = 11
|
|
||||||
|
|
||||||
type
|
|
||||||
PXRenderDirectFormat* = ptr TXRenderDirectFormat
|
|
||||||
TXRenderDirectFormat*{.final.} = object
|
|
||||||
red*: int16
|
|
||||||
redMask*: int16
|
|
||||||
green*: int16
|
|
||||||
greenMask*: int16
|
|
||||||
blue*: int16
|
|
||||||
blueMask*: int16
|
|
||||||
alpha*: int16
|
|
||||||
alphaMask*: int16
|
|
||||||
|
|
||||||
PXRenderPictFormat* = ptr TXRenderPictFormat
|
|
||||||
TXRenderPictFormat*{.final.} = object
|
|
||||||
id*: TPictFormat
|
|
||||||
thetype*: int32
|
|
||||||
depth*: int32
|
|
||||||
direct*: TXRenderDirectFormat
|
|
||||||
colormap*: TColormap
|
|
||||||
|
|
||||||
|
|
||||||
const
|
|
||||||
PictFormatID* = 1 shl 0
|
|
||||||
PictFormatType* = 1 shl 1
|
|
||||||
PictFormatDepth* = 1 shl 2
|
|
||||||
PictFormatRed* = 1 shl 3
|
|
||||||
PictFormatRedMask* = 1 shl 4
|
|
||||||
PictFormatGreen* = 1 shl 5
|
|
||||||
PictFormatGreenMask* = 1 shl 6
|
|
||||||
PictFormatBlue* = 1 shl 7
|
|
||||||
PictFormatBlueMask* = 1 shl 8
|
|
||||||
PictFormatAlpha* = 1 shl 9
|
|
||||||
PictFormatAlphaMask* = 1 shl 10
|
|
||||||
PictFormatColormap* = 1 shl 11
|
|
||||||
|
|
||||||
type
|
|
||||||
PXRenderVisual* = ptr TXRenderVisual
|
|
||||||
TXRenderVisual*{.final.} = object
|
|
||||||
visual*: PVisual
|
|
||||||
format*: PXRenderPictFormat
|
|
||||||
|
|
||||||
PXRenderDepth* = ptr TXRenderDepth
|
|
||||||
TXRenderDepth*{.final.} = object
|
|
||||||
depth*: int32
|
|
||||||
nvisuals*: int32
|
|
||||||
visuals*: PXRenderVisual
|
|
||||||
|
|
||||||
PXRenderScreen* = ptr TXRenderScreen
|
|
||||||
TXRenderScreen*{.final.} = object
|
|
||||||
depths*: PXRenderDepth
|
|
||||||
ndepths*: int32
|
|
||||||
fallback*: PXRenderPictFormat
|
|
||||||
|
|
||||||
PXRenderInfo* = ptr TXRenderInfo
|
|
||||||
TXRenderInfo*{.final.} = object
|
|
||||||
format*: PXRenderPictFormat
|
|
||||||
nformat*: int32
|
|
||||||
screen*: PXRenderScreen
|
|
||||||
nscreen*: int32
|
|
||||||
depth*: PXRenderDepth
|
|
||||||
ndepth*: int32
|
|
||||||
visual*: PXRenderVisual
|
|
||||||
nvisual*: int32
|
|
||||||
|
|
||||||
PXRenderPictureAttributes* = ptr TXRenderPictureAttributes
|
|
||||||
TXRenderPictureAttributes*{.final.} = object
|
|
||||||
repeat*: TBool
|
|
||||||
alpha_map*: TPicture
|
|
||||||
alpha_x_origin*: int32
|
|
||||||
alpha_y_origin*: int32
|
|
||||||
clip_x_origin*: int32
|
|
||||||
clip_y_origin*: int32
|
|
||||||
clip_mask*: TPixmap
|
|
||||||
graphics_exposures*: TBool
|
|
||||||
subwindow_mode*: int32
|
|
||||||
poly_edge*: int32
|
|
||||||
poly_mode*: int32
|
|
||||||
dither*: TAtom
|
|
||||||
|
|
||||||
PXGlyphInfo* = ptr TXGlyphInfo
|
|
||||||
TXGlyphInfo*{.final.} = object
|
|
||||||
width*: int16
|
|
||||||
height*: int16
|
|
||||||
x*: int16
|
|
||||||
y*: int16
|
|
||||||
xOff*: int16
|
|
||||||
yOff*: int16
|
|
||||||
|
|
||||||
|
|
||||||
proc XRenderQueryExtension*(dpy: PDisplay, event_basep: ptr int32,
|
|
||||||
error_basep: ptr int32): TBool{.libxrender.}
|
|
||||||
proc XRenderQueryVersion*(dpy: PDisplay, major_versionp: ptr int32,
|
|
||||||
minor_versionp: ptr int32): TStatus{.libxrender.}
|
|
||||||
proc XRenderQueryFormats*(dpy: PDisplay): TStatus{.libxrender.}
|
|
||||||
proc XRenderFindVisualFormat*(dpy: PDisplay, visual: PVisual): PXRenderPictFormat{.
|
|
||||||
libxrender.}
|
|
||||||
proc XRenderFindFormat*(dpy: PDisplay, mask: int32,
|
|
||||||
`template`: PXRenderPictFormat, count: int32): PXRenderPictFormat{.
|
|
||||||
libxrender.}
|
|
||||||
proc XRenderCreatePicture*(dpy: PDisplay, drawable: TDrawable,
|
|
||||||
format: PXRenderPictFormat, valuemask: int32,
|
|
||||||
attributes: PXRenderPictureAttributes): TPicture{.
|
|
||||||
libxrender.}
|
|
||||||
proc XRenderChangePicture*(dpy: PDisplay, picture: TPicture, valuemask: int32,
|
|
||||||
attributes: PXRenderPictureAttributes){.libxrender.}
|
|
||||||
proc XRenderFreePicture*(dpy: PDisplay, picture: TPicture){.libxrender.}
|
|
||||||
proc XRenderComposite*(dpy: PDisplay, op: int32, src: TPicture, mask: TPicture,
|
|
||||||
dst: TPicture, src_x: int32, src_y: int32, mask_x: int32,
|
|
||||||
mask_y: int32, dst_x: int32, dst_y: int32, width: int32,
|
|
||||||
height: int32){.libxrender.}
|
|
||||||
proc XRenderCreateGlyphSet*(dpy: PDisplay, format: PXRenderPictFormat): TGlyphSet{.
|
|
||||||
libxrender.}
|
|
||||||
proc XRenderReferenceGlyphSet*(dpy: PDisplay, existing: TGlyphSet): TGlyphSet{.
|
|
||||||
libxrender.}
|
|
||||||
proc XRenderFreeGlyphSet*(dpy: PDisplay, glyphset: TGlyphSet){.libxrender.}
|
|
||||||
proc XRenderAddGlyphs*(dpy: PDisplay, glyphset: TGlyphSet, gids: PGlyph,
|
|
||||||
glyphs: PXGlyphInfo, nglyphs: int32, images: cstring,
|
|
||||||
nbyte_images: int32){.libxrender.}
|
|
||||||
proc XRenderFreeGlyphs*(dpy: PDisplay, glyphset: TGlyphSet, gids: PGlyph,
|
|
||||||
nglyphs: int32){.libxrender.}
|
|
||||||
proc XRenderCompositeString8*(dpy: PDisplay, op: int32, src: TPicture,
|
|
||||||
dst: TPicture, maskFormat: PXRenderPictFormat,
|
|
||||||
glyphset: TGlyphSet, xSrc: int32, ySrc: int32,
|
|
||||||
xDst: int32, yDst: int32, str: cstring,
|
|
||||||
nchar: int32){.libxrender.}
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,201 +0,0 @@
|
||||||
|
|
||||||
import
|
|
||||||
x, xlib
|
|
||||||
|
|
||||||
#const
|
|
||||||
# libX11* = "libX11.so"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Automatically converted by H2Pas 0.99.15 from xresource.h
|
|
||||||
# The following command line parameters were used:
|
|
||||||
# -p
|
|
||||||
# -T
|
|
||||||
# -S
|
|
||||||
# -d
|
|
||||||
# -c
|
|
||||||
# xresource.h
|
|
||||||
#
|
|
||||||
|
|
||||||
proc Xpermalloc*(para1: int32): cstring{.cdecl, dynlib: libX11, importc.}
|
|
||||||
type
|
|
||||||
PXrmQuark* = ptr TXrmQuark
|
|
||||||
TXrmQuark* = int32
|
|
||||||
TXrmQuarkList* = PXrmQuark
|
|
||||||
PXrmQuarkList* = ptr TXrmQuarkList
|
|
||||||
|
|
||||||
proc NULLQUARK*(): TXrmQuark
|
|
||||||
type
|
|
||||||
PXrmString* = ptr TXrmString
|
|
||||||
TXrmString* = ptr char
|
|
||||||
|
|
||||||
proc NULLSTRING*(): TXrmString
|
|
||||||
proc XrmStringToQuark*(para1: cstring): TXrmQuark{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XrmPermStringToQuark*(para1: cstring): TXrmQuark{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XrmQuarkToString*(para1: TXrmQuark): TXrmString{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XrmUniqueQuark*(): TXrmQuark{.cdecl, dynlib: libX11, importc.}
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc XrmStringsEqual*(a1, a2: cstring): bool
|
|
||||||
type
|
|
||||||
PXrmBinding* = ptr TXrmBinding
|
|
||||||
TXrmBinding* = enum
|
|
||||||
XrmBindTightly, XrmBindLoosely
|
|
||||||
TXrmBindingList* = PXrmBinding
|
|
||||||
PXrmBindingList* = ptr TXrmBindingList
|
|
||||||
|
|
||||||
proc XrmStringToQuarkList*(para1: cstring, para2: TXrmQuarkList){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XrmStringToBindingQuarkList*(para1: cstring, para2: TXrmBindingList,
|
|
||||||
para3: TXrmQuarkList){.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
type
|
|
||||||
PXrmName* = ptr TXrmName
|
|
||||||
TXrmName* = TXrmQuark
|
|
||||||
PXrmNameList* = ptr TXrmNameList
|
|
||||||
TXrmNameList* = TXrmQuarkList
|
|
||||||
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc XrmNameToString*(name: int32): TXrmString
|
|
||||||
proc XrmStringToName*(str: cstring): int32
|
|
||||||
proc XrmStringToNameList*(str: cstring, name: PXrmQuark)
|
|
||||||
type
|
|
||||||
PXrmClass* = ptr TXrmClass
|
|
||||||
TXrmClass* = TXrmQuark
|
|
||||||
PXrmClassList* = ptr TXrmClassList
|
|
||||||
TXrmClassList* = TXrmQuarkList
|
|
||||||
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc XrmClassToString*(c_class: int32): TXrmString
|
|
||||||
proc XrmStringToClass*(c_class: cstring): int32
|
|
||||||
proc XrmStringToClassList*(str: cstring, c_class: PXrmQuark)
|
|
||||||
type
|
|
||||||
PXrmRepresentation* = ptr TXrmRepresentation
|
|
||||||
TXrmRepresentation* = TXrmQuark
|
|
||||||
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc XrmStringToRepresentation*(str: cstring): int32
|
|
||||||
proc XrmRepresentationToString*(thetype: int32): TXrmString
|
|
||||||
type
|
|
||||||
PXrmValue* = ptr TXrmValue
|
|
||||||
TXrmValue*{.final.} = object
|
|
||||||
size*: int32
|
|
||||||
address*: TXPointer
|
|
||||||
|
|
||||||
TXrmValuePtr* = PXrmValue
|
|
||||||
PXrmValuePtr* = ptr TXrmValuePtr
|
|
||||||
PXrmHashBucketRec* = ptr TXrmHashBucketRec
|
|
||||||
TXrmHashBucketRec*{.final.} = object
|
|
||||||
TXrmHashBucket* = PXrmHashBucketRec
|
|
||||||
PXrmHashBucket* = ptr TXrmHashBucket
|
|
||||||
PXrmHashTable* = ptr TXrmHashTable
|
|
||||||
TXrmHashTable* = ptr TXrmHashBucket
|
|
||||||
TXrmDatabase* = PXrmHashBucketRec
|
|
||||||
PXrmDatabase* = ptr TXrmDatabase
|
|
||||||
|
|
||||||
proc XrmDestroyDatabase*(para1: TXrmDatabase){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XrmQPutResource*(para1: PXrmDatabase, para2: TXrmBindingList,
|
|
||||||
para3: TXrmQuarkList, para4: TXrmRepresentation,
|
|
||||||
para5: PXrmValue){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XrmPutResource*(para1: PXrmDatabase, para2: cstring, para3: cstring,
|
|
||||||
para4: PXrmValue){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XrmQPutStringResource*(para1: PXrmDatabase, para2: TXrmBindingList,
|
|
||||||
para3: TXrmQuarkList, para4: cstring){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XrmPutStringResource*(para1: PXrmDatabase, para2: cstring, para3: cstring){.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XrmPutLineResource*(para1: PXrmDatabase, para2: cstring){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XrmQGetResource*(para1: TXrmDatabase, para2: TXrmNameList,
|
|
||||||
para3: TXrmClassList, para4: PXrmRepresentation,
|
|
||||||
para5: PXrmValue): TBool{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XrmGetResource*(para1: TXrmDatabase, para2: cstring, para3: cstring,
|
|
||||||
para4: PPchar, para5: PXrmValue): TBool{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
# There is no definition of TXrmSearchList
|
|
||||||
#function XrmQGetSearchList(para1:TXrmDatabase; para2:TXrmNameList; para3:TXrmClassList; para4:TXrmSearchList; para5:longint):TBool;cdecl;external libX11;
|
|
||||||
#function XrmQGetSearchResource(para1:TXrmSearchList; para2:TXrmName; para3:TXrmClass; para4:PXrmRepresentation; para5:PXrmValue):TBool;cdecl;external libX11;
|
|
||||||
proc XrmSetDatabase*(para1: PDisplay, para2: TXrmDatabase){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XrmGetDatabase*(para1: PDisplay): TXrmDatabase{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XrmGetFileDatabase*(para1: cstring): TXrmDatabase{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XrmCombineFileDatabase*(para1: cstring, para2: PXrmDatabase, para3: TBool): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XrmGetStringDatabase*(para1: cstring): TXrmDatabase{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XrmPutFileDatabase*(para1: TXrmDatabase, para2: cstring){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XrmMergeDatabases*(para1: TXrmDatabase, para2: PXrmDatabase){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XrmCombineDatabase*(para1: TXrmDatabase, para2: PXrmDatabase, para3: TBool){.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
const
|
|
||||||
XrmEnumAllLevels* = 0
|
|
||||||
XrmEnumOneLevel* = 1
|
|
||||||
|
|
||||||
type
|
|
||||||
funcbool* = proc (): TBool {.cdecl.}
|
|
||||||
|
|
||||||
proc XrmEnumerateDatabase*(para1: TXrmDatabase, para2: TXrmNameList,
|
|
||||||
para3: TXrmClassList, para4: int32, para5: funcbool,
|
|
||||||
para6: TXPointer): TBool{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XrmLocaleOfDatabase*(para1: TXrmDatabase): cstring{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
type
|
|
||||||
PXrmOptionKind* = ptr TXrmOptionKind
|
|
||||||
TXrmOptionKind* = enum
|
|
||||||
XrmoptionNoArg, XrmoptionIsArg, XrmoptionStickyArg, XrmoptionSepArg,
|
|
||||||
XrmoptionResArg, XrmoptionSkipArg, XrmoptionSkipLine, XrmoptionSkipNArgs
|
|
||||||
PXrmOptionDescRec* = ptr TXrmOptionDescRec
|
|
||||||
TXrmOptionDescRec*{.final.} = object
|
|
||||||
option*: cstring
|
|
||||||
specifier*: cstring
|
|
||||||
argKind*: TXrmOptionKind
|
|
||||||
value*: TXPointer
|
|
||||||
|
|
||||||
TXrmOptionDescList* = PXrmOptionDescRec
|
|
||||||
PXrmOptionDescList* = ptr TXrmOptionDescList
|
|
||||||
|
|
||||||
proc XrmParseCommand*(para1: PXrmDatabase, para2: TXrmOptionDescList,
|
|
||||||
para3: int32, para4: cstring, para5: ptr int32,
|
|
||||||
para6: PPchar){.cdecl, dynlib: libX11, importc.}
|
|
||||||
# implementation
|
|
||||||
|
|
||||||
proc NULLQUARK(): TXrmQuark =
|
|
||||||
result = TXrmQuark(0)
|
|
||||||
|
|
||||||
proc NULLSTRING(): TXrmString =
|
|
||||||
result = nil
|
|
||||||
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc XrmStringsEqual(a1, a2: cstring): bool =
|
|
||||||
#result = (strcomp(a1, a2)) == 0
|
|
||||||
$a1 == $a2
|
|
||||||
|
|
||||||
proc XrmNameToString(name: int32): TXrmString =
|
|
||||||
result = XrmQuarkToString(name)
|
|
||||||
|
|
||||||
proc XrmStringToName(str: cstring): int32 =
|
|
||||||
result = XrmStringToQuark(str)
|
|
||||||
|
|
||||||
proc XrmStringToNameList(str: cstring, name: PXrmQuark) =
|
|
||||||
XrmStringToQuarkList(str, name)
|
|
||||||
|
|
||||||
proc XrmClassToString(c_class: int32): TXrmString =
|
|
||||||
result = XrmQuarkToString(c_class)
|
|
||||||
|
|
||||||
proc XrmStringToClass(c_class: cstring): int32 =
|
|
||||||
result = XrmStringToQuark(c_class)
|
|
||||||
|
|
||||||
proc XrmStringToClassList(str: cstring, c_class: PXrmQuark) =
|
|
||||||
XrmStringToQuarkList(str, c_class)
|
|
||||||
|
|
||||||
proc XrmStringToRepresentation(str: cstring): int32 =
|
|
||||||
result = XrmStringToQuark(str)
|
|
||||||
|
|
||||||
proc XrmRepresentationToString(thetype: int32): TXrmString =
|
|
||||||
result = XrmQuarkToString(thetype)
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
|
|
||||||
import
|
|
||||||
x, xlib
|
|
||||||
|
|
||||||
#const
|
|
||||||
# libX11* = "libX11.so"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Automatically converted by H2Pas 0.99.15 from xshm.h
|
|
||||||
# The following command line parameters were used:
|
|
||||||
# -p
|
|
||||||
# -T
|
|
||||||
# -S
|
|
||||||
# -d
|
|
||||||
# -c
|
|
||||||
# xshm.h
|
|
||||||
#
|
|
||||||
|
|
||||||
const
|
|
||||||
constX_ShmQueryVersion* = 0
|
|
||||||
constX_ShmAttach* = 1
|
|
||||||
constX_ShmDetach* = 2
|
|
||||||
constX_ShmPutImage* = 3
|
|
||||||
constX_ShmGetImage* = 4
|
|
||||||
constX_ShmCreatePixmap* = 5
|
|
||||||
ShmCompletion* = 0
|
|
||||||
ShmNumberEvents* = ShmCompletion + 1
|
|
||||||
BadShmSeg* = 0
|
|
||||||
ShmNumberErrors* = BadShmSeg + 1
|
|
||||||
|
|
||||||
type
|
|
||||||
PShmSeg* = ptr TShmSeg
|
|
||||||
TShmSeg* = culong
|
|
||||||
PXShmCompletionEvent* = ptr TXShmCompletionEvent
|
|
||||||
TXShmCompletionEvent*{.final.} = object
|
|
||||||
theType*: cint
|
|
||||||
serial*: culong
|
|
||||||
send_event*: TBool
|
|
||||||
display*: PDisplay
|
|
||||||
drawable*: TDrawable
|
|
||||||
major_code*: cint
|
|
||||||
minor_code*: cint
|
|
||||||
shmseg*: TShmSeg
|
|
||||||
offset*: culong
|
|
||||||
|
|
||||||
PXShmSegmentInfo* = ptr TXShmSegmentInfo
|
|
||||||
TXShmSegmentInfo*{.final.} = object
|
|
||||||
shmseg*: TShmSeg
|
|
||||||
shmid*: cint
|
|
||||||
shmaddr*: cstring
|
|
||||||
readOnly*: TBool
|
|
||||||
|
|
||||||
|
|
||||||
proc XShmQueryExtension*(para1: PDisplay): TBool{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XShmGetEventBase*(para1: PDisplay): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XShmQueryVersion*(para1: PDisplay, para2: Pcint, para3: Pcint, para4: PBool): TBool{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XShmPixmapFormat*(para1: PDisplay): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XShmAttach*(para1: PDisplay, para2: PXShmSegmentInfo): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XShmDetach*(para1: PDisplay, para2: PXShmSegmentInfo): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XShmPutImage*(para1: PDisplay, para2: TDrawable, para3: TGC,
|
|
||||||
para4: PXImage, para5: cint, para6: cint, para7: cint,
|
|
||||||
para8: cint, para9: cuint, para10: cuint, para11: TBool): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XShmGetImage*(para1: PDisplay, para2: TDrawable, para3: PXImage,
|
|
||||||
para4: cint, para5: cint, para6: culong): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XShmCreateImage*(para1: PDisplay, para2: PVisual, para3: cuint,
|
|
||||||
para4: cint, para5: cstring, para6: PXShmSegmentInfo,
|
|
||||||
para7: cuint, para8: cuint): PXImage{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XShmCreatePixmap*(para1: PDisplay, para2: TDrawable, para3: cstring,
|
|
||||||
para4: PXShmSegmentInfo, para5: cuint, para6: cuint,
|
|
||||||
para7: cuint): TPixmap{.cdecl, dynlib: libX11, importc.}
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,412 +0,0 @@
|
||||||
|
|
||||||
import
|
|
||||||
x, xlib, keysym
|
|
||||||
|
|
||||||
#const
|
|
||||||
# libX11* = "libX11.so"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Automatically converted by H2Pas 0.99.15 from xutil.h
|
|
||||||
# The following command line parameters were used:
|
|
||||||
# -p
|
|
||||||
# -T
|
|
||||||
# -S
|
|
||||||
# -d
|
|
||||||
# -c
|
|
||||||
# xutil.h
|
|
||||||
#
|
|
||||||
|
|
||||||
const
|
|
||||||
NoValue* = 0x00000000
|
|
||||||
XValue* = 0x00000001
|
|
||||||
YValue* = 0x00000002
|
|
||||||
WidthValue* = 0x00000004
|
|
||||||
HeightValue* = 0x00000008
|
|
||||||
AllValues* = 0x0000000F
|
|
||||||
XNegative* = 0x00000010
|
|
||||||
YNegative* = 0x00000020
|
|
||||||
|
|
||||||
type
|
|
||||||
TCPoint*{.final.} = object
|
|
||||||
x*: cint
|
|
||||||
y*: cint
|
|
||||||
|
|
||||||
PXSizeHints* = ptr TXSizeHints
|
|
||||||
TXSizeHints*{.final.} = object
|
|
||||||
flags*: clong
|
|
||||||
x*, y*: cint
|
|
||||||
width*, height*: cint
|
|
||||||
min_width*, min_height*: cint
|
|
||||||
max_width*, max_height*: cint
|
|
||||||
width_inc*, height_inc*: cint
|
|
||||||
min_aspect*, max_aspect*: TCPoint
|
|
||||||
base_width*, base_height*: cint
|
|
||||||
win_gravity*: cint
|
|
||||||
|
|
||||||
|
|
||||||
const
|
|
||||||
USPosition* = 1 shl 0
|
|
||||||
USSize* = 1 shl 1
|
|
||||||
PPosition* = 1 shl 2
|
|
||||||
PSize* = 1 shl 3
|
|
||||||
PMinSize* = 1 shl 4
|
|
||||||
PMaxSize* = 1 shl 5
|
|
||||||
PResizeInc* = 1 shl 6
|
|
||||||
PAspect* = 1 shl 7
|
|
||||||
PBaseSize* = 1 shl 8
|
|
||||||
PWinGravity* = 1 shl 9
|
|
||||||
PAllHints* = PPosition or PSize or PMinSize or PMaxSize or PResizeInc or
|
|
||||||
PAspect
|
|
||||||
|
|
||||||
type
|
|
||||||
PXWMHints* = ptr TXWMHints
|
|
||||||
TXWMHints*{.final.} = object
|
|
||||||
flags*: clong
|
|
||||||
input*: TBool
|
|
||||||
initial_state*: cint
|
|
||||||
icon_pixmap*: TPixmap
|
|
||||||
icon_window*: TWindow
|
|
||||||
icon_x*, icon_y*: cint
|
|
||||||
icon_mask*: TPixmap
|
|
||||||
window_group*: TXID
|
|
||||||
|
|
||||||
|
|
||||||
const
|
|
||||||
InputHint* = 1 shl 0
|
|
||||||
StateHint* = 1 shl 1
|
|
||||||
IconPixmapHint* = 1 shl 2
|
|
||||||
IconWindowHint* = 1 shl 3
|
|
||||||
IconPositionHint* = 1 shl 4
|
|
||||||
IconMaskHint* = 1 shl 5
|
|
||||||
WindowGroupHint* = 1 shl 6
|
|
||||||
AllHints* = InputHint or StateHint or IconPixmapHint or IconWindowHint or
|
|
||||||
IconPositionHint or IconMaskHint or WindowGroupHint
|
|
||||||
XUrgencyHint* = 1 shl 8
|
|
||||||
WithdrawnState* = 0
|
|
||||||
NormalState* = 1
|
|
||||||
IconicState* = 3
|
|
||||||
DontCareState* = 0
|
|
||||||
ZoomState* = 2
|
|
||||||
InactiveState* = 4
|
|
||||||
|
|
||||||
type
|
|
||||||
PXTextProperty* = ptr TXTextProperty
|
|
||||||
TXTextProperty*{.final.} = object
|
|
||||||
value*: Pcuchar
|
|
||||||
encoding*: TAtom
|
|
||||||
format*: cint
|
|
||||||
nitems*: culong
|
|
||||||
|
|
||||||
|
|
||||||
const
|
|
||||||
XNoMemory* = - 1
|
|
||||||
XLocaleNotSupported* = - 2
|
|
||||||
XConverterNotFound* = - 3
|
|
||||||
|
|
||||||
type
|
|
||||||
PXICCEncodingStyle* = ptr TXICCEncodingStyle
|
|
||||||
TXICCEncodingStyle* = enum
|
|
||||||
XStringStyle, XCompoundTextStyle, XTextStyle, XStdICCTextStyle,
|
|
||||||
XUTF8StringStyle
|
|
||||||
PPXIconSize* = ptr PXIconSize
|
|
||||||
PXIconSize* = ptr TXIconSize
|
|
||||||
TXIconSize*{.final.} = object
|
|
||||||
min_width*, min_height*: cint
|
|
||||||
max_width*, max_height*: cint
|
|
||||||
width_inc*, height_inc*: cint
|
|
||||||
|
|
||||||
PXClassHint* = ptr TXClassHint
|
|
||||||
TXClassHint*{.final.} = object
|
|
||||||
res_name*: cstring
|
|
||||||
res_class*: cstring
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXComposeStatus* = ptr TXComposeStatus
|
|
||||||
TXComposeStatus*{.final.} = object
|
|
||||||
compose_ptr*: TXPointer
|
|
||||||
chars_matched*: cint
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
PXRegion* = ptr TXRegion
|
|
||||||
TXRegion*{.final.} = object
|
|
||||||
TRegion* = PXRegion
|
|
||||||
PRegion* = ptr TRegion
|
|
||||||
|
|
||||||
const
|
|
||||||
RectangleOut* = 0
|
|
||||||
RectangleIn* = 1
|
|
||||||
RectanglePart* = 2
|
|
||||||
|
|
||||||
type
|
|
||||||
PXVisualInfo* = ptr TXVisualInfo
|
|
||||||
TXVisualInfo*{.final.} = object
|
|
||||||
visual*: PVisual
|
|
||||||
visualid*: TVisualID
|
|
||||||
screen*: cint
|
|
||||||
depth*: cint
|
|
||||||
class*: cint
|
|
||||||
red_mask*: culong
|
|
||||||
green_mask*: culong
|
|
||||||
blue_mask*: culong
|
|
||||||
colormap_size*: cint
|
|
||||||
bits_per_rgb*: cint
|
|
||||||
|
|
||||||
|
|
||||||
const
|
|
||||||
VisualNoMask* = 0x00000000
|
|
||||||
VisualIDMask* = 0x00000001
|
|
||||||
VisualScreenMask* = 0x00000002
|
|
||||||
VisualDepthMask* = 0x00000004
|
|
||||||
VisualClassMask* = 0x00000008
|
|
||||||
VisualRedMaskMask* = 0x00000010
|
|
||||||
VisualGreenMaskMask* = 0x00000020
|
|
||||||
VisualBlueMaskMask* = 0x00000040
|
|
||||||
VisualColormapSizeMask* = 0x00000080
|
|
||||||
VisualBitsPerRGBMask* = 0x00000100
|
|
||||||
VisualAllMask* = 0x000001FF
|
|
||||||
|
|
||||||
type
|
|
||||||
PPXStandardColormap* = ptr PXStandardColormap
|
|
||||||
PXStandardColormap* = ptr TXStandardColormap
|
|
||||||
TXStandardColormap*{.final.} = object
|
|
||||||
colormap*: TColormap
|
|
||||||
red_max*: culong
|
|
||||||
red_mult*: culong
|
|
||||||
green_max*: culong
|
|
||||||
green_mult*: culong
|
|
||||||
blue_max*: culong
|
|
||||||
blue_mult*: culong
|
|
||||||
base_pixel*: culong
|
|
||||||
visualid*: TVisualID
|
|
||||||
killid*: TXID
|
|
||||||
|
|
||||||
|
|
||||||
const
|
|
||||||
BitmapSuccess* = 0
|
|
||||||
BitmapOpenFailed* = 1
|
|
||||||
BitmapFileInvalid* = 2
|
|
||||||
BitmapNoMemory* = 3
|
|
||||||
XCSUCCESS* = 0
|
|
||||||
XCNOMEM* = 1
|
|
||||||
XCNOENT* = 2
|
|
||||||
ReleaseByFreeingColormap*: TXID = TXID(1)
|
|
||||||
|
|
||||||
type
|
|
||||||
PXContext* = ptr TXContext
|
|
||||||
TXContext* = cint
|
|
||||||
|
|
||||||
proc XAllocClassHint*(): PXClassHint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XAllocIconSize*(): PXIconSize{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XAllocSizeHints*(): PXSizeHints{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XAllocStandardColormap*(): PXStandardColormap{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XAllocWMHints*(): PXWMHints{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XClipBox*(para1: TRegion, para2: PXRectangle): cint{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XCreateRegion*(): TRegion{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XDefaultString*(): cstring{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XDeleteContext*(para1: PDisplay, para2: TXID, para3: TXContext): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XDestroyRegion*(para1: TRegion): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XEmptyRegion*(para1: TRegion): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XEqualRegion*(para1: TRegion, para2: TRegion): cint{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XFindContext*(para1: PDisplay, para2: TXID, para3: TXContext,
|
|
||||||
para4: PXPointer): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetClassHint*(para1: PDisplay, para2: TWindow, para3: PXClassHint): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetIconSizes*(para1: PDisplay, para2: TWindow, para3: PPXIconSize,
|
|
||||||
para4: Pcint): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetNormalHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetRGBColormaps*(para1: PDisplay, para2: TWindow,
|
|
||||||
para3: PPXStandardColormap, para4: Pcint, para5: TAtom): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetSizeHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints,
|
|
||||||
para4: TAtom): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetStandardColormap*(para1: PDisplay, para2: TWindow,
|
|
||||||
para3: PXStandardColormap, para4: TAtom): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetTextProperty*(para1: PDisplay, para2: TWindow, para3: PXTextProperty,
|
|
||||||
para4: TAtom): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetVisualInfo*(para1: PDisplay, para2: clong, para3: PXVisualInfo,
|
|
||||||
para4: Pcint): PXVisualInfo{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetWMClientMachine*(para1: PDisplay, para2: TWindow, para3: PXTextProperty): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetWMHints*(para1: PDisplay, para2: TWindow): PXWMHints{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XGetWMIconName*(para1: PDisplay, para2: TWindow, para3: PXTextProperty): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetWMName*(para1: PDisplay, para2: TWindow, para3: PXTextProperty): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetWMNormalHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints,
|
|
||||||
para4: ptr int): TStatus{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XGetWMSizeHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints,
|
|
||||||
para4: ptr int, para5: TAtom): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XGetZoomHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints): TStatus{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XIntersectRegion*(para1: TRegion, para2: TRegion, para3: TRegion): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XConvertCase*(para1: TKeySym, para2: PKeySym, para3: PKeySym){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XLookupString*(para1: PXKeyEvent, para2: cstring, para3: cint,
|
|
||||||
para4: PKeySym, para5: PXComposeStatus): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XMatchVisualInfo*(para1: PDisplay, para2: cint, para3: cint, para4: cint,
|
|
||||||
para5: PXVisualInfo): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XOffsetRegion*(para1: TRegion, para2: cint, para3: cint): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XPointInRegion*(para1: TRegion, para2: cint, para3: cint): TBool{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XPolygonRegion*(para1: PXPoint, para2: cint, para3: cint): TRegion{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XRectInRegion*(para1: TRegion, para2: cint, para3: cint, para4: cuint,
|
|
||||||
para5: cuint): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSaveContext*(para1: PDisplay, para2: TXID, para3: TXContext,
|
|
||||||
para4: cstring): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetClassHint*(para1: PDisplay, para2: TWindow, para3: PXClassHint): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetIconSizes*(para1: PDisplay, para2: TWindow, para3: PXIconSize,
|
|
||||||
para4: cint): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetNormalHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetRGBColormaps*(para1: PDisplay, para2: TWindow,
|
|
||||||
para3: PXStandardColormap, para4: cint, para5: TAtom){.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetSizeHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints,
|
|
||||||
para4: TAtom): cint{.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetStandardProperties*(para1: PDisplay, para2: TWindow, para3: cstring,
|
|
||||||
para4: cstring, para5: TPixmap, para6: PPchar,
|
|
||||||
para7: cint, para8: PXSizeHints): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XSetTextProperty*(para1: PDisplay, para2: TWindow, para3: PXTextProperty,
|
|
||||||
para4: TAtom){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetWMClientMachine*(para1: PDisplay, para2: TWindow, para3: PXTextProperty){.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetWMHints*(para1: PDisplay, para2: TWindow, para3: PXWMHints): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetWMIconName*(para1: PDisplay, para2: TWindow, para3: PXTextProperty){.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetWMName*(para1: PDisplay, para2: TWindow, para3: PXTextProperty){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XSetWMNormalHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints){.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetWMProperties*(para1: PDisplay, para2: TWindow, para3: PXTextProperty,
|
|
||||||
para4: PXTextProperty, para5: PPchar, para6: cint,
|
|
||||||
para7: PXSizeHints, para8: PXWMHints, para9: PXClassHint){.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XmbSetWMProperties*(para1: PDisplay, para2: TWindow, para3: cstring,
|
|
||||||
para4: cstring, para5: PPchar, para6: cint,
|
|
||||||
para7: PXSizeHints, para8: PXWMHints,
|
|
||||||
para9: PXClassHint){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc Xutf8SetWMProperties*(para1: PDisplay, para2: TWindow, para3: cstring,
|
|
||||||
para4: cstring, para5: PPchar, para6: cint,
|
|
||||||
para7: PXSizeHints, para8: PXWMHints,
|
|
||||||
para9: PXClassHint){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetWMSizeHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints,
|
|
||||||
para4: TAtom){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XSetRegion*(para1: PDisplay, para2: TGC, para3: TRegion): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XSetStandardColormap*(para1: PDisplay, para2: TWindow,
|
|
||||||
para3: PXStandardColormap, para4: TAtom){.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XSetZoomHints*(para1: PDisplay, para2: TWindow, para3: PXSizeHints): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XShrinkRegion*(para1: TRegion, para2: cint, para3: cint): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XStringListToTextProperty*(para1: PPchar, para2: cint,
|
|
||||||
para3: PXTextProperty): TStatus{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XSubtractRegion*(para1: TRegion, para2: TRegion, para3: TRegion): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XmbTextListToTextProperty*(para1: PDisplay, para2: PPchar, para3: cint,
|
|
||||||
para4: TXICCEncodingStyle, para5: PXTextProperty): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XwcTextListToTextProperty*(para1: PDisplay, para2: ptr ptr int16, para3: cint,
|
|
||||||
para4: TXICCEncodingStyle, para5: PXTextProperty): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc Xutf8TextListToTextProperty*(para1: PDisplay, para2: PPchar, para3: cint,
|
|
||||||
para4: TXICCEncodingStyle,
|
|
||||||
para5: PXTextProperty): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XwcFreeStringList*(para1: ptr ptr int16){.cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XTextPropertyToStringList*(para1: PXTextProperty, para2: PPPchar,
|
|
||||||
para3: Pcint): TStatus{.cdecl, dynlib: libX11,
|
|
||||||
importc.}
|
|
||||||
proc XmbTextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty,
|
|
||||||
para3: PPPchar, para4: Pcint): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XwcTextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty,
|
|
||||||
para3: ptr ptr ptr int16, para4: Pcint): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc Xutf8TextPropertyToTextList*(para1: PDisplay, para2: PXTextProperty,
|
|
||||||
para3: PPPchar, para4: Pcint): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XUnionRectWithRegion*(para1: PXRectangle, para2: TRegion, para3: TRegion): cint{.
|
|
||||||
cdecl, dynlib: libX11, importc.}
|
|
||||||
proc XUnionRegion*(para1: TRegion, para2: TRegion, para3: TRegion): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XWMGeometry*(para1: PDisplay, para2: cint, para3: cstring, para4: cstring,
|
|
||||||
para5: cuint, para6: PXSizeHints, para7: Pcint, para8: Pcint,
|
|
||||||
para9: Pcint, para10: Pcint, para11: Pcint): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
proc XXorRegion*(para1: TRegion, para2: TRegion, para3: TRegion): cint{.cdecl,
|
|
||||||
dynlib: libX11, importc.}
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc XDestroyImage*(ximage: PXImage): cint
|
|
||||||
proc XGetPixel*(ximage: PXImage, x, y: cint): culong
|
|
||||||
proc XPutPixel*(ximage: PXImage, x, y: cint, pixel: culong): cint
|
|
||||||
proc XSubImage*(ximage: PXImage, x, y: cint, width, height: cuint): PXImage
|
|
||||||
proc XAddPixel*(ximage: PXImage, value: clong): cint
|
|
||||||
proc IsKeypadKey*(keysym: TKeySym): bool
|
|
||||||
proc IsPrivateKeypadKey*(keysym: TKeySym): bool
|
|
||||||
proc IsCursorKey*(keysym: TKeySym): bool
|
|
||||||
proc IsPFKey*(keysym: TKeySym): bool
|
|
||||||
proc IsFunctionKey*(keysym: TKeySym): bool
|
|
||||||
proc IsMiscFunctionKey*(keysym: TKeySym): bool
|
|
||||||
proc IsModifierKey*(keysym: TKeySym): bool
|
|
||||||
#function XUniqueContext : TXContext;
|
|
||||||
#function XStringToContext(_string : Pchar) : TXContext;
|
|
||||||
# implementation
|
|
||||||
|
|
||||||
#when defined(MACROS):
|
|
||||||
proc XDestroyImage(ximage: PXImage): cint =
|
|
||||||
ximage.f.destroy_image(ximage)
|
|
||||||
|
|
||||||
proc XGetPixel(ximage: PXImage, x, y: cint): culong =
|
|
||||||
ximage.f.get_pixel(ximage, x, y)
|
|
||||||
|
|
||||||
proc XPutPixel(ximage: PXImage, x, y: cint, pixel: culong): cint =
|
|
||||||
ximage.f.put_pixel(ximage, x, y, pixel)
|
|
||||||
|
|
||||||
proc XSubImage(ximage: PXImage, x, y: cint, width, height: cuint): PXImage =
|
|
||||||
ximage.f.sub_image(ximage, x, y, width, height)
|
|
||||||
|
|
||||||
proc XAddPixel(ximage: PXImage, value: clong): cint =
|
|
||||||
ximage.f.add_pixel(ximage, value)
|
|
||||||
|
|
||||||
proc IsKeypadKey(keysym: TKeySym): bool =
|
|
||||||
(keysym >= XK_KP_Space) and (keysym <= XK_KP_Equal)
|
|
||||||
|
|
||||||
proc IsPrivateKeypadKey(keysym: TKeySym): bool =
|
|
||||||
(keysym >= 0x11000000.TKeySym) and (keysym <= 0x1100FFFF.TKeySym)
|
|
||||||
|
|
||||||
proc IsCursorKey(keysym: TKeySym): bool =
|
|
||||||
(keysym >= XK_Home) and (keysym < XK_Select)
|
|
||||||
|
|
||||||
proc IsPFKey(keysym: TKeySym): bool =
|
|
||||||
(keysym >= XK_KP_F1) and (keysym <= XK_KP_F4)
|
|
||||||
|
|
||||||
proc IsFunctionKey(keysym: TKeySym): bool =
|
|
||||||
(keysym >= XK_F1) and (keysym <= XK_F35)
|
|
||||||
|
|
||||||
proc IsMiscFunctionKey(keysym: TKeySym): bool =
|
|
||||||
(keysym >= XK_Select) and (keysym <= XK_Break)
|
|
||||||
|
|
||||||
proc IsModifierKey(keysym: TKeySym): bool =
|
|
||||||
((keysym >= XK_Shift_L) and (keysym <= XK_Hyper_R)) or
|
|
||||||
(keysym == XK_Mode_switch) or (keysym == XK_Num_Lock)
|
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
#***********************************************************
|
|
||||||
#Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
|
|
||||||
#and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
|
||||||
#
|
|
||||||
# All Rights Reserved
|
|
||||||
#
|
|
||||||
#Permission to use, copy, modify, and distribute this software and its
|
|
||||||
#documentation for any purpose and without fee is hereby granted,
|
|
||||||
#provided that the above copyright notice appear in all copies and that
|
|
||||||
#both that copyright notice and this permission notice appear in
|
|
||||||
#supporting documentation, and that the names of Digital or MIT not be
|
|
||||||
#used in advertising or publicity pertaining to distribution of the
|
|
||||||
#software without specific, written prior permission.
|
|
||||||
#
|
|
||||||
#DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
||||||
#ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
||||||
#DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
||||||
#ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
||||||
#WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
||||||
#ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
||||||
#SOFTWARE.
|
|
||||||
#
|
|
||||||
#******************************************************************
|
|
||||||
# $XFree86: xc/include/extensions/Xv.h,v 1.3 1999/05/23 06:33:22 dawes Exp $
|
|
||||||
|
|
||||||
import
|
|
||||||
x
|
|
||||||
|
|
||||||
const
|
|
||||||
XvName* = "libXVideo.so"
|
|
||||||
XvVersion* = 2
|
|
||||||
XvRevision* = 2 # Symbols
|
|
||||||
|
|
||||||
type
|
|
||||||
TXvPortID* = TXID
|
|
||||||
TXvEncodingID* = TXID
|
|
||||||
|
|
||||||
const
|
|
||||||
XvNone* = 0
|
|
||||||
XvInput* = 0
|
|
||||||
XvOutput* = 1
|
|
||||||
XvInputMask* = 1 shl XvInput
|
|
||||||
XvOutputMask* = 1 shl XvOutput
|
|
||||||
XvVideoMask* = 0x00000004
|
|
||||||
XvStillMask* = 0x00000008
|
|
||||||
XvImageMask* = 0x00000010 # These two are not client viewable
|
|
||||||
XvPixmapMask* = 0x00010000
|
|
||||||
XvWindowMask* = 0x00020000
|
|
||||||
XvGettable* = 0x00000001
|
|
||||||
XvSettable* = 0x00000002
|
|
||||||
XvRGB* = 0
|
|
||||||
XvYUV* = 1
|
|
||||||
XvPacked* = 0
|
|
||||||
XvPlanar* = 1
|
|
||||||
XvTopToBottom* = 0
|
|
||||||
XvBottomToTop* = 1 # Events
|
|
||||||
XvVideoNotify* = 0
|
|
||||||
XvPortNotify* = 1
|
|
||||||
XvNumEvents* = 2 # Video Notify Reasons
|
|
||||||
XvStarted* = 0
|
|
||||||
XvStopped* = 1
|
|
||||||
XvBusy* = 2
|
|
||||||
XvPreempted* = 3
|
|
||||||
XvHardError* = 4
|
|
||||||
XvLastReason* = 4
|
|
||||||
XvNumReasons* = XvLastReason + 1
|
|
||||||
XvStartedMask* = 1 shl XvStarted
|
|
||||||
XvStoppedMask* = 1 shl XvStopped
|
|
||||||
XvBusyMask* = 1 shl XvBusy
|
|
||||||
XvPreemptedMask* = 1 shl XvPreempted
|
|
||||||
XvHardErrorMask* = 1 shl XvHardError
|
|
||||||
XvAnyReasonMask* = (1 shl XvNumReasons) - 1
|
|
||||||
XvNoReasonMask* = 0 # Errors
|
|
||||||
XvBadPort* = 0
|
|
||||||
XvBadEncoding* = 1
|
|
||||||
XvBadControl* = 2
|
|
||||||
XvNumErrors* = 3 # Status
|
|
||||||
XvBadExtension* = 1
|
|
||||||
XvAlreadyGrabbed* = 2
|
|
||||||
XvInvalidTime* = 3
|
|
||||||
XvBadReply* = 4
|
|
||||||
XvBadAlloc* = 5
|
|
||||||
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,234 +0,0 @@
|
||||||
#***********************************************************
|
|
||||||
#Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts,
|
|
||||||
#and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
|
|
||||||
#
|
|
||||||
# All Rights Reserved
|
|
||||||
#
|
|
||||||
#Permission to use, copy, modify, and distribute this software and its
|
|
||||||
#documentation for any purpose and without fee is hereby granted,
|
|
||||||
#provided that the above copyright notice appear in all copies and that
|
|
||||||
#both that copyright notice and this permission notice appear in
|
|
||||||
#supporting documentation, and that the names of Digital or MIT not be
|
|
||||||
#used in advertising or publicity pertaining to distribution of the
|
|
||||||
#software without specific, written prior permission.
|
|
||||||
#
|
|
||||||
#DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
||||||
#ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
||||||
#DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
||||||
#ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
||||||
#WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
||||||
#ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
||||||
#SOFTWARE.
|
|
||||||
#
|
|
||||||
#******************************************************************
|
|
||||||
# $XFree86: xc/include/extensions/Xvlib.h,v 1.3 1999/12/11 19:28:48 mvojkovi Exp $
|
|
||||||
#*
|
|
||||||
#** File:
|
|
||||||
#**
|
|
||||||
#** Xvlib.h --- Xv library public header file
|
|
||||||
#**
|
|
||||||
#** Author:
|
|
||||||
#**
|
|
||||||
#** David Carver (Digital Workstation Engineering/Project Athena)
|
|
||||||
#**
|
|
||||||
#** Revisions:
|
|
||||||
#**
|
|
||||||
#** 26.06.91 Carver
|
|
||||||
#** - changed XvFreeAdaptors to XvFreeAdaptorInfo
|
|
||||||
#** - changed XvFreeEncodings to XvFreeEncodingInfo
|
|
||||||
#**
|
|
||||||
#** 11.06.91 Carver
|
|
||||||
#** - changed SetPortControl to SetPortAttribute
|
|
||||||
#** - changed GetPortControl to GetPortAttribute
|
|
||||||
#** - changed QueryBestSize
|
|
||||||
#**
|
|
||||||
#** 05.15.91 Carver
|
|
||||||
#** - version 2.0 upgrade
|
|
||||||
#**
|
|
||||||
#** 01.24.91 Carver
|
|
||||||
#** - version 1.4 upgrade
|
|
||||||
#**
|
|
||||||
#*
|
|
||||||
|
|
||||||
import
|
|
||||||
x, xlib, xshm, xv
|
|
||||||
|
|
||||||
const
|
|
||||||
libXv* = "libXv.so"
|
|
||||||
|
|
||||||
type
|
|
||||||
PXvRational* = ptr TXvRational
|
|
||||||
TXvRational*{.final.} = object
|
|
||||||
numerator*: cint
|
|
||||||
denominator*: cint
|
|
||||||
|
|
||||||
PXvAttribute* = ptr TXvAttribute
|
|
||||||
TXvAttribute*{.final.} = object
|
|
||||||
flags*: cint # XvGettable, XvSettable
|
|
||||||
min_value*: cint
|
|
||||||
max_value*: cint
|
|
||||||
name*: cstring
|
|
||||||
|
|
||||||
PPXvEncodingInfo* = ptr PXvEncodingInfo
|
|
||||||
PXvEncodingInfo* = ptr TXvEncodingInfo
|
|
||||||
TXvEncodingInfo*{.final.} = object
|
|
||||||
encoding_id*: TXvEncodingID
|
|
||||||
name*: cstring
|
|
||||||
width*: culong
|
|
||||||
height*: culong
|
|
||||||
rate*: TXvRational
|
|
||||||
num_encodings*: culong
|
|
||||||
|
|
||||||
PXvFormat* = ptr TXvFormat
|
|
||||||
TXvFormat*{.final.} = object
|
|
||||||
depth*: cchar
|
|
||||||
visual_id*: culong
|
|
||||||
|
|
||||||
PPXvAdaptorInfo* = ptr PXvAdaptorInfo
|
|
||||||
PXvAdaptorInfo* = ptr TXvAdaptorInfo
|
|
||||||
TXvAdaptorInfo*{.final.} = object
|
|
||||||
base_id*: TXvPortID
|
|
||||||
num_ports*: culong
|
|
||||||
thetype*: cchar
|
|
||||||
name*: cstring
|
|
||||||
num_formats*: culong
|
|
||||||
formats*: PXvFormat
|
|
||||||
num_adaptors*: culong
|
|
||||||
|
|
||||||
PXvVideoNotifyEvent* = ptr TXvVideoNotifyEvent
|
|
||||||
TXvVideoNotifyEvent*{.final.} = object
|
|
||||||
theType*: cint
|
|
||||||
serial*: culong # # of last request processed by server
|
|
||||||
send_event*: TBool # true if this came from a SendEvent request
|
|
||||||
display*: PDisplay # Display the event was read from
|
|
||||||
drawable*: TDrawable # drawable
|
|
||||||
reason*: culong # what generated this event
|
|
||||||
port_id*: TXvPortID # what port
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
|
|
||||||
PXvPortNotifyEvent* = ptr TXvPortNotifyEvent
|
|
||||||
TXvPortNotifyEvent*{.final.} = object
|
|
||||||
theType*: cint
|
|
||||||
serial*: culong # # of last request processed by server
|
|
||||||
send_event*: TBool # true if this came from a SendEvent request
|
|
||||||
display*: PDisplay # Display the event was read from
|
|
||||||
port_id*: TXvPortID # what port
|
|
||||||
time*: TTime # milliseconds
|
|
||||||
attribute*: TAtom # atom that identifies attribute
|
|
||||||
value*: clong # value of attribute
|
|
||||||
|
|
||||||
PXvEvent* = ptr TXvEvent
|
|
||||||
TXvEvent*{.final.} = object
|
|
||||||
pad*: array[0..23, clong] #case longint of
|
|
||||||
# 0 : (
|
|
||||||
# theType : cint;
|
|
||||||
# );
|
|
||||||
# 1 : (
|
|
||||||
# xvvideo : TXvVideoNotifyEvent;
|
|
||||||
# );
|
|
||||||
# 2 : (
|
|
||||||
# xvport : TXvPortNotifyEvent;
|
|
||||||
# );
|
|
||||||
# 3 : (
|
|
||||||
#
|
|
||||||
# );
|
|
||||||
|
|
||||||
PXvImageFormatValues* = ptr TXvImageFormatValues
|
|
||||||
TXvImageFormatValues*{.final.} = object
|
|
||||||
id*: cint # Unique descriptor for the format
|
|
||||||
theType*: cint # XvRGB, XvYUV
|
|
||||||
byte_order*: cint # LSBFirst, MSBFirst
|
|
||||||
guid*: array[0..15, cchar] # Globally Unique IDentifier
|
|
||||||
bits_per_pixel*: cint
|
|
||||||
format*: cint # XvPacked, XvPlanar
|
|
||||||
num_planes*: cint # for RGB formats only
|
|
||||||
depth*: cint
|
|
||||||
red_mask*: cuint
|
|
||||||
green_mask*: cuint
|
|
||||||
blue_mask*: cuint # for YUV formats only
|
|
||||||
y_sample_bits*: cuint
|
|
||||||
u_sample_bits*: cuint
|
|
||||||
v_sample_bits*: cuint
|
|
||||||
horz_y_period*: cuint
|
|
||||||
horz_u_period*: cuint
|
|
||||||
horz_v_period*: cuint
|
|
||||||
vert_y_period*: cuint
|
|
||||||
vert_u_period*: cuint
|
|
||||||
vert_v_period*: cuint
|
|
||||||
component_order*: array[0..31, char] # e.g. UYVY
|
|
||||||
scanline_order*: cint # XvTopToBottom, XvBottomToTop
|
|
||||||
|
|
||||||
PXvImage* = ptr TXvImage
|
|
||||||
TXvImage*{.final.} = object
|
|
||||||
id*: cint
|
|
||||||
width*, height*: cint
|
|
||||||
data_size*: cint # bytes
|
|
||||||
num_planes*: cint
|
|
||||||
pitches*: cint # bytes
|
|
||||||
offsets*: cint # bytes
|
|
||||||
data*: pointer
|
|
||||||
obdata*: TXPointer
|
|
||||||
|
|
||||||
|
|
||||||
proc XvQueryExtension*(display: PDisplay, p_version, p_revision, p_requestBase,
|
|
||||||
p_eventBase, p_errorBase: cuint): cint{.cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvQueryAdaptors*(display: PDisplay, window: TWindow, p_nAdaptors: cuint,
|
|
||||||
p_pAdaptors: PPXvAdaptorInfo): cint{.cdecl, dynlib: libXv,
|
|
||||||
importc.}
|
|
||||||
proc XvQueryEncodings*(display: PDisplay, port: TXvPortID, p_nEncoding: cuint,
|
|
||||||
p_pEncoding: PPXvEncodingInfo): cint{.cdecl,
|
|
||||||
dynlib: libXv, importc.}
|
|
||||||
proc XvPutVideo*(display: PDisplay, port: TXvPortID, d: TDrawable, gc: TGC,
|
|
||||||
vx, vy: cint, vw, vh: cuint, dx, dy: cint, dw, dh: cuint): cint{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvPutStill*(display: PDisplay, port: TXvPortID, d: TDrawable, gc: TGC,
|
|
||||||
vx, vy: cint, vw, vh: cuint, dx, dy: cint, dw, dh: cuint): cint{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvGetVideo*(display: PDisplay, port: TXvPortID, d: TDrawable, gc: TGC,
|
|
||||||
vx, vy: cint, vw, vh: cuint, dx, dy: cint, dw, dh: cuint): cint{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvGetStill*(display: PDisplay, port: TXvPortID, d: TDrawable, gc: TGC,
|
|
||||||
vx, vy: cint, vw, vh: cuint, dx, dy: cint, dw, dh: cuint): cint{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvStopVideo*(display: PDisplay, port: TXvPortID, drawable: TDrawable): cint{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvGrabPort*(display: PDisplay, port: TXvPortID, time: TTime): cint{.cdecl,
|
|
||||||
dynlib: libXv, importc.}
|
|
||||||
proc XvUngrabPort*(display: PDisplay, port: TXvPortID, time: TTime): cint{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvSelectVideoNotify*(display: PDisplay, drawable: TDrawable, onoff: TBool): cint{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvSelectPortNotify*(display: PDisplay, port: TXvPortID, onoff: TBool): cint{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvSetPortAttribute*(display: PDisplay, port: TXvPortID, attribute: TAtom,
|
|
||||||
value: cint): cint{.cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvGetPortAttribute*(display: PDisplay, port: TXvPortID, attribute: TAtom,
|
|
||||||
p_value: cint): cint{.cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvQueryBestSize*(display: PDisplay, port: TXvPortID, motion: TBool,
|
|
||||||
vid_w, vid_h, drw_w, drw_h: cuint,
|
|
||||||
p_actual_width, p_actual_height: cuint): cint{.cdecl,
|
|
||||||
dynlib: libXv, importc.}
|
|
||||||
proc XvQueryPortAttributes*(display: PDisplay, port: TXvPortID, number: cint): PXvAttribute{.
|
|
||||||
cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvFreeAdaptorInfo*(adaptors: PXvAdaptorInfo){.cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvFreeEncodingInfo*(encodings: PXvEncodingInfo){.cdecl, dynlib: libXv,
|
|
||||||
importc.}
|
|
||||||
proc XvListImageFormats*(display: PDisplay, port_id: TXvPortID,
|
|
||||||
count_return: cint): PXvImageFormatValues{.cdecl,
|
|
||||||
dynlib: libXv, importc.}
|
|
||||||
proc XvCreateImage*(display: PDisplay, port: TXvPortID, id: cint, data: pointer,
|
|
||||||
width, height: cint): PXvImage{.cdecl, dynlib: libXv,
|
|
||||||
importc.}
|
|
||||||
proc XvPutImage*(display: PDisplay, id: TXvPortID, d: TDrawable, gc: TGC,
|
|
||||||
image: PXvImage, src_x, src_y: cint, src_w, src_h: cuint,
|
|
||||||
dest_x, dest_y: cint, dest_w, dest_h: cuint): cint{.cdecl,
|
|
||||||
dynlib: libXv, importc.}
|
|
||||||
proc XvShmPutImage*(display: PDisplay, id: TXvPortID, d: TDrawable, gc: TGC,
|
|
||||||
image: PXvImage, src_x, src_y: cint, src_w, src_h: cuint,
|
|
||||||
dest_x, dest_y: cint, dest_w, dest_h: cuint,
|
|
||||||
send_event: TBool): cint{.cdecl, dynlib: libXv, importc.}
|
|
||||||
proc XvShmCreateImage*(display: PDisplay, port: TXvPortID, id: cint,
|
|
||||||
data: pointer, width, height: cint,
|
|
||||||
shminfo: PXShmSegmentInfo): PXvImage{.cdecl,
|
|
||||||
dynlib: libXv, importc.}
|
|
||||||
# implementation
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
# Package
|
|
||||||
|
|
||||||
version = "0.2.1"
|
|
||||||
author = "Anonymous"
|
|
||||||
description = "Wrapper for the zip library"
|
|
||||||
license = "MIT"
|
|
||||||
|
|
||||||
skipDirs = @["tests"]
|
|
||||||
|
|
||||||
# Dependencies
|
|
||||||
|
|
||||||
requires "nim >= 0.10.0"
|
|
||||||
|
|
||||||
task tests, "Run lib tests":
|
|
||||||
withDir "tests":
|
|
||||||
exec "nim c -r ziptests"
|
|
||||||
exec "nim c -r zlibtests"
|
|
||||||
exec "nim c -r gziptests"
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
||||||
import os
|
|
||||||
import zlib
|
|
||||||
import streams
|
|
||||||
export streams
|
|
||||||
|
|
||||||
## This module implements a gzipfile stream for reading, writing, appending.
|
|
||||||
|
|
||||||
type
|
|
||||||
GzFileStream* = ref object of Stream
|
|
||||||
mode: FileMode
|
|
||||||
f: GzFile
|
|
||||||
|
|
||||||
const SEEK_SET = 0.int32 # Seek from beginning of file.
|
|
||||||
|
|
||||||
proc fsClose(s: Stream) =
|
|
||||||
if not GzFileStream(s).f.isNil:
|
|
||||||
discard gzclose(GzFileStream(s).f)
|
|
||||||
GzFileStream(s).f = nil
|
|
||||||
|
|
||||||
proc fsFlush(s: Stream) =
|
|
||||||
# compiler flushFile also discard c_fflush
|
|
||||||
discard gzflush(GzFileStream(s).f, Z_FINISH)
|
|
||||||
|
|
||||||
proc fsAtEnd(s: Stream): bool =
|
|
||||||
result = gzeof(GzFileStream(s).f) == 1
|
|
||||||
|
|
||||||
proc fsSetPosition(s: Stream, pos: int) =
|
|
||||||
if gzseek(GzFileStream(s).f, pos.ZOffT, SEEK_SET) == -1:
|
|
||||||
if GzFileStream(s).mode in {fmWrite, fmAppend}:
|
|
||||||
raise newException(IOError, "error in gzip stream while seeking! (file is in write/append mode!")
|
|
||||||
else:
|
|
||||||
raise newException(IOError, "error in gzip stream while seeking!")
|
|
||||||
|
|
||||||
proc fsGetPosition(s: Stream): int =
|
|
||||||
result = gztell(GzFileStream(s).f).int
|
|
||||||
|
|
||||||
proc fsReadData(s: Stream, buffer: pointer, bufLen: int): int =
|
|
||||||
result = gzread(GzFileStream(s).f, buffer, bufLen).int
|
|
||||||
if result == -1:
|
|
||||||
if GzFileStream(s).mode in {fmWrite, fmAppend}:
|
|
||||||
raise newException(IOError, "cannot read data from write-only gzip stream!")
|
|
||||||
else:
|
|
||||||
raise newException(IOError, "cannot read from stream!")
|
|
||||||
|
|
||||||
proc fsPeekData(s: Stream, buffer: pointer, bufLen: int): int =
|
|
||||||
let gz = GzFileStream(s)
|
|
||||||
if gz.mode in {fmWrite, fmAppend}:
|
|
||||||
raise newException(IOError, "cannot peek data from write-only gzip stream!")
|
|
||||||
let pos = int(gztell(gz.f))
|
|
||||||
result = fsReadData(s, buffer, bufLen)
|
|
||||||
fsSetPosition(s, pos)
|
|
||||||
|
|
||||||
proc fsWriteData(s: Stream, buffer: pointer, bufLen: int) =
|
|
||||||
if gzwrite(GzFileStream(s).f, buffer, bufLen).int != bufLen:
|
|
||||||
if GzFileStream(s).mode in {fmWrite, fmAppend}:
|
|
||||||
raise newException(IOError, "cannot write data to gzip stream!")
|
|
||||||
else:
|
|
||||||
raise newException(IOError, "cannot write data to read-only gzip stream!")
|
|
||||||
|
|
||||||
|
|
||||||
proc newGzFileStream*(filename: string; mode=fmRead; level=Z_DEFAULT_COMPRESSION): GzFileStream =
|
|
||||||
## Opens a Gzipfile as a file stream. `mode` can be
|
|
||||||
## ``fmRead``, ``fmWrite`` or ``fmAppend``.
|
|
||||||
##
|
|
||||||
## Compression level can be set with ``level`` argument. Currently
|
|
||||||
## ``Z_DEFAULT_COMPRESSION`` is 6.
|
|
||||||
##
|
|
||||||
## Note: ``level`` is ignored if ``mode`` is `fmRead`
|
|
||||||
##
|
|
||||||
## Note: There is only partial support for file seeking
|
|
||||||
## - in fmRead mode, seeking randomly inside the gzip
|
|
||||||
## file will lead to poor performance.
|
|
||||||
## - in fmWrite, fmAppend mode, only forward seeking
|
|
||||||
## is supported.
|
|
||||||
new(result)
|
|
||||||
case mode
|
|
||||||
of fmRead: result.f = gzopen(filename, "rb")
|
|
||||||
of fmWrite: result.f = gzopen(filename, "wb")
|
|
||||||
of fmAppend: result.f = gzopen(filename, "ab")
|
|
||||||
else: raise newException(IOError, "unsupported file mode '" & $mode &
|
|
||||||
"' for GzFileStream!")
|
|
||||||
if result.f.isNil:
|
|
||||||
let err = osLastError()
|
|
||||||
if err != OSErrorCode(0'i32):
|
|
||||||
raiseOSError(err)
|
|
||||||
if mode in {fmWrite, fmAppend}:
|
|
||||||
discard gzsetparams(result.f, level.int32, Z_DEFAULT_STRATEGY.int32)
|
|
||||||
|
|
||||||
result.mode = mode
|
|
||||||
result.closeImpl = fsClose
|
|
||||||
result.atEndImpl = fsAtEnd
|
|
||||||
result.setPositionImpl = fsSetPosition
|
|
||||||
result.getPositionImpl = fsGetPosition
|
|
||||||
result.readDataImpl = fsReadData
|
|
||||||
result.peekDataImpl = fsPeekData
|
|
||||||
result.writeDataImpl = fsWriteData
|
|
||||||
result.flushImpl = fsFlush
|
|
||||||
|
|
@ -1,252 +0,0 @@
|
||||||
#
|
|
||||||
#
|
|
||||||
# Nim's Runtime Library
|
|
||||||
# (c) Copyright 2013 Andreas Rumpf
|
|
||||||
#
|
|
||||||
# See the file "copying.txt", included in this
|
|
||||||
# distribution, for details about the copyright.
|
|
||||||
#
|
|
||||||
|
|
||||||
## Interface to the `libzip <http://www.nih.at/libzip/index.html>`_ library by
|
|
||||||
## Dieter Baron and Thomas Klausner. This version links
|
|
||||||
## against ``libzip2.so.2`` unless you define the symbol ``useLibzipSrc``; then
|
|
||||||
## it is compiled against some old ``libizp_all.c`` file.
|
|
||||||
|
|
||||||
#
|
|
||||||
# zip.h -- exported declarations.
|
|
||||||
# Copyright (C) 1999-2008 Dieter Baron and Thomas Klausner
|
|
||||||
#
|
|
||||||
# This file is part of libzip, a library to manipulate ZIP archives.
|
|
||||||
# The authors can be contacted at <libzip@nih.at>
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in
|
|
||||||
# the documentation and/or other materials provided with the
|
|
||||||
# distribution.
|
|
||||||
# 3. The names of the authors may not be used to endorse or promote
|
|
||||||
# products derived from this software without specific prior
|
|
||||||
# written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
|
|
||||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
|
||||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
||||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
|
||||||
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
||||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
|
||||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
|
|
||||||
import times
|
|
||||||
|
|
||||||
when defined(unix) and not defined(useLibzipSrc):
|
|
||||||
when defined(macosx):
|
|
||||||
{.pragma: mydll, dynlib: "libzip(|2|4).dylib".}
|
|
||||||
else:
|
|
||||||
{.pragma: mydll, dynlib: "libzip(|2).so(|.4|.2|.1|.0)".}
|
|
||||||
else:
|
|
||||||
when defined(unix):
|
|
||||||
{.passl: "-lz".}
|
|
||||||
{.compile: "zip/private/libzip_all.c".}
|
|
||||||
{.pragma: mydll.}
|
|
||||||
|
|
||||||
type
|
|
||||||
ZipSourceCmd* = int32
|
|
||||||
|
|
||||||
ZipSourceCallback* = proc (state: pointer, data: pointer, length: int,
|
|
||||||
cmd: ZipSourceCmd): int {.cdecl.}
|
|
||||||
PZipStat* = ptr ZipStat
|
|
||||||
ZipStat* = object ## the 'zip_stat' struct
|
|
||||||
name*: cstring ## name of the file
|
|
||||||
index*: int32 ## index within archive
|
|
||||||
crc*: int32 ## crc of file data
|
|
||||||
mtime*: Time ## modification time
|
|
||||||
size*: int ## size of file (uncompressed)
|
|
||||||
compSize*: int ## size of file (compressed)
|
|
||||||
compMethod*: int16 ## compression method used
|
|
||||||
encryptionMethod*: int16 ## encryption method used
|
|
||||||
|
|
||||||
Zip = object
|
|
||||||
ZipSource = object
|
|
||||||
ZipFile = object
|
|
||||||
|
|
||||||
PZip* = ptr Zip ## represents a zip archive
|
|
||||||
PZipFile* = ptr ZipFile ## represents a file within an archive
|
|
||||||
PZipSource* = ptr ZipSource ## represents a source for an archive
|
|
||||||
{.deprecated: [TZipSourceCmd: ZipSourceCmd, TZipStat: ZipStat, TZip: Zip,
|
|
||||||
TZipSourceCallback: ZipSourceCallback, TZipSource: ZipSource,
|
|
||||||
TZipFile: ZipFile].}
|
|
||||||
|
|
||||||
# flags for zip_name_locate, zip_fopen, zip_stat, ...
|
|
||||||
const
|
|
||||||
ZIP_CREATE* = 1'i32
|
|
||||||
ZIP_EXCL* = 2'i32
|
|
||||||
ZIP_CHECKCONS* = 4'i32
|
|
||||||
ZIP_FL_NOCASE* = 1'i32 ## ignore case on name lookup
|
|
||||||
ZIP_FL_NODIR* = 2'i32 ## ignore directory component
|
|
||||||
ZIP_FL_COMPRESSED* = 4'i32 ## read compressed data
|
|
||||||
ZIP_FL_UNCHANGED* = 8'i32 ## use original data, ignoring changes
|
|
||||||
ZIP_FL_RECOMPRESS* = 16'i32 ## force recompression of data
|
|
||||||
|
|
||||||
const # archive global flags flags
|
|
||||||
ZIP_AFL_TORRENT* = 1'i32 ## torrent zipped
|
|
||||||
|
|
||||||
const # libzip error codes
|
|
||||||
ZIP_ER_OK* = 0'i32 ## N No error
|
|
||||||
ZIP_ER_MULTIDISK* = 1'i32 ## N Multi-disk zip archives not supported
|
|
||||||
ZIP_ER_RENAME* = 2'i32 ## S Renaming temporary file failed
|
|
||||||
ZIP_ER_CLOSE* = 3'i32 ## S Closing zip archive failed
|
|
||||||
ZIP_ER_SEEK* = 4'i32 ## S Seek error
|
|
||||||
ZIP_ER_READ* = 5'i32 ## S Read error
|
|
||||||
ZIP_ER_WRITE* = 6'i32 ## S Write error
|
|
||||||
ZIP_ER_CRC* = 7'i32 ## N CRC error
|
|
||||||
ZIP_ER_ZIPCLOSED* = 8'i32 ## N Containing zip archive was closed
|
|
||||||
ZIP_ER_NOENT* = 9'i32 ## N No such file
|
|
||||||
ZIP_ER_EXISTS* = 10'i32 ## N File already exists
|
|
||||||
ZIP_ER_OPEN* = 11'i32 ## S Can't open file
|
|
||||||
ZIP_ER_TMPOPEN* = 12'i32 ## S Failure to create temporary file
|
|
||||||
ZIP_ER_ZLIB* = 13'i32 ## Z Zlib error
|
|
||||||
ZIP_ER_MEMORY* = 14'i32 ## N Malloc failure
|
|
||||||
ZIP_ER_CHANGED* = 15'i32 ## N Entry has been changed
|
|
||||||
ZIP_ER_COMPNOTSUPP* = 16'i32 ## N Compression method not supported
|
|
||||||
ZIP_ER_EOF* = 17'i32 ## N Premature EOF
|
|
||||||
ZIP_ER_INVAL* = 18'i32 ## N Invalid argument
|
|
||||||
ZIP_ER_NOZIP* = 19'i32 ## N Not a zip archive
|
|
||||||
ZIP_ER_INTERNAL* = 20'i32 ## N Internal error
|
|
||||||
ZIP_ER_INCONS* = 21'i32 ## N Zip archive inconsistent
|
|
||||||
ZIP_ER_REMOVE* = 22'i32 ## S Can't remove file
|
|
||||||
ZIP_ER_DELETED* = 23'i32 ## N Entry has been deleted
|
|
||||||
|
|
||||||
const # type of system error value
|
|
||||||
ZIP_ET_NONE* = 0'i32 ## sys_err unused
|
|
||||||
ZIP_ET_SYS* = 1'i32 ## sys_err is errno
|
|
||||||
ZIP_ET_ZLIB* = 2'i32 ## sys_err is zlib error code
|
|
||||||
|
|
||||||
const # compression methods
|
|
||||||
ZIP_CM_DEFAULT* = -1'i32 ## better of deflate or store
|
|
||||||
ZIP_CM_STORE* = 0'i32 ## stored (uncompressed)
|
|
||||||
ZIP_CM_SHRINK* = 1'i32 ## shrunk
|
|
||||||
ZIP_CM_REDUCE_1* = 2'i32 ## reduced with factor 1
|
|
||||||
ZIP_CM_REDUCE_2* = 3'i32 ## reduced with factor 2
|
|
||||||
ZIP_CM_REDUCE_3* = 4'i32 ## reduced with factor 3
|
|
||||||
ZIP_CM_REDUCE_4* = 5'i32 ## reduced with factor 4
|
|
||||||
ZIP_CM_IMPLODE* = 6'i32 ## imploded
|
|
||||||
## 7 - Reserved for Tokenizing compression algorithm
|
|
||||||
ZIP_CM_DEFLATE* = 8'i32 ## deflated
|
|
||||||
ZIP_CM_DEFLATE64* = 9'i32 ## deflate64
|
|
||||||
ZIP_CM_PKWARE_IMPLODE* = 10'i32 ## PKWARE imploding
|
|
||||||
## 11 - Reserved by PKWARE
|
|
||||||
ZIP_CM_BZIP2* = 12'i32 ## compressed using BZIP2 algorithm
|
|
||||||
## 13 - Reserved by PKWARE
|
|
||||||
ZIP_CM_LZMA* = 14'i32 ## LZMA (EFS)
|
|
||||||
## 15-17 - Reserved by PKWARE
|
|
||||||
ZIP_CM_TERSE* = 18'i32 ## compressed using IBM TERSE (new)
|
|
||||||
ZIP_CM_LZ77* = 19'i32 ## IBM LZ77 z Architecture (PFS)
|
|
||||||
ZIP_CM_WAVPACK* = 97'i32 ## WavPack compressed data
|
|
||||||
ZIP_CM_PPMD* = 98'i32 ## PPMd version I, Rev 1
|
|
||||||
|
|
||||||
const # encryption methods
|
|
||||||
ZIP_EM_NONE* = 0'i32 ## not encrypted
|
|
||||||
ZIP_EM_TRAD_PKWARE* = 1'i32 ## traditional PKWARE encryption
|
|
||||||
|
|
||||||
const
|
|
||||||
ZIP_EM_UNKNOWN* = 0x0000FFFF'i32 ## unknown algorithm
|
|
||||||
|
|
||||||
const
|
|
||||||
ZIP_SOURCE_OPEN* = 0'i32 ## prepare for reading
|
|
||||||
ZIP_SOURCE_READ* = 1'i32 ## read data
|
|
||||||
ZIP_SOURCE_CLOSE* = 2'i32 ## reading is done
|
|
||||||
ZIP_SOURCE_STAT* = 3'i32 ## get meta information
|
|
||||||
ZIP_SOURCE_ERROR* = 4'i32 ## get error information
|
|
||||||
constZIP_SOURCE_FREE* = 5'i32 ## cleanup and free resources
|
|
||||||
ZIP_SOURCE_SUPPORTS* = 14'i32 ## check supported commands
|
|
||||||
|
|
||||||
proc zip_add*(para1: PZip, para2: cstring, para3: PZipSource): int32 {.cdecl,
|
|
||||||
importc: "zip_add", mydll.}
|
|
||||||
proc zip_add_dir*(para1: PZip, para2: cstring): int32 {.cdecl,
|
|
||||||
importc: "zip_add_dir", mydll.}
|
|
||||||
proc zip_close*(para1: PZip) {.cdecl, importc: "zip_close", mydll.}
|
|
||||||
proc zip_delete*(para1: PZip, para2: int32): int32 {.cdecl, mydll,
|
|
||||||
importc: "zip_delete".}
|
|
||||||
proc zip_error_clear*(para1: PZip) {.cdecl, importc: "zip_error_clear", mydll.}
|
|
||||||
proc zip_error_get*(para1: PZip, para2: ptr int32, para3: ptr int32) {.cdecl,
|
|
||||||
importc: "zip_error_get", mydll.}
|
|
||||||
proc zip_error_get_sys_type*(para1: int32): int32 {.cdecl, mydll,
|
|
||||||
importc: "zip_error_get_sys_type".}
|
|
||||||
proc zip_error_to_str*(para1: cstring, para2: int, para3: int32,
|
|
||||||
para4: int32): int32 {.cdecl, mydll,
|
|
||||||
importc: "zip_error_to_str".}
|
|
||||||
proc zip_fclose*(para1: PZipFile) {.cdecl, mydll,
|
|
||||||
importc: "zip_fclose".}
|
|
||||||
proc zip_file_error_clear*(para1: PZipFile) {.cdecl, mydll,
|
|
||||||
importc: "zip_file_error_clear".}
|
|
||||||
proc zip_file_error_get*(para1: PZipFile, para2: ptr int32, para3: ptr int32) {.
|
|
||||||
cdecl, mydll, importc: "zip_file_error_get".}
|
|
||||||
proc zip_file_strerror*(para1: PZipFile): cstring {.cdecl, mydll,
|
|
||||||
importc: "zip_file_strerror".}
|
|
||||||
proc zip_fopen*(para1: PZip, para2: cstring, para3: int32): PZipFile {.cdecl,
|
|
||||||
mydll, importc: "zip_fopen".}
|
|
||||||
proc zip_fopen_index*(para1: PZip, para2: int32, para3: int32): PZipFile {.
|
|
||||||
cdecl, mydll, importc: "zip_fopen_index".}
|
|
||||||
proc zip_fread*(para1: PZipFile, para2: pointer, para3: int): int {.
|
|
||||||
cdecl, mydll, importc: "zip_fread".}
|
|
||||||
proc zip_get_archive_comment*(para1: PZip, para2: ptr int32, para3: int32): cstring {.
|
|
||||||
cdecl, mydll, importc: "zip_get_archive_comment".}
|
|
||||||
proc zip_get_archive_flag*(para1: PZip, para2: int32, para3: int32): int32 {.
|
|
||||||
cdecl, mydll, importc: "zip_get_archive_flag".}
|
|
||||||
proc zip_get_file_comment*(para1: PZip, para2: int32, para3: ptr int32,
|
|
||||||
para4: int32): cstring {.cdecl, mydll,
|
|
||||||
importc: "zip_get_file_comment".}
|
|
||||||
proc zip_get_name*(para1: PZip, para2: int32, para3: int32): cstring {.cdecl,
|
|
||||||
mydll, importc: "zip_get_name".}
|
|
||||||
proc zip_get_num_files*(para1: PZip): int32 {.cdecl,
|
|
||||||
mydll, importc: "zip_get_num_files".}
|
|
||||||
proc zip_name_locate*(para1: PZip, para2: cstring, para3: int32): int32 {.cdecl,
|
|
||||||
mydll, importc: "zip_name_locate".}
|
|
||||||
proc zip_open*(para1: cstring, para2: int32, para3: ptr int32): PZip {.cdecl,
|
|
||||||
mydll, importc: "zip_open".}
|
|
||||||
proc zip_rename*(para1: PZip, para2: int32, para3: cstring): int32 {.cdecl,
|
|
||||||
mydll, importc: "zip_rename".}
|
|
||||||
proc zip_replace*(para1: PZip, para2: int32, para3: PZipSource): int32 {.cdecl,
|
|
||||||
mydll, importc: "zip_replace".}
|
|
||||||
proc zip_set_archive_comment*(para1: PZip, para2: cstring, para3: int32): int32 {.
|
|
||||||
cdecl, mydll, importc: "zip_set_archive_comment".}
|
|
||||||
proc zip_set_archive_flag*(para1: PZip, para2: int32, para3: int32): int32 {.
|
|
||||||
cdecl, mydll, importc: "zip_set_archive_flag".}
|
|
||||||
proc zip_set_file_comment*(para1: PZip, para2: int32, para3: cstring,
|
|
||||||
para4: int32): int32 {.cdecl, mydll,
|
|
||||||
importc: "zip_set_file_comment".}
|
|
||||||
proc zip_source_buffer*(para1: PZip, para2: pointer, para3: int, para4: int32): PZipSource {.
|
|
||||||
cdecl, mydll, importc: "zip_source_buffer".}
|
|
||||||
proc zip_source_file*(para1: PZip, para2: cstring, para3: int, para4: int): PZipSource {.
|
|
||||||
cdecl, mydll, importc: "zip_source_file".}
|
|
||||||
proc zip_source_filep*(para1: PZip, para2: File, para3: int, para4: int): PZipSource {.
|
|
||||||
cdecl, mydll, importc: "zip_source_filep".}
|
|
||||||
proc zip_source_free*(para1: PZipSource) {.cdecl, mydll,
|
|
||||||
importc: "zip_source_free".}
|
|
||||||
proc zip_source_function*(para1: PZip, para2: ZipSourceCallback,
|
|
||||||
para3: pointer): PZipSource {.cdecl, mydll,
|
|
||||||
importc: "zip_source_function".}
|
|
||||||
proc zip_source_zip*(para1: PZip, para2: PZip, para3: int32, para4: int32,
|
|
||||||
para5: int, para6: int): PZipSource {.cdecl, mydll,
|
|
||||||
importc: "zip_source_zip".}
|
|
||||||
proc zip_stat*(para1: PZip, para2: cstring, para3: int32, para4: PZipStat): int32 {.
|
|
||||||
cdecl, mydll, importc: "zip_stat".}
|
|
||||||
proc zip_stat_index*(para1: PZip, para2: int32, para3: int32, para4: PZipStat): int32 {.
|
|
||||||
cdecl, mydll, importc: "zip_stat_index".}
|
|
||||||
proc zip_stat_init*(para1: PZipStat) {.cdecl, mydll, importc: "zip_stat_init".}
|
|
||||||
proc zip_strerror*(para1: PZip): cstring {.cdecl, mydll, importc: "zip_strerror".}
|
|
||||||
proc zip_unchange*(para1: PZip, para2: int32): int32 {.cdecl, mydll,
|
|
||||||
importc: "zip_unchange".}
|
|
||||||
proc zip_unchange_all*(para1: PZip): int32 {.cdecl, mydll,
|
|
||||||
importc: "zip_unchange_all".}
|
|
||||||
proc zip_unchange_archive*(para1: PZip): int32 {.cdecl, mydll,
|
|
||||||
importc: "zip_unchange_archive".}
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,193 +0,0 @@
|
||||||
#
|
|
||||||
#
|
|
||||||
# Nim's Runtime Library
|
|
||||||
# (c) Copyright 2012 Andreas Rumpf
|
|
||||||
#
|
|
||||||
# See the file "copying.txt", included in this
|
|
||||||
# distribution, for details about the copyright.
|
|
||||||
#
|
|
||||||
|
|
||||||
## This module implements a zip archive creator/reader/modifier.
|
|
||||||
|
|
||||||
import
|
|
||||||
streams, libzip, times, os, strutils
|
|
||||||
|
|
||||||
const BufSize = 8 * 1024
|
|
||||||
|
|
||||||
type
|
|
||||||
ZipArchive* = object of RootObj ## represents a zip archive
|
|
||||||
mode: FileMode
|
|
||||||
w: PZip
|
|
||||||
{.deprecated: [TZipArchive: ZipArchive].}
|
|
||||||
|
|
||||||
proc zipError(z: var ZipArchive) =
|
|
||||||
var e: ref IOError
|
|
||||||
new(e)
|
|
||||||
e.msg = $zip_strerror(z.w)
|
|
||||||
raise e
|
|
||||||
|
|
||||||
proc open*(z: var ZipArchive, filename: string, mode: FileMode = fmRead): bool =
|
|
||||||
## Opens a zip file for reading, writing or appending. All file modes are
|
|
||||||
## supported. Returns true iff successful, false otherwise.
|
|
||||||
var err, flags: int32
|
|
||||||
case mode
|
|
||||||
of fmRead, fmReadWriteExisting, fmAppend: flags = 0
|
|
||||||
of fmWrite:
|
|
||||||
if existsFile(filename): removeFile(filename)
|
|
||||||
flags = ZIP_CREATE or ZIP_EXCL
|
|
||||||
of fmReadWrite: flags = ZIP_CREATE
|
|
||||||
z.w = zip_open(filename, flags, addr(err))
|
|
||||||
z.mode = mode
|
|
||||||
result = z.w != nil
|
|
||||||
|
|
||||||
proc close*(z: var ZipArchive) =
|
|
||||||
## Closes a zip file.
|
|
||||||
zip_close(z.w)
|
|
||||||
|
|
||||||
proc createDir*(z: var ZipArchive, dir: string) =
|
|
||||||
## Creates a directory within the `z` archive. This does not fail if the
|
|
||||||
## directory already exists. Note that for adding a file like
|
|
||||||
## ``"path1/path2/filename"`` it is not necessary
|
|
||||||
## to create the ``"path/path2"`` subdirectories - it will be done
|
|
||||||
## automatically by ``addFile``.
|
|
||||||
assert(z.mode != fmRead)
|
|
||||||
discard zip_add_dir(z.w, dir)
|
|
||||||
zip_error_clear(z.w)
|
|
||||||
|
|
||||||
proc addFile*(z: var ZipArchive, dest, src: string) =
|
|
||||||
## Adds the file `src` to the archive `z` with the name `dest`. `dest`
|
|
||||||
## may contain a path that will be created.
|
|
||||||
assert(z.mode != fmRead)
|
|
||||||
if not fileExists(src):
|
|
||||||
raise newException(IOError, "File '" & src & "' does not exist")
|
|
||||||
var zipsrc = zip_source_file(z.w, src, 0, -1)
|
|
||||||
if zipsrc == nil:
|
|
||||||
#echo("Dest: " & dest)
|
|
||||||
#echo("Src: " & src)
|
|
||||||
zipError(z)
|
|
||||||
if zip_add(z.w, dest, zipsrc) < 0'i32:
|
|
||||||
zip_source_free(zipsrc)
|
|
||||||
zipError(z)
|
|
||||||
|
|
||||||
proc addFile*(z: var ZipArchive, file: string) =
|
|
||||||
## A shortcut for ``addFile(z, file, file)``, i.e. the name of the source is
|
|
||||||
## the name of the destination.
|
|
||||||
addFile(z, file, file)
|
|
||||||
|
|
||||||
proc mySourceCallback(state, data: pointer, len: int,
|
|
||||||
cmd: ZipSourceCmd): int {.cdecl.} =
|
|
||||||
var src = cast[Stream](state)
|
|
||||||
case cmd
|
|
||||||
of ZIP_SOURCE_OPEN:
|
|
||||||
if src.setPositionImpl != nil: setPosition(src, 0) # reset
|
|
||||||
of ZIP_SOURCE_READ:
|
|
||||||
result = readData(src, data, len)
|
|
||||||
of ZIP_SOURCE_CLOSE: close(src)
|
|
||||||
of ZIP_SOURCE_STAT:
|
|
||||||
var stat = cast[PZipStat](data)
|
|
||||||
zip_stat_init(stat)
|
|
||||||
stat.size = high(int32)-1 # we don't know the size
|
|
||||||
stat.mtime = getTime()
|
|
||||||
result = sizeof(ZipStat)
|
|
||||||
of ZIP_SOURCE_ERROR:
|
|
||||||
var err = cast[ptr array[0..1, cint]](data)
|
|
||||||
err[0] = ZIP_ER_INTERNAL
|
|
||||||
err[1] = 0
|
|
||||||
result = 2*sizeof(cint)
|
|
||||||
of constZIP_SOURCE_FREE: GC_unref(src)
|
|
||||||
of ZIP_SOURCE_SUPPORTS:
|
|
||||||
# By default a read-only source is supported, which suits us.
|
|
||||||
result = -1
|
|
||||||
else:
|
|
||||||
# An unknown command, failing
|
|
||||||
result = -1
|
|
||||||
|
|
||||||
proc addFile*(z: var ZipArchive, dest: string, src: Stream) =
|
|
||||||
## Adds a file named with `dest` to the archive `z`. `dest`
|
|
||||||
## may contain a path. The file's content is read from the `src` stream.
|
|
||||||
assert(z.mode != fmRead)
|
|
||||||
GC_ref(src)
|
|
||||||
var zipsrc = zip_source_function(z.w, mySourceCallback, cast[pointer](src))
|
|
||||||
if zipsrc == nil: zipError(z)
|
|
||||||
if zip_add(z.w, dest, zipsrc) < 0'i32:
|
|
||||||
zip_source_free(zipsrc)
|
|
||||||
zipError(z)
|
|
||||||
|
|
||||||
# -------------- zip file stream ---------------------------------------------
|
|
||||||
|
|
||||||
type
|
|
||||||
TZipFileStream = object of StreamObj
|
|
||||||
f: PZipFile
|
|
||||||
atEnd: bool
|
|
||||||
|
|
||||||
PZipFileStream* =
|
|
||||||
ref TZipFileStream ## a reader stream of a file within a zip archive
|
|
||||||
|
|
||||||
proc fsClose(s: Stream) = zip_fclose(PZipFileStream(s).f)
|
|
||||||
proc fsAtEnd(s: Stream): bool = PZipFileStream(s).atEnd
|
|
||||||
proc fsReadData(s: Stream, buffer: pointer, bufLen: int): int =
|
|
||||||
result = zip_fread(PZipFileStream(s).f, buffer, bufLen)
|
|
||||||
if result == 0:
|
|
||||||
PZipFileStream(s).atEnd = true
|
|
||||||
|
|
||||||
proc newZipFileStream(f: PZipFile): PZipFileStream =
|
|
||||||
new(result)
|
|
||||||
result.f = f
|
|
||||||
result.atEnd = false
|
|
||||||
result.closeImpl = fsClose
|
|
||||||
result.readDataImpl = fsReadData
|
|
||||||
result.atEndImpl = fsAtEnd
|
|
||||||
# other methods are nil!
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
proc getStream*(z: var ZipArchive, filename: string): PZipFileStream =
|
|
||||||
## returns a stream that can be used to read the file named `filename`
|
|
||||||
## from the archive `z`. Returns nil in case of an error.
|
|
||||||
## The returned stream does not support the `setPosition`, `getPosition`,
|
|
||||||
## `writeData` or `atEnd` methods.
|
|
||||||
var x = zip_fopen(z.w, filename, 0'i32)
|
|
||||||
if x != nil: result = newZipFileStream(x)
|
|
||||||
|
|
||||||
iterator walkFiles*(z: var ZipArchive): string =
|
|
||||||
## walks over all files in the archive `z` and returns the filename
|
|
||||||
## (including the path).
|
|
||||||
var i = 0'i32
|
|
||||||
var num = zip_get_num_files(z.w)
|
|
||||||
while i < num:
|
|
||||||
yield $zip_get_name(z.w, i, 0'i32)
|
|
||||||
inc(i)
|
|
||||||
|
|
||||||
proc extractFile*(z: var ZipArchive, srcFile: string, dest: Stream) =
|
|
||||||
## extracts a file from the zip archive `z` to the destination stream.
|
|
||||||
var buf: array[BufSize, byte]
|
|
||||||
var strm = getStream(z, srcFile)
|
|
||||||
while true:
|
|
||||||
let bytesRead = strm.readData(addr(buf[0]), buf.len)
|
|
||||||
if bytesRead <= 0: break
|
|
||||||
dest.writeData(addr(buf[0]), bytesRead)
|
|
||||||
|
|
||||||
dest.flush()
|
|
||||||
strm.close()
|
|
||||||
|
|
||||||
proc extractFile*(z: var ZipArchive, srcFile: string, dest: string) =
|
|
||||||
## extracts a file from the zip archive `z` to the destination filename.
|
|
||||||
var file = newFileStream(dest, fmWrite)
|
|
||||||
if file.isNil:
|
|
||||||
raise newException(IOError, "Failed to create output file: " & dest)
|
|
||||||
extractFile(z, srcFile, file)
|
|
||||||
file.close()
|
|
||||||
|
|
||||||
proc extractAll*(z: var ZipArchive, dest: string) =
|
|
||||||
## extracts all files from archive `z` to the destination directory.
|
|
||||||
createDir(dest)
|
|
||||||
for file in walkFiles(z):
|
|
||||||
if file.contains("/"):
|
|
||||||
createDir(dest / file[0..file.rfind("/")])
|
|
||||||
extractFile(z, file, dest / file)
|
|
||||||
|
|
||||||
when not defined(testing) and true:
|
|
||||||
var zip: ZipArchive
|
|
||||||
if not zip.open("nim-0.11.0.zip"):
|
|
||||||
raise newException(IOError, "opening zip failed")
|
|
||||||
zip.extractAll("test")
|
|
||||||
|
|
@ -1,425 +0,0 @@
|
||||||
# Converted from Pascal
|
|
||||||
|
|
||||||
## Interface to the zlib http://www.zlib.net/ compression library.
|
|
||||||
|
|
||||||
when defined(windows):
|
|
||||||
const libz = "zlib1.dll"
|
|
||||||
elif defined(macosx):
|
|
||||||
const libz = "libz.dylib"
|
|
||||||
else:
|
|
||||||
const libz = "libz.so.1"
|
|
||||||
|
|
||||||
type
|
|
||||||
Uint* = int32
|
|
||||||
Ulong* = int
|
|
||||||
Ulongf* = int
|
|
||||||
Pulongf* = ptr Ulongf
|
|
||||||
ZOffT* = int32
|
|
||||||
Pbyte* = cstring
|
|
||||||
Pbytef* = cstring
|
|
||||||
Allocfunc* = proc (p: pointer, items: Uint, size: Uint): pointer{.cdecl.}
|
|
||||||
FreeFunc* = proc (p: pointer, address: pointer){.cdecl.}
|
|
||||||
InternalState*{.final, pure.} = object
|
|
||||||
PInternalState* = ptr InternalState
|
|
||||||
ZStream*{.final, pure.} = object
|
|
||||||
nextIn*: Pbytef
|
|
||||||
availIn*: Uint
|
|
||||||
totalIn*: Ulong
|
|
||||||
nextOut*: Pbytef
|
|
||||||
availOut*: Uint
|
|
||||||
totalOut*: Ulong
|
|
||||||
msg*: Pbytef
|
|
||||||
state*: PInternalState
|
|
||||||
zalloc*: Allocfunc
|
|
||||||
zfree*: FreeFunc
|
|
||||||
opaque*: pointer
|
|
||||||
dataType*: int32
|
|
||||||
adler*: Ulong
|
|
||||||
reserved*: Ulong
|
|
||||||
|
|
||||||
ZStreamRec* = ZStream
|
|
||||||
PZstream* = ptr ZStream
|
|
||||||
GzFile* = pointer
|
|
||||||
ZStreamHeader* = enum
|
|
||||||
DETECT_STREAM,
|
|
||||||
RAW_DEFLATE,
|
|
||||||
ZLIB_STREAM,
|
|
||||||
GZIP_STREAM
|
|
||||||
|
|
||||||
ZlibStreamError* = object of Exception
|
|
||||||
|
|
||||||
{.deprecated: [TInternalState: InternalState, TAllocfunc: Allocfunc,
|
|
||||||
TFreeFunc: FreeFunc, TZStream: ZStream, TZStreamRec: ZStreamRec].}
|
|
||||||
|
|
||||||
const
|
|
||||||
Z_NO_FLUSH* = 0
|
|
||||||
Z_PARTIAL_FLUSH* = 1
|
|
||||||
Z_SYNC_FLUSH* = 2
|
|
||||||
Z_FULL_FLUSH* = 3
|
|
||||||
Z_FINISH* = 4
|
|
||||||
Z_OK* = 0
|
|
||||||
Z_STREAM_END* = 1
|
|
||||||
Z_NEED_DICT* = 2
|
|
||||||
Z_ERRNO* = -1
|
|
||||||
Z_STREAM_ERROR* = -2
|
|
||||||
Z_DATA_ERROR* = -3
|
|
||||||
Z_MEM_ERROR* = -4
|
|
||||||
Z_BUF_ERROR* = -5
|
|
||||||
Z_VERSION_ERROR* = -6
|
|
||||||
Z_NO_COMPRESSION* = 0
|
|
||||||
Z_BEST_SPEED* = 1
|
|
||||||
Z_BEST_COMPRESSION* = 9
|
|
||||||
Z_DEFAULT_COMPRESSION* = -1
|
|
||||||
Z_FILTERED* = 1
|
|
||||||
Z_HUFFMAN_ONLY* = 2
|
|
||||||
Z_DEFAULT_STRATEGY* = 0
|
|
||||||
Z_BINARY* = 0
|
|
||||||
Z_ASCII* = 1
|
|
||||||
Z_UNKNOWN* = 2
|
|
||||||
Z_DEFLATED* = 8
|
|
||||||
Z_NULL* = 0
|
|
||||||
Z_MEM_LEVEL* = 8
|
|
||||||
MAX_WBITS* = 15
|
|
||||||
|
|
||||||
proc zlibVersion*(): cstring{.cdecl, dynlib: libz, importc: "zlibVersion".}
|
|
||||||
proc deflate*(strm: var ZStream, flush: int32): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "deflate".}
|
|
||||||
proc deflateEnd*(strm: var ZStream): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "deflateEnd".}
|
|
||||||
proc inflate*(strm: var ZStream, flush: int32): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "inflate".}
|
|
||||||
proc inflateEnd*(strm: var ZStream): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "inflateEnd".}
|
|
||||||
proc deflateSetDictionary*(strm: var ZStream, dictionary: Pbytef,
|
|
||||||
dictLength: Uint): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "deflateSetDictionary".}
|
|
||||||
proc deflateCopy*(dest, source: var ZStream): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "deflateCopy".}
|
|
||||||
proc deflateReset*(strm: var ZStream): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "deflateReset".}
|
|
||||||
proc deflateParams*(strm: var ZStream, level: int32, strategy: int32): int32{.
|
|
||||||
cdecl, dynlib: libz, importc: "deflateParams".}
|
|
||||||
proc inflateSetDictionary*(strm: var ZStream, dictionary: Pbytef,
|
|
||||||
dictLength: Uint): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "inflateSetDictionary".}
|
|
||||||
proc inflateSync*(strm: var ZStream): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "inflateSync".}
|
|
||||||
proc inflateReset*(strm: var ZStream): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "inflateReset".}
|
|
||||||
proc compress*(dest: Pbytef, destLen: Pulongf, source: Pbytef, sourceLen: Ulong): cint{.
|
|
||||||
cdecl, dynlib: libz, importc: "compress".}
|
|
||||||
proc compress2*(dest: Pbytef, destLen: Pulongf, source: Pbytef,
|
|
||||||
sourceLen: Ulong, level: cint): cint{.cdecl, dynlib: libz,
|
|
||||||
importc: "compress2".}
|
|
||||||
proc uncompress*(dest: Pbytef, destLen: Pulongf, source: Pbytef,
|
|
||||||
sourceLen: Ulong): cint{.cdecl, dynlib: libz,
|
|
||||||
importc: "uncompress".}
|
|
||||||
proc compressBound*(sourceLen: Ulong): Ulong {.cdecl, dynlib: libz, importc.}
|
|
||||||
proc gzopen*(path: cstring, mode: cstring): GzFile{.cdecl, dynlib: libz,
|
|
||||||
importc: "gzopen".}
|
|
||||||
proc gzdopen*(fd: int32, mode: cstring): GzFile{.cdecl, dynlib: libz,
|
|
||||||
importc: "gzdopen".}
|
|
||||||
proc gzsetparams*(thefile: GzFile, level: int32, strategy: int32): int32{.cdecl,
|
|
||||||
dynlib: libz, importc: "gzsetparams".}
|
|
||||||
proc gzread*(thefile: GzFile, buf: pointer, length: int): int32{.cdecl,
|
|
||||||
dynlib: libz, importc: "gzread".}
|
|
||||||
proc gzwrite*(thefile: GzFile, buf: pointer, length: int): int32{.cdecl,
|
|
||||||
dynlib: libz, importc: "gzwrite".}
|
|
||||||
proc gzprintf*(thefile: GzFile, format: Pbytef): int32{.varargs, cdecl,
|
|
||||||
dynlib: libz, importc: "gzprintf".}
|
|
||||||
proc gzputs*(thefile: GzFile, s: Pbytef): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "gzputs".}
|
|
||||||
proc gzgets*(thefile: GzFile, buf: Pbytef, length: int32): Pbytef{.cdecl,
|
|
||||||
dynlib: libz, importc: "gzgets".}
|
|
||||||
proc gzputc*(thefile: GzFile, c: char): char{.cdecl, dynlib: libz,
|
|
||||||
importc: "gzputc".}
|
|
||||||
proc gzgetc*(thefile: GzFile): char{.cdecl, dynlib: libz, importc: "gzgetc".}
|
|
||||||
proc gzflush*(thefile: GzFile, flush: int32): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "gzflush".}
|
|
||||||
proc gzseek*(thefile: GzFile, offset: ZOffT, whence: int32): ZOffT{.cdecl,
|
|
||||||
dynlib: libz, importc: "gzseek".}
|
|
||||||
proc gzrewind*(thefile: GzFile): int32{.cdecl, dynlib: libz, importc: "gzrewind".}
|
|
||||||
proc gztell*(thefile: GzFile): ZOffT{.cdecl, dynlib: libz, importc: "gztell".}
|
|
||||||
proc gzeof*(thefile: GzFile): int {.cdecl, dynlib: libz, importc: "gzeof".}
|
|
||||||
proc gzclose*(thefile: GzFile): int32{.cdecl, dynlib: libz, importc: "gzclose".}
|
|
||||||
proc gzerror*(thefile: GzFile, errnum: var int32): Pbytef{.cdecl, dynlib: libz,
|
|
||||||
importc: "gzerror".}
|
|
||||||
proc adler32*(adler: Ulong, buf: Pbytef, length: Uint): Ulong{.cdecl,
|
|
||||||
dynlib: libz, importc: "adler32".}
|
|
||||||
## **Warning**: Adler-32 requires at least a few hundred bytes to get rolling.
|
|
||||||
proc crc32*(crc: Ulong, buf: Pbytef, length: Uint): Ulong{.cdecl, dynlib: libz,
|
|
||||||
importc: "crc32".}
|
|
||||||
proc deflateInitu*(strm: var ZStream, level: int32, version: cstring,
|
|
||||||
streamSize: int32): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "deflateInit_".}
|
|
||||||
proc inflateInitu*(strm: var ZStream, version: cstring,
|
|
||||||
streamSize: int32): int32 {.
|
|
||||||
cdecl, dynlib: libz, importc: "inflateInit_".}
|
|
||||||
proc deflateInit*(strm: var ZStream, level: int32): int32
|
|
||||||
proc inflateInit*(strm: var ZStream): int32
|
|
||||||
proc deflateInit2u*(strm: var ZStream, level: int32, `method`: int32,
|
|
||||||
windowBits: int32, memLevel: int32, strategy: int32,
|
|
||||||
version: cstring, streamSize: int32): int32 {.cdecl,
|
|
||||||
dynlib: libz, importc: "deflateInit2_".}
|
|
||||||
proc inflateInit2u*(strm: var ZStream, windowBits: int32, version: cstring,
|
|
||||||
streamSize: int32): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "inflateInit2_".}
|
|
||||||
proc deflateInit2*(strm: var ZStream,
|
|
||||||
level, `method`, windowBits, memLevel,
|
|
||||||
strategy: int32): int32
|
|
||||||
proc inflateInit2*(strm: var ZStream, windowBits: int32): int32
|
|
||||||
proc zError*(err: int32): cstring{.cdecl, dynlib: libz, importc: "zError".}
|
|
||||||
proc inflateSyncPoint*(z: PZstream): int32{.cdecl, dynlib: libz,
|
|
||||||
importc: "inflateSyncPoint".}
|
|
||||||
proc getCrcTable*(): pointer{.cdecl, dynlib: libz, importc: "get_crc_table".}
|
|
||||||
|
|
||||||
proc deflateBound*(strm: var ZStream, sourceLen: ULong): ULong {.cdecl,
|
|
||||||
dynlib: libz, importc: "deflateBound".}
|
|
||||||
|
|
||||||
proc deflateInit(strm: var ZStream, level: int32): int32 =
|
|
||||||
result = deflateInitu(strm, level, zlibVersion(), sizeof(ZStream).cint)
|
|
||||||
|
|
||||||
proc inflateInit(strm: var ZStream): int32 =
|
|
||||||
result = inflateInitu(strm, zlibVersion(), sizeof(ZStream).cint)
|
|
||||||
|
|
||||||
proc deflateInit2(strm: var ZStream,
|
|
||||||
level, `method`, windowBits, memLevel,
|
|
||||||
strategy: int32): int32 =
|
|
||||||
result = deflateInit2u(strm, level, `method`, windowBits, memLevel,
|
|
||||||
strategy, zlibVersion(), sizeof(ZStream).cint)
|
|
||||||
|
|
||||||
proc inflateInit2(strm: var ZStream, windowBits: int32): int32 =
|
|
||||||
result = inflateInit2u(strm, windowBits, zlibVersion(),
|
|
||||||
sizeof(ZStream).cint)
|
|
||||||
|
|
||||||
proc zlibAllocMem*(appData: pointer, items, size: int): pointer {.cdecl.} =
|
|
||||||
result = alloc(items * size)
|
|
||||||
|
|
||||||
proc zlibFreeMem*(appData, `block`: pointer) {.cdecl.} =
|
|
||||||
dealloc(`block`)
|
|
||||||
|
|
||||||
|
|
||||||
proc compress*(sourceBuf: cstring; sourceLen: int; level=Z_DEFAULT_COMPRESSION; stream=GZIP_STREAM): string =
|
|
||||||
## Given a cstring, returns its deflated version with an optional header.
|
|
||||||
##
|
|
||||||
## Valid argument for ``stream`` are
|
|
||||||
## - ``ZLIB_STREAM`` - add a zlib header and footer.
|
|
||||||
## - ``GZIP_STREAM`` - add a basic gzip header and footer.
|
|
||||||
## - ``RAW_DEFLATE`` - no header is generated.
|
|
||||||
##
|
|
||||||
## Passing a nil cstring will crash this proc in release mode and assert in
|
|
||||||
## debug mode.
|
|
||||||
##
|
|
||||||
## Compression level can be set with ``level`` argument. Currently
|
|
||||||
## ``Z_DEFAULT_COMPRESSION`` is 6.
|
|
||||||
##
|
|
||||||
## Returns "" on failure.
|
|
||||||
assert(not sourceBuf.isNil)
|
|
||||||
assert(sourceLen >= 0)
|
|
||||||
|
|
||||||
var z: ZStream
|
|
||||||
var windowBits = MAX_WBITS
|
|
||||||
case (stream)
|
|
||||||
of RAW_DEFLATE: windowBits = -MAX_WBITS
|
|
||||||
of GZIP_STREAM: windowBits = MAX_WBITS + 16
|
|
||||||
of ZLIB_STREAM, DETECT_STREAM:
|
|
||||||
discard # DETECT_STREAM defaults to ZLIB_STREAM
|
|
||||||
|
|
||||||
var status = deflateInit2(z, level.int32, Z_DEFLATED.int32,
|
|
||||||
windowBits.int32, Z_MEM_LEVEL.int32,
|
|
||||||
Z_DEFAULT_STRATEGY.int32)
|
|
||||||
case status
|
|
||||||
of Z_OK: discard
|
|
||||||
of Z_MEM_ERROR: raise newException(OutOfMemError, "")
|
|
||||||
of Z_STREAM_ERROR: raise newException(ZlibStreamError, "invalid zlib stream parameter!")
|
|
||||||
of Z_VERSION_ERROR: raise newException(ZlibStreamError, "zlib version mismatch!")
|
|
||||||
else: raise newException(ZlibStreamError, "Unkown error(" & $status & ") : " & $z.msg)
|
|
||||||
|
|
||||||
let space = deflateBound(z, sourceLen)
|
|
||||||
var compressed = newStringOfCap(space)
|
|
||||||
z.next_in = sourceBuf
|
|
||||||
z.avail_in = sourceLen.Uint
|
|
||||||
z.next_out = addr(compressed[0])
|
|
||||||
z.avail_out = space.Uint
|
|
||||||
|
|
||||||
status = deflate(z, Z_FINISH)
|
|
||||||
if status != Z_STREAM_END:
|
|
||||||
discard deflateEnd(z) # cleanup allocated ressources
|
|
||||||
raise newException(ZlibStreamError, "Invalid stream state(" & $status & ") : " & $z.msg)
|
|
||||||
|
|
||||||
status = deflateEnd(z)
|
|
||||||
if status != Z_OK: # cleanup allocated ressources
|
|
||||||
raise newException(ZlibStreamError, "Invalid stream state(" & $status & ") : " & $z.msg)
|
|
||||||
|
|
||||||
compressed.setLen(z.total_out)
|
|
||||||
swap(result, compressed)
|
|
||||||
|
|
||||||
proc compress*(input: string; level=Z_DEFAULT_COMPRESSION; stream=GZIP_STREAM): string =
|
|
||||||
## Given a string, returns its deflated version with an optional header.
|
|
||||||
##
|
|
||||||
## Valid arguments for ``stream`` are
|
|
||||||
## - ``ZLIB_STREAM`` - add a zlib header and footer.
|
|
||||||
## - ``GZIP_STREAM`` - add a basic gzip header and footer.
|
|
||||||
## - ``RAW_DEFLATE`` - no header is generated.
|
|
||||||
##
|
|
||||||
## Compression level can be set with ``level`` argument. Currently
|
|
||||||
## ``Z_DEFAULT_COMPRESSION`` is 6.
|
|
||||||
##
|
|
||||||
## Returns "" on failure.
|
|
||||||
result = compress(input, input.len, level, stream)
|
|
||||||
|
|
||||||
proc uncompress*(sourceBuf: cstring, sourceLen: Natural; stream=DETECT_STREAM): string =
|
|
||||||
## Given a deflated buffer returns its inflated content as a string.
|
|
||||||
##
|
|
||||||
## Valid arguments for ``stream`` are
|
|
||||||
## - ``DETECT_STREAM`` - detect if zlib or gzip header is present
|
|
||||||
## and decompress stream. Fail on raw deflate stream.
|
|
||||||
## - ``ZLIB_STREAM`` - decompress a zlib stream.
|
|
||||||
## - ``GZIP_STREAM`` - decompress a gzip stream.
|
|
||||||
## - ``RAW_DEFLATE`` - decompress a raw deflate stream.
|
|
||||||
##
|
|
||||||
## Passing a nil cstring will crash this proc in release mode and assert in
|
|
||||||
## debug mode.
|
|
||||||
##
|
|
||||||
## Returns "" on problems. Failure is a very loose concept, it could be you
|
|
||||||
## passing a non deflated string, or it could mean not having enough memory
|
|
||||||
## for the inflated version.
|
|
||||||
##
|
|
||||||
## The uncompression algorithm is based on http://zlib.net/zpipe.c.
|
|
||||||
assert(not sourceBuf.isNil)
|
|
||||||
assert(sourceLen >= 0)
|
|
||||||
var z: ZStream
|
|
||||||
var decompressed: string = ""
|
|
||||||
var sbytes = 0
|
|
||||||
var wbytes = 0
|
|
||||||
## allocate inflate state
|
|
||||||
|
|
||||||
z.availIn = 0
|
|
||||||
var wbits = case (stream)
|
|
||||||
of RAW_DEFLATE: -MAX_WBITS
|
|
||||||
of ZLIB_STREAM: MAX_WBITS
|
|
||||||
of GZIP_STREAM: MAX_WBITS + 16
|
|
||||||
of DETECT_STREAM: MAX_WBITS + 32
|
|
||||||
|
|
||||||
var status = inflateInit2(z, wbits.int32)
|
|
||||||
|
|
||||||
case status
|
|
||||||
of Z_OK: discard
|
|
||||||
of Z_MEM_ERROR: raise newException(OutOfMemError, "")
|
|
||||||
of Z_STREAM_ERROR: raise newException(ZlibStreamError, "invalid zlib stream parameter!")
|
|
||||||
of Z_VERSION_ERROR: raise newException(ZlibStreamError, "zlib version mismatch!")
|
|
||||||
else: raise newException(ZlibStreamError, "Unkown error(" & $status & ") : " & $z.msg)
|
|
||||||
|
|
||||||
# run loop until all input is consumed.
|
|
||||||
# handle concatenated deflated stream with header.
|
|
||||||
while true:
|
|
||||||
z.availIn = (sourceLen - sbytes).int32
|
|
||||||
|
|
||||||
# no more input available
|
|
||||||
if (sourceLen - sbytes) <= 0: break
|
|
||||||
z.nextIn = sourceBuf[sbytes].unsafeaddr
|
|
||||||
|
|
||||||
# run inflate() on available input until output buffer is full
|
|
||||||
while true:
|
|
||||||
# if written bytes >= output size : resize output
|
|
||||||
if wbytes >= decompressed.len:
|
|
||||||
let cur_outlen = decompressed.len
|
|
||||||
let new_outlen = if decompressed.len == 0: sourceLen*2 else: decompressed.len*2
|
|
||||||
if new_outlen < cur_outlen: # unsigned integer overflow, buffer too large
|
|
||||||
discard inflateEnd(z);
|
|
||||||
raise newException(OverflowError, "zlib stream decompressed size is too large! (size > " & $int.high & ")")
|
|
||||||
|
|
||||||
decompressed.setLen(new_outlen)
|
|
||||||
|
|
||||||
# available space for decompression
|
|
||||||
let space = decompressed.len - wbytes
|
|
||||||
z.availOut = space.Uint
|
|
||||||
z.nextOut = decompressed[wbytes].addr
|
|
||||||
|
|
||||||
status = inflate(z, Z_NO_FLUSH)
|
|
||||||
if status.int8 notin {Z_OK.int8, Z_STREAM_END.int8, Z_BUF_ERROR.int8}:
|
|
||||||
discard inflateEnd(z)
|
|
||||||
case status
|
|
||||||
of Z_MEM_ERROR: raise newException(OutOfMemError, "")
|
|
||||||
of Z_DATA_ERROR: raise newException(ZlibStreamError, "invalid zlib stream parameter!")
|
|
||||||
else: raise newException(ZlibStreamError, "Unkown error(" & $status & ") : " & $z.msg)
|
|
||||||
|
|
||||||
# add written bytes, if any.
|
|
||||||
wbytes += space - z.availOut.int
|
|
||||||
|
|
||||||
# may need more input
|
|
||||||
if not (z.availOut == 0): break
|
|
||||||
|
|
||||||
# inflate() says stream is done
|
|
||||||
if (status == Z_STREAM_END):
|
|
||||||
# may have another stream concatenated
|
|
||||||
if z.availIn != 0:
|
|
||||||
sbytes = sourceLen - z.availIn # add consumed bytes
|
|
||||||
if inflateReset(z) != Z_OK: # reset zlib struct and try again
|
|
||||||
raise newException(ZlibStreamError, "Invalid stream state(" & $status & ") : " & $z.msg)
|
|
||||||
else:
|
|
||||||
break # end of decompression
|
|
||||||
|
|
||||||
# clean up and don't care about any error
|
|
||||||
discard inflateEnd(z)
|
|
||||||
|
|
||||||
if status != Z_STREAM_END:
|
|
||||||
raise newException(ZlibStreamError, "Invalid stream state(" & $status & ") : " & $z.msg)
|
|
||||||
|
|
||||||
decompressed.setLen(wbytes)
|
|
||||||
swap(result, decompressed)
|
|
||||||
|
|
||||||
|
|
||||||
proc uncompress*(sourceBuf: string; stream=DETECT_STREAM): string =
|
|
||||||
## Given a GZIP-ed string return its inflated content.
|
|
||||||
##
|
|
||||||
## Valid arguments for ``stream`` are
|
|
||||||
## - ``DETECT_STREAM`` - detect if zlib or gzip header is present
|
|
||||||
## and decompress stream. Fail on raw deflate stream.
|
|
||||||
## - ``ZLIB_STREAM`` - decompress a zlib stream.
|
|
||||||
## - ``GZIP_STREAM`` - decompress a gzip stream.
|
|
||||||
## - ``RAW_DEFLATE`` - decompress a raw deflate stream.
|
|
||||||
##
|
|
||||||
## Returns "" on failure.
|
|
||||||
result = uncompress(sourceBuf, sourceBuf.len, stream)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
proc deflate*(buffer: var string; level=Z_DEFAULT_COMPRESSION; stream=GZIP_STREAM): bool {.discardable.} =
|
|
||||||
## Convenience proc which deflates a string and insert an optional header/footer.
|
|
||||||
##
|
|
||||||
## Valid arguments for ``stream`` are
|
|
||||||
## - ``ZLIB_STREAM`` - add a zlib header and footer.
|
|
||||||
## - ``GZIP_STREAM`` - add a basic gzip header and footer.
|
|
||||||
## - ``RAW_DEFLATE`` - no header is generated.
|
|
||||||
##
|
|
||||||
## Compression level can be set with ``level`` argument. Currently
|
|
||||||
## ``Z_DEFAULT_COMPRESSION`` is 6.
|
|
||||||
##
|
|
||||||
## Returns true if `buffer` was successfully deflated otherwise the buffer is untouched.
|
|
||||||
|
|
||||||
var temp = compress(addr(buffer[0]), buffer.len, level, stream)
|
|
||||||
if temp.len != 0:
|
|
||||||
swap(buffer, temp)
|
|
||||||
result = true
|
|
||||||
|
|
||||||
proc inflate*(buffer: var string; stream=DETECT_STREAM): bool {.discardable.} =
|
|
||||||
## Convenience proc which inflates a string containing compressed data
|
|
||||||
## with an optional header.
|
|
||||||
##
|
|
||||||
## Valid argument for ``stream`` are:
|
|
||||||
## - ``DETECT_STREAM`` - detect if zlib or gzip header is present
|
|
||||||
## and decompress stream. Fail on raw deflate stream.
|
|
||||||
## - ``ZLIB_STREAM`` - decompress a zlib stream.
|
|
||||||
## - ``GZIP_STREAM`` - decompress a gzip stream.
|
|
||||||
## - ``RAW_DEFLATE`` - decompress a raw deflate stream.
|
|
||||||
##
|
|
||||||
## It is ok to pass a buffer which doesn't contain deflated data,
|
|
||||||
## in this case the proc won't modify the buffer.
|
|
||||||
##
|
|
||||||
## Returns true if `buffer` was successfully inflated.
|
|
||||||
|
|
||||||
var temp = uncompress(addr(buffer[0]), buffer.len, stream)
|
|
||||||
if temp.len != 0:
|
|
||||||
swap(buffer, temp)
|
|
||||||
result = true
|
|
||||||
|
|
@ -1,176 +0,0 @@
|
||||||
#
|
|
||||||
#
|
|
||||||
# Nim's Runtime Library
|
|
||||||
# (c) Copyright 2008 Andreas Rumpf
|
|
||||||
#
|
|
||||||
# See the file "copying.txt", included in this
|
|
||||||
# distribution, for details about the copyright.
|
|
||||||
#
|
|
||||||
|
|
||||||
## This module is an interface to the zzip library.
|
|
||||||
|
|
||||||
# Author:
|
|
||||||
# Guido Draheim <guidod@gmx.de>
|
|
||||||
# Tomi Ollila <Tomi.Ollila@iki.fi>
|
|
||||||
# Copyright (c) 1999,2000,2001,2002,2003,2004 Guido Draheim
|
|
||||||
# All rights reserved,
|
|
||||||
# usage allowed under the restrictions of the
|
|
||||||
# Lesser GNU General Public License
|
|
||||||
# or alternatively the restrictions
|
|
||||||
# of the Mozilla Public License 1.1
|
|
||||||
|
|
||||||
when defined(windows):
|
|
||||||
const
|
|
||||||
dllname = "zzip.dll"
|
|
||||||
else:
|
|
||||||
const
|
|
||||||
dllname = "libzzip.so"
|
|
||||||
|
|
||||||
type
|
|
||||||
TZZipError* = int32 # Name conflict if we drop the `T`
|
|
||||||
|
|
||||||
const
|
|
||||||
ZZIP_ERROR* = -4096'i32
|
|
||||||
ZZIP_NO_ERROR* = 0'i32 # no error, may be used if user sets it.
|
|
||||||
ZZIP_OUTOFMEM* = ZZIP_ERROR - 20'i32 # out of memory
|
|
||||||
ZZIP_DIR_OPEN* = ZZIP_ERROR - 21'i32 # failed to open zipfile, see errno for details
|
|
||||||
ZZIP_DIR_STAT* = ZZIP_ERROR - 22'i32 # failed to fstat zipfile, see errno for details
|
|
||||||
ZZIP_DIR_SEEK* = ZZIP_ERROR - 23'i32 # failed to lseek zipfile, see errno for details
|
|
||||||
ZZIP_DIR_READ* = ZZIP_ERROR - 24'i32 # failed to read zipfile, see errno for details
|
|
||||||
ZZIP_DIR_TOO_SHORT* = ZZIP_ERROR - 25'i32
|
|
||||||
ZZIP_DIR_EDH_MISSING* = ZZIP_ERROR - 26'i32
|
|
||||||
ZZIP_DIRSIZE* = ZZIP_ERROR - 27'i32
|
|
||||||
ZZIP_ENOENT* = ZZIP_ERROR - 28'i32
|
|
||||||
ZZIP_UNSUPP_COMPR* = ZZIP_ERROR - 29'i32
|
|
||||||
ZZIP_CORRUPTED* = ZZIP_ERROR - 31'i32
|
|
||||||
ZZIP_UNDEF* = ZZIP_ERROR - 32'i32
|
|
||||||
ZZIP_DIR_LARGEFILE* = ZZIP_ERROR - 33'i32
|
|
||||||
|
|
||||||
ZZIP_CASELESS* = 1'i32 shl 12'i32
|
|
||||||
ZZIP_NOPATHS* = 1'i32 shl 13'i32
|
|
||||||
ZZIP_PREFERZIP* = 1'i32 shl 14'i32
|
|
||||||
ZZIP_ONLYZIP* = 1'i32 shl 16'i32
|
|
||||||
ZZIP_FACTORY* = 1'i32 shl 17'i32
|
|
||||||
ZZIP_ALLOWREAL* = 1'i32 shl 18'i32
|
|
||||||
ZZIP_THREADED* = 1'i32 shl 19'i32
|
|
||||||
|
|
||||||
type
|
|
||||||
ZZipDir* {.final, pure.} = object
|
|
||||||
ZZipFile* {.final, pure.} = object
|
|
||||||
ZZipPluginIO* {.final, pure.} = object
|
|
||||||
|
|
||||||
ZZipDirent* {.final, pure.} = object
|
|
||||||
d_compr*: int32 ## compression method
|
|
||||||
d_csize*: int32 ## compressed size
|
|
||||||
st_size*: int32 ## file size / decompressed size
|
|
||||||
d_name*: cstring ## file name / strdupped name
|
|
||||||
|
|
||||||
ZZipStat* = ZZipDirent
|
|
||||||
{.deprecated: [TZZipDir: ZzipDir, TZZipFile: ZzipFile,
|
|
||||||
TZZipPluginIO: ZzipPluginIO, TZZipDirent: ZzipDirent,
|
|
||||||
TZZipStat: ZZipStat].}
|
|
||||||
|
|
||||||
proc zzip_strerror*(errcode: int32): cstring {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_strerror".}
|
|
||||||
proc zzip_strerror_of*(dir: ptr ZZipDir): cstring {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_strerror_of".}
|
|
||||||
proc zzip_errno*(errcode: int32): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_errno".}
|
|
||||||
|
|
||||||
proc zzip_geterror*(dir: ptr ZZipDir): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_error".}
|
|
||||||
proc zzip_seterror*(dir: ptr ZZipDir, errcode: int32) {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_seterror".}
|
|
||||||
proc zzip_compr_str*(compr: int32): cstring {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_compr_str".}
|
|
||||||
proc zzip_dirhandle*(fp: ptr ZZipFile): ptr ZZipDir {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_dirhandle".}
|
|
||||||
proc zzip_dirfd*(dir: ptr ZZipDir): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_dirfd".}
|
|
||||||
proc zzip_dir_real*(dir: ptr ZZipDir): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_dir_real".}
|
|
||||||
proc zzip_file_real*(fp: ptr ZZipFile): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_file_real".}
|
|
||||||
proc zzip_realdir*(dir: ptr ZZipDir): pointer {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_realdir".}
|
|
||||||
proc zzip_realfd*(fp: ptr ZZipFile): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_realfd".}
|
|
||||||
|
|
||||||
proc zzip_dir_alloc*(fileext: cstringArray): ptr ZZipDir {.cdecl,
|
|
||||||
dynlib: dllname, importc: "zzip_dir_alloc".}
|
|
||||||
proc zzip_dir_free*(para1: ptr ZZipDir): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_dir_free".}
|
|
||||||
|
|
||||||
proc zzip_dir_fdopen*(fd: int32, errcode_p: ptr TZZipError): ptr ZZipDir {.cdecl,
|
|
||||||
dynlib: dllname, importc: "zzip_dir_fdopen".}
|
|
||||||
proc zzip_dir_open*(filename: cstring, errcode_p: ptr TZZipError): ptr ZZipDir {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_dir_open".}
|
|
||||||
proc zzip_dir_close*(dir: ptr ZZipDir) {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_dir_close".}
|
|
||||||
proc zzip_dir_read*(dir: ptr ZZipDir, dirent: ptr ZZipDirent): int32 {.cdecl,
|
|
||||||
dynlib: dllname, importc: "zzip_dir_read".}
|
|
||||||
|
|
||||||
proc zzip_opendir*(filename: cstring): ptr ZZipDir {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_opendir".}
|
|
||||||
proc zzip_closedir*(dir: ptr ZZipDir) {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_closedir".}
|
|
||||||
proc zzip_readdir*(dir: ptr ZZipDir): ptr ZZipDirent {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_readdir".}
|
|
||||||
proc zzip_rewinddir*(dir: ptr ZZipDir) {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_rewinddir".}
|
|
||||||
proc zzip_telldir*(dir: ptr ZZipDir): int {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_telldir".}
|
|
||||||
proc zzip_seekdir*(dir: ptr ZZipDir, offset: int) {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_seekdir".}
|
|
||||||
|
|
||||||
proc zzip_file_open*(dir: ptr ZZipDir, name: cstring, flags: int32): ptr ZZipFile {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_file_open".}
|
|
||||||
proc zzip_file_close*(fp: ptr ZZipFile) {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_file_close".}
|
|
||||||
proc zzip_file_read*(fp: ptr ZZipFile, buf: pointer, length: int): int {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_file_read".}
|
|
||||||
proc zzip_open*(name: cstring, flags: int32): ptr ZZipFile {.cdecl,
|
|
||||||
dynlib: dllname, importc: "zzip_open".}
|
|
||||||
proc zzip_close*(fp: ptr ZZipFile) {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_close".}
|
|
||||||
proc zzip_read*(fp: ptr ZZipFile, buf: pointer, length: int): int {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_read".}
|
|
||||||
|
|
||||||
proc zzip_freopen*(name: cstring, mode: cstring, para3: ptr ZZipFile): ptr ZZipFile {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_freopen".}
|
|
||||||
proc zzip_fopen*(name: cstring, mode: cstring): ptr ZZipFile {.cdecl,
|
|
||||||
dynlib: dllname, importc: "zzip_fopen".}
|
|
||||||
proc zzip_fread*(p: pointer, size: int, nmemb: int,
|
|
||||||
file: ptr ZZipFile): int {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_fread".}
|
|
||||||
proc zzip_fclose*(fp: ptr ZZipFile) {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_fclose".}
|
|
||||||
|
|
||||||
proc zzip_rewind*(fp: ptr ZZipFile): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_rewind".}
|
|
||||||
proc zzip_seek*(fp: ptr ZZipFile, offset: int, whence: int32): int {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_seek".}
|
|
||||||
proc zzip_tell*(fp: ptr ZZipFile): int {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_tell".}
|
|
||||||
|
|
||||||
proc zzip_dir_stat*(dir: ptr ZZipDir, name: cstring, zs: ptr ZZipStat,
|
|
||||||
flags: int32): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_dir_stat".}
|
|
||||||
proc zzip_file_stat*(fp: ptr ZZipFile, zs: ptr ZZipStat): int32 {.cdecl,
|
|
||||||
dynlib: dllname, importc: "zzip_file_stat".}
|
|
||||||
proc zzip_fstat*(fp: ptr ZZipFile, zs: ptr ZZipStat): int32 {.cdecl, dynlib: dllname,
|
|
||||||
importc: "zzip_fstat".}
|
|
||||||
|
|
||||||
proc zzip_open_shared_io*(stream: ptr ZZipFile, name: cstring,
|
|
||||||
o_flags: int32, o_modes: int32, ext: cstringArray,
|
|
||||||
io: ptr ZZipPluginIO): ptr ZZipFile {.cdecl,
|
|
||||||
dynlib: dllname, importc: "zzip_open_shared_io".}
|
|
||||||
proc zzip_open_ext_io*(name: cstring, o_flags: int32, o_modes: int32,
|
|
||||||
ext: cstringArray, io: ptr ZZipPluginIO): ptr ZZipFile {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_open_ext_io".}
|
|
||||||
proc zzip_opendir_ext_io*(name: cstring, o_modes: int32,
|
|
||||||
ext: cstringArray, io: ptr ZZipPluginIO): ptr ZZipDir {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_opendir_ext_io".}
|
|
||||||
proc zzip_dir_open_ext_io*(filename: cstring, errcode_p: ptr TZZipError,
|
|
||||||
ext: cstringArray, io: ptr ZZipPluginIO): ptr ZZipDir {.
|
|
||||||
cdecl, dynlib: dllname, importc: "zzip_dir_open_ext_io".}
|
|
||||||
|
|
@ -1,21 +1,26 @@
|
||||||
|
# xxx this test is bad (echo instead of error, etc)
|
||||||
|
|
||||||
import zip/zlib
|
import zip/zlib
|
||||||
|
|
||||||
proc compress*(source: string): string =
|
proc compress*(source: string): string =
|
||||||
var
|
var
|
||||||
sourcelen = source.len
|
sourcelen = source.len
|
||||||
destlen = sourcelen + (sourcelen.float * 0.1).int + 16
|
destLen = sourcelen + (sourcelen.float * 0.1).int + 16
|
||||||
result = ""
|
result = ""
|
||||||
result.setLen destLen
|
result.setLen destLen
|
||||||
var res = zlib.compress(cstring(result), addr destLen, cstring(source), sourceLen)
|
# see http://www.zlib.net/zlib-1.2.11.tar.gz for correct definitions
|
||||||
|
var destLen2 = destLen.Ulongf
|
||||||
|
var res = zlib.compress(cstring(result), addr destLen2, cstring(source), sourceLen.Ulong)
|
||||||
if res != Z_OK:
|
if res != Z_OK:
|
||||||
echo "Error occurred: ", res
|
echo "Error occurred: ", res
|
||||||
elif destLen < result.len:
|
elif destLen2.int < result.len:
|
||||||
result.setLen(destLen)
|
result.setLen(destLen2.int)
|
||||||
|
|
||||||
proc uncompress*(source: string, destLen: var int): string =
|
proc uncompress*(source: string, destLen: var int): string =
|
||||||
result = ""
|
result = ""
|
||||||
result.setLen destLen
|
result.setLen destLen
|
||||||
var res = zlib.uncompress(cstring(result), addr destLen, cstring(source), source.len)
|
var destLen2 = destLen.Ulongf
|
||||||
|
var res = zlib.uncompress(cstring(result), addr destLen2, cstring(source), source.len.Ulong)
|
||||||
if res != Z_OK:
|
if res != Z_OK:
|
||||||
echo "Error occurred: ", res
|
echo "Error occurred: ", res
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ template inFold*(desc, body) =
|
||||||
proc execFold*(desc, cmd: string, errorcode: int = QuitFailure, additionalPath = "") =
|
proc execFold*(desc, cmd: string, errorcode: int = QuitFailure, additionalPath = "") =
|
||||||
## Execute shell command. Add log folding for various CI services.
|
## Execute shell command. Add log folding for various CI services.
|
||||||
# https://github.com/travis-ci/travis-ci/issues/2285#issuecomment-42724719
|
# https://github.com/travis-ci/travis-ci/issues/2285#issuecomment-42724719
|
||||||
|
let desc = if desc.len == 0: cmd else: desc
|
||||||
inFold(desc):
|
inFold(desc):
|
||||||
exec(cmd, errorcode, additionalPath)
|
exec(cmd, errorcode, additionalPath)
|
||||||
|
|
||||||
|
|
@ -283,7 +284,7 @@ proc buildDoc(nimArgs, destPath: string) =
|
||||||
|
|
||||||
proc nim2pdf(src: string, dst: string, nimArgs: string) =
|
proc nim2pdf(src: string, dst: string, nimArgs: string) =
|
||||||
# xxx expose as a `nim` command or in some other reusable way.
|
# xxx expose as a `nim` command or in some other reusable way.
|
||||||
let outDir = "build" / "pdflatextmp" # xxx use reusable std/private/paths shared with other modules
|
let outDir = "build" / "pdflatextmp" # xxx factor pending https://github.com/timotheecour/Nim/issues/616
|
||||||
# note: this will generate temporary files in gitignored `outDir`: aux toc log out tex
|
# note: this will generate temporary files in gitignored `outDir`: aux toc log out tex
|
||||||
exec("$# rst2tex $# --outdir:$# $#" % [findNim().quoteShell(), nimArgs, outDir.quoteShell, src.quoteShell])
|
exec("$# rst2tex $# --outdir:$# $#" % [findNim().quoteShell(), nimArgs, outDir.quoteShell, src.quoteShell])
|
||||||
let texFile = outDir / src.lastPathPart.changeFileExt("tex")
|
let texFile = outDir / src.lastPathPart.changeFileExt("tex")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue