examples/lib use the new wrappers

This commit is contained in:
Andreas Rumpf
2010-02-28 23:04:18 +01:00
parent ddb7185482
commit b559285b78
133 changed files with 17038 additions and 151734 deletions

View File

@@ -16,7 +16,7 @@ cc = gcc
path="$lib/pure"
path="$lib/impure"
path="$lib/newwrap"
path="$lib/wrappers"
path="$lib/wrappers/cairo"
path="$lib/wrappers/gtk"
path="$lib/wrappers/lua"

View File

@@ -175,7 +175,8 @@ XML Processing
This module parses an XML Document into a XML DOM Document representation.
* `xmltree <xmltree.html>`_
A simple XML tree. More efficient and simpler than the DOM.
A simple XML tree. More efficient and simpler than the DOM. It also
contains a macro for XML/HTML code generation.
* `xmlparser <xmlparser.html>`_
This module parses an XML document and creates its XML tree representation.
@@ -184,13 +185,6 @@ XML Processing
This module parses an HTML document and creates its XML tree representation.
Code generation
---------------
* `xmlgen <xmlgen.html>`_
This module implements macros for XML/HTML code generation.
Cryptography and Hashing
------------------------
@@ -202,7 +196,6 @@ Cryptography and Hashing
This module implements the MD5 checksum algorithm.
Impure libraries
================

View File

@@ -1,14 +1,15 @@
import cairo
var surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 240, 80)
var cr = cairo_create(surface)
var surface = image_surface_create(FORMAT_ARGB32, 240, 80)
var cr = create(surface)
select_font_face(cr, "serif", FONT_SLANT_NORMAL,
FONT_WEIGHT_BOLD)
set_font_size(cr, 32.0)
set_source_rgb(cr, 0.0, 0.0, 1.0)
move_to(cr, 10.0, 50.0)
show_text(cr, "Hello, world")
destroy(cr)
discard write_to_png(surface, "hello.png")
destroy(surface)
cairo_select_font_face(cr, "serif", CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD)
cairo_set_font_size(cr, 32.0)
cairo_set_source_rgb(cr, 0.0, 0.0, 1.0)
cairo_move_to(cr, 10.0, 50.0)
cairo_show_text(cr, "Hello, world")
cairo_destroy(cr)
discard cairo_surface_write_to_png(surface, "hello.png")
cairo_surface_destroy(surface)

View File

@@ -1,10 +1,10 @@
import
libcurl
var hCurl = curl_easy_init()
var hCurl = easy_init()
if hCurl != nil:
discard curl_easy_setopt(hCurl, CURLOPT_VERBOSE, True)
discard curl_easy_setopt(hCurl, CURLOPT_URL, "http://force7.de/nimrod")
discard curl_easy_perform(hCurl)
curl_easy_cleanup(hCurl)
discard easy_setopt(hCurl, OPT_VERBOSE, True)
discard easy_setopt(hCurl, OPT_URL, "http://force7.de/nimrod")
discard easy_perform(hCurl)
easy_cleanup(hCurl)

View File

@@ -1,14 +1,14 @@
import
cairo, glib2, gtk2
proc destroy(widget: pGtkWidget, data: pgpointer) {.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer) {.cdecl.} =
main_quit()
var
window: pGtkWidget
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
gtk_widget_show(window)
gtk_main()
window: pWidget
nimrod_init()
window = window_new(WINDOW_TOPLEVEL)
discard signal_connect(window, "destroy",
SIGNAL_FUNC(ex1.destroy), nil)
show(window)
main()

View File

@@ -2,20 +2,21 @@
import
glib2, gtk2
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
var
window: PGtkWidget
button: PGtkWidget
window: PWidget
button: PWidget
nimrod_init()
window = window_new(WINDOW_TOPLEVEL)
button = button_new_with_label("Click me")
set_border_width(PContainer(Window), 5)
add(PContainer(window), button)
discard signal_connect(window, "destroy",
SIGNAL_FUNC(ex2.destroy), nil)
show(button)
show(window)
main()
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
button = gtk_button_new_with_label("Click me")
gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
gtk_container_add(GTK_Container(window), button)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
gtk_widget_show(button)
gtk_widget_show(window)
gtk_main()

View File

@@ -2,38 +2,33 @@
import
glib2, gtk2
proc newbutton(ALabel: cstring): PGtkWidget =
Result = gtk_button_new_with_label(ALabel)
gtk_widget_show(result)
proc newbutton(ALabel: cstring): PWidget =
Result = button_new_with_label(ALabel)
show(result)
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
var
window, totalbox, hbox, vbox: PgtkWidget
nimrod_init()
var window = window_new(WINDOW_TOPLEVEL) # Box to divide window in 2 halves:
var totalbox = vbox_new(true, 10)
show(totalbox) # A box for each half of the screen:
var hbox = hbox_new(false, 5)
show(hbox)
var vbox = vbox_new(true, 5)
show(vbox) # Put boxes in their halves
pack_start(totalbox, hbox, true, true, 0)
pack_start(totalbox, vbox, true, true, 0) # Now fill boxes with buttons.
pack_start(hbox, newbutton("Button 1"), false, false, 0)
pack_start(hbox, newbutton("Button 2"), false, false, 0)
pack_start(hbox, newbutton("Button 3"), false, false, 0) # Vertical box
pack_start(vbox, newbutton("Button A"), true, true, 0)
pack_start(vbox, newbutton("Button B"), true, true, 0)
pack_start(vbox, newbutton("Button C"), true, true, 0) # Put totalbox in window
set_border_width(PCONTAINER(Window), 5)
add(PContainer(window), totalbox)
discard signal_connect(window, "destroy", SIGNAL_FUNC(ex3.destroy), nil)
show(window)
main()
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL) # Box to divide window in 2 halves:
totalbox = gtk_vbox_new(true, 10)
gtk_widget_show(totalbox) # A box for each half of the screen:
hbox = gtk_hbox_new(false, 5)
gtk_widget_show(hbox)
vbox = gtk_vbox_new(true, 5)
gtk_widget_show(vbox) # Put boxes in their halves
gtk_box_pack_start(GTK_BOX(totalbox), hbox, true, true, 0)
gtk_box_pack_start(GTK_BOX(totalbox), vbox, true, true, 0) # Now fill boxes with buttons.
# Horizontal box
gtk_box_pack_start(GTK_BOX(hbox), newbutton("Button 1"), false, false, 0)
gtk_box_pack_start(GTK_BOX(hbox), newbutton("Button 2"), false, false, 0)
gtk_box_pack_start(GTK_BOX(hbox), newbutton("Button 3"), false, false, 0) #
# Vertical box
gtk_box_pack_start(GTK_BOX(vbox), newbutton("Button A"), true, true, 0)
gtk_box_pack_start(GTK_BOX(vbox), newbutton("Button B"), true, true, 0)
gtk_box_pack_start(GTK_BOX(vbox), newbutton("Button C"), true, true, 0) # Put
# totalbox in window
gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
gtk_container_add(GTK_Container(window), totalbox)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
gtk_widget_show(window)
gtk_main()

View File

@@ -2,30 +2,28 @@
import
glib2, gtk2
proc newbutton(ALabel: cstring): PGtkWidget =
Result = gtk_button_new_with_label(ALabel)
gtk_widget_show(result)
proc newbutton(ALabel: cstring): PWidget =
Result = button_new_with_label(ALabel)
show(result)
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
var
window, maintable: PgtkWidget
nimrod_init()
var window = window_new(WINDOW_TOPLEVEL)
var Maintable = table_new(6, 6, True)
proc AddToTable(Widget: PGtkWidget, Left, Right, Top, Bottom: guint) =
gtk_table_attach_defaults(GTK_TABLE(MainTable), Widget, Left, right, top,
bottom)
proc AddToTable(Widget: PWidget, Left, Right, Top, Bottom: guint) =
attach_defaults(MainTable, Widget, Left, right, top, bottom)
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
Maintable = gtk_table_new(6, 6, True)
gtk_widget_show(MainTable)
show(MainTable)
AddToTable(newbutton("1,1 At 1,1"), 1, 2, 1, 2)
AddToTable(newbutton("2,2 At 3,1"), 3, 5, 1, 3)
AddToTable(newbutton("4,1 At 4,1"), 1, 5, 4, 5) # Put all in window
gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
gtk_container_add(GTK_Container(window), maintable)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
gtk_widget_show(window)
gtk_main()
set_border_width(Window, 5)
add(window, maintable)
discard signal_connect(window, "destroy",
SignalFunc(ex4.destroy), nil)
show(window)
main()

View File

@@ -2,23 +2,23 @@
import
glib2, gtk2
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
var
window: PGtkWidget
button: PGtkWidget
proc widgetDestroy(w: PWidget) {.cdecl.} =
destroy(w)
nimrod_init()
var window = window_new(WINDOW_TOPLEVEL)
var button = button_new_with_label("Click me")
set_border_width(Window, 5)
add(window, button)
discard signal_connect(window, "destroy",
SIGNAL_FUNC(ex5.destroy), nil)
discard signal_connect_object(button, "clicked",
SIGNAL_FUNC(widgetDestroy),
window)
show(button)
show(window)
main()
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
button = gtk_button_new_with_label("Click me")
gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
gtk_container_add(GTK_Container(window), button)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
discard gtk_signal_connect_object(GTKOBJECT(button), "clicked",
GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTKOBJECT(window))
gtk_widget_show(button)
gtk_widget_show(window)
gtk_main()

View File

@@ -3,50 +3,49 @@ import
glib2, gtk2
type
TButtonSignalState = record
Obj: PgtkObject
TButtonSignalState = object
Obj: gtk2.PObject
SignalID: int32
Disable: bool
PButtonSignalState = ptr TButtonSignalState
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
proc disablesignal(widget: pGtkWidget, data: pgpointer){.cdecl.} =
if PButtonSignalState(Data).Disable:
gtk_signal_handler_block(PButtonSignalState(Data).Obj, SignalID)
proc widgetDestroy(w: PWidget) {.cdecl.} = destroy(w)
proc disablesignal(widget: pWidget, data: pgpointer){.cdecl.} =
var s = cast[PButtonSignalState](Data)
if s.Disable:
signal_handler_block(s.Obj, s.SignalID)
else:
gtk_signal_handler_unblock(PButtonSignalState(Data).Obj, SignalID)
PButtonSignalState(Data).disable = not PButtonSignalState(Data).disable
signal_handler_unblock(s.Obj, s.SignalID)
s.disable = not s.disable
var
window: PGtkWidget
quitbutton: PGtkWidget
disablebutton: PGTKWidget
windowbox: PGTKWidget
quitsignal: guint
QuitState: TButtonSignalState
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
quitbutton = gtk_button_new_with_label("Quit program")
disablebutton = gtk_button_new_with_label("Disable button")
windowbox = gtk_vbox_new(TRUE, 10)
gtk_box_pack_start(GTK_BOX(windowbox), disablebutton, True, false, 0)
gtk_box_pack_start(GTK_BOX(windowbox), quitbutton, True, false, 0)
gtk_container_set_border_width(GTK_CONTAINER(Window), 10)
gtk_container_add(GTK_Container(window), windowbox)
gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
QuitState.Obj = GTKObject(QuitButton)
SignalID = gtk_signal_connect_object(QuitState.Obj, "clicked", GTK_SIGNAL_FUNC(
gtk_widget_destroy), GTKOBJECT(window))
nimrod_init()
var window = window_new(WINDOW_TOPLEVEL)
var quitbutton = button_new_with_label("Quit program")
var disablebutton = button_new_with_label("Disable button")
var windowbox = vbox_new(TRUE, 10)
pack_start(windowbox, disablebutton, True, false, 0)
pack_start(windowbox, quitbutton, True, false, 0)
set_border_width(Window, 10)
add(window, windowbox)
discard signal_connect(window, "destroy", SIGNAL_FUNC(ex6.destroy), nil)
QuitState.Obj = QuitButton
quitState.SignalID = signal_connect_object(QuitState.Obj, "clicked",
SIGNAL_FUNC(widgetDestroy), window)
QuitState.Disable = True
discard gtk_signal_connect(GTKOBJECT(disablebutton), "clicked",
GTK_SIGNAL_FUNC(disablesignal), addr(QuitState))
gtk_widget_show(quitbutton)
gtk_widget_show(disablebutton)
gtk_widget_show(windowbox)
gtk_widget_show(window)
gtk_main()
discard signal_connect(disablebutton, "clicked",
SIGNAL_FUNC(disablesignal), addr(QuitState))
show(quitbutton)
show(disablebutton)
show(windowbox)
show(window)
main()

View File

@@ -2,8 +2,8 @@
import
gdk2, glib2, gtk2
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
const
Inside: cstring = "Mouse is over label"
@@ -11,33 +11,36 @@ const
var
OverLabel: bool
window, box1, box2, stackbox, label1, Label2: PGtkWidget
proc ChangeLabel(P: PGtkWidget, Event: PGdkEventCrossing,
nimrod_init()
var window = window_new(gtk2.WINDOW_TOPLEVEL)
var stackbox = vbox_new(TRUE, 10)
var box1 = event_box_new()
var label1 = label_new("Move mouse over label")
add(box1, label1)
var box2 = event_box_new()
var label2 = label_new(OutSide)
add(box2, label2)
pack_start(stackbox, box1, TRUE, TRUE, 0)
pack_start(stackbox, box2, TRUE, TRUE, 0)
set_border_width(Window, 5)
add(window, stackbox)
discard signal_connect(window, "destroy",
SIGNAL_FUNC(ex7.destroy), nil)
overlabel = False
proc ChangeLabel(P: PWidget, Event: gdk2.PEventCrossing,
Data: var bool){.cdecl.} =
if not Data: gtk_label_set_text(GTKLABEL(Label2), Inside)
else: gtk_label_set_text(GTKLABEL(Label2), Outside)
if not Data: set_text(Label1, Inside)
else: set_text(Label2, Outside)
Data = not Data
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
stackbox = gtk_vbox_new(TRUE, 10)
box1 = gtk_event_box_new()
label1 = gtk_label_new("Move mouse over label")
gtk_container_add(GTK_CONTAINER(box1), label1)
box2 = gtk_event_box_new()
label2 = gtk_label_new(OutSide)
gtk_container_add(GTK_CONTAINER(box2), label2)
gtk_box_pack_start(GTK_BOX(stackbox), box1, TRUE, TRUE, 0)
gtk_box_pack_start(GTK_BOX(stackbox), box2, TRUE, TRUE, 0)
gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
gtk_container_add(GTK_Container(window), stackbox)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
overlabel = False
discard gtk_signal_connect(GTKOBJECT(box1), "enter_notify_event",
GTK_SIGNAL_FUNC(ChangeLabel), addr(Overlabel))
discard gtk_signal_connect(GTKOBJECT(box1), "leave_notify_event",
GTK_SIGNAL_FUNC(ChangeLabel), addr(Overlabel))
gtk_widget_show_all(window)
gtk_main()
discard signal_connect(box1, "enter_notify_event",
SIGNAL_FUNC(ChangeLabel), addr(Overlabel))
discard signal_connect(box1, "leave_notify_event",
SIGNAL_FUNC(ChangeLabel), addr(Overlabel))
show_all(window)
main()

View File

@@ -2,31 +2,28 @@
import
glib2, gtk2
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
var
window, stackbox, label1, Label2: PGtkWidget
labelstyle: pgtkstyle
nimrod_init()
var window = window_new(WINDOW_TOPLEVEL)
var stackbox = vbox_new(TRUE, 10)
var label1 = label_new("Red label text")
var labelstyle = copy(get_style(label1))
LabelStyle.fg[STATE_NORMAL].pixel = 0
LabelStyle.fg[STATE_NORMAL].red = -1'i16
LabelStyle.fg[STATE_NORMAL].blue = 0'i16
LabelStyle.fg[STATE_NORMAL].green = 0'i16
set_style(label1, labelstyle)
# Uncomment this to see the effect of setting the default style.
# set_default_style(labelstyle)
var label2 = label_new("Black label text")
pack_start(stackbox, label1, TRUE, TRUE, 0)
pack_start(stackbox, label2, TRUE, TRUE, 0)
set_border_width(Window, 5)
add(window, stackbox)
discard signal_connect(window, "destroy",
SIGNAL_FUNC(ex8.destroy), nil)
show_all(window)
main()
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
stackbox = gtk_vbox_new(TRUE, 10)
label1 = gtk_label_new("Red label text")
labelstyle = gtk_style_copy(gtk_widget_get_style(label1))
LabelStyle.fg[GTK_STATE_NORMAL].pixel = 0
LabelStyle.fg[GTK_STATE_NORMAL].red = 0x0000FFFF
LabelStyle.fg[GTK_STATE_NORMAL].blue = 0
LabelStyle.fg[GTK_STATE_NORMAL].green = 0
gtk_widget_set_style(label1, labelstyle) # Uncomment this to see the effect of setting the default style.
#
# gtk_widget_set_default_style(labelstyle)
label2 = gtk_label_new("Black label text")
gtk_box_pack_start(GTK_BOX(stackbox), label1, TRUE, TRUE, 0)
gtk_box_pack_start(GTK_BOX(stackbox), label2, TRUE, TRUE, 0)
gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
gtk_container_add(GTK_Container(window), stackbox)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
gtk_widget_show_all(window)
gtk_main()

View File

@@ -2,46 +2,48 @@
import
gdk2, glib2, gtk2
proc destroy(widget: pGtkWidget, data: pgpointer){.cdecl.} =
gtk_main_quit()
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =
main_quit()
const
Inside: cstring = "Mouse is over label"
OutSide: cstring = "Mouse is not over label"
var
window, button1, Button2, Alabel, stackbox: PGtkWidget
buttonstyle: pgtkstyle
OverButton: bool
proc ChangeLabel(P: PGtkWidget, Event: PGdkEventCrossing, Data: var bool){.cdecl.} =
if Not Data: gtk_label_set_text(GTKLABEL(ALabel), Inside)
else: gtk_label_set_text(GTKLABEL(ALabel), Outside)
nimrod_init()
var window = window_new(gtk2.WINDOW_TOPLEVEL)
var stackbox = vbox_new(TRUE, 10)
var button1 = button_new_with_label("Move mouse over button")
var buttonstyle = copy(get_style(Button1))
ButtonStyle.bg[STATE_PRELIGHT].pixel = 0
ButtonStyle.bg[STATE_PRELIGHT].red = -1'i16
ButtonStyle.bg[STATE_PRELIGHT].blue = 0'i16
ButtonStyle.bg[STATE_PRELIGHT].green = 0'i16
set_style(button1, buttonstyle)
var button2 = button_new()
var ALabel = label_new(Outside)
proc ChangeLabel(P: PWidget, Event: gdk2.PEventCrossing,
Data: var bool){.cdecl.} =
if Not Data: set_text(ALabel, Inside)
else: set_text(ALabel, Outside)
Data = Not Data
gtk_nimrod_init()
window = gtk_window_new(GTK_WINDOW_TOPLEVEL)
stackbox = gtk_vbox_new(TRUE, 10)
button1 = gtk_button_new_with_label("Move mouse over button")
buttonstyle = gtk_style_copy(gtk_widget_get_style(Button1))
ButtonStyle.bg[GTK_STATE_PRELIGHT].pixel = 0
ButtonStyle.bg[GTK_STATE_PRELIGHT].red = 0x0000FFFF'i16
ButtonStyle.bg[GTK_STATE_PRELIGHT].blue = 0'i16
ButtonStyle.bg[GTK_STATE_PRELIGHT].green = 0'i16
gtk_widget_set_style(button1, buttonstyle)
button2 = gtk_button_new()
ALabel = gtk_label_new(Outside)
gtk_container_add(GTK_CONTAINER(button2), ALAbel)
gtk_box_pack_start(GTK_BOX(stackbox), button1, TRUE, TRUE, 0)
gtk_box_pack_start(GTK_BOX(stackbox), button2, TRUE, TRUE, 0)
gtk_container_set_border_width(GTK_CONTAINER(Window), 5)
gtk_container_add(GTK_Container(window), stackbox)
discard gtk_signal_connect(GTKOBJECT(window), "destroy",
GTK_SIGNAL_FUNC(destroy), nil)
add(button2, ALAbel)
pack_start(stackbox, button1, TRUE, TRUE, 0)
pack_start(stackbox, button2, TRUE, TRUE, 0)
set_border_width(Window, 5)
add(window, stackbox)
discard signal_connect(window, "destroy",
SIGNAL_FUNC(ex9.destroy), nil)
overbutton = False
discard gtk_signal_connect(GTKOBJECT(button1), "enter_notify_event",
GTK_SIGNAL_FUNC(ChangeLabel), addr(OverButton))
discard gtk_signal_connect(GTKOBJECT(button1), "leave_notify_event",
GTK_SIGNAL_FUNC(ChangeLabel), addr(OverButton))
gtk_widget_show_all(window)
gtk_main()
discard signal_connect(button1, "enter_notify_event",
SIGNAL_FUNC(ChangeLabel), addr(OverButton))
discard signal_connect(button1, "leave_notify_event",
SIGNAL_FUNC(ChangeLabel), addr(OverButton))
show_all(window)
main()

View File

@@ -12,7 +12,7 @@ if paramCount() < 1:
quit("Usage: htmlrefs filename[.html]")
var links = 0 # count the number of links
var filename = appendFileExt(ParamStr(1), "html")
var filename = addFileExt(ParamStr(1), "html")
var s = newFileStream(filename, fmRead)
if s == nil: quit("cannot open the file " & filename)
var x: TXmlParser

View File

@@ -7,7 +7,7 @@ import os, streams, parsexml, strutils
if paramCount() < 1:
quit("Usage: htmltitle filename[.html]")
var filename = appendFileExt(ParamStr(1), "html")
var filename = addFileExt(ParamStr(1), "html")
var s = newFileStream(filename, fmRead)
if s == nil: quit("cannot open the file " & filename)
var x: TXmlParser

View File

@@ -1,8 +1,8 @@
# Filter key=value pairs from "myfile.txt"
import regexprs
import re
for x in lines("myfile.txt"):
if x =~ r"(\w+)=(.*)":
if x =~ re"(\w+)=(.*)":
echo "Key: ", matches[1],
" Value: ", matches[2]

View File

@@ -8,8 +8,8 @@ const
print 'hi'
"""
var L = luaL_newstate()
luaL_openlibs(L)
discard luaL_loadbuffer(L, code, code.len, "line")
discard lua_pcall(L, 0, 0, 0)
var L = newstate()
openlibs(L)
discard loadbuffer(L, code, code.len, "line")
discard pcall(L, 0, 0, 0)

View File

@@ -4,23 +4,23 @@ import
SDL
var
screen, greeting: PSDL_Surface
r: TSDL_Rect
screen, greeting: PSurface
r: TRect
if SDL_Init(SDL_INIT_VIDEO) == 0:
screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE or SDL_ANYFORMAT)
if Init(INIT_VIDEO) == 0:
screen = SetVideoMode(640, 480, 16, SWSURFACE or ANYFORMAT)
if screen == nil:
write(stdout, "screen is nil!\n")
else:
greeting = SDL_LoadBmp("backgrnd.bmp")
greeting = LoadBmp("backgrnd.bmp")
if greeting == nil:
write(stdout, "greeting is nil!")
r.x = 0'i16
r.y = 0'i16
discard SDL_blitSurface(greeting, nil, screen, addr(r))
discard SDL_flip(screen)
SDL_Delay(3000)
discard blitSurface(greeting, nil, screen, addr(r))
discard flip(screen)
Delay(3000)
else:
write(stdout, "SDL_Init failed!\n")
SDL_Quit()
sdl.Quit()

View File

@@ -8,7 +8,7 @@ import os, streams, parsecsv, strutils, math
if paramCount() < 1:
quit("Usage: statcsv filename[.csv]")
var filename = appendFileExt(ParamStr(1), "csv")
var filename = addFileExt(ParamStr(1), "csv")
var s = newFileStream(filename, fmRead)
if s == nil: quit("cannot open the file " & filename)

View File

@@ -14,12 +14,12 @@ bind .e <Return> {
}
"""
Tcl_FindExecutable(getApplicationFilename())
var interp = Tcl_CreateInterp()
FindExecutable(getApplicationFilename())
var interp = CreateInterp()
if interp == nil: quit("cannot create TCL interpreter")
if Tcl_Init(interp) != TCL_OK:
if Init(interp) != TCL_OK:
quit("cannot init interpreter")
if Tcl_Eval(interp, myScript) != TCL_OK:
if Eval(interp, myScript) != TCL_OK:
quit("cannot execute script.tcl")

View File

@@ -23,7 +23,7 @@ proc dbError(db: TDbConn) {.noreturn.} =
## raises an EDb exception.
var e: ref EDb
new(e)
e.msg = $mysql_error(db)
e.msg = $mysql.error(db)
raise e
proc dbError*(msg: string) {.noreturn.} =
@@ -63,21 +63,21 @@ proc dbFormat(formatstr: TSqlQuery, args: openarray[string]): string =
proc TryExec*(db: TDbConn, query: TSqlQuery, args: openarray[string]): bool =
## tries to execute the query and returns true if successful, false otherwise.
var q = dbFormat(query, args)
return mysqlRealQuery(db, q, q.len) == 0'i32
return mysql.RealQuery(db, q, q.len) == 0'i32
proc Exec*(db: TDbConn, query: TSqlQuery, args: openarray[string]) =
## executes the query and raises EDB if not successful.
var q = dbFormat(query, args)
if mysqlRealQuery(db, q, q.len) != 0'i32: dbError(db)
if mysql.RealQuery(db, q, q.len) != 0'i32: dbError(db)
proc newRow(L: int): TRow =
newSeq(result, L)
for i in 0..L-1: result[i] = ""
proc properFreeResult(sqlres: PMYSQL_RES, row: cstringArray) =
proc properFreeResult(sqlres: mysql.PRES, row: cstringArray) =
if row != nil:
while mysqlFetchRow(sqlres) != nil: nil
mysqlFreeResult(sqlres)
while mysql.FetchRow(sqlres) != nil: nil
mysql.FreeResult(sqlres)
iterator FastRows*(db: TDbConn, query: TSqlQuery,
args: openarray[string]): TRow =
@@ -85,13 +85,13 @@ iterator FastRows*(db: TDbConn, query: TSqlQuery,
## fast, but potenially dangerous: If the for-loop-body executes another
## query, the results can be undefined. For Postgres it is safe though.
Exec(db, query, args)
var sqlres = mysqlUseResult(db)
var sqlres = mysql.UseResult(db)
if sqlres != nil:
var L = int(mysql_num_fields(sqlres))
var L = int(mysql.NumFields(sqlres))
var result = newRow(L)
var row: cstringArray
while true:
row = mysqlFetchRow(sqlres)
row = mysql.FetchRow(sqlres)
if row == nil: break
for i in 0..L-1:
setLen(result[i], 0)
@@ -104,19 +104,19 @@ proc GetAllRows*(db: TDbConn, query: TSqlQuery,
## executes the query and returns the whole result dataset.
result = @[]
Exec(db, query, args)
var sqlres = mysqlUseResult(db)
var sqlres = mysql.UseResult(db)
if sqlres != nil:
var L = int(mysql_num_fields(sqlres))
var L = int(mysql.NumFields(sqlres))
var row: cstringArray
var j = 0
while true:
row = mysqlFetchRow(sqlres)
row = mysql.FetchRow(sqlres)
if row == nil: break
setLen(result, j+1)
newSeq(result[j], L)
for i in 0..L-1: result[j][i] = $row[i]
inc(j)
mysqlFreeResult(sqlres)
mysql.FreeResult(sqlres)
iterator Rows*(db: TDbConn, query: TSqlQuery,
args: openarray[string]): TRow =
@@ -138,10 +138,10 @@ proc TryInsertID*(db: TDbConn, query: TSqlQuery,
## executes the query (typically "INSERT") and returns the
## generated ID for the row or -1 in case of an error.
var q = dbFormat(query, args)
if mysqlRealQuery(db, q, q.len) != 0'i32:
if mysql.RealQuery(db, q, q.len) != 0'i32:
result = -1'i64
else:
result = mysql_insert_id(db)
result = mysql.InsertId(db)
proc InsertID*(db: TDbConn, query: TSqlQuery, args: openArray[string]): int64 =
## executes the query (typically "INSERT") and returns the
@@ -154,20 +154,20 @@ proc ExecAffectedRows*(db: TDbConn, query: TSqlQuery,
## runs the query (typically "UPDATE") and returns the
## number of affected rows
Exec(db, query, args)
result = mysql_affected_rows(db)
result = mysql.AffectedRows(db)
proc Close*(db: TDbConn) =
## closes the database connection.
if db != nil: mysqlClose(db)
if db != nil: mysql.Close(db)
proc Open*(connection, user, password, database: string): TDbConn =
## opens a database connection. Raises `EDb` if the connection could not
## be established.
result = mysqlInit(nil)
result = mysql.Init(nil)
if result == nil: dbError("could not open database connection")
if mysqlRealConnect(result, "", user, password, database,
0'i32, nil, 0) == nil:
var errmsg = $mysql_error(result)
Close(result)
if mysql.RealConnect(result, "", user, password, database,
0'i32, nil, 0) == nil:
var errmsg = $mysql.error(result)
db_mysql.Close(result)
dbError(errmsg)

View File

@@ -18,21 +18,18 @@ import
when defined(Windows):
import windows, ShellAPI, os
type
PWindow* = PGtkWindow ## A shortcut for a GTK window.
proc info*(window: PWindow, msg: string) =
## Shows an information message to the user. The process waits until the
## user presses the OK button.
when defined(Windows):
discard MessageBoxA(0, msg, "Information", MB_OK or MB_ICONINFORMATION)
else:
var dialog = GTK_DIALOG(gtk_message_dialog_new(window,
GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "%s", cstring(msg)))
gtk_window_set_title(dialog, "Information")
discard gtk_dialog_run(dialog)
gtk_widget_destroy(dialog)
var dialog = message_dialog_new(window,
DIALOG_MODAL or DIALOG_DESTROY_WITH_PARENT,
MESSAGE_INFO, BUTTONS_OK, "%s", cstring(msg))
setTitle(dialog, "Information")
discard run(dialog)
destroy(PWidget(dialog))
proc warning*(window: PWindow, msg: string) =
## Shows a warning message to the user. The process waits until the user
@@ -40,12 +37,12 @@ proc warning*(window: PWindow, msg: string) =
when defined(Windows):
discard MessageBoxA(0, msg, "Warning", MB_OK or MB_ICONWARNING)
else:
var dialog = GTK_DIALOG(gtk_message_dialog_new(window,
GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "%s", cstring(msg)))
gtk_window_set_title(dialog, "Warning")
discard gtk_dialog_run(dialog)
gtk_widget_destroy(dialog)
var dialog = DIALOG(message_dialog_new(window,
DIALOG_MODAL or DIALOG_DESTROY_WITH_PARENT,
MESSAGE_WARNING, BUTTONS_OK, "%s", cstring(msg)))
setTitle(dialog, "Warning")
discard run(dialog)
destroy(PWidget(dialog))
proc error*(window: PWindow, msg: string) =
## Shows an error message to the user. The process waits until the user
@@ -53,12 +50,12 @@ proc error*(window: PWindow, msg: string) =
when defined(Windows):
discard MessageBoxA(0, msg, "Error", MB_OK or MB_ICONERROR)
else:
var dialog = GTK_DIALOG(gtk_message_dialog_new(window,
GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", cstring(msg)))
gtk_window_set_title(dialog, "Error")
discard gtk_dialog_run(dialog)
gtk_widget_destroy(dialog)
var dialog = DIALOG(message_dialog_new(window,
DIALOG_MODAL or DIALOG_DESTROY_WITH_PARENT,
MESSAGE_ERROR, BUTTONS_OK, "%s", cstring(msg)))
setTitle(dialog, "Error")
discard run(dialog)
destroy(PWidget(dialog))
proc ChooseFileToOpen*(window: PWindow, root: string = ""): string =
@@ -82,21 +79,19 @@ proc ChooseFileToOpen*(window: PWindow, root: string = ""): string =
else:
result = ""
else:
var
chooser: PGtkDialog
chooser = GTK_DIALOG(gtk_file_chooser_dialog_new("Open File", window,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, nil))
var chooser = file_chooser_dialog_new("Open File", window,
FILE_CHOOSER_ACTION_OPEN,
STOCK_CANCEL, RESPONSE_CANCEL,
STOCK_OPEN, RESPONSE_OK, nil)
if root.len > 0:
discard gtk_file_chooser_set_current_folder(chooser, root)
if gtk_dialog_run(chooser) == cint(GTK_RESPONSE_OK):
var x = gtk_file_chooser_get_filename(chooser)
discard set_current_folder(chooser, root)
if run(chooser) == cint(RESPONSE_OK):
var x = get_filename(chooser)
result = $x
g_free(x)
else:
result = ""
gtk_widget_destroy(chooser)
destroy(PWidget(chooser))
proc ChooseFilesToOpen*(window: PWindow, root: string = ""): seq[string] =
## Opens a dialog that requests filenames from the user. Returns ``@[]``
@@ -136,25 +131,23 @@ proc ChooseFilesToOpen*(window: PWindow, root: string = ""): seq[string] =
if buf[i] == '\0': break
for i in 0..result.len-1: result[i] = os.joinPath(path, result[i])
else:
var
chooser: PGtkDialog
chooser = GTK_DIALOG(gtk_file_chooser_dialog_new("Open Files", window,
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, nil))
var chooser = file_chooser_dialog_new("Open Files", window,
FILE_CHOOSER_ACTION_OPEN,
STOCK_CANCEL, RESPONSE_CANCEL,
STOCK_OPEN, RESPONSE_OK, nil)
if root.len > 0:
discard gtk_file_chooser_set_current_folder(chooser, root)
gtk_file_chooser_set_select_multiple(chooser, true)
discard set_current_folder(chooser, root)
set_select_multiple(chooser, true)
result = @[]
if gtk_dialog_run(chooser) == cint(GTK_RESPONSE_OK):
var L = gtk_file_chooser_get_filenames(chooser)
if run(chooser) == cint(RESPONSE_OK):
var L = get_filenames(chooser)
var it = L
while it != nil:
add(result, $cast[cstring](it.data))
g_free(it.data)
it = it.next
g_slist_free(L)
gtk_widget_destroy(chooser)
free(L)
destroy(PWidget(chooser))
proc ChooseFileToSave*(window: PWindow, root: string = ""): string =
@@ -178,22 +171,20 @@ proc ChooseFileToSave*(window: PWindow, root: string = ""): string =
else:
result = ""
else:
var
chooser: PGtkDialog
chooser = GTK_DIALOG(gtk_file_chooser_dialog_new("Save File", window,
GTK_FILE_CHOOSER_ACTION_SAVE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, nil))
var chooser = file_chooser_dialog_new("Save File", window,
FILE_CHOOSER_ACTION_SAVE,
STOCK_CANCEL, RESPONSE_CANCEL,
STOCK_OPEN, RESPONSE_OK, nil)
if root.len > 0:
discard gtk_file_chooser_set_current_folder(chooser, root)
gtk_file_chooser_set_do_overwrite_confirmation(chooser, true)
if gtk_dialog_run(chooser) == cint(GTK_RESPONSE_OK):
var x = gtk_file_chooser_get_filename(chooser)
discard set_current_folder(chooser, root)
set_do_overwrite_confirmation(chooser, true)
if run(chooser) == cint(RESPONSE_OK):
var x = get_filename(chooser)
result = $x
g_free(x)
else:
result = ""
gtk_widget_destroy(chooser)
destroy(PWidget(chooser))
proc ChooseDir*(window: PWindow, root: string = ""): string =
@@ -216,19 +207,17 @@ proc ChooseDir*(window: PWindow, root: string = ""): string =
Result = $TempPath
discard GlobalFreePtr(lpItemID)
else:
var
chooser: PGtkDialog
chooser = GTK_DIALOG(gtk_file_chooser_dialog_new("Select Directory", window,
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, nil))
var chooser = file_chooser_dialog_new("Select Directory", window,
FILE_CHOOSER_ACTION_SELECT_FOLDER,
STOCK_CANCEL, RESPONSE_CANCEL,
STOCK_OPEN, RESPONSE_OK, nil)
if root.len > 0:
discard gtk_file_chooser_set_current_folder(chooser, root)
if gtk_dialog_run(chooser) == cint(GTK_RESPONSE_OK):
var x = gtk_file_chooser_get_filename(chooser)
discard set_current_folder(chooser, root)
if run(chooser) == cint(RESPONSE_OK):
var x = get_filename(chooser)
result = $x
g_free(x)
else:
result = ""
gtk_widget_destroy(chooser)
destroy(PWidget(chooser))

View File

@@ -17,7 +17,7 @@
## Currently only requesting URLs is implemented. The implementation depends
## on the libcurl library!
##
## **Deprecated since version 0.8.6:** Use the ``httpclient`` module instead.
## **Deprecated since version 0.8.8:** Use the ``httpclient`` module instead.
##
{.deprecated.}
@@ -34,27 +34,27 @@ proc URLretrieveStream*(url: string): PStream =
## retrieves the given `url` and returns a stream which one can read from to
## obtain the contents. Returns nil if an error occurs.
result = newStringStream()
var hCurl = curl_easy_init()
var hCurl = easy_init()
if hCurl == nil: return nil
if curl_easy_setopt(hCurl, CURLOPT_URL, url) != CURLE_OK: return nil
if curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION,
curlwrapperWrite) != CURLE_OK: return nil
if curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, result) != CURLE_OK: return nil
if curl_easy_perform(hCurl) != CURLE_OK: return nil
curl_easy_cleanup(hCurl)
if easy_setopt(hCurl, OPT_URL, url) != E_OK: return nil
if easy_setopt(hCurl, OPT_WRITEFUNCTION,
curlwrapperWrite) != E_OK: return nil
if easy_setopt(hCurl, OPT_WRITEDATA, result) != E_OK: return nil
if easy_perform(hCurl) != E_OK: return nil
easy_cleanup(hCurl)
proc URLretrieveString*(url: string): string =
## retrieves the given `url` and returns the contents. Returns nil if an
## error occurs.
var stream = newStringStream()
var hCurl = curl_easy_init()
var hCurl = easy_init()
if hCurl == nil: return nil
if curl_easy_setopt(hCurl, CURLOPT_URL, url) != CURLE_OK: return nil
if curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION,
curlwrapperWrite) != CURLE_OK: return nil
if curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, stream) != CURLE_OK: return nil
if curl_easy_perform(hCurl) != CURLE_OK: return nil
curl_easy_cleanup(hCurl)
if easy_setopt(hCurl, OPT_URL, url) != E_OK: return nil
if easy_setopt(hCurl, OPT_WRITEFUNCTION,
curlwrapperWrite) != E_OK: return nil
if easy_setopt(hCurl, OPT_WRITEDATA, stream) != E_OK: return nil
if easy_perform(hCurl) != E_OK: return nil
easy_cleanup(hCurl)
result = stream.data
when isMainModule:

View File

@@ -1,737 +0,0 @@
#* cairo - a vector graphics library with display and print output
# *
# * Copyright <20> 2002 University of Southern California
# * Copyright <20> 2005 Red Hat, Inc.
# *
# * This library is free software; you can redistribute it and/or
# * modify it either under the terms of the GNU Lesser General Public
# * License version 2.1 as published by the Free Software Foundation
# * (the "LGPL") or, at your option, under the terms of the Mozilla
# * Public License Version 1.1 (the "MPL"). If you do not alter this
# * notice, a recipient may use your version of this file under either
# * the MPL or the LGPL.
# *
# * You should have received a copy of the LGPL along with this library
# * in the file COPYING-LGPL-2.1; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# * You should have received a copy of the MPL along with this library
# * in the file COPYING-MPL-1.1
# *
# * The contents of this file are subject to the Mozilla Public License
# * Version 1.1 (the "License"); you may not use this file except in
# * compliance with the License. You may obtain a copy of the License at
# * http://www.mozilla.org/MPL/
# *
# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
# * OF ANY KIND, either express or implied. See the LGPL or the MPL for
# * the specific language governing rights and limitations.
# *
# * The Original Code is the cairo graphics library.
# *
# * The Initial Developer of the Original Code is University of Southern
# * California.
# *
# * Contributor(s):
# * Carl D. Worth <cworth@cworth.org>
# #*
# * This FreePascal binding generated August 26, 2005
# * by Jeffrey Pohlmeyer <yetanothergeek@yahoo.com>
#
#
# - Updated to cairo version 1.4
# - Grouped OS specific fuctions in separated units
# - Organized the functions by group and ordered exactly as the c header
# - Cleared parameter list syntax according to pascal standard
#
# By Luiz Am<41>rico Pereira C<>mara
# October 2007
#
when defined(windows):
const
LIB_CAIRO* = "libcairo-2.dll"
else:
const
LIB_CAIRO* = "libcairo.so"
type
PByte = cstring
TStatus* = enum
STATUS_SUCCESS = 0,
STATUS_NO_MEMORY,
STATUS_INVALID_RESTORE,
STATUS_INVALID_POP_GROUP,
STATUS_NO_CURRENT_POINT,
STATUS_INVALID_MATRIX,
STATUS_INVALID_STATUS,
STATUS_NULL_POINTER,
STATUS_INVALID_STRING,
STATUS_INVALID_PATH_DATA,
STATUS_READ_ERROR,
STATUS_WRITE_ERROR,
STATUS_SURFACE_FINISHED,
STATUS_SURFACE_TYPE_MISMATCH,
STATUS_PATTERN_TYPE_MISMATCH,
STATUS_INVALID_CONTENT,
STATUS_INVALID_FORMAT,
STATUS_INVALID_VISUAL,
STATUS_FILE_NOT_FOUND,
STATUS_INVALID_DASH,
STATUS_INVALID_DSC_COMMENT,
STATUS_INVALID_INDEX,
STATUS_CLIP_NOT_REPRESENTABLE,
STATUS_TEMP_FILE_ERROR,
STATUS_INVALID_STRIDE,
STATUS_FONT_TYPE_MISMATCH,
STATUS_USER_FONT_IMMUTABLE,
STATUS_USER_FONT_ERROR,
STATUS_NEGATIVE_COUNT,
STATUS_INVALID_CLUSTERS,
STATUS_INVALID_SLANT,
STATUS_INVALID_WEIGHT
TOperator* = enum
OPERATOR_CLEAR, OPERATOR_SOURCE, OPERATOR_OVER, OPERATOR_IN, OPERATOR_OUT,
OPERATOR_ATOP, OPERATOR_DEST, OPERATOR_DEST_OVER, OPERATOR_DEST_IN,
OPERATOR_DEST_OUT, OPERATOR_DEST_ATOP, OPERATOR_XOR, OPERATOR_ADD,
OPERATOR_SATURATE
TAntialias* = enum
ANTIALIAS_DEFAULT, ANTIALIAS_NONE, ANTIALIAS_GRAY, ANTIALIAS_SUBPIXEL
TFillRule* = enum
FILL_RULE_WINDING, FILL_RULE_EVEN_ODD
TLineCap* = enum
LINE_CAP_BUTT, LINE_CAP_ROUND, LINE_CAP_SQUARE
TLineJoin* = enum
LINE_JOIN_MITER, LINE_JOIN_ROUND, LINE_JOIN_BEVEL
TFontSlant* = enum
FONT_SLANT_NORMAL, FONT_SLANT_ITALIC, FONT_SLANT_OBLIQUE
TFontWeight* = enum
FONT_WEIGHT_NORMAL, FONT_WEIGHT_BOLD
TSubpixelOrder* = enum
SUBPIXEL_ORDER_DEFAULT, SUBPIXEL_ORDER_RGB, SUBPIXEL_ORDER_BGR,
SUBPIXEL_ORDER_VRGB, SUBPIXEL_ORDER_VBGR
THintStyle* = enum
HINT_STYLE_DEFAULT, HINT_STYLE_NONE, HINT_STYLE_SLIGHT, HINT_STYLE_MEDIUM,
HINT_STYLE_FULL
THintMetrics* = enum
HINT_METRICS_DEFAULT, HINT_METRICS_OFF, HINT_METRICS_ON
TPathDataType* = enum
PATH_MOVE_TO, PATH_LINE_TO, PATH_CURVE_TO, PATH_CLOSE_PATH
TContent* = enum
CONTENT_COLOR = 0x00001000, CONTENT_ALPHA = 0x00002000,
CONTENT_COLOR_ALPHA = 0x00003000
TFormat* = enum
FORMAT_ARGB32, FORMAT_RGB24, FORMAT_A8, FORMAT_A1
TExtend* = enum
EXTEND_NONE, EXTEND_REPEAT, EXTEND_REFLECT, EXTEND_PAD
TFilter* = enum
FILTER_FAST, FILTER_GOOD, FILTER_BEST, FILTER_NEAREST, FILTER_BILINEAR,
FILTER_GAUSSIAN
TFontType* = enum
FONT_TYPE_TOY, FONT_TYPE_FT, FONT_TYPE_WIN32, FONT_TYPE_ATSUI
TPatternType* = enum
PATTERN_TYPE_SOLID, PATTERN_TYPE_SURFACE, PATTERN_TYPE_LINEAR,
PATTERN_TYPE_RADIAL
TSurfaceType* = enum
SURFACE_TYPE_IMAGE, SURFACE_TYPE_PDF, SURFACE_TYPE_PS, SURFACE_TYPE_XLIB,
SURFACE_TYPE_XCB, SURFACE_TYPE_GLITZ, SURFACE_TYPE_QUARTZ,
SURFACE_TYPE_WIN32, SURFACE_TYPE_BEOS, SURFACE_TYPE_DIRECTFB,
SURFACE_TYPE_SVG, SURFACE_TYPE_OS2
TSvgVersion* = enum
SVG_VERSION_1_1, SVG_VERSION_1_2
PSurface* = ptr TSurface
PPSurface* = ptr PSurface
PContext* = ptr TContext
PPattern* = ptr TPattern
PFontOptions* = ptr TFontOptions
PFontFace* = ptr TFontFace
PScaledFont* = ptr TScaledFont
PBool* = ptr TBool
TBool* = int32
PMatrix* = ptr TMatrix
PUserDataKey* = ptr TUserDataKey
PGlyph* = ptr TGlyph
PTextExtents* = ptr TTextExtents
PFontExtents* = ptr TFontExtents
PPathDataType* = ptr TPathDataType
PPathData* = ptr TPathData
PPath* = ptr TPath
PRectangle* = ptr TRectangle
PRectangleList* = ptr TRectangleList
TDestroyFunc* = proc (data: Pointer){.cdecl.}
TWriteFunc* = proc (closure: Pointer, data: PByte, len: int32): TStatus{.cdecl.}
TReadFunc* = proc (closure: Pointer, data: PByte, len: int32): TStatus{.cdecl.}
TContext*{.final.} = object #OPAQUE
TSurface*{.final.} = object #OPAQUE
TPattern*{.final.} = object #OPAQUE
TScaledFont*{.final.} = object #OPAQUE
TFontFace*{.final.} = object #OPAQUE
TFontOptions*{.final.} = object #OPAQUE
TMatrix*{.final.} = object
xx: float64
yx: float64
xy: float64
yy: float64
x0: float64
y0: float64
TUserDataKey*{.final.} = object
unused: int32
TGlyph*{.final.} = object
index: int32
x: float64
y: float64
TTextExtents*{.final.} = object
x_bearing: float64
y_bearing: float64
width: float64
height: float64
x_advance: float64
y_advance: float64
TFontExtents*{.final.} = object
ascent: float64
descent: float64
height: float64
max_x_advance: float64
max_y_advance: float64
TPathData*{.final.} = object #* _type : TCairoPathDataType;
# length : LongInt;
# end
x: float64
y: float64
TPath*{.final.} = object
status: TStatus
data: PPathData
num_data: int32
TRectangle*{.final.} = object
x, y, width, height: float64
TRectangleList*{.final.} = object
status: TStatus
rectangles: PRectangle
num_rectangles: int32
proc version*(): int32{.cdecl, importc: "cairo_version", dynlib: LIB_CAIRO.}
proc version_string*(): cstring{.cdecl, importc: "cairo_version_string",
dynlib: LIB_CAIRO.}
#Helper function to retrieve decoded version
proc version*(major, minor, micro: var int32)
#* Functions for manipulating state objects
proc create*(target: PSurface): PContext{.cdecl, importc: "cairo_create",
dynlib: LIB_CAIRO.}
proc reference*(cr: PContext): PContext{.cdecl, importc: "cairo_reference", dynlib: LIB_CAIRO.}
proc destroy*(cr: PContext){.cdecl, importc: "cairo_destroy", dynlib: LIB_CAIRO.}
proc get_reference_count*(cr: PContext): int32{.cdecl,
importc: "cairo_get_reference_count", dynlib: LIB_CAIRO.}
proc get_user_data*(cr: PContext, key: PUserDataKey): pointer{.cdecl,
importc: "cairo_get_user_data", dynlib: LIB_CAIRO.}
proc set_user_data*(cr: PContext, key: PUserDataKey, user_data: Pointer,
destroy: TDestroyFunc): TStatus{.cdecl,
importc: "cairo_set_user_data", dynlib: LIB_CAIRO.}
proc save*(cr: PContext){.cdecl, importc: "cairo_save", dynlib: LIB_CAIRO.}
proc restore*(cr: PContext){.cdecl, importc: "cairo_restore", dynlib: LIB_CAIRO.}
proc push_group*(cr: PContext){.cdecl, importc: "cairo_push_group", dynlib: LIB_CAIRO.}
proc push_group_with_content*(cr: PContext, content: TContent){.cdecl,
importc: "cairo_push_group_with_content", dynlib: LIB_CAIRO.}
proc pop_group*(cr: PContext): PPattern{.cdecl, importc: "cairo_pop_group",
dynlib: LIB_CAIRO.}
proc pop_group_to_source*(cr: PContext){.cdecl, importc: "cairo_pop_group_to_source",
dynlib: LIB_CAIRO.}
#* Modify state
proc set_operator*(cr: PContext, op: TOperator){.cdecl, importc: "cairo_set_operator",
dynlib: LIB_CAIRO.}
proc set_source*(cr: PContext, source: PPattern){.cdecl, importc: "cairo_set_source",
dynlib: LIB_CAIRO.}
proc set_source_rgb*(cr: PContext, red, green, blue: float64){.cdecl,
importc: "cairo_set_source_rgb", dynlib: LIB_CAIRO.}
proc set_source_rgba*(cr: PContext, red, green, blue, alpha: float64){.cdecl,
importc: "cairo_set_source_rgba", dynlib: LIB_CAIRO.}
proc set_source*(cr: PContext, surface: PSurface, x, y: float64){.cdecl,
importc: "cairo_set_source_surface", dynlib: LIB_CAIRO.}
proc set_tolerance*(cr: PContext, tolerance: float64){.cdecl,
importc: "cairo_set_tolerance", dynlib: LIB_CAIRO.}
proc set_antialias*(cr: PContext, antialias: TAntialias){.cdecl,
importc: "cairo_set_antialias", dynlib: LIB_CAIRO.}
proc set_fill_rule*(cr: PContext, fill_rule: TFillRule){.cdecl,
importc: "cairo_set_fill_rule", dynlib: LIB_CAIRO.}
proc set_line_width*(cr: PContext, width: float64){.cdecl,
importc: "cairo_set_line_width", dynlib: LIB_CAIRO.}
proc set_line_cap*(cr: PContext, line_cap: TLineCap){.cdecl,
importc: "cairo_set_line_cap", dynlib: LIB_CAIRO.}
proc set_line_join*(cr: PContext, line_join: TLineJoin){.cdecl,
importc: "cairo_set_line_join", dynlib: LIB_CAIRO.}
proc set_dash*(cr: PContext, dashes: openarray[float64], offset: float64){.cdecl,
importc: "cairo_set_dash", dynlib: LIB_CAIRO.}
proc set_miter_limit*(cr: PContext, limit: float64){.cdecl,
importc: "cairo_set_miter_limit", dynlib: LIB_CAIRO.}
proc translate*(cr: PContext, tx, ty: float64){.cdecl, importc: "cairo_translate",
dynlib: LIB_CAIRO.}
proc scale*(cr: PContext, sx, sy: float64){.cdecl, importc: "cairo_scale",
dynlib: LIB_CAIRO.}
proc rotate*(cr: PContext, angle: float64){.cdecl, importc: "cairo_rotate",
dynlib: LIB_CAIRO.}
proc transform*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_transform",
dynlib: LIB_CAIRO.}
proc set_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_set_matrix",
dynlib: LIB_CAIRO.}
proc identity_matrix*(cr: PContext){.cdecl, importc: "cairo_identity_matrix",
dynlib: LIB_CAIRO.}
proc user_to_device*(cr: PContext, x, y: var float64){.cdecl,
importc: "cairo_user_to_device", dynlib: LIB_CAIRO.}
proc user_to_device_distance*(cr: PContext, dx, dy: var float64){.cdecl,
importc: "cairo_user_to_device_distance", dynlib: LIB_CAIRO.}
proc device_to_user*(cr: PContext, x, y: var float64){.cdecl,
importc: "cairo_device_to_user", dynlib: LIB_CAIRO.}
proc device_to_user_distance*(cr: PContext, dx, dy: var float64){.cdecl,
importc: "cairo_device_to_user_distance", dynlib: LIB_CAIRO.}
#* Path creation functions
proc new_path*(cr: PContext){.cdecl, importc: "cairo_new_path", dynlib: LIB_CAIRO.}
proc move_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_move_to",
dynlib: LIB_CAIRO.}
proc new_sub_path*(cr: PContext){.cdecl, importc: "cairo_new_sub_path",
dynlib: LIB_CAIRO.}
proc line_to*(cr: PContext, x, y: float64){.cdecl, importc: "cairo_line_to",
dynlib: LIB_CAIRO.}
proc curve_to*(cr: PContext, x1, y1, x2, y2, x3, y3: float64){.cdecl,
importc: "cairo_curve_to", dynlib: LIB_CAIRO.}
proc arc*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl,
importc: "cairo_arc", dynlib: LIB_CAIRO.}
proc arc_negative*(cr: PContext, xc, yc, radius, angle1, angle2: float64){.cdecl,
importc: "cairo_arc_negative", dynlib: LIB_CAIRO.}
proc rel_move_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_move_to",
dynlib: LIB_CAIRO.}
proc rel_line_to*(cr: PContext, dx, dy: float64){.cdecl, importc: "cairo_rel_line_to",
dynlib: LIB_CAIRO.}
proc rel_curve_to*(cr: PContext, dx1, dy1, dx2, dy2, dx3, dy3: float64){.cdecl,
importc: "cairo_rel_curve_to", dynlib: LIB_CAIRO.}
proc rectangle*(cr: PContext, x, y, width, height: float64){.cdecl,
importc: "cairo_rectangle", dynlib: LIB_CAIRO.}
proc close_path*(cr: PContext){.cdecl, importc: "cairo_close_path", dynlib: LIB_CAIRO.}
#* Painting functions
proc paint*(cr: PContext){.cdecl, importc: "cairo_paint", dynlib: LIB_CAIRO.}
proc paint_with_alpha*(cr: PContext, alpha: float64){.cdecl,
importc: "cairo_paint_with_alpha", dynlib: LIB_CAIRO.}
proc mask*(cr: PContext, pattern: PPattern){.cdecl, importc: "cairo_mask",
dynlib: LIB_CAIRO.}
proc mask*(cr: PContext, surface: PSurface, surface_x, surface_y: float64){.
cdecl, importc: "cairo_mask_surface", dynlib: LIB_CAIRO.}
proc stroke*(cr: PContext){.cdecl, importc: "cairo_stroke", dynlib: LIB_CAIRO.}
proc stroke_preserve*(cr: PContext){.cdecl, importc: "cairo_stroke_preserve",
dynlib: LIB_CAIRO.}
proc fill*(cr: PContext){.cdecl, importc: "cairo_fill", dynlib: LIB_CAIRO.}
proc fill_preserve*(cr: PContext){.cdecl, importc: "cairo_fill_preserve",
dynlib: LIB_CAIRO.}
proc copy_page*(cr: PContext){.cdecl, importc: "cairo_copy_page", dynlib: LIB_CAIRO.}
proc show_page*(cr: PContext){.cdecl, importc: "cairo_show_page", dynlib: LIB_CAIRO.}
#* Insideness testing
proc in_stroke*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_stroke",
dynlib: LIB_CAIRO.}
proc in_fill*(cr: PContext, x, y: float64): TBool{.cdecl, importc: "cairo_in_fill",
dynlib: LIB_CAIRO.}
#* Rectangular extents
proc stroke_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
importc: "cairo_stroke_extents", dynlib: LIB_CAIRO.}
proc fill_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
importc: "cairo_fill_extents", dynlib: LIB_CAIRO.}
#* Clipping
proc reset_clip*(cr: PContext){.cdecl, importc: "cairo_reset_clip", dynlib: LIB_CAIRO.}
proc clip*(cr: PContext){.cdecl, importc: "cairo_clip", dynlib: LIB_CAIRO.}
proc clip_preserve*(cr: PContext){.cdecl, importc: "cairo_clip_preserve",
dynlib: LIB_CAIRO.}
proc clip_extents*(cr: PContext, x1, y1, x2, y2: var float64){.cdecl,
importc: "cairo_clip_extents", dynlib: LIB_CAIRO.}
proc copy_clip_rectangle_list*(cr: PContext): PRectangleList{.cdecl,
importc: "cairo_copy_clip_rectangle_list", dynlib: LIB_CAIRO.}
proc rectangle_list_destroy*(rectangle_list: PRectangleList){.cdecl,
importc: "cairo_rectangle_list_destroy", dynlib: LIB_CAIRO.}
#* Font/Text functions
proc font_options_create*(): PFontOptions{.cdecl,
importc: "cairo_font_options_create", dynlib: LIB_CAIRO.}
proc copy*(original: PFontOptions): PFontOptions{.cdecl,
importc: "cairo_font_options_copy", dynlib: LIB_CAIRO.}
proc destroy*(options: PFontOptions){.cdecl,
importc: "cairo_font_options_destroy", dynlib: LIB_CAIRO.}
proc status*(options: PFontOptions): TStatus{.cdecl,
importc: "cairo_font_options_status", dynlib: LIB_CAIRO.}
proc merge*(options, other: PFontOptions){.cdecl,
importc: "cairo_font_options_merge", dynlib: LIB_CAIRO.}
proc equal*(options, other: PFontOptions): TBool{.cdecl,
importc: "cairo_font_options_equal", dynlib: LIB_CAIRO.}
proc hash*(options: PFontOptions): int32{.cdecl,
importc: "cairo_font_options_hash", dynlib: LIB_CAIRO.}
proc set_antialias*(options: PFontOptions, antialias: TAntialias){.
cdecl, importc: "cairo_font_options_set_antialias", dynlib: LIB_CAIRO.}
proc get_antialias*(options: PFontOptions): TAntialias{.cdecl,
importc: "cairo_font_options_get_antialias", dynlib: LIB_CAIRO.}
proc set_subpixel_order*(options: PFontOptions,
subpixel_order: TSubpixelOrder){.cdecl,
importc: "cairo_font_options_set_subpixel_order", dynlib: LIB_CAIRO.}
proc get_subpixel_order*(options: PFontOptions): TSubpixelOrder{.
cdecl, importc: "cairo_font_options_get_subpixel_order", dynlib: LIB_CAIRO.}
proc set_hint_style*(options: PFontOptions, hint_style: THintStyle){.
cdecl, importc: "cairo_font_options_set_hint_style", dynlib: LIB_CAIRO.}
proc get_hint_style*(options: PFontOptions): THintStyle{.cdecl,
importc: "cairo_font_options_get_hint_style", dynlib: LIB_CAIRO.}
proc set_hint_metrics*(options: PFontOptions,
hint_metrics: THintMetrics){.cdecl,
importc: "cairo_font_options_set_hint_metrics", dynlib: LIB_CAIRO.}
proc get_hint_metrics*(options: PFontOptions): THintMetrics{.cdecl,
importc: "cairo_font_options_get_hint_metrics", dynlib: LIB_CAIRO.}
#* This interface is for dealing with text as text, not caring about the
# font object inside the the TCairo.
proc select_font_face*(cr: PContext, family: cstring, slant: TFontSlant,
weight: TFontWeight){.cdecl,
importc: "cairo_select_font_face", dynlib: LIB_CAIRO.}
proc set_font_size*(cr: PContext, size: float64){.cdecl,
importc: "cairo_set_font_size", dynlib: LIB_CAIRO.}
proc set_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl,
importc: "cairo_set_font_matrix", dynlib: LIB_CAIRO.}
proc get_font_matrix*(cr: PContext, matrix: PMatrix){.cdecl,
importc: "cairo_get_font_matrix", dynlib: LIB_CAIRO.}
proc set_font_options*(cr: PContext, options: PFontOptions){.cdecl,
importc: "cairo_set_font_options", dynlib: LIB_CAIRO.}
proc get_font_options*(cr: PContext, options: PFontOptions){.cdecl,
importc: "cairo_get_font_options", dynlib: LIB_CAIRO.}
proc set_font_face*(cr: PContext, font_face: PFontFace){.cdecl,
importc: "cairo_set_font_face", dynlib: LIB_CAIRO.}
proc get_font_face*(cr: PContext): PFontFace{.cdecl, importc: "cairo_get_font_face",
dynlib: LIB_CAIRO.}
proc set_scaled_font*(cr: PContext, scaled_font: PScaledFont){.cdecl,
importc: "cairo_set_scaled_font", dynlib: LIB_CAIRO.}
proc get_scaled_font*(cr: PContext): PScaledFont{.cdecl,
importc: "cairo_get_scaled_font", dynlib: LIB_CAIRO.}
proc show_text*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_show_text",
dynlib: LIB_CAIRO.}
proc show_glyphs*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl,
importc: "cairo_show_glyphs", dynlib: LIB_CAIRO.}
proc text_path*(cr: PContext, utf8: cstring){.cdecl, importc: "cairo_text_path",
dynlib: LIB_CAIRO.}
proc glyph_path*(cr: PContext, glyphs: PGlyph, num_glyphs: int32){.cdecl,
importc: "cairo_glyph_path", dynlib: LIB_CAIRO.}
proc text_extents*(cr: PContext, utf8: cstring, extents: PTextExtents){.cdecl,
importc: "cairo_text_extents", dynlib: LIB_CAIRO.}
proc glyph_extents*(cr: PContext, glyphs: PGlyph, num_glyphs: int32,
extents: PTextExtents){.cdecl,
importc: "cairo_glyph_extents", dynlib: LIB_CAIRO.}
proc font_extents*(cr: PContext, extents: PFontExtents){.cdecl,
importc: "cairo_font_extents", dynlib: LIB_CAIRO.}
#* Generic identifier for a font style
proc reference*(font_face: PFontFace): PFontFace{.cdecl,
importc: "cairo_font_face_reference", dynlib: LIB_CAIRO.}
proc destroy*(font_face: PFontFace){.cdecl,
importc: "cairo_font_face_destroy", dynlib: LIB_CAIRO.}
proc get_reference_count*(font_face: PFontFace): int32{.cdecl,
importc: "cairo_font_face_get_reference_count", dynlib: LIB_CAIRO.}
proc status*(font_face: PFontFace): TStatus{.cdecl,
importc: "cairo_font_face_status", dynlib: LIB_CAIRO.}
proc get_type*(font_face: PFontFace): TFontType{.cdecl,
importc: "cairo_font_face_get_type", dynlib: LIB_CAIRO.}
proc get_user_data*(font_face: PFontFace, key: PUserDataKey): pointer{.
cdecl, importc: "cairo_font_face_get_user_data", dynlib: LIB_CAIRO.}
proc set_user_data*(font_face: PFontFace, key: PUserDataKey,
user_data: pointer, destroy: TDestroyFunc): TStatus{.
cdecl, importc: "cairo_font_face_set_user_data", dynlib: LIB_CAIRO.}
#* Portable interface to general font features
proc scaled_font_create*(font_face: PFontFace, font_matrix: PMatrix,
ctm: PMatrix, options: PFontOptions): PScaledFont{.
cdecl, importc: "cairo_scaled_font_create", dynlib: LIB_CAIRO.}
proc reference*(scaled_font: PScaledFont): PScaledFont{.cdecl,
importc: "cairo_scaled_font_reference", dynlib: LIB_CAIRO.}
proc destroy*(scaled_font: PScaledFont){.cdecl,
importc: "cairo_scaled_font_destroy", dynlib: LIB_CAIRO.}
proc get_reference_count*(scaled_font: PScaledFont): int32{.cdecl,
importc: "cairo_scaled_font_get_reference_count", dynlib: LIB_CAIRO.}
proc status*(scaled_font: PScaledFont): TStatus{.cdecl,
importc: "cairo_scaled_font_status", dynlib: LIB_CAIRO.}
proc get_type*(scaled_font: PScaledFont): TFontType{.cdecl,
importc: "cairo_scaled_font_get_type", dynlib: LIB_CAIRO.}
proc get_user_data*(scaled_font: PScaledFont, key: PUserDataKey): Pointer{.
cdecl, importc: "cairo_scaled_font_get_user_data", dynlib: LIB_CAIRO.}
proc set_user_data*(scaled_font: PScaledFont, key: PUserDataKey,
user_data: Pointer, destroy: TDestroyFunc): TStatus{.
cdecl, importc: "cairo_scaled_font_set_user_data", dynlib: LIB_CAIRO.}
proc extents*(scaled_font: PScaledFont, extents: PFontExtents){.
cdecl, importc: "cairo_scaled_font_extents", dynlib: LIB_CAIRO.}
proc text_extents*(scaled_font: PScaledFont, utf8: cstring,
extents: PTextExtents){.cdecl,
importc: "cairo_scaled_font_text_extents", dynlib: LIB_CAIRO.}
proc glyph_extents*(scaled_font: PScaledFont, glyphs: PGlyph,
num_glyphs: int32, extents: PTextExtents){.
cdecl, importc: "cairo_scaled_font_glyph_extents", dynlib: LIB_CAIRO.}
proc get_font_face*(scaled_font: PScaledFont): PFontFace{.cdecl,
importc: "cairo_scaled_font_get_font_face", dynlib: LIB_CAIRO.}
proc get_font_matrix*(scaled_font: PScaledFont, font_matrix: PMatrix){.
cdecl, importc: "cairo_scaled_font_get_font_matrix", dynlib: LIB_CAIRO.}
proc get_ctm*(scaled_font: PScaledFont, ctm: PMatrix){.cdecl,
importc: "cairo_scaled_font_get_ctm", dynlib: LIB_CAIRO.}
proc get_font_options*(scaled_font: PScaledFont,
options: PFontOptions){.cdecl,
importc: "cairo_scaled_font_get_font_options", dynlib: LIB_CAIRO.}
#* Query functions
proc get_operator*(cr: PContext): TOperator{.cdecl, importc: "cairo_get_operator",
dynlib: LIB_CAIRO.}
proc get_source*(cr: PContext): PPattern{.cdecl, importc: "cairo_get_source",
dynlib: LIB_CAIRO.}
proc get_tolerance*(cr: PContext): float64{.cdecl, importc: "cairo_get_tolerance",
dynlib: LIB_CAIRO.}
proc get_antialias*(cr: PContext): TAntialias{.cdecl, importc: "cairo_get_antialias",
dynlib: LIB_CAIRO.}
proc get_current_point*(cr: PContext, x, y: var float64){.cdecl,
importc: "cairo_get_current_point", dynlib: LIB_CAIRO.}
proc get_fill_rule*(cr: PContext): TFillRule{.cdecl, importc: "cairo_get_fill_rule",
dynlib: LIB_CAIRO.}
proc get_line_width*(cr: PContext): float64{.cdecl, importc: "cairo_get_line_width",
dynlib: LIB_CAIRO.}
proc get_line_cap*(cr: PContext): TLineCap{.cdecl, importc: "cairo_get_line_cap",
dynlib: LIB_CAIRO.}
proc get_line_join*(cr: PContext): TLineJoin{.cdecl, importc: "cairo_get_line_join",
dynlib: LIB_CAIRO.}
proc get_miter_limit*(cr: PContext): float64{.cdecl, importc: "cairo_get_miter_limit",
dynlib: LIB_CAIRO.}
proc get_dash_count*(cr: PContext): int32{.cdecl, importc: "cairo_get_dash_count",
dynlib: LIB_CAIRO.}
proc get_dash*(cr: PContext, dashes, offset: var float64){.cdecl,
importc: "cairo_get_dash", dynlib: LIB_CAIRO.}
proc get_matrix*(cr: PContext, matrix: PMatrix){.cdecl, importc: "cairo_get_matrix",
dynlib: LIB_CAIRO.}
proc get_target*(cr: PContext): PSurface{.cdecl, importc: "cairo_get_target",
dynlib: LIB_CAIRO.}
proc get_group_target*(cr: PContext): PSurface{.cdecl,
importc: "cairo_get_group_target", dynlib: LIB_CAIRO.}
proc copy_path*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path",
dynlib: LIB_CAIRO.}
proc copy_path_flat*(cr: PContext): PPath{.cdecl, importc: "cairo_copy_path_flat",
dynlib: LIB_CAIRO.}
proc append_path*(cr: PContext, path: PPath){.cdecl, importc: "cairo_append_path",
dynlib: LIB_CAIRO.}
proc destroy*(path: PPath){.cdecl, importc: "cairo_path_destroy",
dynlib: LIB_CAIRO.}
#* Error status queries
proc status*(cr: PContext): TStatus{.cdecl, importc: "cairo_status", dynlib: LIB_CAIRO.}
proc status_to_string*(status: TStatus): cstring{.cdecl,
importc: "cairo_status_to_string", dynlib: LIB_CAIRO.}
#* Surface manipulation
proc surface_create_similar*(other: PSurface, content: TContent,
width, height: int32): PSurface{.cdecl,
importc: "cairo_surface_create_similar", dynlib: LIB_CAIRO.}
proc reference*(surface: PSurface): PSurface{.cdecl,
importc: "cairo_surface_reference", dynlib: LIB_CAIRO.}
proc finish*(surface: PSurface){.cdecl, importc: "cairo_surface_finish",
dynlib: LIB_CAIRO.}
proc destroy*(surface: PSurface){.cdecl,
importc: "cairo_surface_destroy", dynlib: LIB_CAIRO.}
proc get_reference_count*(surface: PSurface): int32{.cdecl,
importc: "cairo_surface_get_reference_count", dynlib: LIB_CAIRO.}
proc status*(surface: PSurface): TStatus{.cdecl,
importc: "cairo_surface_status", dynlib: LIB_CAIRO.}
proc get_type*(surface: PSurface): TSurfaceType{.cdecl,
importc: "cairo_surface_get_type", dynlib: LIB_CAIRO.}
proc get_content*(surface: PSurface): TContent{.cdecl,
importc: "cairo_surface_get_content", dynlib: LIB_CAIRO.}
proc write_to_png*(surface: PSurface, filename: cstring): TStatus{.
cdecl, importc: "cairo_surface_write_to_png", dynlib: LIB_CAIRO.}
proc write_to_png*(surface: PSurface, write_func: TWriteFunc,
closure: pointer): TStatus{.cdecl,
importc: "cairo_surface_write_to_png_stream", dynlib: LIB_CAIRO.}
proc get_user_data*(surface: PSurface, key: PUserDataKey): pointer{.
cdecl, importc: "cairo_surface_get_user_data", dynlib: LIB_CAIRO.}
proc set_user_data*(surface: PSurface, key: PUserDataKey,
user_data: pointer, destroy: TDestroyFunc): TStatus{.
cdecl, importc: "cairo_surface_set_user_data", dynlib: LIB_CAIRO.}
proc get_font_options*(surface: PSurface, options: PFontOptions){.cdecl,
importc: "cairo_surface_get_font_options", dynlib: LIB_CAIRO.}
proc flush*(surface: PSurface){.cdecl, importc: "cairo_surface_flush",
dynlib: LIB_CAIRO.}
proc mark_dirty*(surface: PSurface){.cdecl,
importc: "cairo_surface_mark_dirty", dynlib: LIB_CAIRO.}
proc mark_dirty_rectangle*(surface: PSurface, x, y, width, height: int32){.
cdecl, importc: "cairo_surface_mark_dirty_rectangle", dynlib: LIB_CAIRO.}
proc set_device_offset*(surface: PSurface, x_offset, y_offset: float64){.
cdecl, importc: "cairo_surface_set_device_offset", dynlib: LIB_CAIRO.}
proc get_device_offset*(surface: PSurface,
x_offset, y_offset: var float64){.cdecl,
importc: "cairo_surface_get_device_offset", dynlib: LIB_CAIRO.}
proc set_fallback_resolution*(surface: PSurface, x_pixels_per_inch,
y_pixels_per_inch: float64){.cdecl, importc: "cairo_surface_set_fallback_resolution",
dynlib: LIB_CAIRO.}
#* Image-surface functions
proc image_surface_create*(format: TFormat, width, height: int32): PSurface{.
cdecl, importc: "cairo_image_surface_create", dynlib: LIB_CAIRO.}
proc image_surface_create*(data: Pbyte, format: TFormat,
width, height, stride: int32): PSurface{.
cdecl, importc: "cairo_image_surface_create_for_data", dynlib: LIB_CAIRO.}
proc get_data*(surface: PSurface): cstring{.cdecl,
importc: "cairo_image_surface_get_data", dynlib: LIB_CAIRO.}
proc get_format*(surface: PSurface): TFormat{.cdecl,
importc: "cairo_image_surface_get_format", dynlib: LIB_CAIRO.}
proc get_width*(surface: PSurface): int32{.cdecl,
importc: "cairo_image_surface_get_width", dynlib: LIB_CAIRO.}
proc get_height*(surface: PSurface): int32{.cdecl,
importc: "cairo_image_surface_get_height", dynlib: LIB_CAIRO.}
proc get_stride*(surface: PSurface): int32{.cdecl,
importc: "cairo_image_surface_get_stride", dynlib: LIB_CAIRO.}
proc image_surface_create_from_png*(filename: cstring): PSurface{.cdecl,
importc: "cairo_image_surface_create_from_png", dynlib: LIB_CAIRO.}
proc image_surface_create_from_png*(read_func: TReadFunc,
closure: pointer): PSurface{.cdecl, importc: "cairo_image_surface_create_from_png_stream",
dynlib: LIB_CAIRO.}
#* Pattern creation functions
proc pattern_create_rgb*(red, green, blue: float64): PPattern{.cdecl,
importc: "cairo_pattern_create_rgb", dynlib: LIB_CAIRO.}
proc pattern_create_rgba*(red, green, blue, alpha: float64): PPattern{.cdecl,
importc: "cairo_pattern_create_rgba", dynlib: LIB_CAIRO.}
proc pattern_create_for_surface*(surface: PSurface): PPattern{.cdecl,
importc: "cairo_pattern_create_for_surface", dynlib: LIB_CAIRO.}
proc pattern_create_linear*(x0, y0, x1, y1: float64): PPattern{.cdecl,
importc: "cairo_pattern_create_linear", dynlib: LIB_CAIRO.}
proc pattern_create_radial*(cx0, cy0, radius0, cx1, cy1, radius1: float64): PPattern{.
cdecl, importc: "cairo_pattern_create_radial", dynlib: LIB_CAIRO.}
proc reference*(pattern: PPattern): PPattern{.cdecl,
importc: "cairo_pattern_reference", dynlib: LIB_CAIRO.}
proc destroy*(pattern: PPattern){.cdecl,
importc: "cairo_pattern_destroy", dynlib: LIB_CAIRO.}
proc get_reference_count*(pattern: PPattern): int32{.cdecl,
importc: "cairo_pattern_get_reference_count", dynlib: LIB_CAIRO.}
proc status*(pattern: PPattern): TStatus{.cdecl,
importc: "cairo_pattern_status", dynlib: LIB_CAIRO.}
proc get_user_data*(pattern: PPattern, key: PUserDataKey): Pointer{.
cdecl, importc: "cairo_pattern_get_user_data", dynlib: LIB_CAIRO.}
proc set_user_data*(pattern: PPattern, key: PUserDataKey,
user_data: Pointer, destroy: TDestroyFunc): TStatus{.
cdecl, importc: "cairo_pattern_set_user_data", dynlib: LIB_CAIRO.}
proc get_type*(pattern: PPattern): TPatternType{.cdecl,
importc: "cairo_pattern_get_type", dynlib: LIB_CAIRO.}
proc add_color_stop_rgb*(pattern: PPattern,
offset, red, green, blue: float64){.cdecl,
importc: "cairo_pattern_add_color_stop_rgb", dynlib: LIB_CAIRO.}
proc add_color_stop_rgba*(pattern: PPattern,
offset, red, green, blue, alpha: float64){.
cdecl, importc: "cairo_pattern_add_color_stop_rgba", dynlib: LIB_CAIRO.}
proc set_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl,
importc: "cairo_pattern_set_matrix", dynlib: LIB_CAIRO.}
proc get_matrix*(pattern: PPattern, matrix: PMatrix){.cdecl,
importc: "cairo_pattern_get_matrix", dynlib: LIB_CAIRO.}
proc set_extend*(pattern: PPattern, extend: TExtend){.cdecl,
importc: "cairo_pattern_set_extend", dynlib: LIB_CAIRO.}
proc get_extend*(pattern: PPattern): TExtend{.cdecl,
importc: "cairo_pattern_get_extend", dynlib: LIB_CAIRO.}
proc set_filter*(pattern: PPattern, filter: TFilter){.cdecl,
importc: "cairo_pattern_set_filter", dynlib: LIB_CAIRO.}
proc get_filter*(pattern: PPattern): TFilter{.cdecl,
importc: "cairo_pattern_get_filter", dynlib: LIB_CAIRO.}
proc get_rgba*(pattern: PPattern,
red, green, blue, alpha: var float64): TStatus{.
cdecl, importc: "cairo_pattern_get_rgba", dynlib: LIB_CAIRO.}
proc get_surface*(pattern: PPattern, surface: PPSurface): TStatus{.
cdecl, importc: "cairo_pattern_get_surface", dynlib: LIB_CAIRO.}
proc get_color_stop_rgba*(pattern: PPattern, index: int32,
offset, red, green, blue, alpha: var float64): TStatus{.
cdecl, importc: "cairo_pattern_get_color_stop_rgba", dynlib: LIB_CAIRO.}
proc get_color_stop_count*(pattern: PPattern, count: var int32): TStatus{.
cdecl, importc: "cairo_pattern_get_color_stop_count", dynlib: LIB_CAIRO.}
proc get_linear_points*(pattern: PPattern,
x0, y0, x1, y1: var float64): TStatus{.
cdecl, importc: "cairo_pattern_get_linear_points", dynlib: LIB_CAIRO.}
proc get_radial_circles*(pattern: PPattern,
x0, y0, r0, x1, y1, r1: var float64): TStatus{.
cdecl, importc: "cairo_pattern_get_radial_circles", dynlib: LIB_CAIRO.}
#* Matrix functions
proc init*(matrix: PMatrix, xx, yx, xy, yy, x0, y0: float64){.cdecl,
importc: "cairo_matrix_init", dynlib: LIB_CAIRO.}
proc init_identity*(matrix: PMatrix){.cdecl,
importc: "cairo_matrix_init_identity", dynlib: LIB_CAIRO.}
proc init_translate*(matrix: PMatrix, tx, ty: float64){.cdecl,
importc: "cairo_matrix_init_translate", dynlib: LIB_CAIRO.}
proc init_scale*(matrix: PMatrix, sx, sy: float64){.cdecl,
importc: "cairo_matrix_init_scale", dynlib: LIB_CAIRO.}
proc init_rotate*(matrix: PMatrix, radians: float64){.cdecl,
importc: "cairo_matrix_init_rotate", dynlib: LIB_CAIRO.}
proc translate*(matrix: PMatrix, tx, ty: float64){.cdecl,
importc: "cairo_matrix_translate", dynlib: LIB_CAIRO.}
proc scale*(matrix: PMatrix, sx, sy: float64){.cdecl,
importc: "cairo_matrix_scale", dynlib: LIB_CAIRO.}
proc rotate*(matrix: PMatrix, radians: float64){.cdecl,
importc: "cairo_matrix_rotate", dynlib: LIB_CAIRO.}
proc invert*(matrix: PMatrix): TStatus{.cdecl,
importc: "cairo_matrix_invert", dynlib: LIB_CAIRO.}
proc multiply*(result, a, b: PMatrix){.cdecl,
importc: "cairo_matrix_multiply", dynlib: LIB_CAIRO.}
proc transform_distance*(matrix: PMatrix, dx, dy: var float64){.cdecl,
importc: "cairo_matrix_transform_distance", dynlib: LIB_CAIRO.}
proc transform_point*(matrix: PMatrix, x, y: var float64){.cdecl,
importc: "cairo_matrix_transform_point", dynlib: LIB_CAIRO.}
#* PDF functions
proc pdf_surface_create*(filename: cstring,
width_in_points, height_in_points: float64): PSurface{.
cdecl, importc: "cairo_pdf_surface_create", dynlib: LIB_CAIRO.}
proc pdf_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
width_in_points, height_in_points: float64): PSurface{.
cdecl, importc: "cairo_pdf_surface_create_for_stream", dynlib: LIB_CAIRO.}
proc pdf_surface_set_size*(surface: PSurface,
width_in_points, height_in_points: float64){.cdecl,
importc: "cairo_pdf_surface_set_size", dynlib: LIB_CAIRO.}
#* PS functions
proc ps_surface_create*(filename: cstring,
width_in_points, height_in_points: float64): PSurface{.
cdecl, importc: "cairo_ps_surface_create", dynlib: LIB_CAIRO.}
proc ps_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
width_in_points, height_in_points: float64): PSurface{.
cdecl, importc: "cairo_ps_surface_create_for_stream", dynlib: LIB_CAIRO.}
proc ps_surface_set_size*(surface: PSurface,
width_in_points, height_in_points: float64){.cdecl,
importc: "cairo_ps_surface_set_size", dynlib: LIB_CAIRO.}
proc ps_surface_dsc_comment*(surface: PSurface, comment: cstring){.cdecl,
importc: "cairo_ps_surface_dsc_comment", dynlib: LIB_CAIRO.}
proc ps_surface_dsc_begin_setup*(surface: PSurface){.cdecl,
importc: "cairo_ps_surface_dsc_begin_setup", dynlib: LIB_CAIRO.}
proc ps_surface_dsc_begin_page_setup*(surface: PSurface){.cdecl,
importc: "cairo_ps_surface_dsc_begin_page_setup", dynlib: LIB_CAIRO.}
#* SVG functions
proc svg_surface_create*(filename: cstring,
width_in_points, height_in_points: float64): PSurface{.
cdecl, importc: "cairo_svg_surface_create", dynlib: LIB_CAIRO.}
proc svg_surface_create_for_stream*(write_func: TWriteFunc, closure: Pointer,
width_in_points, height_in_points: float64): PSurface{.
cdecl, importc: "cairo_svg_surface_create_for_stream", dynlib: LIB_CAIRO.}
proc svg_surface_restrict_to_version*(surface: PSurface, version: TSvgVersion){.
cdecl, importc: "cairo_svg_surface_restrict_to_version", dynlib: LIB_CAIRO.}
#todo: see how translate this
#procedure cairo_svg_get_versions(TCairoSvgVersion const **versions,
# int *num_versions);
proc svg_version_to_string*(version: TSvgVersion): cstring{.cdecl,
importc: "cairo_svg_version_to_string", dynlib: LIB_CAIRO.}
#* Functions to be used while debugging (not intended for use in production code)
proc debug_reset_static_data*(){.cdecl,
importc: "cairo_debug_reset_static_data",
dynlib: LIB_CAIRO.}
# implementation
proc version(major, minor, micro: var int32) =
var version: int32
version = version()
major = version div 10000'i32
minor = (version mod (major * 10000'i32)) div 100'i32
micro = (version mod ((major * 10000'i32) + (minor * 100'i32)))
proc checkStatus*(s: cairo.TStatus) {.noinline.} =
## if ``s != StatusSuccess`` the error is turned into an appropirate Nimrod
## exception and raised.
case s
of StatusSuccess: nil
of StatusNoMemory:
raise newException(EOutOfMemory, $statusToString(s)))
of STATUS_READ_ERROR, STATUS_WRITE_ERROR, STATUS_FILE_NOT_FOUND,
STATUS_TEMP_FILE_ERROR:
raise newException(EIO, $statusToString(s))
else:
raise newException(EAssertion, $statusToString(s))

View File

@@ -1,35 +0,0 @@
#
# Translation of cairo-ft.h
# by Jeffrey Pohlmeyer
# updated to version 1.4 by Luiz Am<41>rico Pereira C<>mara 2007
#
import
cairo, freetypeh
#todo: properly define FcPattern:
#It will require translate FontConfig header
#*
#typedef struct _XftPattern {
# int num;
# int size;
# XftPatternElt *elts;
# } XftPattern;
# typedef FcPattern XftPattern;
#
type
FcPattern* = Pointer
PFcPattern* = ptr FcPattern
proc ft_font_face_create_for_pattern*(pattern: PFcPattern): PFontFace{.cdecl,
importc: "cairo_ft_font_face_create_for_pattern", dynlib: LIB_CAIRO.}
proc ft_font_options_substitute*(options: PFontOptions, pattern: PFcPattern){.
cdecl, importc: "cairo_ft_font_options_substitute", dynlib: LIB_CAIRO.}
proc ft_font_face_create_for_ft_face*(face: TFT_Face, load_flags: int32): PFontFace{.
cdecl, importc: "cairo_ft_font_face_create_for_ft_face", dynlib: LIB_CAIRO.}
proc ft_scaled_font_lock_face*(scaled_font: PScaledFont): TFT_Face{.cdecl,
importc: "cairo_ft_scaled_font_lock_face", dynlib: LIB_CAIRO.}
proc ft_scaled_font_unlock_face*(scaled_font: PScaledFont){.cdecl,
importc: "cairo_ft_scaled_font_unlock_face", dynlib: LIB_CAIRO.}

View File

@@ -1,37 +0,0 @@
#
# Translation of cairo-win32.h version 1.4
# by Luiz Am<41>rico Pereira C<>mara 2007
#
import
cairo, windows
proc win32_surface_create*(hdc: HDC): PSurface{.cdecl,
importc: "cairo_win32_surface_create", dynlib: LIB_CAIRO.}
proc win32_surface_create_with_ddb*(hdc: HDC, format: TFormat,
width, height: int32): PSurface{.cdecl,
importc: "cairo_win32_surface_create_with_ddb", dynlib: LIB_CAIRO.}
proc win32_surface_create_with_dib*(format: TFormat, width, height: int32): PSurface{.
cdecl, importc: "cairo_win32_surface_create_with_dib", dynlib: LIB_CAIRO.}
proc win32_surface_get_dc*(surface: PSurface): HDC{.cdecl,
importc: "cairo_win32_surface_get_dc", dynlib: LIB_CAIRO.}
proc win32_surface_get_image*(surface: PSurface): PSurface{.cdecl,
importc: "cairo_win32_surface_get_image", dynlib: LIB_CAIRO.}
proc win32_font_face_create_for_logfontw*(logfont: pLOGFONTW): PFontFace{.cdecl,
importc: "cairo_win32_font_face_create_for_logfontw", dynlib: LIB_CAIRO.}
proc win32_font_face_create_for_hfont*(font: HFONT): PFontFace{.cdecl,
importc: "cairo_win32_font_face_create_for_hfont", dynlib: LIB_CAIRO.}
proc win32_scaled_font_select_font*(scaled_font: PScaledFont, hdc: HDC): TStatus{.
cdecl, importc: "cairo_win32_scaled_font_select_font", dynlib: LIB_CAIRO.}
proc win32_scaled_font_done_font*(scaled_font: PScaledFont){.cdecl,
importc: "cairo_win32_scaled_font_done_font", dynlib: LIB_CAIRO.}
proc win32_scaled_font_get_metrics_factor*(scaled_font: PScaledFont): float64{.
cdecl, importc: "cairo_win32_scaled_font_get_metrics_factor",
dynlib: LIB_CAIRO.}
proc win32_scaled_font_get_logical_to_device*(scaled_font: PScaledFont,
logical_to_device: PMatrix){.cdecl, importc: "cairo_win32_scaled_font_get_logical_to_device",
dynlib: LIB_CAIRO.}
proc win32_scaled_font_get_device_to_logical*(scaled_font: PScaledFont,
device_to_logical: PMatrix){.cdecl, importc: "cairo_win32_scaled_font_get_device_to_logical",
dynlib: LIB_CAIRO.}
# implementation

View File

@@ -1,39 +0,0 @@
#
# Translation of cairo-xlib.h version 1.4
# by Jeffrey Pohlmeyer
# updated to version 1.4 by Luiz Am<41>rico Pereira C<>mara 2007
#
import
cairo, x, xlib, xrender
proc xlib_surface_create*(dpy: PDisplay, drawable: TDrawable, visual: PVisual,
width, height: int32): PSurface{.cdecl,
importc: "cairo_xlib_surface_create", dynlib: LIB_CAIRO.}
proc xlib_surface_create_for_bitmap*(dpy: PDisplay, bitmap: TPixmap,
screen: PScreen, width, height: int32): PSurface{.
cdecl, importc: "cairo_xlib_surface_create_for_bitmap", dynlib: LIB_CAIRO.}
proc xlib_surface_create_with_xrender_format*(dpy: PDisplay,
drawable: TDrawable, screen: PScreen, format: PXRenderPictFormat,
width, height: int32): PSurface{.cdecl, importc: "cairo_xlib_surface_create_with_xrender_format",
dynlib: LIB_CAIRO.}
proc xlib_surface_get_depth*(surface: PSurface): int32{.cdecl,
importc: "cairo_xlib_surface_get_depth", dynlib: LIB_CAIRO.}
proc xlib_surface_get_display*(surface: PSurface): PDisplay{.cdecl,
importc: "cairo_xlib_surface_get_display", dynlib: LIB_CAIRO.}
proc xlib_surface_get_drawable*(surface: PSurface): TDrawable{.cdecl,
importc: "cairo_xlib_surface_get_drawable", dynlib: LIB_CAIRO.}
proc xlib_surface_get_height*(surface: PSurface): int32{.cdecl,
importc: "cairo_xlib_surface_get_height", dynlib: LIB_CAIRO.}
proc xlib_surface_get_screen*(surface: PSurface): PScreen{.cdecl,
importc: "cairo_xlib_surface_get_screen", dynlib: LIB_CAIRO.}
proc xlib_surface_get_visual*(surface: PSurface): PVisual{.cdecl,
importc: "cairo_xlib_surface_get_visual", dynlib: LIB_CAIRO.}
proc xlib_surface_get_width*(surface: PSurface): int32{.cdecl,
importc: "cairo_xlib_surface_get_width", dynlib: LIB_CAIRO.}
proc xlib_surface_set_size*(surface: PSurface, width, height: int32){.cdecl,
importc: "cairo_xlib_surface_set_size", dynlib: LIB_CAIRO.}
proc xlib_surface_set_drawable*(surface: PSurface, drawable: TDrawable,
width, height: int32){.cdecl,
importc: "cairo_xlib_surface_set_drawable", dynlib: LIB_CAIRO.}
# implementation

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,271 +0,0 @@
{.deadCodeElim: on.}
import
glib2
when defined(win32):
const
pixbuflib = "libgdk_pixbuf-2.0-0.dll"
elif defined(darwin):
const
pixbuflib = "gdk_pixbuf-2.0.0"
# linklib gtk-x11-2.0
# linklib gdk-x11-2.0
# linklib pango-1.0.0
# linklib glib-2.0.0
# linklib gobject-2.0.0
# linklib gdk_pixbuf-2.0.0
# linklib atk-1.0.0
else:
const
pixbuflib = "libgdk_pixbuf-2.0.so"
type
PPixbuf* = pointer
PPixbufAnimation* = pointer
PPixbufAnimationIter* = pointer
PPixbufAlphaMode* = ptr TPixbufAlphaMode
TPixbufAlphaMode* = enum
PIXBUF_ALPHA_BILEVEL, PIXBUF_ALPHA_FULL
PColorspace* = ptr TColorspace
TColorspace* = enum
COLORSPACE_RGB
TPixbufDestroyNotify* = proc (pixels: Pguchar, data: gpointer){.cdecl.}
PPixbufError* = ptr TPixbufError
TPixbufError* = enum
PIXBUF_ERROR_CORRUPT_IMAGE, PIXBUF_ERROR_INSUFFICIENT_MEMORY,
PIXBUF_ERROR_BAD_OPTION, PIXBUF_ERROR_UNKNOWN_TYPE,
PIXBUF_ERROR_UNSUPPORTED_OPERATION, PIXBUF_ERROR_FAILED
PInterpType* = ptr TInterpType
TInterpType* = enum
INTERP_NEAREST, INTERP_TILES, INTERP_BILINEAR, INTERP_HYPER
proc TYPE_PIXBUF*(): GType
proc PIXBUF*(anObject: pointer): PPixbuf
proc IS_PIXBUF*(anObject: pointer): bool
proc TYPE_PIXBUF_ANIMATION*(): GType
proc PIXBUF_ANIMATION*(anObject: pointer): PPixbufAnimation
proc IS_PIXBUF_ANIMATION*(anObject: pointer): bool
proc TYPE_PIXBUF_ANIMATION_ITER*(): GType
proc PIXBUF_ANIMATION_ITER*(anObject: pointer): PPixbufAnimationIter
proc IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool
proc PIXBUF_ERROR*(): TGQuark
proc pixbuf_error_quark*(): TGQuark{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_error_quark".}
proc pixbuf_get_type*(): GType{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_get_type".}
when not defined(PIXBUF_DISABLE_DEPRECATED):
proc pixbuf_ref*(pixbuf: PPixbuf): PPixbuf{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_ref".}
proc pixbuf_unref*(pixbuf: PPixbuf){.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_unref".}
proc get_colorspace*(pixbuf: PPixbuf): TColorspace{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_get_colorspace".}
proc get_n_channels*(pixbuf: PPixbuf): int32{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_get_n_channels".}
proc get_has_alpha*(pixbuf: PPixbuf): gboolean{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_get_has_alpha".}
proc get_bits_per_sample*(pixbuf: PPixbuf): int32{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_get_bits_per_sample".}
proc get_pixels*(pixbuf: PPixbuf): Pguchar{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_get_pixels".}
proc get_width*(pixbuf: PPixbuf): int32{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_get_width".}
proc get_height*(pixbuf: PPixbuf): int32{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_get_height".}
proc get_rowstride*(pixbuf: PPixbuf): int32{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_get_rowstride".}
proc pixbuf_new*(colorspace: TColorspace, has_alpha: gboolean,
bits_per_sample: int32, width: int32, height: int32): PPixbuf{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_new".}
proc copy*(pixbuf: PPixbuf): PPixbuf{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_copy".}
proc new_subpixbuf*(src_pixbuf: PPixbuf, src_x: int32, src_y: int32,
width: int32, height: int32): PPixbuf{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_new_subpixbuf".}
proc pixbuf_new_from_file*(filename: cstring, error: pointer): PPixbuf{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_file".}
proc pixbuf_new_from_data*(data: Pguchar, colorspace: TColorspace,
has_alpha: gboolean, bits_per_sample: int32,
width: int32, height: int32, rowstride: int32,
destroy_fn: TPixbufDestroyNotify,
destroy_fn_data: gpointer): PPixbuf{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_data".}
proc pixbuf_new_from_xpm_data*(data: PPchar): PPixbuf{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_new_from_xpm_data".}
proc pixbuf_new_from_inline*(data_length: gint, a: var guint8,
copy_pixels: gboolean, error: pointer): PPixbuf{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_inline".}
proc pixbuf_new_from_file_at_size*(filename: cstring, width, height: gint,
error: pointer): PPixbuf{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_file_at_size".}
proc pixbuf_new_from_file_at_scale*(filename: cstring, width, height: gint,
preserve_aspect_ratio: gboolean,
error: pointer): PPixbuf{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_new_from_file_at_scale".}
proc fill*(pixbuf: PPixbuf, pixel: guint32){.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_fill".}
proc save*(pixbuf: PPixbuf, filename: cstring, `type`: cstring,
error: pointer): gboolean{.cdecl, varargs, dynlib: pixbuflib,
importc: "gdk_pixbuf_save".}
proc savev*(pixbuf: PPixbuf, filename: cstring, `type`: cstring,
option_keys: PPchar, option_values: PPchar, error: pointer): gboolean{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_savev".}
proc add_alpha*(pixbuf: PPixbuf, substitute_color: gboolean, r: guchar,
g: guchar, b: guchar): PPixbuf{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_add_alpha".}
proc copy_area*(src_pixbuf: PPixbuf, src_x: int32, src_y: int32,
width: int32, height: int32, dest_pixbuf: PPixbuf,
dest_x: int32, dest_y: int32){.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_copy_area".}
proc saturate_and_pixelate*(src: PPixbuf, dest: PPixbuf,
saturation: gfloat, pixelate: gboolean){.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_saturate_and_pixelate".}
proc scale*(src: PPixbuf, dest: PPixbuf, dest_x: int32, dest_y: int32,
dest_width: int32, dest_height: int32, offset_x: float64,
offset_y: float64, scale_x: float64, scale_y: float64,
interp_type: TInterpType){.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_scale".}
proc composite*(src: PPixbuf, dest: PPixbuf, dest_x: int32,
dest_y: int32, dest_width: int32, dest_height: int32,
offset_x: float64, offset_y: float64, scale_x: float64,
scale_y: float64, interp_type: TInterpType,
overall_alpha: int32){.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_composite".}
proc composite_color*(src: PPixbuf, dest: PPixbuf, dest_x: int32,
dest_y: int32, dest_width: int32,
dest_height: int32, offset_x: float64,
offset_y: float64, scale_x: float64,
scale_y: float64, interp_type: TInterpType,
overall_alpha: int32, check_x: int32,
check_y: int32, check_size: int32, color1: guint32,
color2: guint32){.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_composite_color".}
proc scale_simple*(src: PPixbuf, dest_width: int32, dest_height: int32,
interp_type: TInterpType): PPixbuf{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_scale_simple".}
proc composite_color_simple*(src: PPixbuf, dest_width: int32,
dest_height: int32,
interp_type: TInterpType,
overall_alpha: int32, check_size: int32,
color1: guint32, color2: guint32): PPixbuf{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_composite_color_simple".}
proc pixbuf_animation_get_type*(): GType{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_animation_get_type".}
proc pixbuf_animation_new_from_file*(filename: cstring, error: pointer): PPixbufAnimation{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_new_from_file".}
when not defined(PIXBUF_DISABLE_DEPRECATED):
proc pixbuf_animation_ref*(animation: PPixbufAnimation): PPixbufAnimation{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_ref".}
proc pixbuf_animation_unref*(animation: PPixbufAnimation){.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_animation_unref".}
proc get_width*(animation: PPixbufAnimation): int32{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_animation_get_width".}
proc get_height*(animation: PPixbufAnimation): int32{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_animation_get_height".}
proc is_static_image*(animation: PPixbufAnimation): gboolean{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_is_static_image".}
proc get_static_image*(animation: PPixbufAnimation): PPixbuf{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_get_static_image".}
proc get_iter*(animation: PPixbufAnimation, e: var TGTimeVal): PPixbufAnimationIter{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_get_iter".}
proc pixbuf_animation_iter_get_type*(): GType{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_animation_iter_get_type".}
proc iter_get_delay_time*(iter: PPixbufAnimationIter): int32{.
cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_animation_iter_get_delay_time".}
proc iter_get_pixbuf*(iter: PPixbufAnimationIter): PPixbuf{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_iter_get_pixbuf".}
proc pixbuf_animation_iter_on_currently_loading_frame*(
iter: PPixbufAnimationIter): gboolean{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_animation_iter_on_currently_loading_frame".}
proc iter_advance*(iter: PPixbufAnimationIter, e: var TGTimeVal): gboolean{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_animation_iter_advance".}
proc get_option*(pixbuf: PPixbuf, key: cstring): cstring{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_get_option".}
type
PPixbufLoader* = ptr TPixbufLoader
TPixbufLoader*{.final, pure.} = object
parent_instance*: TGObject
priv*: gpointer
PPixbufLoaderClass* = ptr TPixbufLoaderClass
TPixbufLoaderClass*{.final, pure.} = object
parent_class*: TGObjectClass
area_prepared*: proc (loader: PPixbufLoader){.cdecl.}
area_updated*: proc (loader: PPixbufLoader, x: int32, y: int32,
width: int32, height: int32){.cdecl.}
closed*: proc (loader: PPixbufLoader){.cdecl.}
proc TYPE_PIXBUF_LOADER*(): GType
proc PIXBUF_LOADER*(obj: pointer): PPixbufLoader
proc PIXBUF_LOADER_CLASS*(klass: pointer): PPixbufLoaderClass
proc IS_PIXBUF_LOADER*(obj: pointer): bool
proc IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool
proc PIXBUF_LOADER_GET_CLASS*(obj: pointer): PPixbufLoaderClass
proc pixbuf_loader_get_type*(): GType{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_loader_get_type".}
proc pixbuf_loader_new*(): PPixbufLoader{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_loader_new".}
proc pixbuf_loader_new_with_type*(image_type: cstring, error: pointer): PPixbufLoader{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_loader_new_with_type".}
proc write*(loader: PPixbufLoader, buf: Pguchar, count: gsize,
error: pointer): gboolean{.cdecl, dynlib: pixbuflib,
importc: "gdk_pixbuf_loader_write".}
proc get_pixbuf*(loader: PPixbufLoader): PPixbuf{.cdecl,
dynlib: pixbuflib, importc: "gdk_pixbuf_loader_get_pixbuf".}
proc get_animation*(loader: PPixbufLoader): PPixbufAnimation{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_loader_get_animation".}
proc close*(loader: PPixbufLoader, error: pointer): gboolean{.
cdecl, dynlib: pixbuflib, importc: "gdk_pixbuf_loader_close".}
proc TYPE_PIXBUF_LOADER*(): GType =
result = pixbuf_loader_get_type()
proc PIXBUF_LOADER*(obj: pointer): PPixbufLoader =
result = cast[PPixbufLoader](G_TYPE_CHECK_INSTANCE_CAST(obj,
TYPE_PIXBUF_LOADER()))
proc PIXBUF_LOADER_CLASS*(klass: pointer): PPixbufLoaderClass =
result = cast[PPixbufLoaderClass](G_TYPE_CHECK_CLASS_CAST(klass,
TYPE_PIXBUF_LOADER()))
proc IS_PIXBUF_LOADER*(obj: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_PIXBUF_LOADER())
proc IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_PIXBUF_LOADER())
proc PIXBUF_LOADER_GET_CLASS*(obj: pointer): PPixbufLoaderClass =
result = cast[PPixbufLoaderClass](G_TYPE_INSTANCE_GET_CLASS(obj,
TYPE_PIXBUF_LOADER()))
proc TYPE_PIXBUF*(): GType =
result = pixbuf_get_type()
proc PIXBUF*(anObject: pointer): PPixbuf =
result = cast[PPixbuf](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_PIXBUF()))
proc IS_PIXBUF*(anObject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_PIXBUF())
proc TYPE_PIXBUF_ANIMATION*(): GType =
result = pixbuf_animation_get_type()
proc PIXBUF_ANIMATION*(anObject: pointer): PPixbufAnimation =
result = cast[PPixbufAnimation](G_TYPE_CHECK_INSTANCE_CAST(anObject,
TYPE_PIXBUF_ANIMATION()))
proc IS_PIXBUF_ANIMATION*(anObject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_PIXBUF_ANIMATION())
proc TYPE_PIXBUF_ANIMATION_ITER*(): GType =
result = pixbuf_animation_iter_get_type()
proc PIXBUF_ANIMATION_ITER*(anObject: pointer): PPixbufAnimationIter =
result = cast[PPixbufAnimationIter](G_TYPE_CHECK_INSTANCE_CAST(anObject,
TYPE_PIXBUF_ANIMATION_ITER()))
proc IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_PIXBUF_ANIMATION_ITER())
proc PIXBUF_ERROR*(): TGQuark =
result = pixbuf_error_quark()

View File

@@ -1,551 +0,0 @@
{.deadCodeElim: on.}
import
Glib2, gdk2
when defined(WIN32):
const
GLExtLib = "libgdkglext-win32-1.0-0.dll"
else:
const
GLExtLib = "libgdkglext-x11-1.0.so"
type
TGLConfigAttrib* = int32
TGLConfigCaveat* = int32
TGLVisualType* = int32
TGLTransparentType* = int32
TGLDrawableTypeMask* = int32
TGLRenderTypeMask* = int32
TGLBufferMask* = int32
TGLConfigError* = int32
TGLRenderType* = int32
TGLDrawableAttrib* = int32
TGLPbufferAttrib* = int32
TGLEventMask* = int32
TGLEventType* = int32
TGLDrawableType* = int32
TGLProc* = Pointer
PGLConfig* = ptr TGLConfig
PGLContext* = ptr TGLContext
PGLDrawable* = ptr TGLDrawable
PGLPixmap* = ptr TGLPixmap
PGLWindow* = ptr TGLWindow
TGLConfig* = object of TGObject
layer_plane*: gint
n_aux_buffers*: gint
n_sample_buffers*: gint
flag0*: int16
PGLConfigClass* = ptr TGLConfigClass
TGLConfigClass* = object of TGObjectClass
TGLContext* = object of TGObject
PGLContextClass* = ptr TGLContextClass
TGLContextClass* = object of TGObjectClass
TGLDrawable* = object of TGObject
PGLDrawableClass* = ptr TGLDrawableClass
TGLDrawableClass* = object of TGTypeInterface
create_new_context*: proc (gldrawable: PGLDrawable, share_list: PGLContext,
direct: gboolean, render_type: int32): PGLContext{.
cdecl.}
make_context_current*: proc (draw: PGLDrawable, a_read: PGLDrawable,
glcontext: PGLContext): gboolean{.cdecl.}
is_double_buffered*: proc (gldrawable: PGLDrawable): gboolean{.cdecl.}
swap_buffers*: proc (gldrawable: PGLDrawable){.cdecl.}
wait_gl*: proc (gldrawable: PGLDrawable){.cdecl.}
wait_gdk*: proc (gldrawable: PGLDrawable){.cdecl.}
gl_begin*: proc (draw: PGLDrawable, a_read: PGLDrawable,
glcontext: PGLContext): gboolean{.cdecl.}
gl_end*: proc (gldrawable: PGLDrawable){.cdecl.}
get_gl_config*: proc (gldrawable: PGLDrawable): PGLConfig{.cdecl.}
get_size*: proc (gldrawable: PGLDrawable, width, height: PGInt){.cdecl.}
TGLPixmap* = object of TGObject
drawable*: PDrawable
PGLPixmapClass* = ptr TGLPixmapClass
TGLPixmapClass* = object of TGObjectClass
TGLWindow* = object of TGObject
drawable*: PDrawable
PGLWindowClass* = ptr TGLWindowClass
TGLWindowClass* = object of TGObjectClass
const
HEADER_GDKGLEXT_MAJOR_VERSION* = 1
HEADER_GDKGLEXT_MINOR_VERSION* = 0
HEADER_GDKGLEXT_MICRO_VERSION* = 6
HEADER_GDKGLEXT_INTERFACE_AGE* = 4
HEADER_GDKGLEXT_BINARY_AGE* = 6
proc HEADER_GDKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool
var
glext_major_version*{.importc, dynlib: GLExtLib.}: guint
glext_minor_version*{.importc, dynlib: GLExtLib.}: guint
glext_micro_version*{.importc, dynlib: GLExtLib.}: guint
glext_interface_age*{.importc, dynlib: GLExtLib.}: guint
glext_binary_age*{.importc, dynlib: GLExtLib.}: guint
const
GL_SUCCESS* = 0
GL_ATTRIB_LIST_NONE* = 0
GL_USE_GL* = 1
GL_BUFFER_SIZE* = 2
GL_LEVEL* = 3
GL_RGBA* = 4
GL_DOUBLEBUFFER* = 5
GL_STEREO* = 6
GL_AUX_BUFFERS* = 7
GL_RED_SIZE* = 8
GL_GREEN_SIZE* = 9
GL_BLUE_SIZE* = 10
GL_ALPHA_SIZE* = 11
GL_DEPTH_SIZE* = 12
GL_STENCIL_SIZE* = 13
GL_ACCUM_RED_SIZE* = 14
GL_ACCUM_GREEN_SIZE* = 15
GL_ACCUM_BLUE_SIZE* = 16
GL_ACCUM_ALPHA_SIZE* = 17
GL_CONFIG_CAVEAT* = 0x00000020
GL_X_VISUAL_TYPE* = 0x00000022
GL_TRANSPARENT_TYPE* = 0x00000023
GL_TRANSPARENT_INDEX_VALUE* = 0x00000024
GL_TRANSPARENT_RED_VALUE* = 0x00000025
GL_TRANSPARENT_GREEN_VALUE* = 0x00000026
GL_TRANSPARENT_BLUE_VALUE* = 0x00000027
GL_TRANSPARENT_ALPHA_VALUE* = 0x00000028
GL_DRAWABLE_TYPE* = 0x00008010
GL_RENDER_TYPE* = 0x00008011
GL_X_RENDERABLE* = 0x00008012
GL_FBCONFIG_ID* = 0x00008013
GL_MAX_PBUFFER_WIDTH* = 0x00008016
GL_MAX_PBUFFER_HEIGHT* = 0x00008017
GL_MAX_PBUFFER_PIXELS* = 0x00008018
GL_VISUAL_ID* = 0x0000800B
GL_SCREEN* = 0x0000800C
GL_SAMPLE_BUFFERS* = 100000
GL_SAMPLES* = 100001
GL_DONT_CARE* = 0xFFFFFFFF
GL_NONE* = 0x00008000
GL_CONFIG_CAVEAT_DONT_CARE* = 0xFFFFFFFF
GL_CONFIG_CAVEAT_NONE* = 0x00008000
GL_SLOW_CONFIG* = 0x00008001
GL_NON_CONFORMANT_CONFIG* = 0x0000800D
GL_VISUAL_TYPE_DONT_CARE* = 0xFFFFFFFF
GL_TRUE_COLOR* = 0x00008002
GL_DIRECT_COLOR* = 0x00008003
GL_PSEUDO_COLOR* = 0x00008004
GL_STATIC_COLOR* = 0x00008005
GL_GRAY_SCALE* = 0x00008006
GL_STATIC_GRAY* = 0x00008007
GL_TRANSPARENT_NONE* = 0x00008000
GL_TRANSPARENT_RGB* = 0x00008008
GL_TRANSPARENT_INDEX* = 0x00008009
GL_WINDOW_BIT* = 1 shl 0
GL_PIXMAP_BIT* = 1 shl 1
GL_PBUFFER_BIT* = 1 shl 2
GL_RGBA_BIT* = 1 shl 0
GL_COLOR_INDEX_BIT* = 1 shl 1
GL_FRONT_LEFT_BUFFER_BIT* = 1 shl 0
GL_FRONT_RIGHT_BUFFER_BIT* = 1 shl 1
GL_BACK_LEFT_BUFFER_BIT* = 1 shl 2
GL_BACK_RIGHT_BUFFER_BIT* = 1 shl 3
GL_AUX_BUFFERS_BIT* = 1 shl 4
GL_DEPTH_BUFFER_BIT* = 1 shl 5
GL_STENCIL_BUFFER_BIT* = 1 shl 6
GL_ACCUM_BUFFER_BIT* = 1 shl 7
GL_BAD_SCREEN* = 1
GL_BAD_ATTRIBUTE* = 2
GL_NO_EXTENSION* = 3
GL_BAD_VISUAL* = 4
GL_BAD_CONTEXT* = 5
GL_BAD_VALUE* = 6
GL_BAD_ENUM* = 7
GL_RGBA_TYPE* = 0x00008014
GL_COLOR_INDEX_TYPE* = 0x00008015
GL_PRESERVED_CONTENTS* = 0x0000801B
GL_LARGEST_PBUFFER* = 0x0000801C
GL_WIDTH* = 0x0000801D
GL_HEIGHT* = 0x0000801E
GL_EVENT_MASK* = 0x0000801F
GL_PBUFFER_PRESERVED_CONTENTS* = 0x0000801B
GL_PBUFFER_LARGEST_PBUFFER* = 0x0000801C
GL_PBUFFER_HEIGHT* = 0x00008040
GL_PBUFFER_WIDTH* = 0x00008041
GL_PBUFFER_CLOBBER_MASK* = 1 shl 27
GL_DAMAGED* = 0x00008020
GL_SAVED* = 0x00008021
GL_WINDOW_VALUE* = 0x00008022
GL_PBUFFER* = 0x00008023
proc gl_config_attrib_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_attrib_get_type".}
proc TYPE_GL_CONFIG_ATTRIB*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_attrib_get_type".}
proc gl_config_caveat_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_caveat_get_type".}
proc TYPE_GL_CONFIG_CAVEAT*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_caveat_get_type".}
proc gl_visual_type_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_visual_type_get_type".}
proc TYPE_GL_VISUAL_TYPE*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_visual_type_get_type".}
proc gl_transparent_type_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_transparent_type_get_type".}
proc TYPE_GL_TRANSPARENT_TYPE*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_transparent_type_get_type".}
proc gl_drawable_type_mask_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_type_mask_get_type".}
proc TYPE_GL_DRAWABLE_TYPE_MASK*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_type_mask_get_type".}
proc gl_render_type_mask_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_render_type_mask_get_type".}
proc TYPE_GL_RENDER_TYPE_MASK*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_render_type_mask_get_type".}
proc gl_buffer_mask_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_buffer_mask_get_type".}
proc TYPE_GL_BUFFER_MASK*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_buffer_mask_get_type".}
proc gl_config_error_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_error_get_type".}
proc TYPE_GL_CONFIG_ERROR*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_error_get_type".}
proc gl_render_type_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_render_type_get_type".}
proc TYPE_GL_RENDER_TYPE*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_render_type_get_type".}
proc gl_drawable_attrib_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_attrib_get_type".}
proc TYPE_GL_DRAWABLE_ATTRIB*(): GType{.cdecl, dynlib: GLExtLib, importc: "gdk_gl_drawable_attrib_get_type".}
proc gl_pbuffer_attrib_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_pbuffer_attrib_get_type".}
proc TYPE_GL_PBUFFER_ATTRIB*(): GType{.cdecl, dynlib: GLExtLib, importc: "gdk_gl_pbuffer_attrib_get_type".}
proc gl_event_mask_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_event_mask_get_type".}
proc TYPE_GL_EVENT_MASK*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_event_mask_get_type".}
proc gl_event_type_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_event_type_get_type".}
proc TYPE_GL_EVENT_TYPE*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_event_type_get_type".}
proc gl_drawable_type_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_type_get_type".}
proc TYPE_GL_DRAWABLE_TYPE*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_type_get_type".}
proc gl_config_mode_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_mode_get_type".}
proc TYPE_GL_CONFIG_MODE*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_mode_get_type".}
proc gl_parse_args*(argc: var int32, argv: ptr cstringArray): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_parse_args".}
proc gl_init_check*(argc: var int32, argv: ptr cstringArray): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_init_check".}
proc gl_init*(argc: var int32, argv: ptr cstringArray){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_init".}
proc gl_query_gl_extension*(extension: cstring): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_query_gl_extension".}
proc gl_get_proc_address*(proc_name: cstring): TGLProc{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_get_proc_address".}
const
bm_TGdkGLConfig_is_rgba* = 1 shl 0
bp_TGdkGLConfig_is_rgba* = 0
bm_TGdkGLConfig_is_double_buffered* = 1 shl 1
bp_TGdkGLConfig_is_double_buffered* = 1
bm_TGdkGLConfig_as_single_mode* = 1 shl 2
bp_TGdkGLConfig_as_single_mode* = 2
bm_TGdkGLConfig_is_stereo* = 1 shl 3
bp_TGdkGLConfig_is_stereo* = 3
bm_TGdkGLConfig_has_alpha* = 1 shl 4
bp_TGdkGLConfig_has_alpha* = 4
bm_TGdkGLConfig_has_depth_buffer* = 1 shl 5
bp_TGdkGLConfig_has_depth_buffer* = 5
bm_TGdkGLConfig_has_stencil_buffer* = 1 shl 6
bp_TGdkGLConfig_has_stencil_buffer* = 6
bm_TGdkGLConfig_has_accum_buffer* = 1 shl 7
bp_TGdkGLConfig_has_accum_buffer* = 7
const
GL_MODE_RGB* = 0
GL_MODE_RGBA* = 0
GL_MODE_INDEX* = 1 shl 0
GL_MODE_SINGLE* = 0
GL_MODE_DOUBLE* = 1 shl 1
GL_MODE_STEREO* = 1 shl 2
GL_MODE_ALPHA* = 1 shl 3
GL_MODE_DEPTH* = 1 shl 4
GL_MODE_STENCIL* = 1 shl 5
GL_MODE_ACCUM* = 1 shl 6
GL_MODE_MULTISAMPLE* = 1 shl 7
type
TGLConfigMode* = int32
PGLConfigMode* = ptr TGLConfigMode
proc TYPE_GL_CONFIG*(): GType
proc GL_CONFIG*(anObject: Pointer): PGLConfig
proc GL_CONFIG_CLASS*(klass: Pointer): PGLConfigClass
proc IS_GL_CONFIG*(anObject: Pointer): bool
proc IS_GL_CONFIG_CLASS*(klass: Pointer): bool
proc GL_CONFIG_GET_CLASS*(obj: Pointer): PGLConfigClass
proc gl_config_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_get_type".}
proc get_screen*(glconfig: PGLConfig): PScreen{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_get_screen".}
proc get_attrib*(glconfig: PGLConfig, attribute: int, value: var cint): gboolean{.
cdecl, dynlib: GLExtLib, importc: "gdk_gl_config_get_attrib".}
proc get_colormap*(glconfig: PGLConfig): PColormap{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_get_colormap".}
proc get_visual*(glconfig: PGLConfig): PVisual{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_get_visual".}
proc get_depth*(glconfig: PGLConfig): gint{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_get_depth".}
proc get_layer_plane*(glconfig: PGLConfig): gint{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_get_layer_plane".}
proc get_n_aux_buffers*(glconfig: PGLConfig): gint{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_get_n_aux_buffers".}
proc get_n_sample_buffers*(glconfig: PGLConfig): gint{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_get_n_sample_buffers".}
proc is_rgba*(glconfig: PGLConfig): gboolean{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_config_is_rgba".}
proc is_double_buffered*(glconfig: PGLConfig): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_is_double_buffered".}
proc is_stereo*(glconfig: PGLConfig): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_is_stereo".}
proc has_alpha*(glconfig: PGLConfig): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_has_alpha".}
proc has_depth_buffer*(glconfig: PGLConfig): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_has_depth_buffer".}
proc has_stencil_buffer*(glconfig: PGLConfig): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_has_stencil_buffer".}
proc has_accum_buffer*(glconfig: PGLConfig): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_config_has_accum_buffer".}
proc TYPE_GL_CONTEXT*(): GType
proc GL_CONTEXT*(anObject: Pointer): PGLContext
proc GL_CONTEXT_CLASS*(klass: Pointer): PGLContextClass
proc IS_GL_CONTEXT*(anObject: Pointer): bool
proc IS_GL_CONTEXT_CLASS*(klass: Pointer): bool
proc GL_CONTEXT_GET_CLASS*(obj: Pointer): PGLContextClass
proc gl_context_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_context_get_type".}
proc context_new*(gldrawable: PGLDrawable, share_list: PGLContext,
direct: gboolean, render_type: int32): PGLContext{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_context_new".}
proc destroy*(glcontext: PGLContext){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_context_destroy".}
proc copy*(glcontext: PGLContext, src: PGLContext, mask: int32): gboolean{.
cdecl, dynlib: GLExtLib, importc: "gdk_gl_context_copy".}
proc get_gl_drawable*(glcontext: PGLContext): PGLDrawable{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_context_get_gl_drawable".}
proc get_gl_config*(glcontext: PGLContext): PGLConfig{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_context_get_gl_config".}
proc get_share_list*(glcontext: PGLContext): PGLContext{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_context_get_share_list".}
proc is_direct*(glcontext: PGLContext): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_context_is_direct".}
proc get_render_type*(glcontext: PGLContext): int32{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_context_get_render_type".}
proc gl_context_get_current*(): PGLContext{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_context_get_current".}
proc TYPE_GL_DRAWABLE*(): GType
proc GL_DRAWABLE*(inst: Pointer): PGLDrawable
proc GL_DRAWABLE_CLASS*(vtable: Pointer): PGLDrawableClass
proc IS_GL_DRAWABLE*(inst: Pointer): bool
proc IS_GL_DRAWABLE_CLASS*(vtable: Pointer): bool
proc GL_DRAWABLE_GET_CLASS*(inst: Pointer): PGLDrawableClass
proc gl_drawable_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_get_type".}
proc make_current*(gldrawable: PGLDrawable, glcontext: PGLContext): gboolean{.
cdecl, dynlib: GLExtLib, importc: "gdk_gl_drawable_make_current".}
proc is_double_buffered*(gldrawable: PGLDrawable): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_drawable_is_double_buffered".}
proc swap_buffers*(gldrawable: PGLDrawable){.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_drawable_swap_buffers".}
proc wait_gl*(gldrawable: PGLDrawable){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_wait_gl".}
proc wait_gdk*(gldrawable: PGLDrawable){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_wait_gdk".}
proc gl_begin*(gldrawable: PGLDrawable, glcontext: PGLContext): gboolean{.
cdecl, dynlib: GLExtLib, importc: "gdk_gl_drawable_gl_begin".}
proc gl_end*(gldrawable: PGLDrawable){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_gl_end".}
proc get_gl_config*(gldrawable: PGLDrawable): PGLConfig{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_drawable_get_gl_config".}
proc get_size*(gldrawable: PGLDrawable, width, height: PGInt){.
cdecl, dynlib: GLExtLib, importc: "gdk_gl_drawable_get_size".}
proc gl_drawable_get_current*(): PGLDrawable{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_drawable_get_current".}
proc TYPE_GL_PIXMAP*(): GType
proc GL_PIXMAP*(anObject: Pointer): PGLPixmap
proc GL_PIXMAP_CLASS*(klass: Pointer): PGLPixmapClass
proc IS_GL_PIXMAP*(anObject: Pointer): bool
proc IS_GL_PIXMAP_CLASS*(klass: Pointer): bool
proc GL_PIXMAP_GET_CLASS*(obj: Pointer): PGLPixmapClass
proc gl_pixmap_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_pixmap_get_type".}
proc pixmap_new*(glconfig: PGLConfig, pixmap: PPixmap, attrib_list: ptr int32): PGLPixmap{.
cdecl, dynlib: GLExtLib, importc: "gdk_gl_pixmap_new".}
proc destroy*(glpixmap: PGLPixmap){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_pixmap_destroy".}
proc get_pixmap*(glpixmap: PGLPixmap): PPixmap{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_pixmap_get_pixmap".}
proc set_gl_capability*(pixmap: PPixmap, glconfig: PGLConfig,
attrib_list: ptr int32): PGLPixmap{.cdecl,
dynlib: GLExtLib, importc: "gdk_pixmap_set_gl_capability".}
proc unset_gl_capability*(pixmap: PPixmap){.cdecl, dynlib: GLExtLib,
importc: "gdk_pixmap_unset_gl_capability".}
proc is_gl_capable*(pixmap: PPixmap): gboolean{.cdecl, dynlib: GLExtLib,
importc: "gdk_pixmap_is_gl_capable".}
proc get_gl_pixmap*(pixmap: PPixmap): PGLPixmap{.cdecl, dynlib: GLExtLib,
importc: "gdk_pixmap_get_gl_pixmap".}
proc get_gl_drawable*(pixmap: PPixmap): PGLDrawable
proc TYPE_GL_WINDOW*(): GType
proc GL_WINDOW*(anObject: Pointer): PGLWindow
proc GL_WINDOW_CLASS*(klass: Pointer): PGLWindowClass
proc IS_GL_WINDOW*(anObject: Pointer): bool
proc IS_GL_WINDOW_CLASS*(klass: Pointer): bool
proc GL_WINDOW_GET_CLASS*(obj: Pointer): PGLWindowClass
proc gl_window_get_type*(): GType{.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_window_get_type".}
proc window_new*(glconfig: PGLConfig, window: PWindow, attrib_list: ptr int32): PGLWindow{.
cdecl, dynlib: GLExtLib, importc: "gdk_gl_window_new".}
proc destroy*(glwindow: PGLWindow){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_window_destroy".}
proc get_window*(glwindow: PGLWindow): PWindow{.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_window_get_window".}
proc set_gl_capability*(window: PWindow, glconfig: PGLConfig,
attrib_list: ptr int32): PGLWindow{.cdecl,
dynlib: GLExtLib, importc: "gdk_window_set_gl_capability".}
proc unset_gl_capability*(window: PWindow){.cdecl, dynlib: GLExtLib,
importc: "gdk_window_unset_gl_capability".}
proc is_gl_capable*(window: PWindow): gboolean{.cdecl, dynlib: GLExtLib,
importc: "gdk_window_is_gl_capable".}
proc get_gl_window*(window: PWindow): PGLWindow{.cdecl, dynlib: GLExtLib,
importc: "gdk_window_get_gl_window".}
proc get_gl_drawable*(window: PWindow): PGLDrawable
proc gl_draw_cube*(solid: gboolean, size: float64){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_draw_cube".}
proc gl_draw_sphere*(solid: gboolean, radius: float64, slices: int32,
stacks: int32){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_draw_sphere".}
proc gl_draw_cone*(solid: gboolean, base: float64, height: float64,
slices: int32, stacks: int32){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_draw_cone".}
proc gl_draw_torus*(solid: gboolean, inner_radius: float64,
outer_radius: float64, nsides: int32, rings: int32){.cdecl,
dynlib: GLExtLib, importc: "gdk_gl_draw_torus".}
proc gl_draw_tetrahedron*(solid: gboolean){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_draw_tetrahedron".}
proc gl_draw_octahedron*(solid: gboolean){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_draw_octahedron".}
proc gl_draw_dodecahedron*(solid: gboolean){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_draw_dodecahedron".}
proc gl_draw_icosahedron*(solid: gboolean){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_draw_icosahedron".}
proc gl_draw_teapot*(solid: gboolean, scale: float64){.cdecl, dynlib: GLExtLib,
importc: "gdk_gl_draw_teapot".}
proc HEADER_GDKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool =
result = (HEADER_GDKGLEXT_MAJOR_VERSION > major) or
((HEADER_GDKGLEXT_MAJOR_VERSION == major) and
(HEADER_GDKGLEXT_MINOR_VERSION > minor)) or
((HEADER_GDKGLEXT_MAJOR_VERSION == major) and
(HEADER_GDKGLEXT_MINOR_VERSION == minor) and
(HEADER_GDKGLEXT_MICRO_VERSION >= micro))
proc TYPE_GL_CONFIG*(): GType =
result = gl_config_get_type()
proc GL_CONFIG*(anObject: Pointer): PGLConfig =
result = cast[PGLConfig](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_GL_CONFIG()))
proc GL_CONFIG_CLASS*(klass: Pointer): PGLConfigClass =
result = cast[PGLConfigClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_GL_CONFIG()))
proc IS_GL_CONFIG*(anObject: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GL_CONFIG())
proc IS_GL_CONFIG_CLASS*(klass: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GL_CONFIG())
proc GL_CONFIG_GET_CLASS*(obj: Pointer): PGLConfigClass =
result = cast[PGLConfigClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_GL_CONFIG()))
proc TYPE_GL_CONTEXT*(): GType =
result = gl_context_get_type()
proc GL_CONTEXT*(anObject: Pointer): PGLContext =
result = cast[PGLContext](G_TYPE_CHECK_INSTANCE_CAST(anObject,
TYPE_GL_CONTEXT()))
proc GL_CONTEXT_CLASS*(klass: Pointer): PGLContextClass =
result = cast[PGLContextClass](G_TYPE_CHECK_CLASS_CAST(klass,
TYPE_GL_CONTEXT()))
proc IS_GL_CONTEXT*(anObject: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GL_CONTEXT())
proc IS_GL_CONTEXT_CLASS*(klass: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GL_CONTEXT())
proc GL_CONTEXT_GET_CLASS*(obj: Pointer): PGLContextClass =
result = cast[PGLContextClass](G_TYPE_INSTANCE_GET_CLASS(obj,
TYPE_GL_CONTEXT()))
proc TYPE_GL_DRAWABLE*(): GType =
result = gl_drawable_get_type()
proc GL_DRAWABLE*(inst: Pointer): PGLDrawable =
result = cast[PGLDrawable](G_TYPE_CHECK_INSTANCE_CAST(inst, TYPE_GL_DRAWABLE()))
proc GL_DRAWABLE_CLASS*(vtable: Pointer): PGLDrawableClass =
result = cast[PGLDrawableClass](G_TYPE_CHECK_CLASS_CAST(vtable,
TYPE_GL_DRAWABLE()))
proc IS_GL_DRAWABLE*(inst: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(inst, TYPE_GL_DRAWABLE())
proc IS_GL_DRAWABLE_CLASS*(vtable: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(vtable, TYPE_GL_DRAWABLE())
proc GL_DRAWABLE_GET_CLASS*(inst: Pointer): PGLDrawableClass =
result = cast[PGLDrawableClass](G_TYPE_INSTANCE_GET_INTERFACE(inst,
TYPE_GL_DRAWABLE()))
proc TYPE_GL_PIXMAP*(): GType =
result = gl_pixmap_get_type()
proc GL_PIXMAP*(anObject: Pointer): PGLPixmap =
result = cast[PGLPixmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_GL_PIXMAP()))
proc GL_PIXMAP_CLASS*(klass: Pointer): PGLPixmapClass =
result = cast[PGLPixmapClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_GL_PIXMAP()))
proc IS_GL_PIXMAP*(anObject: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GL_PIXMAP())
proc IS_GL_PIXMAP_CLASS*(klass: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GL_PIXMAP())
proc GL_PIXMAP_GET_CLASS*(obj: Pointer): PGLPixmapClass =
result = cast[PGLPixmapClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_GL_PIXMAP()))
proc get_gl_drawable*(pixmap: PPixmap): PGLDrawable =
result = GL_DRAWABLE(get_gl_pixmap(pixmap))
proc TYPE_GL_WINDOW*(): GType =
result = gl_window_get_type()
proc GL_WINDOW*(anObject: Pointer): PGLWindow =
result = cast[PGLWindow](G_TYPE_CHECK_INSTANCE_CAST(anObject, TYPE_GL_WINDOW()))
proc GL_WINDOW_CLASS*(klass: Pointer): PGLWindowClass =
result = cast[PGLWindowClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_GL_WINDOW()))
proc IS_GL_WINDOW*(anObject: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, TYPE_GL_WINDOW())
proc IS_GL_WINDOW_CLASS*(klass: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_GL_WINDOW())
proc GL_WINDOW_GET_CLASS*(obj: Pointer): PGLWindowClass =
result = cast[PGLWindowClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_GL_WINDOW()))
proc get_gl_drawable*(window: PWindow): PGLDrawable =
result = GL_DRAWABLE(get_gl_window(window))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +0,0 @@
{.deadCodeElim: on.}
import
Glib2, Gdk2, gtk2, GdkGLExt
const
GLExtLib* = if defined(WIN32): "libgtkglext-win32-1.0-0.dll" else: "libgtkglext-x11-1.0.so"
const
HEADER_GTKGLEXT_MAJOR_VERSION* = 1
HEADER_GTKGLEXT_MINOR_VERSION* = 0
HEADER_GTKGLEXT_MICRO_VERSION* = 6
HEADER_GTKGLEXT_INTERFACE_AGE* = 4
HEADER_GTKGLEXT_BINARY_AGE* = 6
proc gl_parse_args*(argc: ptr int32, argv: PPPChar): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gtk_gl_parse_args".}
proc gl_init_check*(argc: ptr int32, argv: PPPChar): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gtk_gl_init_check".}
proc gl_init*(argc: ptr int32, argv: PPPChar){.cdecl, dynlib: GLExtLib,
importc: "gtk_gl_init".}
proc set_gl_capability*(widget: PWidget, glconfig: PGLConfig,
share_list: PGLContext, direct: gboolean,
render_type: int): gboolean{.cdecl,
dynlib: GLExtLib, importc: "gtk_widget_set_gl_capability".}
proc is_gl_capable*(widget: PWidget): gboolean{.cdecl, dynlib: GLExtLib,
importc: "gtk_widget_is_gl_capable".}
proc get_gl_config*(widget: PWidget): PGLConfig{.cdecl,
dynlib: GLExtLib, importc: "gtk_widget_get_gl_config".}
proc create_gl_context*(widget: PWidget, share_list: PGLContext,
direct: gboolean, render_type: int): PGLContext{.
cdecl, dynlib: GLExtLib, importc: "gtk_widget_create_gl_context".}
proc get_gl_context*(widget: PWidget): PGLContext{.cdecl,
dynlib: GLExtLib, importc: "gtk_widget_get_gl_context".}
proc get_gl_window*(widget: PWidget): PGLWindow{.cdecl,
dynlib: GLExtLib, importc: "gtk_widget_get_gl_window".}
proc HEADER_GTKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool =
result = (HEADER_GTKGLEXT_MAJOR_VERSION > major) or
((HEADER_GTKGLEXT_MAJOR_VERSION == major) and
(HEADER_GTKGLEXT_MINOR_VERSION > minor)) or
((HEADER_GTKGLEXT_MAJOR_VERSION == major) and
(HEADER_GTKGLEXT_MINOR_VERSION == minor) and
(HEADER_GTKGLEXT_MICRO_VERSION >= micro))
proc get_gl_drawable*(widget: PWidget): PGLDrawable =
result = GL_DRAWABLE(get_gl_window(widget))

View File

@@ -1,521 +0,0 @@
{.deadCodeElim: on.}
import
gtk2, glib2, atk, pango, gdk2pixbuf, gdk2
when defined(windows):
{.define: WINDOWING_WIN32.}
const
htmllib = "libgtkhtml-win32-2.0-0.dll"
else:
const
htmllib = "libgtkhtml-2.so"
const
DOM_UNSPECIFIED_EVENT_TYPE_ERR* = 0
DOM_INDEX_SIZE_ERR* = 1
DOM_DOMSTRING_SIZE_ERR* = 2
DOM_HIERARCHY_REQUEST_ERR* = 3
DOM_WRONG_DOCUMENT_ERR* = 4
DOM_INVALID_CHARACTER_ERR* = 5
DOM_NO_DATA_ALLOWED_ERR* = 6
DOM_NO_MODIFICATION_ALLOWED_ERR* = 7
DOM_NOT_FOUND_ERR* = 8
DOM_NOT_SUPPORTED_ERR* = 9
DOM_INUSE_ATTRIBUTE_ERR* = 10
DOM_INVALID_STATE_ERR* = 11
DOM_SYNTAX_ERR* = 12
DOM_INVALID_MODIFICATION_ERR* = 13
DOM_NAMESPACE_ERR* = 14
DOM_INVALID_ACCESS_ERR* = 15
DOM_NO_EXCEPTION* = 255
DOM_ELEMENT_NODE* = 1
DOM_ATTRIBUTE_NODE* = 2
DOM_TEXT_NODE* = 3
DOM_CDATA_SECTION_NODE* = 4
DOM_ENTITY_REFERENCE_NODE* = 5
DOM_ENTITY_NODE* = 6
DOM_PROCESSING_INSTRUCTION_NODE* = 7
DOM_COMMENT_NODE* = 8
DOM_DOCUMENT_NODE* = 9
DOM_DOCUMENT_TYPE_NODE* = 10
DOM_DOCUMENT_FRAGMENT_NODE* = 11
DOM_NOTATION_NODE* = 12
bm_HtmlFontSpecification_weight* = 0x0000000F
bp_HtmlFontSpecification_weight* = 0
bm_HtmlFontSpecification_style* = 0x00000030
bp_HtmlFontSpecification_style* = 4
bm_HtmlFontSpecification_variant* = 0x000000C0
bp_HtmlFontSpecification_variant* = 6
bm_HtmlFontSpecification_stretch* = 0x00000F00
bp_HtmlFontSpecification_stretch* = 8
bm_HtmlFontSpecification_decoration* = 0x00007000
bp_HtmlFontSpecification_decoration* = 12
type
TDomString* = gchar
PDomString* = cstring
TDomBoolean* = gboolean
TDomException* = gushort
TDomTimeStamp* = guint64
PDomNode* = ptr TDomNode
TDomNode* = object of TGObject
xmlnode*: pointer
style*: pointer
PDomException* = ptr TDomException
PDomNodeClass* = ptr TDomNodeClass
TDomNodeClass* = object of TGObjectClass
`get_nodeName`*: proc (node: PDomNode): PDomString{.cdecl.}
`get_nodeValue`*: proc (node: PDomNode, exc: PDomException): PDomString{.
cdecl.}
`set_nodeValue`*: proc (node: PDomNode, value: PDomString,
exc: PDomException): PDomString{.cdecl.}
PDomDocument* = ptr TDomDocument
TDomDocument*{.final, pure.} = object
parent*: PDomNode
iterators*: PGSList
PDomDocumentClass* = ptr TDomDocumentClass
TDomDocumentClass*{.final, pure.} = object
parent_class*: PDomNodeClass
PHtmlFocusIterator* = ptr THtmlFocusIterator
THtmlFocusIterator* = object of TGObject
document*: PDomDocument
current_node*: PDomNode
PHtmlFocusIteratorClass* = ptr THtmlFocusIteratorClass
THtmlFocusIteratorClass* = object of TGObjectClass
THtmlParserType* = enum
HTML_PARSER_TYPE_HTML, HTML_PARSER_TYPE_XML
PHtmlParser* = ptr THtmlParser
THtmlParser* = object of TGObject
parser_type*: THtmlParserType
document*: PHtmlDocument
stream*: PHtmlStream
xmlctxt*: pointer
res*: int32
chars*: array[0..9, char]
blocking*: gboolean
blocking_node*: PDomNode
PHtmlParserClass* = ptr THtmlParserClass
THtmlParserClass* = object of gtk2.TObjectClass
done_parsing*: proc (parser: PHtmlParser){.cdecl.}
new_node*: proc (parser: PHtmlParser, node: PDomNode)
parsed_document_node*: proc (parser: PHtmlParser, document: PDomDocument)
PHtmlStream* = ptr THtmlStream
THtmlStreamCloseFunc* = proc (stream: PHtmlStream, user_data: gpointer){.cdecl.}
THtmlStreamWriteFunc* = proc (stream: PHtmlStream, buffer: cstring,
size: guint, user_data: gpointer){.cdecl.}
THtmlStreamCancelFunc* = proc (stream: PHtmlStream, user_data: gpointer,
cancel_data: gpointer){.cdecl.}
THtmlStream* = object of TGObject
write_func*: THtmlStreamWriteFunc
close_func*: THtmlStreamCloseFunc
cancel_func*: THtmlStreamCancelFunc
user_data*: gpointer
cancel_data*: gpointer
written*: gint
mime_type*: cstring
PHtmlStreamClass* = ptr THtmlStreamClass
THtmlStreamClass* = object of TGObjectClass
THtmlStreamBufferCloseFunc* = proc (str: cstring, len: gint,
user_data: gpointer){.cdecl.}
PHtmlContext* = ptr THtmlContext
THtmlContext* = object of TGObject
documents*: PGSList
standard_font*: PHtmlFontSpecification
fixed_font*: PHtmlFontSpecification
debug_painting*: gboolean
PHtmlFontSpecification* = ptr THtmlFontSpecification
THtmlFontSpecification {.final, pure.} = object
PHtmlContextClass* = ptr THtmlContextClass
THtmlContextClass* = object of TGObjectClass
THtmlDocumentState* = enum
HTML_DOCUMENT_STATE_DONE, HTML_DOCUMENT_STATE_PARSING
PHtmlDocument* = ptr THtmlDocument
THtmlDocument* = object of TGObject
stylesheets*: PGSList
current_stream*: PHtmlStream
state*: THtmlDocumentState
PHtmlDocumentClass* = ptr THtmlDocumentClass
THtmlDocumentClass* = object of TGObjectClass
request_url*: proc (document: PHtmlDocument, url: cstring,
stream: PHtmlStream){.cdecl.}
link_clicked*: proc (document: PHtmlDocument, url: cstring){.cdecl.}
set_base*: proc (document: PHtmlDocument, url: cstring){.cdecl.}
title_changed*: proc (document: PHtmlDocument, new_title: cstring){.cdecl.}
submit*: proc (document: PHtmlDocument, `method`: cstring, url: cstring,
encoding: cstring){.cdecl.}
PHtmlView* = ptr THtmlView
THtmlView* = object of gtk2.TLayout
document*: PHtmlDocument
node_table*: PGHashTable
relayout_idle_id*: guint
relayout_timeout_id*: guint
mouse_down_x*: gint
mouse_down_y*: gint
mouse_detail*: gint
sel_start_ypos*: gint
sel_start_index*: gint
sel_end_ypos*: gint
sel_end_index*: gint
sel_flag*: gboolean
sel_backwards*: gboolean
sel_start_found*: gboolean
sel_list*: PGSList
jump_to_anchor*: cstring
magnification*: gdouble
magnification_modified*: gboolean
on_url*: gboolean
PHtmlViewClass* = ptr THtmlViewClass
THtmlViewClass* = object of gtk2.TLayoutClass
move_cursor*: proc (html_view: PHtmlView, step: TMovementStep, count: gint,
extend_selection: gboolean){.cdecl.}
on_url*: proc (html_view: PHtmlView, url: cstring)
activate*: proc (html_view: PHtmlView)
move_focus_out*: proc (html_view: PHtmlView, direction: TDirectionType)
PDomNodeList* = ptr TDomNodeList
TDomNodeList {.pure, final.} = object
PDomNamedNodeMap* = ptr TDomNamedNodeMap
TDomNamedNodeMap {.pure, final.} = object
PDomDocumentType* = ptr TDomDocumentType
TDomDocumentType {.pure, final.} = object
PDomElement* = ptr TDomElement
TDomElement = object of TDomNode
PDomText* = ptr TDomText
TDomText = object of TDomNode
PDomComment* = ptr TDomComment
TDomComment = object of TDomNode
THtmlBox {.pure, final.} = object
PHtmlBox* = ptr THtmlBox
proc DOM_TYPE_NODE*(): GType
proc DOM_NODE*(theobject: pointer): PDomNode
proc DOM_NODE_CLASS*(klass: pointer): PDomNodeClass
proc DOM_IS_NODE*(theobject: pointer): bool
proc DOM_IS_NODE_CLASS*(klass: pointer): bool
proc DOM_NODE_GET_CLASS*(obj: pointer): int32
proc dom_node_get_type*(): GType{.cdecl, dynlib: htmllib,
importc: "dom_node_get_type".}
proc dom_Node_mkref*(node: pointer): PDomNode{.cdecl, dynlib: htmllib,
importc: "dom_Node_mkref".}
proc get_childNodes*(node: PDomNode): PDomNodeList{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_childNodes".}
proc removeChild*(node: PDomNode, oldChild: PDomNode,
exc: PDomException): PDomNode{.cdecl,
dynlib: htmllib, importc: "dom_Node_removeChild".}
proc get_nodeValue*(node: PDomNode, exc: PDomException): PDomString{.
cdecl, dynlib: htmllib, importc: "dom_Node__get_nodeValue".}
proc get_firstChild*(node: PDomNode): PDomNode{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_firstChild".}
proc get_nodeName*(node: PDomNode): PDomString{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_nodeName".}
proc get_attributes*(node: PDomNode): PDomNamedNodeMap{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_attributes".}
proc get_doctype*(doc: PDomDocument): PDomDocumentType{.cdecl,
dynlib: htmllib, importc: "dom_Document__get_doctype".}
proc hasChildNodes*(node: PDomNode): bool{.cdecl,
dynlib: htmllib, importc: "dom_Node_hasChildNodes".}
proc get_parentNode*(node: PDomNode): PDomNode{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_parentNode".}
proc get_nextSibling*(node: PDomNode): PDomNode{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_nextSibling".}
proc get_nodeType*(node: PDomNode): gushort{.cdecl, dynlib: htmllib,
importc: "dom_Node__get_nodeType".}
proc cloneNode*(node: PDomNode, deep: bool): PDomNode{.cdecl,
dynlib: htmllib, importc: "dom_Node_cloneNode".}
proc appendChild*(node: PDomNode, newChild: PDomNode,
exc: PDomException): PDomNode{.cdecl,
dynlib: htmllib, importc: "dom_Node_appendChild".}
proc get_localName*(node: PDomNode): PDomString{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_localName".}
proc get_namespaceURI*(node: PDomNode): PDomString{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_namespaceURI".}
proc get_previousSibling*(node: PDomNode): PDomNode{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_previousSibling".}
proc get_lastChild*(node: PDomNode): PDomNode{.cdecl, dynlib: htmllib,
importc: "dom_Node__get_lastChild".}
proc set_nodeValue*(node: PDomNode, value: PDomString,
exc: PDomException){.cdecl, dynlib: htmllib,
importc: "dom_Node__set_nodeValue".}
proc get_ownerDocument*(node: PDomNode): PDomDocument{.cdecl,
dynlib: htmllib, importc: "dom_Node__get_ownerDocument".}
proc hasAttributes*(node: PDomNode): gboolean{.cdecl, dynlib: htmllib,
importc: "dom_Node_hasAttributes".}
proc DOM_TYPE_DOCUMENT*(): GType
proc DOM_DOCUMENT*(theobject: pointer): PDomDocument
proc DOM_DOCUMENT_CLASS*(klass: pointer): PDomDocumentClass
proc DOM_IS_DOCUMENT*(theobject: pointer): bool
proc DOM_IS_DOCUMENT_CLASS*(klass: pointer): bool
proc DOM_DOCUMENT_GET_CLASS*(obj: pointer): PDomDocumentClass
proc dom_document_get_type*(): GType
proc get_documentElement*(doc: PDomDocument): PDomElement
proc createElement*(doc: PDomDocument, tagName: PDomString): PDomElement
proc createTextNode*(doc: PDomDocument, data: PDomString): PDomText
proc createComment*(doc: PDomDocument, data: PDomString): PDomComment
proc importNode*(doc: PDomDocument, importedNode: PDomNode,
deep: bool, exc: PDomException): PDomNode
proc HTML_TYPE_FOCUS_ITERATOR*(): GType
proc HTML_FOCUS_ITERATOR*(theobject: pointer): PHtmlFocusIterator
proc HTML_FOCUS_ITERATOR_CLASS*(klass: pointer): PHtmlFocusIteratorClass
proc HTML_IS_FOCUS_ITERATOR*(theobject: pointer): bool
proc HTML_IS_FOCUS_ITERATOR_CLASS*(klass: pointer): bool
proc HTML_FOCUS_ITERATOR_GET_CLASS*(obj: pointer): PHtmlFocusIteratorClass
proc html_focus_iterator_next_element*(document: PDomDocument,
element: PDomElement): PDomElement{.
cdecl, dynlib: htmllib, importc: "html_focus_iterator_next_element".}
proc html_focus_iterator_prev_element*(document: PDomDocument,
element: PDomElement): PDomElement{.
cdecl, dynlib: htmllib, importc: "html_focus_iterator_prev_element".}
proc HTML_PARSER_TYPE*(): GType
proc HTML_PARSER*(obj: pointer): PHtmlParser
proc HTML_PARSER_CLASS*(klass: pointer): PHtmlParserClass
proc HTML_IS_PARSER*(obj: pointer): bool
proc html_parser_get_type*(): GType
proc parser_new*(document: PHtmlDocument, parser_type: THtmlParserType): PHtmlParser
proc HTML_TYPE_STREAM*(): GType
proc HTML_STREAM*(obj: pointer): PHtmlStream
proc HTML_STREAM_CLASS*(klass: pointer): PHtmlStreamClass
proc HTML_IS_STREAM*(obj: pointer): bool
proc HTML_IS_STREAM_CLASS*(klass: pointer): bool
proc HTML_STREAM_GET_CLASS*(obj: pointer): PHtmlStreamClass
proc html_stream_get_type*(): GType{.cdecl, dynlib: htmllib,
importc: "html_stream_get_type".}
proc html_stream_new*(write_func: THtmlStreamWriteFunc,
close_func: THtmlStreamCloseFunc, user_data: gpointer): PHtmlStream{.
cdecl, dynlib: htmllib, importc: "html_stream_new".}
proc write*(stream: PHtmlStream, buffer: cstring, size: guint){.
cdecl, dynlib: htmllib, importc: "html_stream_write".}
proc close*(stream: PHtmlStream){.cdecl, dynlib: htmllib,
importc: "html_stream_close".}
proc destroy*(stream: PHtmlStream){.cdecl, dynlib: htmllib,
importc: "html_stream_destroy".}
proc get_written*(stream: PHtmlStream): gint{.cdecl,
dynlib: htmllib, importc: "html_stream_get_written".}
proc cancel*(stream: PHtmlStream){.cdecl, dynlib: htmllib,
importc: "html_stream_cancel".}
proc set_cancel_func*(stream: PHtmlStream,
abort_func: THtmlStreamCancelFunc,
cancel_data: gpointer){.cdecl,
dynlib: htmllib, importc: "html_stream_set_cancel_func".}
proc get_mime_type*(stream: PHtmlStream): cstring{.cdecl,
dynlib: htmllib, importc: "html_stream_get_mime_type".}
proc set_mime_type*(stream: PHtmlStream, mime_type: cstring){.cdecl,
dynlib: htmllib, importc: "html_stream_set_mime_type".}
proc html_stream_buffer_new*(close_func: THtmlStreamBufferCloseFunc,
user_data: gpointer): PHtmlStream{.cdecl,
dynlib: htmllib, importc: "html_stream_buffer_new".}
proc event_mouse_move*(view: PHtmlView, event: Gdk2.PEventMotion){.cdecl,
dynlib: htmllib, importc: "html_event_mouse_move".}
proc event_button_press*(view: PHtmlView, button: Gdk2.PEventButton){.cdecl,
dynlib: htmllib, importc: "html_event_button_press".}
proc event_button_release*(view: PHtmlView, event: Gdk2.PEventButton){.cdecl,
dynlib: htmllib, importc: "html_event_button_release".}
proc event_activate*(view: PHtmlView){.cdecl, dynlib: htmllib,
importc: "html_event_activate".}
proc event_key_press*(view: PHtmlView, event: Gdk2.PEventKey): gboolean{.
cdecl, dynlib: htmllib, importc: "html_event_key_press".}
proc event_find_root_box*(self: PHtmlBox, x: gint, y: gint): PHtmlBox{.
cdecl, dynlib: htmllib, importc: "html_event_find_root_box".}
proc selection_start*(view: PHtmlView, event: Gdk2.PEventButton){.cdecl,
dynlib: htmllib, importc: "html_selection_start".}
proc selection_end*(view: PHtmlView, event: Gdk2.PEventButton){.cdecl,
dynlib: htmllib, importc: "html_selection_end".}
proc selection_update*(view: PHtmlView, event: Gdk2.PEventMotion){.cdecl,
dynlib: htmllib, importc: "html_selection_update".}
proc selection_clear*(view: PHtmlView){.cdecl, dynlib: htmllib,
importc: "html_selection_clear".}
proc selection_set*(view: PHtmlView, start: PDomNode, offset: int32,
len: int32){.cdecl, dynlib: htmllib,
importc: "html_selection_set".}
proc HTML_CONTEXT_TYPE*(): GType
proc HTML_CONTEXT*(obj: pointer): PHtmlContext
proc HTML_CONTEXT_CLASS*(klass: pointer): PHtmlContextClass
proc HTML_IS_CONTEXT*(obj: pointer): bool
proc HTML_IS_CONTEXT_CLASS*(klass: pointer): bool
proc html_context_get_type*(): GType
proc html_context_get*(): PHtmlContext
proc HTML_TYPE_DOCUMENT*(): GType
proc HTML_DOCUMENT*(obj: pointer): PHtmlDocument
proc HTML_DOCUMENT_CLASS*(klass: pointer): PHtmlDocumentClass
proc HTML_IS_DOCUMENT*(obj: pointer): bool
proc html_document_get_type*(): GType{.cdecl, dynlib: htmllib,
importc: "html_document_get_type".}
proc html_document_new*(): PHtmlDocument{.cdecl, dynlib: htmllib,
importc: "html_document_new".}
proc open_stream*(document: PHtmlDocument, mime_type: cstring): gboolean{.
cdecl, dynlib: htmllib, importc: "html_document_open_stream".}
proc write_stream*(document: PHtmlDocument, buffer: cstring,
len: gint){.cdecl, dynlib: htmllib,
importc: "html_document_write_stream".}
proc close_stream*(document: PHtmlDocument){.cdecl,
dynlib: htmllib, importc: "html_document_close_stream".}
proc clear*(document: PHtmlDocument){.cdecl, dynlib: htmllib,
importc: "html_document_clear".}
proc HTML_TYPE_VIEW*(): GType
proc HTML_VIEW*(obj: pointer): PHtmlView
proc HTML_VIEW_CLASS*(klass: pointer): PHtmlViewClass
proc HTML_IS_VIEW*(obj: pointer): bool
proc html_view_get_type*(): GType{.cdecl, dynlib: htmllib,
importc: "html_view_get_type".}
proc html_view_new*(): PWidget{.cdecl, dynlib: htmllib, importc: "html_view_new".}
proc set_document*(view: PHtmlView, document: PHtmlDocument){.cdecl,
dynlib: htmllib, importc: "html_view_set_document".}
proc jump_to_anchor*(view: PHtmlView, anchor: cstring){.cdecl,
dynlib: htmllib, importc: "html_view_jump_to_anchor".}
proc get_magnification*(view: PHtmlView): gdouble{.cdecl,
dynlib: htmllib, importc: "html_view_get_magnification".}
proc set_magnification*(view: PHtmlView, magnification: gdouble){.
cdecl, dynlib: htmllib, importc: "html_view_set_magnification".}
proc zoom_in*(view: PHtmlView){.cdecl, dynlib: htmllib,
importc: "html_view_zoom_in".}
proc zoom_out*(view: PHtmlView){.cdecl, dynlib: htmllib,
importc: "html_view_zoom_out".}
proc zoom_reset*(view: PHtmlView){.cdecl, dynlib: htmllib,
importc: "html_view_zoom_reset".}
proc DOM_TYPE_NODE*(): GType =
result = dom_node_get_type()
proc DOM_NODE*(theobject: pointer): PDomNode =
result = G_TYPE_CHECK_INSTANCE_CAST(theobject, DOM_TYPE_NODE())
proc DOM_NODE_CLASS*(klass: pointer): PDomNodeClass =
result = G_TYPE_CHECK_CLASS_CAST(klass, DOM_TYPE_NODE(), TDomNodeClass)
proc DOM_IS_NODE*(theobject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, DOM_TYPE_NODE())
proc DOM_IS_NODE_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, DOM_TYPE_NODE())
proc DOM_NODE_GET_CLASS*(obj: pointer): PDomNodeClass =
result = G_TYPE_INSTANCE_GET_CLASS(obj, DOM_TYPE_NODE(), TDomNodeClass)
proc DOM_TYPE_DOCUMENT*(): GType =
result = dom_document_get_type()
proc DOM_DOCUMENT*(theobject: pointer): PDomDocument =
result = G_TYPE_CHECK_INSTANCE_CAST(theobject, DOM_TYPE_DOCUMENT(),
TDomDocument)
proc DOM_DOCUMENT_CLASS*(klass: pointer): PDomDocumentClass =
result = G_TYPE_CHECK_CLASS_CAST(klass, DOM_TYPE_DOCUMENT(), TDomDocumentClass)
proc DOM_IS_DOCUMENT*(theobject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, DOM_TYPE_DOCUMENT())
proc DOM_IS_DOCUMENT_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, DOM_TYPE_DOCUMENT())
proc DOM_DOCUMENT_GET_CLASS*(obj: pointer): PDomDocumentClass =
result = G_TYPE_INSTANCE_GET_CLASS(obj, DOM_TYPE_DOCUMENT(), TDomDocumentClass)
proc HTML_TYPE_FOCUS_ITERATOR*(): GType =
result = html_focus_iterator_get_type()
proc HTML_FOCUS_ITERATOR*(theobject: pointer): PHtmlFocusIterator =
result = G_TYPE_CHECK_INSTANCE_CAST(theobject, HTML_TYPE_FOCUS_ITERATOR(),
HtmlFocusIterator)
proc HTML_FOCUS_ITERATOR_CLASS*(klass: pointer): PHtmlFocusIteratorClass =
result = G_TYPE_CHECK_CLASS_CAST(klass, HTML_TYPE_FOCUS_ITERATOR(),
HtmlFocusIteratorClass)
proc HTML_IS_FOCUS_ITERATOR*(theobject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, HTML_TYPE_FOCUS_ITERATOR())
proc HTML_IS_FOCUS_ITERATOR_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, HTML_TYPE_FOCUS_ITERATOR())
proc HTML_FOCUS_ITERATOR_GET_CLASS*(obj: pointer): PHtmlFocusIteratorClass =
result = G_TYPE_INSTANCE_GET_CLASS(obj, HTML_TYPE_FOCUS_ITERATOR(),
HtmlFocusIteratorClass)
proc HTML_PARSER_TYPE*(): GType =
result = html_parser_get_type()
proc HTML_PARSER*(obj: pointer): PHtmlParser =
result = CHECK_CAST(obj, HTML_PARSER_TYPE(), THtmlParser)
proc HTML_PARSER_CLASS*(klass: pointer): PHtmlParserClass =
result = CHECK_CLASS_CAST(klass, HTML_PARSER_TYPE(), THtmlParserClass)
proc HTML_IS_PARSER*(obj: pointer): bool =
result = CHECK_TYPE(obj, HTML_PARSER_TYPE())
proc HTML_TYPE_STREAM*(): GType =
result = html_stream_get_type()
proc HTML_STREAM*(obj: pointer): PHtmlStream =
result = PHtmlStream(G_TYPE_CHECK_INSTANCE_CAST(obj, HTML_TYPE_STREAM()))
proc HTML_STREAM_CLASS*(klass: pointer): PHtmlStreamClass =
result = G_TYPE_CHECK_CLASS_CAST(klass, HTML_TYPE_STREAM())
proc HTML_IS_STREAM*(obj: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(obj, HTML_TYPE_STREAM())
proc HTML_IS_STREAM_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, HTML_TYPE_STREAM())
proc HTML_STREAM_GET_CLASS*(obj: pointer): PHtmlStreamClass =
result = PHtmlStreamClass(G_TYPE_INSTANCE_GET_CLASS(obj, HTML_TYPE_STREAM()))
proc HTML_CONTEXT_TYPE*(): GType =
result = html_context_get_type()
proc HTML_CONTEXT*(obj: pointer): PHtmlContext =
result = CHECK_CAST(obj, HTML_CONTEXT_TYPE(), THtmlContext)
proc HTML_CONTEXT_CLASS*(klass: pointer): PHtmlContextClass =
result = CHECK_CLASS_CAST(klass, HTML_CONTEXT_TYPE(), THtmlContextClass)
proc HTML_IS_CONTEXT*(obj: pointer): bool =
result = CHECK_TYPE(obj, HTML_CONTEXT_TYPE())
proc HTML_IS_CONTEXT_CLASS*(klass: pointer): bool =
result = CHECK_CLASS_TYPE(klass, HTML_CONTEXT_TYPE())
proc HTML_TYPE_DOCUMENT*(): GType =
result = html_document_get_type()
proc HTML_DOCUMENT*(obj: pointer): PHtmlDocument =
result = PHtmlDocument(CHECK_CAST(obj, HTML_TYPE_DOCUMENT()))
proc HTML_DOCUMENT_CLASS*(klass: pointer): PHtmlDocumentClass =
result = CHECK_CLASS_CAST(klass, HTML_TYPE_DOCUMENT())
proc HTML_IS_DOCUMENT*(obj: pointer): bool =
result = CHECK_TYPE(obj, HTML_TYPE_DOCUMENT())
proc HTML_TYPE_VIEW*(): GType =
result = html_view_get_type()
proc HTML_VIEW*(obj: pointer): PHtmlView =
result = PHtmlView(CHECK_CAST(obj, HTML_TYPE_VIEW()))
proc HTML_VIEW_CLASS*(klass: pointer): PHtmlViewClass =
result = PHtmlViewClass(CHECK_CLASS_CAST(klass, HTML_TYPE_VIEW()))
proc HTML_IS_VIEW*(obj: pointer): bool =
result = CHECK_TYPE(obj, HTML_TYPE_VIEW())

View File

@@ -1,111 +0,0 @@
{.deadCodeElim: on.}
import
glib2, gtk2
when defined(win32):
const
LibGladeLib = "libglade-2.0-0.dll"
else:
const
LibGladeLib = "libglade-2.0.so"
type
PLongint* = ptr int32
PSmallInt* = ptr int16
PByte* = ptr int8
PWord* = ptr int16
PDWord* = ptr int32
PDouble* = ptr float64
proc init*(){.cdecl, dynlib: LibGladeLib, importc: "glade_init".}
proc require*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib,
importc: "glade_require".}
proc provide*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib,
importc: "glade_provide".}
type
PXMLPrivate* = pointer
PXML* = ptr TXML
TXML* = object of TGObject
filename*: cstring
priv*: PXMLPrivate
PXMLClass* = ptr TXMLClass
TXMLClass* = object of TGObjectClass
TXMLConnectFunc* = proc (handler_name: cstring, anObject: PGObject,
signal_name: cstring, signal_data: cstring,
connect_object: PGObject, after: gboolean,
user_data: gpointer){.cdecl.}
proc TYPE_XML*(): GType
proc XML*(obj: pointer): PXML
proc XML_CLASS*(klass: pointer): PXMLClass
proc IS_XML*(obj: pointer): gboolean
proc IS_XML_CLASS*(klass: pointer): gboolean
proc XML_GET_CLASS*(obj: pointer): PXMLClass
proc xml_get_type*(): GType{.cdecl, dynlib: LibGladeLib,
importc: "glade_xml_get_type".}
proc xml_new*(fname: cstring, root: cstring, domain: cstring): PXML{.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_new".}
proc xml_new_from_buffer*(buffer: cstring, size: int32, root: cstring,
domain: cstring): PXML{.cdecl, dynlib: LibGladeLib,
importc: "glade_xml_new_from_buffer".}
proc construct*(self: PXML, fname: cstring, root: cstring, domain: cstring): gboolean{.
cdecl, dynlib: LibGladeLib, importc: "glade_xml_construct".}
proc signal_connect*(self: PXML, handlername: cstring, func: TGCallback){.
cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_connect".}
proc signal_connect_data*(self: PXML, handlername: cstring,
func: TGCallback, user_data: gpointer){.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_signal_connect_data".}
proc signal_autoconnect*(self: PXML){.cdecl, dynlib: LibGladeLib,
importc: "glade_xml_signal_autoconnect".}
proc signal_connect_full*(self: PXML, handler_name: cstring,
func: TXMLConnectFunc, user_data: gpointer){.
cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_connect_full".}
proc signal_autoconnect_full*(self: PXML, func: TXMLConnectFunc,
user_data: gpointer){.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_signal_autoconnect_full".}
proc get_widget*(self: PXML, name: cstring): gtk2.PWidget{.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_get_widget".}
proc get_widget_prefix*(self: PXML, name: cstring): PGList{.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_get_widget_prefix".}
proc relative_file*(self: PXML, filename: cstring): cstring{.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_relative_file".}
proc get_widget_name*(widget: gtk2.PWidget): cstring{.cdecl, dynlib: LibGladeLib,
importc: "glade_get_widget_name".}
proc get_widget_tree*(widget: gtk2.PWidget): PXML{.cdecl, dynlib: LibGladeLib,
importc: "glade_get_widget_tree".}
type
PXMLCustomWidgetHandler* = ptr TXMLCustomWidgetHandler
TXMLCustomWidgetHandler* = gtk2.TWidget
proc set_custom_handler*(handler: TXMLCustomWidgetHandler, user_data: gpointer){.
cdecl, dynlib: LibGladeLib, importc: "glade_set_custom_handler".}
proc gnome_init*() =
init()
proc bonobo_init*() =
init()
proc xml_new_with_domain*(fname: cstring, root: cstring, domain: cstring): PXML =
result = xml_new(fname, root, domain)
proc xml_new_from_memory*(buffer: cstring, size: int32, root: cstring,
domain: cstring): PXML =
result = xml_new_from_buffer(buffer, size, root, domain)
proc TYPE_XML*(): GType =
result = xml_get_type()
proc XML*(obj: pointer): PXML =
result = cast[PXML](G_TYPE_CHECK_INSTANCE_CAST(obj, TYPE_XML()))
proc XML_CLASS*(klass: pointer): PXMLClass =
result = cast[PXMLClass](G_TYPE_CHECK_CLASS_CAST(klass, TYPE_XML()))
proc IS_XML*(obj: pointer): gboolean =
result = G_TYPE_CHECK_INSTANCE_TYPE(obj, TYPE_XML())
proc IS_XML_CLASS*(klass: pointer): gboolean =
result = G_TYPE_CHECK_CLASS_TYPE(klass, TYPE_XML())
proc XML_GET_CLASS*(obj: pointer): PXMLClass =
result = cast[PXMLClass](G_TYPE_INSTANCE_GET_CLASS(obj, TYPE_XML()))

File diff suppressed because it is too large Load Diff

View File

@@ -1,42 +0,0 @@
{.deadCodeElim: on.}
import
glib2, pango
proc split_file_list*(str: cstring): PPchar{.cdecl, dynlib: lib,
importc: "pango_split_file_list".}
proc trim_string*(str: cstring): cstring{.cdecl, dynlib: lib,
importc: "pango_trim_string".}
proc read_line*(stream: TFile, str: PGString): gint{.cdecl, dynlib: lib,
importc: "pango_read_line".}
proc skip_space*(pos: PPchar): gboolean{.cdecl, dynlib: lib,
importc: "pango_skip_space".}
proc scan_word*(pos: PPchar, OutStr: PGString): gboolean{.cdecl, dynlib: lib,
importc: "pango_scan_word".}
proc scan_string*(pos: PPchar, OutStr: PGString): gboolean{.cdecl, dynlib: lib,
importc: "pango_scan_string".}
proc scan_int*(pos: PPchar, OutInt: ptr int32): gboolean{.cdecl, dynlib: lib,
importc: "pango_scan_int".}
proc config_key_get*(key: cstring): cstring{.cdecl, dynlib: lib,
importc: "pango_config_key_get".}
proc lookup_aliases*(fontname: cstring, families: PPPchar, n_families: ptr int32){.
cdecl, dynlib: lib, importc: "pango_lookup_aliases".}
proc parse_style*(str: cstring, style: PStyle, warn: gboolean): gboolean{.cdecl,
dynlib: lib, importc: "pango_parse_style".}
proc parse_variant*(str: cstring, variant: PVariant, warn: gboolean): gboolean{.
cdecl, dynlib: lib, importc: "pango_parse_variant".}
proc parse_weight*(str: cstring, weight: PWeight, warn: gboolean): gboolean{.
cdecl, dynlib: lib, importc: "pango_parse_weight".}
proc parse_stretch*(str: cstring, stretch: PStretch, warn: gboolean): gboolean{.
cdecl, dynlib: lib, importc: "pango_parse_stretch".}
proc get_sysconf_subdirectory*(): cstring{.cdecl, dynlib: lib,
importc: "pango_get_sysconf_subdirectory".}
proc get_lib_subdirectory*(): cstring{.cdecl, dynlib: lib,
importc: "pango_get_lib_subdirectory".}
proc log2vis_get_embedding_levels*(str: Pgunichar, len: int32,
pbase_dir: PDirection,
embedding_level_list: Pguint8): gboolean{.
cdecl, dynlib: lib, importc: "pango_log2vis_get_embedding_levels".}
proc get_mirror_char*(ch: gunichar, mirrored_ch: Pgunichar): gboolean{.cdecl,
dynlib: lib, importc: "pango_get_mirror_char".}
proc get_sample_string*(language: PLanguage): cstring{.cdecl,
dynlib: lib, importc: "pango_language_get_sample_string".}

View File

@@ -1,494 +0,0 @@
#
# $Id: header,v 1.1 2000/07/13 06:33:45 michael Exp $
# This file is part of the Free Pascal packages
# Copyright (c) 1999-2000 by the Free Pascal development team
#
# See the file COPYING.FPC, included in this distribution,
# for details about the copyright.
#
# This program 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.
#
# **********************************************************************
#
# the curl library is governed by its own copyright, see the curl
# website for this.
#
{.deadCodeElim: on.}
import
times
when defined(windows):
const
libname = "libcurl.dll"
elif defined(macosx):
const
libname = "libcurl-7.19.3.dylib"
elif defined(unix):
const
libname = "libcurl.so.4"
type
Pcalloc_callback* = ptr Tcalloc_callback
Pclosepolicy* = ptr Tclosepolicy
Pforms* = ptr Tforms
Pftpauth* = ptr Tftpauth
Pftpmethod* = ptr Tftpmethod
Pftpssl* = ptr Tftpssl
PHTTP_VERSION* = ptr THTTP_VERSION
Phttppost* = ptr Thttppost
PPcurl_httppost* = ptr Phttppost
Pinfotype* = ptr Tinfotype
Plock_access* = ptr Tlock_access
Plock_data* = ptr Tlock_data
Pmalloc_callback* = ptr tmalloc_callback
PNETRC_OPTION* = ptr TNETRC_OPTION
Pproxytype* = ptr Tproxytype
Prealloc_callback* = ptr trealloc_callback
Pslist* = ptr Tslist
Psocket* = ptr Tsocket
PSSL_VERSION* = ptr TSSL_VERSION
Pstrdup_callback* = ptr Tstrdup_callback
PTIMECOND* = ptr TTIMECOND
Pversion_info_data* = ptr Tversion_info_data
Pcode* = ptr Tcode
PFORMcode* = ptr TFORMcode
Pformoption* = ptr Tformoption
PINFO* = ptr TINFO
Piocmd* = ptr Tiocmd
Pioerr* = ptr Tioerr
PM* = ptr TM
PMcode* = ptr TMcode
PMoption* = ptr TMoption
PMSG* = ptr TMSG
Poption* = ptr Toption
PSH* = ptr TSH
PSHcode* = ptr TSHcode
PSHoption* = ptr TSHoption
Pversion* = ptr Tversion
Pfd_set* = pointer
PCurl* = ptr TCurl
TCurl* = pointer
Thttppost*{.final, pure.} = object
next*: Phttppost
name*: cstring
namelength*: int32
contents*: cstring
contentslength*: int32
buffer*: cstring
bufferlength*: int32
contenttype*: cstring
contentheader*: Pslist
more*: Phttppost
flags*: int32
showfilename*: cstring
Tprogress_callback* = proc (clientp: pointer, dltotal: float64,
dlnow: float64, ultotal: float64,
ulnow: float64): int32 {.cdecl.}
Twrite_callback* = proc (buffer: cstring, size: int, nitems: int,
outstream: pointer): int{.cdecl.}
Tread_callback* = proc (buffer: cstring, size: int, nitems: int,
instream: pointer): int{.cdecl.}
Tpasswd_callback* = proc (clientp: pointer, prompt: cstring, buffer: cstring,
buflen: int32): int32{.cdecl.}
Tioerr* = enum
IOE_OK, IOE_UNKNOWNCMD, IOE_FAILRESTART, IOE_LAST
Tiocmd* = enum
IOCMD_NOP, IOCMD_RESTARTREAD, IOCMD_LAST
Tioctl_callback* = proc (handle: PCurl, cmd: int32, clientp: pointer): Tioerr{.
cdecl.}
Tmalloc_callback* = proc (size: int): pointer{.cdecl.}
Tfree_callback* = proc (p: pointer){.cdecl.}
Trealloc_callback* = proc (p: pointer, size: int): pointer{.cdecl.}
Tstrdup_callback* = proc (str: cstring): cstring{.cdecl.}
Tcalloc_callback* = proc (nmemb: int, size: int): pointer
Tinfotype* = enum
INFO_TEXT = 0, INFO_HEADER_IN, INFO_HEADER_OUT, INFO_DATA_IN, INFO_DATA_OUT,
INFO_SSL_DATA_IN, INFO_SSL_DATA_OUT, INFO_END
Tdebug_callback* = proc (handle: PCurl, theType: Tinfotype, data: cstring,
size: int, userptr: pointer): int32{.cdecl.}
Tcode* = enum
E_OK = 0, E_UNSUPPORTED_PROTOCOL, E_FAILED_INIT, E_URL_MALFORMAT,
E_URL_MALFORMAT_USER, E_COULDNT_RESOLVE_PROXY, E_COULDNT_RESOLVE_HOST,
E_COULDNT_CONNECT, E_FTP_WEIRD_SERVER_REPLY, E_FTP_ACCESS_DENIED,
E_FTP_USER_PASSWORD_INCORRECT, E_FTP_WEIRD_PASS_REPLY,
E_FTP_WEIRD_USER_REPLY, E_FTP_WEIRD_PASV_REPLY, E_FTP_WEIRD_227_FORMAT,
E_FTP_CANT_GET_HOST, E_FTP_CANT_RECONNECT, E_FTP_COULDNT_SET_BINARY,
E_PARTIAL_FILE, E_FTP_COULDNT_RETR_FILE, E_FTP_WRITE_ERROR,
E_FTP_QUOTE_ERROR, E_HTTP_RETURNED_ERROR, E_WRITE_ERROR, E_MALFORMAT_USER,
E_FTP_COULDNT_STOR_FILE, E_READ_ERROR, E_OUT_OF_MEMORY,
E_OPERATION_TIMEOUTED, E_FTP_COULDNT_SET_ASCII, E_FTP_PORT_FAILED,
E_FTP_COULDNT_USE_REST, E_FTP_COULDNT_GET_SIZE, E_HTTP_RANGE_ERROR,
E_HTTP_POST_ERROR, E_SSL_CONNECT_ERROR, E_BAD_DOWNLOAD_RESUME,
E_FILE_COULDNT_READ_FILE, E_LDAP_CANNOT_BIND, E_LDAP_SEARCH_FAILED,
E_LIBRARY_NOT_FOUND, E_FUNCTION_NOT_FOUND, E_ABORTED_BY_CALLBACK,
E_BAD_FUNCTION_ARGUMENT, E_BAD_CALLING_ORDER, E_INTERFACE_FAILED,
E_BAD_PASSWORD_ENTERED, E_TOO_MANY_REDIRECTS, E_UNKNOWN_TELNET_OPTION,
E_TELNET_OPTION_SYNTAX, E_OBSOLETE, E_SSL_PEER_CERTIFICATE, E_GOT_NOTHING,
E_SSL_ENGINE_NOTFOUND, E_SSL_ENGINE_SETFAILED, E_SEND_ERROR, E_RECV_ERROR,
E_SHARE_IN_USE, E_SSL_CERTPROBLEM, E_SSL_CIPHER, E_SSL_CACERT,
E_BAD_CONTENT_ENCODING, E_LDAP_INVALID_URL, E_FILESIZE_EXCEEDED,
E_FTP_SSL_FAILED, E_SEND_FAIL_REWIND, E_SSL_ENGINE_INITFAILED,
E_LOGIN_DENIED, E_TFTP_NOTFOUND, E_TFTP_PERM, E_TFTP_DISKFULL,
E_TFTP_ILLEGAL, E_TFTP_UNKNOWNID, E_TFTP_EXISTS, E_TFTP_NOSUCHUSER,
E_CONV_FAILED, E_CONV_REQD, LAST
Tconv_callback* = proc (buffer: cstring, len: int): Tcode{.cdecl.}
Tssl_ctx_callback* = proc (curl: PCurl, ssl_ctx, userptr: pointer): Tcode{.cdecl.}
Tproxytype* = enum
PROXY_HTTP = 0, PROXY_SOCKS4 = 4, PROXY_SOCKS5 = 5
Tftpssl* = enum
FTPSSL_NONE, FTPSSL_TRY, FTPSSL_CONTROL, FTPSSL_ALL, FTPSSL_LAST
Tftpauth* = enum
FTPAUTH_DEFAULT, FTPAUTH_SSL, FTPAUTH_TLS, FTPAUTH_LAST
Tftpmethod* = enum
FTPMETHOD_DEFAULT, FTPMETHOD_MULTICWD, FTPMETHOD_NOCWD, FTPMETHOD_SINGLECWD,
FTPMETHOD_LAST
Toption* = enum
OPT_PORT = 0 + 3, OPT_TIMEOUT = 0 + 13, OPT_INFILESIZE = 0 + 14,
OPT_LOW_SPEED_LIMIT = 0 + 19, OPT_LOW_SPEED_TIME = 0 + 20,
OPT_RESUME_FROM = 0 + 21, OPT_CRLF = 0 + 27, OPT_SSLVERSION = 0 + 32,
OPT_TIMECONDITION = 0 + 33, OPT_TIMEVALUE = 0 + 34, OPT_VERBOSE = 0 + 41,
OPT_HEADER = 0 + 42, OPT_NOPROGRESS = 0 + 43, OPT_NOBODY = 0 + 44,
OPT_FAILONERROR = 0 + 45, OPT_UPLOAD = 0 + 46, OPT_POST = 0 + 47,
OPT_FTPLISTONLY = 0 + 48, OPT_FTPAPPEND = 0 + 50, OPT_NETRC = 0 + 51,
OPT_FOLLOWLOCATION = 0 + 52, OPT_TRANSFERTEXT = 0 + 53, OPT_PUT = 0 + 54,
OPT_AUTOREFERER = 0 + 58, OPT_PROXYPORT = 0 + 59,
OPT_POSTFIELDSIZE = 0 + 60, OPT_HTTPPROXYTUNNEL = 0 + 61,
OPT_SSL_VERIFYPEER = 0 + 64, OPT_MAXREDIRS = 0 + 68, OPT_FILETIME = 0 + 69,
OPT_MAXCONNECTS = 0 + 71, OPT_CLOSEPOLICY = 0 + 72,
OPT_FRESH_CONNECT = 0 + 74, OPT_FORBID_REUSE = 0 + 75,
OPT_CONNECTTIMEOUT = 0 + 78, OPT_HTTPGET = 0 + 80,
OPT_SSL_VERIFYHOST = 0 + 81, OPT_HTTP_VERSION = 0 + 84,
OPT_FTP_USE_EPSV = 0 + 85, OPT_SSLENGINE_DEFAULT = 0 + 90,
OPT_DNS_USE_GLOBAL_CACHE = 0 + 91, OPT_DNS_CACHE_TIMEOUT = 0 + 92,
OPT_COOKIESESSION = 0 + 96, OPT_BUFFERSIZE = 0 + 98, OPT_NOSIGNAL = 0 + 99,
OPT_PROXYTYPE = 0 + 101, OPT_UNRESTRICTED_AUTH = 0 + 105,
OPT_FTP_USE_EPRT = 0 + 106, OPT_HTTPAUTH = 0 + 107,
OPT_FTP_CREATE_MISSING_DIRS = 0 + 110, OPT_PROXYAUTH = 0 + 111,
OPT_FTP_RESPONSE_TIMEOUT = 0 + 112, OPT_IPRESOLVE = 0 + 113,
OPT_MAXFILESIZE = 0 + 114, OPT_FTP_SSL = 0 + 119, OPT_TCP_NODELAY = 0 + 121,
OPT_FTPSSLAUTH = 0 + 129, OPT_IGNORE_CONTENT_LENGTH = 0 + 136,
OPT_FTP_SKIP_PASV_IP = 0 + 137, OPT_FTP_FILEMETHOD = 0 + 138,
OPT_LOCALPORT = 0 + 139, OPT_LOCALPORTRANGE = 0 + 140,
OPT_CONNECT_ONLY = 0 + 141, OPT_FILE = 10000 + 1, OPT_URL = 10000 + 2,
OPT_PROXY = 10000 + 4, OPT_USERPWD = 10000 + 5,
OPT_PROXYUSERPWD = 10000 + 6, OPT_RANGE = 10000 + 7, OPT_INFILE = 10000 + 9,
OPT_ERRORBUFFER = 10000 + 10, OPT_POSTFIELDS = 10000 + 15,
OPT_REFERER = 10000 + 16, OPT_FTPPORT = 10000 + 17,
OPT_USERAGENT = 10000 + 18, OPT_COOKIE = 10000 + 22,
OPT_HTTPHEADER = 10000 + 23, OPT_HTTPPOST = 10000 + 24,
OPT_SSLCERT = 10000 + 25, OPT_SSLCERTPASSWD = 10000 + 26,
OPT_QUOTE = 10000 + 28, OPT_WRITEHEADER = 10000 + 29,
OPT_COOKIEFILE = 10000 + 31, OPT_CUSTOMREQUEST = 10000 + 36,
OPT_STDERR = 10000 + 37, OPT_POSTQUOTE = 10000 + 39,
OPT_WRITEINFO = 10000 + 40, OPT_PROGRESSDATA = 10000 + 57,
OPT_INTERFACE = 10000 + 62, OPT_KRB4LEVEL = 10000 + 63,
OPT_CAINFO = 10000 + 65, OPT_TELNETOPTIONS = 10000 + 70,
OPT_RANDOM_FILE = 10000 + 76, OPT_EGDSOCKET = 10000 + 77,
OPT_COOKIEJAR = 10000 + 82, OPT_SSL_CIPHER_LIST = 10000 + 83,
OPT_SSLCERTTYPE = 10000 + 86, OPT_SSLKEY = 10000 + 87,
OPT_SSLKEYTYPE = 10000 + 88, OPT_SSLENGINE = 10000 + 89,
OPT_PREQUOTE = 10000 + 93, OPT_DEBUGDATA = 10000 + 95,
OPT_CAPATH = 10000 + 97, OPT_SHARE = 10000 + 100,
OPT_ENCODING = 10000 + 102, OPT_PRIVATE = 10000 + 103,
OPT_HTTP200ALIASES = 10000 + 104, OPT_SSL_CTX_DATA = 10000 + 109,
OPT_NETRC_FILE = 10000 + 118, OPT_SOURCE_USERPWD = 10000 + 123,
OPT_SOURCE_PREQUOTE = 10000 + 127, OPT_SOURCE_POSTQUOTE = 10000 + 128,
OPT_IOCTLDATA = 10000 + 131, OPT_SOURCE_URL = 10000 + 132,
OPT_SOURCE_QUOTE = 10000 + 133, OPT_FTP_ACCOUNT = 10000 + 134,
OPT_COOKIELIST = 10000 + 135, OPT_FTP_ALTERNATIVE_TO_USER = 10000 + 147,
OPT_LASTENTRY = 10000 + 148, OPT_WRITEFUNCTION = 20000 + 11,
OPT_READFUNCTION = 20000 + 12, OPT_PROGRESSFUNCTION = 20000 + 56,
OPT_HEADERFUNCTION = 20000 + 79, OPT_DEBUGFUNCTION = 20000 + 94,
OPT_SSL_CTX_FUNCTION = 20000 + 108, OPT_IOCTLFUNCTION = 20000 + 130,
OPT_CONV_FROM_NETWORK_FUNCTION = 20000 + 142,
OPT_CONV_TO_NETWORK_FUNCTION = 20000 + 143,
OPT_CONV_FROM_UTF8_FUNCTION = 20000 + 144,
OPT_INFILESIZE_LARGE = 30000 + 115, OPT_RESUME_FROM_LARGE = 30000 + 116,
OPT_MAXFILESIZE_LARGE = 30000 + 117, OPT_POSTFIELDSIZE_LARGE = 30000 + 120,
OPT_MAX_SEND_SPEED_LARGE = 30000 + 145,
OPT_MAX_RECV_SPEED_LARGE = 30000 + 146
THTTP_VERSION* = enum
HTTP_VERSION_NONE, HTTP_VERSION_1_0, HTTP_VERSION_1_1, HTTP_VERSION_LAST
TNETRC_OPTION* = enum
NETRC_IGNORED, NETRC_OPTIONAL, NETRC_REQUIRED, NETRC_LAST
TSSL_VERSION* = enum
SSLVERSION_DEFAULT, SSLVERSION_TLSv1, SSLVERSION_SSLv2, SSLVERSION_SSLv3,
SSLVERSION_LAST
TTIMECOND* = enum
TIMECOND_NONE, TIMECOND_IFMODSINCE, TIMECOND_IFUNMODSINCE, TIMECOND_LASTMOD,
TIMECOND_LAST
Tformoption* = enum
FORM_NOTHING, FORM_COPYNAME, FORM_PTRNAME, FORM_NAMELENGTH,
FORM_COPYCONTENTS, FORM_PTRCONTENTS, FORM_CONTENTSLENGTH, FORM_FILECONTENT,
FORM_ARRAY, FORM_OBSOLETE, FORM_FILE, FORM_BUFFER, FORM_BUFFERPTR,
FORM_BUFFERLENGTH, FORM_CONTENTTYPE, FORM_CONTENTHEADER, FORM_FILENAME,
FORM_END, FORM_OBSOLETE2, FORM_LASTENTRY
Tforms*{.pure, final.} = object
option*: Tformoption
value*: cstring
TFORMcode* = enum
FORMADD_OK, FORMADD_MEMORY, FORMADD_OPTION_TWICE, FORMADD_NULL,
FORMADD_UNKNOWN_OPTION, FORMADD_INCOMPLETE, FORMADD_ILLEGAL_ARRAY,
FORMADD_DISABLED, FORMADD_LAST
Tformget_callback* = proc (arg: pointer, buf: cstring, length: int): int{.
cdecl.}
Tslist*{.pure, final.} = object
data*: cstring
next*: Pslist
TINFO* = enum
INFO_NONE = 0, INFO_LASTONE = 30, INFO_EFFECTIVE_URL = 0x00100000 + 1,
INFO_CONTENT_TYPE = 0x00100000 + 18, INFO_PRIVATE = 0x00100000 + 21,
INFO_FTP_ENTRY_PATH = 0x00100000 + 30, INFO_RESPONSE_CODE = 0x00200000 + 2,
INFO_HEADER_SIZE = 0x00200000 + 11, INFO_REQUEST_SIZE = 0x00200000 + 12,
INFO_SSL_VERIFYRESULT = 0x00200000 + 13, INFO_FILETIME = 0x00200000 + 14,
INFO_REDIRECT_COUNT = 0x00200000 + 20,
INFO_HTTP_CONNECTCODE = 0x00200000 + 22,
INFO_HTTPAUTH_AVAIL = 0x00200000 + 23,
INFO_PROXYAUTH_AVAIL = 0x00200000 + 24, INFO_OS_ERRNO = 0x00200000 + 25,
INFO_NUM_CONNECTS = 0x00200000 + 26, INFO_LASTSOCKET = 0x00200000 + 29,
INFO_TOTAL_TIME = 0x00300000 + 3, INFO_NAMELOOKUP_TIME = 0x00300000 + 4,
INFO_CONNECT_TIME = 0x00300000 + 5, INFO_PRETRANSFER_TIME = 0x00300000 + 6,
INFO_SIZE_UPLOAD = 0x00300000 + 7, INFO_SIZE_DOWNLOAD = 0x00300000 + 8,
INFO_SPEED_DOWNLOAD = 0x00300000 + 9, INFO_SPEED_UPLOAD = 0x00300000 + 10,
INFO_CONTENT_LENGTH_DOWNLOAD = 0x00300000 + 15,
INFO_CONTENT_LENGTH_UPLOAD = 0x00300000 + 16,
INFO_STARTTRANSFER_TIME = 0x00300000 + 17,
INFO_REDIRECT_TIME = 0x00300000 + 19, INFO_SSL_ENGINES = 0x00400000 + 27,
INFO_COOKIELIST = 0x00400000 + 28
Tclosepolicy* = enum
CLOSEPOLICY_NONE, CLOSEPOLICY_OLDEST, CLOSEPOLICY_LEAST_RECENTLY_USED,
CLOSEPOLICY_LEAST_TRAFFIC, CLOSEPOLICY_SLOWEST, CLOSEPOLICY_CALLBACK,
CLOSEPOLICY_LAST
Tlock_data* = enum
LOCK_DATA_NONE = 0, LOCK_DATA_SHARE, LOCK_DATA_COOKIE, LOCK_DATA_DNS,
LOCK_DATA_SSL_SESSION, LOCK_DATA_CONNECT, LOCK_DATA_LAST
Tlock_access* = enum
LOCK_ACCESS_NONE = 0, LOCK_ACCESS_SHARED = 1, LOCK_ACCESS_SINGLE = 2,
LOCK_ACCESS_LAST
Tlock_function* = proc (handle: PCurl, data: Tlock_data,
locktype: Tlock_access,
userptr: pointer){.cdecl.}
Tunlock_function* = proc (handle: PCurl, data: Tlock_data, userptr: pointer){.
cdecl.}
TSH* = pointer
TSHcode* = enum
SHE_OK, SHE_BAD_OPTION, SHE_IN_USE, SHE_INVALID, SHE_NOMEM, SHE_LAST
TSHoption* = enum
SHOPT_NONE, SHOPT_SHARE, SHOPT_UNSHARE, SHOPT_LOCKFUNC, SHOPT_UNLOCKFUNC,
SHOPT_USERDATA, SHOPT_LAST
Tversion* = enum
VERSION_FIRST, VERSION_SECOND, VERSION_THIRD, VERSION_LAST
Tversion_info_data*{.pure, final.} = object
age*: Tversion
version*: cstring
version_num*: int32
host*: cstring
features*: int32
ssl_version*: cstring
ssl_version_num*: int32
libz_version*: cstring
protocols*: cstringArray
ares*: cstring
ares_num*: int32
libidn*: cstring
iconv_ver_num*: int32
TM* = pointer
Tsocket* = int32
TMcode* = enum
M_CALL_MULTI_PERFORM = - 1, M_OK = 0, M_BAD_HANDLE, M_BAD_EASY_HANDLE,
M_OUT_OF_MEMORY, M_INTERNAL_ERROR, M_BAD_SOCKET, M_UNKNOWN_OPTION, M_LAST
TMSGEnum* = enum
MSG_NONE, MSG_DONE, MSG_LAST
TMsg*{.pure, final.} = object
msg*: TMSGEnum
easy_handle*: PCurl
whatever*: Pointer #data : record
# case longint of
# 0 : ( whatever : pointer );
# 1 : ( result : CURLcode );
# end;
Tsocket_callback* = proc (easy: PCurl, s: Tsocket, what: int32,
userp, socketp: pointer): int32{.cdecl.}
TMoption* = enum
MOPT_SOCKETDATA = 10000 + 2, MOPT_LASTENTRY = 10000 + 3,
MOPT_SOCKETFUNCTION = 20000 + 1
const
OPT_SSLKEYPASSWD* = OPT_SSLCERTPASSWD
AUTH_ANY* = not (0)
AUTH_BASIC* = 1 shl 0
AUTH_ANYSAFE* = not (AUTH_BASIC)
AUTH_DIGEST* = 1 shl 1
AUTH_GSSNEGOTIATE* = 1 shl 2
AUTH_NONE* = 0
AUTH_NTLM* = 1 shl 3
E_ALREADY_COMPLETE* = 99999
E_FTP_BAD_DOWNLOAD_RESUME* = E_BAD_DOWNLOAD_RESUME
E_FTP_PARTIAL_FILE* = E_PARTIAL_FILE
E_HTTP_NOT_FOUND* = E_HTTP_RETURNED_ERROR
E_HTTP_PORT_FAILED* = E_INTERFACE_FAILED
E_OPERATION_TIMEDOUT* = E_OPERATION_TIMEOUTED
ERROR_SIZE* = 256
FORMAT_OFF_T* = "%ld"
GLOBAL_NOTHING* = 0
GLOBAL_SSL* = 1 shl 0
GLOBAL_WIN32* = 1 shl 1
GLOBAL_ALL* = GLOBAL_SSL or GLOBAL_WIN32
GLOBAL_DEFAULT* = GLOBAL_ALL
INFO_DOUBLE* = 0x00300000
INFO_HTTP_CODE* = INFO_RESPONSE_CODE
INFO_LONG* = 0x00200000
INFO_MASK* = 0x000FFFFF
INFO_SLIST* = 0x00400000
INFO_STRING* = 0x00100000
INFO_TYPEMASK* = 0x00F00000
IPRESOLVE_V4* = 1
IPRESOLVE_V6* = 2
IPRESOLVE_WHATEVER* = 0
MAX_WRITE_SIZE* = 16384
M_CALL_MULTI_SOCKET* = M_CALL_MULTI_PERFORM
OPT_CLOSEFUNCTION* = - (5)
OPT_FTPASCII* = OPT_TRANSFERTEXT
OPT_HEADERDATA* = OPT_WRITEHEADER
OPT_HTTPREQUEST* = - (1)
OPT_MUTE* = - (2)
OPT_PASSWDDATA* = - (4)
OPT_PASSWDFUNCTION* = - (3)
OPT_PASV_HOST* = - (9)
OPT_READDATA* = OPT_INFILE
OPT_SOURCE_HOST* = - (6)
OPT_SOURCE_PATH* = - (7)
OPT_SOURCE_PORT* = - (8)
OPTTYPE_FUNCTIONPOINT* = 20000
OPTTYPE_LONG* = 0
OPTTYPE_OBJECTPOINT* = 10000
OPTTYPE_OFF_T* = 30000
OPT_WRITEDATA* = OPT_FILE
POLL_IN* = 1
POLL_INOUT* = 3
POLL_NONE* = 0
POLL_OUT* = 2
POLL_REMOVE* = 4
READFUNC_ABORT* = 0x10000000
SOCKET_BAD* = - (1)
SOCKET_TIMEOUT* = SOCKET_BAD
VERSION_ASYNCHDNS* = 1 shl 7
VERSION_CONV* = 1 shl 12
VERSION_DEBUG* = 1 shl 6
VERSION_GSSNEGOTIATE* = 1 shl 5
VERSION_IDN* = 1 shl 10
VERSION_IPV6* = 1 shl 0
VERSION_KERBEROS4* = 1 shl 1
VERSION_LARGEFILE* = 1 shl 9
VERSION_LIBZ* = 1 shl 3
VERSION_NOW* = VERSION_THIRD
VERSION_NTLM* = 1 shl 4
VERSION_SPNEGO* = 1 shl 8
VERSION_SSL* = 1 shl 2
VERSION_SSPI* = 1 shl 11
FILE_OFFSET_BITS* = 0
FILESIZEBITS* = 0
FUNCTIONPOINT* = OPTTYPE_FUNCTIONPOINT
HTTPPOST_BUFFER* = 1 shl 4
HTTPPOST_FILENAME* = 1 shl 0
HTTPPOST_PTRBUFFER* = 1 shl 5
HTTPPOST_PTRCONTENTS* = 1 shl 3
HTTPPOST_PTRNAME* = 1 shl 2
HTTPPOST_READFILE* = 1 shl 1
LIBCURL_VERSION* = "7.15.5"
LIBCURL_VERSION_MAJOR* = 7
LIBCURL_VERSION_MINOR* = 15
LIBCURL_VERSION_NUM* = 0x00070F05
LIBCURL_VERSION_PATCH* = 5
proc strequal*(s1, s2: cstring): int32{.cdecl, dynlib: libname,
importc: "curl_strequal".}
proc strnequal*(s1, s2: cstring, n: int): int32{.cdecl, dynlib: libname,
importc: "curl_strnequal".}
proc formadd*(httppost, last_post: PPcurl_httppost): TFORMcode{.cdecl, varargs,
dynlib: libname, importc: "curl_formadd".}
proc formget*(form: Phttppost, arg: pointer, append: Tformget_callback): int32{.
cdecl, dynlib: libname, importc: "curl_formget".}
proc formfree*(form: Phttppost){.cdecl, dynlib: libname,
importc: "curl_formfree".}
proc getenv*(variable: cstring): cstring{.cdecl, dynlib: libname,
importc: "curl_getenv".}
proc version*(): cstring{.cdecl, dynlib: libname, importc: "curl_version".}
proc easy_escape*(handle: PCurl, str: cstring, len: int32): cstring{.cdecl,
dynlib: libname, importc: "curl_easy_escape".}
proc escape*(str: cstring, len: int32): cstring{.cdecl, dynlib: libname,
importc: "curl_escape".}
proc easy_unescape*(handle: PCurl, str: cstring, len: int32, outlength: var int32): cstring{.
cdecl, dynlib: libname, importc: "curl_easy_unescape".}
proc unescape*(str: cstring, len: int32): cstring{.cdecl, dynlib: libname,
importc: "curl_unescape".}
proc free*(p: pointer){.cdecl, dynlib: libname, importc: "curl_free".}
proc global_init*(flags: int32): Tcode{.cdecl, dynlib: libname,
importc: "curl_global_init".}
proc global_init_mem*(flags: int32, m: Tmalloc_callback, f: Tfree_callback,
r: Trealloc_callback, s: Tstrdup_callback,
c: Tcalloc_callback): Tcode{.cdecl, dynlib: libname,
importc: "curl_global_init_mem".}
proc global_cleanup*(){.cdecl, dynlib: libname, importc: "curl_global_cleanup".}
proc slist_append*(slist: Pslist, p: cstring): Pslist{.cdecl, dynlib: libname,
importc: "curl_slist_append".}
proc slist_free_all*(para1: Pslist){.cdecl, dynlib: libname,
importc: "curl_slist_free_all".}
proc getdate*(p: cstring, unused: ptr TTime): TTime{.cdecl, dynlib: libname,
importc: "curl_getdate".}
proc share_init*(): PSH{.cdecl, dynlib: libname, importc: "curl_share_init".}
proc share_setopt*(para1: PSH, option: TSHoption): TSHcode{.cdecl, varargs,
dynlib: libname, importc: "curl_share_setopt".}
proc share_cleanup*(para1: PSH): TSHcode{.cdecl, dynlib: libname,
importc: "curl_share_cleanup".}
proc version_info*(para1: Tversion): Pversion_info_data{.cdecl, dynlib: libname,
importc: "curl_version_info".}
proc easy_strerror*(para1: Tcode): cstring{.cdecl, dynlib: libname,
importc: "curl_easy_strerror".}
proc share_strerror*(para1: TSHcode): cstring{.cdecl, dynlib: libname,
importc: "curl_share_strerror".}
proc easy_init*(): PCurl{.cdecl, dynlib: libname, importc: "curl_easy_init".}
proc easy_setopt*(curl: PCurl, option: Toption): Tcode{.cdecl, varargs, dynlib: libname,
importc: "curl_easy_setopt".}
proc easy_perform*(curl: PCurl): Tcode{.cdecl, dynlib: libname,
importc: "curl_easy_perform".}
proc easy_cleanup*(curl: PCurl){.cdecl, dynlib: libname, importc: "curl_easy_cleanup".}
proc easy_getinfo*(curl: PCurl, info: TINFO): Tcode{.cdecl, varargs, dynlib: libname,
importc: "curl_easy_getinfo".}
proc easy_duphandle*(curl: PCurl): PCurl{.cdecl, dynlib: libname,
importc: "curl_easy_duphandle".}
proc easy_reset*(curl: PCurl){.cdecl, dynlib: libname, importc: "curl_easy_reset".}
proc multi_init*(): PM{.cdecl, dynlib: libname, importc: "curl_multi_init".}
proc multi_add_handle*(multi_handle: PM, handle: PCurl): TMcode{.cdecl,
dynlib: libname, importc: "curl_multi_add_handle".}
proc multi_remove_handle*(multi_handle: PM, handle: PCurl): TMcode{.cdecl,
dynlib: libname, importc: "curl_multi_remove_handle".}
proc multi_fdset*(multi_handle: PM, read_fd_set: Pfd_set, write_fd_set: Pfd_set,
exc_fd_set: Pfd_set, max_fd: var int32): TMcode{.cdecl,
dynlib: libname, importc: "curl_multi_fdset".}
proc multi_perform*(multi_handle: PM, running_handles: var int32): TMcode{.
cdecl, dynlib: libname, importc: "curl_multi_perform".}
proc multi_cleanup*(multi_handle: PM): TMcode{.cdecl, dynlib: libname,
importc: "curl_multi_cleanup".}
proc multi_info_read*(multi_handle: PM, msgs_in_queue: var int32): PMsg{.cdecl,
dynlib: libname, importc: "curl_multi_info_read".}
proc multi_strerror*(para1: TMcode): cstring{.cdecl, dynlib: libname,
importc: "curl_multi_strerror".}
proc multi_socket*(multi_handle: PM, s: Tsocket, running_handles: var int32): TMcode{.
cdecl, dynlib: libname, importc: "curl_multi_socket".}
proc multi_socket_all*(multi_handle: PM, running_handles: var int32): TMcode{.
cdecl, dynlib: libname, importc: "curl_multi_socket_all".}
proc multi_timeout*(multi_handle: PM, milliseconds: var int32): TMcode{.cdecl,
dynlib: libname, importc: "curl_multi_timeout".}
proc multi_setopt*(multi_handle: PM, option: TMoption): TMcode{.cdecl, varargs,
dynlib: libname, importc: "curl_multi_setopt".}
proc multi_assign*(multi_handle: PM, sockfd: Tsocket, sockp: pointer): TMcode{.
cdecl, dynlib: libname, importc: "curl_multi_assign".}

View File

@@ -1,225 +0,0 @@
#*****************************************************************************
# * *
# * File: lauxlib.pas *
# * Authors: TeCGraf (C headers + actual Lua libraries) *
# * Lavergne Thomas (original translation to Pascal) *
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
# * Description: Lua auxiliary library *
# * *
# *****************************************************************************
#
#** $Id: lauxlib.h,v 1.59 2003/03/18 12:25:32 roberto Exp $
#** Auxiliary functions for building Lua libraries
#** See Copyright Notice in lua.h
#
#
#** Translated to pascal by Lavergne Thomas
#** Notes :
#** - Pointers type was prefixed with 'P'
#** Bug reports :
#** - thomas.lavergne@laposte.net
#** In french or in english
#
import
lua
proc pushstring*(L: PState, s: string)
# compatibilty macros
proc getn*(L: PState, n: int): int
# calls lua_objlen
proc setn*(L: PState, t, n: int)
# does nothing!
type
Treg*{.final.} = object
name*: cstring
func*: CFunction
Preg* = ptr Treg
proc openlib*(L: PState, libname: cstring, lr: Preg, nup: int){.cdecl,
dynlib: lua.LIB_NAME, importc: "luaL_openlib".}
proc register*(L: PState, libname: cstring, lr: Preg){.cdecl,
dynlib: lua.LIB_NAME, importc: "luaL_register".}
proc getmetafield*(L: PState, obj: int, e: cstring): int{.cdecl,
dynlib: lua.LIB_NAME, importc: "luaL_getmetafield".}
proc callmeta*(L: PState, obj: int, e: cstring): int{.cdecl,
dynlib: LIB_NAME, importc: "luaL_callmeta".}
proc typerror*(L: PState, narg: int, tname: cstring): int{.cdecl,
dynlib: LIB_NAME, importc: "luaL_typerror".}
proc argerror*(L: PState, numarg: int, extramsg: cstring): int{.cdecl,
dynlib: LIB_NAME, importc: "luaL_argerror".}
proc checklstring*(L: PState, numArg: int, len: ptr int): cstring{.cdecl,
dynlib: LIB_NAME, importc: "luaL_checklstring".}
proc optlstring*(L: PState, numArg: int, def: cstring, len: ptr int): cstring{.
cdecl, dynlib: LIB_NAME, importc: "luaL_optlstring".}
proc checknumber*(L: PState, numArg: int): Number{.cdecl,
dynlib: LIB_NAME, importc: "luaL_checknumber".}
proc optnumber*(L: PState, nArg: int, def: Number): Number{.cdecl,
dynlib: LIB_NAME, importc: "luaL_optnumber".}
proc checkinteger*(L: PState, numArg: int): Integer{.cdecl,
dynlib: LIB_NAME, importc: "luaL_checkinteger".}
proc optinteger*(L: PState, nArg: int, def: Integer): Integer{.
cdecl, dynlib: LIB_NAME, importc: "luaL_optinteger".}
proc checkstack*(L: PState, sz: int, msg: cstring){.cdecl,
dynlib: LIB_NAME, importc: "luaL_checkstack".}
proc checktype*(L: PState, narg, t: int){.cdecl, dynlib: LIB_NAME,
importc: "luaL_checktype".}
proc checkany*(L: PState, narg: int){.cdecl, dynlib: LIB_NAME,
importc: "luaL_checkany".}
proc newmetatable*(L: PState, tname: cstring): int{.cdecl,
dynlib: LIB_NAME, importc: "luaL_newmetatable".}
proc checkudata*(L: PState, ud: int, tname: cstring): Pointer{.cdecl,
dynlib: LIB_NAME, importc: "luaL_checkudata".}
proc where*(L: PState, lvl: int){.cdecl, dynlib: LIB_NAME,
importc: "luaL_where".}
proc error*(L: PState, fmt: cstring): int{.cdecl, varargs,
dynlib: LIB_NAME, importc: "luaL_error".}
proc checkoption*(L: PState, narg: int, def: cstring, lst: cstringArray): int{.
cdecl, dynlib: LIB_NAME, importc: "luaL_checkoption".}
proc reference*(L: PState, t: int): int{.cdecl, dynlib: LIB_NAME,
importc: "luaL_ref".}
proc unref*(L: PState, t, theref: int){.cdecl, dynlib: LIB_NAME,
importc: "luaL_unref".}
proc loadfile*(L: PState, filename: cstring): int{.cdecl,
dynlib: LIB_NAME, importc: "luaL_loadfile".}
proc loadbuffer*(L: PState, buff: cstring, size: int, name: cstring): int{.
cdecl, dynlib: LIB_NAME, importc: "luaL_loadbuffer".}
proc loadstring*(L: PState, s: cstring): int{.cdecl, dynlib: LIB_NAME,
importc: "luaL_loadstring".}
proc newstate*(): PState{.cdecl, dynlib: LIB_NAME,
importc: "luaL_newstate".}
proc open*(): PState
# compatibility; moved from unit lua to lauxlib because it needs luaL_newstate
#
#** ===============================================================
#** some useful macros
#** ===============================================================
#
proc argcheck*(L: PState, cond: bool, numarg: int, extramsg: cstring)
proc checkstring*(L: PState, n: int): cstring
proc optstring*(L: PState, n: int, d: cstring): cstring
proc checkint*(L: PState, n: int): int
proc checklong*(L: PState, n: int): int32
proc optint*(L: PState, n: int, d: float64): int
proc optlong*(L: PState, n: int, d: float64): int32
proc dofile*(L: PState, filename: cstring): int
proc dostring*(L: PState, str: cstring): int
proc getmetatable*(L: PState, tname: cstring)
# not translated:
# #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
#
#** =======================================================
#** Generic Buffer manipulation
#** =======================================================
#
const # note: this is just arbitrary, as it related to the BUFSIZ defined in stdio.h ...
BUFFERSIZE* = 4096
type
Buffer*{.final.} = object
p*: cstring # current position in buffer
lvl*: int # number of strings in the stack (level)
L*: PState
buffer*: array[0..BUFFERSIZE - 1, Char] # warning: see note above about LUAL_BUFFERSIZE
PBuffer* = ptr Buffer
proc addchar*(B: PBuffer, c: Char)
# warning: see note above about LUAL_BUFFERSIZE
# compatibility only (alias for luaL_addchar)
proc putchar*(B: PBuffer, c: Char)
# warning: see note above about LUAL_BUFFERSIZE
proc addsize*(B: PBuffer, n: int)
proc buffinit*(L: PState, B: PBuffer){.cdecl, dynlib: LIB_NAME,
importc: "luaL_buffinit".}
proc prepbuffer*(B: PBuffer): cstring{.cdecl, dynlib: LIB_NAME,
importc: "luaL_prepbuffer".}
proc addlstring*(B: PBuffer, s: cstring, L: int){.cdecl,
dynlib: LIB_NAME, importc: "luaL_addlstring".}
proc addstring*(B: PBuffer, s: cstring){.cdecl, dynlib: LIB_NAME,
importc: "luaL_addstring".}
proc addvalue*(B: PBuffer){.cdecl, dynlib: LIB_NAME,
importc: "luaL_addvalue".}
proc pushresult*(B: PBuffer){.cdecl, dynlib: LIB_NAME,
importc: "luaL_pushresult".}
proc gsub*(L: PState, s, p, r: cstring): cstring{.cdecl,
dynlib: LIB_NAME, importc: "luaL_gsub".}
proc findtable*(L: PState, idx: int, fname: cstring, szhint: int): cstring{.
cdecl, dynlib: LIB_NAME, importc: "luaL_findtable".}
# compatibility with ref system
# pre-defined references
const
NOREF* = - 2
REFNIL* = - 1
proc unref*(L: PState, theref: int)
proc getref*(L: PState, theref: int)
#
#** Compatibility macros and functions
#
# implementation
proc pushstring(L: PState, s: string) =
pushlstring(L, cstring(s), len(s))
proc getn(L: PState, n: int): int =
Result = objlen(L, n)
proc setn(L: PState, t, n: int) =
# does nothing as this operation is deprecated
nil
proc open(): PState =
Result = newstate()
proc dofile(L: PState, filename: cstring): int =
Result = loadfile(L, filename)
if Result == 0: Result = pcall(L, 0, MULTRET, 0)
proc dostring(L: PState, str: cstring): int =
Result = loadstring(L, str)
if Result == 0: Result = pcall(L, 0, MULTRET, 0)
proc getmetatable(L: PState, tname: cstring) =
getfield(L, REGISTRYINDEX, tname)
proc argcheck(L: PState, cond: bool, numarg: int, extramsg: cstring) =
if not cond:
discard argerror(L, numarg, extramsg)
proc checkstring(L: PState, n: int): cstring =
Result = checklstring(L, n, nil)
proc optstring(L: PState, n: int, d: cstring): cstring =
Result = optlstring(L, n, d, nil)
proc checkint(L: PState, n: int): int =
Result = toInt(checknumber(L, n))
proc checklong(L: PState, n: int): int32 =
Result = int32(ToInt(checknumber(L, n)))
proc optint(L: PState, n: int, d: float64): int =
Result = int(ToInt(optnumber(L, n, d)))
proc optlong(L: PState, n: int, d: float64): int32 =
Result = int32(ToInt(optnumber(L, n, d)))
proc addchar(B: PBuffer, c: Char) =
if cast[int](addr((B.p))) < (cast[int](addr((B.buffer[0]))) + BUFFERSIZE):
discard prepbuffer(B)
B.p[1] = c
B.p = cast[cstring](cast[int](B.p) + 1)
proc putchar(B: PBuffer, c: Char) =
addchar(B, c)
proc addsize(B: PBuffer, n: int) =
B.p = cast[cstring](cast[int](B.p) + n)
proc unref(L: PState, theref: int) =
unref(L, REGISTRYINDEX, theref)
proc getref(L: PState, theref: int) =
rawgeti(L, REGISTRYINDEX, theref)

View File

@@ -1,399 +0,0 @@
#*****************************************************************************
# * *
# * File: lua.pas *
# * Authors: TeCGraf (C headers + actual Lua libraries) *
# * Lavergne Thomas (original translation to Pascal) *
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
# * Description: Basic Lua library *
# * *
# *****************************************************************************
#
#** $Id: lua.h,v 1.175 2003/03/18 12:31:39 roberto Exp $
#** Lua - An Extensible Extension Language
#** TeCGraf: Computer Graphics Technology Group, PUC-Rio, Brazil
#** http://www.lua.org mailto:info@lua.org
#** See Copyright Notice at the end of this file
#
#
#** Updated to Lua 5.1.1 by Bram Kuijvenhoven (bram at kuijvenhoven dot net),
#** Hexis BV (http://www.hexis.nl), the Netherlands
#** Notes:
#** - Only tested with FPC (FreePascal Compiler)
#** - Using LuaBinaries styled DLL/SO names, which include version names
#** - LUA_YIELD was suffixed by '_' for avoiding name collision
#
#
#** Translated to pascal by Lavergne Thomas
#** Notes :
#** - Pointers type was prefixed with 'P'
#** - lua_upvalueindex constant was transformed to function
#** - Some compatibility function was isolated because with it you must have
#** lualib.
#** - LUA_VERSION was suffixed by '_' for avoiding name collision.
#** Bug reports :
#** - thomas.lavergne@laposte.net
#** In french or in english
#
when defined(MACOSX):
const
NAME* = "liblua(|5.2|5.1|5.0).dylib"
LIB_NAME* = "liblua(|5.2|5.1|5.0).dylib"
elif defined(UNIX):
const
NAME* = "liblua(|5.2|5.1|5.0).so(|.0)"
LIB_NAME* = "liblua(|5.2|5.1|5.0).so(|.0)"
else:
const
NAME* = "lua(|5.2|5.1|5.0).dll"
LIB_NAME* = "lua(|5.2|5.1|5.0).dll"
const
VERSION* = "Lua 5.1"
RELEASE* = "Lua 5.1.1"
VERSION_NUM* = 501
COPYRIGHT* = "Copyright (C) 1994-2006 Lua.org, PUC-Rio"
AUTHORS* = "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
# option for multiple returns in `lua_pcall' and `lua_call'
MULTRET* = - 1 #
#** pseudo-indices
#
REGISTRYINDEX* = - 10000
ENVIRONINDEX* = - 10001
GLOBALSINDEX* = - 10002
proc upvalueindex*(I: int): int
const # thread status; 0 is OK
constYIELD* = 1
ERRRUN* = 2
ERRSYNTAX* = 3
ERRMEM* = 4
ERRERR* = 5
type
PState* = Pointer
CFunction* = proc (L: PState): int{.cdecl.}
#
#** functions that read/write blocks when loading/dumping Lua chunks
#
type
Reader* = proc (L: PState, ud: Pointer, sz: ptr int): cstring{.cdecl.}
Writer* = proc (L: PState, p: Pointer, sz: int, ud: Pointer): int{.cdecl.}
Alloc* = proc (ud, theptr: Pointer, osize, nsize: int){.cdecl.}
const
TNONE* = - 1
TNIL* = 0
TBOOLEAN* = 1
TLIGHTUSERDATA* = 2
TNUMBER* = 3
TSTRING* = 4
TTABLE* = 5
TFUNCTION* = 6
TUSERDATA* = 7
TTHREAD* = 8 # minimum Lua stack available to a C function
MINSTACK* = 20
type # Type of Numbers in Lua
Number* = float
Integer* = int
proc newstate*(f: Alloc, ud: Pointer): PState{.cdecl, dynlib: NAME,
importc: "lua_newstate".}
proc close*(L: PState){.cdecl, dynlib: NAME, importc: "lua_close".}
proc newthread*(L: PState): PState{.cdecl, dynlib: NAME,
importc: "lua_newthread".}
proc atpanic*(L: PState, panicf: CFunction): CFunction{.cdecl, dynlib: NAME,
importc: "lua_atpanic".}
proc gettop*(L: PState): int{.cdecl, dynlib: NAME, importc: "lua_gettop".}
proc settop*(L: PState, idx: int){.cdecl, dynlib: NAME, importc: "lua_settop".}
proc pushvalue*(L: PState, Idx: int){.cdecl, dynlib: NAME,
importc: "lua_pushvalue".}
proc remove*(L: PState, idx: int){.cdecl, dynlib: NAME, importc: "lua_remove".}
proc insert*(L: PState, idx: int){.cdecl, dynlib: NAME, importc: "lua_insert".}
proc replace*(L: PState, idx: int){.cdecl, dynlib: NAME, importc: "lua_replace".}
proc checkstack*(L: PState, sz: int): cint{.cdecl, dynlib: NAME,
importc: "lua_checkstack".}
proc xmove*(`from`, `to`: PState, n: int){.cdecl, dynlib: NAME,
importc: "lua_xmove".}
proc isnumber*(L: PState, idx: int): cint{.cdecl, dynlib: NAME,
importc: "lua_isnumber".}
proc isstring*(L: PState, idx: int): cint{.cdecl, dynlib: NAME,
importc: "lua_isstring".}
proc iscfunction*(L: PState, idx: int): cint{.cdecl, dynlib: NAME,
importc: "lua_iscfunction".}
proc isuserdata*(L: PState, idx: int): cint{.cdecl, dynlib: NAME,
importc: "lua_isuserdata".}
proc luatype*(L: PState, idx: int): int{.cdecl, dynlib: NAME, importc: "lua_type".}
proc typename*(L: PState, tp: int): cstring{.cdecl, dynlib: NAME,
importc: "lua_typename".}
proc equal*(L: PState, idx1, idx2: int): cint{.cdecl, dynlib: NAME,
importc: "lua_equal".}
proc rawequal*(L: PState, idx1, idx2: int): cint{.cdecl, dynlib: NAME,
importc: "lua_rawequal".}
proc lessthan*(L: PState, idx1, idx2: int): cint{.cdecl, dynlib: NAME,
importc: "lua_lessthan".}
proc tonumber*(L: PState, idx: int): Number{.cdecl, dynlib: NAME,
importc: "lua_tonumber".}
proc tointeger*(L: PState, idx: int): Integer{.cdecl, dynlib: NAME,
importc: "lua_tointeger".}
proc toboolean*(L: PState, idx: int): cint{.cdecl, dynlib: NAME,
importc: "lua_toboolean".}
proc tolstring*(L: PState, idx: int, length: ptr int): cstring{.cdecl,
dynlib: NAME, importc: "lua_tolstring".}
proc objlen*(L: PState, idx: int): int{.cdecl, dynlib: NAME,
importc: "lua_objlen".}
proc tocfunction*(L: PState, idx: int): CFunction{.cdecl, dynlib: NAME,
importc: "lua_tocfunction".}
proc touserdata*(L: PState, idx: int): Pointer{.cdecl, dynlib: NAME,
importc: "lua_touserdata".}
proc tothread*(L: PState, idx: int): PState{.cdecl, dynlib: NAME,
importc: "lua_tothread".}
proc topointer*(L: PState, idx: int): Pointer{.cdecl, dynlib: NAME,
importc: "lua_topointer".}
proc pushnil*(L: PState){.cdecl, dynlib: NAME, importc: "lua_pushnil".}
proc pushnumber*(L: PState, n: Number){.cdecl, dynlib: NAME,
importc: "lua_pushnumber".}
proc pushinteger*(L: PState, n: Integer){.cdecl, dynlib: NAME,
importc: "lua_pushinteger".}
proc pushlstring*(L: PState, s: cstring, len: int){.cdecl, dynlib: NAME,
importc: "lua_pushlstring".}
proc pushstring*(L: PState, s: cstring){.cdecl, dynlib: NAME,
importc: "lua_pushstring".}
proc pushvfstring*(L: PState, fmt: cstring, argp: Pointer): cstring{.cdecl,
dynlib: NAME, importc: "lua_pushvfstring".}
proc pushfstring*(L: PState, fmt: cstring): cstring{.cdecl, varargs,
dynlib: NAME, importc: "lua_pushfstring".}
proc pushcclosure*(L: PState, fn: CFunction, n: int){.cdecl, dynlib: NAME,
importc: "lua_pushcclosure".}
proc pushboolean*(L: PState, b: cint){.cdecl, dynlib: NAME,
importc: "lua_pushboolean".}
proc pushlightuserdata*(L: PState, p: Pointer){.cdecl, dynlib: NAME,
importc: "lua_pushlightuserdata".}
proc pushthread*(L: PState){.cdecl, dynlib: NAME, importc: "lua_pushthread".}
proc gettable*(L: PState, idx: int){.cdecl, dynlib: NAME,
importc: "lua_gettable".}
proc getfield*(L: Pstate, idx: int, k: cstring){.cdecl, dynlib: NAME,
importc: "lua_getfield".}
proc rawget*(L: PState, idx: int){.cdecl, dynlib: NAME, importc: "lua_rawget".}
proc rawgeti*(L: PState, idx, n: int){.cdecl, dynlib: NAME,
importc: "lua_rawgeti".}
proc createtable*(L: PState, narr, nrec: int){.cdecl, dynlib: NAME,
importc: "lua_createtable".}
proc newuserdata*(L: PState, sz: int): Pointer{.cdecl, dynlib: NAME,
importc: "lua_newuserdata".}
proc getmetatable*(L: PState, objindex: int): int{.cdecl, dynlib: NAME,
importc: "lua_getmetatable".}
proc getfenv*(L: PState, idx: int){.cdecl, dynlib: NAME, importc: "lua_getfenv".}
proc settable*(L: PState, idx: int){.cdecl, dynlib: NAME,
importc: "lua_settable".}
proc setfield*(L: PState, idx: int, k: cstring){.cdecl, dynlib: NAME,
importc: "lua_setfield".}
proc rawset*(L: PState, idx: int){.cdecl, dynlib: NAME, importc: "lua_rawset".}
proc rawseti*(L: PState, idx, n: int){.cdecl, dynlib: NAME,
importc: "lua_rawseti".}
proc setmetatable*(L: PState, objindex: int): int{.cdecl, dynlib: NAME,
importc: "lua_setmetatable".}
proc setfenv*(L: PState, idx: int): int{.cdecl, dynlib: NAME,
importc: "lua_setfenv".}
proc call*(L: PState, nargs, nresults: int){.cdecl, dynlib: NAME,
importc: "lua_call".}
proc pcall*(L: PState, nargs, nresults, errf: int): int{.cdecl, dynlib: NAME,
importc: "lua_pcall".}
proc cpcall*(L: PState, func: CFunction, ud: Pointer): int{.cdecl, dynlib: NAME,
importc: "lua_cpcall".}
proc load*(L: PState, reader: Reader, dt: Pointer, chunkname: cstring): int{.
cdecl, dynlib: NAME, importc: "lua_load".}
proc dump*(L: PState, writer: Writer, data: Pointer): int{.cdecl, dynlib: NAME,
importc: "lua_dump".}
proc luayield*(L: PState, nresults: int): int{.cdecl, dynlib: NAME,
importc: "lua_yield".}
proc resume*(L: PState, narg: int): int{.cdecl, dynlib: NAME,
importc: "lua_resume".}
proc status*(L: PState): int{.cdecl, dynlib: NAME, importc: "lua_status".}
proc gc*(L: PState, what, data: int): int{.cdecl, dynlib: NAME,
importc: "lua_gc".}
proc error*(L: PState): int{.cdecl, dynlib: NAME, importc: "lua_error".}
proc next*(L: PState, idx: int): int{.cdecl, dynlib: NAME, importc: "lua_next".}
proc concat*(L: PState, n: int){.cdecl, dynlib: NAME, importc: "lua_concat".}
proc getallocf*(L: PState, ud: ptr Pointer): Alloc{.cdecl, dynlib: NAME,
importc: "lua_getallocf".}
proc setallocf*(L: PState, f: Alloc, ud: Pointer){.cdecl, dynlib: NAME,
importc: "lua_setallocf".}
#
#** Garbage-collection functions and options
#
const
GCSTOP* = 0
GCRESTART* = 1
GCCOLLECT* = 2
GCCOUNT* = 3
GCCOUNTB* = 4
GCSTEP* = 5
GCSETPAUSE* = 6
GCSETSTEPMUL* = 7
#
#** ===============================================================
#** some useful macros
#** ===============================================================
#
proc pop*(L: PState, n: int)
proc newtable*(L: Pstate)
proc register*(L: PState, n: cstring, f: CFunction)
proc pushcfunction*(L: PState, f: CFunction)
proc strlen*(L: Pstate, i: int): int
proc isfunction*(L: PState, n: int): bool
proc istable*(L: PState, n: int): bool
proc islightuserdata*(L: PState, n: int): bool
proc isnil*(L: PState, n: int): bool
proc isboolean*(L: PState, n: int): bool
proc isthread*(L: PState, n: int): bool
proc isnone*(L: PState, n: int): bool
proc isnoneornil*(L: PState, n: int): bool
proc pushliteral*(L: PState, s: cstring)
proc setglobal*(L: PState, s: cstring)
proc getglobal*(L: PState, s: cstring)
proc tostring*(L: PState, i: int): cstring
#
#** compatibility macros and functions
#
proc getregistry*(L: PState)
proc getgccount*(L: PState): int
type
Chunkreader* = Reader
Chunkwriter* = Writer
#
#** ======================================================================
#** Debug API
#** ======================================================================
#
const
HOOKCALL* = 0
HOOKRET* = 1
HOOKLINE* = 2
HOOKCOUNT* = 3
HOOKTAILRET* = 4
const
MASKCALL* = 1 shl Ord(HOOKCALL)
MASKRET* = 1 shl Ord(HOOKRET)
MASKLINE* = 1 shl Ord(HOOKLINE)
MASKCOUNT* = 1 shl Ord(HOOKCOUNT)
const
IDSIZE* = 60
type
TDebug*{.final.} = object # activation record
event*: int
name*: cstring # (n)
namewhat*: cstring # (n) `global', `local', `field', `method'
what*: cstring # (S) `Lua', `C', `main', `tail'
source*: cstring # (S)
currentline*: int # (l)
nups*: int # (u) number of upvalues
linedefined*: int # (S)
lastlinedefined*: int # (S)
short_src*: array[0..IDSIZE - 1, Char] # (S)
# private part
i_ci*: int # active function
PDebug* = ptr TDebug
Hook* = proc (L: PState, ar: PDebug){.cdecl.}
#
#** ======================================================================
#** Debug API
#** ======================================================================
#
proc getstack*(L: PState, level: int, ar: PDebug): int{.cdecl, dynlib: NAME,
importc: "lua_getstack".}
proc getinfo*(L: PState, what: cstring, ar: PDebug): int{.cdecl, dynlib: NAME,
importc: "lua_getinfo".}
proc getlocal*(L: PState, ar: PDebug, n: int): cstring{.cdecl, dynlib: NAME,
importc: "lua_getlocal".}
proc setlocal*(L: PState, ar: PDebug, n: int): cstring{.cdecl, dynlib: NAME,
importc: "lua_setlocal".}
proc getupvalue*(L: PState, funcindex: int, n: int): cstring{.cdecl,
dynlib: NAME, importc: "lua_getupvalue".}
proc setupvalue*(L: PState, funcindex: int, n: int): cstring{.cdecl,
dynlib: NAME, importc: "lua_setupvalue".}
proc sethook*(L: PState, func: Hook, mask: int, count: int): int{.cdecl,
dynlib: NAME, importc: "lua_sethook".}
proc gethook*(L: PState): Hook{.cdecl, dynlib: NAME, importc: "lua_gethook".}
proc gethookmask*(L: PState): int{.cdecl, dynlib: NAME,
importc: "lua_gethookmask".}
proc gethookcount*(L: PState): int{.cdecl, dynlib: NAME,
importc: "lua_gethookcount".}
# implementation
proc upvalueindex(I: int): int =
Result = GLOBALSINDEX - i
proc pop(L: PState, n: int) =
settop(L, - n - 1)
proc newtable(L: PState) =
createtable(L, 0, 0)
proc register(L: PState, n: cstring, f: CFunction) =
pushcfunction(L, f)
setglobal(L, n)
proc pushcfunction(L: PState, f: CFunction) =
pushcclosure(L, f, 0)
proc strlen(L: PState, i: int): int =
Result = objlen(L, i)
proc isfunction(L: PState, n: int): bool =
Result = luatype(L, n) == TFUNCTION
proc istable(L: PState, n: int): bool =
Result = luatype(L, n) == TTABLE
proc islightuserdata(L: PState, n: int): bool =
Result = luatype(L, n) == TLIGHTUSERDATA
proc isnil(L: PState, n: int): bool =
Result = luatype(L, n) == TNIL
proc isboolean(L: PState, n: int): bool =
Result = luatype(L, n) == TBOOLEAN
proc isthread(L: PState, n: int): bool =
Result = luatype(L, n) == TTHREAD
proc isnone(L: PState, n: int): bool =
Result = luatype(L, n) == TNONE
proc isnoneornil(L: PState, n: int): bool =
Result = luatype(L, n) <= 0
proc pushliteral(L: PState, s: cstring) =
pushlstring(L, s, len(s))
proc setglobal(L: PState, s: cstring) =
setfield(L, GLOBALSINDEX, s)
proc getglobal(L: PState, s: cstring) =
getfield(L, GLOBALSINDEX, s)
proc tostring(L: PState, i: int): cstring =
Result = tolstring(L, i, nil)
proc getregistry(L: PState) =
pushvalue(L, REGISTRYINDEX)
proc getgccount(L: PState): int =
Result = gc(L, GCCOUNT, 0)

View File

@@ -1,66 +0,0 @@
#*****************************************************************************
# * *
# * File: lualib.pas *
# * Authors: TeCGraf (C headers + actual Lua libraries) *
# * Lavergne Thomas (original translation to Pascal) *
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
# * Description: Standard Lua libraries *
# * *
# *****************************************************************************
#
#** $Id: lualib.h,v 1.28 2003/03/18 12:24:26 roberto Exp $
#** Lua standard libraries
#** See Copyright Notice in lua.h
#
#
#** Translated to pascal by Lavergne Thomas
#** Bug reports :
#** - thomas.lavergne@laposte.net
#** In french or in english
#
import
lua
const
COLIBNAME* = "coroutine"
TABLIBNAME* = "table"
IOLIBNAME* = "io"
OSLIBNAME* = "os"
STRLINAME* = "string"
MATHLIBNAME* = "math"
DBLIBNAME* = "debug"
LOADLIBNAME* = "package"
proc open_base*(L: PState): cint{.cdecl, dynlib: LIB_NAME,
importc: "luaopen_base".}
proc open_table*(L: PState): cint{.cdecl, dynlib: LIB_NAME,
importc: "luaopen_table".}
proc open_io*(L: PState): cint{.cdecl, dynlib: LIB_NAME, importc: "luaopen_io".}
proc open_string*(L: PState): cint{.cdecl, dynlib: LIB_NAME,
importc: "luaopen_string".}
proc open_math*(L: PState): cint{.cdecl, dynlib: LIB_NAME,
importc: "luaopen_math".}
proc open_debug*(L: PState): cint{.cdecl, dynlib: LIB_NAME,
importc: "luaopen_debug".}
proc open_package*(L: PState): cint{.cdecl, dynlib: LIB_NAME,
importc: "luaopen_package".}
proc openlibs*(L: PState){.cdecl, dynlib: LIB_NAME, importc: "luaL_openlibs".}
proc baselibopen*(L: PState): Bool =
Result = open_base(L) != 0'i32
proc tablibopen*(L: PState): Bool =
Result = open_table(L) != 0'i32
proc iolibopen*(L: PState): Bool =
Result = open_io(L) != 0'i32
proc strlibopen*(L: PState): Bool =
Result = open_string(L) != 0'i32
proc mathlibopen*(L: PState): Bool =
Result = open_math(L) != 0'i32
proc dblibopen*(L: PState): Bool =
Result = open_debug(L) != 0'i32

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,329 +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
GL
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
TViewPortArray* = array[0..3, TGLint]
T16dArray* = array[0..15, TGLdouble]
TCallBack* = proc ()
T3dArray* = array[0..2, TGLdouble]
T4pArray* = array[0..3, Pointer]
T4fArray* = array[0..3, TGLfloat]
PPointer* = ptr Pointer
type
GLUnurbs*{.final.} = object
PGLUnurbs* = ptr GLUnurbs
GLUquadric*{.final.} = object
PGLUquadric* = ptr GLUquadric
GLUtesselator*{.final.} = object
PGLUtesselator* = ptr GLUtesselator # backwards compatibility:
GLUnurbsObj* = GLUnurbs
PGLUnurbsObj* = PGLUnurbs
GLUquadricObj* = GLUquadric
PGLUquadricObj* = PGLUquadric
GLUtesselatorObj* = GLUtesselator
PGLUtesselatorObj* = PGLUtesselator
GLUtriangulatorObj* = GLUtesselator
PGLUtriangulatorObj* = PGLUtesselator
TGLUnurbs* = GLUnurbs
TGLUquadric* = GLUquadric
TGLUtesselator* = GLUtesselator
TGLUnurbsObj* = GLUnurbsObj
TGLUquadricObj* = GLUquadricObj
TGLUtesselatorObj* = GLUtesselatorObj
TGLUtriangulatorObj* = GLUtriangulatorObj
proc gluErrorString*(errCode: TGLenum): cstring{.dynlib: dllname,
importc: "gluErrorString".}
proc gluErrorUnicodeStringEXT*(errCode: TGLenum): ptr int16{.dynlib: dllname,
importc: "gluErrorUnicodeStringEXT".}
proc gluGetString*(name: TGLenum): cstring{.dynlib: dllname,
importc: "gluGetString".}
proc gluOrtho2D*(left, right, bottom, top: TGLdouble){.dynlib: dllname,
importc: "gluOrtho2D".}
proc gluPerspective*(fovy, aspect, zNear, zFar: TGLdouble){.dynlib: dllname,
importc: "gluPerspective".}
proc gluPickMatrix*(x, y, width, height: TGLdouble, viewport: var TViewPortArray){.
dynlib: dllname, importc: "gluPickMatrix".}
proc gluLookAt*(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: TGLdouble){.
dynlib: dllname, importc: "gluLookAt".}
proc gluProject*(objx, objy, objz: TGLdouble,
modelMatrix, projMatrix: var T16dArray,
viewport: var TViewPortArray, winx, winy, winz: PGLdouble): int{.
dynlib: dllname, importc: "gluProject".}
proc gluUnProject*(winx, winy, winz: TGLdouble,
modelMatrix, projMatrix: var T16dArray,
viewport: var TViewPortArray, objx, objy, objz: PGLdouble): int{.
dynlib: dllname, importc: "gluUnProject".}
proc gluScaleImage*(format: TGLenum, widthin, heightin: TGLint, typein: TGLenum,
datain: Pointer, widthout, heightout: TGLint,
typeout: TGLenum, dataout: Pointer): int{.dynlib: dllname,
importc: "gluScaleImage".}
proc gluBuild1DMipmaps*(target: TGLenum, components, width: TGLint,
format, atype: TGLenum, data: Pointer): int{.
dynlib: dllname, importc: "gluBuild1DMipmaps".}
proc gluBuild2DMipmaps*(target: TGLenum, components, width, height: TGLint,
format, atype: TGLenum, data: Pointer): int{.
dynlib: dllname, importc: "gluBuild2DMipmaps".}
proc gluNewQuadric*(): PGLUquadric{.dynlib: dllname, importc: "gluNewQuadric".}
proc gluDeleteQuadric*(state: PGLUquadric){.dynlib: dllname,
importc: "gluDeleteQuadric".}
proc gluQuadricNormals*(quadObject: PGLUquadric, normals: TGLenum){.
dynlib: dllname, importc: "gluQuadricNormals".}
proc gluQuadricTexture*(quadObject: PGLUquadric, textureCoords: TGLboolean){.
dynlib: dllname, importc: "gluQuadricTexture".}
proc gluQuadricOrientation*(quadObject: PGLUquadric, orientation: TGLenum){.
dynlib: dllname, importc: "gluQuadricOrientation".}
proc gluQuadricDrawStyle*(quadObject: PGLUquadric, drawStyle: TGLenum){.
dynlib: dllname, importc: "gluQuadricDrawStyle".}
proc gluCylinder*(qobj: PGLUquadric, baseRadius, topRadius, height: TGLdouble,
slices, stacks: TGLint){.dynlib: dllname,
importc: "gluCylinder".}
proc gluDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble,
slices, loops: TGLint){.dynlib: dllname, importc: "gluDisk".}
proc gluPartialDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble,
slices, loops: TGLint, startAngle, sweepAngle: TGLdouble){.
dynlib: dllname, importc: "gluPartialDisk".}
proc gluSphere*(qobj: PGLuquadric, radius: TGLdouble, slices, stacks: TGLint){.
dynlib: dllname, importc: "gluSphere".}
proc gluQuadricCallback*(qobj: PGLUquadric, which: TGLenum, fn: TCallBack){.
dynlib: dllname, importc: "gluQuadricCallback".}
proc gluNewTess*(): PGLUtesselator{.dynlib: dllname, importc: "gluNewTess".}
proc gluDeleteTess*(tess: PGLUtesselator){.dynlib: dllname,
importc: "gluDeleteTess".}
proc gluTessBeginPolygon*(tess: PGLUtesselator, polygon_data: Pointer){.
dynlib: dllname, importc: "gluTessBeginPolygon".}
proc gluTessBeginContour*(tess: PGLUtesselator){.dynlib: dllname,
importc: "gluTessBeginContour".}
proc gluTessVertex*(tess: PGLUtesselator, coords: var T3dArray, data: Pointer){.
dynlib: dllname, importc: "gluTessVertex".}
proc gluTessEndContour*(tess: PGLUtesselator){.dynlib: dllname,
importc: "gluTessEndContour".}
proc gluTessEndPolygon*(tess: PGLUtesselator){.dynlib: dllname,
importc: "gluTessEndPolygon".}
proc gluTessProperty*(tess: PGLUtesselator, which: TGLenum, value: TGLdouble){.
dynlib: dllname, importc: "gluTessProperty".}
proc gluTessNormal*(tess: PGLUtesselator, x, y, z: TGLdouble){.dynlib: dllname,
importc: "gluTessNormal".}
proc gluTessCallback*(tess: PGLUtesselator, which: TGLenum, fn: TCallBack){.
dynlib: dllname, importc: "gluTessCallback".}
proc gluGetTessProperty*(tess: PGLUtesselator, which: TGLenum, value: PGLdouble){.
dynlib: dllname, importc: "gluGetTessProperty".}
proc gluNewNurbsRenderer*(): PGLUnurbs{.dynlib: dllname,
importc: "gluNewNurbsRenderer".}
proc gluDeleteNurbsRenderer*(nobj: PGLUnurbs){.dynlib: dllname,
importc: "gluDeleteNurbsRenderer".}
proc gluBeginSurface*(nobj: PGLUnurbs){.dynlib: dllname,
importc: "gluBeginSurface".}
proc gluBeginCurve*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluBeginCurve".}
proc gluEndCurve*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluEndCurve".}
proc gluEndSurface*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluEndSurface".}
proc gluBeginTrim*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluBeginTrim".}
proc gluEndTrim*(nobj: PGLUnurbs){.dynlib: dllname, importc: "gluEndTrim".}
proc gluPwlCurve*(nobj: PGLUnurbs, count: TGLint, aarray: PGLfloat,
stride: TGLint, atype: TGLenum){.dynlib: dllname,
importc: "gluPwlCurve".}
proc gluNurbsCurve*(nobj: PGLUnurbs, nknots: TGLint, knot: PGLfloat,
stride: TGLint, ctlarray: PGLfloat, order: TGLint,
atype: TGLenum){.dynlib: dllname, importc: "gluNurbsCurve".}
proc gluNurbsSurface*(nobj: PGLUnurbs, sknot_count: TGLint, sknot: PGLfloat,
tknot_count: TGLint, tknot: PGLfloat,
s_stride, t_stride: TGLint, ctlarray: PGLfloat,
sorder, torder: TGLint, atype: TGLenum){.dynlib: dllname,
importc: "gluNurbsSurface".}
proc gluLoadSamplingMatrices*(nobj: PGLUnurbs,
modelMatrix, projMatrix: var T16dArray,
viewport: var TViewPortArray){.dynlib: dllname,
importc: "gluLoadSamplingMatrices".}
proc gluNurbsProperty*(nobj: PGLUnurbs, aproperty: TGLenum, value: TGLfloat){.
dynlib: dllname, importc: "gluNurbsProperty".}
proc gluGetNurbsProperty*(nobj: PGLUnurbs, aproperty: TGLenum, value: PGLfloat){.
dynlib: dllname, importc: "gluGetNurbsProperty".}
proc gluNurbsCallback*(nobj: PGLUnurbs, which: TGLenum, fn: TCallBack){.
dynlib: dllname, importc: "gluNurbsCallback".}
#*** Callback function prototypes ***
type # gluQuadricCallback
GLUquadricErrorProc* = proc (p: TGLenum) # gluTessCallback
GLUtessBeginProc* = proc (p: TGLenum)
GLUtessEdgeFlagProc* = proc (p: TGLboolean)
GLUtessVertexProc* = proc (p: Pointer)
GLUtessEndProc* = proc ()
GLUtessErrorProc* = proc (p: TGLenum)
GLUtessCombineProc* = proc (p1: var T3dArray, p2: T4pArray, p3: T4fArray,
p4: PPointer)
GLUtessBeginDataProc* = proc (p1: TGLenum, p2: Pointer)
GLUtessEdgeFlagDataProc* = proc (p1: TGLboolean, p2: Pointer)
GLUtessVertexDataProc* = proc (p1, p2: Pointer)
GLUtessEndDataProc* = proc (p: Pointer)
GLUtessErrorDataProc* = proc (p1: TGLenum, p2: Pointer)
GLUtessCombineDataProc* = proc (p1: var T3dArray, p2: var T4pArray,
p3: var T4fArray, p4: PPointer, p5: Pointer) #
#
# gluNurbsCallback
GLUnurbsErrorProc* = proc (p: TGLenum) #*** 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*)(TGLenum type)
constGLU_TESS_VERTEX* = 100101 # void (CALLBACK*)(void *data)
GLU_TESS_END* = 100102 # void (CALLBACK*)(void)
GLU_TESS_ERROR* = 100103 # void (CALLBACK*)(TGLenum errno)
GLU_TESS_EDGE_FLAG* = 100104 # void (CALLBACK*)(TGLboolean boundaryEdge)
GLU_TESS_COMBINE* = 100105 # void (CALLBACK*)(TGLdouble coords[3],
# void *data[4],
# TGLfloat weight[4],
# void **dataOut)
GLU_TESS_BEGIN_DATA* = 100106 # void (CALLBACK*)(TGLenum 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*)(TGLenum errno,
# void *polygon_data)
GLU_TESS_EDGE_FLAG_DATA* = 100110 # void (CALLBACK*)(TGLboolean boundaryEdge,
# void *polygon_data)
GLU_TESS_COMBINE_DATA* = 100111 # void (CALLBACK*)(TGLdouble coords[3],
# void *data[4],
# TGLfloat 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: PGLUtesselator){.dynlib: dllname,
importc: "gluBeginPolygon".}
proc gluNextContour*(tess: PGLUtesselator, atype: TGLenum){.dynlib: dllname,
importc: "gluNextContour".}
proc gluEndPolygon*(tess: PGLUtesselator){.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
# implementation

View File

@@ -1,432 +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
GL
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
PInteger* = ptr int
PPChar* = ptr cstring
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.}
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.
proc glutInit*(argcp: PInteger, argv: PPChar){.dynlib: dllname,
importc: "glutInit".}
proc glutInitDisplayMode*(mode: int16){.dynlib: dllname,
importc: "glutInitDisplayMode".}
proc glutInitDisplayString*(str: cstring){.dynlib: dllname,
importc: "glutInitDisplayString".}
proc glutInitWindowPosition*(x, y: int){.dynlib: dllname,
importc: "glutInitWindowPosition".}
proc glutInitWindowSize*(width, height: int){.dynlib: dllname,
importc: "glutInitWindowSize".}
proc glutMainLoop*(){.dynlib: dllname, importc: "glutMainLoop".}
# GLUT window sub-API.
proc glutCreateWindow*(title: cstring): int{.dynlib: dllname,
importc: "glutCreateWindow".}
proc glutCreateSubWindow*(win, x, y, width, height: int): int{.dynlib: dllname,
importc: "glutCreateSubWindow".}
proc glutDestroyWindow*(win: int){.dynlib: dllname, importc: "glutDestroyWindow".}
proc glutPostRedisplay*(){.dynlib: dllname, importc: "glutPostRedisplay".}
proc glutPostWindowRedisplay*(win: int){.dynlib: dllname,
importc: "glutPostWindowRedisplay".}
proc glutSwapBuffers*(){.dynlib: dllname, importc: "glutSwapBuffers".}
proc glutGetWindow*(): int{.dynlib: dllname, importc: "glutGetWindow".}
proc glutSetWindow*(win: int){.dynlib: dllname, importc: "glutSetWindow".}
proc glutSetWindowTitle*(title: cstring){.dynlib: dllname,
importc: "glutSetWindowTitle".}
proc glutSetIconTitle*(title: cstring){.dynlib: dllname,
importc: "glutSetIconTitle".}
proc glutPositionWindow*(x, y: int){.dynlib: dllname,
importc: "glutPositionWindow".}
proc glutReshapeWindow*(width, height: int){.dynlib: dllname,
importc: "glutReshapeWindow".}
proc glutPopWindow*(){.dynlib: dllname, importc: "glutPopWindow".}
proc glutPushWindow*(){.dynlib: dllname, importc: "glutPushWindow".}
proc glutIconifyWindow*(){.dynlib: dllname, importc: "glutIconifyWindow".}
proc glutShowWindow*(){.dynlib: dllname, importc: "glutShowWindow".}
proc glutHideWindow*(){.dynlib: dllname, importc: "glutHideWindow".}
proc glutFullScreen*(){.dynlib: dllname, importc: "glutFullScreen".}
proc glutSetCursor*(cursor: int){.dynlib: dllname, importc: "glutSetCursor".}
proc glutWarpPointer*(x, y: int){.dynlib: dllname, importc: "glutWarpPointer".}
# GLUT overlay sub-API.
proc glutEstablishOverlay*(){.dynlib: dllname, importc: "glutEstablishOverlay".}
proc glutRemoveOverlay*(){.dynlib: dllname, importc: "glutRemoveOverlay".}
proc glutUseLayer*(layer: TGLenum){.dynlib: dllname, importc: "glutUseLayer".}
proc glutPostOverlayRedisplay*(){.dynlib: dllname,
importc: "glutPostOverlayRedisplay".}
proc glutPostWindowOverlayRedisplay*(win: int){.dynlib: dllname,
importc: "glutPostWindowOverlayRedisplay".}
proc glutShowOverlay*(){.dynlib: dllname, importc: "glutShowOverlay".}
proc glutHideOverlay*(){.dynlib: dllname, importc: "glutHideOverlay".}
# GLUT menu sub-API.
proc glutCreateMenu*(callback: TGlut1IntCallback): int{.dynlib: dllname,
importc: "glutCreateMenu".}
proc glutDestroyMenu*(menu: int){.dynlib: dllname, importc: "glutDestroyMenu".}
proc glutGetMenu*(): int{.dynlib: dllname, importc: "glutGetMenu".}
proc glutSetMenu*(menu: int){.dynlib: dllname, importc: "glutSetMenu".}
proc glutAddMenuEntry*(caption: cstring, value: int){.dynlib: dllname,
importc: "glutAddMenuEntry".}
proc glutAddSubMenu*(caption: cstring, submenu: int){.dynlib: dllname,
importc: "glutAddSubMenu".}
proc glutChangeToMenuEntry*(item: int, caption: cstring, value: int){.
dynlib: dllname, importc: "glutChangeToMenuEntry".}
proc glutChangeToSubMenu*(item: int, caption: cstring, submenu: int){.
dynlib: dllname, importc: "glutChangeToSubMenu".}
proc glutRemoveMenuItem*(item: int){.dynlib: dllname,
importc: "glutRemoveMenuItem".}
proc glutAttachMenu*(button: int){.dynlib: dllname, importc: "glutAttachMenu".}
proc glutDetachMenu*(button: int){.dynlib: dllname, importc: "glutDetachMenu".}
# GLUT window callback sub-API.
proc glutDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname,
importc: "glutDisplayFunc".}
proc glutReshapeFunc*(f: TGlut2IntCallback){.dynlib: dllname,
importc: "glutReshapeFunc".}
proc glutKeyboardFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname,
importc: "glutKeyboardFunc".}
proc glutMouseFunc*(f: TGlut4IntCallback){.dynlib: dllname,
importc: "glutMouseFunc".}
proc glutMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
importc: "glutMotionFunc".}
proc glutPassiveMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
importc: "glutPassiveMotionFunc".}
proc glutEntryFunc*(f: TGlut1IntCallback){.dynlib: dllname,
importc: "glutEntryFunc".}
proc glutVisibilityFunc*(f: TGlut1IntCallback){.dynlib: dllname,
importc: "glutVisibilityFunc".}
proc glutIdleFunc*(f: TGlutVoidCallback){.dynlib: dllname,
importc: "glutIdleFunc".}
proc glutTimerFunc*(millis: int16, f: TGlut1IntCallback, value: int){.
dynlib: dllname, importc: "glutTimerFunc".}
proc glutMenuStateFunc*(f: TGlut1IntCallback){.dynlib: dllname,
importc: "glutMenuStateFunc".}
proc glutSpecialFunc*(f: TGlut3IntCallback){.dynlib: dllname,
importc: "glutSpecialFunc".}
proc glutSpaceballMotionFunc*(f: TGlut3IntCallback){.dynlib: dllname,
importc: "glutSpaceballMotionFunc".}
proc glutSpaceballRotateFunc*(f: TGlut3IntCallback){.dynlib: dllname,
importc: "glutSpaceballRotateFunc".}
proc glutSpaceballButtonFunc*(f: TGlut2IntCallback){.dynlib: dllname,
importc: "glutSpaceballButtonFunc".}
proc glutButtonBoxFunc*(f: TGlut2IntCallback){.dynlib: dllname,
importc: "glutButtonBoxFunc".}
proc glutDialsFunc*(f: TGlut2IntCallback){.dynlib: dllname,
importc: "glutDialsFunc".}
proc glutTabletMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
importc: "glutTabletMotionFunc".}
proc glutTabletButtonFunc*(f: TGlut4IntCallback){.dynlib: dllname,
importc: "glutTabletButtonFunc".}
proc glutMenuStatusFunc*(f: TGlut3IntCallback){.dynlib: dllname,
importc: "glutMenuStatusFunc".}
proc glutOverlayDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname,
importc: "glutOverlayDisplayFunc".}
proc glutWindowStatusFunc*(f: TGlut1IntCallback){.dynlib: dllname,
importc: "glutWindowStatusFunc".}
proc glutKeyboardUpFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname,
importc: "glutKeyboardUpFunc".}
proc glutSpecialUpFunc*(f: TGlut3IntCallback){.dynlib: dllname,
importc: "glutSpecialUpFunc".}
proc glutJoystickFunc*(f: TGlut1UInt3IntCallback, pollInterval: int){.
dynlib: dllname, importc: "glutJoystickFunc".}
# GLUT color index sub-API.
proc glutSetColor*(cell: int, red, green, blue: TGLfloat){.dynlib: dllname,
importc: "glutSetColor".}
proc glutGetColor*(ndx, component: int): TGLfloat{.dynlib: dllname,
importc: "glutGetColor".}
proc glutCopyColormap*(win: int){.dynlib: dllname, importc: "glutCopyColormap".}
# GLUT state retrieval sub-API.
proc glutGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutGet".}
proc glutDeviceGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutDeviceGet".}
# GLUT extension support sub-API
proc glutExtensionSupported*(name: cstring): int{.dynlib: dllname,
importc: "glutExtensionSupported".}
proc glutGetModifiers*(): int{.dynlib: dllname, importc: "glutGetModifiers".}
proc glutLayerGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutLayerGet".}
# GLUT font sub-API
proc glutBitmapCharacter*(font: pointer, character: int){.dynlib: dllname,
importc: "glutBitmapCharacter".}
proc glutBitmapWidth*(font: pointer, character: int): int{.dynlib: dllname,
importc: "glutBitmapWidth".}
proc glutStrokeCharacter*(font: pointer, character: int){.dynlib: dllname,
importc: "glutStrokeCharacter".}
proc glutStrokeWidth*(font: pointer, character: int): int{.dynlib: dllname,
importc: "glutStrokeWidth".}
proc glutBitmapLength*(font: pointer, str: cstring): int{.dynlib: dllname,
importc: "glutBitmapLength".}
proc glutStrokeLength*(font: pointer, str: cstring): int{.dynlib: dllname,
importc: "glutStrokeLength".}
# GLUT pre-built models sub-API
proc glutWireSphere*(radius: TGLdouble, slices, stacks: TGLint){.
dynlib: dllname, importc: "glutWireSphere".}
proc glutSolidSphere*(radius: TGLdouble, slices, stacks: TGLint){.
dynlib: dllname, importc: "glutSolidSphere".}
proc glutWireCone*(base, height: TGLdouble, slices, stacks: TGLint){.
dynlib: dllname, importc: "glutWireCone".}
proc glutSolidCone*(base, height: TGLdouble, slices, stacks: TGLint){.
dynlib: dllname, importc: "glutSolidCone".}
proc glutWireCube*(size: TGLdouble){.dynlib: dllname, importc: "glutWireCube".}
proc glutSolidCube*(size: TGLdouble){.dynlib: dllname, importc: "glutSolidCube".}
proc glutWireTorus*(innerRadius, outerRadius: TGLdouble, sides, rings: TGLint){.
dynlib: dllname, importc: "glutWireTorus".}
proc glutSolidTorus*(innerRadius, outerRadius: TGLdouble, sides, rings: TGLint){.
dynlib: dllname, importc: "glutSolidTorus".}
proc glutWireDodecahedron*(){.dynlib: dllname, importc: "glutWireDodecahedron".}
proc glutSolidDodecahedron*(){.dynlib: dllname, importc: "glutSolidDodecahedron".}
proc glutWireTeapot*(size: TGLdouble){.dynlib: dllname,
importc: "glutWireTeapot".}
proc glutSolidTeapot*(size: TGLdouble){.dynlib: dllname,
importc: "glutSolidTeapot".}
proc glutWireOctahedron*(){.dynlib: dllname, importc: "glutWireOctahedron".}
proc glutSolidOctahedron*(){.dynlib: dllname, importc: "glutSolidOctahedron".}
proc glutWireTetrahedron*(){.dynlib: dllname, importc: "glutWireTetrahedron".}
proc glutSolidTetrahedron*(){.dynlib: dllname, importc: "glutSolidTetrahedron".}
proc glutWireIcosahedron*(){.dynlib: dllname, importc: "glutWireIcosahedron".}
proc glutSolidIcosahedron*(){.dynlib: dllname, importc: "glutSolidIcosahedron".}
# GLUT video resize sub-API.
proc glutVideoResizeGet*(param: TGLenum): int{.dynlib: dllname,
importc: "glutVideoResizeGet".}
proc glutSetupVideoResizing*(){.dynlib: dllname,
importc: "glutSetupVideoResizing".}
proc glutStopVideoResizing*(){.dynlib: dllname, importc: "glutStopVideoResizing".}
proc glutVideoResize*(x, y, width, height: int){.dynlib: dllname,
importc: "glutVideoResize".}
proc glutVideoPan*(x, y, width, height: int){.dynlib: dllname,
importc: "glutVideoPan".}
# GLUT debugging sub-API.
proc glutReportErrors*(){.dynlib: dllname, importc: "glutReportErrors".}
# GLUT device control sub-API.
proc glutIgnoreKeyRepeat*(ignore: int){.dynlib: dllname,
importc: "glutIgnoreKeyRepeat".}
proc glutSetKeyRepeat*(repeatMode: int){.dynlib: dllname,
importc: "glutSetKeyRepeat".}
proc glutForceJoystickFunc*(){.dynlib: dllname, importc: "glutForceJoystickFunc".}
# GLUT game mode sub-API.
#example glutGameModeString('1280x1024:32@75');
proc glutGameModeString*(AString: cstring){.dynlib: dllname,
importc: "glutGameModeString".}
proc glutEnterGameMode*(): int{.dynlib: dllname, importc: "glutEnterGameMode".}
proc glutLeaveGameMode*(){.dynlib: dllname, importc: "glutLeaveGameMode".}
proc glutGameModeGet*(mode: TGLenum): int{.dynlib: dllname,
importc: "glutGameModeGet".}
# implementation

View File

@@ -1,153 +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, gl
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
GLX_BUFFER_SIZE* = 2
GLX_LEVEL* = 3
GLX_RGBA* = 4
GLX_DOUBLEBUFFER* = 5
GLX_STEREO* = 6
GLX_AUX_BUFFERS* = 7
GLX_RED_SIZE* = 8
GLX_GREEN_SIZE* = 9
GLX_BLUE_SIZE* = 10
GLX_ALPHA_SIZE* = 11
GLX_DEPTH_SIZE* = 12
GLX_STENCIL_SIZE* = 13
GLX_ACCUM_RED_SIZE* = 14
GLX_ACCUM_GREEN_SIZE* = 15
GLX_ACCUM_BLUE_SIZE* = 16
GLX_ACCUM_ALPHA_SIZE* = 17 # 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

View File

@@ -1,368 +0,0 @@
import
gl, windows
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

View File

@@ -1,259 +0,0 @@
#
#
# Nimrod's Runtime Library
# (c) Copyright 2009 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
{.compile: "pcre_all.c".}
type
Pbyte = ptr byte
PPchar = ptr cstring
Pint = ptr cint
P* = ptr T
Pcallout_block* = ptr tcallout_block
Pextra* = ptr Textra
T{.final, pure.} = object
# The structure for passing additional data to pcre_exec(). This is defined
# in such as way as to be extensible.
# Bits for which fields are set
# Opaque data from pcre_study()
# Maximum number of calls to match()
# Data passed back in callouts
# Const before type ignored
# Pointer to character tables
Textra*{.final, pure.} = object # The structure for passing out data via the pcre_callout_function. We use a
# structure so that new fields can be added on the end in future versions,
# without changing the API of the function, thereby allowing old clients to
# work without modification.
# Identifies version of block
# ------------------------ Version 0 -------------------------------
# Number compiled into pattern
# The offset vector
# Const before type ignored
# The subject being matched
# The length of the subject
# Offset to start of this match attempt
# Where we currently are in the subject
# Max current capture
# Most recently closed capture
# Data passed in with the call
# ------------------- Added for Version 1 --------------------------
# Offset to next item in the pattern
# Length of next item in the pattern
#
# ------------------------------------------------------------------
flags: cint
study_data: pointer
match_limit: cint
callout_data: pointer
tables: ptr byte
Tcallout_block*{.final, pure.} = object
version: cint
callout_number: cint
offset_vector: ptr cint
subject: ptr char
subject_length: cint
start_match: cint
current_position: cint
capture_top: cint
capture_last: cint
callout_data: pointer
pattern_position: cint
next_item_length: cint
#************************************************
#* Perl-Compatible Regular Expressions *
#************************************************
#
# Modified by Andreas Rumpf for h2pas.
# In its original form, this is the .in file that is transformed by
# "configure" into pcre.h.
#
# Copyright (c) 1997-2005 University of Cambridge
#
# -----------------------------------------------------------------------------
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * 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.
#
# * Neither the name of the University of Cambridge nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
# -----------------------------------------------------------------------------
# The file pcre.h is build by "configure". Do not edit it; instead
# make changes to pcre.in.
const
PCRE_MAJOR* = 6
PCRE_MINOR* = 3
PCRE_DATE* = "2005/11/29"
# Options
PCRE_CASELESS* = 0x00000001
PCRE_MULTILINE* = 0x00000002
PCRE_DOTALL* = 0x00000004
PCRE_EXTENDED* = 0x00000008
PCRE_ANCHORED* = 0x00000010
PCRE_DOLLAR_ENDONLY* = 0x00000020
PCRE_EXTRA* = 0x00000040
PCRE_NOTBOL* = 0x00000080
PCRE_NOTEOL* = 0x00000100
PCRE_UNGREEDY* = 0x00000200
PCRE_NOTEMPTY* = 0x00000400
PCRE_UTF8* = 0x00000800
PCRE_NO_AUTO_CAPTURE* = 0x00001000
PCRE_NO_UTF8_CHECK* = 0x00002000
PCRE_AUTO_CALLOUT* = 0x00004000
PCRE_PARTIAL* = 0x00008000
PCRE_DFA_SHORTEST* = 0x00010000
PCRE_DFA_RESTART* = 0x00020000
PCRE_FIRSTLINE* = 0x00040000
# Exec-time and get/set-time error codes
PCRE_ERROR_NOMATCH* = - (1)
PCRE_ERROR_NULL* = - (2)
PCRE_ERROR_BADOPTION* = - (3)
PCRE_ERROR_BADMAGIC* = - (4)
PCRE_ERROR_UNKNOWN_NODE* = - (5)
PCRE_ERROR_NOMEMORY* = - (6)
PCRE_ERROR_NOSUBSTRING* = - (7)
PCRE_ERROR_MATCHLIMIT* = - (8)
# Never used by PCRE itself
PCRE_ERROR_CALLOUT* = - (9)
PCRE_ERROR_BADUTF8* = - (10)
PCRE_ERROR_BADUTF8_OFFSET* = - (11)
PCRE_ERROR_PARTIAL* = - (12)
PCRE_ERROR_BADPARTIAL* = - (13)
PCRE_ERROR_INTERNAL* = - (14)
PCRE_ERROR_BADCOUNT* = - (15)
PCRE_ERROR_DFA_UITEM* = - (16)
PCRE_ERROR_DFA_UCOND* = - (17)
PCRE_ERROR_DFA_UMLIMIT* = - (18)
PCRE_ERROR_DFA_WSSIZE* = - (19)
PCRE_ERROR_DFA_RECURSE* = - (20)
# Request types for pcre_fullinfo()
PCRE_INFO_OPTIONS* = 0
PCRE_INFO_SIZE* = 1
PCRE_INFO_CAPTURECOUNT* = 2
PCRE_INFO_BACKREFMAX* = 3
PCRE_INFO_FIRSTBYTE* = 4
# For backwards compatibility
PCRE_INFO_FIRSTCHAR* = 4
PCRE_INFO_FIRSTTABLE* = 5
PCRE_INFO_LASTLITERAL* = 6
PCRE_INFO_NAMEENTRYSIZE* = 7
PCRE_INFO_NAMECOUNT* = 8
PCRE_INFO_NAMETABLE* = 9
PCRE_INFO_STUDYSIZE* = 10
PCRE_INFO_DEFAULT_TABLES* = 11
# Request types for pcre_config()
PCRE_CONFIG_UTF8* = 0
PCRE_CONFIG_NEWLINE* = 1
PCRE_CONFIG_LINK_SIZE* = 2
PCRE_CONFIG_POSIX_MALLOC_THRESHOLD* = 3
PCRE_CONFIG_MATCH_LIMIT* = 4
PCRE_CONFIG_STACKRECURSE* = 5
PCRE_CONFIG_UNICODE_PROPERTIES* = 6
# Bit flags for the pcre_extra structure
PCRE_EXTRA_STUDY_DATA* = 0x00000001
PCRE_EXTRA_MATCH_LIMIT* = 0x00000002
PCRE_EXTRA_CALLOUT_DATA* = 0x00000004
PCRE_EXTRA_TABLES* = 0x00000008
# Exported PCRE functions
proc pcre_compile*(para1: cstring, para2: cint, para3: ptr cstring,
para4: ptr int, para5: Pbyte): P{.importc: "pcre_compile",
noconv.}
proc pcre_compile2*(para1: cstring, para2: cint, para3: Pint, para4: PPchar,
para5: ptr int, para6: Pbyte): P{.importc: "pcre_compile2",
noconv.}
proc pcre_config*(para1: cint, para2: pointer): cint{.importc: "pcre_config",
noconv.}
proc pcre_copy_named_substring*(para1: P, para2: cstring, para3: Pint,
para4: cint, para5: cstring, para6: cstring,
para7: cint): cint{.
importc: "pcre_copy_named_substring", noconv.}
proc pcre_copy_substring*(para1: cstring, para2: Pint, para3: cint, para4: cint,
para5: cstring, para6: cint): cint{.
importc: "pcre_copy_substring", noconv.}
proc pcre_dfa_exec*(para1: P, para2: Pextra, para3: cstring, para4: cint,
para5: cint, para6: cint, para7: Pint, para8: cint,
para9: Pint, para10: cint): cint{.importc: "pcre_dfa_exec",
noconv.}
proc pcre_exec*(para1: P, para2: Pextra, para3: cstring, para4: cint,
para5: cint, para6: cint, para7: Pint, para8: cint): cint{.
importc: "pcre_exec", noconv.}
proc pcre_free_substring*(para1: cstring){.importc: "pcre_free_substring",
noconv.}
proc pcre_free_substring_list*(para1: PPchar){.
importc: "pcre_free_substring_list", noconv.}
proc pcre_fullinfo*(para1: P, para2: Pextra, para3: cint, para4: pointer): cint{.
importc: "pcre_fullinfo", noconv.}
proc pcre_get_named_substring*(para1: P, para2: cstring, para3: Pint,
para4: cint, para5: cstring, para6: PPchar): cint{.
importc: "pcre_get_named_substring", noconv.}
proc pcre_get_stringnumber*(para1: P, para2: cstring): cint{.
importc: "pcre_get_stringnumber", noconv.}
proc pcre_get_substring*(para1: cstring, para2: Pint, para3: cint, para4: cint,
para5: PPchar): cint{.importc: "pcre_get_substring",
noconv.}
proc pcre_get_substring_list*(para1: cstring, para2: Pint, para3: cint,
para4: ptr PPchar): cint{.
importc: "pcre_get_substring_list", noconv.}
proc pcre_info*(para1: P, para2: Pint, para3: Pint): cint{.importc: "pcre_info",
noconv.}
proc pcre_maketables*(): ptr byte{.importc: "pcre_maketables", noconv.}
proc pcre_refcount*(para1: P, para2: cint): cint{.importc: "pcre_refcount",
noconv.}
proc pcre_study*(para1: P, para2: cint, para3: ptr CString): Pextra{.
importc: "pcre_study", noconv.}
proc pcre_version*(): CString{.importc: "pcre_version", noconv.}
# Indirection for store get and free functions. These can be set to
# alternative malloc/free functions if required. Special ones are used in the
# non-recursive case for "frames". There is also an optional callout function
# that is triggered by the (?) regex item.
#
# we use Nimrod's memory manager (but not GC!) for these functions:
type
TMalloc = proc (para1: int): pointer{.noconv.}
TFree = proc (para1: pointer){.noconv.}
var
pcre_malloc{.importc: "pcre_malloc".}: TMalloc
pcre_free{.importc: "pcre_free".}: TFree
pcre_stack_malloc{.importc: "pcre_stack_malloc".}: TMalloc
pcre_stack_free{.importc: "pcre_stack_free".}: TFree
pcre_callout{.importc: "pcre_callout".}: proc (para1: Pcallout_block): cint{.
noconv.}
pcre_malloc = cast[TMalloc](system.alloc)
pcre_free = cast[TFree](system.dealloc)
pcre_stack_malloc = cast[TMalloc](system.alloc)
pcre_stack_free = cast[TFree](system.dealloc)
pcre_callout = nil

View File

@@ -1,350 +0,0 @@
# This module contains the definitions for structures and externs for
# functions used by frontend postgres applications. It is based on
# Postgresql's libpq-fe.h.
#
# It is for postgreSQL version 7.4 and higher with support for the v3.0
# connection-protocol.
#
{.deadCodeElim: on.}
when defined(windows):
const
dllName = "pq.dll"
elif defined(macosx):
const
dllName = "libpq.dylib"
else:
const
dllName = "libpq.so(.5|)"
type
POid* = ptr Oid
Oid* = int32
const
ERROR_MSG_LENGTH* = 4096
CMDSTATUS_LEN* = 40
type
TSockAddr* = array[1..112, int8]
TPGresAttDesc*{.pure, final.} = object
name*: cstring
adtid*: Oid
adtsize*: int
PPGresAttDesc* = ptr TPGresAttDesc
PPPGresAttDesc* = ptr PPGresAttDesc
TPGresAttValue*{.pure, final.} = object
length*: int32
value*: cstring
PPGresAttValue* = ptr TPGresAttValue
PPPGresAttValue* = ptr PPGresAttValue
PExecStatusType* = ptr TExecStatusType
TExecStatusType* = enum
PGRES_EMPTY_QUERY = 0, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PGRES_COPY_OUT,
PGRES_COPY_IN, PGRES_BAD_RESPONSE, PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR
TPGlobjfuncs*{.pure, final.} = object
fn_lo_open*: Oid
fn_lo_close*: Oid
fn_lo_creat*: Oid
fn_lo_unlink*: Oid
fn_lo_lseek*: Oid
fn_lo_tell*: Oid
fn_lo_read*: Oid
fn_lo_write*: Oid
PPGlobjfuncs* = ptr TPGlobjfuncs
PConnStatusType* = ptr TConnStatusType
TConnStatusType* = enum
CONNECTION_OK, CONNECTION_BAD, CONNECTION_STARTED, CONNECTION_MADE,
CONNECTION_AWAITING_RESPONSE, CONNECTION_AUTH_OK, CONNECTION_SETENV,
CONNECTION_SSL_STARTUP, CONNECTION_NEEDED
TPGconn*{.pure, final.} = object
pghost*: cstring
pgtty*: cstring
pgport*: cstring
pgoptions*: cstring
dbName*: cstring
status*: TConnStatusType
errorMessage*: array[0..(ERROR_MSG_LENGTH) - 1, char]
Pfin*: TFile
Pfout*: TFile
Pfdebug*: TFile
sock*: int32
laddr*: TSockAddr
raddr*: TSockAddr
salt*: array[0..(2) - 1, char]
asyncNotifyWaiting*: int32
notifyList*: pointer
pguser*: cstring
pgpass*: cstring
lobjfuncs*: PPGlobjfuncs
PPGconn* = ptr TPGconn
TPGresult*{.pure, final.} = object
ntups*: int32
numAttributes*: int32
attDescs*: PPGresAttDesc
tuples*: PPPGresAttValue
tupArrSize*: int32
resultStatus*: TExecStatusType
cmdStatus*: array[0..(CMDSTATUS_LEN) - 1, char]
binary*: int32
conn*: PPGconn
PPGresult* = ptr TPGresult
PPostgresPollingStatusType* = ptr PostgresPollingStatusType
PostgresPollingStatusType* = enum
PGRES_POLLING_FAILED = 0, PGRES_POLLING_READING, PGRES_POLLING_WRITING,
PGRES_POLLING_OK, PGRES_POLLING_ACTIVE
PPGTransactionStatusType* = ptr PGTransactionStatusType
PGTransactionStatusType* = enum
PQTRANS_IDLE, PQTRANS_ACTIVE, PQTRANS_INTRANS, PQTRANS_INERROR,
PQTRANS_UNKNOWN
PPGVerbosity* = ptr PGVerbosity
PGVerbosity* = enum
PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE
PpgNotify* = ptr pgNotify
pgNotify*{.pure, final.} = object
relname*: cstring
be_pid*: int32
extra*: cstring
PQnoticeReceiver* = proc (arg: pointer, res: PPGresult){.cdecl.}
PQnoticeProcessor* = proc (arg: pointer, message: cstring){.cdecl.}
Ppqbool* = ptr pqbool
pqbool* = char
P_PQprintOpt* = ptr PQprintOpt
PQprintOpt*{.pure, final.} = object
header*: pqbool
align*: pqbool
standard*: pqbool
html3*: pqbool
expanded*: pqbool
pager*: pqbool
fieldSep*: cstring
tableOpt*: cstring
caption*: cstring
fieldName*: ptr cstring
P_PQconninfoOption* = ptr PQconninfoOption
PQconninfoOption*{.pure, final.} = object
keyword*: cstring
envvar*: cstring
compiled*: cstring
val*: cstring
label*: cstring
dispchar*: cstring
dispsize*: int32
PPQArgBlock* = ptr PQArgBlock
PQArgBlock*{.pure, final.} = object
length*: int32
isint*: int32
p*: pointer
proc PQconnectStart*(conninfo: cstring): PPGconn{.cdecl, dynlib: dllName,
importc: "PQconnectStart".}
proc PQconnectPoll*(conn: PPGconn): PostgresPollingStatusType{.cdecl,
dynlib: dllName, importc: "PQconnectPoll".}
proc PQconnectdb*(conninfo: cstring): PPGconn{.cdecl, dynlib: dllName,
importc: "PQconnectdb".}
proc PQsetdbLogin*(pghost: cstring, pgport: cstring, pgoptions: cstring,
pgtty: cstring, dbName: cstring, login: cstring, pwd: cstring): PPGconn{.
cdecl, dynlib: dllName, importc: "PQsetdbLogin".}
proc PQsetdb*(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): ppgconn
proc PQfinish*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQfinish".}
proc PQconndefaults*(): PPQconninfoOption{.cdecl, dynlib: dllName,
importc: "PQconndefaults".}
proc PQconninfoFree*(connOptions: PPQconninfoOption){.cdecl, dynlib: dllName,
importc: "PQconninfoFree".}
proc PQresetStart*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQresetStart".}
proc PQresetPoll*(conn: PPGconn): PostgresPollingStatusType{.cdecl,
dynlib: dllName, importc: "PQresetPoll".}
proc PQreset*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQreset".}
proc PQrequestCancel*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQrequestCancel".}
proc PQdb*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQdb".}
proc PQuser*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQuser".}
proc PQpass*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQpass".}
proc PQhost*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQhost".}
proc PQport*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQport".}
proc PQtty*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQtty".}
proc PQoptions*(conn: PPGconn): cstring{.cdecl, dynlib: dllName,
importc: "PQoptions".}
proc PQstatus*(conn: PPGconn): TConnStatusType{.cdecl, dynlib: dllName,
importc: "PQstatus".}
proc PQtransactionStatus*(conn: PPGconn): PGTransactionStatusType{.cdecl,
dynlib: dllName, importc: "PQtransactionStatus".}
proc PQparameterStatus*(conn: PPGconn, paramName: cstring): cstring{.cdecl,
dynlib: dllName, importc: "PQparameterStatus".}
proc PQprotocolVersion*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQprotocolVersion".}
proc PQerrorMessage*(conn: PPGconn): cstring{.cdecl, dynlib: dllName,
importc: "PQerrorMessage".}
proc PQsocket*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQsocket".}
proc PQbackendPID*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQbackendPID".}
proc PQclientEncoding*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQclientEncoding".}
proc PQsetClientEncoding*(conn: PPGconn, encoding: cstring): int32{.cdecl,
dynlib: dllName, importc: "PQsetClientEncoding".}
when defined(USE_SSL):
# Get the SSL structure associated with a connection
proc PQgetssl*(conn: PPGconn): PSSL{.cdecl, dynlib: dllName,
importc: "PQgetssl".}
proc PQsetErrorVerbosity*(conn: PPGconn, verbosity: PGVerbosity): PGVerbosity{.
cdecl, dynlib: dllName, importc: "PQsetErrorVerbosity".}
proc PQtrace*(conn: PPGconn, debug_port: TFile){.cdecl, dynlib: dllName,
importc: "PQtrace".}
proc PQuntrace*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQuntrace".}
proc PQsetNoticeReceiver*(conn: PPGconn, theProc: PQnoticeReceiver, arg: pointer): PQnoticeReceiver{.
cdecl, dynlib: dllName, importc: "PQsetNoticeReceiver".}
proc PQsetNoticeProcessor*(conn: PPGconn, theProc: PQnoticeProcessor,
arg: pointer): PQnoticeProcessor{.cdecl,
dynlib: dllName, importc: "PQsetNoticeProcessor".}
proc PQexec*(conn: PPGconn, query: cstring): PPGresult{.cdecl, dynlib: dllName,
importc: "PQexec".}
proc PQexecParams*(conn: PPGconn, command: cstring, nParams: int32,
paramTypes: POid, paramValues: cstringArray,
paramLengths, paramFormats: ptr int32, resultFormat: int32): PPGresult{.
cdecl, dynlib: dllName, importc: "PQexecParams".}
proc PQexecPrepared*(conn: PPGconn, stmtName: cstring, nParams: int32,
paramValues: cstringArray,
paramLengths, paramFormats: ptr int32, resultFormat: int32): PPGresult{.
cdecl, dynlib: dllName, importc: "PQexecPrepared".}
proc PQsendQuery*(conn: PPGconn, query: cstring): int32{.cdecl, dynlib: dllName,
importc: "PQsendQuery".}
proc PQsendQueryParams*(conn: PPGconn, command: cstring, nParams: int32,
paramTypes: POid, paramValues: cstringArray,
paramLengths, paramFormats: ptr int32,
resultFormat: int32): int32{.cdecl, dynlib: dllName,
importc: "PQsendQueryParams".}
proc PQsendQueryPrepared*(conn: PPGconn, stmtName: cstring, nParams: int32,
paramValues: cstringArray,
paramLengths, paramFormats: ptr int32,
resultFormat: int32): int32{.cdecl, dynlib: dllName,
importc: "PQsendQueryPrepared".}
proc PQgetResult*(conn: PPGconn): PPGresult{.cdecl, dynlib: dllName,
importc: "PQgetResult".}
proc PQisBusy*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQisBusy".}
proc PQconsumeInput*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQconsumeInput".}
proc PQnotifies*(conn: PPGconn): PPGnotify{.cdecl, dynlib: dllName,
importc: "PQnotifies".}
proc PQputCopyData*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{.
cdecl, dynlib: dllName, importc: "PQputCopyData".}
proc PQputCopyEnd*(conn: PPGconn, errormsg: cstring): int32{.cdecl,
dynlib: dllName, importc: "PQputCopyEnd".}
proc PQgetCopyData*(conn: PPGconn, buffer: cstringArray, async: int32): int32{.
cdecl, dynlib: dllName, importc: "PQgetCopyData".}
proc PQgetline*(conn: PPGconn, str: cstring, len: int32): int32{.cdecl,
dynlib: dllName, importc: "PQgetline".}
proc PQputline*(conn: PPGconn, str: cstring): int32{.cdecl, dynlib: dllName,
importc: "PQputline".}
proc PQgetlineAsync*(conn: PPGconn, buffer: cstring, bufsize: int32): int32{.
cdecl, dynlib: dllName, importc: "PQgetlineAsync".}
proc PQputnbytes*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{.cdecl,
dynlib: dllName, importc: "PQputnbytes".}
proc PQendcopy*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQendcopy".}
proc PQsetnonblocking*(conn: PPGconn, arg: int32): int32{.cdecl,
dynlib: dllName, importc: "PQsetnonblocking".}
proc PQisnonblocking*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQisnonblocking".}
proc PQflush*(conn: PPGconn): int32{.cdecl, dynlib: dllName, importc: "PQflush".}
proc PQfn*(conn: PPGconn, fnid: int32, result_buf, result_len: ptr int32,
result_is_int: int32, args: PPQArgBlock, nargs: int32): PPGresult{.
cdecl, dynlib: dllName, importc: "PQfn".}
proc PQresultStatus*(res: PPGresult): TExecStatusType{.cdecl, dynlib: dllName,
importc: "PQresultStatus".}
proc PQresStatus*(status: TExecStatusType): cstring{.cdecl, dynlib: dllName,
importc: "PQresStatus".}
proc PQresultErrorMessage*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
importc: "PQresultErrorMessage".}
proc PQresultErrorField*(res: PPGresult, fieldcode: int32): cstring{.cdecl,
dynlib: dllName, importc: "PQresultErrorField".}
proc PQntuples*(res: PPGresult): int32{.cdecl, dynlib: dllName,
importc: "PQntuples".}
proc PQnfields*(res: PPGresult): int32{.cdecl, dynlib: dllName,
importc: "PQnfields".}
proc PQbinaryTuples*(res: PPGresult): int32{.cdecl, dynlib: dllName,
importc: "PQbinaryTuples".}
proc PQfname*(res: PPGresult, field_num: int32): cstring{.cdecl,
dynlib: dllName, importc: "PQfname".}
proc PQfnumber*(res: PPGresult, field_name: cstring): int32{.cdecl,
dynlib: dllName, importc: "PQfnumber".}
proc PQftable*(res: PPGresult, field_num: int32): Oid{.cdecl, dynlib: dllName,
importc: "PQftable".}
proc PQftablecol*(res: PPGresult, field_num: int32): int32{.cdecl,
dynlib: dllName, importc: "PQftablecol".}
proc PQfformat*(res: PPGresult, field_num: int32): int32{.cdecl,
dynlib: dllName, importc: "PQfformat".}
proc PQftype*(res: PPGresult, field_num: int32): Oid{.cdecl, dynlib: dllName,
importc: "PQftype".}
proc PQfsize*(res: PPGresult, field_num: int32): int32{.cdecl, dynlib: dllName,
importc: "PQfsize".}
proc PQfmod*(res: PPGresult, field_num: int32): int32{.cdecl, dynlib: dllName,
importc: "PQfmod".}
proc PQcmdStatus*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
importc: "PQcmdStatus".}
proc PQoidStatus*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
importc: "PQoidStatus".}
proc PQoidValue*(res: PPGresult): Oid{.cdecl, dynlib: dllName,
importc: "PQoidValue".}
proc PQcmdTuples*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
importc: "PQcmdTuples".}
proc PQgetvalue*(res: PPGresult, tup_num: int32, field_num: int32): cstring{.
cdecl, dynlib: dllName, importc: "PQgetvalue".}
proc PQgetlength*(res: PPGresult, tup_num: int32, field_num: int32): int32{.
cdecl, dynlib: dllName, importc: "PQgetlength".}
proc PQgetisnull*(res: PPGresult, tup_num: int32, field_num: int32): int32{.
cdecl, dynlib: dllName, importc: "PQgetisnull".}
proc PQclear*(res: PPGresult){.cdecl, dynlib: dllName, importc: "PQclear".}
proc PQfreemem*(p: pointer){.cdecl, dynlib: dllName, importc: "PQfreemem".}
proc PQmakeEmptyPGresult*(conn: PPGconn, status: TExecStatusType): PPGresult{.
cdecl, dynlib: dllName, importc: "PQmakeEmptyPGresult".}
proc PQescapeString*(till, `from`: cstring, len: int): int{.cdecl,
dynlib: dllName, importc: "PQescapeString".}
proc PQescapeBytea*(bintext: cstring, binlen: int, bytealen: var int): cstring{.
cdecl, dynlib: dllName, importc: "PQescapeBytea".}
proc PQunescapeBytea*(strtext: cstring, retbuflen: var int): cstring{.cdecl,
dynlib: dllName, importc: "PQunescapeBytea".}
proc PQprint*(fout: TFile, res: PPGresult, ps: PPQprintOpt){.cdecl,
dynlib: dllName, importc: "PQprint".}
proc PQdisplayTuples*(res: PPGresult, fp: TFile, fillAlign: int32,
fieldSep: cstring, printHeader: int32, quiet: int32){.
cdecl, dynlib: dllName, importc: "PQdisplayTuples".}
proc PQprintTuples*(res: PPGresult, fout: TFile, printAttName: int32,
terseOutput: int32, width: int32){.cdecl, dynlib: dllName,
importc: "PQprintTuples".}
proc lo_open*(conn: PPGconn, lobjId: Oid, mode: int32): int32{.cdecl,
dynlib: dllName, importc: "lo_open".}
proc lo_close*(conn: PPGconn, fd: int32): int32{.cdecl, dynlib: dllName,
importc: "lo_close".}
proc lo_read*(conn: PPGconn, fd: int32, buf: cstring, length: int): int32{.
cdecl, dynlib: dllName, importc: "lo_read".}
proc lo_write*(conn: PPGconn, fd: int32, buf: cstring, length: int): int32{.
cdecl, dynlib: dllName, importc: "lo_write".}
proc lo_lseek*(conn: PPGconn, fd: int32, offset: int32, whence: int32): int32{.
cdecl, dynlib: dllName, importc: "lo_lseek".}
proc lo_creat*(conn: PPGconn, mode: int32): Oid{.cdecl, dynlib: dllName,
importc: "lo_creat".}
proc lo_tell*(conn: PPGconn, fd: int32): int32{.cdecl, dynlib: dllName,
importc: "lo_tell".}
proc lo_unlink*(conn: PPGconn, lobjId: Oid): int32{.cdecl, dynlib: dllName,
importc: "lo_unlink".}
proc lo_import*(conn: PPGconn, filename: cstring): Oid{.cdecl, dynlib: dllName,
importc: "lo_import".}
proc lo_export*(conn: PPGconn, lobjId: Oid, filename: cstring): int32{.cdecl,
dynlib: dllName, importc: "lo_export".}
proc PQmblen*(s: cstring, encoding: int32): int32{.cdecl, dynlib: dllName,
importc: "PQmblen".}
proc PQenv2encoding*(): int32{.cdecl, dynlib: dllName, importc: "PQenv2encoding".}
proc PQsetdb(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): ppgconn =
result = PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, "", "")

File diff suppressed because it is too large Load Diff

View File

@@ -1,452 +0,0 @@
#
# $Id: sdl_gfx.pas,v 1.3 2007/05/29 21:31:04 savage Exp $
#
#
#
# $Log: sdl_gfx.pas,v $
# Revision 1.3 2007/05/29 21:31:04 savage
# Changes as suggested by Almindor for 64bit compatibility.
#
# Revision 1.2 2007/05/20 20:30:18 savage
# Initial Changes to Handle 64 Bits
#
# Revision 1.1 2005/01/03 19:08:32 savage
# Header for the SDL_Gfx library.
#
#
#
#
import
sdl
when defined(windows):
const
gfxLibName = "SDL_gfx.dll"
elif defined(macosx):
const
gfxLibName = "libSDL_gfx.dylib"
else:
const
gfxLibName = "libSDL_gfx.so"
const # Some rates in Hz
FPS_UPPER_LIMIT* = 200
FPS_LOWER_LIMIT* = 1
FPS_DEFAULT* = 30 # ---- Defines
SMOOTHING_OFF* = 0
SMOOTHING_ON* = 1
type
PFPSmanager* = ptr TFPSmanager
TFPSmanager*{.final.} = object # ---- Structures
framecount*: Uint32
rateticks*: float32
lastticks*: Uint32
rate*: Uint32
PColorRGBA* = ptr TColorRGBA
TColorRGBA*{.final.} = object
r*: Uint8
g*: Uint8
b*: Uint8
a*: Uint8
PColorY* = ptr TColorY
TColorY*{.final.} = object #
#
# SDL_framerate: framerate manager
#
# LGPL (c) A. Schiffler
#
#
y*: Uint8
proc initFramerate*(manager: PFPSmanager){.cdecl, importc: "SDL_initFramerate",
dynlib: gfxLibName.}
proc setFramerate*(manager: PFPSmanager, rate: int): int{.cdecl,
importc: "SDL_setFramerate", dynlib: gfxLibName.}
proc getFramerate*(manager: PFPSmanager): int{.cdecl,
importc: "SDL_getFramerate", dynlib: gfxLibName.}
proc framerateDelay*(manager: PFPSmanager){.cdecl,
importc: "SDL_framerateDelay", dynlib: gfxLibName.}
#
#
# SDL_gfxPrimitives: graphics primitives for SDL
#
# LGPL (c) A. Schiffler
#
#
# Note: all ___Color routines expect the color to be in format 0xRRGGBBAA
# Pixel
proc pixelColor*(dst: PSurface, x: Sint16, y: Sint16, color: Uint32): int{.
cdecl, importc: "pixelColor", dynlib: gfxLibName.}
proc pixelRGBA*(dst: PSurface, x: Sint16, y: Sint16, r: Uint8, g: Uint8,
b: Uint8, a: Uint8): int{.cdecl, importc: "pixelRGBA",
dynlib: gfxLibName.}
# Horizontal line
proc hlineColor*(dst: PSurface, x1: Sint16, x2: Sint16, y: Sint16, color: Uint32): int{.
cdecl, importc: "hlineColor", dynlib: gfxLibName.}
proc hlineRGBA*(dst: PSurface, x1: Sint16, x2: Sint16, y: Sint16, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl, importc: "hlineRGBA",
dynlib: gfxLibName.}
# Vertical line
proc vlineColor*(dst: PSurface, x: Sint16, y1: Sint16, y2: Sint16, color: Uint32): int{.
cdecl, importc: "vlineColor", dynlib: gfxLibName.}
proc vlineRGBA*(dst: PSurface, x: Sint16, y1: Sint16, y2: Sint16, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl, importc: "vlineRGBA",
dynlib: gfxLibName.}
# Rectangle
proc rectangleColor*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, color: Uint32): int{.cdecl,
importc: "rectangleColor", dynlib: gfxLibName.}
proc rectangleRGBA*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc: "rectangleRGBA", dynlib: gfxLibName.}
# Filled rectangle (Box)
proc boxColor*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
color: Uint32): int{.cdecl, importc: "boxColor",
dynlib: gfxLibName.}
proc boxRGBA*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "boxRGBA", dynlib: gfxLibName.}
# Line
proc lineColor*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
color: Uint32): int{.cdecl, importc: "lineColor",
dynlib: gfxLibName.}
proc lineRGBA*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "lineRGBA", dynlib: gfxLibName.}
# AA Line
proc aalineColor*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
color: Uint32): int{.cdecl, importc: "aalineColor",
dynlib: gfxLibName.}
proc aalineRGBA*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "aalineRGBA", dynlib: gfxLibName.}
# Circle
proc circleColor*(dst: PSurface, x: Sint16, y: Sint16, r: Sint16, color: Uint32): int{.
cdecl, importc: "circleColor", dynlib: gfxLibName.}
proc circleRGBA*(dst: PSurface, x: Sint16, y: Sint16, rad: Sint16, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "circleRGBA", dynlib: gfxLibName.}
# AA Circle
proc aacircleColor*(dst: PSurface, x: Sint16, y: Sint16, r: Sint16,
color: Uint32): int{.cdecl, importc: "aacircleColor",
dynlib: gfxLibName.}
proc aacircleRGBA*(dst: PSurface, x: Sint16, y: Sint16, rad: Sint16, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "aacircleRGBA", dynlib: gfxLibName.}
# Filled Circle
proc filledCircleColor*(dst: PSurface, x: Sint16, y: Sint16, r: Sint16,
color: Uint32): int{.cdecl,
importc: "filledCircleColor", dynlib: gfxLibName.}
proc filledCircleRGBA*(dst: PSurface, x: Sint16, y: Sint16, rad: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "filledCircleRGBA", dynlib: gfxLibName.}
# Ellipse
proc ellipseColor*(dst: PSurface, x: Sint16, y: Sint16, rx: Sint16, ry: Sint16,
color: Uint32): int{.cdecl, importc: "ellipseColor",
dynlib: gfxLibName.}
proc ellipseRGBA*(dst: PSurface, x: Sint16, y: Sint16, rx: Sint16, ry: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "ellipseRGBA", dynlib: gfxLibName.}
# AA Ellipse
proc aaellipseColor*(dst: PSurface, xc: Sint16, yc: Sint16, rx: Sint16,
ry: Sint16, color: Uint32): int{.cdecl,
importc: "aaellipseColor", dynlib: gfxLibName.}
proc aaellipseRGBA*(dst: PSurface, x: Sint16, y: Sint16, rx: Sint16, ry: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "aaellipseRGBA", dynlib: gfxLibName.}
# Filled Ellipse
proc filledEllipseColor*(dst: PSurface, x: Sint16, y: Sint16, rx: Sint16,
ry: Sint16, color: Uint32): int{.cdecl,
importc: "filledEllipseColor", dynlib: gfxLibName.}
proc filledEllipseRGBA*(dst: PSurface, x: Sint16, y: Sint16, rx: Sint16,
ry: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc: "filledEllipseRGBA", dynlib: gfxLibName.}
# Pie
proc pieColor*(dst: PSurface, x: Sint16, y: Sint16, rad: Sint16, start: Sint16,
finish: Sint16, color: Uint32): int{.cdecl, importc: "pieColor",
dynlib: gfxLibName.}
proc pieRGBA*(dst: PSurface, x: Sint16, y: Sint16, rad: Sint16, start: Sint16,
finish: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc: "pieRGBA", dynlib: gfxLibName.}
# Filled Pie
proc filledPieColor*(dst: PSurface, x: Sint16, y: Sint16, rad: Sint16,
start: Sint16, finish: Sint16, color: Uint32): int{.cdecl,
importc: "filledPieColor", dynlib: gfxLibName.}
proc filledPieRGBA*(dst: PSurface, x: Sint16, y: Sint16, rad: Sint16,
start: Sint16, finish: Sint16, r: Uint8, g: Uint8, b: Uint8,
a: Uint8): int{.cdecl, importc: "filledPieRGBA",
dynlib: gfxLibName.}
# Trigon
proc trigonColor*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
x3: Sint16, y3: Sint16, color: Uint32): int{.cdecl,
importc: "trigonColor", dynlib: gfxLibName.}
proc trigonRGBA*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
x3: Sint16, y3: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc: "trigonRGBA", dynlib: gfxLibName.}
# AA-Trigon
proc aatrigonColor*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, color: Uint32): int{.
cdecl, importc: "aatrigonColor", dynlib: gfxLibName.}
proc aatrigonRGBA*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, r: Uint8, g: Uint8,
b: Uint8, a: Uint8): int{.cdecl, importc: "aatrigonRGBA",
dynlib: gfxLibName.}
# Filled Trigon
proc filledTrigonColor*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, color: Uint32): int{.
cdecl, importc: "filledTrigonColor", dynlib: gfxLibName.}
proc filledTrigonRGBA*(dst: PSurface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, r: Uint8, g: Uint8,
b: Uint8, a: Uint8): int{.cdecl,
importc: "filledTrigonRGBA", dynlib: gfxLibName.}
# Polygon
proc polygonColor*(dst: PSurface, vx: PSint16, vy: PSint16, n: int,
color: Uint32): int{.cdecl, importc: "polygonColor",
dynlib: gfxLibName.}
proc polygonRGBA*(dst: PSurface, vx: PSint16, vy: PSint16, n: int, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "polygonRGBA", dynlib: gfxLibName.}
# AA-Polygon
proc aapolygonColor*(dst: PSurface, vx: PSint16, vy: PSint16, n: int,
color: Uint32): int{.cdecl, importc: "aapolygonColor",
dynlib: gfxLibName.}
proc aapolygonRGBA*(dst: PSurface, vx: PSint16, vy: PSint16, n: int, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "aapolygonRGBA", dynlib: gfxLibName.}
# Filled Polygon
proc filledPolygonColor*(dst: PSurface, vx: PSint16, vy: PSint16, n: int,
color: Uint32): int{.cdecl,
importc: "filledPolygonColor", dynlib: gfxLibName.}
proc filledPolygonRGBA*(dst: PSurface, vx: PSint16, vy: PSint16, n: int,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "filledPolygonRGBA", dynlib: gfxLibName.}
# Bezier
# s = number of steps
proc bezierColor*(dst: PSurface, vx: PSint16, vy: PSint16, n: int, s: int,
color: Uint32): int{.cdecl, importc: "bezierColor",
dynlib: gfxLibName.}
proc bezierRGBA*(dst: PSurface, vx: PSint16, vy: PSint16, n: int, s: int,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "bezierRGBA", dynlib: gfxLibName.}
# Characters/Strings
proc characterColor*(dst: PSurface, x: Sint16, y: Sint16, c: char, color: Uint32): int{.
cdecl, importc: "characterColor", dynlib: gfxLibName.}
proc characterRGBA*(dst: PSurface, x: Sint16, y: Sint16, c: char, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "characterRGBA", dynlib: gfxLibName.}
proc stringColor*(dst: PSurface, x: Sint16, y: Sint16, c: cstring, color: Uint32): int{.
cdecl, importc: "stringColor", dynlib: gfxLibName.}
proc stringRGBA*(dst: PSurface, x: Sint16, y: Sint16, c: cstring, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc: "stringRGBA", dynlib: gfxLibName.}
proc gfxPrimitivesSetFont*(fontdata: Pointer, cw: int, ch: int){.cdecl,
importc: "gfxPrimitivesSetFont", dynlib: gfxLibName.}
#
#
# SDL_imageFilter - bytes-image "filter" routines
# (uses inline x86 MMX optimizations if available)
#
# LGPL (c) A. Schiffler
#
#
# Comments:
# 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary.
# 2.) Data that is not within an 8 byte boundary is processed using the C routine.
# 3.) Convolution routines do not have C routines at this time.
# Detect MMX capability in CPU
proc imageFilterMMXdetect*(): int{.cdecl, importc: "SDL_imageFilterMMXdetect",
dynlib: gfxLibName.}
# Force use of MMX off (or turn possible use back on)
proc imageFilterMMXoff*(){.cdecl, importc: "SDL_imageFilterMMXoff",
dynlib: gfxLibName.}
proc imageFilterMMXon*(){.cdecl, importc: "SDL_imageFilterMMXon",
dynlib: gfxLibName.}
#
# All routines return:
# 0 OK
# -1 Error (internal error, parameter error)
#
# SDL_imageFilterAdd: D = saturation255(S1 + S2)
proc imageFilterAdd*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterAdd", dynlib: gfxLibName.}
# SDL_imageFilterMean: D = S1/2 + S2/2
proc imageFilterMean*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterMean", dynlib: gfxLibName.}
# SDL_imageFilterSub: D = saturation0(S1 - S2)
proc imageFilterSub*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterSub", dynlib: gfxLibName.}
# SDL_imageFilterAbsDiff: D = | S1 - S2 |
proc imageFilterAbsDiff*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterAbsDiff", dynlib: gfxLibName.}
# SDL_imageFilterMult: D = saturation(S1 * S2)
proc imageFilterMult*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterMult", dynlib: gfxLibName.}
# SDL_imageFilterMultNor: D = S1 * S2 (non-MMX)
proc imageFilterMultNor*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterMultNor", dynlib: gfxLibName.}
# SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
proc imageFilterMultDivby2*(Src1: cstring, Src2: cstring, Dest: cstring,
len: int): int{.cdecl,
importc: "SDL_imageFilterMultDivby2", dynlib: gfxLibName.}
# SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
proc imageFilterMultDivby4*(Src1: cstring, Src2: cstring, Dest: cstring,
len: int): int{.cdecl,
importc: "SDL_imageFilterMultDivby4", dynlib: gfxLibName.}
# SDL_imageFilterBitAnd: D = S1 & S2
proc imageFilterBitAnd*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterBitAnd", dynlib: gfxLibName.}
# SDL_imageFilterBitOr: D = S1 | S2
proc imageFilterBitOr*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterBitOr", dynlib: gfxLibName.}
# SDL_imageFilterDiv: D = S1 / S2 (non-MMX)
proc imageFilterDiv*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterDiv", dynlib: gfxLibName.}
# SDL_imageFilterBitNegation: D = !S
proc imageFilterBitNegation*(Src1: cstring, Dest: cstring, len: int): int{.
cdecl, importc: "SDL_imageFilterBitNegation", dynlib: gfxLibName.}
# SDL_imageFilterAddByte: D = saturation255(S + C)
proc imageFilterAddByte*(Src1: cstring, Dest: cstring, len: int, C: char): int{.
cdecl, importc: "SDL_imageFilterAddByte", dynlib: gfxLibName.}
# SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
proc imageFilterAddUint*(Src1: cstring, Dest: cstring, len: int, C: int): int{.
cdecl, importc: "SDL_imageFilterAddUint", dynlib: gfxLibName.}
# SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
proc imageFilterAddByteToHalf*(Src1: cstring, Dest: cstring, len: int, C: char): int{.
cdecl, importc: "SDL_imageFilterAddByteToHalf", dynlib: gfxLibName.}
# SDL_imageFilterSubByte: D = saturation0(S - C)
proc imageFilterSubByte*(Src1: cstring, Dest: cstring, len: int, C: char): int{.
cdecl, importc: "SDL_imageFilterSubByte", dynlib: gfxLibName.}
# SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
proc imageFilterSubUint*(Src1: cstring, Dest: cstring, len: int, C: int): int{.
cdecl, importc: "SDL_imageFilterSubUint", dynlib: gfxLibName.}
# SDL_imageFilterShiftRight: D = saturation0(S >> N)
proc imageFilterShiftRight*(Src1: cstring, Dest: cstring, len: int, N: char): int{.
cdecl, importc: "SDL_imageFilterShiftRight", dynlib: gfxLibName.}
# SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
proc imageFilterShiftRightUint*(Src1: cstring, Dest: cstring, len: int, N: char): int{.
cdecl, importc: "SDL_imageFilterShiftRightUint", dynlib: gfxLibName.}
# SDL_imageFilterMultByByte: D = saturation255(S * C)
proc imageFilterMultByByte*(Src1: cstring, Dest: cstring, len: int, C: char): int{.
cdecl, importc: "SDL_imageFilterMultByByte", dynlib: gfxLibName.}
# SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
proc imageFilterShiftRightAndMultByByte*(Src1: cstring, Dest: cstring, len: int,
N: char, C: char): int{.cdecl,
importc: "SDL_imageFilterShiftRightAndMultByByte",
dynlib: gfxLibName.}
# SDL_imageFilterShiftLeftByte: D = (S << N)
proc imageFilterShiftLeftByte*(Src1: cstring, Dest: cstring, len: int, N: char): int{.
cdecl, importc: "SDL_imageFilterShiftLeftByte", dynlib: gfxLibName.}
# SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
proc imageFilterShiftLeftUint*(Src1: cstring, Dest: cstring, len: int, N: char): int{.
cdecl, importc: "SDL_imageFilterShiftLeftUint", dynlib: gfxLibName.}
# SDL_imageFilterShiftLeft: D = saturation255(S << N)
proc imageFilterShiftLeft*(Src1: cstring, Dest: cstring, len: int, N: char): int{.
cdecl, importc: "SDL_imageFilterShiftLeft", dynlib: gfxLibName.}
# SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
proc imageFilterBinarizeUsingThreshold*(Src1: cstring, Dest: cstring, len: int,
T: char): int{.cdecl,
importc: "SDL_imageFilterBinarizeUsingThreshold", dynlib: gfxLibName.}
# SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
proc imageFilterClipToRange*(Src1: cstring, Dest: cstring, len: int, Tmin: int8,
Tmax: int8): int{.cdecl,
importc: "SDL_imageFilterClipToRange", dynlib: gfxLibName.}
# SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
proc imageFilterNormalizeLinear*(Src1: cstring, Dest: cstring, len: int,
Cmin: int, Cmax: int, Nmin: int, Nmax: int): int{.
cdecl, importc: "SDL_imageFilterNormalizeLinear", dynlib: gfxLibName.}
# !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!!
# SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... )
proc imageFilterConvolveKernel3x3Divide*(Src: cstring, Dest: cstring, rows: int,
columns: int, Kernel: PShortInt, Divisor: int8): int{.cdecl,
importc: "SDL_imageFilterConvolveKernel3x3Divide", dynlib: gfxLibName.}
# SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... )
proc imageFilterConvolveKernel5x5Divide*(Src: cstring, Dest: cstring, rows: int,
columns: int, Kernel: PShortInt, Divisor: int8): int{.cdecl,
importc: "SDL_imageFilterConvolveKernel5x5Divide", dynlib: gfxLibName.}
# SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... )
proc imageFilterConvolveKernel7x7Divide*(Src: cstring, Dest: cstring, rows: int,
columns: int, Kernel: PShortInt, Divisor: int8): int{.cdecl,
importc: "SDL_imageFilterConvolveKernel7x7Divide", dynlib: gfxLibName.}
# SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... )
proc imageFilterConvolveKernel9x9Divide*(Src: cstring, Dest: cstring, rows: int,
columns: int, Kernel: PShortInt, Divisor: int8): int{.cdecl,
importc: "SDL_imageFilterConvolveKernel9x9Divide", dynlib: gfxLibName.}
# SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
proc imageFilterConvolveKernel3x3ShiftRight*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, NRightShift: char): int{.cdecl,
importc: "SDL_imageFilterConvolveKernel3x3ShiftRight", dynlib: gfxLibName.}
# SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
proc imageFilterConvolveKernel5x5ShiftRight*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, NRightShift: char): int{.cdecl,
importc: "SDL_imageFilterConvolveKernel5x5ShiftRight", dynlib: gfxLibName.}
# SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
proc imageFilterConvolveKernel7x7ShiftRight*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, NRightShift: char): int{.cdecl,
importc: "SDL_imageFilterConvolveKernel7x7ShiftRight", dynlib: gfxLibName.}
# SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... )
proc imageFilterConvolveKernel9x9ShiftRight*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, NRightShift: char): int{.cdecl,
importc: "SDL_imageFilterConvolveKernel9x9ShiftRight", dynlib: gfxLibName.}
# SDL_imageFilterSobelX: Dij = saturation255( ... )
proc imageFilterSobelX*(Src: cstring, Dest: cstring, rows: int, columns: int): int{.
cdecl, importc: "SDL_imageFilterSobelX", dynlib: gfxLibName.}
# SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... )
proc imageFilterSobelXShiftRight*(Src: cstring, Dest: cstring, rows: int,
columns: int, NRightShift: char): int{.cdecl,
importc: "SDL_imageFilterSobelXShiftRight", dynlib: gfxLibName.}
# Align/restore stack to 32 byte boundary -- Functionality untested! --
proc imageFilterAlignStack*(){.cdecl, importc: "SDL_imageFilterAlignStack",
dynlib: gfxLibName.}
proc imageFilterRestoreStack*(){.cdecl, importc: "SDL_imageFilterRestoreStack",
dynlib: gfxLibName.}
#
#
# SDL_rotozoom - rotozoomer
#
# LGPL (c) A. Schiffler
#
#
#
#
# rotozoomSurface()
#
# Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
# 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
# then the destination 32bit surface is anti-aliased. If the surface is not 8bit
# or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
#
#
proc rotozoomSurface*(src: PSurface, angle: float64, zoom: float64, smooth: int): PSurface{.
cdecl, importc: "rotozoomSurface", dynlib: gfxLibName.}
proc rotozoomSurfaceXY*(src: PSurface, angle: float64, zoomx: float64,
zoomy: float64, smooth: int): PSurface{.cdecl,
importc: "rotozoomSurfaceXY", dynlib: gfxLibName.}
# Returns the size of the target surface for a rotozoomSurface() call
proc rotozoomSurfaceSize*(width: int, height: int, angle: float64,
zoom: float64, dstwidth: var int, dstheight: var int){.
cdecl, importc: "rotozoomSurfaceSize", dynlib: gfxLibName.}
proc rotozoomSurfaceSizeXY*(width: int, height: int, angle: float64,
zoomx: float64, zoomy: float64, dstwidth: var int,
dstheight: var int){.cdecl,
importc: "rotozoomSurfaceSizeXY", dynlib: gfxLibName.}
#
#
# zoomSurface()
#
# Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
# 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
# then the destination 32bit surface is anti-aliased. If the surface is not 8bit
# or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
#
#
proc zoomSurface*(src: PSurface, zoomx: float64, zoomy: float64, smooth: int): PSurface{.
cdecl, importc: "zoomSurface", dynlib: gfxLibName.}
# Returns the size of the target surface for a zoomSurface() call
proc zoomSurfaceSize*(width: int, height: int, zoomx: float64, zoomy: float64,
dstwidth: var int, dstheight: var int){.cdecl,
importc: "zoomSurfaceSize", dynlib: gfxLibName.}
# implementation

View File

@@ -1,232 +0,0 @@
#
# $Id: sdl_image.pas,v 1.14 2007/05/29 21:31:13 savage Exp $
#
#
#******************************************************************************
#
# Borland Delphi SDL_Image - An example image loading library for use
# with SDL
# Conversion of the Simple DirectMedia Layer Image Headers
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : SDL_image.h
#
# The initial developer of this Pascal code was :
# Matthias Thoma <ma.thoma@gmx.de>
#
# Portions created by Matthias Thoma are
# Copyright (C) 2000 - 2001 Matthias Thoma.
#
#
# Contributor(s)
# --------------
# Dominique Louis <Dominique@SavageSoftware.com.au>
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
# A simple library to load images of various formats as SDL surfaces
#
# Requires
# --------
# SDL.pas in your search path.
#
# Programming Notes
# -----------------
# See the Aliens Demo on how to make use of this libaray
#
# Revision History
# ----------------
# April 02 2001 - MT : Initial Translation
#
# May 08 2001 - DL : Added ExternalSym derectives and copyright header
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: sdl_image.pas,v $
# Revision 1.14 2007/05/29 21:31:13 savage
# Changes as suggested by Almindor for 64bit compatibility.
#
# Revision 1.13 2007/05/20 20:30:54 savage
# Initial Changes to Handle 64 Bits
#
# Revision 1.12 2006/12/02 00:14:40 savage
# Updated to latest version
#
# Revision 1.11 2005/04/10 18:22:59 savage
# Changes as suggested by Michalis, thanks.
#
# Revision 1.10 2005/04/10 11:48:33 savage
# Changes as suggested by Michalis, thanks.
#
# Revision 1.9 2005/01/05 01:47:07 savage
# Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
#
# Revision 1.8 2005/01/04 23:14:44 savage
# Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
#
# Revision 1.7 2005/01/01 02:03:12 savage
# Updated to v1.2.4
#
# Revision 1.6 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.5 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.4 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.3 2004/04/01 20:53:23 savage
# Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/14 23:35:42 savage
# version 1 of sdl_image, sdl_mixer and smpeg.
#
#
#
#******************************************************************************
import
sdl
when defined(windows):
const
ImageLibName = "SDL_Image.dll"
elif defined(macosx):
const
ImageLibName = "libSDL_image-1.2.0.dylib"
else:
const
ImageLibName = "libSDL_image.so"
const
IMAGE_MAJOR_VERSION* = 1'i8
IMAGE_MINOR_VERSION* = 2'i8
IMAGE_PATCHLEVEL* = 5'i8
# This macro can be used to fill a version structure with the compile-time
# version of the SDL_image library.
proc IMAGE_VERSION*(X: var TVersion)
# This function gets the version of the dynamically linked SDL_image library.
# it should NOT be used to fill a version structure, instead you should
# use the SDL_IMAGE_VERSION() macro.
#
proc IMG_Linked_Version*(): Pversion{.importc: "IMG_Linked_Version",
dynlib: ImageLibName.}
# Load an image from an SDL data source.
# The 'type' may be one of: "BMP", "GIF", "PNG", etc.
#
# If the image format supports a transparent pixel, SDL will set the
# colorkey for the surface. You can enable RLE acceleration on the
# surface afterwards by calling:
# SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey);
#
proc IMG_LoadTyped_RW*(src: PRWops, freesrc: int, theType: cstring): PSurface{.
cdecl, importc: "IMG_LoadTyped_RW", dynlib: ImageLibName.}
# Convenience functions
proc IMG_Load*(theFile: cstring): PSurface{.cdecl, importc: "IMG_Load",
dynlib: ImageLibName.}
proc IMG_Load_RW*(src: PRWops, freesrc: int): PSurface{.cdecl,
importc: "IMG_Load_RW", dynlib: ImageLibName.}
# Invert the alpha of a surface for use with OpenGL
# This function is now a no-op, and only provided for backwards compatibility.
proc IMG_InvertAlpha*(theOn: int): int{.cdecl, importc: "IMG_InvertAlpha",
dynlib: ImageLibName.}
# Functions to detect a file type, given a seekable source
proc IMG_isBMP*(src: PRWops): int{.cdecl, importc: "IMG_isBMP",
dynlib: ImageLibName.}
proc IMG_isGIF*(src: PRWops): int{.cdecl, importc: "IMG_isGIF",
dynlib: ImageLibName.}
proc IMG_isJPG*(src: PRWops): int{.cdecl, importc: "IMG_isJPG",
dynlib: ImageLibName.}
proc IMG_isLBM*(src: PRWops): int{.cdecl, importc: "IMG_isLBM",
dynlib: ImageLibName.}
proc IMG_isPCX*(src: PRWops): int{.cdecl, importc: "IMG_isPCX",
dynlib: ImageLibName.}
proc IMG_isPNG*(src: PRWops): int{.cdecl, importc: "IMG_isPNG",
dynlib: ImageLibName.}
proc IMG_isPNM*(src: PRWops): int{.cdecl, importc: "IMG_isPNM",
dynlib: ImageLibName.}
proc IMG_isTIF*(src: PRWops): int{.cdecl, importc: "IMG_isTIF",
dynlib: ImageLibName.}
proc IMG_isXCF*(src: PRWops): int{.cdecl, importc: "IMG_isXCF",
dynlib: ImageLibName.}
proc IMG_isXPM*(src: PRWops): int{.cdecl, importc: "IMG_isXPM",
dynlib: ImageLibName.}
proc IMG_isXV*(src: PRWops): int{.cdecl, importc: "IMG_isXV",
dynlib: ImageLibName.}
# Individual loading functions
proc IMG_LoadBMP_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadBMP_RW",
dynlib: ImageLibName.}
proc IMG_LoadGIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadGIF_RW",
dynlib: ImageLibName.}
proc IMG_LoadJPG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadJPG_RW",
dynlib: ImageLibName.}
proc IMG_LoadLBM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadLBM_RW",
dynlib: ImageLibName.}
proc IMG_LoadPCX_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPCX_RW",
dynlib: ImageLibName.}
proc IMG_LoadPNM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNM_RW",
dynlib: ImageLibName.}
proc IMG_LoadPNG_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadPNG_RW",
dynlib: ImageLibName.}
proc IMG_LoadTGA_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTGA_RW",
dynlib: ImageLibName.}
proc IMG_LoadTIF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadTIF_RW",
dynlib: ImageLibName.}
proc IMG_LoadXCF_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXCF_RW",
dynlib: ImageLibName.}
proc IMG_LoadXPM_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXPM_RW",
dynlib: ImageLibName.}
proc IMG_LoadXV_RW*(src: PRWops): PSurface{.cdecl, importc: "IMG_LoadXV_RW",
dynlib: ImageLibName.}
proc IMG_ReadXPMFromArray*(xpm: cstringArray): PSurface{.cdecl,
importc: "IMG_ReadXPMFromArray", dynlib: ImageLibName.}
proc IMAGE_VERSION(X: var TVersion) =
X.major = IMAGE_MAJOR_VERSION
X.minor = IMAGE_MINOR_VERSION
X.patch = IMAGE_PATCHLEVEL

View File

@@ -1,483 +0,0 @@
#******************************************************************************
#
# $Id: sdl_mixer.pas,v 1.18 2007/05/29 21:31:44 savage Exp $
#
#
#
# Borland Delphi SDL_Mixer - Simple DirectMedia Layer Mixer Library
# Conversion of the Simple DirectMedia Layer Headers
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : SDL_mixer.h
# music_cmd.h
# wavestream.h
# timidity.h
# playmidi.h
# music_ogg.h
# mikmod.h
#
# The initial developer of this Pascal code was :
# Dominqiue Louis <Dominique@SavageSoftware.com.au>
#
# Portions created by Dominqiue Louis are
# Copyright (C) 2000 - 2001 Dominqiue Louis.
#
#
# Contributor(s)
# --------------
# Matthias Thoma <ma.thoma@gmx.de>
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
#
#
#
#
#
#
#
# Requires
# --------
# SDL.pas & SMPEG.pas somewhere within your search path.
#
# Programming Notes
# -----------------
# See the Aliens Demo to see how this library is used
#
# Revision History
# ----------------
# April 02 2001 - DL : Initial Translation
#
# February 02 2002 - DL : Update to version 1.2.1
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: sdl_mixer.pas,v $
# Revision 1.18 2007/05/29 21:31:44 savage
# Changes as suggested by Almindor for 64bit compatibility.
#
# Revision 1.17 2007/05/20 20:31:17 savage
# Initial Changes to Handle 64 Bits
#
# Revision 1.16 2006/12/02 00:16:17 savage
# Updated to latest version
#
# Revision 1.15 2005/04/10 11:48:33 savage
# Changes as suggested by Michalis, thanks.
#
# Revision 1.14 2005/02/24 20:20:07 savage
# Changed definition of MusicType and added GetMusicType function
#
# Revision 1.13 2005/01/05 01:47:09 savage
# Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
#
# Revision 1.12 2005/01/04 23:14:56 savage
# Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
#
# Revision 1.11 2005/01/01 02:05:19 savage
# Updated to v1.2.6
#
# Revision 1.10 2004/09/12 21:45:17 savage
# Robert Reed spotted that Mix_SetMusicPosition was missing from the conversion, so this has now been added.
#
# Revision 1.9 2004/08/27 21:48:24 savage
# IFDEFed out Smpeg support on MacOS X
#
# Revision 1.8 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.7 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.6 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.5 2004/04/01 20:53:23 savage
# Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.4 2004/03/31 22:20:02 savage
# Windows unit not used in this file, so it was removed to keep the code tidy.
#
# Revision 1.3 2004/03/31 10:05:08 savage
# Better defines for Endianess under FreePascal and Borland compilers.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/14 23:35:42 savage
# version 1 of sdl_image, sdl_mixer and smpeg.
#
#
#
#******************************************************************************
import
sdl, smpeg
when defined(windows):
const
MixerLibName = "SDL_mixer.dll"
elif defined(macosx):
const
MixerLibName = "libSDL_mixer-1.2.0.dylib"
else:
const
MixerLibName = "libSDL_mixer.so"
const
MAJOR_VERSION* = 1'i8
MINOR_VERSION* = 2'i8
PATCHLEVEL* = 7'i8 # Backwards compatibility
CHANNELS* = 8 # Good default values for a PC soundcard
DEFAULT_FREQUENCY* = 22050
when defined(IA32):
const
DEFAULT_FORMAT* = AUDIO_S16LSB
else:
const
DEFAULT_FORMAT* = AUDIO_S16MSB
const
DEFAULT_CHANNELS* = 2
MAX_VOLUME* = 128 # Volume of a chunk
PATH_MAX* = 255 # mikmod.h constants
#*
# * Library version
# *
LIBMIKMOD_VERSION_MAJOR* = 3
LIBMIKMOD_VERSION_MINOR* = 1
LIBMIKMOD_REVISION* = 8
LIBMIKMOD_VERSION* = ((LIBMIKMOD_VERSION_MAJOR shl 16) or
(LIBMIKMOD_VERSION_MINOR shl 8) or (LIBMIKMOD_REVISION))
type #music_cmd.h types
PMusicCMD* = ptr TMusicCMD
TMusicCMD*{.final.} = object #wavestream.h types
filename*: array[0..PATH_MAX - 1, char]
cmd*: array[0..PATH_MAX - 1, char]
pid*: TSYS_ThreadHandle
PWAVStream* = ptr TWAVStream
TWAVStream*{.final.} = object #playmidi.h types
wavefp*: Pointer
start*: int32
stop*: int32
cvt*: TAudioCVT
PMidiEvent* = ptr TMidiEvent
TMidiEvent*{.final.} = object
time*: int32
channel*: uint8
typ*: uint8
a*: uint8
b*: uint8
PMidiSong* = ptr TMidiSong
TMidiSong*{.final.} = object #music_ogg.h types
samples*: int32
events*: PMidiEvent
POGG_Music* = ptr TOGG_Music
TOGG_Music*{.final.} = object # mikmod.h types
#*
# * Error codes
# *
playing*: int
volume*: int #vf: OggVorbis_File;
section*: int
cvt*: TAudioCVT
len_available*: int
snd_available*: PUint8
TErrorEnum* = enum
MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING,
MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE,
MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER,
MMERR_LOADING_SAMPLEINFO, MMERR_NOT_A_MODULE, MMERR_NOT_A_STREAM,
MMERR_MED_SYNTHSAMPLES, MMERR_ITPACK_INVALID_DATA, MMERR_DETECTING_DEVICE,
MMERR_INVALID_DEVICE, MMERR_INITIALIZING_MIXER, MMERR_OPENING_AUDIO,
MMERR_8BIT_ONLY, MMERR_16BIT_ONLY, MMERR_STEREO_ONLY, MMERR_ULAW,
MMERR_NON_BLOCK, MMERR_AF_AUDIO_PORT, MMERR_AIX_CONFIG_INIT,
MMERR_AIX_CONFIG_CONTROL, MMERR_AIX_CONFIG_START, MMERR_GUS_SETTINGS,
MMERR_GUS_RESET, MMERR_GUS_TIMER, MMERR_HP_SETSAMPLESIZE, MMERR_HP_SETSPEED,
MMERR_HP_CHANNELS, MMERR_HP_AUDIO_OUTPUT, MMERR_HP_AUDIO_DESC,
MMERR_HP_BUFFERSIZE, MMERR_OSS_SETFRAGMENT, MMERR_OSS_SETSAMPLESIZE,
MMERR_OSS_SETSTEREO, MMERR_OSS_SETSPEED, MMERR_SGI_SPEED, MMERR_SGI_16BIT,
MMERR_SGI_8BIT, MMERR_SGI_STEREO, MMERR_SGI_MONO, MMERR_SUN_INIT,
MMERR_OS2_MIXSETUP, MMERR_OS2_SEMAPHORE, MMERR_OS2_TIMER, MMERR_OS2_THREAD,
MMERR_DS_PRIORITY, MMERR_DS_BUFFER, MMERR_DS_FORMAT, MMERR_DS_NOTIFY,
MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE,
MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT,
MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_MAX
PMODULE* = ptr TMODULE
TMODULE*{.final.} = object
PUNIMOD* = ptr TUNIMOD
TUNIMOD* = TMODULE #SDL_mixer.h types
# The internal format for an audio chunk
PChunk* = ptr TChunk
TChunk*{.final.} = object
allocated*: int
abuf*: PUint8
alen*: Uint32
volume*: Uint8 # Per-sample volume, 0-128
TFading* = enum
MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN
TMusicType* = enum
MUS_NONE, MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3
PMusic* = ptr TMusic
TMusic*{.final.} = object # The internal format for a music chunk interpreted via mikmod
mixtype*: TMusicType # other fields are not aviable
# data : TMusicUnion;
# fading : TMix_Fading;
# fade_volume : integer;
# fade_step : integer;
# fade_steps : integer;
# error : integer;
TMixFunction* = proc (udata: Pointer, stream: PUint8, length: int): Pointer{.
cdecl.} # This macro can be used to fill a version structure with the compile-time
# version of the SDL_mixer library.
proc VERSION*(X: var sdl.TVersion)
# This function gets the version of the dynamically linked SDL_mixer library.
# It should NOT be used to fill a version structure, instead you should use the
# SDL_MIXER_VERSION() macro.
proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "Mix_Linked_Version",
dynlib: MixerLibName.}
# Open the mixer with a certain audio format
proc OpenAudio*(frequency: int, format: Uint16, channels: int,
chunksize: int): int{.cdecl, importc: "Mix_OpenAudio",
dynlib: MixerLibName.}
# Dynamically change the number of channels managed by the mixer.
# If decreasing the number of channels, the upper channels are
# stopped.
# This function returns the new number of allocated channels.
#
proc AllocateChannels*(numchannels: int): int{.cdecl,
importc: "Mix_AllocateChannels", dynlib: MixerLibName.}
# Find out what the actual audio device parameters are.
# This function returns 1 if the audio has been opened, 0 otherwise.
#
proc QuerySpec*(frequency: var int, format: var Uint16, channels: var int): int{.
cdecl, importc: "Mix_QuerySpec", dynlib: MixerLibName.}
# Load a wave file or a music (.mod .s3m .it .xm) file
proc LoadWAV_RW*(src: PRWops, freesrc: int): PChunk{.cdecl,
importc: "Mix_LoadWAV_RW", dynlib: MixerLibName.}
proc LoadWAV*(filename: cstring): PChunk
proc LoadMUS*(filename: cstring): PMusic{.cdecl, importc: "Mix_LoadMUS",
dynlib: MixerLibName.}
# Load a wave file of the mixer format from a memory buffer
proc QuickLoad_WAV*(mem: PUint8): PChunk{.cdecl,
importc: "Mix_QuickLoad_WAV", dynlib: MixerLibName.}
# Free an audio chunk previously loaded
proc FreeChunk*(chunk: PChunk){.cdecl, importc: "Mix_FreeChunk",
dynlib: MixerLibName.}
proc FreeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic",
dynlib: MixerLibName.}
# Find out the music format of a mixer music, or the currently playing
# music, if 'music' is NULL.
proc GetMusicType*(music: PMusic): TMusicType{.cdecl,
importc: "Mix_GetMusicType", dynlib: MixerLibName.}
# Set a function that is called after all mixing is performed.
# This can be used to provide real-time visual display of the audio stream
# or add a custom mixer filter for the stream data.
#
proc SetPostMix*(mix_func: TMixFunction, arg: Pointer){.cdecl,
importc: "Mix_SetPostMix", dynlib: MixerLibName.}
# Add your own music player or additional mixer function.
# If 'mix_func' is NULL, the default music player is re-enabled.
#
proc HookMusic*(mix_func: TMixFunction, arg: Pointer){.cdecl,
importc: "Mix_HookMusic", dynlib: MixerLibName.}
# Add your own callback when the music has finished playing.
#
proc HookMusicFinished*(music_finished: Pointer){.cdecl,
importc: "Mix_HookMusicFinished", dynlib: MixerLibName.}
# Get a pointer to the user data for the current music hook
proc GetMusicHookData*(): Pointer{.cdecl, importc: "Mix_GetMusicHookData",
dynlib: MixerLibName.}
#* Add your own callback when a channel has finished playing. NULL
# * to disable callback.*
type
TChannel_finished* = proc (channel: int){.cdecl.}
proc ChannelFinished*(channel_finished: TChannel_finished){.cdecl,
importc: "Mix_ChannelFinished", dynlib: MixerLibName.}
const
CHANNEL_POST* = - 2
type
TEffectFunc* = proc (chan: int, stream: Pointer, length: int,
udata: Pointer): Pointer{.cdecl.}
TEffectDone* = proc (chan: int, udata: Pointer): Pointer{.cdecl.}
proc RegisterEffect*(chan: int, f: TEffectFunc, d: TEffectDone,
arg: Pointer): int{.cdecl,
importc: "Mix_RegisterEffect", dynlib: MixerLibName.}
proc UnregisterEffect*(channel: int, f: TEffectFunc): int{.cdecl,
importc: "Mix_UnregisterEffect", dynlib: MixerLibName.}
proc UnregisterAllEffects*(channel: int): int{.cdecl,
importc: "Mix_UnregisterAllEffects", dynlib: MixerLibName.}
const
EFFECTSMAXSPEED* = "MIX_EFFECTSMAXSPEED"
proc SetPanning*(channel: int, left: Uint8, right: Uint8): int{.cdecl,
importc: "Mix_SetPanning", dynlib: MixerLibName.}
proc SetPosition*(channel: int, angle: Sint16, distance: Uint8): int{.cdecl,
importc: "Mix_SetPosition", dynlib: MixerLibName.}
proc SetDistance*(channel: int, distance: Uint8): int{.cdecl,
importc: "Mix_SetDistance", dynlib: MixerLibName.}
proc SetReverseStereo*(channel: int, flip: int): int{.cdecl,
importc: "Mix_SetReverseStereo", dynlib: MixerLibName.}
proc ReserveChannels*(num: int): int{.cdecl, importc: "Mix_ReserveChannels",
dynlib: MixerLibName.}
proc GroupChannel*(which: int, tag: int): int{.cdecl,
importc: "Mix_GroupChannel", dynlib: MixerLibName.}
proc GroupChannels*(`from`: int, `to`: int, tag: int): int{.cdecl,
importc: "Mix_GroupChannels", dynlib: MixerLibName.}
proc GroupAvailable*(tag: int): int{.cdecl, importc: "Mix_GroupAvailable",
dynlib: MixerLibName.}
proc GroupCount*(tag: int): int{.cdecl, importc: "Mix_GroupCount",
dynlib: MixerLibName.}
proc GroupOldest*(tag: int): int{.cdecl, importc: "Mix_GroupOldest",
dynlib: MixerLibName.}
proc GroupNewer*(tag: int): int{.cdecl, importc: "Mix_GroupNewer",
dynlib: MixerLibName.}
proc PlayChannelTimed*(channel: int, chunk: PChunk, loops: int,
ticks: int): int{.cdecl,
importc: "Mix_PlayChannelTimed", dynlib: MixerLibName.}
proc PlayChannel*(channel: int, chunk: PChunk, loops: int): int
proc PlayMusic*(music: PMusic, loops: int): int{.cdecl,
importc: "Mix_PlayMusic", dynlib: MixerLibName.}
proc FadeInMusic*(music: PMusic, loops: int, ms: int): int{.cdecl,
importc: "Mix_FadeInMusic", dynlib: MixerLibName.}
proc FadeInChannelTimed*(channel: int, chunk: PChunk, loops: int,
ms: int, ticks: int): int{.cdecl,
importc: "Mix_FadeInChannelTimed", dynlib: MixerLibName.}
proc FadeInChannel*(channel: int, chunk: PChunk, loops: int, ms: int): int
proc Volume*(channel: int, volume: int): int{.cdecl, importc: "Mix_Volume",
dynlib: MixerLibName.}
proc VolumeChunk*(chunk: PChunk, volume: int): int{.cdecl,
importc: "Mix_VolumeChunk", dynlib: MixerLibName.}
proc VolumeMusic*(volume: int): int{.cdecl, importc: "Mix_VolumeMusic",
dynlib: MixerLibName.}
proc HaltChannel*(channel: int): int{.cdecl, importc: "Mix_HaltChannel",
dynlib: MixerLibName.}
proc HaltGroup*(tag: int): int{.cdecl, importc: "Mix_HaltGroup",
dynlib: MixerLibName.}
proc HaltMusic*(): int{.cdecl, importc: "Mix_HaltMusic",
dynlib: MixerLibName.}
# Change the expiration delay for a particular channel.
# The sample will stop playing after the 'ticks' milliseconds have elapsed,
# or remove the expiration if 'ticks' is -1
#
proc ExpireChannel*(channel: int, ticks: int): int{.cdecl,
importc: "Mix_ExpireChannel", dynlib: MixerLibName.}
# Halt a channel, fading it out progressively till it's silent
# The ms parameter indicates the number of milliseconds the fading
# will take.
#
proc FadeOutChannel*(which: int, ms: int): int{.cdecl,
importc: "Mix_FadeOutChannel", dynlib: MixerLibName.}
proc FadeOutGroup*(tag: int, ms: int): int{.cdecl,
importc: "Mix_FadeOutGroup", dynlib: MixerLibName.}
proc FadeOutMusic*(ms: int): int{.cdecl, importc: "Mix_FadeOutMusic",
dynlib: MixerLibName.}
# Query the fading status of a channel
proc FadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic",
dynlib: MixerLibName.}
proc FadingChannel*(which: int): TFading{.cdecl,
importc: "Mix_FadingChannel", dynlib: MixerLibName.}
proc Pause*(channel: int){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.}
proc Resume*(channel: int){.cdecl, importc: "Mix_Resume",
dynlib: MixerLibName.}
proc Paused*(channel: int): int{.cdecl, importc: "Mix_Paused",
dynlib: MixerLibName.}
proc PauseMusic*(){.cdecl, importc: "Mix_PauseMusic", dynlib: MixerLibName.}
proc ResumeMusic*(){.cdecl, importc: "Mix_ResumeMusic", dynlib: MixerLibName.}
proc RewindMusic*(){.cdecl, importc: "Mix_RewindMusic", dynlib: MixerLibName.}
proc PausedMusic*(): int{.cdecl, importc: "Mix_PausedMusic",
dynlib: MixerLibName.}
proc SetMusicPosition*(position: float64): int{.cdecl,
importc: "Mix_SetMusicPosition", dynlib: MixerLibName.}
proc Playing*(channel: int): int{.cdecl, importc: "Mix_Playing",
dynlib: MixerLibName.}
proc PlayingMusic*(): int{.cdecl, importc: "Mix_PlayingMusic",
dynlib: MixerLibName.}
proc SetMusicCMD*(command: cstring): int{.cdecl, importc: "Mix_SetMusicCMD",
dynlib: MixerLibName.}
proc SetSynchroValue*(value: int): int{.cdecl,
importc: "Mix_SetSynchroValue", dynlib: MixerLibName.}
proc GetSynchroValue*(): int{.cdecl, importc: "Mix_GetSynchroValue",
dynlib: MixerLibName.}
proc GetChunk*(channel: int): PChunk{.cdecl, importc: "Mix_GetChunk",
dynlib: MixerLibName.}
proc CloseAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.}
proc VERSION(X: var sdl.Tversion) =
X.major = MAJOR_VERSION
X.minor = MINOR_VERSION
X.patch = PATCHLEVEL
proc LoadWAV(filename: cstring): PChunk =
result = LoadWAV_RW(RWFromFile(filename, "rb"), 1)
proc PlayChannel(channel: int, chunk: PChunk, loops: int): int =
result = PlayChannelTimed(channel, chunk, loops, - 1)
proc FadeInChannel(channel: int, chunk: PChunk, loops: int, ms: int): int =
result = FadeInChannelTimed(channel, chunk, loops, ms, - 1)

View File

@@ -1,351 +0,0 @@
#******************************************************************************
# Copy of SDL_Mixer without smpeg dependency and mp3 support
#******************************************************************************
import
sdl
when defined(windows):
const
MixerLibName = "SDL_mixer.dll"
elif defined(macosx):
const
MixerLibName = "libSDL_mixer-1.2.0.dylib"
else:
const
MixerLibName = "libSDL_mixer.so"
const
MAJOR_VERSION* = 1'i8
MINOR_VERSION* = 2'i8
PATCHLEVEL* = 7'i8 # Backwards compatibility
CHANNELS* = 8 # Good default values for a PC soundcard
DEFAULT_FREQUENCY* = 22050
when defined(IA32):
const
DEFAULT_FORMAT* = AUDIO_S16LSB
else:
const
DEFAULT_FORMAT* = AUDIO_S16MSB
const
DEFAULT_CHANNELS* = 2
MAX_VOLUME* = 128 # Volume of a chunk
PATH_MAX* = 255
LIBMIKMOD_VERSION_MAJOR* = 3
LIBMIKMOD_VERSION_MINOR* = 1
LIBMIKMOD_REVISION* = 8
LIBMIKMOD_VERSION* = ((LIBMIKMOD_VERSION_MAJOR shl 16) or
(LIBMIKMOD_VERSION_MINOR shl 8) or (LIBMIKMOD_REVISION))
type #music_cmd.h types
PMusicCMD* = ptr TMusicCMD
TMusicCMD*{.final.} = object #wavestream.h types
filename*: array[0..PATH_MAX - 1, char]
cmd*: array[0..PATH_MAX - 1, char]
pid*: TSYS_ThreadHandle
PWAVStream* = ptr TWAVStream
TWAVStream*{.final.} = object #playmidi.h types
wavefp*: Pointer
start*: int32
stop*: int32
cvt*: TAudioCVT
PMidiEvent* = ptr TMidiEvent
TMidiEvent*{.final.} = object
time*: int32
channel*: uint8
typ*: uint8
a*: uint8
b*: uint8
PMidiSong* = ptr TMidiSong
TMidiSong*{.final.} = object #music_ogg.h types
samples*: int32
events*: PMidiEvent
POGG_Music* = ptr TOGG_Music
TOGG_Music*{.final.} = object # mikmod.h types
#*
# * Error codes
# *
playing*: int
volume*: int #vf: OggVorbis_File;
section*: int
cvt*: TAudioCVT
len_available*: int
snd_available*: PUint8
TErrorEnum* = enum
MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING,
MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE,
MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER,
MMERR_LOADING_SAMPLEINFO, MMERR_NOT_A_MODULE, MMERR_NOT_A_STREAM,
MMERR_MED_SYNTHSAMPLES, MMERR_ITPACK_INVALID_DATA, MMERR_DETECTING_DEVICE,
MMERR_INVALID_DEVICE, MMERR_INITIALIZING_MIXER, MMERR_OPENING_AUDIO,
MMERR_8BIT_ONLY, MMERR_16BIT_ONLY, MMERR_STEREO_ONLY, MMERR_ULAW,
MMERR_NON_BLOCK, MMERR_AF_AUDIO_PORT, MMERR_AIX_CONFIG_INIT,
MMERR_AIX_CONFIG_CONTROL, MMERR_AIX_CONFIG_START, MMERR_GUS_SETTINGS,
MMERR_GUS_RESET, MMERR_GUS_TIMER, MMERR_HP_SETSAMPLESIZE, MMERR_HP_SETSPEED,
MMERR_HP_CHANNELS, MMERR_HP_AUDIO_OUTPUT, MMERR_HP_AUDIO_DESC,
MMERR_HP_BUFFERSIZE, MMERR_OSS_SETFRAGMENT, MMERR_OSS_SETSAMPLESIZE,
MMERR_OSS_SETSTEREO, MMERR_OSS_SETSPEED, MMERR_SGI_SPEED, MMERR_SGI_16BIT,
MMERR_SGI_8BIT, MMERR_SGI_STEREO, MMERR_SGI_MONO, MMERR_SUN_INIT,
MMERR_OS2_MIXSETUP, MMERR_OS2_SEMAPHORE, MMERR_OS2_TIMER, MMERR_OS2_THREAD,
MMERR_DS_PRIORITY, MMERR_DS_BUFFER, MMERR_DS_FORMAT, MMERR_DS_NOTIFY,
MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE,
MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT,
MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_MAX
PMODULE* = ptr TMODULE
TMODULE*{.final.} = object
PUNIMOD* = ptr TUNIMOD
TUNIMOD* = TMODULE #SDL_mixer.h types
# The internal format for an audio chunk
PChunk* = ptr TChunk
TChunk*{.final.} = object
allocated*: int
abuf*: PUint8
alen*: Uint32
volume*: Uint8 # Per-sample volume, 0-128
TFading* = enum
MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN
TMusicType* = enum
MUS_NONE, MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG
PMusic* = ptr TMusic
TMusic*{.final.} = object
typ*: TMusicType
TMixFunction* = proc (udata: Pointer, stream: PUint8, length: int): Pointer{.
cdecl.} # This macro can be used to fill a version structure with the compile-time
# version of the SDL_mixer library.
proc VERSION*(X: var sdl.TVersion)
# This function gets the version of the dynamically linked SDL_mixer library.
# It should NOT be used to fill a version structure, instead you should use the
# SDL_MIXER_VERSION() macro.
proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "Mix_Linked_Version",
dynlib: MixerLibName.}
# Open the mixer with a certain audio format
proc OpenAudio*(frequency: int, format: Uint16, channels: int,
chunksize: int): int{.cdecl, importc: "Mix_OpenAudio",
dynlib: MixerLibName.}
# Dynamically change the number of channels managed by the mixer.
# If decreasing the number of channels, the upper channels are
# stopped.
# This function returns the new number of allocated channels.
#
proc AllocateChannels*(numchannels: int): int{.cdecl,
importc: "Mix_AllocateChannels", dynlib: MixerLibName.}
# Find out what the actual audio device parameters are.
# This function returns 1 if the audio has been opened, 0 otherwise.
#
proc QuerySpec*(frequency: var int, format: var Uint16, channels: var int): int{.
cdecl, importc: "Mix_QuerySpec", dynlib: MixerLibName.}
# Load a wave file or a music (.mod .s3m .it .xm) file
proc LoadWAV_RW*(src: PRWops, freesrc: int): PChunk{.cdecl,
importc: "Mix_LoadWAV_RW", dynlib: MixerLibName.}
proc LoadWAV*(filename: cstring): PChunk
proc LoadMUS*(filename: cstring): PMusic{.cdecl, importc: "Mix_LoadMUS",
dynlib: MixerLibName.}
# Load a wave file of the mixer format from a memory buffer
proc QuickLoad_WAV*(mem: PUint8): PChunk{.cdecl,
importc: "Mix_QuickLoad_WAV", dynlib: MixerLibName.}
# Free an audio chunk previously loaded
proc FreeChunk*(chunk: PChunk){.cdecl, importc: "Mix_FreeChunk",
dynlib: MixerLibName.}
proc FreeMusic*(music: PMusic){.cdecl, importc: "Mix_FreeMusic",
dynlib: MixerLibName.}
# Find out the music format of a mixer music, or the currently playing
# music, if 'music' is NULL.
proc GetMusicType*(music: PMusic): TMusicType{.cdecl,
importc: "Mix_GetMusicType", dynlib: MixerLibName.}
# Set a function that is called after all mixing is performed.
# This can be used to provide real-time visual display of the audio stream
# or add a custom mixer filter for the stream data.
#
proc SetPostMix*(mixfunc: TMixFunction, arg: Pointer){.cdecl,
importc: "Mix_SetPostMix", dynlib: MixerLibName.}
# Add your own music player or additional mixer function.
# If 'mix_func' is NULL, the default music player is re-enabled.
#
proc HookMusic*(mix_func: TMixFunction, arg: Pointer){.cdecl,
importc: "Mix_HookMusic", dynlib: MixerLibName.}
# Add your own callback when the music has finished playing.
#
proc HookMusicFinished*(music_finished: Pointer){.cdecl,
importc: "Mix_HookMusicFinished", dynlib: MixerLibName.}
# Get a pointer to the user data for the current music hook
proc GetMusicHookData*(): Pointer{.cdecl, importc: "Mix_GetMusicHookData",
dynlib: MixerLibName.}
#* Add your own callback when a channel has finished playing. NULL
# * to disable callback.*
type
TChannel_finished* = proc (channel: int){.cdecl.}
proc ChannelFinished*(channel_finished: TChannel_finished){.cdecl,
importc: "Mix_ChannelFinished", dynlib: MixerLibName.}
const
CHANNEL_POST* = - 2
type
TEffectFunc* = proc (chan: int, stream: Pointer, length: int,
udata: Pointer): Pointer{.cdecl.}
TEffectDone* = proc (chan: int, udata: Pointer): Pointer{.cdecl.}
proc RegisterEffect*(chan: int, f: TEffectFunc, d: TEffectDone,
arg: Pointer): int{.cdecl,
importc: "Mix_RegisterEffect", dynlib: MixerLibName.}
proc UnregisterEffect*(channel: int, f: TEffectFunc): int{.cdecl,
importc: "Mix_UnregisterEffect", dynlib: MixerLibName.}
proc UnregisterAllEffects*(channel: int): int{.cdecl,
importc: "Mix_UnregisterAllEffects", dynlib: MixerLibName.}
const
EFFECTSMAXSPEED* = "MIX_EFFECTSMAXSPEED"
proc SetPanning*(channel: int, left: Uint8, right: Uint8): int{.cdecl,
importc: "Mix_SetPanning", dynlib: MixerLibName.}
proc SetPosition*(channel: int, angle: Sint16, distance: Uint8): int{.cdecl,
importc: "Mix_SetPosition", dynlib: MixerLibName.}
proc SetDistance*(channel: int, distance: Uint8): int{.cdecl,
importc: "Mix_SetDistance", dynlib: MixerLibName.}
proc SetReverseStereo*(channel: int, flip: int): int{.cdecl,
importc: "Mix_SetReverseStereo", dynlib: MixerLibName.}
proc ReserveChannels*(num: int): int{.cdecl, importc: "Mix_ReserveChannels",
dynlib: MixerLibName.}
proc GroupChannel*(which: int, tag: int): int{.cdecl,
importc: "Mix_GroupChannel", dynlib: MixerLibName.}
# Assign several consecutive channels to a group
proc GroupChannels*(`from`: int, `to`: int, tag: int): int{.cdecl,
importc: "Mix_GroupChannels", dynlib: MixerLibName.}
# Finds the first available channel in a group of channels
proc GroupAvailable*(tag: int): int{.cdecl, importc: "Mix_GroupAvailable",
dynlib: MixerLibName.}
# Returns the number of channels in a group. This is also a subtle
# way to get the total number of channels when 'tag' is -1
#
proc GroupCount*(tag: int): int{.cdecl, importc: "Mix_GroupCount",
dynlib: MixerLibName.}
# Finds the "oldest" sample playing in a group of channels
proc GroupOldest*(tag: int): int{.cdecl, importc: "Mix_GroupOldest",
dynlib: MixerLibName.}
# Finds the "most recent" (i.e. last) sample playing in a group of channels
proc GroupNewer*(tag: int): int{.cdecl, importc: "Mix_GroupNewer",
dynlib: MixerLibName.}
# The same as above, but the sound is played at most 'ticks' milliseconds
proc PlayChannelTimed*(channel: int, chunk: PChunk, loops: int,
ticks: int): int{.cdecl,
importc: "Mix_PlayChannelTimed", dynlib: MixerLibName.}
proc PlayChannel*(channel: int, chunk: PChunk, loops: int): int
proc PlayMusic*(music: PMusic, loops: int): int{.cdecl,
importc: "Mix_PlayMusic", dynlib: MixerLibName.}
# Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions
proc FadeInMusic*(music: PMusic, loops: int, ms: int): int{.cdecl,
importc: "Mix_FadeInMusic", dynlib: MixerLibName.}
proc FadeInChannelTimed*(channel: int, chunk: PChunk, loops: int,
ms: int, ticks: int): int{.cdecl,
importc: "Mix_FadeInChannelTimed", dynlib: MixerLibName.}
proc FadeInChannel*(channel: int, chunk: PChunk, loops: int, ms: int): int
# Set the volume in the range of 0-128 of a specific channel or chunk.
# If the specified channel is -1, set volume for all channels.
# Returns the original volume.
# If the specified volume is -1, just return the current volume.
#
proc Volume*(channel: int, volume: int): int{.cdecl, importc: "Mix_Volume",
dynlib: MixerLibName.}
proc VolumeChunk*(chunk: PChunk, volume: int): int{.cdecl,
importc: "Mix_VolumeChunk", dynlib: MixerLibName.}
proc VolumeMusic*(volume: int): int{.cdecl, importc: "Mix_VolumeMusic",
dynlib: MixerLibName.}
# Halt playing of a particular channel
proc HaltChannel*(channel: int): int{.cdecl, importc: "Mix_HaltChannel",
dynlib: MixerLibName.}
proc HaltGroup*(tag: int): int{.cdecl, importc: "Mix_HaltGroup",
dynlib: MixerLibName.}
proc HaltMusic*(): int{.cdecl, importc: "Mix_HaltMusic",
dynlib: MixerLibName.}
proc ExpireChannel*(channel: int, ticks: int): int{.cdecl,
importc: "Mix_ExpireChannel", dynlib: MixerLibName.}
proc FadeOutChannel*(which: int, ms: int): int{.cdecl,
importc: "Mix_FadeOutChannel", dynlib: MixerLibName.}
proc FadeOutGroup*(tag: int, ms: int): int{.cdecl,
importc: "Mix_FadeOutGroup", dynlib: MixerLibName.}
proc FadeOutMusic*(ms: int): int{.cdecl, importc: "Mix_FadeOutMusic",
dynlib: MixerLibName.}
# Query the fading status of a channel
proc FadingMusic*(): TFading{.cdecl, importc: "Mix_FadingMusic",
dynlib: MixerLibName.}
proc FadingChannel*(which: int): TFading{.cdecl,
importc: "Mix_FadingChannel", dynlib: MixerLibName.}
# Pause/Resume a particular channel
proc Pause*(channel: int){.cdecl, importc: "Mix_Pause", dynlib: MixerLibName.}
proc Resume*(channel: int){.cdecl, importc: "Mix_Resume",
dynlib: MixerLibName.}
proc Paused*(channel: int): int{.cdecl, importc: "Mix_Paused",
dynlib: MixerLibName.}
# Pause/Resume the music stream
proc PauseMusic*(){.cdecl, importc: "Mix_PauseMusic", dynlib: MixerLibName.}
proc ResumeMusic*(){.cdecl, importc: "Mix_ResumeMusic", dynlib: MixerLibName.}
proc RewindMusic*(){.cdecl, importc: "Mix_RewindMusic", dynlib: MixerLibName.}
proc PausedMusic*(): int{.cdecl, importc: "Mix_PausedMusic",
dynlib: MixerLibName.}
# Set the current position in the music stream.
# This returns 0 if successful, or -1 if it failed or isn't implemented.
# This function is only implemented for MOD music formats (set pattern
# order number) and for OGG music (set position in seconds), at the
# moment.
#
proc SetMusicPosition*(position: float64): int{.cdecl,
importc: "Mix_SetMusicPosition", dynlib: MixerLibName.}
# Check the status of a specific channel.
# If the specified channel is -1, check all channels.
#
proc Playing*(channel: int): int{.cdecl, importc: "Mix_Playing",
dynlib: MixerLibName.}
proc PlayingMusic*(): int{.cdecl, importc: "Mix_PlayingMusic",
dynlib: MixerLibName.}
# Stop music and set external music playback command
proc SetMusicCMD*(command: cstring): int{.cdecl, importc: "Mix_SetMusicCMD",
dynlib: MixerLibName.}
# Synchro value is set by MikMod from modules while playing
proc SetSynchroValue*(value: int): int{.cdecl,
importc: "Mix_SetSynchroValue", dynlib: MixerLibName.}
proc GetSynchroValue*(): int{.cdecl, importc: "Mix_GetSynchroValue",
dynlib: MixerLibName.}
#
# Get the Mix_Chunk currently associated with a mixer channel
# Returns nil if it's an invalid channel, or there's no chunk associated.
#
proc GetChunk*(channel: int): PChunk{.cdecl, importc: "Mix_GetChunk",
dynlib: MixerLibName.}
# Close the mixer, halting all playing audio
proc CloseAudio*(){.cdecl, importc: "Mix_CloseAudio", dynlib: MixerLibName.}
# We'll use SDL for reporting errors
proc VERSION(X: var Tversion) =
X.major = MAJOR_VERSION
X.minor = MINOR_VERSION
X.patch = PATCHLEVEL
proc LoadWAV(filename: cstring): PChunk =
result = LoadWAV_RW(RWFromFile(filename, "rb"), 1)
proc PlayChannel(channel: int, chunk: PChunk, loops: int): int =
result = PlayChannelTimed(channel, chunk, loops, - 1)
proc FadeInChannel(channel: int, chunk: PChunk, loops: int, ms: int): int =
result = FadeInChannelTimed(channel, chunk, loops, ms, - 1)

View File

@@ -1,427 +0,0 @@
#******************************************************************************
#
# $Id: sdl_net.pas,v 1.7 2005/01/01 02:14:21 savage Exp $
#
#
#
# Borland Delphi SDL_Net - A x-platform network library for use with SDL.
# Conversion of the Simple DirectMedia Layer Network Headers
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : SDL_net.h
#
# The initial developer of this Pascal code was :
# Dominqiue Louis <Dominique@SavageSoftware.com.au>
#
# Portions created by Dominqiue Louis are
# Copyright (C) 2000 - 2001 Dominqiue Louis.
#
#
# Contributor(s)
# --------------
# Matthias Thoma <ma.thoma@gmx.de>
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
#
#
#
#
#
#
#
# Requires
# --------
# SDL.pas somehere in your search path
#
# Programming Notes
# -----------------
#
#
#
#
# Revision History
# ----------------
# April 09 2001 - DL : Initial Translation
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: sdl_net.pas,v $
# Revision 1.7 2005/01/01 02:14:21 savage
# Updated to v1.2.5
#
# Revision 1.6 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.5 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.4 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.3 2004/04/01 20:53:23 savage
# Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/16 22:16:40 savage
# v1.0 changes
#
#
#
#******************************************************************************
import
sdl
when defined(windows):
const
NetLibName = "SDL_net.dll"
elif defined(macosx):
const
NetLibName = "libSDL_net.dylib"
else:
const
NetLibName = "libSDL_net.so"
const #* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *
MAJOR_VERSION* = 1'i8
MINOR_VERSION* = 2'i8
PATCHLEVEL* = 5'i8 # SDL_Net.h constants
#* Resolve a host name and port to an IP address in network form.
# If the function succeeds, it will return 0.
# If the host couldn't be resolved, the host portion of the returned
# address will be INADDR_NONE, and the function will return -1.
# If 'host' is NULL, the resolved host will be set to INADDR_ANY.
# *
INADDR_ANY* = 0x00000000
INADDR_NONE* = 0xFFFFFFFF #***********************************************************************
#* UDP network API *
#***********************************************************************
#* The maximum channels on a a UDP socket *
MAX_UDPCHANNELS* = 32 #* The maximum addresses bound to a single UDP socket channel *
MAX_UDPADDRESSES* = 4
type # SDL_net.h types
#***********************************************************************
#* IPv4 hostname resolution API *
#***********************************************************************
PIPAddress* = ptr TIPAddress
TIPAddress*{.final.} = object #* TCP network API
host*: Uint32 # 32-bit IPv4 host address */
port*: Uint16 # 16-bit protocol port */
PTCPSocket* = ptr TTCPSocket
TTCPSocket*{.final.} = object # UDP network API
ready*: int
channel*: int
remoteAddress*: TIPaddress
localAddress*: TIPaddress
sflag*: int
PUDP_Channel* = ptr TUDP_Channel
TUDP_Channel*{.final.} = object
numbound*: int
address*: array[0..MAX_UDPADDRESSES - 1, TIPAddress]
PUDPSocket* = ptr TUDPSocket
TUDPSocket*{.final.} = object
ready*: int
channel*: int
address*: TIPAddress
binding*: array[0..MAX_UDPCHANNELS - 1, TUDP_Channel]
PUDPpacket* = ptr TUDPpacket
PPUDPpacket* = ptr PUDPpacket
TUDPpacket*{.final.} = object #***********************************************************************
#* Hooks for checking sockets for available data *
#***********************************************************************
channel*: int #* The src/dst channel of the packet *
data*: PUint8 #* The packet data *
length*: int #* The length of the packet data *
maxlen*: int #* The size of the data buffer *
status*: int #* packet status after sending *
address*: TIPAddress #* The source/dest address of an incoming/outgoing packet *
PSocket* = ptr TSocket
TSocket*{.final.} = object
ready*: int
channel*: int
PSocketSet* = ptr TSocketSet
TSocketSet*{.final.} = object # Any network socket can be safely cast to this socket type *
numsockets*: int
maxsockets*: int
sockets*: PSocket
PGenericSocket* = ptr TGenericSocket
TGenericSocket*{.final.} = object
ready*: int
proc VERSION*(X: var Tversion)
#* Initialize/Cleanup the network API
# SDL must be initialized before calls to functions in this library,
# because this library uses utility functions from the SDL library.
#*
proc Init*(): int{.cdecl, importc: "SDLNet_Init", dynlib: NetLibName.}
proc Quit*(){.cdecl, importc: "SDLNet_Quit", dynlib: NetLibName.}
#* Resolve a host name and port to an IP address in network form.
# If the function succeeds, it will return 0.
# If the host couldn't be resolved, the host portion of the returned
# address will be INADDR_NONE, and the function will return -1.
# If 'host' is NULL, the resolved host will be set to INADDR_ANY.
# *
proc ResolveHost*(address: var TIPaddress, host: cstring, port: Uint16): int{.
cdecl, importc: "SDLNet_ResolveHost", dynlib: NetLibName.}
#* Resolve an ip address to a host name in canonical form.
# If the ip couldn't be resolved, this function returns NULL,
# otherwise a pointer to a static buffer containing the hostname
# is returned. Note that this function is not thread-safe.
#*
proc ResolveIP*(ip: var TIPaddress): cstring{.cdecl,
importc: "SDLNet_ResolveIP", dynlib: NetLibName.}
#***********************************************************************
#* TCP network API *
#***********************************************************************
#* Open a TCP network socket
# If ip.host is INADDR_NONE, this creates a local server socket on the
# given port, otherwise a TCP connection to the remote host and port is
# attempted. The address passed in should already be swapped to network
# byte order (addresses returned from SDLNet_ResolveHost() are already
# in the correct form).
# The newly created socket is returned, or NULL if there was an error.
#*
proc TCP_Open*(ip: var TIPaddress): PTCPSocket{.cdecl,
importc: "SDLNet_TCP_Open", dynlib: NetLibName.}
#* Accept an incoming connection on the given server socket.
# The newly created socket is returned, or NULL if there was an error.
#*
proc TCP_Accept*(server: PTCPsocket): PTCPSocket{.cdecl,
importc: "SDLNet_TCP_Accept", dynlib: NetLibName.}
#* Get the IP address of the remote system associated with the socket.
# If the socket is a server socket, this function returns NULL.
#*
proc TCP_GetPeerAddress*(sock: PTCPsocket): PIPAddress{.cdecl,
importc: "SDLNet_TCP_GetPeerAddress", dynlib: NetLibName.}
#* Send 'len' bytes of 'data' over the non-server socket 'sock'
# This function returns the actual amount of data sent. If the return value
# is less than the amount of data sent, then either the remote connection was
# closed, or an unknown socket error occurred.
#*
proc TCP_Send*(sock: PTCPsocket, data: Pointer, length: int): int{.cdecl,
importc: "SDLNet_TCP_Send", dynlib: NetLibName.}
#* Receive up to 'maxlen' bytes of data over the non-server socket 'sock',
# and store them in the buffer pointed to by 'data'.
# This function returns the actual amount of data received. If the return
# value is less than or equal to zero, then either the remote connection was
# closed, or an unknown socket error occurred.
#*
proc TCP_Recv*(sock: PTCPsocket, data: Pointer, maxlen: int): int{.cdecl,
importc: "SDLNet_TCP_Recv", dynlib: NetLibName.}
#* Close a TCP network socket *
proc TCP_Close*(sock: PTCPsocket){.cdecl, importc: "SDLNet_TCP_Close",
dynlib: NetLibName.}
#***********************************************************************
#* UDP network API *
#***********************************************************************
#* Allocate/resize/free a single UDP packet 'size' bytes long.
# The new packet is returned, or NULL if the function ran out of memory.
# *
proc AllocPacket*(size: int): PUDPpacket{.cdecl,
importc: "SDLNet_AllocPacket", dynlib: NetLibName.}
proc ResizePacket*(packet: PUDPpacket, newsize: int): int{.cdecl,
importc: "SDLNet_ResizePacket", dynlib: NetLibName.}
proc FreePacket*(packet: PUDPpacket){.cdecl, importc: "SDLNet_FreePacket",
dynlib: NetLibName.}
#* Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets,
# each 'size' bytes long.
# A pointer to the first packet in the array is returned, or NULL if the
# function ran out of memory.
# *
proc AllocPacketV*(howmany: int, size: int): PUDPpacket{.cdecl,
importc: "SDLNet_AllocPacketV", dynlib: NetLibName.}
proc FreePacketV*(packetV: PUDPpacket){.cdecl,
importc: "SDLNet_FreePacketV", dynlib: NetLibName.}
#* Open a UDP network socket
# If 'port' is non-zero, the UDP socket is bound to a local port.
# This allows other systems to send to this socket via a known port.
#*
proc UDP_Open*(port: Uint16): PUDPsocket{.cdecl, importc: "SDLNet_UDP_Open",
dynlib: NetLibName.}
#* Bind the address 'address' to the requested channel on the UDP socket.
# If the channel is -1, then the first unbound channel will be bound with
# the given address as it's primary address.
# If the channel is already bound, this new address will be added to the
# list of valid source addresses for packets arriving on the channel.
# If the channel is not already bound, then the address becomes the primary
# address, to which all outbound packets on the channel are sent.
# This function returns the channel which was bound, or -1 on error.
#*
proc UDP_Bind*(sock: PUDPsocket, channel: int, address: var TIPaddress): int{.
cdecl, importc: "SDLNet_UDP_Bind", dynlib: NetLibName.}
#* Unbind all addresses from the given channel *
proc UDP_Unbind*(sock: PUDPsocket, channel: int){.cdecl,
importc: "SDLNet_UDP_Unbind", dynlib: NetLibName.}
#* Get the primary IP address of the remote system associated with the
# socket and channel. If the channel is -1, then the primary IP port
# of the UDP socket is returned -- this is only meaningful for sockets
# opened with a specific port.
# If the channel is not bound and not -1, this function returns NULL.
# *
proc UDP_GetPeerAddress*(sock: PUDPsocket, channel: int): PIPAddress{.cdecl,
importc: "SDLNet_UDP_GetPeerAddress", dynlib: NetLibName.}
#* Send a vector of packets to the the channels specified within the packet.
# If the channel specified in the packet is -1, the packet will be sent to
# the address in the 'src' member of the packet.
# Each packet will be updated with the status of the packet after it has
# been sent, -1 if the packet send failed.
# This function returns the number of packets sent.
#*
proc UDP_SendV*(sock: PUDPsocket, packets: PPUDPpacket, npackets: int): int{.
cdecl, importc: "SDLNet_UDP_SendV", dynlib: NetLibName.}
#* Send a single packet to the specified channel.
# If the channel specified in the packet is -1, the packet will be sent to
# the address in the 'src' member of the packet.
# The packet will be updated with the status of the packet after it has
# been sent.
# This function returns 1 if the packet was sent, or 0 on error.
#*
proc UDP_Send*(sock: PUDPsocket, channel: int, packet: PUDPpacket): int{.
cdecl, importc: "SDLNet_UDP_Send", dynlib: NetLibName.}
#* Receive a vector of pending packets from the UDP socket.
# The returned packets contain the source address and the channel they arrived
# on. If they did not arrive on a bound channel, the the channel will be set
# to -1.
# The channels are checked in highest to lowest order, so if an address is
# bound to multiple channels, the highest channel with the source address
# bound will be returned.
# This function returns the number of packets read from the network, or -1
# on error. This function does not block, so can return 0 packets pending.
#*
proc UDP_RecvV*(sock: PUDPsocket, packets: PPUDPpacket): int{.cdecl,
importc: "SDLNet_UDP_RecvV", dynlib: NetLibName.}
#* Receive a single packet from the UDP socket.
# The returned packet contains the source address and the channel it arrived
# on. If it did not arrive on a bound channel, the the channel will be set
# to -1.
# The channels are checked in highest to lowest order, so if an address is
# bound to multiple channels, the highest channel with the source address
# bound will be returned.
# This function returns the number of packets read from the network, or -1
# on error. This function does not block, so can return 0 packets pending.
#*
proc UDP_Recv*(sock: PUDPsocket, packet: PUDPpacket): int{.cdecl,
importc: "SDLNet_UDP_Recv", dynlib: NetLibName.}
#* Close a UDP network socket *
proc UDP_Close*(sock: PUDPsocket){.cdecl, importc: "SDLNet_UDP_Close",
dynlib: NetLibName.}
#***********************************************************************
#* Hooks for checking sockets for available data *
#***********************************************************************
#* Allocate a socket set for use with SDLNet_CheckSockets()
# This returns a socket set for up to 'maxsockets' sockets, or NULL if
# the function ran out of memory.
# *
proc AllocSocketSet*(maxsockets: int): PSocketSet{.cdecl,
importc: "SDLNet_AllocSocketSet", dynlib: NetLibName.}
#* Add a socket to a set of sockets to be checked for available data *
proc AddSocket*(theSet: PSocketSet, sock: PGenericSocket): int{.
cdecl, importc: "SDLNet_AddSocket", dynlib: NetLibName.}
proc TCP_AddSocket*(theSet: PSocketSet, sock: PTCPSocket): int
proc UDP_AddSocket*(theSet: PSocketSet, sock: PUDPSocket): int
#* Remove a socket from a set of sockets to be checked for available data *
proc DelSocket*(theSet: PSocketSet, sock: PGenericSocket): int{.
cdecl, importc: "SDLNet_DelSocket", dynlib: NetLibName.}
proc TCP_DelSocket*(theSet: PSocketSet, sock: PTCPSocket): int
# SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock)
proc UDP_DelSocket*(theSet: PSocketSet, sock: PUDPSocket): int
#SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock)
#* This function checks to see if data is available for reading on the
# given set of sockets. If 'timeout' is 0, it performs a quick poll,
# otherwise the function returns when either data is available for
# reading, or the timeout in milliseconds has elapsed, which ever occurs
# first. This function returns the number of sockets ready for reading,
# or -1 if there was an error with the select() system call.
#*
proc CheckSockets*(theSet: PSocketSet, timeout: Sint32): int{.cdecl,
importc: "SDLNet_CheckSockets", dynlib: NetLibName.}
#* After calling SDLNet_CheckSockets(), you can use this function on a
# socket that was in the socket set, to find out if data is available
# for reading.
#*
proc SocketReady*(sock: PGenericSocket): bool
#* Free a set of sockets allocated by SDL_NetAllocSocketSet() *
proc FreeSocketSet*(theSet: PSocketSet){.cdecl,
importc: "SDLNet_FreeSocketSet", dynlib: NetLibName.}
#***********************************************************************
#* Platform-independent data conversion functions *
#***********************************************************************
#* Write a 16/32 bit value to network packet buffer *
proc Write16*(value: Uint16, area: Pointer){.cdecl,
importc: "SDLNet_Write16", dynlib: NetLibName.}
proc Write32*(value: Uint32, area: Pointer){.cdecl,
importc: "SDLNet_Write32", dynlib: NetLibName.}
#* Read a 16/32 bit value from network packet buffer *
proc Read16*(area: Pointer): Uint16{.cdecl, importc: "SDLNet_Read16",
dynlib: NetLibName.}
proc Read32*(area: Pointer): Uint32{.cdecl, importc: "SDLNet_Read32",
dynlib: NetLibName.}
proc VERSION(X: var Tversion) =
X.major = MAJOR_VERSION
X.minor = MINOR_VERSION
X.patch = PATCHLEVEL
proc TCP_AddSocket(theSet: PSocketSet, sock: PTCPSocket): int =
result = AddSocket(theSet, cast[PGenericSocket](sock))
proc UDP_AddSocket(theSet: PSocketSet, sock: PUDPSocket): int =
result = AddSocket(theSet, cast[PGenericSocket](sock))
proc TCP_DelSocket(theSet: PSocketSet, sock: PTCPSocket): int =
result = DelSocket(theSet, cast[PGenericSocket](sock))
proc UDP_DelSocket(theSet: PSocketSet, sock: PUDPSocket): int =
result = DelSocket(theSet, cast[PGenericSocket](sock))
proc SocketReady(sock: PGenericSocket): bool =
result = ((sock != nil) and (sock.ready == 1))

View File

@@ -1,341 +0,0 @@
#
# $Id: sdl_ttf.pas,v 1.18 2007/06/01 11:16:33 savage Exp $
#
#
#******************************************************************************
#
# JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer
# Conversion of the Simple DirectMedia Layer Headers
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : SDL_ttf.h
#
# The initial developer of this Pascal code was :
# Dominqiue Louis <Dominique@SavageSoftware.com.au>
#
# Portions created by Dominqiue Louis are
# Copyright (C) 2000 - 2001 Dominqiue Louis.
#
#
# Contributor(s)
# --------------
# Tom Jones <tigertomjones@gmx.de> His Project inspired this conversion
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
#
#
#
#
#
#
#
# Requires
# --------
# The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so
# They are available from...
# http://www.libsdl.org .
#
# Programming Notes
# -----------------
#
#
#
#
# Revision History
# ----------------
# December 08 2002 - DL : Fixed definition of TTF_RenderUnicode_Solid
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: sdl_ttf.pas,v $
# Revision 1.18 2007/06/01 11:16:33 savage
# Added IFDEF UNIX for Workaround.
#
# Revision 1.17 2007/06/01 08:38:21 savage
# Added TTF_RenderText_Solid workaround as suggested by Michalis Kamburelis
#
# Revision 1.16 2007/05/29 21:32:14 savage
# Changes as suggested by Almindor for 64bit compatibility.
#
# Revision 1.15 2007/05/20 20:32:45 savage
# Initial Changes to Handle 64 Bits
#
# Revision 1.14 2006/12/02 00:19:01 savage
# Updated to latest version
#
# Revision 1.13 2005/04/10 11:48:33 savage
# Changes as suggested by Michalis, thanks.
#
# Revision 1.12 2005/01/05 01:47:14 savage
# Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
#
# Revision 1.11 2005/01/04 23:14:57 savage
# Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
#
# Revision 1.10 2005/01/02 19:07:32 savage
# Slight bug fix to use LongInt instead of Long ( Thanks Michalis Kamburelis )
#
# Revision 1.9 2005/01/01 02:15:20 savage
# Updated to v2.0.7
#
# Revision 1.8 2004/10/07 21:02:32 savage
# Fix for FPC
#
# Revision 1.7 2004/09/30 22:39:50 savage
# Added a true type font class which contains a wrap text function.
# Changed the sdl_ttf.pas header to reflect the future of jedi-sdl.
#
# Revision 1.6 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.5 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.4 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.3 2004/04/01 20:53:24 savage
# Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/16 22:16:40 savage
# v1.0 changes
#
#
#
#******************************************************************************
#
# Define this to workaround a known bug in some freetype versions.
# The error manifests as TTF_RenderGlyph_Solid returning nil (error)
# and error message (in SDL_Error) is
# "Failed loading DPMSDisable: /usr/lib/libX11.so.6: undefined symbol: DPMSDisable"
# See [http://lists.libsdl.org/pipermail/sdl-libsdl.org/2007-March/060459.html]
#
import
sdl
when defined(windows):
const
ttfLibName = "SDL_ttf.dll"
elif defined(macosx):
const
ttfLibName = "libSDL_ttf-2.0.0.dylib"
else:
const
ttfLibName = "libSDL_ttf.so"
const
MAJOR_VERSION* = 2'i8
MINOR_VERSION* = 0'i8
PATCHLEVEL* = 8'i8 # Backwards compatibility
STYLE_NORMAL* = 0x00000000
STYLE_BOLD* = 0x00000001
STYLE_ITALIC* = 0x00000002
STYLE_UNDERLINE* = 0x00000004 # ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark)
UNICODE_BOM_NATIVE* = 0x0000FEFF
UNICODE_BOM_SWAPPED* = 0x0000FFFE
type
PFont* = ptr Tfont
TFont*{.final.} = object # This macro can be used to fill a version structure with the compile-time
# version of the SDL_ttf library.
proc Linked_Version*(): sdl.Pversion{.cdecl, importc: "TTF_Linked_Version",
dynlib: ttfLibName.}
# This function tells the library whether UNICODE text is generally
# byteswapped. A UNICODE BOM character in a string will override
# this setting for the remainder of that string.
#
proc ByteSwappedUNICODE*(swapped: int){.cdecl,
importc: "TTF_ByteSwappedUNICODE", dynlib: ttfLibName.}
#returns 0 on succes, -1 if error occurs
proc Init*(): int{.cdecl, importc: "TTF_Init", dynlib: ttfLibName.}
#
# Open a font file and create a font of the specified point size.
# Some .fon fonts will have several sizes embedded in the file, so the
# point size becomes the index of choosing which size. If the value
# is too high, the last indexed size will be the default.
#
proc OpenFont*(filename: cstring, ptsize: int): PFont{.cdecl,
importc: "TTF_OpenFont", dynlib: ttfLibName.}
proc OpenFontIndex*(filename: cstring, ptsize: int, index: int32): PFont{.
cdecl, importc: "TTF_OpenFontIndex", dynlib: ttfLibName.}
proc OpenFontRW*(src: PRWops, freesrc: int, ptsize: int): PFont{.cdecl,
importc: "TTF_OpenFontRW", dynlib: ttfLibName.}
proc OpenFontIndexRW*(src: PRWops, freesrc: int, ptsize: int, index: int32): PFont{.
cdecl, importc: "TTF_OpenFontIndexRW", dynlib: ttfLibName.}
proc GetFontStyle*(font: PFont): int{.cdecl,
importc: "TTF_GetFontStyle", dynlib: ttfLibName.}
proc SetFontStyle*(font: PFont, style: int){.cdecl,
importc: "TTF_SetFontStyle", dynlib: ttfLibName.}
# Get the total height of the font - usually equal to point size
proc FontHeight*(font: PFont): int{.cdecl, importc: "TTF_FontHeight",
dynlib: ttfLibName.}
# Get the offset from the baseline to the top of the font
# This is a positive value, relative to the baseline.
#
proc FontAscent*(font: PFont): int{.cdecl, importc: "TTF_FontAscent",
dynlib: ttfLibName.}
# Get the offset from the baseline to the bottom of the font
# This is a negative value, relative to the baseline.
#
proc FontDescent*(font: PFont): int{.cdecl, importc: "TTF_FontDescent",
dynlib: ttfLibName.}
# Get the recommended spacing between lines of text for this font
proc FontLineSkip*(font: PFont): int{.cdecl,
importc: "TTF_FontLineSkip", dynlib: ttfLibName.}
# Get the number of faces of the font
proc FontFaces*(font: PFont): int32{.cdecl, importc: "TTF_FontFaces",
dynlib: ttfLibName.}
# Get the font face attributes, if any
proc FontFaceIsFixedWidth*(font: PFont): int{.cdecl,
importc: "TTF_FontFaceIsFixedWidth", dynlib: ttfLibName.}
proc FontFaceFamilyName*(font: PFont): cstring{.cdecl,
importc: "TTF_FontFaceFamilyName", dynlib: ttfLibName.}
proc FontFaceStyleName*(font: PFont): cstring{.cdecl,
importc: "TTF_FontFaceStyleName", dynlib: ttfLibName.}
# Get the metrics (dimensions) of a glyph
proc GlyphMetrics*(font: PFont, ch: Uint16, minx: var int,
maxx: var int, miny: var int, maxy: var int,
advance: var int): int{.cdecl,
importc: "TTF_GlyphMetrics", dynlib: ttfLibName.}
# Get the dimensions of a rendered string of text
proc SizeText*(font: PFont, text: cstring, w: var int, y: var int): int{.
cdecl, importc: "TTF_SizeText", dynlib: ttfLibName.}
proc SizeUTF8*(font: PFont, text: cstring, w: var int, y: var int): int{.
cdecl, importc: "TTF_SizeUTF8", dynlib: ttfLibName.}
proc SizeUNICODE*(font: PFont, text: PUint16, w: var int, y: var int): int{.
cdecl, importc: "TTF_SizeUNICODE", dynlib: ttfLibName.}
# Create an 8-bit palettized surface and render the given text at
# fast quality with the given font and color. The 0 pixel is the
# colorkey, giving a transparent background, and the 1 pixel is set
# to the text color.
# This function returns the new surface, or NULL if there was an error.
#
proc RenderUTF8_Solid*(font: PFont, text: cstring, fg: TColor): PSurface{.
cdecl, importc: "TTF_RenderUTF8_Solid", dynlib: ttfLibName.}
proc RenderUNICODE_Solid*(font: PFont, text: PUint16, fg: TColor): PSurface{.
cdecl, importc: "TTF_RenderUNICODE_Solid", dynlib: ttfLibName.}
#
#Create an 8-bit palettized surface and render the given glyph at
# fast quality with the given font and color. The 0 pixel is the
# colorkey, giving a transparent background, and the 1 pixel is set
# to the text color. The glyph is rendered without any padding or
# centering in the X direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc RenderGlyph_Solid*(font: PFont, ch: Uint16, fg: TColor): PSurface{.
cdecl, importc: "TTF_RenderGlyph_Solid", dynlib: ttfLibName.}
# Create an 8-bit palettized surface and render the given text at
# high quality with the given font and colors. The 0 pixel is background,
# while other pixels have varying degrees of the foreground color.
# This function returns the new surface, or NULL if there was an error.
#
proc RenderText_Shaded*(font: PFont, text: cstring, fg: TColor,
bg: TColor): PSurface{.cdecl,
importc: "TTF_RenderText_Shaded", dynlib: ttfLibName.}
proc RenderUTF8_Shaded*(font: PFont, text: cstring, fg: TColor,
bg: TColor): PSurface{.cdecl,
importc: "TTF_RenderUTF8_Shaded", dynlib: ttfLibName.}
proc RenderUNICODE_Shaded*(font: PFont, text: PUint16, fg: TColor,
bg: TColor): PSurface{.cdecl,
importc: "TTF_RenderUNICODE_Shaded", dynlib: ttfLibName.}
# Create an 8-bit palettized surface and render the given glyph at
# high quality with the given font and colors. The 0 pixel is background,
# while other pixels have varying degrees of the foreground color.
# The glyph is rendered without any padding or centering in the X
# direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc RenderGlyph_Shaded*(font: PFont, ch: Uint16, fg: TColor, bg: TColor): PSurface{.
cdecl, importc: "TTF_RenderGlyph_Shaded", dynlib: ttfLibName.}
# Create a 32-bit ARGB surface and render the given text at high quality,
# using alpha blending to dither the font with the given color.
# This function returns the new surface, or NULL if there was an error.
#
proc RenderText_Blended*(font: PFont, text: cstring, fg: TColor): PSurface{.
cdecl, importc: "TTF_RenderText_Blended", dynlib: ttfLibName.}
proc RenderUTF8_Blended*(font: PFont, text: cstring, fg: TColor): PSurface{.
cdecl, importc: "TTF_RenderUTF8_Blended", dynlib: ttfLibName.}
proc RenderUNICODE_Blended*(font: PFont, text: PUint16, fg: TColor): PSurface{.
cdecl, importc: "TTF_RenderUNICODE_Blended", dynlib: ttfLibName.}
# Create a 32-bit ARGB surface and render the given glyph at high quality,
# using alpha blending to dither the font with the given color.
# The glyph is rendered without any padding or centering in the X
# direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc RenderGlyph_Blended*(font: PFont, ch: Uint16, fg: TColor): PSurface{.
cdecl, importc: "TTF_RenderGlyph_Blended", dynlib: ttfLibName.}
# For compatibility with previous versions, here are the old functions
##define TTF_RenderText(font, text, fg, bg)
# TTF_RenderText_Shaded(font, text, fg, bg)
##define TTF_RenderUTF8(font, text, fg, bg)
# TTF_RenderUTF8_Shaded(font, text, fg, bg)
##define TTF_RenderUNICODE(font, text, fg, bg)
# TTF_RenderUNICODE_Shaded(font, text, fg, bg)
# Close an opened font file
proc CloseFont*(font: PFont){.cdecl, importc: "TTF_CloseFont",
dynlib: ttfLibName.}
#De-initialize TTF engine
proc Quit*(){.cdecl, importc: "TTF_Quit", dynlib: ttfLibName.}
# Check if the TTF engine is initialized
proc WasInit*(): int{.cdecl, importc: "TTF_WasInit", dynlib: ttfLibName.}
proc VERSION*(X: var sdl.Tversion) =
X.major = MAJOR_VERSION
X.minor = MINOR_VERSION
X.patch = PATCHLEVEL
when not (defined(Workaround_RenderText_Solid)):
proc RenderText_Solid*(font: PFont, text: cstring, fg: TColor): PSurface{.
cdecl, importc: "TTF_RenderText_Solid", dynlib: ttfLibName.}
else:
proc RenderText_Solid(font: PFont, text: cstring, fg: TColor): PSurface =
var Black: TColor # initialized to zero
result = RenderText_Shaded(font, text, fg, Black)

View File

@@ -1,335 +0,0 @@
#******************************************************************************
#
# $Id: smpeg.pas,v 1.7 2004/08/14 22:54:30 savage Exp $
#
#
#
# Borland Delphi SMPEG - SDL MPEG Player Library
# Conversion of the SMPEG - SDL MPEG Player Library
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : smpeg.h
#
# The initial developer of this Pascal code was :
# Matthias Thoma <ma.thoma@gmx.de>
#
# Portions created by Matthias Thoma are
# Copyright (C) 2000 - 2001 Matthias Thoma.
#
#
# Contributor(s)
# --------------
# Tom Jones <tigertomjones@gmx.de> His Project inspired this conversion
# Matthias Thoma <ma.thoma@gmx.de>
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
#
#
#
#
#
#
#
# Requires
# --------
# The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL-1.2.so.0
# They are available from...
# http://www.libsdl.org .
#
# Programming Notes
# -----------------
#
#
#
#
# Revision History
# ----------------
# May 08 2001 - MT : Initial conversion
#
# October 12 2001 - DA : Various changes as suggested by David Acklam
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support
# Fixed all invalid calls to DLL.
# Changed constant names to:
# const
# STATUS_SMPEG_ERROR = -1;
# STATUS_SMPEG_STOPPED = 0;
# STATUS_SMPEG_PLAYING = 1;
# because SMPEG_ERROR is a function (_SMPEG_error
# isn't correct), and cannot be two elements with the
# same name
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: smpeg.pas,v $
# Revision 1.7 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.6 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.5 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.4 2004/04/02 10:40:55 savage
# Changed Linux Shared Object name so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.3 2004/03/31 22:20:02 savage
# Windows unit not used in this file, so it was removed to keep the code tidy.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/14 23:35:42 savage
# version 1 of sdl_image, sdl_mixer and smpeg.
#
#
#
#******************************************************************************
import
sdl
when defined(windows):
const
SmpegLibName = "smpeg.dll"
elif defined(macosx):
const
SmpegLibName = "libsmpeg.dylib"
else:
const
SmpegLibName = "libsmpeg.so"
const
FILTER_INFO_MB_ERROR* = 1
FILTER_INFO_PIXEL_ERROR* = 2 # Filter info from SMPEG
type
TFilterInfo*{.final.} = object
yuv_mb_square_error*: PUint16
yuv_pixel_square_error*: PUint16
PFilterInfo* = ptr TFilterInfo # MPEG filter definition
PFilter* = ptr TFilter # Callback functions for the filter
TFilterCallback* = proc (dest, source: POverlay, region: PRect,
filter_info: PFilterInfo, data: Pointer): Pointer{.
cdecl.}
TFilterDestroy* = proc (Filter: PFilter): Pointer{.cdecl.} # The filter definition itself
TFilter*{.final.} = object # The null filter (default). It simply copies the source rectangle to the video overlay.
flags*: Uint32
data*: Pointer
callback*: TFilterCallback
destroy*: TFilterDestroy
proc filter_null*(): PFilter{.cdecl, importc: "SMPEGfilter_null",
dynlib: SmpegLibName.}
# The bilinear filter. A basic low-pass filter that will produce a smoother image.
proc filter_bilinear*(): PFilter{.cdecl,
importc: "SMPEGfilter_bilinear", dynlib: SmpegLibName.}
# The deblocking filter. It filters block borders and non-intra coded blocks to reduce blockiness
proc filter_deblocking*(): PFilter{.cdecl,
importc: "SMPEGfilter_deblocking", dynlib: SmpegLibName.}
#------------------------------------------------------------------------------
# SMPEG.h
#------------------------------------------------------------------------------
const
MAJOR_VERSION* = 0'i8
MINOR_VERSION* = 4'i8
PATCHLEVEL* = 2'i8
type
TVersion*{.final.} = object
major*: UInt8
minor*: UInt8
patch*: UInt8
Pversion* = ptr Tversion # This is the actual SMPEG object
TSMPEG*{.final.} = object
PSMPEG* = ptr TSMPEG # Used to get information about the SMPEG object
TInfo*{.final.} = object
has_audio*: int
has_video*: int
width*: int
height*: int
current_frame*: int
current_fps*: float64
audio_string*: array[0..79, char]
audio_current_frame*: int
current_offset*: UInt32
total_size*: UInt32
current_time*: float64
total_time*: float64
PInfo* = ptr TInfo # Possible MPEG status codes
const
STATUS_ERROR* = - 1
STATUS_STOPPED* = 0
STATUS_PLAYING* = 1
type
Tstatus* = int
Pstatus* = ptr int # Matches the declaration of SDL_UpdateRect()
TDisplayCallback* = proc (dst: PSurface, x, y: int, w, h: int): Pointer{.
cdecl.} # Create a new SMPEG object from an MPEG file.
# On return, if 'info' is not NULL, it will be filled with information
# about the MPEG object.
# This function returns a new SMPEG object. Use error() to find out
# whether or not there was a problem building the MPEG stream.
# The sdl_audio parameter indicates if SMPEG should initialize the SDL audio
# subsystem. If not, you will have to use the playaudio() function below
# to extract the decoded data.
proc SMPEG_new*(theFile: cstring, info: PInfo, audio: int): PSMPEG{.cdecl,
importc: "SMPEG_new", dynlib: SmpegLibName.}
# The same as above for a file descriptor
proc new_descr*(theFile: int, info: PInfo, audio: int): PSMPEG{.
cdecl, importc: "SMPEG_new_descr", dynlib: SmpegLibName.}
# The same as above but for a raw chunk of data. SMPEG makes a copy of the
# data, so the application is free to delete after a successful call to this
# function.
proc new_data*(data: Pointer, size: int, info: PInfo, audio: int): PSMPEG{.
cdecl, importc: "SMPEG_new_data", dynlib: SmpegLibName.}
# Get current information about an SMPEG object
proc getinfo*(mpeg: PSMPEG, info: PInfo){.cdecl,
importc: "SMPEG_getinfo", dynlib: SmpegLibName.}
#procedure getinfo(mpeg: PSMPEG; info: Pointer);
#cdecl; external SmpegLibName;
# Enable or disable audio playback in MPEG stream
proc enableaudio*(mpeg: PSMPEG, enable: int){.cdecl,
importc: "SMPEG_enableaudio", dynlib: SmpegLibName.}
# Enable or disable video playback in MPEG stream
proc enablevideo*(mpeg: PSMPEG, enable: int){.cdecl,
importc: "SMPEG_enablevideo", dynlib: SmpegLibName.}
# Delete an SMPEG object
proc delete*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_delete",
dynlib: SmpegLibName.}
# Get the current status of an SMPEG object
proc status*(mpeg: PSMPEG): Tstatus{.cdecl, importc: "SMPEG_status",
dynlib: SmpegLibName.}
# status
# Set the audio volume of an MPEG stream, in the range 0-100
proc setvolume*(mpeg: PSMPEG, volume: int){.cdecl,
importc: "SMPEG_setvolume", dynlib: SmpegLibName.}
# Set the destination surface for MPEG video playback
# 'surfLock' is a mutex used to synchronize access to 'dst', and can be NULL.
# 'callback' is a function called when an area of 'dst' needs to be updated.
# If 'callback' is NULL, the default function (SDL_UpdateRect) will be used.
proc setdisplay*(mpeg: PSMPEG, dst: PSurface, surfLock: Pmutex,
callback: TDisplayCallback){.cdecl,
importc: "SMPEG_setdisplay", dynlib: SmpegLibName.}
# Set or clear looping play on an SMPEG object
proc loop*(mpeg: PSMPEG, repeat: int){.cdecl, importc: "SMPEG_loop",
dynlib: SmpegLibName.}
# Scale pixel display on an SMPEG object
proc scaleXY*(mpeg: PSMPEG, width, height: int){.cdecl,
importc: "SMPEG_scaleXY", dynlib: SmpegLibName.}
proc scale*(mpeg: PSMPEG, scale: int){.cdecl, importc: "SMPEG_scale",
dynlib: SmpegLibName.}
proc Double*(mpeg: PSMPEG, doubleit: bool)
# Move the video display area within the destination surface
proc move*(mpeg: PSMPEG, x, y: int){.cdecl, importc: "SMPEG_move",
dynlib: SmpegLibName.}
# Set the region of the video to be shown
proc setdisplayregion*(mpeg: PSMPEG, x, y, w, h: int){.cdecl,
importc: "SMPEG_setdisplayregion", dynlib: SmpegLibName.}
# Play an SMPEG object
proc play*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_play",
dynlib: SmpegLibName.}
# Pause/Resume playback of an SMPEG object
proc pause*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_pause",
dynlib: SmpegLibName.}
# Stop playback of an SMPEG object
proc stop*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_stop",
dynlib: SmpegLibName.}
# Rewind the play position of an SMPEG object to the beginning of the MPEG
proc rewind*(mpeg: PSMPEG){.cdecl, importc: "SMPEG_rewind",
dynlib: SmpegLibName.}
# Seek 'bytes' bytes in the MPEG stream
proc seek*(mpeg: PSMPEG, bytes: int){.cdecl, importc: "SMPEG_seek",
dynlib: SmpegLibName.}
# Skip 'seconds' seconds in the MPEG stream
proc skip*(mpeg: PSMPEG, seconds: float32){.cdecl, importc: "SMPEG_skip",
dynlib: SmpegLibName.}
# Render a particular frame in the MPEG video
# API CHANGE: This function no longer takes a target surface and position.
# Use setdisplay() and move() to set this information.
proc renderFrame*(mpeg: PSMPEG, framenum: int){.cdecl,
importc: "SMPEG_renderFrame", dynlib: SmpegLibName.}
# Render the last frame of an MPEG video
proc renderFinal*(mpeg: PSMPEG, dst: PSurface, x, y: int){.cdecl,
importc: "SMPEG_renderFinal", dynlib: SmpegLibName.}
# Set video filter
proc filter*(mpeg: PSMPEG, filter: PFilter): PFilter{.cdecl,
importc: "SMPEG_filter", dynlib: SmpegLibName.}
# Return NULL if there is no error in the MPEG stream, or an error message
# if there was a fatal error in the MPEG stream for the SMPEG object.
proc error*(mpeg: PSMPEG): cstring{.cdecl, importc: "SMPEG_error",
dynlib: SmpegLibName.}
# Exported callback function for audio playback.
# The function takes a buffer and the amount of data to fill, and returns
# the amount of data in bytes that was actually written. This will be the
# amount requested unless the MPEG audio has finished.
#
proc playAudio*(mpeg: PSMPEG, stream: PUInt8, length: int): int{.cdecl,
importc: "SMPEG_playAudio", dynlib: SmpegLibName.}
# Wrapper for playAudio() that can be passed to SDL and SDL_mixer
proc playAudioSDL*(mpeg: Pointer, stream: PUInt8, length: int){.cdecl,
importc: "SMPEG_playAudioSDL", dynlib: SmpegLibName.}
# Get the best SDL audio spec for the audio stream
proc wantedSpec*(mpeg: PSMPEG, wanted: PAudioSpec): int{.cdecl,
importc: "SMPEG_wantedSpec", dynlib: SmpegLibName.}
# Inform SMPEG of the actual SDL audio spec used for sound playback
proc actualSpec*(mpeg: PSMPEG, spec: PAudioSpec){.cdecl,
importc: "SMPEG_actualSpec", dynlib: SmpegLibName.}
# This macro can be used to fill a version structure with the compile-time
# version of the SDL library.
proc GETVERSION*(X: var Tversion)
# implementation
proc double(mpeg: PSMPEG, doubleit: bool) =
if doubleit: scale(mpeg, 2)
else: scale(mpeg, 1)
proc GETVERSION(X: var Tversion) =
X.major = MAJOR_VERSION
X.minor = MINOR_VERSION
X.patch = PATCHLEVEL

View File

@@ -1,356 +0,0 @@
#
#
# Nimrod's Runtime Library
# (c) Copyright 2010 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
{.deadCodeElim: on.}
when defined(windows):
const
Lib = "sqlite3.dll"
elif defined(macosx):
const
Lib = "sqlite-3.6.13.dylib"
else:
const
Lib = "libsqlite3.so"
const
SQLITE_INTEGER* = 1
SQLITE_FLOAT* = 2
SQLITE_BLOB* = 4
SQLITE_NULL* = 5
SQLITE_TEXT* = 3
SQLITE_UTF8* = 1
SQLITE_UTF16LE* = 2
SQLITE_UTF16BE* = 3 # Use native byte order
SQLITE_UTF16* = 4 # sqlite3_create_function only
SQLITE_ANY* = 5 #sqlite_exec return values
SQLITE_OK* = 0
SQLITE_ERROR* = 1 # SQL error or missing database
SQLITE_INTERNAL* = 2 # An internal logic error in SQLite
SQLITE_PERM* = 3 # Access permission denied
SQLITE_ABORT* = 4 # Callback routine requested an abort
SQLITE_BUSY* = 5 # The database file is locked
SQLITE_LOCKED* = 6 # A table in the database is locked
SQLITE_NOMEM* = 7 # A malloc() failed
SQLITE_READONLY* = 8 # Attempt to write a readonly database
SQLITE_INTERRUPT* = 9 # Operation terminated by sqlite3_interrupt()
SQLITE_IOERR* = 10 # Some kind of disk I/O error occurred
SQLITE_CORRUPT* = 11 # The database disk image is malformed
SQLITE_NOTFOUND* = 12 # (Internal Only) Table or record not found
SQLITE_FULL* = 13 # Insertion failed because database is full
SQLITE_CANTOPEN* = 14 # Unable to open the database file
SQLITE_PROTOCOL* = 15 # Database lock protocol error
SQLITE_EMPTY* = 16 # Database is empty
SQLITE_SCHEMA* = 17 # The database schema changed
SQLITE_TOOBIG* = 18 # Too much data for one row of a table
SQLITE_CONSTRAINT* = 19 # Abort due to contraint violation
SQLITE_MISMATCH* = 20 # Data type mismatch
SQLITE_MISUSE* = 21 # Library used incorrectly
SQLITE_NOLFS* = 22 # Uses OS features not supported on host
SQLITE_AUTH* = 23 # Authorization denied
SQLITE_FORMAT* = 24 # Auxiliary database format error
SQLITE_RANGE* = 25 # 2nd parameter to sqlite3_bind out of range
SQLITE_NOTADB* = 26 # File opened that is not a database file
SQLITE_ROW* = 100 # sqlite3_step() has another row ready
SQLITE_DONE* = 101 # sqlite3_step() has finished executing
SQLITE_COPY* = 0
SQLITE_CREATE_INDEX* = 1
SQLITE_CREATE_TABLE* = 2
SQLITE_CREATE_TEMP_INDEX* = 3
SQLITE_CREATE_TEMP_TABLE* = 4
SQLITE_CREATE_TEMP_TRIGGER* = 5
SQLITE_CREATE_TEMP_VIEW* = 6
SQLITE_CREATE_TRIGGER* = 7
SQLITE_CREATE_VIEW* = 8
SQLITE_DELETE* = 9
SQLITE_DROP_INDEX* = 10
SQLITE_DROP_TABLE* = 11
SQLITE_DROP_TEMP_INDEX* = 12
SQLITE_DROP_TEMP_TABLE* = 13
SQLITE_DROP_TEMP_TRIGGER* = 14
SQLITE_DROP_TEMP_VIEW* = 15
SQLITE_DROP_TRIGGER* = 16
SQLITE_DROP_VIEW* = 17
SQLITE_INSERT* = 18
SQLITE_PRAGMA* = 19
SQLITE_READ* = 20
SQLITE_SELECT* = 21
SQLITE_TRANSACTION* = 22
SQLITE_UPDATE* = 23
SQLITE_ATTACH* = 24
SQLITE_DETACH* = 25
SQLITE_ALTER_TABLE* = 26
SQLITE_REINDEX* = 27
SQLITE_DENY* = 1
SQLITE_IGNORE* = 2 # Original from sqlite3.h:
##define SQLITE_STATIC ((void(*)(void *))0)
##define SQLITE_TRANSIENT ((void(*)(void *))-1)
const
SQLITE_STATIC* = nil
SQLITE_TRANSIENT* = cast[pointer](- 1)
type
TSqlite3 {.pure, final.} = object
PSqlite3* = ptr TSqlite3
PPSqlite3* = ptr PSqlite3
TContext{.pure, final.} = object
Pcontext* = ptr TContext
Tstmt{.pure, final.} = object
Pstmt* = ptr Tstmt
Tvalue{.pure, final.} = object
Pvalue* = ptr Tvalue
PPValue* = ptr Pvalue
Tcallback* = proc (para1: pointer, para2: int32, para3,
para4: cstringArray): int32{.cdecl.}
Tbind_destructor_func* = proc (para1: pointer){.cdecl.}
Tcreate_function_step_func* = proc (para1: Pcontext, para2: int32,
para3: PPValue){.cdecl.}
Tcreate_function_func_func* = proc (para1: Pcontext, para2: int32,
para3: PPValue){.cdecl.}
Tcreate_function_final_func* = proc (para1: Pcontext){.cdecl.}
Tresult_func* = proc (para1: pointer){.cdecl.}
Tcreate_collation_func* = proc (para1: pointer, para2: int32, para3: pointer,
para4: int32, para5: pointer): int32{.cdecl.}
Tcollation_needed_func* = proc (para1: pointer, para2: PSqlite3, eTextRep: int32,
para4: cstring){.cdecl.}
proc close*(para1: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_close".}
proc exec*(para1: PSqlite3, sql: cstring, para3: Tcallback, para4: pointer,
errmsg: var cstring): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_exec".}
proc last_insert_rowid*(para1: PSqlite3): int64{.cdecl, dynlib: Lib,
importc: "sqlite3_last_insert_rowid".}
proc changes*(para1: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_changes".}
proc total_changes*(para1: PSqlite3): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_total_changes".}
proc interrupt*(para1: PSqlite3){.cdecl, dynlib: Lib, importc: "sqlite3_interrupt".}
proc complete*(sql: cstring): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_complete".}
proc complete16*(sql: pointer): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_complete16".}
proc busy_handler*(para1: PSqlite3,
para2: proc (para1: pointer, para2: int32): int32{.cdecl.},
para3: pointer): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_busy_handler".}
proc busy_timeout*(para1: PSqlite3, ms: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_busy_timeout".}
proc get_table*(para1: PSqlite3, sql: cstring, resultp: var cstringArray,
nrow, ncolumn: var cint, errmsg: ptr cstring): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_get_table".}
proc free_table*(result: cstringArray){.cdecl, dynlib: Lib,
importc: "sqlite3_free_table".}
# Todo: see how translate sqlite3_mprintf, sqlite3_vmprintf, sqlite3_snprintf
# function sqlite3_mprintf(_para1:Pchar; args:array of const):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_mprintf';
proc mprintf*(para1: cstring): cstring{.cdecl, varargs, dynlib: Lib,
importc: "sqlite3_mprintf".}
#function sqlite3_vmprintf(_para1:Pchar; _para2:va_list):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_vmprintf';
proc free*(z: cstring){.cdecl, dynlib: Lib, importc: "sqlite3_free".}
#function sqlite3_snprintf(_para1:longint; _para2:Pchar; _para3:Pchar; args:array of const):Pchar;cdecl; external Sqlite3Lib name 'sqlite3_snprintf';
proc snprintf*(para1: int32, para2: cstring, para3: cstring): cstring{.cdecl,
dynlib: Lib, varargs, importc: "sqlite3_snprintf".}
proc set_authorizer*(para1: PSqlite3, xAuth: proc (para1: pointer, para2: int32,
para3: cstring, para4: cstring, para5: cstring, para6: cstring): int32{.
cdecl.}, pUserData: pointer): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_set_authorizer".}
proc trace*(para1: PSqlite3, xTrace: proc (para1: pointer, para2: cstring){.cdecl.},
para3: pointer): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_trace".}
proc progress_handler*(para1: PSqlite3, para2: int32,
para3: proc (para1: pointer): int32{.cdecl.},
para4: pointer){.cdecl, dynlib: Lib,
importc: "sqlite3_progress_handler".}
proc commit_hook*(para1: PSqlite3, para2: proc (para1: pointer): int32{.cdecl.},
para3: pointer): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_commit_hook".}
proc open*(filename: cstring, ppDb: var PSqlite3): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_open".}
proc open16*(filename: pointer, ppDb: var PSqlite3): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_open16".}
proc errcode*(db: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_errcode".}
proc errmsg*(para1: PSqlite3): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_errmsg".}
proc errmsg16*(para1: PSqlite3): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_errmsg16".}
proc prepare*(db: PSqlite3, zSql: cstring, nBytes: int32, ppStmt: var PStmt,
pzTail: ptr cstring): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_prepare".}
proc prepare_v2*(db: PSqlite3, zSql: cstring, nByte: cint, ppStmt: var PStmt,
pzTail: ptr cstring): cint {.
importc: "sqlite3_prepare_v2", cdecl, dynlib: Lib.}
proc prepare16*(db: PSqlite3, zSql: pointer, nBytes: int32, ppStmt: var PStmt,
pzTail: var pointer): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_prepare16".}
proc bind_blob*(para1: Pstmt, para2: int32, para3: pointer, n: int32,
para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_blob".}
proc bind_double*(para1: Pstmt, para2: int32, para3: float64): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_double".}
proc bind_int*(para1: Pstmt, para2: int32, para3: int32): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_int".}
proc bind_int64*(para1: Pstmt, para2: int32, para3: int64): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_int64".}
proc bind_null*(para1: Pstmt, para2: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_null".}
proc bind_text*(para1: Pstmt, para2: int32, para3: cstring, n: int32,
para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_text".}
proc bind_text16*(para1: Pstmt, para2: int32, para3: pointer, para4: int32,
para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_text16".}
#function sqlite3_bind_value(_para1:Psqlite3_stmt; _para2:longint; _para3:Psqlite3_value):longint;cdecl; external Sqlite3Lib name 'sqlite3_bind_value';
#These overloaded functions were introduced to allow the use of SQLITE_STATIC and SQLITE_TRANSIENT
#It's the c world man ;-)
proc bind_blob*(para1: Pstmt, para2: int32, para3: pointer, n: int32,
para5: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_blob".}
proc bind_text*(para1: Pstmt, para2: int32, para3: cstring, n: int32,
para5: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_text".}
proc bind_text16*(para1: Pstmt, para2: int32, para3: pointer, para4: int32,
para5: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_text16".}
proc bind_parameter_count*(para1: Pstmt): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_parameter_count".}
proc bind_parameter_name*(para1: Pstmt, para2: int32): cstring{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_parameter_name".}
proc bind_parameter_index*(para1: Pstmt, zName: cstring): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_parameter_index".}
#function sqlite3_clear_bindings(_para1:Psqlite3_stmt):longint;cdecl; external Sqlite3Lib name 'sqlite3_clear_bindings';
proc column_count*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_count".}
proc column_name*(para1: Pstmt, para2: int32): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_column_name".}
proc column_name16*(para1: Pstmt, para2: int32): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_column_name16".}
proc column_decltype*(para1: Pstmt, i: int32): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_column_decltype".}
proc column_decltype16*(para1: Pstmt, para2: int32): pointer{.cdecl,
dynlib: Lib, importc: "sqlite3_column_decltype16".}
proc step*(para1: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_step".}
proc data_count*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_data_count".}
proc column_blob*(para1: Pstmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_column_blob".}
proc column_bytes*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_bytes".}
proc column_bytes16*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_bytes16".}
proc column_double*(para1: Pstmt, iCol: int32): float64{.cdecl, dynlib: Lib,
importc: "sqlite3_column_double".}
proc column_int*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_int".}
proc column_int64*(para1: Pstmt, iCol: int32): int64{.cdecl, dynlib: Lib,
importc: "sqlite3_column_int64".}
proc column_text*(para1: Pstmt, iCol: int32): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_column_text".}
proc column_text16*(para1: Pstmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_column_text16".}
proc column_type*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_type".}
proc finalize*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_finalize".}
proc reset*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_reset".}
proc create_function*(para1: PSqlite3, zFunctionName: cstring, nArg: int32,
eTextRep: int32, para5: pointer,
xFunc: Tcreate_function_func_func,
xStep: Tcreate_function_step_func,
xFinal: Tcreate_function_final_func): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_create_function".}
proc create_function16*(para1: PSqlite3, zFunctionName: pointer, nArg: int32,
eTextRep: int32, para5: pointer,
xFunc: Tcreate_function_func_func,
xStep: Tcreate_function_step_func,
xFinal: Tcreate_function_final_func): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_create_function16".}
proc aggregate_count*(para1: Pcontext): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_aggregate_count".}
proc value_blob*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_value_blob".}
proc value_bytes*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_value_bytes".}
proc value_bytes16*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_value_bytes16".}
proc value_double*(para1: Pvalue): float64{.cdecl, dynlib: Lib,
importc: "sqlite3_value_double".}
proc value_int*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_value_int".}
proc value_int64*(para1: Pvalue): int64{.cdecl, dynlib: Lib,
importc: "sqlite3_value_int64".}
proc value_text*(para1: Pvalue): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_value_text".}
proc value_text16*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_value_text16".}
proc value_text16le*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_value_text16le".}
proc value_text16be*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_value_text16be".}
proc value_type*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_value_type".}
proc aggregate_context*(para1: Pcontext, nBytes: int32): pointer{.cdecl,
dynlib: Lib, importc: "sqlite3_aggregate_context".}
proc user_data*(para1: Pcontext): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_user_data".}
proc get_auxdata*(para1: Pcontext, para2: int32): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_get_auxdata".}
proc set_auxdata*(para1: Pcontext, para2: int32, para3: pointer,
para4: proc (para1: pointer){.cdecl.}){.cdecl, dynlib: Lib,
importc: "sqlite3_set_auxdata".}
proc result_blob*(para1: Pcontext, para2: pointer, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_blob".}
proc result_double*(para1: Pcontext, para2: float64){.cdecl, dynlib: Lib,
importc: "sqlite3_result_double".}
proc result_error*(para1: Pcontext, para2: cstring, para3: int32){.cdecl,
dynlib: Lib, importc: "sqlite3_result_error".}
proc result_error16*(para1: Pcontext, para2: pointer, para3: int32){.cdecl,
dynlib: Lib, importc: "sqlite3_result_error16".}
proc result_int*(para1: Pcontext, para2: int32){.cdecl, dynlib: Lib,
importc: "sqlite3_result_int".}
proc result_int64*(para1: Pcontext, para2: int64){.cdecl, dynlib: Lib,
importc: "sqlite3_result_int64".}
proc result_null*(para1: Pcontext){.cdecl, dynlib: Lib,
importc: "sqlite3_result_null".}
proc result_text*(para1: Pcontext, para2: cstring, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text".}
proc result_text16*(para1: Pcontext, para2: pointer, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text16".}
proc result_text16le*(para1: Pcontext, para2: pointer, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text16le".}
proc result_text16be*(para1: Pcontext, para2: pointer, para3: int32,
para4: Tresult_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text16be".}
proc result_value*(para1: Pcontext, para2: Pvalue){.cdecl, dynlib: Lib,
importc: "sqlite3_result_value".}
proc create_collation*(para1: PSqlite3, zName: cstring, eTextRep: int32,
para4: pointer, xCompare: Tcreate_collation_func): int32{.
cdecl, dynlib: Lib, importc: "sqlite3_create_collation".}
proc create_collation16*(para1: PSqlite3, zName: cstring, eTextRep: int32,
para4: pointer, xCompare: Tcreate_collation_func): int32{.
cdecl, dynlib: Lib, importc: "sqlite3_create_collation16".}
proc collation_needed*(para1: PSqlite3, para2: pointer, para3: Tcollation_needed_func): int32{.
cdecl, dynlib: Lib, importc: "sqlite3_collation_needed".}
proc collation_needed16*(para1: PSqlite3, para2: pointer, para3: Tcollation_needed_func): int32{.
cdecl, dynlib: Lib, importc: "sqlite3_collation_needed16".}
proc libversion*(): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_libversion".}
#Alias for allowing better code portability (win32 is not working with external variables)
proc version*(): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_libversion".}
# Not published functions
proc libversion_number*(): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_libversion_number".}
#function sqlite3_key(db:Psqlite3; pKey:pointer; nKey:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_key';
#function sqlite3_rekey(db:Psqlite3; pKey:pointer; nKey:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_rekey';
#function sqlite3_sleep(_para1:longint):longint;cdecl; external Sqlite3Lib name 'sqlite3_sleep';
#function sqlite3_expired(_para1:Psqlite3_stmt):longint;cdecl; external Sqlite3Lib name 'sqlite3_expired';
#function sqlite3_global_recover:longint;cdecl; external Sqlite3Lib name 'sqlite3_global_recover';
# implementation

View File

@@ -1,866 +0,0 @@
#
#
# Nimrod's Runtime Library
# (c) Copyright 2010 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## This module is a wrapper for the TCL programming language.
#
# tcl.h --
#
# This header file describes the externally-visible facilities of the Tcl
# interpreter.
#
# Translated to Pascal Copyright (c) 2002 by Max Artemev
# aka Bert Raccoon (bert@furry.ru, bert_raccoon@freemail.ru)
#
#
# Copyright (c) 1998-2000 by Scriptics Corporation.
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
# Copyright (c) 1993-1996 Lucent Technologies.
# Copyright (c) 1987-1994 John Ousterhout, The Regents of the
# University of California, Berkeley.
#
# ***********************************************************************
# This program 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.
# ***********************************************************************
#
{.deadCodeElim: on.}
when defined(WIN32):
const
dllName = "tcl(85|84|83|82|81|80).dll"
elif defined(macosx):
const
dllName = "libtcl(8.5|8.4|8.3|8.2|8.1).dynlib"
else:
const
dllName = "libtcl(8.5|8.4|8.3|8.2|8.1).so.(1|0)"
const
TCL_DESTROYED* = 0xDEADDEAD
TCL_OK* = 0
TCL_ERROR* = 1
TCL_RETURN* = 2
TCL_BREAK* = 3
TCL_CONTINUE* = 4
RESULT_SIZE* = 200
MAX_ARGV* = 0x00007FFF
VERSION_MAJOR* = 0
VERSION_MINOR* = 0
NO_EVAL* = 0x00010000
EVAL_GLOBAL* = 0x00020000 # Flag values passed to variable-related proc
GLOBAL_ONLY* = 1
NAMESPACE_ONLY* = 2
APPEND_VALUE* = 4
LIST_ELEMENT* = 8
TRACE_READS* = 0x00000010
TRACE_WRITES* = 0x00000020
TRACE_UNSETS* = 0x00000040
TRACE_DESTROYED* = 0x00000080
INTERP_DESTROYED* = 0x00000100
LEAVE_ERR_MSG* = 0x00000200
PARSE_PART1* = 0x00000400 # Types for linked variables: *
LINK_INT* = 1
LINK_DOUBLE* = 2
LINK_BOOLEAN* = 3
LINK_STRING* = 4
LINK_READ_ONLY* = 0x00000080
SMALL_HASH_TABLE* = 4 # Hash Table *
STRING_KEYS* = 0
ONE_WORD_KEYS* = 1 # Const/enums Tcl_QueuePosition *
QUEUE_TAIL* = 0
QUEUE_HEAD* = 1
QUEUE_MARK* = 2 # Tcl_QueuePosition;
# Event Flags
DONT_WAIT* = 1 shl 1
WINDOW_EVENTS* = 1 shl 2
FILE_EVENTS* = 1 shl 3
TIMER_EVENTS* = 1 shl 4
IDLE_EVENTS* = 1 shl 5 # WAS 0x10 ???? *
ALL_EVENTS* = not DONT_WAIT
VOLATILE* = 1
STATIC* = 0
DYNAMIC* = 3 # Channel
TCL_STDIN* = 1 shl 1
TCL_STDOUT* = 1 shl 2
TCL_STDERR* = 1 shl 3
ENFORCE_MODE* = 1 shl 4
READABLE* = 1 shl 1
WRITABLE* = 1 shl 2
EXCEPTION* = 1 shl 3 # POSIX *
EPERM* = 1 # Operation not permitted; only the owner of the file (or other
# resource) or processes with special privileges can perform the
# operation.
#
ENOENT* = 2 # No such file or directory. This is a "file doesn't exist" error
# for ordinary files that are referenced in contexts where they are
# expected to already exist.
#
ESRCH* = 3 # No process matches the specified process ID. *
EINTR* = 4 # Interrupted function call; an asynchronous signal occurred and
# prevented completion of the call. When this happens, you should
# try the call again.
#
EIO* = 5 # Input/output error; usually used for physical read or write errors. *
ENXIO* = 6 # No such device or address. The system tried to use the device
# represented by a file you specified, and it couldn't find the
# device. This can mean that the device file was installed
# incorrectly, or that the physical device is missing or not
# correctly attached to the computer.
#
E2BIG* = 7 # Argument list too long; used when the arguments passed to a new
# program being executed with one of the `exec' functions (*note
# Executing a File::.) occupy too much memory space. This condition
# never arises in the GNU system.
#
ENOEXEC* = 8 # Invalid executable file format. This condition is detected by the
# `exec' functions; see *Note Executing a File::.
#
EBADF* = 9 # Bad file descriptor; for example, I/O on a descriptor that has been
# closed or reading from a descriptor open only for writing (or vice
# versa).
#
ECHILD* = 10 # There are no child processes. This error happens on operations
# that are supposed to manipulate child processes, when there aren't
# any processes to manipulate.
#
EDEADLK* = 11 # Deadlock avoided; allocating a system resource would have resulted
# in a deadlock situation. The system does not guarantee that it
# will notice all such situations. This error means you got lucky
# and the system noticed; it might just hang. *Note File Locks::,
# for an example.
#
ENOMEM* = 12 # No memory available. The system cannot allocate more virtual
# memory because its capacity is full.
#
EACCES* = 13 # Permission denied; the file permissions do not allow the attempted
# operation.
#
EFAULT* = 14 # Bad address; an invalid pointer was detected. In the GNU system,
# this error never happens; you get a signal instead.
#
ENOTBLK* = 15 # A file that isn't a block special file was given in a situation
# that requires one. For example, trying to mount an ordinary file
# as a file system in Unix gives this error.
#
EBUSY* = 16 # Resource busy; a system resource that can't be shared is already
# in use. For example, if you try to delete a file that is the root
# of a currently mounted filesystem, you get this error.
#
EEXIST* = 17 # File exists; an existing file was specified in a context where it
# only makes sense to specify a new file.
#
EXDEV* = 18 # An attempt to make an improper link across file systems was
# detected. This happens not only when you use `link' (*note Hard
# Links::.) but also when you rename a file with `rename' (*note
# Renaming Files::.).
#
ENODEV* = 19 # The wrong type of device was given to a function that expects a
# particular sort of device.
#
ENOTDIR* = 20 # A file that isn't a directory was specified when a directory is
# required.
#
EISDIR* = 21 # File is a directory; you cannot open a directory for writing, or
# create or remove hard links to it.
#
EINVAL* = 22 # Invalid argument. This is used to indicate various kinds of
# problems with passing the wrong argument to a library function.
#
EMFILE* = 24 # The current process has too many files open and can't open any
# more. Duplicate descriptors do count toward this limit.
#
# In BSD and GNU, the number of open files is controlled by a
# resource limit that can usually be increased. If you get this
# error, you might want to increase the `RLIMIT_NOFILE' limit or
# make it unlimited; *note Limits on Resources::..
#
ENFILE* = 23 # There are too many distinct file openings in the entire system.
# Note that any number of linked channels count as just one file
# opening; see *Note Linked Channels::. This error never occurs in
# the GNU system.
#
ENOTTY* = 25 # Inappropriate I/O control operation, such as trying to set terminal
# modes on an ordinary file.
#
ETXTBSY* = 26 # An attempt to execute a file that is currently open for writing, or
# write to a file that is currently being executed. Often using a
# debugger to run a program is considered having it open for writing
# and will cause this error. (The name stands for "text file
# busy".) This is not an error in the GNU system; the text is
# copied as necessary.
#
EFBIG* = 27 # File too big; the size of a file would be larger than allowed by
# the system.
#
ENOSPC* = 28 # No space left on device; write operation on a file failed because
# the disk is full.
#
ESPIPE* = 29 # Invalid seek operation (such as on a pipe). *
EROFS* = 30 # An attempt was made to modify something on a read-only file system. *
EMLINK* = 31 # Too many links; the link count of a single file would become too
# large. `rename' can cause this error if the file being renamed
# already has as many links as it can take (*note Renaming Files::.).
#
EPIPE* = 32 # Broken pipe; there is no process reading from the other end of a
# pipe. Every library function that returns this error code also
# generates a `SIGPIPE' signal; this signal terminates the program
# if not handled or blocked. Thus, your program will never actually
# see `EPIPE' unless it has handled or blocked `SIGPIPE'.
#
EDOM* = 33 # Domain error; used by mathematical functions when an argument
# value does not fall into the domain over which the function is
# defined.
#
ERANGE* = 34 # Range error; used by mathematical functions when the result value
# is not representable because of overflow or underflow.
#
EAGAIN* = 35 # Resource temporarily unavailable; the call might work if you try
# again later. The macro `EWOULDBLOCK' is another name for `EAGAIN';
# they are always the same in the GNU C library.
#
EWOULDBLOCK* = EAGAIN # In the GNU C library, this is another name for `EAGAIN' (above).
# The values are always the same, on every operating system.
# C libraries in many older Unix systems have `EWOULDBLOCK' as a
# separate error code.
#
EINPROGRESS* = 36 # An operation that cannot complete immediately was initiated on an
# object that has non-blocking mode selected. Some functions that
# must always block (such as `connect'; *note Connecting::.) never
# return `EAGAIN'. Instead, they return `EINPROGRESS' to indicate
# that the operation has begun and will take some time. Attempts to
# manipulate the object before the call completes return `EALREADY'.
# You can use the `select' function to find out when the pending
# operation has completed; *note Waiting for I/O::..
#
EALREADY* = 37 # An operation is already in progress on an object that has
# non-blocking mode selected.
#
ENOTSOCK* = 38 # A file that isn't a socket was specified when a socket is required. *
EDESTADDRREQ* = 39 # No default destination address was set for the socket. You get
# this error when you try to transmit data over a connectionless
# socket, without first specifying a destination for the data with
# `connect'.
#
EMSGSIZE* = 40 # The size of a message sent on a socket was larger than the
# supported maximum size.
#
EPROTOTYPE* = 41 # The socket type does not support the requested communications
# protocol.
#
ENOPROTOOPT* = 42 # You specified a socket option that doesn't make sense for the
# particular protocol being used by the socket. *Note Socket
# Options::.
#
EPROTONOSUPPORT* = 43 # The socket domain does not support the requested communications
# protocol (perhaps because the requested protocol is completely
# invalid.) *Note Creating a Socket::.
#
ESOCKTNOSUPPORT* = 44 # The socket type is not supported. *
EOPNOTSUPP* = 45 # The operation you requested is not supported. Some socket
# functions don't make sense for all types of sockets, and others
# may not be implemented for all communications protocols. In the
# GNU system, this error can happen for many calls when the object
# does not support the particular operation; it is a generic
# indication that the server knows nothing to do for that call.
#
EPFNOSUPPORT* = 46 # The socket communications protocol family you requested is not
# supported.
#
EAFNOSUPPORT* = 47 # The address family specified for a socket is not supported; it is
# inconsistent with the protocol being used on the socket. *Note
# Sockets::.
#
EADDRINUSE* = 48 # The requested socket address is already in use. *Note Socket
# Addresses::.
#
EADDRNOTAVAIL* = 49 # The requested socket address is not available; for example, you
# tried to give a socket a name that doesn't match the local host
# name. *Note Socket Addresses::.
#
ENETDOWN* = 50 # A socket operation failed because the network was down. *
ENETUNREACH* = 51 # A socket operation failed because the subnet containing the remote
# host was unreachable.
#
ENETRESET* = 52 # A network connection was reset because the remote host crashed. *
ECONNABORTED* = 53 # A network connection was aborted locally. *
ECONNRESET* = 54 # A network connection was closed for reasons outside the control of
# the local host, such as by the remote machine rebooting or an
# unrecoverable protocol violation.
#
ENOBUFS* = 55 # The kernel's buffers for I/O operations are all in use. In GNU,
# this error is always synonymous with `ENOMEM'; you may get one or
# the other from network operations.
#
EISCONN* = 56 # You tried to connect a socket that is already connected. *Note
# Connecting::.
#
ENOTCONN* = 57 # The socket is not connected to anything. You get this error when
# you try to transmit data over a socket, without first specifying a
# destination for the data. For a connectionless socket (for
# datagram protocols, such as UDP), you get `EDESTADDRREQ' instead.
#
ESHUTDOWN* = 58 # The socket has already been shut down. *
ETOOMANYREFS* = 59 # ??? *
ETIMEDOUT* = 60 # A socket operation with a specified timeout received no response
# during the timeout period.
#
ECONNREFUSED* = 61 # A remote host refused to allow the network connection (typically
# because it is not running the requested service).
#
ELOOP* = 62 # Too many levels of symbolic links were encountered in looking up a
# file name. This often indicates a cycle of symbolic links.
#
ENAMETOOLONG* = 63 # Filename too long (longer than `PATH_MAX'; *note Limits for
# Files::.) or host name too long (in `gethostname' or
# `sethostname'; *note Host Identification::.).
#
EHOSTDOWN* = 64 # The remote host for a requested network connection is down. *
EHOSTUNREACH* = 65 # The remote host for a requested network connection is not
# reachable.
#
ENOTEMPTY* = 66 # Directory not empty, where an empty directory was expected.
# Typically, this error occurs when you are trying to delete a
# directory.
#
EPROCLIM* = 67 # This means that the per-user limit on new process would be
# exceeded by an attempted `fork'. *Note Limits on Resources::, for
# details on the `RLIMIT_NPROC' limit.
#
EUSERS* = 68 # The file quota system is confused because there are too many users. *
EDQUOT* = 69 # The user's disk quota was exceeded. *
ESTALE* = 70 # Stale NFS file handle. This indicates an internal confusion in
# the NFS system which is due to file system rearrangements on the
# server host. Repairing this condition usually requires unmounting
# and remounting the NFS file system on the local host.
#
EREMOTE* = 71 # An attempt was made to NFS-mount a remote file system with a file
# name that already specifies an NFS-mounted file. (This is an
# error on some operating systems, but we expect it to work properly
# on the GNU system, making this error code impossible.)
#
EBADRPC* = 72 # ??? *
ERPCMISMATCH* = 73 # ??? *
EPROGUNAVAIL* = 74 # ??? *
EPROGMISMATCH* = 75 # ??? *
EPROCUNAVAIL* = 76 # ??? *
ENOLCK* = 77 # No locks available. This is used by the file locking facilities;
# see *Note File Locks::. This error is never generated by the GNU
# system, but it can result from an operation to an NFS server
# running another operating system.
#
ENOSYS* = 78 # Function not implemented. Some functions have commands or options
# defined that might not be supported in all implementations, and
# this is the kind of error you get if you request them and they are
# not supported.
#
EFTYPE* = 79 # Inappropriate file type or format. The file was the wrong type
# for the operation, or a data file had the wrong format.
# On some systems `chmod' returns this error if you try to set the
# sticky bit on a non-directory file; *note Setting Permissions::..
#
type
TArgv* = cstringArray
TClientData* = pointer
TFreeProc* = proc (theBlock: pointer){.cdecl.}
PInterp* = ptr TInterp
TInterp*{.final.} = object # Event Definitions
result*: cstring # Do not access this directly. Use
# Tcl_GetStringResult since result
# may be pointing to an object
#
freeProc*: TFreeProc
errorLine*: int
TEventSetupProc* = proc (clientData: TClientData, flags: int){.cdecl.}
TEventCheckProc* = TEventSetupProc
PEvent* = ptr TEvent
TEventProc* = proc (evPtr: PEvent, flags: int): int{.cdecl.}
TEvent*{.final.} = object
prc*: TEventProc
nextPtr*: PEvent
ClientData*: TObject # ClientData is just pointer.*
PTime* = ptr TTime
TTime*{.final.} = object
sec*: int32 # Seconds. *
usec*: int32 # Microseconds. *
TTimerToken* = pointer
PInteger* = ptr int
PHashTable* = ptr THashTable
PHashEntry* = ptr THashEntry
PPHashEntry* = ptr PHashEntry
THashEntry*{.final.} = object
nextPtr*: PHashEntry
tablePtr*: PHashTable
bucketPtr*: PPHashEntry
clientData*: TClientData
key*: cstring
THashFindProc* = proc (tablePtr: PHashTable, key: cstring): PHashEntry{.
cdecl.}
THashCreateProc* = proc (tablePtr: PHashTable, key: cstring,
newPtr: PInteger): PHashEntry{.cdecl.}
THashTable*{.final.} = object
buckets*: ppHashEntry
staticBuckets*: array[0..SMALL_HASH_TABLE - 1, PHashEntry]
numBuckets*: int
numEntries*: int
rebuildSize*: int
downShift*: int
mask*: int
keyType*: int
findProc*: THashFindProc
createProc*: THashCreateProc
PHashSearch* = ptr THashSearch
THashSearch*{.final.} = object
tablePtr*: PHashTable
nextIndex*: int
nextEntryPtr*: PHashEntry
TAppInitProc* = proc (interp: pInterp): int{.cdecl.}
TPackageInitProc* = proc (interp: pInterp): int{.cdecl.}
TCmdProc* = proc (clientData: TClientData, interp: pInterp, argc: int,
argv: TArgv): int{.cdecl.}
TVarTraceProc* = proc (clientData: TClientData, interp: pInterp,
varName: cstring, elemName: cstring, flags: int): cstring{.
cdecl.}
TInterpDeleteProc* = proc (clientData: TClientData, interp: pInterp){.cdecl.}
TCmdDeleteProc* = proc (clientData: TClientData){.cdecl.}
TNamespaceDeleteProc* = proc (clientData: TClientData){.cdecl.}
const
DSTRING_STATIC_SIZE* = 200
type
PDString* = ptr TDString
TDString*{.final.} = object
str*: cstring
len*: int
spaceAvl*: int
staticSpace*: array[0..DSTRING_STATIC_SIZE - 1, char]
PChannel* = ptr TChannel
TChannel*{.final.} = object
TDriverBlockModeProc* = proc (instanceData: TClientData, mode: int): int{.
cdecl.}
TDriverCloseProc* = proc (instanceData: TClientData, interp: PInterp): int{.
cdecl.}
TDriverInputProc* = proc (instanceData: TClientData, buf: cstring,
toRead: int, errorCodePtr: PInteger): int{.cdecl.}
TDriverOutputProc* = proc (instanceData: TClientData, buf: cstring,
toWrite: int, errorCodePtr: PInteger): int{.cdecl.}
TDriverSeekProc* = proc (instanceData: TClientData, offset: int32,
mode: int, errorCodePtr: PInteger): int{.cdecl.}
TDriverSetOptionProc* = proc (instanceData: TClientData, interp: PInterp,
optionName: cstring, value: cstring): int{.cdecl.}
TDriverGetOptionProc* = proc (instanceData: TClientData, interp: pInterp,
optionName: cstring, dsPtr: PDString): int{.
cdecl.}
TDriverWatchProc* = proc (instanceData: TClientData, mask: int){.cdecl.}
TDriverGetHandleProc* = proc (instanceData: TClientData, direction: int,
handlePtr: var TClientData): int{.cdecl.}
PChannelType* = ptr TChannelType
TChannelType*{.final.} = object
typeName*: cstring
blockModeProc*: TDriverBlockModeProc
closeProc*: TDriverCloseProc
inputProc*: TDriverInputProc
ouputProc*: TDriverOutputProc
seekProc*: TDriverSeekProc
setOptionProc*: TDriverSetOptionProc
getOptionProc*: TDriverGetOptionProc
watchProc*: TDriverWatchProc
getHandleProc*: TDriverGetHandleProc
TChannelProc* = proc (clientData: TClientData, mask: int){.cdecl.}
PObj* = ptr TObj
PPObj* = ptr PObj
TObj*{.final.} = object
refCount*: int # ...
TObjCmdProc* = proc (clientData: TClientData, interp: PInterp, objc: int,
PPObj: PPObj): int{.cdecl.}
PNamespace* = ptr TNamespace
TNamespace*{.final.} = object
name*: cstring
fullName*: cstring
clientData*: TClientData
deleteProc*: TNamespaceDeleteProc
parentPtr*: PNamespace
PCallFrame* = ptr TCallFrame
TCallFrame*{.final.} = object
nsPtr*: PNamespace
dummy1*: int
dummy2*: int
dummy3*: cstring
dummy4*: cstring
dummy5*: cstring
dummy6*: int
dummy7*: cstring
dummy8*: cstring
dummy9*: int
dummy10*: cstring
PCmdInfo* = ptr TCmdInfo
TCmdInfo*{.final.} = object
isNativeObjectProc*: int
objProc*: TObjCmdProc
objClientData*: TClientData
prc*: TCmdProc
clientData*: TClientData
deleteProc*: TCmdDeleteProc
deleteData*: TClientData
namespacePtr*: pNamespace
pCommand* = ptr TCommand
TCommand*{.final.} = object # hPtr : pTcl_HashEntry;
# nsPtr : pTcl_Namespace;
# refCount : integer;
# isCmdEpoch : integer;
# compileProc : pointer;
# objProc : pointer;
# objClientData : Tcl_ClientData;
# proc : pointer;
# clientData : Tcl_ClientData;
# deleteProc : TTclCmdDeleteProc;
# deleteData : Tcl_ClientData;
# deleted : integer;
# importRefPtr : pointer;
#
type
TPanicProc* = proc (fmt, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8: cstring){.
cdecl.} # 1/15/97 orig. Tcl style
TClientDataProc* = proc (clientData: TClientData){.cdecl.}
TIdleProc* = proc (clientData: TClientData){.cdecl.}
TTimerProc* = TIdleProc
TCreateCloseHandler* = proc (channel: pChannel, prc: TClientDataProc,
clientData: TClientData){.cdecl.}
TDeleteCloseHandler* = TCreateCloseHandler
TEventDeleteProc* = proc (evPtr: pEvent, clientData: TClientData): int{.
cdecl.}
proc Alloc*(size: int): cstring{.cdecl, dynlib: dllName,
importc: "Tcl_Alloc".}
proc CreateInterp*(): pInterp{.cdecl, dynlib: dllName,
importc: "Tcl_CreateInterp".}
proc DeleteInterp*(interp: pInterp){.cdecl, dynlib: dllName,
importc: "Tcl_DeleteInterp".}
proc ResetResult*(interp: pInterp){.cdecl, dynlib: dllName,
importc: "Tcl_ResetResult".}
proc Eval*(interp: pInterp, script: cstring): int{.cdecl, dynlib: dllName,
importc: "Tcl_Eval".}
proc EvalFile*(interp: pInterp, filename: cstring): int{.cdecl,
dynlib: dllName, importc: "Tcl_EvalFile".}
proc AddErrorInfo*(interp: pInterp, message: cstring){.cdecl,
dynlib: dllName, importc: "Tcl_AddErrorInfo".}
proc BackgroundError*(interp: pInterp){.cdecl, dynlib: dllName,
importc: "Tcl_BackgroundError".}
proc CreateCommand*(interp: pInterp, name: cstring, cmdProc: TCmdProc,
clientData: TClientData, deleteProc: TCmdDeleteProc): pCommand{.
cdecl, dynlib: dllName, importc: "Tcl_CreateCommand".}
proc DeleteCommand*(interp: pInterp, name: cstring): int{.cdecl,
dynlib: dllName, importc: "Tcl_DeleteCommand".}
proc CallWhenDeleted*(interp: pInterp, prc: TInterpDeleteProc,
clientData: TClientData){.cdecl, dynlib: dllName,
importc: "Tcl_CallWhenDeleted".}
proc DontCallWhenDeleted*(interp: pInterp, prc: TInterpDeleteProc,
clientData: TClientData){.cdecl,
dynlib: dllName, importc: "Tcl_DontCallWhenDeleted".}
proc CommandComplete*(cmd: cstring): int{.cdecl, dynlib: dllName,
importc: "Tcl_CommandComplete".}
proc LinkVar*(interp: pInterp, varName: cstring, varAddr: pointer, typ: int): int{.
cdecl, dynlib: dllName, importc: "Tcl_LinkVar".}
proc UnlinkVar*(interp: pInterp, varName: cstring){.cdecl, dynlib: dllName,
importc: "Tcl_UnlinkVar".}
proc TraceVar*(interp: pInterp, varName: cstring, flags: int,
prc: TVarTraceProc, clientData: TClientData): int{.cdecl,
dynlib: dllName, importc: "Tcl_TraceVar".}
proc TraceVar2*(interp: pInterp, varName: cstring, elemName: cstring,
flags: int, prc: TVarTraceProc, clientData: TClientData): int{.
cdecl, dynlib: dllName, importc: "Tcl_TraceVar2".}
proc UntraceVar*(interp: pInterp, varName: cstring, flags: int,
prc: TVarTraceProc, clientData: TClientData){.cdecl,
dynlib: dllName, importc: "Tcl_UntraceVar".}
proc UntraceVar2*(interp: pInterp, varName: cstring, elemName: cstring,
flags: int, prc: TVarTraceProc, clientData: TClientData){.
cdecl, dynlib: dllName, importc: "Tcl_UntraceVar2".}
proc GetVar*(interp: pInterp, varName: cstring, flags: int): cstring{.cdecl,
dynlib: dllName, importc: "Tcl_GetVar".}
proc GetVar2*(interp: pInterp, varName: cstring, elemName: cstring,
flags: int): cstring{.cdecl, dynlib: dllName,
importc: "Tcl_GetVar2".}
proc SetVar*(interp: pInterp, varName: cstring, newValue: cstring,
flags: int): cstring{.cdecl, dynlib: dllName,
importc: "Tcl_SetVar".}
proc SetVar2*(interp: pInterp, varName: cstring, elemName: cstring,
newValue: cstring, flags: int): cstring{.cdecl,
dynlib: dllName, importc: "Tcl_SetVar2".}
proc UnsetVar*(interp: pInterp, varName: cstring, flags: int): int{.cdecl,
dynlib: dllName, importc: "Tcl_UnsetVar".}
proc UnsetVar2*(interp: pInterp, varName: cstring, elemName: cstring,
flags: int): int{.cdecl, dynlib: dllName,
importc: "Tcl_UnsetVar2".}
proc SetResult*(interp: pInterp, newValue: cstring, freeProc: TFreeProc){.
cdecl, dynlib: dllName, importc: "Tcl_SetResult".}
proc FirstHashEntry*(hashTbl: pHashTable, searchInfo: var THashSearch): pHashEntry{.
cdecl, dynlib: dllName, importc: "Tcl_FirstHashEntry".}
proc NextHashEntry*(searchInfo: var THashSearch): pHashEntry{.cdecl,
dynlib: dllName, importc: "Tcl_NextHashEntry".}
proc InitHashTable*(hashTbl: pHashTable, keyType: int){.cdecl,
dynlib: dllName, importc: "Tcl_InitHashTable".}
proc StringMatch*(str: cstring, pattern: cstring): int{.cdecl,
dynlib: dllName, importc: "Tcl_StringMatch".}
proc GetErrno*(): int{.cdecl, dynlib: dllName, importc: "Tcl_GetErrno".}
proc SetErrno*(val: int){.cdecl, dynlib: dllName, importc: "Tcl_SetErrno".}
proc SetPanicProc*(prc: TPanicProc){.cdecl, dynlib: dllName,
importc: "Tcl_SetPanicProc".}
proc PkgProvide*(interp: pInterp, name: cstring, version: cstring): int{.
cdecl, dynlib: dllName, importc: "Tcl_PkgProvide".}
proc StaticPackage*(interp: pInterp, pkgName: cstring,
initProc: TPackageInitProc,
safeInitProc: TPackageInitProc){.cdecl, dynlib: dllName,
importc: "Tcl_StaticPackage".}
proc CreateEventSource*(setupProc: TEventSetupProc,
checkProc: TEventCheckProc,
clientData: TClientData){.cdecl, dynlib: dllName,
importc: "Tcl_CreateEventSource".}
proc DeleteEventSource*(setupProc: TEventSetupProc,
checkProc: TEventCheckProc,
clientData: TClientData){.cdecl, dynlib: dllName,
importc: "Tcl_DeleteEventSource".}
proc QueueEvent*(evPtr: pEvent, pos: int){.cdecl, dynlib: dllName,
importc: "Tcl_QueueEvent".}
proc SetMaxBlockTime*(timePtr: pTime){.cdecl, dynlib: dllName,
importc: "Tcl_SetMaxBlockTime".}
proc DeleteEvents*(prc: TEventDeleteProc, clientData: TClientData){.
cdecl, dynlib: dllName, importc: "Tcl_DeleteEvents".}
proc DoOneEvent*(flags: int): int{.cdecl, dynlib: dllName,
importc: "Tcl_DoOneEvent".}
proc DoWhenIdle*(prc: TIdleProc, clientData: TClientData){.cdecl,
dynlib: dllName, importc: "Tcl_DoWhenIdle".}
proc CancelIdleCall*(prc: TIdleProc, clientData: TClientData){.cdecl,
dynlib: dllName, importc: "Tcl_CancelIdleCall".}
proc CreateTimerHandler*(milliseconds: int, prc: TTimerProc,
clientData: TClientData): TTimerToken{.cdecl,
dynlib: dllName, importc: "Tcl_CreateTimerHandler".}
proc DeleteTimerHandler*(token: TTimerToken){.cdecl, dynlib: dllName,
importc: "Tcl_DeleteTimerHandler".}
# procedure Tcl_CreateModalTimeout(milliseconds: integer; prc: TTclTimerProc; clientData: Tcl_ClientData); cdecl; external dllName;
# procedure Tcl_DeleteModalTimeout(prc: TTclTimerProc; clientData: Tcl_ClientData); cdecl; external dllName;
proc SplitList*(interp: pInterp, list: cstring, argcPtr: var int,
argvPtr: var TArgv): int{.cdecl, dynlib: dllName,
importc: "Tcl_SplitList".}
proc Merge*(argc: int, argv: TArgv): cstring{.cdecl, dynlib: dllName,
importc: "Tcl_Merge".}
proc Free*(p: cstring){.cdecl, dynlib: dllName, importc: "Tcl_Free".}
proc Init*(interp: pInterp): int{.cdecl, dynlib: dllName,
importc: "Tcl_Init".}
# procedure Tcl_InterpDeleteProc(clientData: Tcl_ClientData; interp: pTcl_Interp); cdecl; external dllName;
proc GetAssocData*(interp: pInterp, key: cstring, prc: var TInterpDeleteProc): TClientData{.
cdecl, dynlib: dllName, importc: "Tcl_GetAssocData".}
proc DeleteAssocData*(interp: pInterp, key: cstring){.cdecl,
dynlib: dllName, importc: "Tcl_DeleteAssocData".}
proc SetAssocData*(interp: pInterp, key: cstring, prc: TInterpDeleteProc,
clientData: TClientData){.cdecl, dynlib: dllName,
importc: "Tcl_SetAssocData".}
proc IsSafe*(interp: pInterp): int{.cdecl, dynlib: dllName,
importc: "Tcl_IsSafe".}
proc MakeSafe*(interp: pInterp): int{.cdecl, dynlib: dllName,
importc: "Tcl_MakeSafe".}
proc CreateSlave*(interp: pInterp, slaveName: cstring, isSafe: int): pInterp{.
cdecl, dynlib: dllName, importc: "Tcl_CreateSlave".}
proc GetSlave*(interp: pInterp, slaveName: cstring): pInterp{.cdecl,
dynlib: dllName, importc: "Tcl_GetSlave".}
proc GetMaster*(interp: pInterp): pInterp{.cdecl, dynlib: dllName,
importc: "Tcl_GetMaster".}
proc GetInterpPath*(askingInterp: pInterp, slaveInterp: pInterp): int{.
cdecl, dynlib: dllName, importc: "Tcl_GetInterpPath".}
proc CreateAlias*(slaveInterp: pInterp, srcCmd: cstring,
targetInterp: pInterp, targetCmd: cstring, argc: int,
argv: TArgv): int{.cdecl, dynlib: dllName,
importc: "Tcl_CreateAlias".}
proc GetAlias*(interp: pInterp, srcCmd: cstring, targetInterp: var pInterp,
targetCmd: var cstring, argc: var int, argv: var TArgv): int{.
cdecl, dynlib: dllName, importc: "Tcl_GetAlias".}
proc ExposeCommand*(interp: pInterp, hiddenCmdName: cstring,
cmdName: cstring): int{.cdecl, dynlib: dllName,
importc: "Tcl_ExposeCommand".}
proc HideCommand*(interp: pInterp, cmdName: cstring, hiddenCmdName: cstring): int{.
cdecl, dynlib: dllName, importc: "Tcl_HideCommand".}
proc EventuallyFree*(clientData: TClientData, freeProc: TFreeProc){.
cdecl, dynlib: dllName, importc: "Tcl_EventuallyFree".}
proc Preserve*(clientData: TClientData){.cdecl, dynlib: dllName,
importc: "Tcl_Preserve".}
proc Release*(clientData: TClientData){.cdecl, dynlib: dllName,
importc: "Tcl_Release".}
proc InterpDeleted*(interp: pInterp): int{.cdecl, dynlib: dllName,
importc: "Tcl_InterpDeleted".}
proc GetCommandInfo*(interp: pInterp, cmdName: cstring,
info: var TCmdInfo): int{.cdecl, dynlib: dllName,
importc: "Tcl_GetCommandInfo".}
proc SetCommandInfo*(interp: pInterp, cmdName: cstring,
info: var TCmdInfo): int{.cdecl, dynlib: dllName,
importc: "Tcl_SetCommandInfo".}
proc FindExecutable*(path: cstring){.cdecl, dynlib: dllName,
importc: "Tcl_FindExecutable".}
proc GetStringResult*(interp: pInterp): cstring{.cdecl, dynlib: dllName,
importc: "Tcl_GetStringResult".}
#v1.0
proc FindCommand*(interp: pInterp, cmdName: cstring,
contextNsPtr: pNamespace, flags: int): TCommand{.cdecl,
dynlib: dllName, importc: "Tcl_FindCommand".}
#v1.0
proc DeleteCommandFromToken*(interp: pInterp, cmd: pCommand): int{.cdecl,
dynlib: dllName, importc: "Tcl_DeleteCommandFromToken".}
proc CreateNamespace*(interp: pInterp, name: cstring,
clientData: TClientData,
deleteProc: TNamespaceDeleteProc): pNamespace{.cdecl,
dynlib: dllName, importc: "Tcl_CreateNamespace".}
#v1.0
proc DeleteNamespace*(namespacePtr: pNamespace){.cdecl, dynlib: dllName,
importc: "Tcl_DeleteNamespace".}
proc FindNamespace*(interp: pInterp, name: cstring,
contextNsPtr: pNamespace, flags: int): pNamespace{.
cdecl, dynlib: dllName, importc: "Tcl_FindNamespace".}
proc Tcl_Export*(interp: pInterp, namespacePtr: pNamespace, pattern: cstring,
resetListFirst: int): int{.cdecl, dynlib: dllName,
importc: "Tcl_Export".}
proc Tcl_Import*(interp: pInterp, namespacePtr: pNamespace, pattern: cstring,
allowOverwrite: int): int{.cdecl, dynlib: dllName,
importc: "Tcl_Import".}
proc GetCurrentNamespace*(interp: pInterp): pNamespace{.cdecl,
dynlib: dllName, importc: "Tcl_GetCurrentNamespace".}
proc GetGlobalNamespace*(interp: pInterp): pNamespace{.cdecl,
dynlib: dllName, importc: "Tcl_GetGlobalNamespace".}
proc PushCallFrame*(interp: pInterp, callFramePtr: var TCallFrame,
namespacePtr: pNamespace, isProcCallFrame: int): int{.
cdecl, dynlib: dllName, importc: "Tcl_PushCallFrame".}
proc PopCallFrame*(interp: pInterp){.cdecl, dynlib: dllName,
importc: "Tcl_PopCallFrame".}
proc VarEval*(interp: pInterp): int{.cdecl, varargs, dynlib: dllName,
importc: "Tcl_VarEval".}
# For TkConsole.c *
proc RecordAndEval*(interp: pInterp, cmd: cstring, flags: int): int{.cdecl,
dynlib: dllName, importc: "Tcl_RecordAndEval".}
proc GlobalEval*(interp: pInterp, command: cstring): int{.cdecl,
dynlib: dllName, importc: "Tcl_GlobalEval".}
proc DStringFree*(dsPtr: pDString){.cdecl, dynlib: dllName,
importc: "Tcl_DStringFree".}
proc DStringAppend*(dsPtr: pDString, str: cstring, length: int): cstring{.
cdecl, dynlib: dllName, importc: "Tcl_DStringAppend".}
proc DStringAppendElement*(dsPtr: pDString, str: cstring): cstring{.cdecl,
dynlib: dllName, importc: "Tcl_DStringAppendElement".}
proc DStringInit*(dsPtr: pDString){.cdecl, dynlib: dllName,
importc: "Tcl_DStringInit".}
proc AppendResult*(interp: pInterp){.cdecl, varargs, dynlib: dllName,
importc: "Tcl_AppendResult".}
# actually a "C" var array
proc SetStdChannel*(channel: pChannel, typ: int){.cdecl, dynlib: dllName,
importc: "Tcl_SetStdChannel".}
proc SetChannelOption*(interp: pInterp, chan: pChannel, optionName: cstring,
newValue: cstring): int{.cdecl, dynlib: dllName,
importc: "Tcl_SetChannelOption".}
proc GetChannelOption*(interp: pInterp, chan: pChannel, optionName: cstring,
dsPtr: pDString): int{.cdecl, dynlib: dllName,
importc: "Tcl_GetChannelOption".}
proc CreateChannel*(typePtr: pChannelType, chanName: cstring,
instanceData: TClientData, mask: int): pChannel{.
cdecl, dynlib: dllName, importc: "Tcl_CreateChannel".}
proc RegisterChannel*(interp: pInterp, channel: pChannel){.cdecl,
dynlib: dllName, importc: "Tcl_RegisterChannel".}
proc UnregisterChannel*(interp: pInterp, channel: pChannel): int{.cdecl,
dynlib: dllName, importc: "Tcl_UnregisterChannel".}
proc CreateChannelHandler*(chan: pChannel, mask: int, prc: TChannelProc,
clientData: TClientData){.cdecl,
dynlib: dllName, importc: "Tcl_CreateChannelHandler".}
proc GetChannel*(interp: pInterp, chanName: cstring, modePtr: pInteger): pChannel{.
cdecl, dynlib: dllName, importc: "Tcl_GetChannel".}
proc GetStdChannel*(typ: int): pChannel{.cdecl, dynlib: dllName,
importc: "Tcl_GetStdChannel".}
proc Gets*(chan: pChannel, dsPtr: pDString): int{.cdecl, dynlib: dllName,
importc: "Tcl_Gets".}
proc Write*(chan: pChannel, s: cstring, slen: int): int{.cdecl,
dynlib: dllName, importc: "Tcl_Write".}
proc Flush*(chan: pChannel): int{.cdecl, dynlib: dllName,
importc: "Tcl_Flush".}
# TclWinLoadLibrary = function(name: PChar): HMODULE; cdecl; external dllName;
proc CreateExitHandler*(prc: TClientDataProc, clientData: TClientData){.
cdecl, dynlib: dllName, importc: "Tcl_CreateExitHandler".}
proc DeleteExitHandler*(prc: TClientDataProc, clientData: TClientData){.
cdecl, dynlib: dllName, importc: "Tcl_DeleteExitHandler".}
proc GetStringFromObj*(pObj: pObj, pLen: pInteger): cstring{.cdecl,
dynlib: dllName, importc: "Tcl_GetStringFromObj".}
proc CreateObjCommand*(interp: pInterp, name: cstring, cmdProc: TObjCmdProc,
clientData: TClientData,
deleteProc: TCmdDeleteProc): pCommand{.cdecl,
dynlib: dllName, importc: "Tcl_CreateObjCommand".}
proc NewStringObj*(bytes: cstring, length: int): pObj{.cdecl,
dynlib: dllName, importc: "Tcl_NewStringObj".}
# procedure TclFreeObj(pObj: pTcl_Obj); cdecl; external dllName;
proc EvalObj*(interp: pInterp, pObj: pObj): int{.cdecl, dynlib: dllName,
importc: "Tcl_EvalObj".}
proc GlobalEvalObj*(interp: pInterp, pObj: pObj): int{.cdecl,
dynlib: dllName, importc: "Tcl_GlobalEvalObj".}
proc RegComp*(exp: cstring): pointer{.cdecl, dynlib: dllName,
importc: "TclRegComp".}
proc RegExec*(prog: pointer, str: cstring, start: cstring): int{.cdecl,
dynlib: dllName, importc: "TclRegExec".}
proc RegError*(msg: cstring){.cdecl, dynlib: dllName, importc: "TclRegError".}
proc GetRegError*(): cstring{.cdecl, dynlib: dllName,
importc: "TclGetRegError".}
proc RegExpRange*(prog: pointer, index: int, head: var cstring,
tail: var cstring){.cdecl, dynlib: dllName,
importc: "Tcl_RegExpRange".}
proc GetCommandTable*(interp: pInterp): pHashTable =
if interp != nil:
result = cast[pHashTable](cast[int](interp) + sizeof(Interp) +
sizeof(pointer))
proc CreateHashEntry*(tablePtr: pHashTable, key: cstring,
newPtr: pInteger): pHashEntry =
result = cast[pHashTable](tablePtr).createProc(tablePtr, key, newPtr)
proc FindHashEntry*(tablePtr: pHashTable, key: cstring): pHashEntry =
result = cast[pHashTable](tablePtr).findProc(tablePtr, key)
proc SetHashValue*(h: pHashEntry, clientData: TClientData) =
h.clientData = clientData
proc GetHashValue*(h: pHashEntry): TClientData =
result = h.clientData
proc IncrRefCount*(pObj: pObj) =
inc(pObj.refCount)
proc DecrRefCount*(pObj: pObj) =
dec(pObj.refCount)
if pObj.refCount <= 0:
dealloc(pObj)
proc IsShared*(pObj: pObj): bool =
return pObj.refCount > 1
proc GetHashKey*(hashTbl: pHashTable, hashEntry: pHashEntry): cstring =
if hashTbl == nil or hashEntry == nil:
result = nil
else:
result = hashEntry.key

File diff suppressed because it is too large Load Diff

View File

@@ -1,36 +0,0 @@
#
# Translation of cairo-ft.h
# by Jeffrey Pohlmeyer
# updated to version 1.4 by Luiz Am<41>rico Pereira C<>mara 2007
#
import cairo, freetypeh
#todo: properly define FcPattern:
#It will require translate FontConfig header
#*
#typedef struct _XftPattern {
# int num;
# int size;
# XftPatternElt *elts;
# } XftPattern;
# typedef FcPattern XftPattern;
#
type
FcPattern* = Pointer
PFcPattern* = ptr FcPattern
proc cairo_ft_font_face_create_for_pattern*(pattern: PFcPattern): PCairoFontFace{.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_ft_font_options_substitute*(options: PCairoFontOptions,
pattern: PFcPattern){.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_ft_font_face_create_for_ft_face*(face: TFT_Face,
load_flags: int32): PCairoFontFace {.cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_ft_scaled_font_lock_face*(
scaled_font: PCairoScaledFont): TFT_Face{.cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_ft_scaled_font_unlock_face*(
scaled_font: PCairoScaledFont){.cdecl, importc, dynlib: LIB_CAIRO.}

View File

@@ -1,36 +0,0 @@
#
# Translation of cairo-win32.h version 1.4
# by Luiz Am<41>rico Pereira C<>mara 2007
#
import
Cairo, windows
proc cairo_win32_surface_create*(hdc: HDC): PCairoSurface{.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_win32_surface_create_with_ddb*(hdc: HDC, format: TCairoFormat,
width, height: int32): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_surface_create_with_dib*(format: TCairoFormat,
width, height: int32): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_surface_get_dc*(surface: PCairoSurface): HDC{.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_win32_surface_get_image*(surface: PCairoSurface): PCairoSurface{.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_font_face_create_for_logfontw*(logfont: pLOGFONTW): PCairoFontFace{.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_font_face_create_for_hfont*(font: HFONT): PCairoFontFace{.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_scaled_font_select_font*(scaled_font: PCairoScaledFont,
hdc: HDC): TCairoStatus{.cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_scaled_font_done_font*(scaled_font: PCairoScaledFont){.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_scaled_font_get_metrics_factor*(
scaled_font: PCairoScaledFont): float64{.cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_scaled_font_get_logical_to_device*(
scaled_font: PCairoScaledFont, logical_to_device: PCairoMatrix){.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_win32_scaled_font_get_device_to_logical*(
scaled_font: PCairoScaledFont, device_to_logical: PCairoMatrix){.
cdecl, importc, dynlib: LIB_CAIRO.}
# implementation

View File

@@ -1,40 +0,0 @@
#
# Translation of cairo-xlib.h version 1.4
# by Jeffrey Pohlmeyer
# updated to version 1.4 by Luiz Am<41>rico Pereira C<>mara 2007
#
import
Cairo, x, xlib, xrender
proc cairo_xlib_surface_create*(dpy: PDisplay, drawable: TDrawable,
visual: PVisual, width, height: int32): PCairoSurface{.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_create_for_bitmap*(dpy: PDisplay, bitmap: TPixmap,
screen: PScreen, width, height: int32): PCairoSurface{.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_create_with_xrender_format*(dpy: PDisplay,
drawable: TDrawable, screen: PScreen, format: PXRenderPictFormat,
width, height: int32): PCairoSurface{.cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_get_depth*(surface: PCairoSurface): int32{.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_get_display*(surface: PCairoSurface): PDisplay{.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_get_drawable*(surface: PCairoSurface): TDrawable{.
cdecl, importc, dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_get_height*(surface: PCairoSurface): int32{.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_get_screen*(surface: PCairoSurface): PScreen{.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_get_visual*(surface: PCairoSurface): PVisual{.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_get_width*(surface: PCairoSurface): int32{.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_set_size*(surface: PCairoSurface,
width, height: int32){.cdecl, importc,
dynlib: LIB_CAIRO.}
proc cairo_xlib_surface_set_drawable*(surface: PCairoSurface,
drawable: TDrawable, width, height: int32){.
cdecl, importc, dynlib: LIB_CAIRO.}
# implementation

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,277 +0,0 @@
{.deadCodeElim: on.}
import
glib2
when defined(win32):
const
gdkpixbuflib = "libgdk_pixbuf-2.0-0.dll"
elif defined(darwin):
const
gdkpixbuflib = "gdk_pixbuf-2.0.0"
# linklib gtk-x11-2.0
# linklib gdk-x11-2.0
# linklib pango-1.0.0
# linklib glib-2.0.0
# linklib gobject-2.0.0
# linklib gdk_pixbuf-2.0.0
# linklib atk-1.0.0
else:
const
gdkpixbuflib = "libgdk_pixbuf-2.0.so"
type
PGdkPixbuf* = pointer
PGdkPixbufAnimation* = pointer
PGdkPixbufAnimationIter* = pointer
PGdkPixbufAlphaMode* = ptr TGdkPixbufAlphaMode
TGdkPixbufAlphaMode* = enum
GDK_PIXBUF_ALPHA_BILEVEL, GDK_PIXBUF_ALPHA_FULL
PGdkColorspace* = ptr TGdkColorspace
TGdkColorspace* = enum
GDK_COLORSPACE_RGB
TGdkPixbufDestroyNotify* = proc (pixels: Pguchar, data: gpointer){.cdecl.}
PGdkPixbufError* = ptr TGdkPixbufError
TGdkPixbufError* = enum
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
GDK_PIXBUF_ERROR_BAD_OPTION, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION, GDK_PIXBUF_ERROR_FAILED
PGdkInterpType* = ptr TGdkInterpType
TGdkInterpType* = enum
GDK_INTERP_NEAREST, GDK_INTERP_TILES, GDK_INTERP_BILINEAR, GDK_INTERP_HYPER
proc GDK_TYPE_PIXBUF*(): GType
proc GDK_PIXBUF*(anObject: pointer): PGdkPixbuf
proc GDK_IS_PIXBUF*(anObject: pointer): bool
proc GDK_TYPE_PIXBUF_ANIMATION*(): GType
proc GDK_PIXBUF_ANIMATION*(anObject: pointer): PGdkPixbufAnimation
proc GDK_IS_PIXBUF_ANIMATION*(anObject: pointer): bool
proc GDK_TYPE_PIXBUF_ANIMATION_ITER*(): GType
proc GDK_PIXBUF_ANIMATION_ITER*(anObject: pointer): PGdkPixbufAnimationIter
proc GDK_IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool
proc GDK_PIXBUF_ERROR*(): TGQuark
proc gdk_pixbuf_error_quark*(): TGQuark{.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_error_quark".}
proc gdk_pixbuf_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_get_type".}
when not defined(GDK_PIXBUF_DISABLE_DEPRECATED):
proc gdk_pixbuf_ref*(pixbuf: PGdkPixbuf): PGdkPixbuf{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_ref".}
proc gdk_pixbuf_unref*(pixbuf: PGdkPixbuf){.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_unref".}
proc gdk_pixbuf_get_colorspace*(pixbuf: PGdkPixbuf): TGdkColorspace{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_colorspace".}
proc gdk_pixbuf_get_n_channels*(pixbuf: PGdkPixbuf): int32{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_n_channels".}
proc gdk_pixbuf_get_has_alpha*(pixbuf: PGdkPixbuf): gboolean{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_has_alpha".}
proc gdk_pixbuf_get_bits_per_sample*(pixbuf: PGdkPixbuf): int32{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_bits_per_sample".}
proc gdk_pixbuf_get_pixels*(pixbuf: PGdkPixbuf): Pguchar{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_pixels".}
proc gdk_pixbuf_get_width*(pixbuf: PGdkPixbuf): int32{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_width".}
proc gdk_pixbuf_get_height*(pixbuf: PGdkPixbuf): int32{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_height".}
proc gdk_pixbuf_get_rowstride*(pixbuf: PGdkPixbuf): int32{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_rowstride".}
proc gdk_pixbuf_new*(colorspace: TGdkColorspace, has_alpha: gboolean,
bits_per_sample: int32, width: int32, height: int32): PGdkPixbuf{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new".}
proc gdk_pixbuf_copy*(pixbuf: PGdkPixbuf): PGdkPixbuf{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_copy".}
proc gdk_pixbuf_new_subpixbuf*(src_pixbuf: PGdkPixbuf, src_x: int32,
src_y: int32, width: int32, height: int32): PGdkPixbuf{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_subpixbuf".}
proc gdk_pixbuf_new_from_file*(filename: cstring, error: pointer): PGdkPixbuf{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_file".}
proc gdk_pixbuf_new_from_data*(data: Pguchar, colorspace: TGdkColorspace,
has_alpha: gboolean, bits_per_sample: int32,
width: int32, height: int32, rowstride: int32,
destroy_fn: TGdkPixbufDestroyNotify,
destroy_fn_data: gpointer): PGdkPixbuf{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_data".}
proc gdk_pixbuf_new_from_xpm_data*(data: PPchar): PGdkPixbuf{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_xpm_data".}
proc gdk_pixbuf_new_from_inline*(data_length: gint, a: var guint8,
copy_pixels: gboolean, error: pointer): PGdkPixbuf{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_inline".}
proc gdk_pixbuf_new_from_file_at_size*(filename: cstring, width, height: gint,
error: pointer): PGdkPixbuf{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_file_at_size".}
proc gdk_pixbuf_new_from_file_at_scale*(filename: cstring, width, height: gint,
preserve_aspect_ratio: gboolean, error: pointer): PGdkPixbuf{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_new_from_file_at_scale".}
proc gdk_pixbuf_fill*(pixbuf: PGdkPixbuf, pixel: guint32){.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_fill".}
proc gdk_pixbuf_save*(pixbuf: PGdkPixbuf, filename: cstring, `type`: cstring,
error: pointer): gboolean{.cdecl, varargs,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_save".}
proc gdk_pixbuf_savev*(pixbuf: PGdkPixbuf, filename: cstring, `type`: cstring,
option_keys: PPchar, option_values: PPchar,
error: pointer): gboolean{.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_savev".}
proc gdk_pixbuf_add_alpha*(pixbuf: PGdkPixbuf, substitute_color: gboolean,
r: guchar, g: guchar, b: guchar): PGdkPixbuf{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_add_alpha".}
proc gdk_pixbuf_copy_area*(src_pixbuf: PGdkPixbuf, src_x: int32, src_y: int32,
width: int32, height: int32, dest_pixbuf: PGdkPixbuf,
dest_x: int32, dest_y: int32){.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_copy_area".}
proc gdk_pixbuf_saturate_and_pixelate*(src: PGdkPixbuf, dest: PGdkPixbuf,
saturation: gfloat, pixelate: gboolean){.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_saturate_and_pixelate".}
proc gdk_pixbuf_scale*(src: PGdkPixbuf, dest: PGdkPixbuf, dest_x: int32,
dest_y: int32, dest_width: int32, dest_height: int32,
offset_x: float64, offset_y: float64, scale_x: float64,
scale_y: float64, interp_type: TGdkInterpType){.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_scale".}
proc gdk_pixbuf_composite*(src: PGdkPixbuf, dest: PGdkPixbuf, dest_x: int32,
dest_y: int32, dest_width: int32, dest_height: int32,
offset_x: float64, offset_y: float64,
scale_x: float64, scale_y: float64,
interp_type: TGdkInterpType, overall_alpha: int32){.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_composite".}
proc gdk_pixbuf_composite_color*(src: PGdkPixbuf, dest: PGdkPixbuf,
dest_x: int32, dest_y: int32,
dest_width: int32, dest_height: int32,
offset_x: float64, offset_y: float64,
scale_x: float64, scale_y: float64,
interp_type: TGdkInterpType,
overall_alpha: int32, check_x: int32,
check_y: int32, check_size: int32,
color1: guint32, color2: guint32){.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_composite_color".}
proc gdk_pixbuf_scale_simple*(src: PGdkPixbuf, dest_width: int32,
dest_height: int32, interp_type: TGdkInterpType): PGdkPixbuf{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_scale_simple".}
proc gdk_pixbuf_composite_color_simple*(src: PGdkPixbuf, dest_width: int32,
dest_height: int32,
interp_type: TGdkInterpType,
overall_alpha: int32, check_size: int32,
color1: guint32, color2: guint32): PGdkPixbuf{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_composite_color_simple".}
proc gdk_pixbuf_animation_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_animation_get_type".}
proc gdk_pixbuf_animation_new_from_file*(filename: cstring, error: pointer): PGdkPixbufAnimation{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_new_from_file".}
when not defined(GDK_PIXBUF_DISABLE_DEPRECATED):
proc gdk_pixbuf_animation_ref*(animation: PGdkPixbufAnimation): PGdkPixbufAnimation{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_ref".}
proc gdk_pixbuf_animation_unref*(animation: PGdkPixbufAnimation){.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_unref".}
proc gdk_pixbuf_animation_get_width*(animation: PGdkPixbufAnimation): int32{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_get_width".}
proc gdk_pixbuf_animation_get_height*(animation: PGdkPixbufAnimation): int32{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_get_height".}
proc gdk_pixbuf_animation_is_static_image*(animation: PGdkPixbufAnimation): gboolean{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_is_static_image".}
proc gdk_pixbuf_animation_get_static_image*(animation: PGdkPixbufAnimation): PGdkPixbuf{.
cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_animation_get_static_image".}
proc gdk_pixbuf_animation_get_iter*(animation: PGdkPixbufAnimation,
e: var TGTimeVal): PGdkPixbufAnimationIter{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_get_iter".}
proc gdk_pixbuf_animation_iter_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_animation_iter_get_type".}
proc gdk_pixbuf_animation_iter_get_delay_time*(iter: PGdkPixbufAnimationIter): int32{.
cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_animation_iter_get_delay_time".}
proc gdk_pixbuf_animation_iter_get_pixbuf*(iter: PGdkPixbufAnimationIter): PGdkPixbuf{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_iter_get_pixbuf".}
proc gdk_pixbuf_animation_iter_on_currently_loading_frame*(
iter: PGdkPixbufAnimationIter): gboolean{.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_animation_iter_on_currently_loading_frame".}
proc gdk_pixbuf_animation_iter_advance*(iter: PGdkPixbufAnimationIter,
e: var TGTimeVal): gboolean{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_animation_iter_advance".}
proc gdk_pixbuf_get_option*(pixbuf: PGdkPixbuf, key: cstring): cstring{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_get_option".}
type
PGdkPixbufLoader* = ptr TGdkPixbufLoader
TGdkPixbufLoader* {.final, pure.} = object
parent_instance*: TGObject
priv*: gpointer
PGdkPixbufLoaderClass* = ptr TGdkPixbufLoaderClass
TGdkPixbufLoaderClass* {.final, pure.} = object
parent_class*: TGObjectClass
area_prepared*: proc (loader: PGdkPixbufLoader){.cdecl.}
area_updated*: proc (loader: PGdkPixbufLoader, x: int32, y: int32,
width: int32, height: int32){.cdecl.}
closed*: proc (loader: PGdkPixbufLoader){.cdecl.}
proc GDK_TYPE_PIXBUF_LOADER*(): GType
proc GDK_PIXBUF_LOADER*(obj: pointer): PGdkPixbufLoader
proc GDK_PIXBUF_LOADER_CLASS*(klass: pointer): PGdkPixbufLoaderClass
proc GDK_IS_PIXBUF_LOADER*(obj: pointer): bool
proc GDK_IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool
proc GDK_PIXBUF_LOADER_GET_CLASS*(obj: pointer): PGdkPixbufLoaderClass
proc gdk_pixbuf_loader_get_type*(): GType{.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_loader_get_type".}
proc gdk_pixbuf_loader_new*(): PGdkPixbufLoader{.cdecl, dynlib: gdkpixbuflib,
importc: "gdk_pixbuf_loader_new".}
proc gdk_pixbuf_loader_new_with_type*(image_type: cstring, error: pointer): PGdkPixbufLoader{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_new_with_type".}
proc gdk_pixbuf_loader_write*(loader: PGdkPixbufLoader, buf: Pguchar,
count: gsize, error: pointer): gboolean{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_write".}
proc gdk_pixbuf_loader_get_pixbuf*(loader: PGdkPixbufLoader): PGdkPixbuf{.cdecl,
dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_get_pixbuf".}
proc gdk_pixbuf_loader_get_animation*(loader: PGdkPixbufLoader): PGdkPixbufAnimation{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_get_animation".}
proc gdk_pixbuf_loader_close*(loader: PGdkPixbufLoader, error: pointer): gboolean{.
cdecl, dynlib: gdkpixbuflib, importc: "gdk_pixbuf_loader_close".}
proc GDK_TYPE_PIXBUF_LOADER*(): GType =
result = gdk_pixbuf_loader_get_type()
proc GDK_PIXBUF_LOADER*(obj: pointer): PGdkPixbufLoader =
result = cast[PGdkPixbufLoader](G_TYPE_CHECK_INSTANCE_CAST(obj,
GDK_TYPE_PIXBUF_LOADER()))
proc GDK_PIXBUF_LOADER_CLASS*(klass: pointer): PGdkPixbufLoaderClass =
result = cast[PGdkPixbufLoaderClass](G_TYPE_CHECK_CLASS_CAST(klass,
GDK_TYPE_PIXBUF_LOADER()))
proc GDK_IS_PIXBUF_LOADER*(obj: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(obj, GDK_TYPE_PIXBUF_LOADER())
proc GDK_IS_PIXBUF_LOADER_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_PIXBUF_LOADER())
proc GDK_PIXBUF_LOADER_GET_CLASS*(obj: pointer): PGdkPixbufLoaderClass =
result = cast[PGdkPixbufLoaderClass](G_TYPE_INSTANCE_GET_CLASS(obj,
GDK_TYPE_PIXBUF_LOADER()))
proc GDK_TYPE_PIXBUF*(): GType =
result = gdk_pixbuf_get_type()
proc GDK_PIXBUF*(anObject: pointer): PGdkPixbuf =
result = cast[PGdkPixbuf](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_PIXBUF()))
proc GDK_IS_PIXBUF*(anObject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_PIXBUF())
proc GDK_TYPE_PIXBUF_ANIMATION*(): GType =
result = gdk_pixbuf_animation_get_type()
proc GDK_PIXBUF_ANIMATION*(anObject: pointer): PGdkPixbufAnimation =
result = cast[PGdkPixbufAnimation](G_TYPE_CHECK_INSTANCE_CAST(anObject,
GDK_TYPE_PIXBUF_ANIMATION()))
proc GDK_IS_PIXBUF_ANIMATION*(anObject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_PIXBUF_ANIMATION())
proc GDK_TYPE_PIXBUF_ANIMATION_ITER*(): GType =
result = gdk_pixbuf_animation_iter_get_type()
proc GDK_PIXBUF_ANIMATION_ITER*(anObject: pointer): PGdkPixbufAnimationIter =
result = cast[PGdkPixbufAnimationIter](G_TYPE_CHECK_INSTANCE_CAST(anObject,
GDK_TYPE_PIXBUF_ANIMATION_ITER()))
proc GDK_IS_PIXBUF_ANIMATION_ITER*(anObject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_PIXBUF_ANIMATION_ITER())
proc GDK_PIXBUF_ERROR*(): TGQuark =
result = gdk_pixbuf_error_quark()

View File

@@ -1,564 +0,0 @@
{.deadCodeElim: on.}
import
Glib2, Gdk2
when defined(WIN32):
const
GdkGLExtLib = "libgdkglext-win32-1.0-0.dll"
else:
const
GdkGLExtLib = "libgdkglext-x11-1.0.so"
type
TGdkGLConfigAttrib* = int32
TGdkGLConfigCaveat* = int32
TGdkGLVisualType* = int32
TGdkGLTransparentType* = int32
TGdkGLDrawableTypeMask* = int32
TGdkGLRenderTypeMask* = int32
TGdkGLBufferMask* = int32
TGdkGLConfigError* = int32
TGdkGLRenderType* = int32
TGdkGLDrawableAttrib* = int32
TGdkGLPbufferAttrib* = int32
TGdkGLEventMask* = int32
TGdkGLEventType* = int32
TGdkGLDrawableType* = int32
TGdkGLProc* = Pointer
PGdkGLConfig* = ptr TGdkGLConfig
PGdkGLContext* = ptr TGdkGLContext
PGdkGLDrawable* = ptr TGdkGLDrawable
PGdkGLPixmap* = ptr TGdkGLPixmap
PGdkGLWindow* = ptr TGdkGLWindow
TGdkGLConfig* = object of TGObject
layer_plane*: gint
n_aux_buffers*: gint
n_sample_buffers*: gint
flag0*: int16
PGdkGLConfigClass* = ptr TGdkGLConfigClass
TGdkGLConfigClass* = object of TGObjectClass
TGdkGLContext* = object of TGObject
PGdkGLContextClass* = ptr TGdkGLContextClass
TGdkGLContextClass* = object of TGObjectClass
TGdkGLDrawable* = object of TGObject
PGdkGLDrawableClass* = ptr TGdkGLDrawableClass
TGdkGLDrawableClass* = object of TGTypeInterface
create_new_context*: proc (gldrawable: PGdkGLDrawable,
share_list: PGdkGLContext, direct: gboolean,
render_type: int32): PGdkGLContext{.cdecl.}
make_context_current*: proc (draw: PGdkGLDrawable, a_read: PGdkGLDrawable,
glcontext: PGdkGLContext): gboolean{.cdecl.}
is_double_buffered*: proc (gldrawable: PGdkGLDrawable): gboolean{.cdecl.}
swap_buffers*: proc (gldrawable: PGdkGLDrawable){.cdecl.}
wait_gl*: proc (gldrawable: PGdkGLDrawable){.cdecl.}
wait_gdk*: proc (gldrawable: PGdkGLDrawable){.cdecl.}
gl_begin*: proc (draw: PGdkGLDrawable, a_read: PGdkGLDrawable,
glcontext: PGdkGLContext): gboolean{.cdecl.}
gl_end*: proc (gldrawable: PGdkGLDrawable){.cdecl.}
get_gl_config*: proc (gldrawable: PGdkGLDrawable): PGdkGLConfig{.cdecl.}
get_size*: proc (gldrawable: PGdkGLDrawable, width, height: PGInt){.cdecl.}
TGdkGLPixmap* = object of TGObject
drawable*: PGdkDrawable
PGdkGLPixmapClass* = ptr TGdkGLPixmapClass
TGdkGLPixmapClass* = object of TGObjectClass
TGdkGLWindow* = object of TGObject
drawable*: PGdkDrawable
PGdkGLWindowClass* = ptr TGdkGLWindowClass
TGdkGLWindowClass* = object of TGObjectClass
const
HEADER_GDKGLEXT_MAJOR_VERSION* = 1
HEADER_GDKGLEXT_MINOR_VERSION* = 0
HEADER_GDKGLEXT_MICRO_VERSION* = 6
HEADER_GDKGLEXT_INTERFACE_AGE* = 4
HEADER_GDKGLEXT_BINARY_AGE* = 6
proc HEADER_GDKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool
var
gdkglext_major_version*{.importc, dynlib: GdkGLExtLib.}: guint
gdkglext_minor_version*{.importc, dynlib: GdkGLExtLib.}: guint
gdkglext_micro_version*{.importc, dynlib: GdkGLExtLib.}: guint
gdkglext_interface_age*{.importc, dynlib: GdkGLExtLib.}: guint
gdkglext_binary_age*{.importc, dynlib: GdkGLExtLib.}: guint
const
GDK_GL_SUCCESS* = 0
GDK_GL_ATTRIB_LIST_NONE* = 0
GDK_GL_USE_GL* = 1
GDK_GL_BUFFER_SIZE* = 2
GDK_GL_LEVEL* = 3
GDK_GL_RGBA* = 4
GDK_GL_DOUBLEBUFFER* = 5
GDK_GL_STEREO* = 6
GDK_GL_AUX_BUFFERS* = 7
GDK_GL_RED_SIZE* = 8
GDK_GL_GREEN_SIZE* = 9
GDK_GL_BLUE_SIZE* = 10
GDK_GL_ALPHA_SIZE* = 11
GDK_GL_DEPTH_SIZE* = 12
GDK_GL_STENCIL_SIZE* = 13
GDK_GL_ACCUM_RED_SIZE* = 14
GDK_GL_ACCUM_GREEN_SIZE* = 15
GDK_GL_ACCUM_BLUE_SIZE* = 16
GDK_GL_ACCUM_ALPHA_SIZE* = 17
GDK_GL_CONFIG_CAVEAT* = 0x00000020
GDK_GL_X_VISUAL_TYPE* = 0x00000022
GDK_GL_TRANSPARENT_TYPE* = 0x00000023
GDK_GL_TRANSPARENT_INDEX_VALUE* = 0x00000024
GDK_GL_TRANSPARENT_RED_VALUE* = 0x00000025
GDK_GL_TRANSPARENT_GREEN_VALUE* = 0x00000026
GDK_GL_TRANSPARENT_BLUE_VALUE* = 0x00000027
GDK_GL_TRANSPARENT_ALPHA_VALUE* = 0x00000028
GDK_GL_DRAWABLE_TYPE* = 0x00008010
GDK_GL_RENDER_TYPE* = 0x00008011
GDK_GL_X_RENDERABLE* = 0x00008012
GDK_GL_FBCONFIG_ID* = 0x00008013
GDK_GL_MAX_PBUFFER_WIDTH* = 0x00008016
GDK_GL_MAX_PBUFFER_HEIGHT* = 0x00008017
GDK_GL_MAX_PBUFFER_PIXELS* = 0x00008018
GDK_GL_VISUAL_ID* = 0x0000800B
GDK_GL_SCREEN* = 0x0000800C
GDK_GL_SAMPLE_BUFFERS* = 100000
GDK_GL_SAMPLES* = 100001
GDK_GL_DONT_CARE* = 0xFFFFFFFF
GDK_GL_NONE* = 0x00008000
GDK_GL_CONFIG_CAVEAT_DONT_CARE* = 0xFFFFFFFF
GDK_GL_CONFIG_CAVEAT_NONE* = 0x00008000
GDK_GL_SLOW_CONFIG* = 0x00008001
GDK_GL_NON_CONFORMANT_CONFIG* = 0x0000800D
GDK_GL_VISUAL_TYPE_DONT_CARE* = 0xFFFFFFFF
GDK_GL_TRUE_COLOR* = 0x00008002
GDK_GL_DIRECT_COLOR* = 0x00008003
GDK_GL_PSEUDO_COLOR* = 0x00008004
GDK_GL_STATIC_COLOR* = 0x00008005
GDK_GL_GRAY_SCALE* = 0x00008006
GDK_GL_STATIC_GRAY* = 0x00008007
GDK_GL_TRANSPARENT_NONE* = 0x00008000
GDK_GL_TRANSPARENT_RGB* = 0x00008008
GDK_GL_TRANSPARENT_INDEX* = 0x00008009
GDK_GL_WINDOW_BIT* = 1 shl 0
GDK_GL_PIXMAP_BIT* = 1 shl 1
GDK_GL_PBUFFER_BIT* = 1 shl 2
GDK_GL_RGBA_BIT* = 1 shl 0
GDK_GL_COLOR_INDEX_BIT* = 1 shl 1
GDK_GL_FRONT_LEFT_BUFFER_BIT* = 1 shl 0
GDK_GL_FRONT_RIGHT_BUFFER_BIT* = 1 shl 1
GDK_GL_BACK_LEFT_BUFFER_BIT* = 1 shl 2
GDK_GL_BACK_RIGHT_BUFFER_BIT* = 1 shl 3
GDK_GL_AUX_BUFFERS_BIT* = 1 shl 4
GDK_GL_DEPTH_BUFFER_BIT* = 1 shl 5
GDK_GL_STENCIL_BUFFER_BIT* = 1 shl 6
GDK_GL_ACCUM_BUFFER_BIT* = 1 shl 7
GDK_GL_BAD_SCREEN* = 1
GDK_GL_BAD_ATTRIBUTE* = 2
GDK_GL_NO_EXTENSION* = 3
GDK_GL_BAD_VISUAL* = 4
GDK_GL_BAD_CONTEXT* = 5
GDK_GL_BAD_VALUE* = 6
GDK_GL_BAD_ENUM* = 7
GDK_GL_RGBA_TYPE* = 0x00008014
GDK_GL_COLOR_INDEX_TYPE* = 0x00008015
GDK_GL_PRESERVED_CONTENTS* = 0x0000801B
GDK_GL_LARGEST_PBUFFER* = 0x0000801C
GDK_GL_WIDTH* = 0x0000801D
GDK_GL_HEIGHT* = 0x0000801E
GDK_GL_EVENT_MASK* = 0x0000801F
GDK_GL_PBUFFER_PRESERVED_CONTENTS* = 0x0000801B
GDK_GL_PBUFFER_LARGEST_PBUFFER* = 0x0000801C
GDK_GL_PBUFFER_HEIGHT* = 0x00008040
GDK_GL_PBUFFER_WIDTH* = 0x00008041
GDK_GL_PBUFFER_CLOBBER_MASK* = 1 shl 27
GDK_GL_DAMAGED* = 0x00008020
GDK_GL_SAVED* = 0x00008021
GDK_GL_WINDOW_VALUE* = 0x00008022
GDK_GL_PBUFFER* = 0x00008023
proc gdk_gl_config_attrib_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_attrib_get_type".}
proc GDK_TYPE_GL_CONFIG_ATTRIB*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_attrib_get_type".}
proc gdk_gl_config_caveat_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_caveat_get_type".}
proc GDK_TYPE_GL_CONFIG_CAVEAT*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_caveat_get_type".}
proc gdk_gl_visual_type_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_visual_type_get_type".}
proc GDK_TYPE_GL_VISUAL_TYPE*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_visual_type_get_type".}
proc gdk_gl_transparent_type_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_transparent_type_get_type".}
proc GDK_TYPE_GL_TRANSPARENT_TYPE*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_transparent_type_get_type".}
proc gdk_gl_drawable_type_mask_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_drawable_type_mask_get_type".}
proc GDK_TYPE_GL_DRAWABLE_TYPE_MASK*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_drawable_type_mask_get_type".}
proc gdk_gl_render_type_mask_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_render_type_mask_get_type".}
proc GDK_TYPE_GL_RENDER_TYPE_MASK*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_render_type_mask_get_type".}
proc gdk_gl_buffer_mask_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_buffer_mask_get_type".}
proc GDK_TYPE_GL_BUFFER_MASK*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_buffer_mask_get_type".}
proc gdk_gl_config_error_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_error_get_type".}
proc GDK_TYPE_GL_CONFIG_ERROR*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_error_get_type".}
proc gdk_gl_render_type_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_render_type_get_type".}
proc GDK_TYPE_GL_RENDER_TYPE*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_render_type_get_type".}
proc gdk_gl_drawable_attrib_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_drawable_attrib_get_type".}
proc GDK_TYPE_GL_DRAWABLE_ATTRIB*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_drawable_attrib_get_type".}
proc gdk_gl_pbuffer_attrib_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_pbuffer_attrib_get_type".}
proc GDK_TYPE_GL_PBUFFER_ATTRIB*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_pbuffer_attrib_get_type".}
proc gdk_gl_event_mask_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_event_mask_get_type".}
proc GDK_TYPE_GL_EVENT_MASK*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_event_mask_get_type".}
proc gdk_gl_event_type_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_event_type_get_type".}
proc GDK_TYPE_GL_EVENT_TYPE*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_event_type_get_type".}
proc gdk_gl_drawable_type_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_drawable_type_get_type".}
proc GDK_TYPE_GL_DRAWABLE_TYPE*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_drawable_type_get_type".}
proc gdk_gl_config_mode_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_mode_get_type".}
proc GDK_TYPE_GL_CONFIG_MODE*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_mode_get_type".}
proc gdk_gl_parse_args*(argc: var int32, argv: ptr cstringArray): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_parse_args".}
proc gdk_gl_init_check*(argc: var int32, argv: ptr cstringArray): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_init_check".}
proc gdk_gl_init*(argc: var int32, argv: ptr cstringArray){.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_init".}
proc gdk_gl_query_gl_extension*(extension: cstring): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_query_gl_extension".}
proc gdk_gl_get_proc_address*(proc_name: cstring): TGdkGLProc{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_get_proc_address".}
const
bm_TGdkGLConfig_is_rgba* = 1 shl 0
bp_TGdkGLConfig_is_rgba* = 0
bm_TGdkGLConfig_is_double_buffered* = 1 shl 1
bp_TGdkGLConfig_is_double_buffered* = 1
bm_TGdkGLConfig_as_single_mode* = 1 shl 2
bp_TGdkGLConfig_as_single_mode* = 2
bm_TGdkGLConfig_is_stereo* = 1 shl 3
bp_TGdkGLConfig_is_stereo* = 3
bm_TGdkGLConfig_has_alpha* = 1 shl 4
bp_TGdkGLConfig_has_alpha* = 4
bm_TGdkGLConfig_has_depth_buffer* = 1 shl 5
bp_TGdkGLConfig_has_depth_buffer* = 5
bm_TGdkGLConfig_has_stencil_buffer* = 1 shl 6
bp_TGdkGLConfig_has_stencil_buffer* = 6
bm_TGdkGLConfig_has_accum_buffer* = 1 shl 7
bp_TGdkGLConfig_has_accum_buffer* = 7
const
GDK_GL_MODE_RGB* = 0
GDK_GL_MODE_RGBA* = 0
GDK_GL_MODE_INDEX* = 1 shl 0
GDK_GL_MODE_SINGLE* = 0
GDK_GL_MODE_DOUBLE* = 1 shl 1
GDK_GL_MODE_STEREO* = 1 shl 2
GDK_GL_MODE_ALPHA* = 1 shl 3
GDK_GL_MODE_DEPTH* = 1 shl 4
GDK_GL_MODE_STENCIL* = 1 shl 5
GDK_GL_MODE_ACCUM* = 1 shl 6
GDK_GL_MODE_MULTISAMPLE* = 1 shl 7
type
TGdkGLConfigMode* = int32
PGdkGLConfigMode* = ptr TGdkGLConfigMode
proc GDK_TYPE_GL_CONFIG*(): GType
proc GDK_GL_CONFIG*(anObject: Pointer): PGdkGLConfig
proc GDK_GL_CONFIG_CLASS*(klass: Pointer): PGdkGLConfigClass
proc GDK_IS_GL_CONFIG*(anObject: Pointer): bool
proc GDK_IS_GL_CONFIG_CLASS*(klass: Pointer): bool
proc GDK_GL_CONFIG_GET_CLASS*(obj: Pointer): PGdkGLConfigClass
proc gdk_gl_config_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_config_get_type".}
proc gdk_gl_config_get_screen*(glconfig: PGdkGLConfig): PGdkScreen{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_get_screen".}
proc gdk_gl_config_get_attrib*(glconfig: PGdkGLConfig, attribute: int,
value: var cint): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_get_attrib".}
proc gdk_gl_config_get_colormap*(glconfig: PGdkGLConfig): PGdkColormap{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_get_colormap".}
proc gdk_gl_config_get_visual*(glconfig: PGdkGLConfig): PGdkVisual{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_get_visual".}
proc gdk_gl_config_get_depth*(glconfig: PGdkGLConfig): gint{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_get_depth".}
proc gdk_gl_config_get_layer_plane*(glconfig: PGdkGLConfig): gint{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_get_layer_plane".}
proc gdk_gl_config_get_n_aux_buffers*(glconfig: PGdkGLConfig): gint{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_get_n_aux_buffers".}
proc gdk_gl_config_get_n_sample_buffers*(glconfig: PGdkGLConfig): gint{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_get_n_sample_buffers".}
proc gdk_gl_config_is_rgba*(glconfig: PGdkGLConfig): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_is_rgba".}
proc gdk_gl_config_is_double_buffered*(glconfig: PGdkGLConfig): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_is_double_buffered".}
proc gdk_gl_config_is_stereo*(glconfig: PGdkGLConfig): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_is_stereo".}
proc gdk_gl_config_has_alpha*(glconfig: PGdkGLConfig): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_has_alpha".}
proc gdk_gl_config_has_depth_buffer*(glconfig: PGdkGLConfig): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_has_depth_buffer".}
proc gdk_gl_config_has_stencil_buffer*(glconfig: PGdkGLConfig): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_has_stencil_buffer".}
proc gdk_gl_config_has_accum_buffer*(glconfig: PGdkGLConfig): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_config_has_accum_buffer".}
proc GDK_TYPE_GL_CONTEXT*(): GType
proc GDK_GL_CONTEXT*(anObject: Pointer): PGdkGLContext
proc GDK_GL_CONTEXT_CLASS*(klass: Pointer): PGdkGLContextClass
proc GDK_IS_GL_CONTEXT*(anObject: Pointer): bool
proc GDK_IS_GL_CONTEXT_CLASS*(klass: Pointer): bool
proc GDK_GL_CONTEXT_GET_CLASS*(obj: Pointer): PGdkGLContextClass
proc gdk_gl_context_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_context_get_type".}
proc gdk_gl_context_new*(gldrawable: PGdkGLDrawable, share_list: PGdkGLContext,
direct: gboolean, render_type: int32): PGdkGLContext{.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_context_new".}
proc gdk_gl_context_destroy*(glcontext: PGdkGLContext){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_context_destroy".}
proc gdk_gl_context_copy*(glcontext: PGdkGLContext, src: PGdkGLContext,
mask: int32): gboolean{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_context_copy".}
proc gdk_gl_context_get_gl_drawable*(glcontext: PGdkGLContext): PGdkGLDrawable{.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_context_get_gl_drawable".}
proc gdk_gl_context_get_gl_config*(glcontext: PGdkGLContext): PGdkGLConfig{.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_context_get_gl_config".}
proc gdk_gl_context_get_share_list*(glcontext: PGdkGLContext): PGdkGLContext{.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_context_get_share_list".}
proc gdk_gl_context_is_direct*(glcontext: PGdkGLContext): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_context_is_direct".}
proc gdk_gl_context_get_render_type*(glcontext: PGdkGLContext): int32{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_context_get_render_type".}
proc gdk_gl_context_get_current*(): PGdkGLContext{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_context_get_current".}
proc GDK_TYPE_GL_DRAWABLE*(): GType
proc GDK_GL_DRAWABLE*(inst: Pointer): PGdkGLDrawable
proc GDK_GL_DRAWABLE_CLASS*(vtable: Pointer): PGdkGLDrawableClass
proc GDK_IS_GL_DRAWABLE*(inst: Pointer): bool
proc GDK_IS_GL_DRAWABLE_CLASS*(vtable: Pointer): bool
proc GDK_GL_DRAWABLE_GET_CLASS*(inst: Pointer): PGdkGLDrawableClass
proc gdk_gl_drawable_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_drawable_get_type".}
proc gdk_gl_drawable_make_current*(gldrawable: PGdkGLDrawable,
glcontext: PGdkGLContext): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_make_current".}
proc gdk_gl_drawable_is_double_buffered*(gldrawable: PGdkGLDrawable): gboolean{.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_is_double_buffered".}
proc gdk_gl_drawable_swap_buffers*(gldrawable: PGdkGLDrawable){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_swap_buffers".}
proc gdk_gl_drawable_wait_gl*(gldrawable: PGdkGLDrawable){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_wait_gl".}
proc gdk_gl_drawable_wait_gdk*(gldrawable: PGdkGLDrawable){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_wait_gdk".}
proc gdk_gl_drawable_gl_begin*(gldrawable: PGdkGLDrawable,
glcontext: PGdkGLContext): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_gl_begin".}
proc gdk_gl_drawable_gl_end*(gldrawable: PGdkGLDrawable){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_gl_end".}
proc gdk_gl_drawable_get_gl_config*(gldrawable: PGdkGLDrawable): PGdkGLConfig{.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_get_gl_config".}
proc gdk_gl_drawable_get_size*(gldrawable: PGdkGLDrawable, width, height: PGInt){.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_drawable_get_size".}
proc gdk_gl_drawable_get_current*(): PGdkGLDrawable{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_drawable_get_current".}
proc GDK_TYPE_GL_PIXMAP*(): GType
proc GDK_GL_PIXMAP*(anObject: Pointer): PGdkGLPixmap
proc GDK_GL_PIXMAP_CLASS*(klass: Pointer): PGdkGLPixmapClass
proc GDK_IS_GL_PIXMAP*(anObject: Pointer): bool
proc GDK_IS_GL_PIXMAP_CLASS*(klass: Pointer): bool
proc GDK_GL_PIXMAP_GET_CLASS*(obj: Pointer): PGdkGLPixmapClass
proc gdk_gl_pixmap_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_pixmap_get_type".}
proc gdk_gl_pixmap_new*(glconfig: PGdkGLConfig, pixmap: PGdkPixmap,
attrib_list: ptr int32): PGdkGLPixmap{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_pixmap_new".}
proc gdk_gl_pixmap_destroy*(glpixmap: PGdkGLPixmap){.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_pixmap_destroy".}
proc gdk_gl_pixmap_get_pixmap*(glpixmap: PGdkGLPixmap): PGdkPixmap{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_pixmap_get_pixmap".}
proc gdk_pixmap_set_gl_capability*(pixmap: PGdkPixmap, glconfig: PGdkGLConfig,
attrib_list: ptr int32): PGdkGLPixmap{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_pixmap_set_gl_capability".}
proc gdk_pixmap_unset_gl_capability*(pixmap: PGdkPixmap){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_pixmap_unset_gl_capability".}
proc gdk_pixmap_is_gl_capable*(pixmap: PGdkPixmap): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_pixmap_is_gl_capable".}
proc gdk_pixmap_get_gl_pixmap*(pixmap: PGdkPixmap): PGdkGLPixmap{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_pixmap_get_gl_pixmap".}
proc gdk_pixmap_get_gl_drawable*(pixmap: PGdkPixmap): PGdkGLDrawable
proc GDK_TYPE_GL_WINDOW*(): GType
proc GDK_GL_WINDOW*(anObject: Pointer): PGdkGLWindow
proc GDK_GL_WINDOW_CLASS*(klass: Pointer): PGdkGLWindowClass
proc GDK_IS_GL_WINDOW*(anObject: Pointer): bool
proc GDK_IS_GL_WINDOW_CLASS*(klass: Pointer): bool
proc GDK_GL_WINDOW_GET_CLASS*(obj: Pointer): PGdkGLWindowClass
proc gdk_gl_window_get_type*(): GType{.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_window_get_type".}
proc gdk_gl_window_new*(glconfig: PGdkGLConfig, window: PGdkWindow,
attrib_list: ptr int32): PGdkGLWindow{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_window_new".}
proc gdk_gl_window_destroy*(glwindow: PGdkGLWindow){.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_window_destroy".}
proc gdk_gl_window_get_window*(glwindow: PGdkGLWindow): PGdkWindow{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_window_get_window".}
proc gdk_window_set_gl_capability*(window: PGdkWindow, glconfig: PGdkGLConfig,
attrib_list: ptr int32): PGdkGLWindow{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_window_set_gl_capability".}
proc gdk_window_unset_gl_capability*(window: PGdkWindow){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_window_unset_gl_capability".}
proc gdk_window_is_gl_capable*(window: PGdkWindow): gboolean{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_window_is_gl_capable".}
proc gdk_window_get_gl_window*(window: PGdkWindow): PGdkGLWindow{.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_window_get_gl_window".}
proc gdk_window_get_gl_drawable*(window: PGdkWindow): PGdkGLDrawable
proc gdk_gl_draw_cube*(solid: gboolean, size: float64){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_draw_cube".}
proc gdk_gl_draw_sphere*(solid: gboolean, radius: float64, slices: int32,
stacks: int32){.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_draw_sphere".}
proc gdk_gl_draw_cone*(solid: gboolean, base: float64, height: float64,
slices: int32, stacks: int32){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_draw_cone".}
proc gdk_gl_draw_torus*(solid: gboolean, inner_radius: float64,
outer_radius: float64, nsides: int32, rings: int32){.
cdecl, dynlib: GdkGLExtLib, importc: "gdk_gl_draw_torus".}
proc gdk_gl_draw_tetrahedron*(solid: gboolean){.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_draw_tetrahedron".}
proc gdk_gl_draw_octahedron*(solid: gboolean){.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_draw_octahedron".}
proc gdk_gl_draw_dodecahedron*(solid: gboolean){.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_draw_dodecahedron".}
proc gdk_gl_draw_icosahedron*(solid: gboolean){.cdecl, dynlib: GdkGLExtLib,
importc: "gdk_gl_draw_icosahedron".}
proc gdk_gl_draw_teapot*(solid: gboolean, scale: float64){.cdecl,
dynlib: GdkGLExtLib, importc: "gdk_gl_draw_teapot".}
proc HEADER_GDKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool =
result = (HEADER_GDKGLEXT_MAJOR_VERSION > major) or
((HEADER_GDKGLEXT_MAJOR_VERSION == major) and
(HEADER_GDKGLEXT_MINOR_VERSION > minor)) or
((HEADER_GDKGLEXT_MAJOR_VERSION == major) and
(HEADER_GDKGLEXT_MINOR_VERSION == minor) and
(HEADER_GDKGLEXT_MICRO_VERSION >= micro))
proc GDK_TYPE_GL_CONFIG*(): GType =
result = gdk_gl_config_get_type()
proc GDK_GL_CONFIG*(anObject: Pointer): PGdkGLConfig =
result = cast[PGdkGLConfig](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_GL_CONFIG()))
proc GDK_GL_CONFIG_CLASS*(klass: Pointer): PGdkGLConfigClass =
result = cast[PGdkGLConfigClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_GL_CONFIG()))
proc GDK_IS_GL_CONFIG*(anObject: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_GL_CONFIG())
proc GDK_IS_GL_CONFIG_CLASS*(klass: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_GL_CONFIG())
proc GDK_GL_CONFIG_GET_CLASS*(obj: Pointer): PGdkGLConfigClass =
result = cast[PGdkGLConfigClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_GL_CONFIG()))
proc GDK_TYPE_GL_CONTEXT*(): GType =
result = gdk_gl_context_get_type()
proc GDK_GL_CONTEXT*(anObject: Pointer): PGdkGLContext =
result = cast[PGdkGLContext](G_TYPE_CHECK_INSTANCE_CAST(anObject,
GDK_TYPE_GL_CONTEXT()))
proc GDK_GL_CONTEXT_CLASS*(klass: Pointer): PGdkGLContextClass =
result = cast[PGdkGLContextClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_GL_CONTEXT()))
proc GDK_IS_GL_CONTEXT*(anObject: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_GL_CONTEXT())
proc GDK_IS_GL_CONTEXT_CLASS*(klass: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_GL_CONTEXT())
proc GDK_GL_CONTEXT_GET_CLASS*(obj: Pointer): PGdkGLContextClass =
result = cast[PGdkGLContextClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_GL_CONTEXT()))
proc GDK_TYPE_GL_DRAWABLE*(): GType =
result = gdk_gl_drawable_get_type()
proc GDK_GL_DRAWABLE*(inst: Pointer): PGdkGLDrawable =
result = cast[PGdkGLDrawable](G_TYPE_CHECK_INSTANCE_CAST(inst, GDK_TYPE_GL_DRAWABLE()))
proc GDK_GL_DRAWABLE_CLASS*(vtable: Pointer): PGdkGLDrawableClass =
result = cast[PGdkGLDrawableClass](G_TYPE_CHECK_CLASS_CAST(vtable,
GDK_TYPE_GL_DRAWABLE()))
proc GDK_IS_GL_DRAWABLE*(inst: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(inst, GDK_TYPE_GL_DRAWABLE())
proc GDK_IS_GL_DRAWABLE_CLASS*(vtable: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(vtable, GDK_TYPE_GL_DRAWABLE())
proc GDK_GL_DRAWABLE_GET_CLASS*(inst: Pointer): PGdkGLDrawableClass =
result = cast[PGdkGLDrawableClass](G_TYPE_INSTANCE_GET_INTERFACE(inst,
GDK_TYPE_GL_DRAWABLE()))
proc GDK_TYPE_GL_PIXMAP*(): GType =
result = gdk_gl_pixmap_get_type()
proc GDK_GL_PIXMAP*(anObject: Pointer): PGdkGLPixmap =
result = cast[PGdkGLPixmap](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_GL_PIXMAP()))
proc GDK_GL_PIXMAP_CLASS*(klass: Pointer): PGdkGLPixmapClass =
result = cast[PGdkGLPixmapClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_GL_PIXMAP()))
proc GDK_IS_GL_PIXMAP*(anObject: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_GL_PIXMAP())
proc GDK_IS_GL_PIXMAP_CLASS*(klass: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_GL_PIXMAP())
proc GDK_GL_PIXMAP_GET_CLASS*(obj: Pointer): PGdkGLPixmapClass =
result = cast[PGdkGLPixmapClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_GL_PIXMAP()))
proc gdk_pixmap_get_gl_drawable*(pixmap: PGdkPixmap): PGdkGLDrawable =
result = GDK_GL_DRAWABLE(gdk_pixmap_get_gl_pixmap(pixmap))
proc GDK_TYPE_GL_WINDOW*(): GType =
result = gdk_gl_window_get_type()
proc GDK_GL_WINDOW*(anObject: Pointer): PGdkGLWindow =
result = cast[PGdkGLWindow](G_TYPE_CHECK_INSTANCE_CAST(anObject, GDK_TYPE_GL_WINDOW()))
proc GDK_GL_WINDOW_CLASS*(klass: Pointer): PGdkGLWindowClass =
result = cast[PGdkGLWindowClass](G_TYPE_CHECK_CLASS_CAST(klass, GDK_TYPE_GL_WINDOW()))
proc GDK_IS_GL_WINDOW*(anObject: Pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(anObject, GDK_TYPE_GL_WINDOW())
proc GDK_IS_GL_WINDOW_CLASS*(klass: Pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, GDK_TYPE_GL_WINDOW())
proc GDK_GL_WINDOW_GET_CLASS*(obj: Pointer): PGdkGLWindowClass =
result = cast[PGdkGLWindowClass](G_TYPE_INSTANCE_GET_CLASS(obj, GDK_TYPE_GL_WINDOW()))
proc gdk_window_get_gl_drawable*(window: PGdkWindow): PGdkGLDrawable =
result = GDK_GL_DRAWABLE(gdk_window_get_gl_window(window))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,50 +0,0 @@
{.deadCodeElim: on.}
import
Glib2, Gdk2, Gtk2, GdkGLExt
const
GtkGLExtLib* = if defined(WIN32): "libgtkglext-win32-1.0-0.dll" else: "libgtkglext-x11-1.0.so"
const
HEADER_GTKGLEXT_MAJOR_VERSION* = 1
HEADER_GTKGLEXT_MINOR_VERSION* = 0
HEADER_GTKGLEXT_MICRO_VERSION* = 6
HEADER_GTKGLEXT_INTERFACE_AGE* = 4
HEADER_GTKGLEXT_BINARY_AGE* = 6
proc gtk_gl_parse_args*(argc: Plongint, argv: PPPChar): gboolean{.cdecl,
dynlib: GtkGLExtLib, importc: "gtk_gl_parse_args".}
proc gtk_gl_init_check*(argc: Plongint, argv: PPPChar): gboolean{.cdecl,
dynlib: GtkGLExtLib, importc: "gtk_gl_init_check".}
proc gtk_gl_init*(argc: Plongint, argv: PPPChar){.cdecl, dynlib: GtkGLExtLib,
importc: "gtk_gl_init".}
proc gtk_widget_set_gl_capability*(widget: PGtkWidget, glconfig: PGdkGLConfig,
share_list: PGdkGLContext, direct: gboolean,
render_type: int): gboolean{.cdecl,
dynlib: GtkGLExtLib, importc: "gtk_widget_set_gl_capability".}
proc gtk_widget_is_gl_capable*(widget: PGtkWidget): gboolean{.cdecl,
dynlib: GtkGLExtLib, importc: "gtk_widget_is_gl_capable".}
proc gtk_widget_get_gl_config*(widget: PGtkWidget): PGdkGLConfig{.cdecl,
dynlib: GtkGLExtLib, importc: "gtk_widget_get_gl_config".}
proc gtk_widget_create_gl_context*(widget: PGtkWidget,
share_list: PGdkGLContext, direct: gboolean,
render_type: int): PGdkGLContext{.cdecl,
dynlib: GtkGLExtLib, importc: "gtk_widget_create_gl_context".}
proc gtk_widget_get_gl_context*(widget: PGtkWidget): PGdkGLContext{.cdecl,
dynlib: GtkGLExtLib, importc: "gtk_widget_get_gl_context".}
proc gtk_widget_get_gl_window*(widget: PGtkWidget): PGdkGLWindow{.cdecl,
dynlib: GtkGLExtLib, importc: "gtk_widget_get_gl_window".}
proc gtk_widget_get_gl_drawable*(widget: PGtkWidget): PGdkGLDrawable =
nil
proc HEADER_GTKGLEXT_CHECK_VERSION*(major, minor, micro: guint): bool =
result = (HEADER_GTKGLEXT_MAJOR_VERSION > major) or
((HEADER_GTKGLEXT_MAJOR_VERSION == major) and
(HEADER_GTKGLEXT_MINOR_VERSION > minor)) or
((HEADER_GTKGLEXT_MAJOR_VERSION == major) and
(HEADER_GTKGLEXT_MINOR_VERSION == minor) and
(HEADER_GTKGLEXT_MICRO_VERSION >= micro))
proc gtk_widget_get_gl_drawable*(widget: PGtkWidget): PGdkGLDrawable =
result = GDK_GL_DRAWABLE(gtk_widget_get_gl_window(widget))

View File

@@ -1,499 +0,0 @@
{.deadCodeElim: on.}
import
gtk2, glib2, atk, pango, gdk2pixbuf, gdk2
when defined(windows):
{.define: GTK_WINDOWING_WIN32.}
const
gtkhtmllib = "libgtkhtml-win32-2.0-0.dll"
else:
const
gtkhtmllib = "libgtkhtml-2.so"
const
DOM_UNSPECIFIED_EVENT_TYPE_ERR* = 0
DOM_INDEX_SIZE_ERR* = 1
DOM_DOMSTRING_SIZE_ERR* = 2
DOM_HIERARCHY_REQUEST_ERR* = 3
DOM_WRONG_DOCUMENT_ERR* = 4
DOM_INVALID_CHARACTER_ERR* = 5
DOM_NO_DATA_ALLOWED_ERR* = 6
DOM_NO_MODIFICATION_ALLOWED_ERR* = 7
DOM_NOT_FOUND_ERR* = 8
DOM_NOT_SUPPORTED_ERR* = 9
DOM_INUSE_ATTRIBUTE_ERR* = 10
DOM_INVALID_STATE_ERR* = 11
DOM_SYNTAX_ERR* = 12
DOM_INVALID_MODIFICATION_ERR* = 13
DOM_NAMESPACE_ERR* = 14
DOM_INVALID_ACCESS_ERR* = 15
DOM_NO_EXCEPTION* = 255
DOM_ELEMENT_NODE* = 1
DOM_ATTRIBUTE_NODE* = 2
DOM_TEXT_NODE* = 3
DOM_CDATA_SECTION_NODE* = 4
DOM_ENTITY_REFERENCE_NODE* = 5
DOM_ENTITY_NODE* = 6
DOM_PROCESSING_INSTRUCTION_NODE* = 7
DOM_COMMENT_NODE* = 8
DOM_DOCUMENT_NODE* = 9
DOM_DOCUMENT_TYPE_NODE* = 10
DOM_DOCUMENT_FRAGMENT_NODE* = 11
DOM_NOTATION_NODE* = 12
bm_HtmlFontSpecification_weight = 0x0000000F
bp_HtmlFontSpecification_weight = 0
bm_HtmlFontSpecification_style = 0x00000030
bp_HtmlFontSpecification_style = 4
bm_HtmlFontSpecification_variant = 0x000000C0
bp_HtmlFontSpecification_variant = 6
bm_HtmlFontSpecification_stretch = 0x00000F00
bp_HtmlFontSpecification_stretch = 8
bm_HtmlFontSpecification_decoration = 0x00007000
bp_HtmlFontSpecification_decoration = 12
type
TDomString* = gchar
TDomBoolean* = gboolean
TDomException* = gushort
TDomTimeStamp* = guint64
PDomNode* = ptr TDomNode
TDomNode* = object of TGObject
xmlnode*: pointer
style*: pointer
PDomNodeClass* = ptr TDomNodeClass
TDomNodeClass* = object of TGObjectClass
`get_nodeName`*: proc (node: PDomNode): PDomString{.cdecl.}
`get_nodeValue`*: proc (node: PDomNode, exc: PDomException): PDomString {.
cdecl.}
`set_nodeValue`*: proc (node: PDomNode, value: PDomString,
exc: PDomException): PDomString{.cdecl.}
PDomDocument* = ptr TDomDocument
TDomDocument* {.final, pure.} = object
parent*: PDomNode
iterators*: PGSList
PDomDocumentClass* = ptr TDomDocumentClass
TDomDocumentClass* {.final, pure.} = object
parent_class*: PDomNodeClass
PHtmlFocusIterator* = ptr THtmlFocusIterator
THtmlFocusIterator* = object of TGObject
document*: PDomDocument
current_node*: PDomNode
PHtmlFocusIteratorClass* = ptr THtmlFocusIteratorClass
THtmlFocusIteratorClass* = object of TGObjectClass
THtmlParserType* = enum
HTML_PARSER_TYPE_HTML, HTML_PARSER_TYPE_XML
PHtmlParser* = ptr THtmlParser
THtmlParser* = object of TGObject
parser_type*: THtmlParserType
document*: PHtmlDocument
stream*: PHtmlStream
xmlctxt*: xmlParserCtxtPtr
res*: int32
chars*: array[0..9, char]
blocking*: gboolean
blocking_node*: PDomNode
PHtmlParserClass* = ptr THtmlParserClass
THtmlParserClass* = object of TGtkObjectClass
done_parsing*: proc (parser: PHtmlParser){.cdecl.}
new_node*: proc (parser: PHtmlParser, node: PDomNode)
parsed_document_node*: proc (parser: PHtmlParser, document: PDomDocument)
PHtmlStream* = ptr THtmlStream
THtmlStreamCloseFunc* = proc (stream: PHtmlStream, user_data: gpointer){.cdecl.}
THtmlStreamWriteFunc* = proc (stream: PHtmlStream, buffer: Pgchar,
size: guint, user_data: gpointer){.cdecl.}
THtmlStreamCancelFunc* = proc (stream: PHtmlStream, user_data: gpointer,
cancel_data: gpointer){.cdecl.}
THtmlStream* = object of TGObject
write_func*: THtmlStreamWriteFunc
close_func*: THtmlStreamCloseFunc
cancel_func*: THtmlStreamCancelFunc
user_data*: gpointer
cancel_data*: gpointer
written*: gint
mime_type*: cstring
PHtmlStreamClass* = ptr THtmlStreamClass
THtmlStreamClass* = object of TGObjectClass
THtmlStreamBufferCloseFunc* = proc (str: Pgchar, len: gint,
user_data: gpointer){.cdecl.}
PGtkHtmlContext* = ptr TGtkHtmlContext
TGtkHtmlContext* = object of TGObject
documents*: PGSList
standard_font*: PHtmlFontSpecification
fixed_font*: PHtmlFontSpecification
debug_painting*: gboolean
PGtkHtmlContextClass* = ptr TGtkHtmlContextClass
TGtkHtmlContextClass* = object of TGObjectClass
THtmlDocumentState* = enum
HTML_DOCUMENT_STATE_DONE, HTML_DOCUMENT_STATE_PARSING
PHtmlDocument* = ptr THtmlDocument
THtmlDocument* = object of TGObject
stylesheets*: PGSList
current_stream*: PHtmlStream
state*: THtmlDocumentState
PHtmlDocumentClass* = ptr THtmlDocumentClass
THtmlDocumentClass* = object of TGObjectClass
request_url*: proc (document: PHtmlDocument, url: Pgchar,
stream: PHtmlStream){.cdecl.}
link_clicked*: proc (document: PHtmlDocument, url: Pgchar){.cdecl.}
set_base*: proc (document: PHtmlDocument, url: Pgchar){.cdecl.}
title_changed*: proc (document: PHtmlDocument, new_title: Pgchar){.cdecl.}
submit*: proc (document: PHtmlDocument, `method`: Pgchar, url: Pgchar,
encoding: Pgchar){.cdecl.}
PHtmlView* = ptr THtmlView
THtmlView* = object of TGtkLayout
document*: PHtmlDocument
node_table*: PGHashTable
relayout_idle_id*: guint
relayout_timeout_id*: guint
mouse_down_x*: gint
mouse_down_y*: gint
mouse_detail*: gint
sel_start_ypos*: gint
sel_start_index*: gint
sel_end_ypos*: gint
sel_end_index*: gint
sel_flag*: gboolean
sel_backwards*: gboolean
sel_start_found*: gboolean
sel_list*: PGSList
jump_to_anchor*: pgchar
magnification*: gdouble
magnification_modified*: gboolean
on_url*: gboolean
PHtmlViewClass* = ptr THtmlViewClass
THtmlViewClass* = object of TGtkLayoutClass
move_cursor*: proc (html_view: PHtmlView, step: TGtkMovementStep,
count: gint, extend_selection: gboolean){.cdecl.}
on_url*: proc (html_view: PHtmlView, url: Pgchar)
activate*: proc (html_view: PHtmlView)
move_focus_out*: proc (html_view: PHtmlView, direction: TGtkDirectionType)
proc DOM_TYPE_NODE*(): GType
proc DOM_NODE*(theobject: pointer): PDomNode
proc DOM_NODE_CLASS*(klass: pointer): PDomNodeClass
proc DOM_IS_NODE*(theobject: pointer): bool
proc DOM_IS_NODE_CLASS*(klass: pointer): bool
proc DOM_NODE_GET_CLASS*(obj: pointer): int32
proc dom_node_get_type*(): GType{.cdecl, dynlib: gtkhtmllib,
importc: "dom_node_get_type".}
proc dom_Node_mkref*(node: pointer): PDomNode{.cdecl, dynlib: gtkhtmllib,
importc: "dom_Node_mkref".}
proc dom_Node_get_childNodes*(node: PDomNode): PDomNodeList{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_childNodes".}
proc dom_Node_removeChild*(node: PDomNode, oldChild: PDomNode,
exc: PDomException): PDomNode{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node_removeChild".}
proc dom_Node_get_nodeValue*(node: PDomNode, exc: PDomException): PDomString{.
cdecl, dynlib: gtkhtmllib, importc: "dom_Node__get_nodeValue".}
proc dom_Node_get_firstChild*(node: PDomNode): PDomNode{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_firstChild".}
proc dom_Node_get_nodeName*(node: PDomNode): PDomString{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_nodeName".}
proc dom_Node_get_attributes*(node: PDomNode): PDomNamedNodeMap{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_attributes".}
proc dom_Document_get_doctype*(doc: PDomDocument): PDomDocumentType{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Document__get_doctype".}
proc dom_Node_hasChildNodes*(node: PDomNode): DomBoolean{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node_hasChildNodes".}
proc dom_Node_get_parentNode*(node: PDomNode): PDomNode{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_parentNode".}
proc dom_Node_get_nextSibling*(node: PDomNode): PDomNode{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_nextSibling".}
proc dom_Node_get_nodeType*(node: PDomNode): gushort{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_nodeType".}
proc dom_Node_hasAttributes*(node: PDomNode): DomBoolean{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node_hasAttributes".}
proc dom_Node_cloneNode*(node: PDomNode, deep: DomBoolean): PDomNode{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node_cloneNode".}
proc dom_Node_appendChild*(node: PDomNode, newChild: PDomNode,
exc: PDomException): PDomNode{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node_appendChild".}
proc dom_Node_get_localName*(node: PDomNode): PDomString{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_localName".}
proc dom_Node_get_namespaceURI*(node: PDomNode): PDomString{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_namespaceURI".}
proc dom_Node_get_previousSibling*(node: PDomNode): PDomNode{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_previousSibling".}
proc dom_Node_get_lastChild*(node: PDomNode): PDomNode{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_lastChild".}
proc dom_Node_set_nodeValue*(node: PDomNode, value: PDomString,
exc: PDomException){.cdecl, dynlib: gtkhtmllib,
importc: "dom_Node__set_nodeValue".}
proc dom_Node_get_ownerDocument*(node: PDomNode): PDomDocument{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node__get_ownerDocument".}
proc dom_Node_hasAttributes*(node: PDomNode): gboolean{.cdecl,
dynlib: gtkhtmllib, importc: "dom_Node_hasAttributes".}
proc DOM_TYPE_DOCUMENT*(): GType
proc DOM_DOCUMENT*(theobject: pointer): PDomDocument
proc DOM_DOCUMENT_CLASS*(klass: pointer): PDomDocumentClass
proc DOM_IS_DOCUMENT*(theobject: pointer): bool
proc DOM_IS_DOCUMENT_CLASS*(klass: pointer): bool
proc DOM_DOCUMENT_GET_CLASS*(obj: pointer): PDomDocumentClass
proc dom_document_get_type*(): GType
proc dom_Document_get_documentElement*(doc: PDomDocument): PDomElement
proc dom_Document_createElement*(doc: PDomDocument, tagName: PDomString): PDomElement
proc dom_Document_createTextNode*(doc: PDomDocument, data: PDomString): PDomText
proc dom_Document_createComment*(doc: PDomDocument, data: PDomString): PDomComment
proc dom_Document_importNode*(doc: PDomDocument, importedNode: PDomNode,
deep: DomBoolean, exc: PDomException): PDomNode
proc HTML_TYPE_FOCUS_ITERATOR*(): GType
proc HTML_FOCUS_ITERATOR*(theobject: pointer): PHtmlFocusIterator
proc HTML_FOCUS_ITERATOR_CLASS*(klass: pointer): PHtmlFocusIteratorClass
proc HTML_IS_FOCUS_ITERATOR*(theobject: pointer): bool
proc HTML_IS_FOCUS_ITERATOR_CLASS*(klass: pointer): bool
proc HTML_FOCUS_ITERATOR_GET_CLASS*(obj: pointer): PHtmlFocusIteratorClass
proc html_focus_iterator_next_element*(document: PDomDocument,
element: PDomElement): PDomElement{.
cdecl, dynlib: gtkhtmllib, importc: "html_focus_iterator_next_element".}
proc html_focus_iterator_prev_element*(document: PDomDocument,
element: PDomElement): PDomElement{.
cdecl, dynlib: gtkhtmllib, importc: "html_focus_iterator_prev_element".}
proc HTML_PARSER_TYPE*(): GType
proc HTML_PARSER*(obj: pointer): PHtmlParser
proc HTML_PARSER_CLASS*(klass: pointer): PHtmlParserClass
proc HTML_IS_PARSER*(obj: pointer): bool
proc html_parser_get_type*(): GType
proc html_parser_new*(document: PHtmlDocument, parser_type: THtmlParserType): PHtmlParser
proc HTML_TYPE_STREAM*(): GType
proc HTML_STREAM*(obj: pointer): PHtmlStream
proc HTML_STREAM_CLASS*(klass: pointer): PHtmlStreamClass
proc HTML_IS_STREAM*(obj: pointer): bool
proc HTML_IS_STREAM_CLASS*(klass: pointer): bool
proc HTML_STREAM_GET_CLASS*(obj: pointer): PHtmlStreamClass
proc html_stream_get_type*(): GType{.cdecl, dynlib: gtkhtmllib,
importc: "html_stream_get_type".}
proc html_stream_new*(write_func: THtmlStreamWriteFunc,
close_func: THtmlStreamCloseFunc, user_data: gpointer): PHtmlStream{.
cdecl, dynlib: gtkhtmllib, importc: "html_stream_new".}
proc html_stream_write*(stream: PHtmlStream, buffer: Pgchar, size: guint){.
cdecl, dynlib: gtkhtmllib, importc: "html_stream_write".}
proc html_stream_close*(stream: PHtmlStream){.cdecl, dynlib: gtkhtmllib,
importc: "html_stream_close".}
proc html_stream_destroy*(stream: PHtmlStream){.cdecl, dynlib: gtkhtmllib,
importc: "html_stream_destroy".}
proc html_stream_get_written*(stream: PHtmlStream): gint{.cdecl,
dynlib: gtkhtmllib, importc: "html_stream_get_written".}
proc html_stream_cancel*(stream: PHtmlStream){.cdecl, dynlib: gtkhtmllib,
importc: "html_stream_cancel".}
proc html_stream_set_cancel_func*(stream: PHtmlStream,
abort_func: THtmlStreamCancelFunc,
cancel_data: gpointer){.cdecl,
dynlib: gtkhtmllib, importc: "html_stream_set_cancel_func".}
proc html_stream_get_mime_type*(stream: PHtmlStream): cstring{.cdecl,
dynlib: gtkhtmllib, importc: "html_stream_get_mime_type".}
proc html_stream_set_mime_type*(stream: PHtmlStream, mime_type: cstring){.cdecl,
dynlib: gtkhtmllib, importc: "html_stream_set_mime_type".}
proc html_stream_buffer_new*(close_func: THtmlStreamBufferCloseFunc,
user_data: gpointer): PHtmlStream{.cdecl,
dynlib: gtkhtmllib, importc: "html_stream_buffer_new".}
proc html_event_mouse_move*(view: PHtmlView, event: PGdkEventMotion){.cdecl,
dynlib: gtkhtmllib, importc: "html_event_mouse_move".}
proc html_event_button_press*(view: PHtmlView, button: PGdkEventButton){.cdecl,
dynlib: gtkhtmllib, importc: "html_event_button_press".}
proc html_event_button_release*(view: PHtmlView, event: PGdkEventButton){.cdecl,
dynlib: gtkhtmllib, importc: "html_event_button_release".}
proc html_event_activate*(view: PHtmlView){.cdecl, dynlib: gtkhtmllib,
importc: "html_event_activate".}
proc html_event_key_press*(view: PHtmlView, event: PGdkEventKey): gboolean{.
cdecl, dynlib: gtkhtmllib, importc: "html_event_key_press".}
proc html_event_find_root_box*(self: PHtmlBox, x: gint, y: gint): PHtmlBox{.
cdecl, dynlib: gtkhtmllib, importc: "html_event_find_root_box".}
proc html_selection_start*(view: PHtmlView, event: PGdkEventButton){.cdecl,
dynlib: gtkhtmllib, importc: "html_selection_start".}
proc html_selection_end*(view: PHtmlView, event: PGdkEventButton){.cdecl,
dynlib: gtkhtmllib, importc: "html_selection_end".}
proc html_selection_update*(view: PHtmlView, event: PGdkEventMotion){.cdecl,
dynlib: gtkhtmllib, importc: "html_selection_update".}
proc html_selection_clear*(view: PHtmlView){.cdecl, dynlib: gtkhtmllib,
importc: "html_selection_clear".}
proc html_selection_set*(view: PHtmlView, start: PDomNode, offset: int32,
len: int32){.cdecl, dynlib: gtkhtmllib,
importc: "html_selection_set".}
proc GTK_HTML_CONTEXT_TYPE*(): GType
proc GTK_HTML_CONTEXT*(obj: pointer): PGtkHtmlContext
proc GTK_HTML_CONTEXT_CLASS*(klass: pointer): PGtkHtmlContextClass
proc GTK_HTML_IS_CONTEXT*(obj: pointer): bool
proc GTK_HTML_IS_CONTEXT_CLASS*(klass: pointer): bool
proc gtk_html_context_get_type*(): GType
proc gtk_html_context_get*(): PGtkHtmlContext
proc HTML_TYPE_DOCUMENT*(): GType
proc HTML_DOCUMENT*(obj: pointer): PHtmlDocument
proc HTML_DOCUMENT_CLASS*(klass: pointer): PHtmlDocumentClass
proc HTML_IS_DOCUMENT*(obj: pointer): bool
proc html_document_get_type*(): GType{.cdecl, dynlib: gtkhtmllib,
importc: "html_document_get_type".}
proc html_document_new*(): PHtmlDocument{.cdecl, dynlib: gtkhtmllib,
importc: "html_document_new".}
proc html_document_open_stream*(document: PHtmlDocument, mime_type: Pgchar): gboolean{.
cdecl, dynlib: gtkhtmllib, importc: "html_document_open_stream".}
proc html_document_write_stream*(document: PHtmlDocument, buffer: Pgchar,
len: gint){.cdecl, dynlib: gtkhtmllib,
importc: "html_document_write_stream".}
proc html_document_close_stream*(document: PHtmlDocument){.cdecl,
dynlib: gtkhtmllib, importc: "html_document_close_stream".}
proc html_document_clear*(document: PHtmlDocument){.cdecl, dynlib: gtkhtmllib,
importc: "html_document_clear".}
proc HTML_TYPE_VIEW*(): GType
proc HTML_VIEW*(obj: pointer): PHtmlView
proc HTML_VIEW_CLASS*(klass: pointer): PHtmlViewClass
proc HTML_IS_VIEW*(obj: pointer): bool
proc html_view_get_type*(): GType{.cdecl, dynlib: gtkhtmllib,
importc: "html_view_get_type".}
proc html_view_new*(): PGtkWidget{.cdecl, dynlib: gtkhtmllib,
importc: "html_view_new".}
proc html_view_set_document*(view: PHtmlView, document: PHtmlDocument){.cdecl,
dynlib: gtkhtmllib, importc: "html_view_set_document".}
proc html_view_jump_to_anchor*(view: PHtmlView, anchor: Pgchar){.cdecl,
dynlib: gtkhtmllib, importc: "html_view_jump_to_anchor".}
proc html_view_get_magnification*(view: PHtmlView): gdouble{.cdecl,
dynlib: gtkhtmllib, importc: "html_view_get_magnification".}
proc html_view_set_magnification*(view: PHtmlView, magnification: gdouble){.
cdecl, dynlib: gtkhtmllib, importc: "html_view_set_magnification".}
proc html_view_zoom_in*(view: PHtmlView){.cdecl, dynlib: gtkhtmllib,
importc: "html_view_zoom_in".}
proc html_view_zoom_out*(view: PHtmlView){.cdecl, dynlib: gtkhtmllib,
importc: "html_view_zoom_out".}
proc html_view_zoom_reset*(view: PHtmlView){.cdecl, dynlib: gtkhtmllib,
importc: "html_view_zoom_reset".}
proc DOM_TYPE_NODE*(): GType =
result = dom_node_get_type()
proc DOM_NODE*(theobject: pointer): PDomNode =
result = G_TYPE_CHECK_INSTANCE_CAST(theobject, DOM_TYPE_NODE(), TDomNode)
proc DOM_NODE_CLASS*(klass: pointer): PDomNodeClass =
result = G_TYPE_CHECK_CLASS_CAST(klass, DOM_TYPE_NODE(), TDomNodeClass)
proc DOM_IS_NODE*(theobject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, DOM_TYPE_NODE())
proc DOM_IS_NODE_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, DOM_TYPE_NODE())
proc DOM_NODE_GET_CLASS*(obj: pointer): PDomNodeClass =
result = G_TYPE_INSTANCE_GET_CLASS(obj, DOM_TYPE_NODE(), TDomNodeClass)
proc DOM_TYPE_DOCUMENT*(): GType =
result = dom_document_get_type()
proc DOM_DOCUMENT*(theobject: pointer): PDomDocument =
result = G_TYPE_CHECK_INSTANCE_CAST(theobject, DOM_TYPE_DOCUMENT(), TDomDocument)
proc DOM_DOCUMENT_CLASS*(klass: pointer): PDomDocumentClass =
result = G_TYPE_CHECK_CLASS_CAST(klass, DOM_TYPE_DOCUMENT(), TDomDocumentClass)
proc DOM_IS_DOCUMENT*(theobject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, DOM_TYPE_DOCUMENT())
proc DOM_IS_DOCUMENT_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, DOM_TYPE_DOCUMENT())
proc DOM_DOCUMENT_GET_CLASS*(obj: pointer): PDomDocumentClass =
result = G_TYPE_INSTANCE_GET_CLASS(obj, DOM_TYPE_DOCUMENT(), TDomDocumentClass)
proc HTML_TYPE_FOCUS_ITERATOR*(): GType =
result = html_focus_iterator_get_type()
proc HTML_FOCUS_ITERATOR*(theobject: pointer): PHtmlFocusIterator =
result = G_TYPE_CHECK_INSTANCE_CAST(theobject, HTML_TYPE_FOCUS_ITERATOR(),
HtmlFocusIterator)
proc HTML_FOCUS_ITERATOR_CLASS*(klass: pointer): PHtmlFocusIteratorClass =
result = G_TYPE_CHECK_CLASS_CAST(klass, HTML_TYPE_FOCUS_ITERATOR(),
HtmlFocusIteratorClass)
proc HTML_IS_FOCUS_ITERATOR*(theobject: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(theobject, HTML_TYPE_FOCUS_ITERATOR())
proc HTML_IS_FOCUS_ITERATOR_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, HTML_TYPE_FOCUS_ITERATOR())
proc HTML_FOCUS_ITERATOR_GET_CLASS*(obj: pointer): PHtmlFocusIteratorClass =
result = G_TYPE_INSTANCE_GET_CLASS(obj, HTML_TYPE_FOCUS_ITERATOR(),
HtmlFocusIteratorClass)
proc HTML_PARSER_TYPE*(): GType =
result = html_parser_get_type()
proc HTML_PARSER*(obj: pointer): PHtmlParser =
result = GTK_CHECK_CAST(obj, HTML_PARSER_TYPE(), THtmlParser)
proc HTML_PARSER_CLASS*(klass: pointer): PHtmlParserClass =
result = GTK_CHECK_CLASS_CAST(klass, HTML_PARSER_TYPE(), THtmlParserClass)
proc HTML_IS_PARSER*(obj: pointer): bool =
result = GTK_CHECK_TYPE(obj, HTML_PARSER_TYPE())
proc HTML_TYPE_STREAM*(): GType =
result = html_stream_get_type()
proc HTML_STREAM*(obj: pointer): PHtmlStream =
result = PHtmlStream(G_TYPE_CHECK_INSTANCE_CAST(obj, HTML_TYPE_STREAM()))
proc HTML_STREAM_CLASS*(klass: pointer): PHtmlStreamClass =
result = G_TYPE_CHECK_CLASS_CAST(klass, HTML_TYPE_STREAM())
proc HTML_IS_STREAM*(obj: pointer): bool =
result = G_TYPE_CHECK_INSTANCE_TYPE(obj, HTML_TYPE_STREAM())
proc HTML_IS_STREAM_CLASS*(klass: pointer): bool =
result = G_TYPE_CHECK_CLASS_TYPE(klass, HTML_TYPE_STREAM())
proc HTML_STREAM_GET_CLASS*(obj: pointer): PHtmlStreamClass =
result = PHtmlStreamClass(G_TYPE_INSTANCE_GET_CLASS(obj, HTML_TYPE_STREAM()))
proc GTK_HTML_CONTEXT_TYPE*(): GType =
result = gtk_html_context_get_type()
proc GTK_HTML_CONTEXT*(obj: pointer): PGtkHtmlContext =
result = GTK_CHECK_CAST(obj, GTK_HTML_CONTEXT_TYPE(), TGtkHtmlContext)
proc GTK_HTML_CONTEXT_CLASS*(klass: pointer): PGtkHtmlContextClass =
result = GTK_CHECK_CLASS_CAST(klass, GTK_HTML_CONTEXT_TYPE(),
TGtkHtmlContextClass)
proc GTK_HTML_IS_CONTEXT*(obj: pointer): bool =
result = GTK_CHECK_TYPE(obj, GTK_HTML_CONTEXT_TYPE())
proc GTK_HTML_IS_CONTEXT_CLASS*(klass: pointer): bool =
result = GTK_CHECK_CLASS_TYPE(klass, GTK_HTML_CONTEXT_TYPE())
proc HTML_TYPE_DOCUMENT*(): GType =
result = html_document_get_type()
proc HTML_DOCUMENT*(obj: pointer): PHtmlDocument =
result = PHtmlDocument(GTK_CHECK_CAST(obj, HTML_TYPE_DOCUMENT()))
proc HTML_DOCUMENT_CLASS*(klass: pointer): PHtmlDocumentClass =
result = GTK_CHECK_CLASS_CAST(klass, HTML_TYPE_DOCUMENT())
proc HTML_IS_DOCUMENT*(obj: pointer): bool =
result = GTK_CHECK_TYPE(obj, HTML_TYPE_DOCUMENT())
proc HTML_TYPE_VIEW*(): GType =
result = html_view_get_type()
proc HTML_VIEW*(obj: pointer): PHtmlView =
result = PHtmlView(GTK_CHECK_CAST(obj, HTML_TYPE_VIEW()))
proc HTML_VIEW_CLASS*(klass: pointer): PHtmlViewClass =
result = PHtmlViewClass(GTK_CHECK_CLASS_CAST(klass, HTML_TYPE_VIEW()))
proc HTML_IS_VIEW*(obj: pointer): bool =
result = GTK_CHECK_TYPE(obj, HTML_TYPE_VIEW())

View File

@@ -1,118 +0,0 @@
{.deadCodeElim: on.}
import
glib2, gtk2
when defined(win32):
const
LibGladeLib = "libglade-2.0-0.dll"
else:
const
LibGladeLib = "libglade-2.0.so"
type
PLongint* = ptr int32
PSmallInt* = ptr int16
PByte* = ptr int8
PWord* = ptr int16
PDWord* = ptr int32
PDouble* = ptr float64
proc glade_init*(){.cdecl, dynlib: LibGladeLib, importc: "glade_init".}
proc glade_require*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib,
importc: "glade_require".}
proc glade_provide*(TheLibrary: cstring){.cdecl, dynlib: LibGladeLib,
importc: "glade_provide".}
type
PGladeXMLPrivate* = pointer
PGladeXML* = ptr TGladeXML
TGladeXML* = object of TGObject
filename*: cstring
priv*: PGladeXMLPrivate
PGladeXMLClass* = ptr TGladeXMLClass
TGladeXMLClass* = object of TGObjectClass
TGladeXMLConnectFunc* = proc (handler_name: cstring, anObject: PGObject,
signal_name: cstring, signal_data: cstring,
connect_object: PGObject, after: gboolean,
user_data: gpointer){.cdecl.}
proc GLADE_TYPE_XML*(): GType
proc GLADE_XML*(obj: pointer): PGladeXML
proc GLADE_XML_CLASS*(klass: pointer): PGladeXMLClass
proc GLADE_IS_XML*(obj: pointer): gboolean
proc GLADE_IS_XML_CLASS*(klass: pointer): gboolean
proc GLADE_XML_GET_CLASS*(obj: pointer): PGladeXMLClass
proc glade_xml_get_type*(): GType{.cdecl, dynlib: LibGladeLib,
importc: "glade_xml_get_type".}
proc glade_xml_new*(fname: cstring, root: cstring, domain: cstring): PGladeXML{.
cdecl, dynlib: LibGladeLib, importc: "glade_xml_new".}
proc glade_xml_new_from_buffer*(buffer: cstring, size: int32, root: cstring,
domain: cstring): PGladeXML{.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_new_from_buffer".}
proc glade_xml_construct*(self: PGladeXML, fname: cstring, root: cstring,
domain: cstring): gboolean{.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_construct".}
proc glade_xml_signal_connect*(self: PGladeXML, handlername: cstring,
func: TGCallback){.cdecl, dynlib: LibGladeLib,
importc: "glade_xml_signal_connect".}
proc glade_xml_signal_connect_data*(self: PGladeXML, handlername: cstring,
func: TGCallback, user_data: gpointer){.
cdecl, dynlib: LibGladeLib, importc: "glade_xml_signal_connect_data".}
proc glade_xml_signal_autoconnect*(self: PGladeXML){.cdecl, dynlib: LibGladeLib,
importc: "glade_xml_signal_autoconnect".}
proc glade_xml_signal_connect_full*(self: PGladeXML, handler_name: cstring,
func: TGladeXMLConnectFunc,
user_data: gpointer){.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_signal_connect_full".}
proc glade_xml_signal_autoconnect_full*(self: PGladeXML,
func: TGladeXMLConnectFunc,
user_data: gpointer){.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_signal_autoconnect_full".}
proc glade_xml_get_widget*(self: PGladeXML, name: cstring): PGtkWidget{.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_get_widget".}
proc glade_xml_get_widget_prefix*(self: PGladeXML, name: cstring): PGList{.
cdecl, dynlib: LibGladeLib, importc: "glade_xml_get_widget_prefix".}
proc glade_xml_relative_file*(self: PGladeXML, filename: cstring): cstring{.cdecl,
dynlib: LibGladeLib, importc: "glade_xml_relative_file".}
proc glade_get_widget_name*(widget: PGtkWidget): cstring{.cdecl,
dynlib: LibGladeLib, importc: "glade_get_widget_name".}
proc glade_get_widget_tree*(widget: PGtkWidget): PGladeXML{.cdecl,
dynlib: LibGladeLib, importc: "glade_get_widget_tree".}
type
PGladeXMLCustomWidgetHandler* = ptr TGladeXMLCustomWidgetHandler
TGladeXMLCustomWidgetHandler* = TGtkWidget
proc glade_set_custom_handler*(handler: TGladeXMLCustomWidgetHandler,
user_data: gpointer){.cdecl, dynlib: LibGladeLib,
importc: "glade_set_custom_handler".}
proc glade_gnome_init*() =
glade_init()
proc glade_bonobo_init*() =
glade_init()
proc glade_xml_new_with_domain*(fname: cstring, root: cstring, domain: cstring): PGladeXML =
result = glade_xml_new(fname, root, domain)
proc glade_xml_new_from_memory*(buffer: cstring, size: int32, root: cstring,
domain: cstring): PGladeXML =
result = glade_xml_new_from_buffer(buffer, size, root, domain)
proc GLADE_TYPE_XML*(): GType =
result = glade_xml_get_type()
proc GLADE_XML*(obj: pointer): PGladeXML =
result = cast[PGladeXML](G_TYPE_CHECK_INSTANCE_CAST(obj, GLADE_TYPE_XML()))
proc GLADE_XML_CLASS*(klass: pointer): PGladeXMLClass =
result = cast[PGladeXMLClass](G_TYPE_CHECK_CLASS_CAST(klass, GLADE_TYPE_XML()))
proc GLADE_IS_XML*(obj: pointer): gboolean =
result = G_TYPE_CHECK_INSTANCE_TYPE(obj, GLADE_TYPE_XML())
proc GLADE_IS_XML_CLASS*(klass: pointer): gboolean =
result = G_TYPE_CHECK_CLASS_TYPE(klass, GLADE_TYPE_XML())
proc GLADE_XML_GET_CLASS*(obj: pointer): PGladeXMLClass =
result = cast[PGladeXMLClass](G_TYPE_INSTANCE_GET_CLASS(obj, GLADE_TYPE_XML()))

File diff suppressed because it is too large Load Diff

View File

@@ -1,46 +0,0 @@
{.deadCodeElim: on.}
import
glib2, pango
type
pint32* = ptr int32
proc pango_split_file_list*(str: cstring): PPchar{.cdecl, dynlib: pangolib,
importc: "pango_split_file_list".}
proc pango_trim_string*(str: cstring): cstring{.cdecl, dynlib: pangolib,
importc: "pango_trim_string".}
proc pango_read_line*(stream: TFile, str: PGString): gint{.cdecl,
dynlib: pangolib, importc: "pango_read_line".}
proc pango_skip_space*(pos: PPchar): gboolean{.cdecl, dynlib: pangolib,
importc: "pango_skip_space".}
proc pango_scan_word*(pos: PPchar, OutStr: PGString): gboolean{.cdecl,
dynlib: pangolib, importc: "pango_scan_word".}
proc pango_scan_string*(pos: PPchar, OutStr: PGString): gboolean{.cdecl,
dynlib: pangolib, importc: "pango_scan_string".}
proc pango_scan_int*(pos: PPchar, OutInt: pint32): gboolean{.cdecl,
dynlib: pangolib, importc: "pango_scan_int".}
proc pango_config_key_get(key: cstring): cstring{.cdecl, dynlib: pangolib,
importc: "pango_config_key_get".}
proc pango_lookup_aliases(fontname: cstring, families: PPPchar,
n_families: pint32){.cdecl, dynlib: pangolib,
importc: "pango_lookup_aliases".}
proc pango_parse_style*(str: cstring, style: PPangoStyle, warn: gboolean): gboolean{.
cdecl, dynlib: pangolib, importc: "pango_parse_style".}
proc pango_parse_variant*(str: cstring, variant: PPangoVariant, warn: gboolean): gboolean{.
cdecl, dynlib: pangolib, importc: "pango_parse_variant".}
proc pango_parse_weight*(str: cstring, weight: PPangoWeight, warn: gboolean): gboolean{.
cdecl, dynlib: pangolib, importc: "pango_parse_weight".}
proc pango_parse_stretch*(str: cstring, stretch: PPangoStretch, warn: gboolean): gboolean{.
cdecl, dynlib: pangolib, importc: "pango_parse_stretch".}
proc pango_get_sysconf_subdirectory(): cstring{.cdecl, dynlib: pangolib,
importc: "pango_get_sysconf_subdirectory".}
proc pango_get_lib_subdirectory(): cstring{.cdecl, dynlib: pangolib,
importc: "pango_get_lib_subdirectory".}
proc pango_log2vis_get_embedding_levels*(str: Pgunichar, len: int32,
pbase_dir: PPangoDirection, embedding_level_list: Pguint8): gboolean{.cdecl,
dynlib: pangolib, importc: "pango_log2vis_get_embedding_levels".}
proc pango_get_mirror_char*(ch: gunichar, mirrored_ch: Pgunichar): gboolean{.
cdecl, dynlib: pangolib, importc: "pango_get_mirror_char".}
proc pango_language_get_sample_string*(language: PPangoLanguage): cstring{.
cdecl, dynlib: pangolib, importc: "pango_language_get_sample_string".}

View File

@@ -1,945 +0,0 @@
#
# Binding for the IUP GUI toolkit
# (c) 2010 Andreas Rumpf
# C header files translated by hand
# Licence of IUP follows:
# ****************************************************************************
# Copyright (C) 1994-2009 Tecgraf, PUC-Rio.
#
# 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 THE AUTHORS OR COPYRIGHT HOLDERS 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.
# ****************************************************************************
{.deadCodeElim: on.}
when defined(windows):
const dllname = "iup(30|27|26|25|24).dll"
elif defined(macosx):
const dllname = "libiup(3.0|2.7|2.6|2.5|2.4).dylib"
else:
const dllname = "libiup(3.0|2.7|2.6|2.5|2.4).so.1"
const
IUP_NAME* = "IUP - Portable User Interface"
IUP_COPYRIGHT* = "Copyright (C) 1994-2009 Tecgraf, PUC-Rio."
IUP_DESCRIPTION* = "Portable toolkit for building graphical user interfaces."
constIUP_VERSION* = "3.0"
constIUP_VERSION_NUMBER* = 300000
constIUP_VERSION_DATE* = "2009/07/18"
type
Ihandle {.pure.} = object
PIhandle* = ptr Ihandle
Icallback* = proc (arg: PIhandle): cint {.cdecl.}
# pre-definided dialogs
proc FileDlg*: PIhandle {.importc: "IupFileDlg", dynlib: dllname, cdecl.}
proc MessageDlg*: PIhandle {.importc: "IupMessageDlg", dynlib: dllname, cdecl.}
proc ColorDlg*: PIhandle {.importc: "IupColorDlg", dynlib: dllname, cdecl.}
proc FontDlg*: PIhandle {.importc: "IupFontDlg", dynlib: dllname, cdecl.}
proc GetFile*(arq: cstring): cint {.
importc: "IupGetFile", dynlib: dllname, cdecl.}
proc Message*(title, msg: cstring) {.
importc: "IupMessage", dynlib: dllname, cdecl.}
proc Messagef*(title, format: cstring) {.
importc: "IupMessagef", dynlib: dllname, cdecl, varargs.}
proc Alarm*(title, msg, b1, b2, b3: cstring): cint {.
importc: "IupAlarm", dynlib: dllname, cdecl.}
proc Scanf*(format: cstring): cint {.
importc: "IupScanf", dynlib: dllname, cdecl, varargs.}
proc ListDialog*(theType: cint, title: cstring, size: cint,
list: cstringArray, op, max_col, max_lin: cint,
marks: ptr cint): cint {.
importc: "IupListDialog", dynlib: dllname, cdecl.}
proc GetText*(title, text: cstring): cint {.
importc: "IupGetText", dynlib: dllname, cdecl.}
proc GetColor*(x, y: cint, r, g, b: var byte): cint {.
importc: "IupGetColor", dynlib: dllname, cdecl.}
type
Iparamcb* = proc (dialog: PIhandle, param_index: cint,
user_data: pointer): cint {.cdecl.}
proc GetParam*(title: cstring, action: Iparamcb, user_data: pointer,
format: cstring): cint {.
importc: "IupGetParam", cdecl, varargs, dynlib: dllname.}
proc GetParamv*(title: cstring, action: Iparamcb, user_data: pointer,
format: cstring, param_count, param_extra: cint,
param_data: pointer): cint {.
importc: "IupGetParamv", cdecl, dynlib: dllname.}
# Functions
proc Open*(argc: ptr cint, argv: ptr cstringArray): cint {.
importc: "IupOpen", cdecl, dynlib: dllname.}
proc Close*() {.importc: "IupClose", cdecl, dynlib: dllname.}
proc ImageLibOpen*() {.importc: "IupImageLibOpen", cdecl, dynlib: dllname.}
proc MainLoop*(): cint {.importc: "IupMainLoop", cdecl, dynlib: dllname.}
proc LoopStep*(): cint {.importc: "IupLoopStep", cdecl, dynlib: dllname.}
proc MainLoopLevel*(): cint {.importc: "IupMainLoopLevel", cdecl, dynlib: dllname.}
proc Flush*() {.importc: "IupFlush", cdecl, dynlib: dllname.}
proc ExitLoop*() {.importc: "IupExitLoop", cdecl, dynlib: dllname.}
proc Update*(ih: PIhandle) {.importc: "IupUpdate", cdecl, dynlib: dllname.}
proc UpdateChildren*(ih: PIhandle) {.importc: "IupUpdateChildren", cdecl, dynlib: dllname.}
proc Redraw*(ih: PIhandle, children: cint) {.importc: "IupRedraw", cdecl, dynlib: dllname.}
proc Refresh*(ih: PIhandle) {.importc: "IupRefresh", cdecl, dynlib: dllname.}
proc MapFont*(iupfont: cstring): cstring {.importc: "IupMapFont", cdecl, dynlib: dllname.}
proc UnMapFont*(driverfont: cstring): cstring {.importc: "IupUnMapFont", cdecl, dynlib: dllname.}
proc Help*(url: cstring): cint {.importc: "IupHelp", cdecl, dynlib: dllname.}
proc Load*(filename: cstring): cstring {.importc: "IupLoad", cdecl, dynlib: dllname.}
proc IupVersion*(): cstring {.importc: "IupVersion", cdecl, dynlib: dllname.}
proc IupVersionDate*(): cstring {.importc: "IupVersionDate", cdecl, dynlib: dllname.}
proc IupVersionNumber*(): cint {.importc: "IupVersionNumber", cdecl, dynlib: dllname.}
proc SetLanguage*(lng: cstring) {.importc: "IupSetLanguage", cdecl, dynlib: dllname.}
proc GetLanguage*(): cstring {.importc: "IupGetLanguage", cdecl, dynlib: dllname.}
proc Destroy*(ih: PIhandle) {.importc: "IupDestroy", cdecl, dynlib: dllname.}
proc Detach*(child: PIhandle) {.importc: "IupDetach", cdecl, dynlib: dllname.}
proc Append*(ih, child: PIhandle): PIhandle {.
importc: "IupAppend", cdecl, dynlib: dllname.}
proc Insert*(ih, ref_child, child: PIhandle): PIhandle {.
importc: "IupInsert", cdecl, dynlib: dllname.}
proc GetChild*(ih: PIhandle, pos: cint): PIhandle {.
importc: "IupGetChild", cdecl, dynlib: dllname.}
proc GetChildPos*(ih, child: PIhandle): cint {.
importc: "IupGetChildPos", cdecl, dynlib: dllname.}
proc GetChildCount*(ih: PIhandle): cint {.
importc: "IupGetChildCount", cdecl, dynlib: dllname.}
proc GetNextChild*(ih, child: PIhandle): PIhandle {.
importc: "IupGetNextChild", cdecl, dynlib: dllname.}
proc GetBrother*(ih: PIhandle): PIhandle {.
importc: "IupGetBrother", cdecl, dynlib: dllname.}
proc GetParent*(ih: PIhandle): PIhandle {.
importc: "IupGetParent", cdecl, dynlib: dllname.}
proc GetDialog*(ih: PIhandle): PIhandle {.
importc: "IupGetDialog", cdecl, dynlib: dllname.}
proc GetDialogChild*(ih: PIhandle, name: cstring): PIhandle {.
importc: "IupGetDialogChild", cdecl, dynlib: dllname.}
proc Reparent*(ih, new_parent: PIhandle): cint {.
importc: "IupReparent", cdecl, dynlib: dllname.}
proc Popup*(ih: PIhandle, x, y: cint): cint {.
importc: "IupPopup", cdecl, dynlib: dllname.}
proc Show*(ih: PIhandle): cint {.
importc: "IupShow", cdecl, dynlib: dllname.}
proc ShowXY*(ih: PIhandle, x, y: cint): cint {.
importc: "IupShowXY", cdecl, dynlib: dllname.}
proc Hide*(ih: PIhandle): cint {.
importc: "IupHide", cdecl, dynlib: dllname.}
proc Map*(ih: PIhandle): cint {.
importc: "IupMap", cdecl, dynlib: dllname.}
proc Unmap*(ih: PIhandle) {.
importc: "IupUnmap", cdecl, dynlib: dllname.}
proc SetAttribute*(ih: PIhandle, name, value: cstring) {.
importc: "IupSetAttribute", cdecl, dynlib: dllname.}
proc StoreAttribute*(ih: PIhandle, name, value: cstring) {.
importc: "IupStoreAttribute", cdecl, dynlib: dllname.}
proc SetAttributes*(ih: PIhandle, str: cstring): PIhandle {.
importc: "IupSetAttributes", cdecl, dynlib: dllname.}
proc GetAttribute*(ih: PIhandle, name: cstring): cstring {.
importc: "IupGetAttribute", cdecl, dynlib: dllname.}
proc GetAttributes*(ih: PIhandle): cstring {.
importc: "IupGetAttributes", cdecl, dynlib: dllname.}
proc GetInt*(ih: PIhandle, name: cstring): cint {.
importc: "IupGetInt", cdecl, dynlib: dllname.}
proc GetInt2*(ih: PIhandle, name: cstring): cint {.
importc: "IupGetInt2", cdecl, dynlib: dllname.}
proc GetIntInt*(ih: PIhandle, name: cstring, i1, i2: var cint): cint {.
importc: "IupGetIntInt", cdecl, dynlib: dllname.}
proc GetFloat*(ih: PIhandle, name: cstring): cfloat {.
importc: "IupGetFloat", cdecl, dynlib: dllname.}
proc SetfAttribute*(ih: PIhandle, name, format: cstring) {.
importc: "IupSetfAttribute", cdecl, dynlib: dllname, varargs.}
proc GetAllAttributes*(ih: PIhandle, names: cstringArray, n: cint): cint {.
importc: "IupGetAllAttributes", cdecl, dynlib: dllname.}
proc SetAtt*(handle_name: cstring, ih: PIhandle, name: cstring): PIhandle {.
importc: "IupSetAtt", cdecl, dynlib: dllname, varargs.}
proc SetGlobal*(name, value: cstring) {.
importc: "IupSetGlobal", cdecl, dynlib: dllname.}
proc StoreGlobal*(name, value: cstring) {.
importc: "IupStoreGlobal", cdecl, dynlib: dllname.}
proc GetGlobal*(name: cstring): cstring {.
importc: "IupGetGlobal", cdecl, dynlib: dllname.}
proc SetFocus*(ih: PIhandle): PIhandle {.
importc: "IupSetFocus", cdecl, dynlib: dllname.}
proc GetFocus*(): PIhandle {.
importc: "IupGetFocus", cdecl, dynlib: dllname.}
proc PreviousField*(ih: PIhandle): PIhandle {.
importc: "IupPreviousField", cdecl, dynlib: dllname.}
proc NextField*(ih: PIhandle): PIhandle {.
importc: "IupNextField", cdecl, dynlib: dllname.}
proc GetCallback*(ih: PIhandle, name: cstring): Icallback {.
importc: "IupGetCallback", cdecl, dynlib: dllname.}
proc SetCallback*(ih: PIhandle, name: cstring, func: Icallback): Icallback {.
importc: "IupSetCallback", cdecl, dynlib: dllname.}
proc SetCallbacks*(ih: PIhandle, name: cstring, func: Icallback): PIhandle {.
importc: "IupSetCallbacks", cdecl, dynlib: dllname, varargs.}
proc GetFunction*(name: cstring): Icallback {.
importc: "IupGetFunction", cdecl, dynlib: dllname.}
proc SetFunction*(name: cstring, func: Icallback): Icallback {.
importc: "IupSetFunction", cdecl, dynlib: dllname.}
proc GetActionName*(): cstring {.
importc: "IupGetActionName", cdecl, dynlib: dllname.}
proc GetHandle*(name: cstring): PIhandle {.
importc: "IupGetHandle", cdecl, dynlib: dllname.}
proc SetHandle*(name: cstring, ih: PIhandle): PIhandle {.
importc: "IupSetHandle", cdecl, dynlib: dllname.}
proc GetAllNames*(names: cstringArray, n: cint): cint {.
importc: "IupGetAllNames", cdecl, dynlib: dllname.}
proc GetAllDialogs*(names: cstringArray, n: cint): cint {.
importc: "IupGetAllDialogs", cdecl, dynlib: dllname.}
proc GetName*(ih: PIhandle): cstring {.
importc: "IupGetName", cdecl, dynlib: dllname.}
proc SetAttributeHandle*(ih: PIhandle, name: cstring, ih_named: PIhandle) {.
importc: "IupSetAttributeHandle", cdecl, dynlib: dllname.}
proc GetAttributeHandle*(ih: PIhandle, name: cstring): PIhandle {.
importc: "IupGetAttributeHandle", cdecl, dynlib: dllname.}
proc GetClassName*(ih: PIhandle): cstring {.
importc: "IupGetClassName", cdecl, dynlib: dllname.}
proc GetClassType*(ih: PIhandle): cstring {.
importc: "IupGetClassType", cdecl, dynlib: dllname.}
proc GetClassAttributes*(classname: cstring, names: cstringArray,
n: cint): cint {.
importc: "IupGetClassAttributes", cdecl, dynlib: dllname.}
proc SaveClassAttributes*(ih: PIhandle) {.
importc: "IupSaveClassAttributes", cdecl, dynlib: dllname.}
proc SetClassDefaultAttribute*(classname, name, value: cstring) {.
importc: "IupSetClassDefaultAttribute", cdecl, dynlib: dllname.}
proc Create*(classname: cstring): PIhandle {.
importc: "IupCreate", cdecl, dynlib: dllname.}
proc Createv*(classname: cstring, params: pointer): PIhandle {.
importc: "IupCreatev", cdecl, dynlib: dllname.}
proc Createp*(classname: cstring, first: pointer): PIhandle {.
importc: "IupCreatep", cdecl, dynlib: dllname, varargs.}
proc Fill*(): PIhandle {.importc: "IupFill", cdecl, dynlib: dllname.}
proc Radio*(child: PIhandle): PIhandle {.
importc: "IupRadio", cdecl, dynlib: dllname.}
proc Vbox*(child: PIhandle): PIhandle {.
importc: "IupVbox", cdecl, dynlib: dllname, varargs.}
proc Vboxv*(children: ptr PIhandle): PIhandle {.
importc: "IupVboxv", cdecl, dynlib: dllname.}
proc Zbox*(child: PIhandle): PIhandle {.
importc: "IupZbox", cdecl, dynlib: dllname, varargs.}
proc Zboxv*(children: ptr PIhandle): PIhandle {.
importc: "IupZboxv", cdecl, dynlib: dllname.}
proc Hbox*(child: PIhandle): PIhandle {.
importc: "IupHbox", cdecl, dynlib: dllname, varargs.}
proc Hboxv*(children: ptr PIhandle): PIhandle {.
importc: "IupHboxv", cdecl, dynlib: dllname.}
proc Normalizer*(ih_first: PIhandle): PIhandle {.
importc: "IupNormalizer", cdecl, dynlib: dllname, varargs.}
proc Normalizerv*(ih_list: ptr PIhandle): PIhandle {.
importc: "IupNormalizerv", cdecl, dynlib: dllname.}
proc Cbox*(child: PIhandle): PIhandle {.
importc: "IupCbox", cdecl, dynlib: dllname, varargs.}
proc Cboxv*(children: ptr PIhandle): PIhandle {.
importc: "IupCboxv", cdecl, dynlib: dllname.}
proc Sbox*(child: PIhandle): PIhandle {.
importc: "IupSbox", cdecl, dynlib: dllname.}
proc Frame*(child: PIhandle): PIhandle {.
importc: "IupFrame", cdecl, dynlib: dllname.}
proc Image*(width, height: cint, pixmap: pointer): PIhandle {.
importc: "IupImage", cdecl, dynlib: dllname.}
proc ImageRGB*(width, height: cint, pixmap: pointer): PIhandle {.
importc: "IupImageRGB", cdecl, dynlib: dllname.}
proc ImageRGBA*(width, height: cint, pixmap: pointer): PIhandle {.
importc: "IupImageRGBA", cdecl, dynlib: dllname.}
proc Item*(title, action: cstring): PIhandle {.
importc: "IupItem", cdecl, dynlib: dllname.}
proc Submenu*(title: cstring, child: PIhandle): PIhandle {.
importc: "IupSubmenu", cdecl, dynlib: dllname.}
proc Separator*(): PIhandle {.
importc: "IupSeparator", cdecl, dynlib: dllname.}
proc Menu*(child: PIhandle): PIhandle {.
importc: "IupMenu", cdecl, dynlib: dllname, varargs.}
proc Menuv*(children: ptr PIhandle): PIhandle {.
importc: "IupMenuv", cdecl, dynlib: dllname.}
proc Button*(title, action: cstring): PIhandle {.
importc: "IupButton", cdecl, dynlib: dllname.}
proc Canvas*(action: cstring): PIhandle {.
importc: "IupCanvas", cdecl, dynlib: dllname.}
proc Dialog*(child: PIhandle): PIhandle {.
importc: "IupDialog", cdecl, dynlib: dllname.}
proc User*(): PIhandle {.
importc: "IupUser", cdecl, dynlib: dllname.}
proc Label*(title: cstring): PIhandle {.
importc: "IupLabel", cdecl, dynlib: dllname.}
proc List*(action: cstring): PIhandle {.
importc: "IupList", cdecl, dynlib: dllname.}
proc Text*(action: cstring): PIhandle {.
importc: "IupText", cdecl, dynlib: dllname.}
proc MultiLine*(action: cstring): PIhandle {.
importc: "IupMultiLine", cdecl, dynlib: dllname.}
proc Toggle*(title, action: cstring): PIhandle {.
importc: "IupToggle", cdecl, dynlib: dllname.}
proc Timer*(): PIhandle {.
importc: "IupTimer", cdecl, dynlib: dllname.}
proc ProgressBar*(): PIhandle {.
importc: "IupProgressBar", cdecl, dynlib: dllname.}
proc Val*(theType: cstring): PIhandle {.
importc: "IupVal", cdecl, dynlib: dllname.}
proc Tabs*(child: PIhandle): PIhandle {.
importc: "IupTabs", cdecl, dynlib: dllname, varargs.}
proc Tabsv*(children: ptr PIhandle): PIhandle {.
importc: "IupTabsv", cdecl, dynlib: dllname.}
proc Tree*(): PIhandle {.importc: "IupTree", cdecl, dynlib: dllname.}
proc Spin*(): PIhandle {.importc: "IupSpin", cdecl, dynlib: dllname.}
proc Spinbox*(child: PIhandle): PIhandle {.
importc: "IupSpinbox", cdecl, dynlib: dllname.}
# IupText utilities
proc TextConvertLinColToPos*(ih: PIhandle, lin, col: cint, pos: var cint) {.
importc: "IupTextConvertLinColToPos", cdecl, dynlib: dllname.}
proc TextConvertPosToLinCol*(ih: PIhandle, pos: cint, lin, col: var cint) {.
importc: "IupTextConvertPosToLinCol", cdecl, dynlib: dllname.}
proc ConvertXYToPos*(ih: PIhandle, x, y: cint): cint {.
importc: "IupConvertXYToPos", cdecl, dynlib: dllname.}
# IupTree utilities
proc TreeSetUserId*(ih: PIhandle, id: cint, userid: pointer): cint {.
importc: "IupTreeSetUserId", cdecl, dynlib: dllname.}
proc TreeGetUserId*(ih: PIhandle, id: cint): pointer {.
importc: "IupTreeGetUserId", cdecl, dynlib: dllname.}
proc TreeGetId*(ih: PIhandle, userid: pointer): cint {.
importc: "IupTreeGetId", cdecl, dynlib: dllname.}
proc TreeSetAttribute*(ih: PIhandle, name: cstring, id: cint, value: cstring) {.
importc: "IupTreeSetAttribute", cdecl, dynlib: dllname.}
proc TreeStoreAttribute*(ih: PIhandle, name: cstring, id: cint, value: cstring) {.
importc: "IupTreeStoreAttribute", cdecl, dynlib: dllname.}
proc TreeGetAttribute*(ih: PIhandle, name: cstring, id: cint): cstring {.
importc: "IupTreeGetAttribute", cdecl, dynlib: dllname.}
proc TreeGetInt*(ih: PIhandle, name: cstring, id: cint): cint {.
importc: "IupTreeGetInt", cdecl, dynlib: dllname.}
proc TreeGetFloat*(ih: PIhandle, name: cstring, id: cint): cfloat {.
importc: "IupTreeGetFloat", cdecl, dynlib: dllname.}
proc TreeSetfAttribute*(ih: PIhandle, name: cstring, id: cint, format: cstring) {.
importc: "IupTreeSetfAttribute", cdecl, dynlib: dllname, varargs.}
# Common Return Values
const
IUP_ERROR* = cint(1)
IUP_NOERROR* = cint(0)
IUP_OPENED* = cint(-1)
IUP_INVALID* = cint(-1)
# Callback Return Values
IUP_IGNORE* = cint(-1)
IUP_DEFAULT* = cint(-2)
IUP_CLOSE* = cint(-3)
IUP_CONTINUE* = cint(-4)
# IupPopup and IupShowXY Parameter Values
IUP_CENTER* = cint(0xFFFF)
IUP_LEFT* = cint(0xFFFE)
IUP_RIGHT* = cint(0xFFFD)
IUP_MOUSEPOS* = cint(0xFFFC)
IUP_CURRENT* = cint(0xFFFB)
IUP_CENTERPARENT* = cint(0xFFFA)
IUP_TOP* = IUP_LEFT
IUP_BOTTOM* = IUP_RIGHT
# SHOW_CB Callback Values
IUP_SHOW* = cint(0)
IUP_RESTORE* = cint(1)
IUP_MINIMIZE* = cint(2)
IUP_MAXIMIZE* = cint(3)
IUP_HIDE* = cint(4)
# SCROLL_CB Callback Values
IUP_SBUP* = cint(0)
IUP_SBDN* = cint(1)
IUP_SBPGUP* = cint(2)
IUP_SBPGDN* = cint(3)
IUP_SBPOSV* = cint(4)
IUP_SBDRAGV* = cint(5)
IUP_SBLEFT* = cint(6)
IUP_SBRIGHT* = cint(7)
IUP_SBPGLEFT* = cint(8)
IUP_SBPGRIGHT* = cint(9)
IUP_SBPOSH* = cint(10)
IUP_SBDRAGH* = cint(11)
# Mouse Button Values and Macros
IUP_BUTTON1* = cint(ord('1'))
IUP_BUTTON2* = cint(ord('2'))
IUP_BUTTON3* = cint(ord('3'))
IUP_BUTTON4* = cint(ord('4'))
IUP_BUTTON5* = cint(ord('5'))
proc isShift*(s: cstring): bool = return s[0] == 'S'
proc isControl*(s: cstring): bool = return s[1] == 'C'
proc isButton1*(s: cstring): bool = return s[2] == '1'
proc isButton2*(s: cstring): bool = return s[3] == '2'
proc isbutton3*(s: cstring): bool = return s[4] == '3'
proc isDouble*(s: cstring): bool = return s[5] == 'D'
proc isAlt*(s: cstring): bool = return s[6] == 'A'
proc isSys*(s: cstring): bool = return s[7] == 'Y'
proc isButton4*(s: cstring): bool = return s[8] == '4'
proc isButton5*(s: cstring): bool = return s[9] == '5'
# Pre-Defined Masks
const
IUP_MASK_FLOAT* = "[+/-]?(/d+/.?/d*|/./d+)"
IUP_MASK_UFLOAT* = "(/d+/.?/d*|/./d+)"
IUP_MASK_EFLOAT* = "[+/-]?(/d+/.?/d*|/./d+)([eE][+/-]?/d+)?"
IUP_MASK_INT* = "[+/-]?/d+"
IUP_MASK_UINT* = "/d+"
# from 32 to 126, all character sets are equal,
# the key code i the same as the character code.
const
K_SP* = cint(ord(' '))
K_exclam* = cint(ord('!'))
K_quotedbl* = cint(ord('\"'))
K_numbersign* = cint(ord('#'))
K_dollar* = cint(ord('$'))
K_percent* = cint(ord('%'))
K_ampersand* = cint(ord('&'))
K_apostrophe* = cint(ord('\''))
K_parentleft* = cint(ord('('))
K_parentright* = cint(ord(')'))
K_asterisk* = cint(ord('*'))
K_plus* = cint(ord('+'))
K_comma* = cint(ord(','))
K_minus* = cint(ord('-'))
K_period* = cint(ord('.'))
K_slash* = cint(ord('/'))
K_0* = cint(ord('0'))
K_1* = cint(ord('1'))
K_2* = cint(ord('2'))
K_3* = cint(ord('3'))
K_4* = cint(ord('4'))
K_5* = cint(ord('5'))
K_6* = cint(ord('6'))
K_7* = cint(ord('7'))
K_8* = cint(ord('8'))
K_9* = cint(ord('9'))
K_colon* = cint(ord(':'))
K_semicolon* = cint(ord(';'))
K_less* = cint(ord('<'))
K_equal* = cint(ord('='))
K_greater* = cint(ord('>'))
K_question* = cint(ord('?'))
K_at* = cint(ord('@'))
K_upperA* = cint(ord('A'))
K_upperB* = cint(ord('B'))
K_upperC* = cint(ord('C'))
K_upperD* = cint(ord('D'))
K_upperE* = cint(ord('E'))
K_upperF* = cint(ord('F'))
K_upperG* = cint(ord('G'))
K_upperH* = cint(ord('H'))
K_upperI* = cint(ord('I'))
K_upperJ* = cint(ord('J'))
K_upperK* = cint(ord('K'))
K_upperL* = cint(ord('L'))
K_upperM* = cint(ord('M'))
K_upperN* = cint(ord('N'))
K_upperO* = cint(ord('O'))
K_upperP* = cint(ord('P'))
K_upperQ* = cint(ord('Q'))
K_upperR* = cint(ord('R'))
K_upperS* = cint(ord('S'))
K_upperT* = cint(ord('T'))
K_upperU* = cint(ord('U'))
K_upperV* = cint(ord('V'))
K_upperW* = cint(ord('W'))
K_upperX* = cint(ord('X'))
K_upperY* = cint(ord('Y'))
K_upperZ* = cint(ord('Z'))
K_bracketleft* = cint(ord('['))
K_backslash* = cint(ord('\\'))
K_bracketright* = cint(ord(']'))
K_circum* = cint(ord('^'))
K_underscore* = cint(ord('_'))
K_grave* = cint(ord('`'))
K_lowera* = cint(ord('a'))
K_lowerb* = cint(ord('b'))
K_lowerc* = cint(ord('c'))
K_lowerd* = cint(ord('d'))
K_lowere* = cint(ord('e'))
K_lowerf* = cint(ord('f'))
K_lowerg* = cint(ord('g'))
K_lowerh* = cint(ord('h'))
K_loweri* = cint(ord('i'))
K_lowerj* = cint(ord('j'))
K_lowerk* = cint(ord('k'))
K_lowerl* = cint(ord('l'))
K_lowerm* = cint(ord('m'))
K_lowern* = cint(ord('n'))
K_lowero* = cint(ord('o'))
K_lowerp* = cint(ord('p'))
K_lowerq* = cint(ord('q'))
K_lowerr* = cint(ord('r'))
K_lowers* = cint(ord('s'))
K_lowert* = cint(ord('t'))
K_loweru* = cint(ord('u'))
K_lowerv* = cint(ord('v'))
K_lowerw* = cint(ord('w'))
K_lowerx* = cint(ord('x'))
K_lowery* = cint(ord('y'))
K_lowerz* = cint(ord('z'))
K_braceleft* = cint(ord('{'))
K_bar* = cint(ord('|'))
K_braceright* = cint(ord('}'))
K_tilde* = cint(ord('~'))
proc isPrint*(c: cint): bool = return c > 31 and c < 127
# also define the escape sequences that have keys associated
const
K_BS* = cint(ord('\b'))
K_TAB* = cint(ord('\t'))
K_LF* = cint(10)
K_CR* = cint(13)
# IUP Extended Key Codes, range start at 128
# Modifiers use 256 interval
# These key code definitions are specific to IUP
proc isXkey*(c: cint): bool = return c > 128
proc isShiftXkey*(c: cint): bool = return c > 256 and c < 512
proc isCtrlXkey*(c: cint): bool = return c > 512 and c < 768
proc isAltXkey*(c: cint): bool = return c > 768 and c < 1024
proc isSysXkey*(c: cint): bool = return c > 1024 and c < 1280
proc IUPxCODE*(c: cint): cint = return c + cint(128) # Normal (must be above 128)
proc IUPsxCODE*(c: cint): cint =
return c + cint(256)
# Shift (must have range to include the standard keys and the normal
# extended keys, so must be above 256
proc IUPcxCODE*(c: cint): cint = return c + cint(512) # Ctrl
proc IUPmxCODE*(c: cint): cint = return c + cint(768) # Alt
proc IUPyxCODE*(c: cint): cint = return c + cint(1024) # Sys (Win or Apple)
const
IUP_NUMMAXCODES* = 1280 ## 5*256=1280 Normal+Shift+Ctrl+Alt+Sys
K_HOME* = IUPxCODE(1)
K_UP* = IUPxCODE(2)
K_PGUP* = IUPxCODE(3)
K_LEFT* = IUPxCODE(4)
K_MIDDLE* = IUPxCODE(5)
K_RIGHT* = IUPxCODE(6)
K_END* = IUPxCODE(7)
K_DOWN* = IUPxCODE(8)
K_PGDN* = IUPxCODE(9)
K_INS* = IUPxCODE(10)
K_DEL* = IUPxCODE(11)
K_PAUSE* = IUPxCODE(12)
K_ESC* = IUPxCODE(13)
K_ccedilla* = IUPxCODE(14)
K_F1* = IUPxCODE(15)
K_F2* = IUPxCODE(16)
K_F3* = IUPxCODE(17)
K_F4* = IUPxCODE(18)
K_F5* = IUPxCODE(19)
K_F6* = IUPxCODE(20)
K_F7* = IUPxCODE(21)
K_F8* = IUPxCODE(22)
K_F9* = IUPxCODE(23)
K_F10* = IUPxCODE(24)
K_F11* = IUPxCODE(25)
K_F12* = IUPxCODE(26)
K_Print* = IUPxCODE(27)
K_Menu* = IUPxCODE(28)
K_acute* = IUPxCODE(29) # no Shift/Ctrl/Alt
K_sHOME* = IUPsxCODE(K_HOME)
K_sUP* = IUPsxCODE(K_UP)
K_sPGUP* = IUPsxCODE(K_PGUP)
K_sLEFT* = IUPsxCODE(K_LEFT)
K_sMIDDLE* = IUPsxCODE(K_MIDDLE)
K_sRIGHT* = IUPsxCODE(K_RIGHT)
K_sEND* = IUPsxCODE(K_END)
K_sDOWN* = IUPsxCODE(K_DOWN)
K_sPGDN* = IUPsxCODE(K_PGDN)
K_sINS* = IUPsxCODE(K_INS)
K_sDEL* = IUPsxCODE(K_DEL)
K_sSP* = IUPsxCODE(K_SP)
K_sTAB* = IUPsxCODE(K_TAB)
K_sCR* = IUPsxCODE(K_CR)
K_sBS* = IUPsxCODE(K_BS)
K_sPAUSE* = IUPsxCODE(K_PAUSE)
K_sESC* = IUPsxCODE(K_ESC)
K_sCcedilla* = IUPsxCODE(K_ccedilla)
K_sF1* = IUPsxCODE(K_F1)
K_sF2* = IUPsxCODE(K_F2)
K_sF3* = IUPsxCODE(K_F3)
K_sF4* = IUPsxCODE(K_F4)
K_sF5* = IUPsxCODE(K_F5)
K_sF6* = IUPsxCODE(K_F6)
K_sF7* = IUPsxCODE(K_F7)
K_sF8* = IUPsxCODE(K_F8)
K_sF9* = IUPsxCODE(K_F9)
K_sF10* = IUPsxCODE(K_F10)
K_sF11* = IUPsxCODE(K_F11)
K_sF12* = IUPsxCODE(K_F12)
K_sPrint* = IUPsxCODE(K_Print)
K_sMenu* = IUPsxCODE(K_Menu)
K_cHOME* = IUPcxCODE(K_HOME)
K_cUP* = IUPcxCODE(K_UP)
K_cPGUP* = IUPcxCODE(K_PGUP)
K_cLEFT* = IUPcxCODE(K_LEFT)
K_cMIDDLE* = IUPcxCODE(K_MIDDLE)
K_cRIGHT* = IUPcxCODE(K_RIGHT)
K_cEND* = IUPcxCODE(K_END)
K_cDOWN* = IUPcxCODE(K_DOWN)
K_cPGDN* = IUPcxCODE(K_PGDN)
K_cINS* = IUPcxCODE(K_INS)
K_cDEL* = IUPcxCODE(K_DEL)
K_cSP* = IUPcxCODE(K_SP)
K_cTAB* = IUPcxCODE(K_TAB)
K_cCR* = IUPcxCODE(K_CR)
K_cBS* = IUPcxCODE(K_BS)
K_cPAUSE* = IUPcxCODE(K_PAUSE)
K_cESC* = IUPcxCODE(K_ESC)
K_cCcedilla* = IUPcxCODE(K_ccedilla)
K_cF1* = IUPcxCODE(K_F1)
K_cF2* = IUPcxCODE(K_F2)
K_cF3* = IUPcxCODE(K_F3)
K_cF4* = IUPcxCODE(K_F4)
K_cF5* = IUPcxCODE(K_F5)
K_cF6* = IUPcxCODE(K_F6)
K_cF7* = IUPcxCODE(K_F7)
K_cF8* = IUPcxCODE(K_F8)
K_cF9* = IUPcxCODE(K_F9)
K_cF10* = IUPcxCODE(K_F10)
K_cF11* = IUPcxCODE(K_F11)
K_cF12* = IUPcxCODE(K_F12)
K_cPrint* = IUPcxCODE(K_Print)
K_cMenu* = IUPcxCODE(K_Menu)
K_mHOME* = IUPmxCODE(K_HOME)
K_mUP* = IUPmxCODE(K_UP)
K_mPGUP* = IUPmxCODE(K_PGUP)
K_mLEFT* = IUPmxCODE(K_LEFT)
K_mMIDDLE* = IUPmxCODE(K_MIDDLE)
K_mRIGHT* = IUPmxCODE(K_RIGHT)
K_mEND* = IUPmxCODE(K_END)
K_mDOWN* = IUPmxCODE(K_DOWN)
K_mPGDN* = IUPmxCODE(K_PGDN)
K_mINS* = IUPmxCODE(K_INS)
K_mDEL* = IUPmxCODE(K_DEL)
K_mSP* = IUPmxCODE(K_SP)
K_mTAB* = IUPmxCODE(K_TAB)
K_mCR* = IUPmxCODE(K_CR)
K_mBS* = IUPmxCODE(K_BS)
K_mPAUSE* = IUPmxCODE(K_PAUSE)
K_mESC* = IUPmxCODE(K_ESC)
K_mCcedilla* = IUPmxCODE(K_ccedilla)
K_mF1* = IUPmxCODE(K_F1)
K_mF2* = IUPmxCODE(K_F2)
K_mF3* = IUPmxCODE(K_F3)
K_mF4* = IUPmxCODE(K_F4)
K_mF5* = IUPmxCODE(K_F5)
K_mF6* = IUPmxCODE(K_F6)
K_mF7* = IUPmxCODE(K_F7)
K_mF8* = IUPmxCODE(K_F8)
K_mF9* = IUPmxCODE(K_F9)
K_mF10* = IUPmxCODE(K_F10)
K_mF11* = IUPmxCODE(K_F11)
K_mF12* = IUPmxCODE(K_F12)
K_mPrint* = IUPmxCODE(K_Print)
K_mMenu* = IUPmxCODE(K_Menu)
K_yHOME* = IUPyxCODE(K_HOME)
K_yUP* = IUPyxCODE(K_UP)
K_yPGUP* = IUPyxCODE(K_PGUP)
K_yLEFT* = IUPyxCODE(K_LEFT)
K_yMIDDLE* = IUPyxCODE(K_MIDDLE)
K_yRIGHT* = IUPyxCODE(K_RIGHT)
K_yEND* = IUPyxCODE(K_END)
K_yDOWN* = IUPyxCODE(K_DOWN)
K_yPGDN* = IUPyxCODE(K_PGDN)
K_yINS* = IUPyxCODE(K_INS)
K_yDEL* = IUPyxCODE(K_DEL)
K_ySP* = IUPyxCODE(K_SP)
K_yTAB* = IUPyxCODE(K_TAB)
K_yCR* = IUPyxCODE(K_CR)
K_yBS* = IUPyxCODE(K_BS)
K_yPAUSE* = IUPyxCODE(K_PAUSE)
K_yESC* = IUPyxCODE(K_ESC)
K_yCcedilla* = IUPyxCODE(K_ccedilla)
K_yF1* = IUPyxCODE(K_F1)
K_yF2* = IUPyxCODE(K_F2)
K_yF3* = IUPyxCODE(K_F3)
K_yF4* = IUPyxCODE(K_F4)
K_yF5* = IUPyxCODE(K_F5)
K_yF6* = IUPyxCODE(K_F6)
K_yF7* = IUPyxCODE(K_F7)
K_yF8* = IUPyxCODE(K_F8)
K_yF9* = IUPyxCODE(K_F9)
K_yF10* = IUPyxCODE(K_F10)
K_yF11* = IUPyxCODE(K_F11)
K_yF12* = IUPyxCODE(K_F12)
K_yPrint* = IUPyxCODE(K_Print)
K_yMenu* = IUPyxCODE(K_Menu)
K_sPlus* = IUPsxCODE(K_plus)
K_sComma* = IUPsxCODE(K_comma)
K_sMinus* = IUPsxCODE(K_minus)
K_sPeriod* = IUPsxCODE(K_period)
K_sSlash* = IUPsxCODE(K_slash)
K_sAsterisk* = IUPsxCODE(K_asterisk)
K_cupperA* = IUPcxCODE(K_upperA)
K_cupperB* = IUPcxCODE(K_upperB)
K_cupperC* = IUPcxCODE(K_upperC)
K_cupperD* = IUPcxCODE(K_upperD)
K_cupperE* = IUPcxCODE(K_upperE)
K_cupperF* = IUPcxCODE(K_upperF)
K_cupperG* = IUPcxCODE(K_upperG)
K_cupperH* = IUPcxCODE(K_upperH)
K_cupperI* = IUPcxCODE(K_upperI)
K_cupperJ* = IUPcxCODE(K_upperJ)
K_cupperK* = IUPcxCODE(K_upperK)
K_cupperL* = IUPcxCODE(K_upperL)
K_cupperM* = IUPcxCODE(K_upperM)
K_cupperN* = IUPcxCODE(K_upperN)
K_cupperO* = IUPcxCODE(K_upperO)
K_cupperP* = IUPcxCODE(K_upperP)
K_cupperQ* = IUPcxCODE(K_upperQ)
K_cupperR* = IUPcxCODE(K_upperR)
K_cupperS* = IUPcxCODE(K_upperS)
K_cupperT* = IUPcxCODE(K_upperT)
K_cupperU* = IUPcxCODE(K_upperU)
K_cupperV* = IUPcxCODE(K_upperV)
K_cupperW* = IUPcxCODE(K_upperW)
K_cupperX* = IUPcxCODE(K_upperX)
K_cupperY* = IUPcxCODE(K_upperY)
K_cupperZ* = IUPcxCODE(K_upperZ)
K_c1* = IUPcxCODE(K_1)
K_c2* = IUPcxCODE(K_2)
K_c3* = IUPcxCODE(K_3)
K_c4* = IUPcxCODE(K_4)
K_c5* = IUPcxCODE(K_5)
K_c6* = IUPcxCODE(K_6)
K_c7* = IUPcxCODE(K_7)
K_c8* = IUPcxCODE(K_8)
K_c9* = IUPcxCODE(K_9)
K_c0* = IUPcxCODE(K_0)
K_cPlus* = IUPcxCODE(K_plus)
K_cComma* = IUPcxCODE(K_comma)
K_cMinus* = IUPcxCODE(K_minus)
K_cPeriod* = IUPcxCODE(K_period)
K_cSlash* = IUPcxCODE(K_slash)
K_cSemicolon* = IUPcxCODE(K_semicolon)
K_cEqual* = IUPcxCODE(K_equal)
K_cBracketleft* = IUPcxCODE(K_bracketleft)
K_cBracketright* = IUPcxCODE(K_bracketright)
K_cBackslash* = IUPcxCODE(K_backslash)
K_cAsterisk* = IUPcxCODE(K_asterisk)
K_mupperA* = IUPmxCODE(K_upperA)
K_mupperB* = IUPmxCODE(K_upperB)
K_mupperC* = IUPmxCODE(K_upperC)
K_mupperD* = IUPmxCODE(K_upperD)
K_mupperE* = IUPmxCODE(K_upperE)
K_mupperF* = IUPmxCODE(K_upperF)
K_mupperG* = IUPmxCODE(K_upperG)
K_mupperH* = IUPmxCODE(K_upperH)
K_mupperI* = IUPmxCODE(K_upperI)
K_mupperJ* = IUPmxCODE(K_upperJ)
K_mupperK* = IUPmxCODE(K_upperK)
K_mupperL* = IUPmxCODE(K_upperL)
K_mupperM* = IUPmxCODE(K_upperM)
K_mupperN* = IUPmxCODE(K_upperN)
K_mupperO* = IUPmxCODE(K_upperO)
K_mupperP* = IUPmxCODE(K_upperP)
K_mupperQ* = IUPmxCODE(K_upperQ)
K_mupperR* = IUPmxCODE(K_upperR)
K_mupperS* = IUPmxCODE(K_upperS)
K_mupperT* = IUPmxCODE(K_upperT)
K_mupperU* = IUPmxCODE(K_upperU)
K_mupperV* = IUPmxCODE(K_upperV)
K_mupperW* = IUPmxCODE(K_upperW)
K_mupperX* = IUPmxCODE(K_upperX)
K_mupperY* = IUPmxCODE(K_upperY)
K_mupperZ* = IUPmxCODE(K_upperZ)
K_m1* = IUPmxCODE(K_1)
K_m2* = IUPmxCODE(K_2)
K_m3* = IUPmxCODE(K_3)
K_m4* = IUPmxCODE(K_4)
K_m5* = IUPmxCODE(K_5)
K_m6* = IUPmxCODE(K_6)
K_m7* = IUPmxCODE(K_7)
K_m8* = IUPmxCODE(K_8)
K_m9* = IUPmxCODE(K_9)
K_m0* = IUPmxCODE(K_0)
K_mPlus* = IUPmxCODE(K_plus)
K_mComma* = IUPmxCODE(K_comma)
K_mMinus* = IUPmxCODE(K_minus)
K_mPeriod* = IUPmxCODE(K_period)
K_mSlash* = IUPmxCODE(K_slash)
K_mSemicolon* = IUPmxCODE(K_semicolon)
K_mEqual* = IUPmxCODE(K_equal)
K_mBracketleft* = IUPmxCODE(K_bracketleft)
K_mBracketright* = IUPmxCODE(K_bracketright)
K_mBackslash* = IUPmxCODE(K_backslash)
K_mAsterisk* = IUPmxCODE(K_asterisk)
K_yA* = IUPyxCODE(K_upperA)
K_yB* = IUPyxCODE(K_upperB)
K_yC* = IUPyxCODE(K_upperC)
K_yD* = IUPyxCODE(K_upperD)
K_yE* = IUPyxCODE(K_upperE)
K_yF* = IUPyxCODE(K_upperF)
K_yG* = IUPyxCODE(K_upperG)
K_yH* = IUPyxCODE(K_upperH)
K_yI* = IUPyxCODE(K_upperI)
K_yJ* = IUPyxCODE(K_upperJ)
K_yK* = IUPyxCODE(K_upperK)
K_yL* = IUPyxCODE(K_upperL)
K_yM* = IUPyxCODE(K_upperM)
K_yN* = IUPyxCODE(K_upperN)
K_yO* = IUPyxCODE(K_upperO)
K_yP* = IUPyxCODE(K_upperP)
K_yQ* = IUPyxCODE(K_upperQ)
K_yR* = IUPyxCODE(K_upperR)
K_yS* = IUPyxCODE(K_upperS)
K_yT* = IUPyxCODE(K_upperT)
K_yU* = IUPyxCODE(K_upperU)
K_yV* = IUPyxCODE(K_upperV)
K_yW* = IUPyxCODE(K_upperW)
K_yX* = IUPyxCODE(K_upperX)
K_yY* = IUPyxCODE(K_upperY)
K_yZ* = IUPyxCODE(K_upperZ)
K_y1* = IUPyxCODE(K_1)
K_y2* = IUPyxCODE(K_2)
K_y3* = IUPyxCODE(K_3)
K_y4* = IUPyxCODE(K_4)
K_y5* = IUPyxCODE(K_5)
K_y6* = IUPyxCODE(K_6)
K_y7* = IUPyxCODE(K_7)
K_y8* = IUPyxCODE(K_8)
K_y9* = IUPyxCODE(K_9)
K_y0* = IUPyxCODE(K_0)
K_yPlus* = IUPyxCODE(K_plus)
K_yComma* = IUPyxCODE(K_comma)
K_yMinus* = IUPyxCODE(K_minus)
K_yPeriod* = IUPyxCODE(K_period)
K_ySlash* = IUPyxCODE(K_slash)
K_ySemicolon* = IUPyxCODE(K_semicolon)
K_yEqual* = IUPyxCODE(K_equal)
K_yBracketleft* = IUPyxCODE(K_bracketleft)
K_yBracketright* = IUPyxCODE(K_bracketright)
K_yBackslash* = IUPyxCODE(K_backslash)
K_yAsterisk* = IUPyxCODE(K_asterisk)
proc ControlsOpen*(): cint {.cdecl, importc: "IupControlsOpen", dynlib: dllname.}
proc ControlsClose*() {.cdecl, importc: "IupControlsClose", dynlib: dllname.}
proc OldValOpen*() {.cdecl, importc: "IupOldValOpen", dynlib: dllname.}
proc OldTabsOpen*() {.cdecl, importc: "IupOldTabsOpen", dynlib: dllname.}
proc Colorbar*(): PIhandle {.cdecl, importc: "IupColorbar", dynlib: dllname.}
proc Cells*(): PIhandle {.cdecl, importc: "IupCells", dynlib: dllname.}
proc ColorBrowser*(): PIhandle {.cdecl, importc: "IupColorBrowser", dynlib: dllname.}
proc Gauge*(): PIhandle {.cdecl, importc: "IupGauge", dynlib: dllname.}
proc Dial*(theType: cstring): PIhandle {.cdecl, importc: "IupDial", dynlib: dllname.}
proc Matrix*(action: cstring): PIhandle {.cdecl, importc: "IupMatrix", dynlib: dllname.}
# IupMatrix utilities
proc MatSetAttribute*(ih: PIhandle, name: cstring, lin, col: cint,
value: cstring) {.
cdecl, importc: "IupMatSetAttribute", dynlib: dllname.}
proc MatStoreAttribute*(ih: PIhandle, name: cstring, lin, col: cint,
value: cstring) {.cdecl,
importc: "IupMatStoreAttribute", dynlib: dllname.}
proc MatGetAttribute*(ih: PIhandle, name: cstring, lin, col: cint): cstring {.
cdecl, importc: "IupMatGetAttribute", dynlib: dllname.}
proc MatGetInt*(ih: PIhandle, name: cstring, lin, col: cint): cint {.
cdecl, importc: "IupMatGetInt", dynlib: dllname.}
proc MatGetFloat*(ih: PIhandle, name: cstring, lin, col: cint): cfloat {.
cdecl, importc: "IupMatGetFloat", dynlib: dllname.}
proc MatSetfAttribute*(ih: PIhandle, name: cstring, lin, col: cint,
format: cstring) {.cdecl,
importc: "IupMatSetfAttribute",
dynlib: dllname, varargs.}
# Used by IupColorbar
const
IUP_PRIMARY* = -1
IUP_SECONDARY* = -2
# Initialize PPlot widget class
proc PPlotOpen*() {.cdecl, importc: "IupPPlotOpen", dynlib: dllname.}
# Create an PPlot widget instance
proc PPlot*: PIhandle {.cdecl, importc: "IupPPlot", dynlib: dllname.}
# Add dataset to plot
proc PPlotBegin*(ih: PIhandle, strXdata: cint) {.
cdecl, importc: "IupPPlotBegin", dynlib: dllname.}
proc PPlotAdd*(ih: PIhandle, x, y: cfloat) {.
cdecl, importc: "IupPPlotAdd", dynlib: dllname.}
proc PPlotAddStr*(ih: PIhandle, x: cstring, y: cfloat) {.
cdecl, importc: "IupPPlotAddStr", dynlib: dllname.}
proc PPlotEnd*(ih: PIhandle): cint {.
cdecl, importc: "IupPPlotEnd", dynlib: dllname.}
proc PPlotInsertStr*(ih: PIhandle, index, sample_index: cint, x: cstring,
y: cfloat) {.cdecl, importc: "IupPPlotInsertStr",
dynlib: dllname.}
proc PPlotInsert*(ih: PIhandle, index, sample_index: cint,
x, y: cfloat) {.
cdecl, importc: "IupPPlotInsert", dynlib: dllname.}
# convert from plot coordinates to pixels
proc PPlotTransform*(ih: PIhandle, x, y: cfloat, ix, iy: var cint) {.
cdecl, importc: "IupPPlotTransform", dynlib: dllname.}
# Plot on the given device. Uses a "cdCanvas*".
proc PPlotPaintTo*(ih: PIhandle, cnv: pointer) {.
cdecl, importc: "IupPPlotPaintTo", dynlib: dllname.}

View File

@@ -1,644 +0,0 @@
#
# $Id: header,v 1.1 2000/07/13 06:33:45 michael Exp $
# This file is part of the Free Pascal packages
# Copyright (c) 1999-2000 by the Free Pascal development team
#
# See the file COPYING.FPC, included in this distribution,
# for details about the copyright.
#
# This program 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.
#
# **********************************************************************
#
# the curl library is governed by its own copyright, see the curl
# website for this.
#
{.deadCodeElim: on.}
import times
when defined(windows):
const libname = "libcurl.dll"
elif defined(macosx):
const libname = "libcurl-7.19.3.dylib"
elif defined(unix):
const libname = "libcurl.so.4"
type
Pcurl_calloc_callback* = ptr Tcurl_calloc_callback
Pcurl_closepolicy* = ptr Tcurl_closepolicy
Pcurl_forms* = ptr Tcurl_forms
Pcurl_ftpauth* = ptr Tcurl_ftpauth
Pcurl_ftpmethod* = ptr Tcurl_ftpmethod
Pcurl_ftpssl* = ptr Tcurl_ftpssl
PCURL_HTTP_VERSION* = ptr TCURL_HTTP_VERSION
Pcurl_httppost* = ptr Tcurl_httppost
PPcurl_httppost* = ptr Pcurl_httppost
Pcurl_infotype* = ptr Tcurl_infotype
Pcurl_lock_access* = ptr Tcurl_lock_access
Pcurl_lock_data* = ptr Tcurl_lock_data
Pcurl_malloc_callback* = ptr tcurl_malloc_callback
PCURL_NETRC_OPTION* = ptr TCURL_NETRC_OPTION
Pcurl_proxytype* = ptr Tcurl_proxytype
Pcurl_realloc_callback* = ptr tcurl_realloc_callback
Pcurl_slist* = ptr Tcurl_slist
Pcurl_socket* = ptr Tcurl_socket
PCURL_SSL_VERSION* = ptr TCURL_SSL_VERSION
Pcurl_strdup_callback* = ptr Tcurl_strdup_callback
PCURL_TIMECOND* = ptr TCURL_TIMECOND
Pcurl_version_info_data* = ptr Tcurl_version_info_data
PCURLcode* = ptr TCURLcode
PCURLFORMcode* = ptr TCURLFORMcode
PCURLformoption* = ptr TCURLformoption
PCURLINFO* = ptr TCURLINFO
Pcurliocmd* = ptr Tcurliocmd
Pcurlioerr* = ptr Tcurlioerr
PCURLM* = ptr TCURLM
PCURLMcode* = ptr TCURLMcode
PCURLMoption* = ptr TCURLMoption
PCURLMSG* = ptr TCURLMSG
PCURLoption* = ptr TCURLoption
PCURLSH* = ptr TCURLSH
PCURLSHcode* = ptr TCURLSHcode
PCURLSHoption* = ptr TCURLSHoption
PCURLversion* = ptr TCURLversion
Pfd_set* = pointer
PCURL* = ptr TCurl
TCurl* = pointer
Tcurl_httppost* {.final, pure.} = object
next*: Pcurl_httppost
name*: cstring
namelength*: int32
contents*: cstring
contentslength*: int32
buffer*: cstring
bufferlength*: int32
contenttype*: cstring
contentheader*: Pcurl_slist
more*: Pcurl_httppost
flags*: int32
showfilename*: cstring
Tcurl_progress_callback* = proc (clientp: pointer, dltotal: float64,
dlnow: float64, ultotal: float64,
ulnow: float64): int32{.cdecl.}
Tcurl_write_callback* = proc (buffer: cstring, size: int, nitems: int,
outstream: pointer): int{.cdecl.}
Tcurl_read_callback* = proc (buffer: cstring, size: int, nitems: int,
instream: pointer): int{.cdecl.}
Tcurl_passwd_callback* = proc (clientp: pointer, prompt: cstring,
buffer: cstring, buflen: int32): int32{.cdecl.}
Tcurlioerr* = enum
CURLIOE_OK, CURLIOE_UNKNOWNCMD, CURLIOE_FAILRESTART, CURLIOE_LAST
Tcurliocmd* = enum
CURLIOCMD_NOP, CURLIOCMD_RESTARTREAD, CURLIOCMD_LAST
Tcurl_ioctl_callback* = proc (handle: PCURL, cmd: int32,
clientp: pointer): Tcurlioerr {.cdecl.}
Tcurl_malloc_callback* = proc (size: int): pointer {.cdecl.}
Tcurl_free_callback* = proc (p: pointer) {.cdecl.}
Tcurl_realloc_callback* = proc (p: pointer, size: int): pointer {.cdecl.}
Tcurl_strdup_callback* = proc (str: cstring): cstring {.cdecl.}
Tcurl_calloc_callback* = proc (nmemb: int, size: int): pointer
Tcurl_infotype* = enum
CURLINFO_TEXT = 0, CURLINFO_HEADER_IN, CURLINFO_HEADER_OUT,
CURLINFO_DATA_IN, CURLINFO_DATA_OUT, CURLINFO_SSL_DATA_IN,
CURLINFO_SSL_DATA_OUT, CURLINFO_END
Tcurl_debug_callback* = proc (handle: PCURL, theType: Tcurl_infotype,
data: cstring, size: int,
userptr: pointer): int32 {.cdecl.}
TCURLcode* = enum
CURLE_OK = 0, CURLE_UNSUPPORTED_PROTOCOL, CURLE_FAILED_INIT,
CURLE_URL_MALFORMAT, CURLE_URL_MALFORMAT_USER, CURLE_COULDNT_RESOLVE_PROXY,
CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT,
CURLE_FTP_WEIRD_SERVER_REPLY, CURLE_FTP_ACCESS_DENIED,
CURLE_FTP_USER_PASSWORD_INCORRECT, CURLE_FTP_WEIRD_PASS_REPLY,
CURLE_FTP_WEIRD_USER_REPLY, CURLE_FTP_WEIRD_PASV_REPLY,
CURLE_FTP_WEIRD_227_FORMAT, CURLE_FTP_CANT_GET_HOST,
CURLE_FTP_CANT_RECONNECT, CURLE_FTP_COULDNT_SET_BINARY, CURLE_PARTIAL_FILE,
CURLE_FTP_COULDNT_RETR_FILE, CURLE_FTP_WRITE_ERROR, CURLE_FTP_QUOTE_ERROR,
CURLE_HTTP_RETURNED_ERROR, CURLE_WRITE_ERROR, CURLE_MALFORMAT_USER,
CURLE_FTP_COULDNT_STOR_FILE, CURLE_READ_ERROR, CURLE_OUT_OF_MEMORY,
CURLE_OPERATION_TIMEOUTED, CURLE_FTP_COULDNT_SET_ASCII,
CURLE_FTP_PORT_FAILED, CURLE_FTP_COULDNT_USE_REST,
CURLE_FTP_COULDNT_GET_SIZE, CURLE_HTTP_RANGE_ERROR, CURLE_HTTP_POST_ERROR,
CURLE_SSL_CONNECT_ERROR, CURLE_BAD_DOWNLOAD_RESUME,
CURLE_FILE_COULDNT_READ_FILE, CURLE_LDAP_CANNOT_BIND,
CURLE_LDAP_SEARCH_FAILED, CURLE_LIBRARY_NOT_FOUND, CURLE_FUNCTION_NOT_FOUND,
CURLE_ABORTED_BY_CALLBACK, CURLE_BAD_FUNCTION_ARGUMENT,
CURLE_BAD_CALLING_ORDER, CURLE_INTERFACE_FAILED, CURLE_BAD_PASSWORD_ENTERED,
CURLE_TOO_MANY_REDIRECTS, CURLE_UNKNOWN_TELNET_OPTION,
CURLE_TELNET_OPTION_SYNTAX, CURLE_OBSOLETE, CURLE_SSL_PEER_CERTIFICATE,
CURLE_GOT_NOTHING, CURLE_SSL_ENGINE_NOTFOUND, CURLE_SSL_ENGINE_SETFAILED,
CURLE_SEND_ERROR, CURLE_RECV_ERROR, CURLE_SHARE_IN_USE,
CURLE_SSL_CERTPROBLEM, CURLE_SSL_CIPHER, CURLE_SSL_CACERT,
CURLE_BAD_CONTENT_ENCODING, CURLE_LDAP_INVALID_URL, CURLE_FILESIZE_EXCEEDED,
CURLE_FTP_SSL_FAILED, CURLE_SEND_FAIL_REWIND, CURLE_SSL_ENGINE_INITFAILED,
CURLE_LOGIN_DENIED, CURLE_TFTP_NOTFOUND, CURLE_TFTP_PERM,
CURLE_TFTP_DISKFULL, CURLE_TFTP_ILLEGAL, CURLE_TFTP_UNKNOWNID,
CURLE_TFTP_EXISTS, CURLE_TFTP_NOSUCHUSER, CURLE_CONV_FAILED,
CURLE_CONV_REQD, CURL_LAST
Tcurl_conv_callback* = proc (buffer: cstring, len: int): TCURLcode {.cdecl.}
Tcurl_ssl_ctx_callback* = proc (curl: PCURL,
ssl_ctx, userptr: pointer): TCURLcode {.cdecl.}
Tcurl_proxytype* = enum
CURLPROXY_HTTP = 0, CURLPROXY_SOCKS4 = 4, CURLPROXY_SOCKS5 = 5
Tcurl_ftpssl* = enum
CURLFTPSSL_NONE, CURLFTPSSL_TRY, CURLFTPSSL_CONTROL, CURLFTPSSL_ALL,
CURLFTPSSL_LAST
Tcurl_ftpauth* = enum
CURLFTPAUTH_DEFAULT, CURLFTPAUTH_SSL, CURLFTPAUTH_TLS, CURLFTPAUTH_LAST
Tcurl_ftpmethod* = enum
CURLFTPMETHOD_DEFAULT, CURLFTPMETHOD_MULTICWD, CURLFTPMETHOD_NOCWD,
CURLFTPMETHOD_SINGLECWD, CURLFTPMETHOD_LAST
TCURLoption* = enum
CURLOPT_PORT = 0 + 3,
CURLOPT_TIMEOUT = 0 + 13,
CURLOPT_INFILESIZE = 0 + 14,
CURLOPT_LOW_SPEED_LIMIT = 0 + 19,
CURLOPT_LOW_SPEED_TIME = 0 + 20,
CURLOPT_RESUME_FROM = 0 + 21,
CURLOPT_CRLF = 0 + 27,
CURLOPT_SSLVERSION = 0 + 32,
CURLOPT_TIMECONDITION = 0 + 33,
CURLOPT_TIMEVALUE = 0 + 34,
CURLOPT_VERBOSE = 0 + 41,
CURLOPT_HEADER = 0 + 42,
CURLOPT_NOPROGRESS = 0 + 43,
CURLOPT_NOBODY = 0 + 44,
CURLOPT_FAILONERROR = 0 + 45,
CURLOPT_UPLOAD = 0 + 46,
CURLOPT_POST = 0 + 47,
CURLOPT_FTPLISTONLY = 0 + 48,
CURLOPT_FTPAPPEND = 0 + 50,
CURLOPT_NETRC = 0 + 51,
CURLOPT_FOLLOWLOCATION = 0 + 52,
CURLOPT_TRANSFERTEXT = 0 + 53,
CURLOPT_PUT = 0 + 54,
CURLOPT_AUTOREFERER = 0 + 58,
CURLOPT_PROXYPORT = 0 + 59,
CURLOPT_POSTFIELDSIZE = 0 + 60,
CURLOPT_HTTPPROXYTUNNEL = 0 + 61,
CURLOPT_SSL_VERIFYPEER = 0 + 64,
CURLOPT_MAXREDIRS = 0 + 68,
CURLOPT_FILETIME = 0 + 69,
CURLOPT_MAXCONNECTS = 0 + 71,
CURLOPT_CLOSEPOLICY = 0 + 72,
CURLOPT_FRESH_CONNECT = 0 + 74,
CURLOPT_FORBID_REUSE = 0 + 75,
CURLOPT_CONNECTTIMEOUT = 0 + 78,
CURLOPT_HTTPGET = 0 + 80,
CURLOPT_SSL_VERIFYHOST = 0 + 81,
CURLOPT_HTTP_VERSION = 0 + 84,
CURLOPT_FTP_USE_EPSV = 0 + 85,
CURLOPT_SSLENGINE_DEFAULT = 0 + 90,
CURLOPT_DNS_USE_GLOBAL_CACHE = 0 + 91,
CURLOPT_DNS_CACHE_TIMEOUT = 0 + 92,
CURLOPT_COOKIESESSION = 0 + 96,
CURLOPT_BUFFERSIZE = 0 + 98,
CURLOPT_NOSIGNAL = 0 + 99,
CURLOPT_PROXYTYPE = 0 + 101,
CURLOPT_UNRESTRICTED_AUTH = 0 + 105,
CURLOPT_FTP_USE_EPRT = 0 + 106,
CURLOPT_HTTPAUTH = 0 + 107,
CURLOPT_FTP_CREATE_MISSING_DIRS = 0 + 110,
CURLOPT_PROXYAUTH = 0 + 111,
CURLOPT_FTP_RESPONSE_TIMEOUT = 0 + 112,
CURLOPT_IPRESOLVE = 0 + 113,
CURLOPT_MAXFILESIZE = 0 + 114,
CURLOPT_FTP_SSL = 0 + 119,
CURLOPT_TCP_NODELAY = 0 + 121,
CURLOPT_FTPSSLAUTH = 0 + 129,
CURLOPT_IGNORE_CONTENT_LENGTH = 0 + 136,
CURLOPT_FTP_SKIP_PASV_IP = 0 + 137,
CURLOPT_FTP_FILEMETHOD = 0 + 138,
CURLOPT_LOCALPORT = 0 + 139,
CURLOPT_LOCALPORTRANGE = 0 + 140,
CURLOPT_CONNECT_ONLY = 0 + 141,
CURLOPT_FILE = 10000 + 1,
CURLOPT_URL = 10000 + 2,
CURLOPT_PROXY = 10000 + 4,
CURLOPT_USERPWD = 10000 + 5,
CURLOPT_PROXYUSERPWD = 10000 + 6,
CURLOPT_RANGE = 10000 + 7,
CURLOPT_INFILE = 10000 + 9,
CURLOPT_ERRORBUFFER = 10000 + 10,
CURLOPT_POSTFIELDS = 10000 + 15,
CURLOPT_REFERER = 10000 + 16,
CURLOPT_FTPPORT = 10000 + 17,
CURLOPT_USERAGENT = 10000 + 18,
CURLOPT_COOKIE = 10000 + 22,
CURLOPT_HTTPHEADER = 10000 + 23,
CURLOPT_HTTPPOST = 10000 + 24,
CURLOPT_SSLCERT = 10000 + 25,
CURLOPT_SSLCERTPASSWD = 10000 + 26,
CURLOPT_QUOTE = 10000 + 28,
CURLOPT_WRITEHEADER = 10000 + 29,
CURLOPT_COOKIEFILE = 10000 + 31,
CURLOPT_CUSTOMREQUEST = 10000 + 36,
CURLOPT_STDERR = 10000 + 37,
CURLOPT_POSTQUOTE = 10000 + 39,
CURLOPT_WRITEINFO = 10000 + 40,
CURLOPT_PROGRESSDATA = 10000 + 57,
CURLOPT_INTERFACE = 10000 + 62,
CURLOPT_KRB4LEVEL = 10000 + 63,
CURLOPT_CAINFO = 10000 + 65,
CURLOPT_TELNETOPTIONS = 10000 + 70,
CURLOPT_RANDOM_FILE = 10000 + 76,
CURLOPT_EGDSOCKET = 10000 + 77,
CURLOPT_COOKIEJAR = 10000 + 82,
CURLOPT_SSL_CIPHER_LIST = 10000 + 83,
CURLOPT_SSLCERTTYPE = 10000 + 86,
CURLOPT_SSLKEY = 10000 + 87,
CURLOPT_SSLKEYTYPE = 10000 + 88,
CURLOPT_SSLENGINE = 10000 + 89,
CURLOPT_PREQUOTE = 10000 + 93,
CURLOPT_DEBUGDATA = 10000 + 95,
CURLOPT_CAPATH = 10000 + 97,
CURLOPT_SHARE = 10000 + 100,
CURLOPT_ENCODING = 10000 + 102,
CURLOPT_PRIVATE = 10000 + 103,
CURLOPT_HTTP200ALIASES = 10000 + 104,
CURLOPT_SSL_CTX_DATA = 10000 + 109,
CURLOPT_NETRC_FILE = 10000 + 118,
CURLOPT_SOURCE_USERPWD = 10000 + 123,
CURLOPT_SOURCE_PREQUOTE = 10000 + 127,
CURLOPT_SOURCE_POSTQUOTE = 10000 + 128,
CURLOPT_IOCTLDATA = 10000 + 131,
CURLOPT_SOURCE_URL = 10000 + 132,
CURLOPT_SOURCE_QUOTE = 10000 + 133,
CURLOPT_FTP_ACCOUNT = 10000 + 134,
CURLOPT_COOKIELIST = 10000 + 135,
CURLOPT_FTP_ALTERNATIVE_TO_USER = 10000 + 147,
CURLOPT_LASTENTRY = 10000 + 148,
CURLOPT_WRITEFUNCTION = 20000 + 11,
CURLOPT_READFUNCTION = 20000 + 12,
CURLOPT_PROGRESSFUNCTION = 20000 + 56,
CURLOPT_HEADERFUNCTION = 20000 + 79,
CURLOPT_DEBUGFUNCTION = 20000 + 94,
CURLOPT_SSL_CTX_FUNCTION = 20000 + 108,
CURLOPT_IOCTLFUNCTION = 20000 + 130,
CURLOPT_CONV_FROM_NETWORK_FUNCTION = 20000 + 142,
CURLOPT_CONV_TO_NETWORK_FUNCTION = 20000 + 143,
CURLOPT_CONV_FROM_UTF8_FUNCTION = 20000 + 144,
CURLOPT_INFILESIZE_LARGE = 30000 + 115,
CURLOPT_RESUME_FROM_LARGE = 30000 + 116,
CURLOPT_MAXFILESIZE_LARGE = 30000 + 117,
CURLOPT_POSTFIELDSIZE_LARGE = 30000 + 120,
CURLOPT_MAX_SEND_SPEED_LARGE = 30000 + 145,
CURLOPT_MAX_RECV_SPEED_LARGE = 30000 + 146
TCURL_HTTP_VERSION* = enum
CURL_HTTP_VERSION_NONE, CURL_HTTP_VERSION_1_0, CURL_HTTP_VERSION_1_1,
CURL_HTTP_VERSION_LAST
TCURL_NETRC_OPTION* = enum
CURL_NETRC_IGNORED, CURL_NETRC_OPTIONAL, CURL_NETRC_REQUIRED,
CURL_NETRC_LAST
TCURL_SSL_VERSION* = enum
CURL_SSLVERSION_DEFAULT, CURL_SSLVERSION_TLSv1, CURL_SSLVERSION_SSLv2,
CURL_SSLVERSION_SSLv3, CURL_SSLVERSION_LAST
TCURL_TIMECOND* = enum
CURL_TIMECOND_NONE, CURL_TIMECOND_IFMODSINCE, CURL_TIMECOND_IFUNMODSINCE,
CURL_TIMECOND_LASTMOD, CURL_TIMECOND_LAST
TCURLformoption* = enum
CURLFORM_NOTHING, CURLFORM_COPYNAME, CURLFORM_PTRNAME, CURLFORM_NAMELENGTH,
CURLFORM_COPYCONTENTS, CURLFORM_PTRCONTENTS, CURLFORM_CONTENTSLENGTH,
CURLFORM_FILECONTENT, CURLFORM_ARRAY, CURLFORM_OBSOLETE, CURLFORM_FILE,
CURLFORM_BUFFER, CURLFORM_BUFFERPTR, CURLFORM_BUFFERLENGTH,
CURLFORM_CONTENTTYPE, CURLFORM_CONTENTHEADER, CURLFORM_FILENAME,
CURLFORM_END, CURLFORM_OBSOLETE2, CURLFORM_LASTENTRY
Tcurl_forms* {.pure, final.} = object
option*: TCURLformoption
value*: cstring
TCURLFORMcode* = enum
CURL_FORMADD_OK, CURL_FORMADD_MEMORY, CURL_FORMADD_OPTION_TWICE,
CURL_FORMADD_NULL, CURL_FORMADD_UNKNOWN_OPTION, CURL_FORMADD_INCOMPLETE,
CURL_FORMADD_ILLEGAL_ARRAY, CURL_FORMADD_DISABLED, CURL_FORMADD_LAST
Tcurl_formget_callback* = proc (arg: pointer, buf: cstring,
length: int): int {.cdecl.}
Tcurl_slist* {.pure, final.} = object
data*: cstring
next*: Pcurl_slist
TCURLINFO* = enum
CURLINFO_NONE = 0,
CURLINFO_LASTONE = 30,
CURLINFO_EFFECTIVE_URL = 0x00100000 + 1,
CURLINFO_CONTENT_TYPE = 0x00100000 + 18,
CURLINFO_PRIVATE = 0x00100000 + 21,
CURLINFO_FTP_ENTRY_PATH = 0x00100000 + 30,
CURLINFO_RESPONSE_CODE = 0x00200000 + 2,
CURLINFO_HEADER_SIZE = 0x00200000 + 11,
CURLINFO_REQUEST_SIZE = 0x00200000 + 12,
CURLINFO_SSL_VERIFYRESULT = 0x00200000 + 13,
CURLINFO_FILETIME = 0x00200000 + 14,
CURLINFO_REDIRECT_COUNT = 0x00200000 + 20,
CURLINFO_HTTP_CONNECTCODE = 0x00200000 + 22,
CURLINFO_HTTPAUTH_AVAIL = 0x00200000 + 23,
CURLINFO_PROXYAUTH_AVAIL = 0x00200000 + 24,
CURLINFO_OS_ERRNO = 0x00200000 + 25,
CURLINFO_NUM_CONNECTS = 0x00200000 + 26,
CURLINFO_LASTSOCKET = 0x00200000 + 29,
CURLINFO_TOTAL_TIME = 0x00300000 + 3,
CURLINFO_NAMELOOKUP_TIME = 0x00300000 + 4,
CURLINFO_CONNECT_TIME = 0x00300000 + 5,
CURLINFO_PRETRANSFER_TIME = 0x00300000 + 6,
CURLINFO_SIZE_UPLOAD = 0x00300000 + 7,
CURLINFO_SIZE_DOWNLOAD = 0x00300000 + 8,
CURLINFO_SPEED_DOWNLOAD = 0x00300000 + 9,
CURLINFO_SPEED_UPLOAD = 0x00300000 + 10,
CURLINFO_CONTENT_LENGTH_DOWNLOAD = 0x00300000 + 15,
CURLINFO_CONTENT_LENGTH_UPLOAD = 0x00300000 + 16,
CURLINFO_STARTTRANSFER_TIME = 0x00300000 + 17,
CURLINFO_REDIRECT_TIME = 0x00300000 + 19,
CURLINFO_SSL_ENGINES = 0x00400000 + 27,
CURLINFO_COOKIELIST = 0x00400000 + 28
Tcurl_closepolicy* = enum
CURLCLOSEPOLICY_NONE, CURLCLOSEPOLICY_OLDEST,
CURLCLOSEPOLICY_LEAST_RECENTLY_USED, CURLCLOSEPOLICY_LEAST_TRAFFIC,
CURLCLOSEPOLICY_SLOWEST, CURLCLOSEPOLICY_CALLBACK, CURLCLOSEPOLICY_LAST
Tcurl_lock_data* = enum
CURL_LOCK_DATA_NONE = 0, CURL_LOCK_DATA_SHARE, CURL_LOCK_DATA_COOKIE,
CURL_LOCK_DATA_DNS, CURL_LOCK_DATA_SSL_SESSION, CURL_LOCK_DATA_CONNECT,
CURL_LOCK_DATA_LAST
Tcurl_lock_access* = enum
CURL_LOCK_ACCESS_NONE = 0, CURL_LOCK_ACCESS_SHARED = 1,
CURL_LOCK_ACCESS_SINGLE = 2, CURL_LOCK_ACCESS_LAST
Tcurl_lock_function* = proc (handle: PCURL, data: Tcurl_lock_data,
locktype: Tcurl_lock_access,
userptr: pointer) {.cdecl.}
Tcurl_unlock_function* = proc (handle: PCURL, data: Tcurl_lock_data,
userptr: pointer) {.cdecl.}
TCURLSH* = pointer
TCURLSHcode* = enum
CURLSHE_OK, CURLSHE_BAD_OPTION, CURLSHE_IN_USE, CURLSHE_INVALID,
CURLSHE_NOMEM, CURLSHE_LAST
TCURLSHoption* = enum
CURLSHOPT_NONE, CURLSHOPT_SHARE, CURLSHOPT_UNSHARE, CURLSHOPT_LOCKFUNC,
CURLSHOPT_UNLOCKFUNC, CURLSHOPT_USERDATA, CURLSHOPT_LAST
TCURLversion* = enum
CURLVERSION_FIRST, CURLVERSION_SECOND, CURLVERSION_THIRD, CURLVERSION_LAST
Tcurl_version_info_data* {.pure, final.} = object
age*: TCURLversion
version*: cstring
version_num*: int32
host*: cstring
features*: int32
ssl_version*: cstring
ssl_version_num*: int32
libz_version*: cstring
protocols*: cstringArray
ares*: cstring
ares_num*: int32
libidn*: cstring
iconv_ver_num*: int32
TCURLM* = pointer
Tcurl_socket* = int32
TCURLMcode* = enum
CURLM_CALL_MULTI_PERFORM = -1,
CURLM_OK = 0,
CURLM_BAD_HANDLE,
CURLM_BAD_EASY_HANDLE,
CURLM_OUT_OF_MEMORY,
CURLM_INTERNAL_ERROR,
CURLM_BAD_SOCKET,
CURLM_UNKNOWN_OPTION,
CURLM_LAST
TCURLMSGEnum* = enum
CURLMSG_NONE, CURLMSG_DONE, CURLMSG_LAST
TCURLMsg* {.pure, final.} = object
msg*: TCURLMSGEnum
easy_handle*: PCURL
whatever*: Pointer #data : record
# case longint of
# 0 : ( whatever : pointer );
# 1 : ( result : CURLcode );
# end;
Tcurl_socket_callback* = proc (easy: PCURL, s: Tcurl_socket, what: int32,
userp, socketp: pointer): int32 {.cdecl.}
TCURLMoption* = enum
CURLMOPT_SOCKETDATA = 10000 + 2,
CURLMOPT_LASTENTRY = 10000 + 3,
CURLMOPT_SOCKETFUNCTION = 20000 + 1
const
CURLOPT_SSLKEYPASSWD* = CURLOPT_SSLCERTPASSWD
CURLAUTH_ANY* = not (0)
CURLAUTH_BASIC* = 1 shl 0
CURLAUTH_ANYSAFE* = not (CURLAUTH_BASIC)
CURLAUTH_DIGEST* = 1 shl 1
CURLAUTH_GSSNEGOTIATE* = 1 shl 2
CURLAUTH_NONE* = 0
CURLAUTH_NTLM* = 1 shl 3
CURLE_ALREADY_COMPLETE* = 99999
CURLE_FTP_BAD_DOWNLOAD_RESUME* = CURLE_BAD_DOWNLOAD_RESUME
CURLE_FTP_PARTIAL_FILE* = CURLE_PARTIAL_FILE
CURLE_HTTP_NOT_FOUND* = CURLE_HTTP_RETURNED_ERROR
CURLE_HTTP_PORT_FAILED* = CURLE_INTERFACE_FAILED
CURLE_OPERATION_TIMEDOUT* = CURLE_OPERATION_TIMEOUTED
CURL_ERROR_SIZE* = 256
CURL_FORMAT_OFF_T* = "%ld"
CURL_GLOBAL_NOTHING* = 0
CURL_GLOBAL_SSL* = 1 shl 0
CURL_GLOBAL_WIN32* = 1 shl 1
CURL_GLOBAL_ALL* = CURL_GLOBAL_SSL or CURL_GLOBAL_WIN32
CURL_GLOBAL_DEFAULT* = CURL_GLOBAL_ALL
CURLINFO_DOUBLE* = 0x00300000
CURLINFO_HTTP_CODE* = CURLINFO_RESPONSE_CODE
CURLINFO_LONG* = 0x00200000
CURLINFO_MASK* = 0x000FFFFF
CURLINFO_SLIST* = 0x00400000
CURLINFO_STRING* = 0x00100000
CURLINFO_TYPEMASK* = 0x00F00000
CURL_IPRESOLVE_V4* = 1
CURL_IPRESOLVE_V6* = 2
CURL_IPRESOLVE_WHATEVER* = 0
CURL_MAX_WRITE_SIZE* = 16384
CURLM_CALL_MULTI_SOCKET* = CURLM_CALL_MULTI_PERFORM
CURLOPT_CLOSEFUNCTION* = - (5)
CURLOPT_FTPASCII* = CURLOPT_TRANSFERTEXT
CURLOPT_HEADERDATA* = CURLOPT_WRITEHEADER
CURLOPT_HTTPREQUEST* = - (1)
CURLOPT_MUTE* = - (2)
CURLOPT_PASSWDDATA* = - (4)
CURLOPT_PASSWDFUNCTION* = - (3)
CURLOPT_PASV_HOST* = - (9)
CURLOPT_READDATA* = CURLOPT_INFILE
CURLOPT_SOURCE_HOST* = - (6)
CURLOPT_SOURCE_PATH* = - (7)
CURLOPT_SOURCE_PORT* = - (8)
CURLOPTTYPE_FUNCTIONPOINT* = 20000
CURLOPTTYPE_LONG* = 0
CURLOPTTYPE_OBJECTPOINT* = 10000
CURLOPTTYPE_OFF_T* = 30000
CURLOPT_WRITEDATA* = CURLOPT_FILE
CURL_POLL_IN* = 1
CURL_POLL_INOUT* = 3
CURL_POLL_NONE* = 0
CURL_POLL_OUT* = 2
CURL_POLL_REMOVE* = 4
CURL_READFUNC_ABORT* = 0x10000000
CURL_SOCKET_BAD* = - (1)
CURL_SOCKET_TIMEOUT* = CURL_SOCKET_BAD
CURL_VERSION_ASYNCHDNS* = 1 shl 7
CURL_VERSION_CONV* = 1 shl 12
CURL_VERSION_DEBUG* = 1 shl 6
CURL_VERSION_GSSNEGOTIATE* = 1 shl 5
CURL_VERSION_IDN* = 1 shl 10
CURL_VERSION_IPV6* = 1 shl 0
CURL_VERSION_KERBEROS4* = 1 shl 1
CURL_VERSION_LARGEFILE* = 1 shl 9
CURL_VERSION_LIBZ* = 1 shl 3
CURLVERSION_NOW* = CURLVERSION_THIRD
CURL_VERSION_NTLM* = 1 shl 4
CURL_VERSION_SPNEGO* = 1 shl 8
CURL_VERSION_SSL* = 1 shl 2
CURL_VERSION_SSPI* = 1 shl 11
FILE_OFFSET_BITS* = 0
FILESIZEBITS* = 0
FUNCTIONPOINT* = CURLOPTTYPE_FUNCTIONPOINT
HTTPPOST_BUFFER* = 1 shl 4
HTTPPOST_FILENAME* = 1 shl 0
HTTPPOST_PTRBUFFER* = 1 shl 5
HTTPPOST_PTRCONTENTS* = 1 shl 3
HTTPPOST_PTRNAME* = 1 shl 2
HTTPPOST_READFILE* = 1 shl 1
LIBCURL_VERSION* = "7.15.5"
LIBCURL_VERSION_MAJOR* = 7
LIBCURL_VERSION_MINOR* = 15
LIBCURL_VERSION_NUM* = 0x00070F05
LIBCURL_VERSION_PATCH* = 5
proc curl_strequal*(s1, s2: cstring): int32{.cdecl,
dynlib: libname, importc: "curl_strequal".}
proc curl_strnequal*(s1, s2: cstring, n: int): int32 {.cdecl,
dynlib: libname, importc: "curl_strnequal".}
proc curl_formadd*(httppost, last_post: PPcurl_httppost): TCURLFORMcode {.
cdecl, varargs, dynlib: libname, importc: "curl_formadd".}
proc curl_formget*(form: Pcurl_httppost, arg: pointer,
append: Tcurl_formget_callback): int32 {.cdecl,
dynlib: libname, importc: "curl_formget".}
proc curl_formfree*(form: Pcurl_httppost){.cdecl, dynlib: libname,
importc: "curl_formfree".}
proc curl_getenv*(variable: cstring): cstring{.cdecl, dynlib: libname,
importc: "curl_getenv".}
proc curl_version*(): cstring{.cdecl, dynlib: libname, importc: "curl_version".}
proc curl_easy_escape*(handle: PCURL, str: cstring, len: int32): cstring{.cdecl,
dynlib: libname, importc: "curl_easy_escape".}
proc curl_escape*(str: cstring, len: int32): cstring{.cdecl,
dynlib: libname, importc: "curl_escape".}
proc curl_easy_unescape*(handle: PCURL, str: cstring, len: int32,
outlength: var int32): cstring{.cdecl,
dynlib: libname, importc: "curl_easy_unescape".}
proc curl_unescape*(str: cstring, len: int32): cstring{.cdecl,
dynlib: libname, importc: "curl_unescape".}
proc curl_free*(p: pointer){.cdecl, dynlib: libname,
importc: "curl_free".}
proc curl_global_init*(flags: int32): TCURLcode {.cdecl, dynlib: libname,
importc: "curl_global_init".}
proc curl_global_init_mem*(flags: int32, m: Tcurl_malloc_callback,
f: Tcurl_free_callback, r: Tcurl_realloc_callback,
s: Tcurl_strdup_callback,
c: Tcurl_calloc_callback): TCURLcode {.
cdecl, dynlib: libname, importc: "curl_global_init_mem".}
proc curl_global_cleanup*() {.cdecl, dynlib: libname,
importc: "curl_global_cleanup".}
proc curl_slist_append*(curl_slist: Pcurl_slist, P: cstring): Pcurl_slist {.
cdecl, dynlib: libname, importc: "curl_slist_append".}
proc curl_slist_free_all*(para1: Pcurl_slist) {.cdecl, dynlib: libname,
importc: "curl_slist_free_all".}
proc curl_getdate*(p: cstring, unused: ptr TTime): TTime {.cdecl,
dynlib: libname, importc: "curl_getdate".}
proc curl_share_init*(): PCURLSH{.cdecl, dynlib: libname,
importc: "curl_share_init".}
proc curl_share_setopt*(para1: PCURLSH, option: TCURLSHoption): TCURLSHcode {.
cdecl, varargs, dynlib: libname, importc: "curl_share_setopt".}
proc curl_share_cleanup*(para1: PCURLSH): TCURLSHcode {.cdecl,
dynlib: libname, importc: "curl_share_cleanup".}
proc curl_version_info*(para1: TCURLversion): Pcurl_version_info_data{.cdecl,
dynlib: libname, importc: "curl_version_info".}
proc curl_easy_strerror*(para1: TCURLcode): cstring {.cdecl,
dynlib: libname, importc: "curl_easy_strerror".}
proc curl_share_strerror*(para1: TCURLSHcode): cstring {.cdecl,
dynlib: libname, importc: "curl_share_strerror".}
proc curl_easy_init*(): PCURL {.cdecl, dynlib: libname,
importc: "curl_easy_init".}
proc curl_easy_setopt*(curl: PCURL, option: TCURLoption): TCURLcode {.cdecl,
varargs, dynlib: libname, importc: "curl_easy_setopt".}
proc curl_easy_perform*(curl: PCURL): TCURLcode {.cdecl, dynlib: libname,
importc: "curl_easy_perform".}
proc curl_easy_cleanup*(curl: PCURL) {.cdecl, dynlib: libname,
importc: "curl_easy_cleanup".}
proc curl_easy_getinfo*(curl: PCURL, info: TCURLINFO): TCURLcode {.
cdecl, varargs, dynlib: libname, importc: "curl_easy_getinfo".}
proc curl_easy_duphandle*(curl: PCURL): PCURL {.cdecl, dynlib: libname,
importc: "curl_easy_duphandle".}
proc curl_easy_reset*(curl: PCURL) {.cdecl, dynlib: libname,
importc: "curl_easy_reset".}
proc curl_multi_init*(): PCURLM {.cdecl, dynlib: libname,
importc: "curl_multi_init".}
proc curl_multi_add_handle*(multi_handle: PCURLM,
curl_handle: PCURL): TCURLMcode {.
cdecl, dynlib: libname, importc: "curl_multi_add_handle".}
proc curl_multi_remove_handle*(multi_handle: PCURLM,
curl_handle: PCURL): TCURLMcode {.
cdecl, dynlib: libname, importc: "curl_multi_remove_handle".}
proc curl_multi_fdset*(multi_handle: PCURLM, read_fd_set: Pfd_set,
write_fd_set: Pfd_set, exc_fd_set: Pfd_set,
max_fd: var int32): TCURLMcode {.cdecl,
dynlib: libname, importc: "curl_multi_fdset".}
proc curl_multi_perform*(multi_handle: PCURLM,
running_handles: var int32): TCURLMcode {.
cdecl, dynlib: libname, importc: "curl_multi_perform".}
proc curl_multi_cleanup*(multi_handle: PCURLM): TCURLMcode {.cdecl,
dynlib: libname, importc: "curl_multi_cleanup".}
proc curl_multi_info_read*(multi_handle: PCURLM,
msgs_in_queue: var int32): PCURLMsg {.
cdecl, dynlib: libname, importc: "curl_multi_info_read".}
proc curl_multi_strerror*(para1: TCURLMcode): cstring {.cdecl,
dynlib: libname, importc: "curl_multi_strerror".}
proc curl_multi_socket*(multi_handle: PCURLM, s: Tcurl_socket,
running_handles: var int32): TCURLMcode {.cdecl,
dynlib: libname, importc: "curl_multi_socket".}
proc curl_multi_socket_all*(multi_handle: PCURLM,
running_handles: var int32): TCURLMcode {.
cdecl, dynlib: libname, importc: "curl_multi_socket_all".}
proc curl_multi_timeout*(multi_handle: PCURLM, milliseconds: var int32): TCURLMcode{.
cdecl, dynlib: libname, importc: "curl_multi_timeout".}
proc curl_multi_setopt*(multi_handle: PCURLM, option: TCURLMoption): TCURLMcode{.
cdecl, varargs, dynlib: libname, importc: "curl_multi_setopt".}
proc curl_multi_assign*(multi_handle: PCURLM, sockfd: Tcurl_socket,
sockp: pointer): TCURLMcode {.cdecl,
dynlib: libname, importc: "curl_multi_assign".}

View File

@@ -1,224 +0,0 @@
#*****************************************************************************
# * *
# * File: lauxlib.pas *
# * Authors: TeCGraf (C headers + actual Lua libraries) *
# * Lavergne Thomas (original translation to Pascal) *
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
# * Description: Lua auxiliary library *
# * *
# *****************************************************************************
#
#** $Id: lauxlib.h,v 1.59 2003/03/18 12:25:32 roberto Exp $
#** Auxiliary functions for building Lua libraries
#** See Copyright Notice in lua.h
#
#
#** Translated to pascal by Lavergne Thomas
#** Notes :
#** - Pointers type was prefixed with 'P'
#** Bug reports :
#** - thomas.lavergne@laposte.net
#** In french or in english
#
import lua
proc lua_pushstring*(L: Plua_State, s: string)
# compatibilty macros
proc luaL_getn*(L: Plua_State, n: int): int
# calls lua_objlen
proc luaL_setn*(L: Plua_State, t, n: int)
# does nothing!
type
TLuaL_reg*{.final.} = object
name*: cstring
func*: lua_CFunction
PluaL_reg* = ptr TLuaL_reg
proc luaL_openlib*(L: Plua_State, libname: cstring, lr: PluaL_reg, nup: int){.
cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_register*(L: Plua_State, libname: cstring, lr: PluaL_reg){.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_getmetafield*(L: Plua_State, obj: int, e: cstring): int{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_callmeta*(L: Plua_State, obj: int, e: cstring): int{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_typerror*(L: Plua_State, narg: int, tname: cstring): int{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_argerror*(L: Plua_State, numarg: int, extramsg: cstring): int{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_checklstring*(L: Plua_State, numArg: int, len: Psize_t): cstring{.
cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_optlstring*(L: Plua_State, numArg: int, def: cstring, len: Psize_t): cstring{.
cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_checknumber*(L: Plua_State, numArg: int): lua_Number{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_optnumber*(L: Plua_State, nArg: int, def: lua_Number): lua_Number{.
cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_checkinteger*(L: Plua_State, numArg: int): lua_Integer{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_optinteger*(L: Plua_State, nArg: int, def: lua_Integer): lua_Integer{.
cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_checkstack*(L: Plua_State, sz: int, msg: cstring){.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_checktype*(L: Plua_State, narg, t: int){.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaL_checkany*(L: Plua_State, narg: int){.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaL_newmetatable*(L: Plua_State, tname: cstring): int{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_checkudata*(L: Plua_State, ud: int, tname: cstring): Pointer{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_where*(L: Plua_State, lvl: int){.cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_error*(L: Plua_State, fmt: cstring): int{.cdecl, varargs,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_checkoption*(L: Plua_State, narg: int, def: cstring, lst: cstringArray): int{.
cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_ref*(L: Plua_State, t: int): int{.cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_unref*(L: Plua_State, t, theref: int){.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaL_loadfile*(L: Plua_State, filename: cstring): int{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_loadbuffer*(L: Plua_State, buff: cstring, size: size_t, name: cstring): int{.
cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_loadstring*(L: Plua_State, s: cstring): int{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_newstate*(): Plua_State{.cdecl, dynlib: LUA_LIB_NAME, importc.}
proc lua_open*(): Plua_State
# compatibility; moved from unit lua to lauxlib because it needs luaL_newstate
#
#** ===============================================================
#** some useful macros
#** ===============================================================
#
proc luaL_argcheck*(L: Plua_State, cond: bool, numarg: int, extramsg: cstring)
proc luaL_checkstring*(L: Plua_State, n: int): cstring
proc luaL_optstring*(L: Plua_State, n: int, d: cstring): cstring
proc luaL_checkint*(L: Plua_State, n: int): int
proc luaL_checklong*(L: Plua_State, n: int): int32
proc luaL_optint*(L: Plua_State, n: int, d: float64): int
proc luaL_optlong*(L: Plua_State, n: int, d: float64): int32
proc luaL_typename*(L: Plua_State, i: int): cstring
proc lua_dofile*(L: Plua_State, filename: cstring): int
proc lua_dostring*(L: Plua_State, str: cstring): int
proc lua_Lgetmetatable*(L: Plua_State, tname: cstring)
# not translated:
# #define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
#
#** =======================================================
#** Generic Buffer manipulation
#** =======================================================
#
const # note: this is just arbitrary, as it related to the BUFSIZ defined in stdio.h ...
LUAL_BUFFERSIZE* = 4096
type
luaL_Buffer*{.final.} = object
p*: cstring # current position in buffer
lvl*: int # number of strings in the stack (level)
L*: Plua_State
buffer*: array[0..LUAL_BUFFERSIZE - 1, Char] # warning: see note above about LUAL_BUFFERSIZE
PluaL_Buffer* = ptr luaL_Buffer
proc luaL_addchar*(B: PluaL_Buffer, c: Char)
# warning: see note above about LUAL_BUFFERSIZE
# compatibility only (alias for luaL_addchar)
proc luaL_putchar*(B: PluaL_Buffer, c: Char)
# warning: see note above about LUAL_BUFFERSIZE
proc luaL_addsize*(B: PluaL_Buffer, n: int)
proc luaL_buffinit*(L: Plua_State, B: PluaL_Buffer){.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_prepbuffer*(B: PluaL_Buffer): cstring{.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaL_addlstring*(B: PluaL_Buffer, s: cstring, L: size_t){.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_addstring*(B: PluaL_Buffer, s: cstring){.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaL_addvalue*(B: PluaL_Buffer){.cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_pushresult*(B: PluaL_Buffer){.cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaL_gsub*(L: Plua_State, s, p, r: cstring): cstring{.cdecl,
dynlib: LUA_LIB_NAME, importc.}
proc luaL_findtable*(L: Plua_State, idx: int, fname: cstring, szhint: int): cstring{.
cdecl, dynlib: LUA_LIB_NAME, importc.}
# compatibility with ref system
# pre-defined references
const
LUA_NOREF* = - 2
LUA_REFNIL* = - 1
proc lua_unref*(L: Plua_State, theref: int)
proc lua_getref*(L: Plua_State, theref: int)
#
#** Compatibility macros and functions
#
# implementation
proc lua_pushstring(L: Plua_State, s: string) =
lua_pushlstring(L, cstring(s), len(s))
proc luaL_getn(L: Plua_State, n: int): int =
Result = lua_objlen(L, n)
proc luaL_setn(L: Plua_State, t, n: int) =
# does nothing as this operation is deprecated
nil
proc lua_open(): Plua_State =
Result = luaL_newstate()
proc luaL_typename(L: Plua_State, i: int): cstring =
Result = lua_typename(L, lua_type(L, i))
proc lua_dofile(L: Plua_State, filename: cstring): int =
Result = luaL_loadfile(L, filename)
if Result == 0: Result = lua_pcall(L, 0, LUA_MULTRET, 0)
proc lua_dostring(L: Plua_State, str: cstring): int =
Result = luaL_loadstring(L, str)
if Result == 0: Result = lua_pcall(L, 0, LUA_MULTRET, 0)
proc lua_Lgetmetatable(L: Plua_State, tname: cstring) =
lua_getfield(L, LUA_REGISTRYINDEX, tname)
proc luaL_argcheck(L: Plua_State, cond: bool, numarg: int, extramsg: cstring) =
if not cond:
discard luaL_argerror(L, numarg, extramsg)
proc luaL_checkstring(L: Plua_State, n: int): cstring =
Result = luaL_checklstring(L, n, nil)
proc luaL_optstring(L: Plua_State, n: int, d: cstring): cstring =
Result = luaL_optlstring(L, n, d, nil)
proc luaL_checkint(L: Plua_State, n: int): int =
Result = toInt(luaL_checknumber(L, n))
proc luaL_checklong(L: Plua_State, n: int): int32 =
Result = int32(ToInt(luaL_checknumber(L, n)))
proc luaL_optint(L: Plua_State, n: int, d: float64): int =
Result = int(ToInt(luaL_optnumber(L, n, d)))
proc luaL_optlong(L: Plua_State, n: int, d: float64): int32 =
Result = int32(ToInt(luaL_optnumber(L, n, d)))
proc luaL_addchar(B: PluaL_Buffer, c: Char) =
if cast[int](addr((B.p))) < (cast[int](addr((B.buffer[0]))) + LUAL_BUFFERSIZE):
discard luaL_prepbuffer(B)
B.p[1] = c
B.p = cast[cstring](cast[int](B.p) + 1)
proc luaL_putchar(B: PluaL_Buffer, c: Char) =
luaL_addchar(B, c)
proc luaL_addsize(B: PluaL_Buffer, n: int) =
B.p = cast[cstring](cast[int](B.p) + n)
proc lua_unref(L: Plua_State, theref: int) =
luaL_unref(L, LUA_REGISTRYINDEX, theref)
proc lua_getref(L: Plua_State, theref: int) =
lua_rawgeti(L, LUA_REGISTRYINDEX, theref)

View File

@@ -1,391 +0,0 @@
#*****************************************************************************
# * *
# * File: lua.pas *
# * Authors: TeCGraf (C headers + actual Lua libraries) *
# * Lavergne Thomas (original translation to Pascal) *
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
# * Description: Basic Lua library *
# * *
# *****************************************************************************
#
#** $Id: lua.h,v 1.175 2003/03/18 12:31:39 roberto Exp $
#** Lua - An Extensible Extension Language
#** TeCGraf: Computer Graphics Technology Group, PUC-Rio, Brazil
#** http://www.lua.org mailto:info@lua.org
#** See Copyright Notice at the end of this file
#
#
#** Updated to Lua 5.1.1 by Bram Kuijvenhoven (bram at kuijvenhoven dot net),
#** Hexis BV (http://www.hexis.nl), the Netherlands
#** Notes:
#** - Only tested with FPC (FreePascal Compiler)
#** - Using LuaBinaries styled DLL/SO names, which include version names
#** - LUA_YIELD was suffixed by '_' for avoiding name collision
#
#
#** Translated to pascal by Lavergne Thomas
#** Notes :
#** - Pointers type was prefixed with 'P'
#** - lua_upvalueindex constant was transformed to function
#** - Some compatibility function was isolated because with it you must have
#** lualib.
#** - LUA_VERSION was suffixed by '_' for avoiding name collision.
#** Bug reports :
#** - thomas.lavergne@laposte.net
#** In french or in english
#
when defined(MACOSX):
const
LUA_NAME* = "liblua(|5.2|5.1|5.0).dylib"
LUA_LIB_NAME* = "liblua(|5.2|5.1|5.0).dylib"
elif defined(UNIX):
const
LUA_NAME* = "liblua(|5.2|5.1|5.0).so(|.0)"
LUA_LIB_NAME* = "liblua(|5.2|5.1|5.0).so(|.0)"
else:
const
LUA_NAME* = "lua(|5.2|5.1|5.0).dll"
LUA_LIB_NAME* = "lua(|5.2|5.1|5.0).dll"
type
size_t* = int
Psize_t* = ptr size_t
const
LUA_VERSION* = "Lua 5.1"
LUA_RELEASE* = "Lua 5.1.1"
LUA_VERSION_NUM* = 501
LUA_COPYRIGHT* = "Copyright (C) 1994-2006 Lua.org, PUC-Rio"
LUA_AUTHORS* = "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
# option for multiple returns in `lua_pcall' and `lua_call'
LUA_MULTRET* = - 1 #
#** pseudo-indices
#
LUA_REGISTRYINDEX* = - 10000
LUA_ENVIRONINDEX* = - 10001
LUA_GLOBALSINDEX* = - 10002
proc lua_upvalueindex*(I: int): int
const # thread status; 0 is OK
constLUA_YIELD* = 1
LUA_ERRRUN* = 2
LUA_ERRSYNTAX* = 3
LUA_ERRMEM* = 4
LUA_ERRERR* = 5
type
Plua_State* = Pointer
lua_CFunction* = proc (L: Plua_State): int{.cdecl.}
#
#** functions that read/write blocks when loading/dumping Lua chunks
#
type
lua_Reader* = proc (L: Plua_State, ud: Pointer, sz: Psize_t): cstring{.cdecl.}
lua_Writer* = proc (L: Plua_State, p: Pointer, sz: size_t, ud: Pointer): int{.
cdecl.}
lua_Alloc* = proc (ud, theptr: Pointer, osize, nsize: size_t){.cdecl.}
const
LUA_TNONE* = - 1
LUA_TNIL* = 0
LUA_TBOOLEAN* = 1
LUA_TLIGHTUSERDATA* = 2
LUA_TNUMBER* = 3
LUA_TSTRING* = 4
LUA_TTABLE* = 5
LUA_TFUNCTION* = 6
LUA_TUSERDATA* = 7
LUA_TTHREAD* = 8 # minimum Lua stack available to a C function
LUA_MINSTACK* = 20
type # Type of Numbers in Lua
lua_Number* = float
lua_Integer* = int
proc lua_newstate*(f: lua_Alloc, ud: Pointer): Plua_State{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_close*(L: Plua_State){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_newthread*(L: Plua_State): Plua_State{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_atpanic*(L: Plua_State, panicf: lua_CFunction): lua_CFunction{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_gettop*(L: Plua_State): int{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_settop*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_pushvalue*(L: Plua_State, Idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_remove*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_insert*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_replace*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_checkstack*(L: Plua_State, sz: int): cint{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_xmove*(`from`, `to`: Plua_State, n: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_isnumber*(L: Plua_State, idx: int): cint{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_isstring*(L: Plua_State, idx: int): cint{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_iscfunction*(L: Plua_State, idx: int): cint{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_isuserdata*(L: Plua_State, idx: int): cint{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_type*(L: Plua_State, idx: int): int{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_typename*(L: Plua_State, tp: int): cstring{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_equal*(L: Plua_State, idx1, idx2: int): cint{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_rawequal*(L: Plua_State, idx1, idx2: int): cint{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_lessthan*(L: Plua_State, idx1, idx2: int): cint{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_tonumber*(L: Plua_State, idx: int): lua_Number{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_tointeger*(L: Plua_State, idx: int): lua_Integer{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_toboolean*(L: Plua_State, idx: int): cint{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_tolstring*(L: Plua_State, idx: int, length: Psize_t): cstring{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_objlen*(L: Plua_State, idx: int): size_t{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_tocfunction*(L: Plua_State, idx: int): lua_CFunction{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_touserdata*(L: Plua_State, idx: int): Pointer{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_tothread*(L: Plua_State, idx: int): Plua_State{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_topointer*(L: Plua_State, idx: int): Pointer{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_pushnil*(L: Plua_State){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_pushnumber*(L: Plua_State, n: lua_Number){.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_pushinteger*(L: Plua_State, n: lua_Integer){.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_pushlstring*(L: Plua_State, s: cstring, len: size_t){.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_pushstring*(L: Plua_State, s: cstring){.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_pushvfstring*(L: Plua_State, fmt: cstring, argp: Pointer): cstring{.
cdecl, dynlib: LUA_NAME, importc.}
proc lua_pushfstring*(L: Plua_State, fmt: cstring): cstring{.cdecl, varargs,
dynlib: LUA_NAME, importc.}
proc lua_pushcclosure*(L: Plua_State, fn: lua_CFunction, n: int){.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_pushboolean*(L: Plua_State, b: cint){.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_pushlightuserdata*(L: Plua_State, p: Pointer){.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_pushthread*(L: Plua_State){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_gettable*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_getfield*(L: Plua_state, idx: int, k: cstring){.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_rawget*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_rawgeti*(L: Plua_State, idx, n: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_createtable*(L: Plua_State, narr, nrec: int){.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_newuserdata*(L: Plua_State, sz: size_t): Pointer{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_getmetatable*(L: Plua_State, objindex: int): int{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_getfenv*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_settable*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_setfield*(L: Plua_State, idx: int, k: cstring){.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_rawset*(L: Plua_State, idx: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_rawseti*(L: Plua_State, idx, n: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_setmetatable*(L: Plua_State, objindex: int): int{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_setfenv*(L: Plua_State, idx: int): int{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_call*(L: Plua_State, nargs, nresults: int){.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_pcall*(L: Plua_State, nargs, nresults, errf: int): int{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_cpcall*(L: Plua_State, func: lua_CFunction, ud: Pointer): int{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_load*(L: Plua_State, reader: lua_Reader, dt: Pointer,
chunkname: cstring): int{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_dump*(L: Plua_State, writer: lua_Writer, data: Pointer): int{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_yield*(L: Plua_State, nresults: int): int{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_resume*(L: Plua_State, narg: int): int{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_status*(L: Plua_State): int{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_gc*(L: Plua_State, what, data: int): int{.cdecl, dynlib: LUA_NAME,
importc.}
proc lua_error*(L: Plua_State): int{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_next*(L: Plua_State, idx: int): int{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_concat*(L: Plua_State, n: int){.cdecl, dynlib: LUA_NAME, importc.}
proc lua_getallocf*(L: Plua_State, ud: ptr Pointer): lua_Alloc{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_setallocf*(L: Plua_State, f: lua_Alloc, ud: Pointer){.cdecl,
dynlib: LUA_NAME, importc.}
#
#** Garbage-collection functions and options
#
const
LUA_GCSTOP* = 0
LUA_GCRESTART* = 1
LUA_GCCOLLECT* = 2
LUA_GCCOUNT* = 3
LUA_GCCOUNTB* = 4
LUA_GCSTEP* = 5
LUA_GCSETPAUSE* = 6
LUA_GCSETSTEPMUL* = 7
#
#** ===============================================================
#** some useful macros
#** ===============================================================
#
proc lua_pop*(L: Plua_State, n: int)
proc lua_newtable*(L: Plua_state)
proc lua_register*(L: Plua_State, n: cstring, f: lua_CFunction)
proc lua_pushcfunction*(L: Plua_State, f: lua_CFunction)
proc lua_strlen*(L: Plua_state, i: int): size_t
proc lua_isfunction*(L: Plua_State, n: int): bool
proc lua_istable*(L: Plua_State, n: int): bool
proc lua_islightuserdata*(L: Plua_State, n: int): bool
proc lua_isnil*(L: Plua_State, n: int): bool
proc lua_isboolean*(L: Plua_State, n: int): bool
proc lua_isthread*(L: Plua_State, n: int): bool
proc lua_isnone*(L: Plua_State, n: int): bool
proc lua_isnoneornil*(L: Plua_State, n: int): bool
proc lua_pushliteral*(L: Plua_State, s: cstring)
proc lua_setglobal*(L: Plua_State, s: cstring)
proc lua_getglobal*(L: Plua_State, s: cstring)
proc lua_tostring*(L: Plua_State, i: int): cstring
#
#** compatibility macros and functions
#
proc lua_getregistry*(L: Plua_State)
proc lua_getgccount*(L: Plua_State): int
type
lua_Chunkreader* = lua_Reader
lua_Chunkwriter* = lua_Writer
#
#** ======================================================================
#** Debug API
#** ======================================================================
#
const
LUA_HOOKCALL* = 0
LUA_HOOKRET* = 1
LUA_HOOKLINE* = 2
LUA_HOOKCOUNT* = 3
LUA_HOOKTAILRET* = 4
const
LUA_MASKCALL* = 1 shl Ord(LUA_HOOKCALL)
LUA_MASKRET* = 1 shl Ord(LUA_HOOKRET)
LUA_MASKLINE* = 1 shl Ord(LUA_HOOKLINE)
LUA_MASKCOUNT* = 1 shl Ord(LUA_HOOKCOUNT)
const
LUA_IDSIZE* = 60
type
lua_Debug*{.final.} = object # activation record
event*: int
name*: cstring # (n)
namewhat*: cstring # (n) `global', `local', `field', `method'
what*: cstring # (S) `Lua', `C', `main', `tail'
source*: cstring # (S)
currentline*: int # (l)
nups*: int # (u) number of upvalues
linedefined*: int # (S)
lastlinedefined*: int # (S)
short_src*: array[0..LUA_IDSIZE - 1, Char] # (S)
# private part
i_ci*: int # active function
Plua_Debug* = ptr lua_Debug
lua_Hook* = proc (L: Plua_State, ar: Plua_Debug){.cdecl.}
#
#** ======================================================================
#** Debug API
#** ======================================================================
#
proc lua_getstack*(L: Plua_State, level: int, ar: Plua_Debug): int{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_getinfo*(L: Plua_State, what: cstring, ar: Plua_Debug): int{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_getlocal*(L: Plua_State, ar: Plua_Debug, n: int): cstring{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_setlocal*(L: Plua_State, ar: Plua_Debug, n: int): cstring{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_getupvalue*(L: Plua_State, funcindex: int, n: int): cstring{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_setupvalue*(L: Plua_State, funcindex: int, n: int): cstring{.cdecl,
dynlib: LUA_NAME, importc.}
proc lua_sethook*(L: Plua_State, func: lua_Hook, mask: int, count: int): int{.
cdecl, dynlib: LUA_NAME, importc.}
proc lua_gethook*(L: Plua_State): lua_Hook{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_gethookmask*(L: Plua_State): int{.cdecl, dynlib: LUA_NAME, importc.}
proc lua_gethookcount*(L: Plua_State): int{.cdecl, dynlib: LUA_NAME, importc.}
# implementation
proc lua_upvalueindex(I: int): int =
Result = LUA_GLOBALSINDEX - i
proc lua_pop(L: Plua_State, n: int) =
lua_settop(L, - n - 1)
proc lua_newtable(L: Plua_State) =
lua_createtable(L, 0, 0)
proc lua_register(L: Plua_State, n: cstring, f: lua_CFunction) =
lua_pushcfunction(L, f)
lua_setglobal(L, n)
proc lua_pushcfunction(L: Plua_State, f: lua_CFunction) =
lua_pushcclosure(L, f, 0)
proc lua_strlen(L: Plua_State, i: int): size_t =
Result = lua_objlen(L, i)
proc lua_isfunction(L: Plua_State, n: int): bool =
Result = lua_type(L, n) == LUA_TFUNCTION
proc lua_istable(L: Plua_State, n: int): bool =
Result = lua_type(L, n) == LUA_TTABLE
proc lua_islightuserdata(L: Plua_State, n: int): bool =
Result = lua_type(L, n) == LUA_TLIGHTUSERDATA
proc lua_isnil(L: Plua_State, n: int): bool =
Result = lua_type(L, n) == LUA_TNIL
proc lua_isboolean(L: Plua_State, n: int): bool =
Result = lua_type(L, n) == LUA_TBOOLEAN
proc lua_isthread(L: Plua_State, n: int): bool =
Result = lua_type(L, n) == LUA_TTHREAD
proc lua_isnone(L: Plua_State, n: int): bool =
Result = lua_type(L, n) == LUA_TNONE
proc lua_isnoneornil(L: Plua_State, n: int): bool =
Result = lua_type(L, n) <= 0
proc lua_pushliteral(L: Plua_State, s: cstring) =
lua_pushlstring(L, s, len(s))
proc lua_setglobal(L: Plua_State, s: cstring) =
lua_setfield(L, LUA_GLOBALSINDEX, s)
proc lua_getglobal(L: Plua_State, s: cstring) =
lua_getfield(L, LUA_GLOBALSINDEX, s)
proc lua_tostring(L: Plua_State, i: int): cstring =
Result = lua_tolstring(L, i, nil)
proc lua_getregistry(L: Plua_State) =
lua_pushvalue(L, LUA_REGISTRYINDEX)
proc lua_getgccount(L: Plua_State): int =
Result = lua_gc(L, LUA_GCCOUNT, 0)

View File

@@ -1,73 +0,0 @@
#*****************************************************************************
# * *
# * File: lualib.pas *
# * Authors: TeCGraf (C headers + actual Lua libraries) *
# * Lavergne Thomas (original translation to Pascal) *
# * Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal) *
# * Description: Standard Lua libraries *
# * *
# *****************************************************************************
#
#** $Id: lualib.h,v 1.28 2003/03/18 12:24:26 roberto Exp $
#** Lua standard libraries
#** See Copyright Notice in lua.h
#
#
#** Translated to pascal by Lavergne Thomas
#** Bug reports :
#** - thomas.lavergne@laposte.net
#** In french or in english
#
import lua
const
LUA_COLIBNAME* = "coroutine"
LUA_TABLIBNAME* = "table"
LUA_IOLIBNAME* = "io"
LUA_OSLIBNAME* = "os"
LUA_STRLINAME* = "string"
LUA_MATHLIBNAME* = "math"
LUA_DBLIBNAME* = "debug"
LUA_LOADLIBNAME* = "package"
proc luaopen_base*(L: Plua_State): cint{.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaopen_table*(L: Plua_State): cint{.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaopen_io*(L: Plua_State): cint{.cdecl, dynlib: LUA_LIB_NAME, importc.}
proc luaopen_string*(L: Plua_State): cint{.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaopen_math*(L: Plua_State): cint{.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaopen_debug*(L: Plua_State): cint{.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaopen_package*(L: Plua_State): cint{.cdecl, dynlib: LUA_LIB_NAME,
importc.}
proc luaL_openlibs*(L: Plua_State){.cdecl, dynlib: LUA_LIB_NAME, importc.}
# compatibility code
proc lua_baselibopen*(L: Plua_State): Bool
proc lua_tablibopen*(L: Plua_State): Bool
proc lua_iolibopen*(L: Plua_State): Bool
proc lua_strlibopen*(L: Plua_State): Bool
proc lua_mathlibopen*(L: Plua_State): Bool
proc lua_dblibopen*(L: Plua_State): Bool
# implementation
proc lua_baselibopen(L: Plua_State): Bool =
Result = luaopen_base(L) != 0'i32
proc lua_tablibopen(L: Plua_State): Bool =
Result = luaopen_table(L) != 0'i32
proc lua_iolibopen(L: Plua_State): Bool =
Result = luaopen_io(L) != 0'i32
proc lua_strlibopen(L: Plua_State): Bool =
Result = luaopen_string(L) != 0'i32
proc lua_mathlibopen(L: Plua_State): Bool =
Result = luaopen_math(L) != 0'i32
proc lua_dblibopen(L: Plua_State): Bool =
Result = luaopen_debug(L) != 0'i32

File diff suppressed because it is too large Load Diff

View File

@@ -1,788 +0,0 @@
{.deadCodeElim: on.}
when not defined(ODBCVER):
const
ODBCVER = 0x0351 ## define ODBC version 3.51 by default
when defined(windows):
{.push callconv: stdcall.}
const odbclib = "odbc32.dll"
else:
{.push callconv: cdecl.}
const odbclib = "libodbc.so"
# DATA TYPES CORRESPONDENCE
# BDE fields ODBC types
# ---------- ------------------
# ftBlob SQL_BINARY
# ftBoolean SQL_BIT
# ftDate SQL_TYPE_DATE
# ftTime SQL_TYPE_TIME
# ftDateTime SQL_TYPE_TIMESTAMP
# ftInteger SQL_INTEGER
# ftSmallint SQL_SMALLINT
# ftFloat SQL_DOUBLE
# ftString SQL_CHAR
# ftMemo SQL_BINARY // SQL_VARCHAR
#
type
TSqlChar* = char
TSqlSmallInt* = int16
TSqlUSmallInt* = int16
TSqlHandle* = pointer
TSqlHEnv* = TSqlHandle
TSqlHDBC* = TSqlHandle
TSqlHStmt* = TSqlHandle
TSqlHDesc* = TSqlHandle
TSqlInteger* = int
TSqlUInteger* = int
TSqlPointer* = pointer
TSqlReal* = cfloat
TSqlDouble* = cdouble
TSqlFloat* = cdouble
TSqlHWND* = pointer
PSQLCHAR* = cstring
PSQLINTEGER* = ptr TSqlInteger
PSQLUINTEGER* = ptr TSqlUInteger
PSQLSMALLINT* = ptr TSqlSmallInt
PSQLUSMALLINT* = ptr TSqlUSmallInt
PSQLREAL* = ptr TSqlReal
PSQLDOUBLE* = ptr TSqlDouble
PSQLFLOAT* = ptr TSqlFloat
PSQLHANDLE* = ptr TSqlHandle
const # SQL data type codes
SQL_UNKNOWN_TYPE* = 0
SQL_LONGVARCHAR* = (- 1)
SQL_BINARY* = (- 2)
SQL_VARBINARY* = (- 3)
SQL_LONGVARBINARY* = (- 4)
SQL_BIGINT* = (- 5)
SQL_TINYINT* = (- 6)
SQL_BIT* = (- 7)
SQL_WCHAR* = (- 8)
SQL_WVARCHAR* = (- 9)
SQL_WLONGVARCHAR* = (- 10)
SQL_CHAR* = 1
SQL_NUMERIC* = 2
SQL_DECIMAL* = 3
SQL_INTEGER* = 4
SQL_SMALLINT* = 5
SQL_FLOAT* = 6
SQL_REAL* = 7
SQL_DOUBLE* = 8
SQL_DATETIME* = 9
SQL_VARCHAR* = 12
SQL_TYPE_DATE* = 91
SQL_TYPE_TIME* = 92
SQL_TYPE_TIMESTAMP* = 93
SQL_DATE* = 9
SQL_TIME* = 10
SQL_TIMESTAMP* = 11
SQL_INTERVAL* = 10
SQL_GUID* = - 11 # interval codes
when ODBCVER >= 0x0300:
const
SQL_CODE_YEAR* = 1
SQL_CODE_MONTH* = 2
SQL_CODE_DAY* = 3
SQL_CODE_HOUR* = 4
SQL_CODE_MINUTE* = 5
SQL_CODE_SECOND* = 6
SQL_CODE_YEAR_TO_MONTH* = 7
SQL_CODE_DAY_TO_HOUR* = 8
SQL_CODE_DAY_TO_MINUTE* = 9
SQL_CODE_DAY_TO_SECOND* = 10
SQL_CODE_HOUR_TO_MINUTE* = 11
SQL_CODE_HOUR_TO_SECOND* = 12
SQL_CODE_MINUTE_TO_SECOND* = 13
SQL_INTERVAL_YEAR* = 100 + SQL_CODE_YEAR
SQL_INTERVAL_MONTH* = 100 + SQL_CODE_MONTH
SQL_INTERVAL_DAY* = 100 + SQL_CODE_DAY
SQL_INTERVAL_HOUR* = 100 + SQL_CODE_HOUR
SQL_INTERVAL_MINUTE* = 100 + SQL_CODE_MINUTE
SQL_INTERVAL_SECOND* = 100 + SQL_CODE_SECOND
SQL_INTERVAL_YEAR_TO_MONTH* = 100 + SQL_CODE_YEAR_TO_MONTH
SQL_INTERVAL_DAY_TO_HOUR* = 100 + SQL_CODE_DAY_TO_HOUR
SQL_INTERVAL_DAY_TO_MINUTE* = 100 + SQL_CODE_DAY_TO_MINUTE
SQL_INTERVAL_DAY_TO_SECOND* = 100 + SQL_CODE_DAY_TO_SECOND
SQL_INTERVAL_HOUR_TO_MINUTE* = 100 + SQL_CODE_HOUR_TO_MINUTE
SQL_INTERVAL_HOUR_TO_SECOND* = 100 + SQL_CODE_HOUR_TO_SECOND
SQL_INTERVAL_MINUTE_TO_SECOND* = 100 + SQL_CODE_MINUTE_TO_SECOND
else:
const
SQL_INTERVAL_YEAR* = - 80
SQL_INTERVAL_MONTH* = - 81
SQL_INTERVAL_YEAR_TO_MONTH* = - 82
SQL_INTERVAL_DAY* = - 83
SQL_INTERVAL_HOUR* = - 84
SQL_INTERVAL_MINUTE* = - 85
SQL_INTERVAL_SECOND* = - 86
SQL_INTERVAL_DAY_TO_HOUR* = - 87
SQL_INTERVAL_DAY_TO_MINUTE* = - 88
SQL_INTERVAL_DAY_TO_SECOND* = - 89
SQL_INTERVAL_HOUR_TO_MINUTE* = - 90
SQL_INTERVAL_HOUR_TO_SECOND* = - 91
SQL_INTERVAL_MINUTE_TO_SECOND* = - 92
when ODBCVER < 0x0300:
const
SQL_UNICODE* = - 95
SQL_UNICODE_VARCHAR* = - 96
SQL_UNICODE_LONGVARCHAR* = - 97
SQL_UNICODE_CHAR* = SQL_UNICODE
else:
# The previous definitions for SQL_UNICODE_ are historical and obsolete
const
SQL_UNICODE* = SQL_WCHAR
SQL_UNICODE_VARCHAR* = SQL_WVARCHAR
SQL_UNICODE_LONGVARCHAR* = SQL_WLONGVARCHAR
SQL_UNICODE_CHAR* = SQL_WCHAR
const # C datatype to SQL datatype mapping
SQL_C_CHAR* = SQL_CHAR
SQL_C_LONG* = SQL_INTEGER
SQL_C_SHORT* = SQL_SMALLINT
SQL_C_FLOAT* = SQL_REAL
SQL_C_DOUBLE* = SQL_DOUBLE
SQL_C_NUMERIC* = SQL_NUMERIC
SQL_C_DEFAULT* = 99
SQL_SIGNED_OFFSET* = - 20
SQL_UNSIGNED_OFFSET* = - 22
SQL_C_DATE* = SQL_DATE
SQL_C_TIME* = SQL_TIME
SQL_C_TIMESTAMP* = SQL_TIMESTAMP
SQL_C_TYPE_DATE* = SQL_TYPE_DATE
SQL_C_TYPE_TIME* = SQL_TYPE_TIME
SQL_C_TYPE_TIMESTAMP* = SQL_TYPE_TIMESTAMP
SQL_C_INTERVAL_YEAR* = SQL_INTERVAL_YEAR
SQL_C_INTERVAL_MONTH* = SQL_INTERVAL_MONTH
SQL_C_INTERVAL_DAY* = SQL_INTERVAL_DAY
SQL_C_INTERVAL_HOUR* = SQL_INTERVAL_HOUR
SQL_C_INTERVAL_MINUTE* = SQL_INTERVAL_MINUTE
SQL_C_INTERVAL_SECOND* = SQL_INTERVAL_SECOND
SQL_C_INTERVAL_YEAR_TO_MONTH* = SQL_INTERVAL_YEAR_TO_MONTH
SQL_C_INTERVAL_DAY_TO_HOUR* = SQL_INTERVAL_DAY_TO_HOUR
SQL_C_INTERVAL_DAY_TO_MINUTE* = SQL_INTERVAL_DAY_TO_MINUTE
SQL_C_INTERVAL_DAY_TO_SECOND* = SQL_INTERVAL_DAY_TO_SECOND
SQL_C_INTERVAL_HOUR_TO_MINUTE* = SQL_INTERVAL_HOUR_TO_MINUTE
SQL_C_INTERVAL_HOUR_TO_SECOND* = SQL_INTERVAL_HOUR_TO_SECOND
SQL_C_INTERVAL_MINUTE_TO_SECOND* = SQL_INTERVAL_MINUTE_TO_SECOND
SQL_C_BINARY* = SQL_BINARY
SQL_C_BIT* = SQL_BIT
SQL_C_SBIGINT* = SQL_BIGINT + SQL_SIGNED_OFFSET # SIGNED BIGINT
SQL_C_UBIGINT* = SQL_BIGINT + SQL_UNSIGNED_OFFSET # UNSIGNED BIGINT
SQL_C_TINYINT* = SQL_TINYINT
SQL_C_SLONG* = SQL_C_LONG + SQL_SIGNED_OFFSET # SIGNED INTEGER
SQL_C_SSHORT* = SQL_C_SHORT + SQL_SIGNED_OFFSET # SIGNED SMALLINT
SQL_C_STINYINT* = SQL_TINYINT + SQL_SIGNED_OFFSET # SIGNED TINYINT
SQL_C_ULONG* = SQL_C_LONG + SQL_UNSIGNED_OFFSET # UNSIGNED INTEGER
SQL_C_USHORT* = SQL_C_SHORT + SQL_UNSIGNED_OFFSET # UNSIGNED SMALLINT
SQL_C_UTINYINT* = SQL_TINYINT + SQL_UNSIGNED_OFFSET # UNSIGNED TINYINT
SQL_C_BOOKMARK* = SQL_C_ULONG # BOOKMARK
SQL_C_GUID* = SQL_GUID
SQL_TYPE_NULL* = 0
when ODBCVER < 0x0300:
const
SQL_TYPE_MIN* = SQL_BIT
SQL_TYPE_MAX* = SQL_VARCHAR
const
SQL_C_VARBOOKMARK* = SQL_C_BINARY
SQL_API_SQLDESCRIBEPARAM* = 58
SQL_NO_TOTAL* = - 4
type
SQL_DATE_STRUCT* {.final, pure.} = object
Year*: TSqlSmallInt
Month*: TSqlUSmallInt
Day*: TSqlUSmallInt
PSQL_DATE_STRUCT* = ptr SQL_DATE_STRUCT
SQL_TIME_STRUCT* {.final, pure.} = object
Hour*: TSqlUSmallInt
Minute*: TSqlUSmallInt
Second*: TSqlUSmallInt
PSQL_TIME_STRUCT* = ptr SQL_TIME_STRUCT
SQL_TIMESTAMP_STRUCT* {.final, pure.} = object
Year*: TSqlUSmallInt
Month*: TSqlUSmallInt
Day*: TSqlUSmallInt
Hour*: TSqlUSmallInt
Minute*: TSqlUSmallInt
Second*: TSqlUSmallInt
Fraction*: TSqlUInteger
PSQL_TIMESTAMP_STRUCT* = ptr SQL_TIMESTAMP_STRUCT
const
SQL_NAME_LEN* = 128
SQL_OV_ODBC3* = 3
SQL_OV_ODBC2* = 2
SQL_ATTR_ODBC_VERSION* = 200 # Options for SQLDriverConnect
SQL_DRIVER_NOPROMPT* = 0
SQL_DRIVER_COMPLETE* = 1
SQL_DRIVER_PROMPT* = 2
SQL_DRIVER_COMPLETE_REQUIRED* = 3
SQL_IS_POINTER* = (- 4) # whether an attribute is a pointer or not
SQL_IS_UINTEGER* = (- 5)
SQL_IS_INTEGER* = (- 6)
SQL_IS_USMALLINT* = (- 7)
SQL_IS_SMALLINT* = (- 8) # SQLExtendedFetch "fFetchType" values
SQL_FETCH_BOOKMARK* = 8
SQL_SCROLL_OPTIONS* = 44 # SQL_USE_BOOKMARKS options
SQL_UB_OFF* = 0
SQL_UB_ON* = 1
SQL_UB_DEFAULT* = SQL_UB_OFF
SQL_UB_FIXED* = SQL_UB_ON
SQL_UB_VARIABLE* = 2 # SQL_SCROLL_OPTIONS masks
SQL_SO_FORWARD_ONLY* = 0x00000001
SQL_SO_KEYSET_DRIVEN* = 0x00000002
SQL_SO_DYNAMIC* = 0x00000004
SQL_SO_MIXED* = 0x00000008
SQL_SO_STATIC* = 0x00000010
SQL_BOOKMARK_PERSISTENCE* = 82
SQL_STATIC_SENSITIVITY* = 83 # SQL_BOOKMARK_PERSISTENCE values
SQL_BP_CLOSE* = 0x00000001
SQL_BP_DELETE* = 0x00000002
SQL_BP_DROP* = 0x00000004
SQL_BP_TRANSACTION* = 0x00000008
SQL_BP_UPDATE* = 0x00000010
SQL_BP_OTHER_HSTMT* = 0x00000020
SQL_BP_SCROLL* = 0x00000040
SQL_DYNAMIC_CURSOR_ATTRIBUTES1* = 144
SQL_DYNAMIC_CURSOR_ATTRIBUTES2* = 145
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1* = 146
SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2* = 147
SQL_INDEX_KEYWORDS* = 148
SQL_INFO_SCHEMA_VIEWS* = 149
SQL_KEYSET_CURSOR_ATTRIBUTES1* = 150
SQL_KEYSET_CURSOR_ATTRIBUTES2* = 151
SQL_STATIC_CURSOR_ATTRIBUTES1* = 167
SQL_STATIC_CURSOR_ATTRIBUTES2* = 168 # supported SQLFetchScroll FetchOrientation's
SQL_CA1_NEXT* = 1
SQL_CA1_ABSOLUTE* = 2
SQL_CA1_RELATIVE* = 4
SQL_CA1_BOOKMARK* = 8 # supported SQLSetPos LockType's
SQL_CA1_LOCK_NO_CHANGE* = 0x00000040
SQL_CA1_LOCK_EXCLUSIVE* = 0x00000080
SQL_CA1_LOCK_UNLOCK* = 0x00000100 # supported SQLSetPos Operations
SQL_CA1_POS_POSITION* = 0x00000200
SQL_CA1_POS_UPDATE* = 0x00000400
SQL_CA1_POS_DELETE* = 0x00000800
SQL_CA1_POS_REFRESH* = 0x00001000 # positioned updates and deletes
SQL_CA1_POSITIONED_UPDATE* = 0x00002000
SQL_CA1_POSITIONED_DELETE* = 0x00004000
SQL_CA1_SELECT_FOR_UPDATE* = 0x00008000 # supported SQLBulkOperations operations
SQL_CA1_BULK_ADD* = 0x00010000
SQL_CA1_BULK_UPDATE_BY_BOOKMARK* = 0x00020000
SQL_CA1_BULK_DELETE_BY_BOOKMARK* = 0x00040000
SQL_CA1_BULK_FETCH_BY_BOOKMARK* = 0x00080000 # supported values for SQL_ATTR_SCROLL_CONCURRENCY
SQL_CA2_READ_ONLY_CONCURRENCY* = 1
SQL_CA2_LOCK_CONCURRENCY* = 2
SQL_CA2_OPT_ROWVER_CONCURRENCY* = 4
SQL_CA2_OPT_VALUES_CONCURRENCY* = 8 # sensitivity of the cursor to its own inserts, deletes, and updates
SQL_CA2_SENSITIVITY_ADDITIONS* = 0x00000010
SQL_CA2_SENSITIVITY_DELETIONS* = 0x00000020
SQL_CA2_SENSITIVITY_UPDATES* = 0x00000040 # semantics of SQL_ATTR_MAX_ROWS
SQL_CA2_MAX_ROWS_SELECT* = 0x00000080
SQL_CA2_MAX_ROWS_INSERT* = 0x00000100
SQL_CA2_MAX_ROWS_DELETE* = 0x00000200
SQL_CA2_MAX_ROWS_UPDATE* = 0x00000400
SQL_CA2_MAX_ROWS_CATALOG* = 0x00000800
SQL_CA2_MAX_ROWS_AFFECTS_ALL* = (SQL_CA2_MAX_ROWS_SELECT or
SQL_CA2_MAX_ROWS_INSERT or SQL_CA2_MAX_ROWS_DELETE or
SQL_CA2_MAX_ROWS_UPDATE or SQL_CA2_MAX_ROWS_CATALOG) # semantics of
# SQL_DIAG_CURSOR_ROW_COUNT
SQL_CA2_CRC_EXACT* = 0x00001000
SQL_CA2_CRC_APPROXIMATE* = 0x00002000 # the kinds of positioned statements that can be simulated
SQL_CA2_SIMULATE_NON_UNIQUE* = 0x00004000
SQL_CA2_SIMULATE_TRY_UNIQUE* = 0x00008000
SQL_CA2_SIMULATE_UNIQUE* = 0x00010000 # Operations in SQLBulkOperations
SQL_ADD* = 4
SQL_SETPOS_MAX_OPTION_VALUE* = SQL_ADD
SQL_UPDATE_BY_BOOKMARK* = 5
SQL_DELETE_BY_BOOKMARK* = 6
SQL_FETCH_BY_BOOKMARK* = 7 # Operations in SQLSetPos
SQL_POSITION* = 0
SQL_REFRESH* = 1
SQL_UPDATE* = 2
SQL_DELETE* = 3 # Lock options in SQLSetPos
SQL_LOCK_NO_CHANGE* = 0
SQL_LOCK_EXCLUSIVE* = 1
SQL_LOCK_UNLOCK* = 2 # SQLExtendedFetch "rgfRowStatus" element values
SQL_ROW_SUCCESS* = 0
SQL_ROW_DELETED* = 1
SQL_ROW_UPDATED* = 2
SQL_ROW_NOROW* = 3
SQL_ROW_ADDED* = 4
SQL_ROW_ERROR* = 5
SQL_ROW_SUCCESS_WITH_INFO* = 6
SQL_ROW_PROCEED* = 0
SQL_ROW_IGNORE* = 1
SQL_MAX_DSN_LENGTH* = 32 # maximum data source name size
SQL_MAX_OPTION_STRING_LENGTH* = 256
SQL_ODBC_CURSORS* = 110
SQL_ATTR_ODBC_CURSORS* = SQL_ODBC_CURSORS # SQL_ODBC_CURSORS options
SQL_CUR_USE_IF_NEEDED* = 0
SQL_CUR_USE_ODBC* = 1
SQL_CUR_USE_DRIVER* = 2
SQL_CUR_DEFAULT* = SQL_CUR_USE_DRIVER
SQL_PARAM_TYPE_UNKNOWN* = 0
SQL_PARAM_INPUT* = 1
SQL_PARAM_INPUT_OUTPUT* = 2
SQL_RESULT_COL* = 3
SQL_PARAM_OUTPUT* = 4
SQL_RETURN_VALUE* = 5 # special length/indicator values
SQL_NULL_DATA* = (- 1)
SQL_DATA_AT_EXEC* = (- 2)
SQL_SUCCESS* = 0
SQL_SUCCESS_WITH_INFO* = 1
SQL_NO_DATA* = 100
SQL_ERROR* = (- 1)
SQL_INVALID_HANDLE* = (- 2)
SQL_STILL_EXECUTING* = 2
SQL_NEED_DATA* = 99 # flags for null-terminated string
SQL_NTS* = (- 3) # maximum message length
SQL_MAX_MESSAGE_LENGTH* = 512 # date/time length constants
SQL_DATE_LEN* = 10
SQL_TIME_LEN* = 8 # add P+1 if precision is nonzero
SQL_TIMESTAMP_LEN* = 19 # add P+1 if precision is nonzero
# handle type identifiers
SQL_HANDLE_ENV* = 1
SQL_HANDLE_DBC* = 2
SQL_HANDLE_STMT* = 3
SQL_HANDLE_DESC* = 4 # environment attribute
SQL_ATTR_OUTPUT_NTS* = 10001 # connection attributes
SQL_ATTR_AUTO_IPD* = 10001
SQL_ATTR_METADATA_ID* = 10014 # statement attributes
SQL_ATTR_APP_ROW_DESC* = 10010
SQL_ATTR_APP_PARAM_DESC* = 10011
SQL_ATTR_IMP_ROW_DESC* = 10012
SQL_ATTR_IMP_PARAM_DESC* = 10013
SQL_ATTR_CURSOR_SCROLLABLE* = (- 1)
SQL_ATTR_CURSOR_SENSITIVITY* = (- 2)
SQL_QUERY_TIMEOUT* = 0
SQL_MAX_ROWS* = 1
SQL_NOSCAN* = 2
SQL_MAX_LENGTH* = 3
SQL_ASYNC_ENABLE* = 4 # same as SQL_ATTR_ASYNC_ENABLE */
SQL_BIND_TYPE* = 5
SQL_CURSOR_TYPE* = 6
SQL_CONCURRENCY* = 7
SQL_KEYSET_SIZE* = 8
SQL_ROWSET_SIZE* = 9
SQL_SIMULATE_CURSOR* = 10
SQL_RETRIEVE_DATA* = 11
SQL_USE_BOOKMARKS* = 12
SQL_GET_BOOKMARK* = 13 # GetStmtOption Only */
SQL_ROW_NUMBER* = 14 # GetStmtOption Only */
SQL_ATTR_CURSOR_TYPE* = SQL_CURSOR_TYPE
SQL_ATTR_CONCURRENCY* = SQL_CONCURRENCY
SQL_ATTR_FETCH_BOOKMARK_PTR* = 16
SQL_ATTR_ROW_STATUS_PTR* = 25
SQL_ATTR_ROWS_FETCHED_PTR* = 26
SQL_AUTOCOMMIT* = 102
SQL_ATTR_AUTOCOMMIT* = SQL_AUTOCOMMIT
SQL_ATTR_ROW_NUMBER* = SQL_ROW_NUMBER
SQL_TXN_ISOLATION* = 108
SQL_ATTR_TXN_ISOLATION* = SQL_TXN_ISOLATION
SQL_ATTR_MAX_ROWS* = SQL_MAX_ROWS
SQL_ATTR_USE_BOOKMARKS* = SQL_USE_BOOKMARKS #* connection attributes */
SQL_ACCESS_MODE* = 101 # SQL_AUTOCOMMIT =102;
SQL_LOGIN_TIMEOUT* = 103
SQL_OPT_TRACE* = 104
SQL_OPT_TRACEFILE* = 105
SQL_TRANSLATE_DLL* = 106
SQL_TRANSLATE_OPTION* = 107 # SQL_TXN_ISOLATION =108;
SQL_CURRENT_QUALIFIER* = 109 # SQL_ODBC_CURSORS =110;
SQL_QUIET_MODE* = 111
SQL_PACKET_SIZE* = 112 #* connection attributes with new names */
SQL_ATTR_ACCESS_MODE* = SQL_ACCESS_MODE # SQL_ATTR_AUTOCOMMIT =SQL_AUTOCOMMIT;
SQL_ATTR_CONNECTION_DEAD* = 1209 #* GetConnectAttr only */
SQL_ATTR_CONNECTION_TIMEOUT* = 113
SQL_ATTR_CURRENT_CATALOG* = SQL_CURRENT_QUALIFIER
SQL_ATTR_DISCONNECT_BEHAVIOR* = 114
SQL_ATTR_ENLIST_IN_DTC* = 1207
SQL_ATTR_ENLIST_IN_XA* = 1208
SQL_ATTR_LOGIN_TIMEOUT* = SQL_LOGIN_TIMEOUT # SQL_ATTR_ODBC_CURSORS =SQL_ODBC_CURSORS;
SQL_ATTR_PACKET_SIZE* = SQL_PACKET_SIZE
SQL_ATTR_QUIET_MODE* = SQL_QUIET_MODE
SQL_ATTR_TRACE* = SQL_OPT_TRACE
SQL_ATTR_TRACEFILE* = SQL_OPT_TRACEFILE
SQL_ATTR_TRANSLATE_LIB* = SQL_TRANSLATE_DLL
SQL_ATTR_TRANSLATE_OPTION* = SQL_TRANSLATE_OPTION # SQL_ATTR_TXN_ISOLATION =SQL_TXN_ISOLATION;
#* SQL_ACCESS_MODE options */
SQL_MODE_READ_WRITE* = 0
SQL_MODE_READ_ONLY* = 1
SQL_MODE_DEFAULT* = SQL_MODE_READ_WRITE #* SQL_AUTOCOMMIT options */
SQL_AUTOCOMMIT_OFF* = 0
SQL_AUTOCOMMIT_ON* = 1
SQL_AUTOCOMMIT_DEFAULT* = SQL_AUTOCOMMIT_ON # SQL_ATTR_CURSOR_SCROLLABLE values
SQL_NONSCROLLABLE* = 0
SQL_SCROLLABLE* = 1 # SQL_CURSOR_TYPE options
SQL_CURSOR_FORWARD_ONLY* = 0
SQL_CURSOR_KEYSET_DRIVEN* = 1
SQL_CURSOR_DYNAMIC* = 2
SQL_CURSOR_STATIC* = 3
SQL_CURSOR_TYPE_DEFAULT* = SQL_CURSOR_FORWARD_ONLY # Default value
# SQL_CONCURRENCY options
SQL_CONCUR_READ_ONLY* = 1
SQL_CONCUR_LOCK* = 2
SQL_CONCUR_ROWVER* = 3
SQL_CONCUR_VALUES* = 4
SQL_CONCUR_DEFAULT* = SQL_CONCUR_READ_ONLY # Default value
# identifiers of fields in the SQL descriptor
SQL_DESC_COUNT* = 1001
SQL_DESC_TYPE* = 1002
SQL_DESC_LENGTH* = 1003
SQL_DESC_OCTET_LENGTH_PTR* = 1004
SQL_DESC_PRECISION* = 1005
SQL_DESC_SCALE* = 1006
SQL_DESC_DATETIME_INTERVAL_CODE* = 1007
SQL_DESC_NULLABLE* = 1008
SQL_DESC_INDICATOR_PTR* = 1009
SQL_DESC_DATA_PTR* = 1010
SQL_DESC_NAME* = 1011
SQL_DESC_UNNAMED* = 1012
SQL_DESC_OCTET_LENGTH* = 1013
SQL_DESC_ALLOC_TYPE* = 1099 # identifiers of fields in the diagnostics area
SQL_DIAG_RETURNCODE* = 1
SQL_DIAG_NUMBER* = 2
SQL_DIAG_ROW_COUNT* = 3
SQL_DIAG_SQLSTATE* = 4
SQL_DIAG_NATIVE* = 5
SQL_DIAG_MESSAGE_TEXT* = 6
SQL_DIAG_DYNAMIC_FUNCTION* = 7
SQL_DIAG_CLASS_ORIGIN* = 8
SQL_DIAG_SUBCLASS_ORIGIN* = 9
SQL_DIAG_CONNECTION_NAME* = 10
SQL_DIAG_SERVER_NAME* = 11
SQL_DIAG_DYNAMIC_FUNCTION_CODE* = 12 # dynamic function codes
SQL_DIAG_ALTER_TABLE* = 4
SQL_DIAG_CREATE_INDEX* = (- 1)
SQL_DIAG_CREATE_TABLE* = 77
SQL_DIAG_CREATE_VIEW* = 84
SQL_DIAG_DELETE_WHERE* = 19
SQL_DIAG_DROP_INDEX* = (- 2)
SQL_DIAG_DROP_TABLE* = 32
SQL_DIAG_DROP_VIEW* = 36
SQL_DIAG_DYNAMIC_DELETE_CURSOR* = 38
SQL_DIAG_DYNAMIC_UPDATE_CURSOR* = 81
SQL_DIAG_GRANT* = 48
SQL_DIAG_INSERT* = 50
SQL_DIAG_REVOKE* = 59
SQL_DIAG_SELECT_CURSOR* = 85
SQL_DIAG_UNKNOWN_STATEMENT* = 0
SQL_DIAG_UPDATE_WHERE* = 82 # Statement attribute values for cursor sensitivity
SQL_UNSPECIFIED* = 0
SQL_INSENSITIVE* = 1
SQL_SENSITIVE* = 2 # GetTypeInfo() request for all data types
SQL_ALL_TYPES* = 0 # Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData()
SQL_DEFAULT* = 99 # SQLGetData() code indicating that the application row descriptor
# specifies the data type
SQL_ARD_TYPE* = (- 99) # SQL date/time type subcodes
SQL_CODE_DATE* = 1
SQL_CODE_TIME* = 2
SQL_CODE_TIMESTAMP* = 3 # CLI option values
SQL_FALSE* = 0
SQL_TRUE* = 1 # values of NULLABLE field in descriptor
SQL_NO_NULLS* = 0
SQL_NULLABLE* = 1 # Value returned by SQLGetTypeInfo() to denote that it is
# not known whether or not a data type supports null values.
SQL_NULLABLE_UNKNOWN* = 2
SQL_CLOSE* = 0
SQL_DROP* = 1
SQL_UNBIND* = 2
SQL_RESET_PARAMS* = 3 # Codes used for FetchOrientation in SQLFetchScroll(),
# and in SQLDataSources()
SQL_FETCH_NEXT* = 1
SQL_FETCH_FIRST* = 2
SQL_FETCH_FIRST_USER* = 31
SQL_FETCH_FIRST_SYSTEM* = 32 # Other codes used for FetchOrientation in SQLFetchScroll()
SQL_FETCH_LAST* = 3
SQL_FETCH_PRIOR* = 4
SQL_FETCH_ABSOLUTE* = 5
SQL_FETCH_RELATIVE* = 6
SQL_NULL_HENV* = TSqlHEnv(nil)
SQL_NULL_HDBC* = TSqlHDBC(nil)
SQL_NULL_HSTMT* = TSqlHStmt(nil)
SQL_NULL_HDESC* = TSqlHDesc(nil) #* null handle used in place of parent handle when allocating HENV */
SQL_NULL_HANDLE* = TSqlHandle(nil) #* Values that may appear in the result set of SQLSpecialColumns() */
SQL_SCOPE_CURROW* = 0
SQL_SCOPE_TRANSACTION* = 1
SQL_SCOPE_SESSION* = 2 #* Column types and scopes in SQLSpecialColumns. */
SQL_BEST_ROWID* = 1
SQL_ROWVER* = 2
SQL_ROW_IDENTIFIER* = 1 #* Reserved values for UNIQUE argument of SQLStatistics() */
SQL_INDEX_UNIQUE* = 0
SQL_INDEX_ALL* = 1 #* Reserved values for RESERVED argument of SQLStatistics() */
SQL_QUICK* = 0
SQL_ENSURE* = 1 #* Values that may appear in the result set of SQLStatistics() */
SQL_TABLE_STAT* = 0
SQL_INDEX_CLUSTERED* = 1
SQL_INDEX_HASHED* = 2
SQL_INDEX_OTHER* = 3
SQL_SCROLL_CONCURRENCY* = 43
SQL_TXN_CAPABLE* = 46
SQL_TRANSACTION_CAPABLE* = SQL_TXN_CAPABLE
SQL_USER_NAME* = 47
SQL_TXN_ISOLATION_OPTION* = 72
SQL_TRANSACTION_ISOLATION_OPTION* = SQL_TXN_ISOLATION_OPTION
SQL_OJ_CAPABILITIES* = 115
SQL_OUTER_JOIN_CAPABILITIES* = SQL_OJ_CAPABILITIES
SQL_XOPEN_CLI_YEAR* = 10000
SQL_CURSOR_SENSITIVITY* = 10001
SQL_DESCRIBE_PARAMETER* = 10002
SQL_CATALOG_NAME* = 10003
SQL_COLLATION_SEQ* = 10004
SQL_MAX_IDENTIFIER_LEN* = 10005
SQL_MAXIMUM_IDENTIFIER_LENGTH* = SQL_MAX_IDENTIFIER_LEN
SQL_SCCO_READ_ONLY* = 1
SQL_SCCO_LOCK* = 2
SQL_SCCO_OPT_ROWVER* = 4
SQL_SCCO_OPT_VALUES* = 8 #* SQL_TXN_CAPABLE values */
SQL_TC_NONE* = 0
SQL_TC_DML* = 1
SQL_TC_ALL* = 2
SQL_TC_DDL_COMMIT* = 3
SQL_TC_DDL_IGNORE* = 4 #* SQL_TXN_ISOLATION_OPTION bitmasks */
SQL_TXN_READ_UNCOMMITTED* = 1
SQL_TRANSACTION_READ_UNCOMMITTED* = SQL_TXN_READ_UNCOMMITTED
SQL_TXN_READ_COMMITTED* = 2
SQL_TRANSACTION_READ_COMMITTED* = SQL_TXN_READ_COMMITTED
SQL_TXN_REPEATABLE_READ* = 4
SQL_TRANSACTION_REPEATABLE_READ* = SQL_TXN_REPEATABLE_READ
SQL_TXN_SERIALIZABLE* = 8
SQL_TRANSACTION_SERIALIZABLE* = SQL_TXN_SERIALIZABLE
SQL_SS_ADDITIONS* = 1
SQL_SS_DELETIONS* = 2
SQL_SS_UPDATES* = 4 # SQLColAttributes defines
SQL_COLUMN_COUNT* = 0
SQL_COLUMN_NAME* = 1
SQL_COLUMN_TYPE* = 2
SQL_COLUMN_LENGTH* = 3
SQL_COLUMN_PRECISION* = 4
SQL_COLUMN_SCALE* = 5
SQL_COLUMN_DISPLAY_SIZE* = 6
SQL_COLUMN_NULLABLE* = 7
SQL_COLUMN_UNSIGNED* = 8
SQL_COLUMN_MONEY* = 9
SQL_COLUMN_UPDATABLE* = 10
SQL_COLUMN_AUTO_INCREMENT* = 11
SQL_COLUMN_CASE_SENSITIVE* = 12
SQL_COLUMN_SEARCHABLE* = 13
SQL_COLUMN_TYPE_NAME* = 14
SQL_COLUMN_TABLE_NAME* = 15
SQL_COLUMN_OWNER_NAME* = 16
SQL_COLUMN_QUALIFIER_NAME* = 17
SQL_COLUMN_LABEL* = 18
SQL_COLATT_OPT_MAX* = SQL_COLUMN_LABEL
SQL_COLUMN_DRIVER_START* = 1000
SQL_DESC_ARRAY_SIZE* = 20
SQL_DESC_ARRAY_STATUS_PTR* = 21
SQL_DESC_AUTO_UNIQUE_VALUE* = SQL_COLUMN_AUTO_INCREMENT
SQL_DESC_BASE_COLUMN_NAME* = 22
SQL_DESC_BASE_TABLE_NAME* = 23
SQL_DESC_BIND_OFFSET_PTR* = 24
SQL_DESC_BIND_TYPE* = 25
SQL_DESC_CASE_SENSITIVE* = SQL_COLUMN_CASE_SENSITIVE
SQL_DESC_CATALOG_NAME* = SQL_COLUMN_QUALIFIER_NAME
SQL_DESC_CONCISE_TYPE* = SQL_COLUMN_TYPE
SQL_DESC_DATETIME_INTERVAL_PRECISION* = 26
SQL_DESC_DISPLAY_SIZE* = SQL_COLUMN_DISPLAY_SIZE
SQL_DESC_FIXED_PREC_SCALE* = SQL_COLUMN_MONEY
SQL_DESC_LABEL* = SQL_COLUMN_LABEL
SQL_DESC_LITERAL_PREFIX* = 27
SQL_DESC_LITERAL_SUFFIX* = 28
SQL_DESC_LOCAL_TYPE_NAME* = 29
SQL_DESC_MAXIMUM_SCALE* = 30
SQL_DESC_MINIMUM_SCALE* = 31
SQL_DESC_NUM_PREC_RADIX* = 32
SQL_DESC_PARAMETER_TYPE* = 33
SQL_DESC_ROWS_PROCESSED_PTR* = 34
SQL_DESC_SCHEMA_NAME* = SQL_COLUMN_OWNER_NAME
SQL_DESC_SEARCHABLE* = SQL_COLUMN_SEARCHABLE
SQL_DESC_TYPE_NAME* = SQL_COLUMN_TYPE_NAME
SQL_DESC_TABLE_NAME* = SQL_COLUMN_TABLE_NAME
SQL_DESC_UNSIGNED* = SQL_COLUMN_UNSIGNED
SQL_DESC_UPDATABLE* = SQL_COLUMN_UPDATABLE #* SQLEndTran() options */
SQL_COMMIT* = 0
SQL_ROLLBACK* = 1
SQL_ATTR_ROW_ARRAY_SIZE* = 27 #* SQLConfigDataSource() options */
ODBC_ADD_DSN* = 1
ODBC_CONFIG_DSN* = 2
ODBC_REMOVE_DSN* = 3
ODBC_ADD_SYS_DSN* = 4
ODBC_CONFIG_SYS_DSN* = 5
ODBC_REMOVE_SYS_DSN* = 6
proc SQLAllocHandle*(HandleType: TSqlSmallInt, InputHandle: TSqlHandle,
OutputHandlePtr: var TSqlHandle): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLSetEnvAttr*(EnvironmentHandle: TSqlHEnv, Attribute: TSqlInteger,
Value: TSqlPointer, StringLength: TSqlInteger): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLGetEnvAttr*(EnvironmentHandle: TSqlHEnv, Attribute: TSqlInteger,
Value: TSqlPointer, BufferLength: TSqlInteger,
StringLength: PSQLINTEGER): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLFreeHandle*(HandleType: TSqlSmallInt, Handle: TSqlHandle): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLGetDiagRec*(HandleType: TSqlSmallInt, Handle: TSqlHandle,
RecNumber: TSqlSmallInt, Sqlstate: PSQLCHAR,
NativeError: var TSqlInteger, MessageText: PSQLCHAR,
BufferLength: TSqlSmallInt, TextLength: var TSqlSmallInt): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLGetDiagField*(HandleType: TSqlSmallInt, Handle: TSqlHandle,
RecNumber: TSqlSmallInt, DiagIdentifier: TSqlSmallInt,
DiagInfoPtr: TSqlPointer, BufferLength: TSqlSmallInt,
StringLengthPtr: var TSqlSmallInt): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLConnect*(ConnectionHandle: TSqlHDBC, ServerName: PSQLCHAR,
NameLength1: TSqlSmallInt, UserName: PSQLCHAR,
NameLength2: TSqlSmallInt, Authentication: PSQLCHAR,
NameLength3: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLDisconnect*(ConnectionHandle: TSqlHDBC): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLDriverConnect*(hdbc: TSqlHDBC, hwnd: TSqlHWND, szCsin: cstring,
szCLen: TSqlSmallInt, szCsout: cstring,
cbCSMax: TSqlSmallInt, cbCsOut: var TSqlSmallInt,
f: TSqlUSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLBrowseConnect*(hdbc: TSqlHDBC, szConnStrIn: PSQLCHAR,
cbConnStrIn: TSqlSmallInt, szConnStrOut: PSQLCHAR,
cbConnStrOutMax: TSqlSmallInt,
cbConnStrOut: var TSqlSmallInt): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLExecDirect*(StatementHandle: TSqlHStmt, StatementText: PSQLCHAR,
TextLength: TSqlInteger): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLPrepare*(StatementHandle: TSqlHStmt, StatementText: PSQLCHAR,
TextLength: TSqlInteger): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLCloseCursor*(StatementHandle: TSqlHStmt): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLExecute*(StatementHandle: TSqlHStmt): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLFetch*(StatementHandle: TSqlHStmt): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLNumResultCols*(StatementHandle: TSqlHStmt, ColumnCount: var TSqlSmallInt): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLDescribeCol*(StatementHandle: TSqlHStmt, ColumnNumber: TSqlUSmallInt,
ColumnName: PSQLCHAR, BufferLength: TSqlSmallInt,
NameLength: var TSqlSmallInt, DataType: var TSqlSmallInt,
ColumnSize: var TSqlUInteger,
DecimalDigits: var TSqlSmallInt, Nullable: var TSqlSmallInt): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLFetchScroll*(StatementHandle: TSqlHStmt, FetchOrientation: TSqlSmallInt,
FetchOffset: TSqlInteger): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLExtendedFetch*(hstmt: TSqlHStmt, fFetchType: TSqlUSmallInt,
irow: TSqlInteger, pcrow: PSQLUINTEGER,
rgfRowStatus: PSQLUSMALLINT): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLGetData*(StatementHandle: TSqlHStmt, ColumnNumber: TSqlUSmallInt,
TargetType: TSqlSmallInt, TargetValue: TSqlPointer,
BufferLength: TSqlInteger, StrLen_or_Ind: PSQLINTEGER): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLSetStmtAttr*(StatementHandle: TSqlHStmt, Attribute: TSqlInteger,
Value: TSqlPointer, StringLength: TSqlInteger): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLGetStmtAttr*(StatementHandle: TSqlHStmt, Attribute: TSqlInteger,
Value: TSqlPointer, BufferLength: TSqlInteger,
StringLength: PSQLINTEGER): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLGetInfo*(ConnectionHandle: TSqlHDBC, InfoType: TSqlUSmallInt,
InfoValue: TSqlPointer, BufferLength: TSqlSmallInt,
StringLength: PSQLSMALLINT): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLBulkOperations*(StatementHandle: TSqlHStmt, Operation: TSqlSmallInt): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLPutData*(StatementHandle: TSqlHStmt, Data: TSqlPointer,
StrLen_or_Ind: TSqlInteger): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLBindCol*(StatementHandle: TSqlHStmt, ColumnNumber: TSqlUSmallInt,
TargetType: TSqlSmallInt, TargetValue: TSqlPointer,
BufferLength: TSqlInteger, StrLen_or_Ind: PSQLINTEGER): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLSetPos*(hstmt: TSqlHStmt, irow: TSqlUSmallInt, fOption: TSqlUSmallInt,
fLock: TSqlUSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLDataSources*(EnvironmentHandle: TSqlHEnv, Direction: TSqlUSmallInt,
ServerName: PSQLCHAR, BufferLength1: TSqlSmallInt,
NameLength1: PSQLSMALLINT, Description: PSQLCHAR,
BufferLength2: TSqlSmallInt, NameLength2: PSQLSMALLINT): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLDrivers*(EnvironmentHandle: TSqlHEnv, Direction: TSqlUSmallInt,
DriverDescription: PSQLCHAR, BufferLength1: TSqlSmallInt,
DescriptionLength1: PSQLSMALLINT, DriverAttributes: PSQLCHAR,
BufferLength2: TSqlSmallInt, AttributesLength2: PSQLSMALLINT): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLSetConnectAttr*(ConnectionHandle: TSqlHDBC, Attribute: TSqlInteger,
Value: TSqlPointer, StringLength: TSqlInteger): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLGetCursorName*(StatementHandle: TSqlHStmt, CursorName: PSQLCHAR,
BufferLength: TSqlSmallInt, NameLength: PSQLSMALLINT): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLSetCursorName*(StatementHandle: TSqlHStmt, CursorName: PSQLCHAR,
NameLength: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLRowCount*(StatementHandle: TSqlHStmt, RowCount: var TSqlInteger): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLBindParameter*(hstmt: TSqlHStmt, ipar: TSqlUSmallInt,
fParamType: TSqlSmallInt, fCType: TSqlSmallInt,
fSqlType: TSqlSmallInt, cbColDef: TSqlUInteger,
ibScale: TSqlSmallInt, rgbValue: TSqlPointer,
cbValueMax: TSqlInteger, pcbValue: PSQLINTEGER): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLFreeStmt*(StatementHandle: TSqlHStmt, Option: TSqlUSmallInt): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLColAttribute*(StatementHandle: TSqlHStmt, ColumnNumber: TSqlUSmallInt,
FieldIdentifier: TSqlUSmallInt,
CharacterAttribute: PSQLCHAR, BufferLength: TSqlSmallInt,
StringLength: PSQLSMALLINT,
NumericAttribute: TSqlPointer): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLEndTran*(HandleType: TSqlSmallInt, Handle: TSqlHandle,
CompletionType: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLTables*(hstmt: TSqlHStmt, szTableQualifier: PSQLCHAR,
cbTableQualifier: TSqlSmallInt, szTableOwner: PSQLCHAR,
cbTableOwner: TSqlSmallInt, szTableName: PSQLCHAR,
cbTableName: TSqlSmallInt, szTableType: PSQLCHAR,
cbTableType: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLColumns*(hstmt: TSqlHStmt, szTableQualifier: PSQLCHAR,
cbTableQualifier: TSqlSmallInt, szTableOwner: PSQLCHAR,
cbTableOwner: TSqlSmallInt, szTableName: PSQLCHAR,
cbTableName: TSqlSmallInt, szColumnName: PSQLCHAR,
cbColumnName: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib, importc.}
proc SQLSpecialColumns*(StatementHandle: TSqlHStmt, IdentifierType: TSqlUSmallInt,
CatalogName: PSQLCHAR, NameLength1: TSqlSmallInt,
SchemaName: PSQLCHAR, NameLength2: TSqlSmallInt,
TableName: PSQLCHAR, NameLength3: TSqlSmallInt,
Scope: TSqlUSmallInt,
Nullable: TSqlUSmallInt): TSqlSmallInt{.
dynlib: odbclib, importc.}
proc SQLProcedures*(hstmt: TSqlHStmt, szTableQualifier: PSQLCHAR,
cbTableQualifier: TSqlSmallInt, szTableOwner: PSQLCHAR,
cbTableOwner: TSqlSmallInt, szTableName: PSQLCHAR,
cbTableName: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLPrimaryKeys*(hstmt: TSqlHStmt, CatalogName: PSQLCHAR,
NameLength1: TSqlSmallInt, SchemaName: PSQLCHAR,
NameLength2: TSqlSmallInt, TableName: PSQLCHAR,
NameLength3: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLProcedureColumns*(hstmt: TSqlHStmt, CatalogName: PSQLCHAR,
NameLength1: TSqlSmallInt, SchemaName: PSQLCHAR,
NameLength2: TSqlSmallInt, ProcName: PSQLCHAR,
NameLength3: TSqlSmallInt, ColumnName: PSQLCHAR,
NameLength4: TSqlSmallInt): TSqlSmallInt{.dynlib: odbclib,
importc.}
proc SQLStatistics*(hstmt: TSqlHStmt, CatalogName: PSQLCHAR,
NameLength1: TSqlSmallInt, SchemaName: PSQLCHAR,
NameLength2: TSqlSmallInt, TableName: PSQLCHAR,
NameLength3: TSqlSmallInt, Unique: TSqlUSmallInt,
Reserved: TSqlUSmallInt): TSqlSmallInt {.
dynlib: odbclib, importc.}
{.pop.}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,311 +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
GL
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
TViewPortArray* = array[0..3, TGLint]
T16dArray* = array[0..15, TGLdouble]
TCallBack* = proc ()
T3dArray* = array[0..2, TGLdouble]
T4pArray* = array[0..3, Pointer]
T4fArray* = array[0..3, TGLfloat]
PPointer* = ptr Pointer
type
GLUnurbs*{.final.} = object
PGLUnurbs* = ptr GLUnurbs
GLUquadric*{.final.} = object
PGLUquadric* = ptr GLUquadric
GLUtesselator*{.final.} = object
PGLUtesselator* = ptr GLUtesselator # backwards compatibility:
GLUnurbsObj* = GLUnurbs
PGLUnurbsObj* = PGLUnurbs
GLUquadricObj* = GLUquadric
PGLUquadricObj* = PGLUquadric
GLUtesselatorObj* = GLUtesselator
PGLUtesselatorObj* = PGLUtesselator
GLUtriangulatorObj* = GLUtesselator
PGLUtriangulatorObj* = PGLUtesselator
TGLUnurbs* = GLUnurbs
TGLUquadric* = GLUquadric
TGLUtesselator* = GLUtesselator
TGLUnurbsObj* = GLUnurbsObj
TGLUquadricObj* = GLUquadricObj
TGLUtesselatorObj* = GLUtesselatorObj
TGLUtriangulatorObj* = GLUtriangulatorObj
proc gluErrorString*(errCode: TGLenum): cstring{.dynlib: dllname, importc.}
proc gluErrorUnicodeStringEXT*(errCode: TGLenum): ptr int16{.dynlib: dllname,
importc.}
proc gluGetString*(name: TGLenum): cstring{.dynlib: dllname, importc.}
proc gluOrtho2D*(left, right, bottom, top: TGLdouble){.dynlib: dllname, importc.}
proc gluPerspective*(fovy, aspect, zNear, zFar: TGLdouble){.dynlib: dllname,
importc.}
proc gluPickMatrix*(x, y, width, height: TGLdouble, viewport: var TViewPortArray){.
dynlib: dllname, importc.}
proc gluLookAt*(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz: TGLdouble){.
dynlib: dllname, importc.}
proc gluProject*(objx, objy, objz: TGLdouble,
modelMatrix, projMatrix: var T16dArray,
viewport: var TViewPortArray, winx, winy, winz: PGLdouble): int{.
dynlib: dllname, importc.}
proc gluUnProject*(winx, winy, winz: TGLdouble,
modelMatrix, projMatrix: var T16dArray,
viewport: var TViewPortArray, objx, objy, objz: PGLdouble): int{.
dynlib: dllname, importc.}
proc gluScaleImage*(format: TGLenum, widthin, heightin: TGLint, typein: TGLenum,
datain: Pointer, widthout, heightout: TGLint,
typeout: TGLenum, dataout: Pointer): int{.dynlib: dllname,
importc.}
proc gluBuild1DMipmaps*(target: TGLenum, components, width: TGLint,
format, atype: TGLenum, data: Pointer): int{.
dynlib: dllname, importc.}
proc gluBuild2DMipmaps*(target: TGLenum, components, width, height: TGLint,
format, atype: TGLenum, data: Pointer): int{.
dynlib: dllname, importc.}
proc gluNewQuadric*(): PGLUquadric{.dynlib: dllname, importc.}
proc gluDeleteQuadric*(state: PGLUquadric){.dynlib: dllname, importc.}
proc gluQuadricNormals*(quadObject: PGLUquadric, normals: TGLenum){.
dynlib: dllname, importc.}
proc gluQuadricTexture*(quadObject: PGLUquadric, textureCoords: TGLboolean){.
dynlib: dllname, importc.}
proc gluQuadricOrientation*(quadObject: PGLUquadric, orientation: TGLenum){.
dynlib: dllname, importc.}
proc gluQuadricDrawStyle*(quadObject: PGLUquadric, drawStyle: TGLenum){.
dynlib: dllname, importc.}
proc gluCylinder*(qobj: PGLUquadric, baseRadius, topRadius, height: TGLdouble,
slices, stacks: TGLint){.dynlib: dllname, importc.}
proc gluDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble,
slices, loops: TGLint){.dynlib: dllname, importc.}
proc gluPartialDisk*(qobj: PGLUquadric, innerRadius, outerRadius: TGLdouble,
slices, loops: TGLint, startAngle, sweepAngle: TGLdouble){.
dynlib: dllname, importc.}
proc gluSphere*(qobj: PGLuquadric, radius: TGLdouble, slices, stacks: TGLint){.
dynlib: dllname, importc.}
proc gluQuadricCallback*(qobj: PGLUquadric, which: TGLenum, fn: TCallBack){.
dynlib: dllname, importc.}
proc gluNewTess*(): PGLUtesselator{.dynlib: dllname, importc.}
proc gluDeleteTess*(tess: PGLUtesselator){.dynlib: dllname, importc.}
proc gluTessBeginPolygon*(tess: PGLUtesselator, polygon_data: Pointer){.
dynlib: dllname, importc.}
proc gluTessBeginContour*(tess: PGLUtesselator){.dynlib: dllname, importc.}
proc gluTessVertex*(tess: PGLUtesselator, coords: var T3dArray, data: Pointer){.
dynlib: dllname, importc.}
proc gluTessEndContour*(tess: PGLUtesselator){.dynlib: dllname, importc.}
proc gluTessEndPolygon*(tess: PGLUtesselator){.dynlib: dllname, importc.}
proc gluTessProperty*(tess: PGLUtesselator, which: TGLenum, value: TGLdouble){.
dynlib: dllname, importc.}
proc gluTessNormal*(tess: PGLUtesselator, x, y, z: TGLdouble){.dynlib: dllname,
importc.}
proc gluTessCallback*(tess: PGLUtesselator, which: TGLenum, fn: TCallBack){.
dynlib: dllname, importc.}
proc gluGetTessProperty*(tess: PGLUtesselator, which: TGLenum, value: PGLdouble){.
dynlib: dllname, importc.}
proc gluNewNurbsRenderer*(): PGLUnurbs{.dynlib: dllname, importc.}
proc gluDeleteNurbsRenderer*(nobj: PGLUnurbs){.dynlib: dllname, importc.}
proc gluBeginSurface*(nobj: PGLUnurbs){.dynlib: dllname, importc.}
proc gluBeginCurve*(nobj: PGLUnurbs){.dynlib: dllname, importc.}
proc gluEndCurve*(nobj: PGLUnurbs){.dynlib: dllname, importc.}
proc gluEndSurface*(nobj: PGLUnurbs){.dynlib: dllname, importc.}
proc gluBeginTrim*(nobj: PGLUnurbs){.dynlib: dllname, importc.}
proc gluEndTrim*(nobj: PGLUnurbs){.dynlib: dllname, importc.}
proc gluPwlCurve*(nobj: PGLUnurbs, count: TGLint, aarray: PGLfloat,
stride: TGLint, atype: TGLenum){.dynlib: dllname, importc.}
proc gluNurbsCurve*(nobj: PGLUnurbs, nknots: TGLint, knot: PGLfloat,
stride: TGLint, ctlarray: PGLfloat, order: TGLint,
atype: TGLenum){.dynlib: dllname, importc.}
proc gluNurbsSurface*(nobj: PGLUnurbs, sknot_count: TGLint, sknot: PGLfloat,
tknot_count: TGLint, tknot: PGLfloat,
s_stride, t_stride: TGLint, ctlarray: PGLfloat,
sorder, torder: TGLint, atype: TGLenum){.dynlib: dllname,
importc.}
proc gluLoadSamplingMatrices*(nobj: PGLUnurbs,
modelMatrix, projMatrix: var T16dArray,
viewport: var TViewPortArray){.dynlib: dllname,
importc.}
proc gluNurbsProperty*(nobj: PGLUnurbs, aproperty: TGLenum, value: TGLfloat){.
dynlib: dllname, importc.}
proc gluGetNurbsProperty*(nobj: PGLUnurbs, aproperty: TGLenum, value: PGLfloat){.
dynlib: dllname, importc.}
proc gluNurbsCallback*(nobj: PGLUnurbs, which: TGLenum, fn: TCallBack){.
dynlib: dllname, importc.}
#*** Callback function prototypes ***
type # gluQuadricCallback
GLUquadricErrorProc* = proc (p: TGLenum) # gluTessCallback
GLUtessBeginProc* = proc (p: TGLenum)
GLUtessEdgeFlagProc* = proc (p: TGLboolean)
GLUtessVertexProc* = proc (p: Pointer)
GLUtessEndProc* = proc ()
GLUtessErrorProc* = proc (p: TGLenum)
GLUtessCombineProc* = proc (p1: var T3dArray, p2: T4pArray, p3: T4fArray,
p4: PPointer)
GLUtessBeginDataProc* = proc (p1: TGLenum, p2: Pointer)
GLUtessEdgeFlagDataProc* = proc (p1: TGLboolean, p2: Pointer)
GLUtessVertexDataProc* = proc (p1, p2: Pointer)
GLUtessEndDataProc* = proc (p: Pointer)
GLUtessErrorDataProc* = proc (p1: TGLenum, p2: Pointer)
GLUtessCombineDataProc* = proc (p1: var T3dArray, p2: var T4pArray,
p3: var T4fArray, p4: PPointer, p5: Pointer) #
# gluNurbsCallback
GLUnurbsErrorProc* = proc (p: TGLenum) #*** 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*)(TGLenum type)
constGLU_TESS_VERTEX* = 100101 # void (CALLBACK*)(void *data)
GLU_TESS_END* = 100102 # void (CALLBACK*)(void)
GLU_TESS_ERROR* = 100103 # void (CALLBACK*)(TGLenum errno)
GLU_TESS_EDGE_FLAG* = 100104 # void (CALLBACK*)(TGLboolean boundaryEdge)
GLU_TESS_COMBINE* = 100105 # void (CALLBACK*)(TGLdouble coords[3],
# void *data[4],
# TGLfloat weight[4],
# void **dataOut)
GLU_TESS_BEGIN_DATA* = 100106 # void (CALLBACK*)(TGLenum 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*)(TGLenum errno,
# void *polygon_data)
GLU_TESS_EDGE_FLAG_DATA* = 100110 # void (CALLBACK*)(TGLboolean boundaryEdge,
# void *polygon_data)
GLU_TESS_COMBINE_DATA* = 100111 # void (CALLBACK*)(TGLdouble coords[3],
# void *data[4],
# TGLfloat 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: PGLUtesselator){.dynlib: dllname, importc.}
proc gluNextContour*(tess: PGLUtesselator, atype: TGLenum){.dynlib: dllname,
importc.}
proc gluEndPolygon*(tess: PGLUtesselator){.dynlib: dllname, importc.}
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
# implementation

View File

@@ -1,378 +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
GL
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
PInteger* = ptr int
PPChar* = ptr cstring
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.}
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.
proc glutInit*(argcp: PInteger, argv: PPChar){.dynlib: dllname, importc.}
proc glutInitDisplayMode*(mode: int16){.dynlib: dllname, importc.}
proc glutInitDisplayString*(str: cstring){.dynlib: dllname, importc.}
proc glutInitWindowPosition*(x, y: int){.dynlib: dllname, importc.}
proc glutInitWindowSize*(width, height: int){.dynlib: dllname, importc.}
proc glutMainLoop*(){.dynlib: dllname, importc.}
# GLUT window sub-API.
proc glutCreateWindow*(title: cstring): int{.dynlib: dllname, importc.}
proc glutCreateSubWindow*(win, x, y, width, height: int): int{.dynlib: dllname,
importc.}
proc glutDestroyWindow*(win: int){.dynlib: dllname, importc.}
proc glutPostRedisplay*(){.dynlib: dllname, importc.}
proc glutPostWindowRedisplay*(win: int){.dynlib: dllname, importc.}
proc glutSwapBuffers*(){.dynlib: dllname, importc.}
proc glutGetWindow*(): int{.dynlib: dllname, importc.}
proc glutSetWindow*(win: int){.dynlib: dllname, importc.}
proc glutSetWindowTitle*(title: cstring){.dynlib: dllname, importc.}
proc glutSetIconTitle*(title: cstring){.dynlib: dllname, importc.}
proc glutPositionWindow*(x, y: int){.dynlib: dllname, importc.}
proc glutReshapeWindow*(width, height: int){.dynlib: dllname, importc.}
proc glutPopWindow*(){.dynlib: dllname, importc.}
proc glutPushWindow*(){.dynlib: dllname, importc.}
proc glutIconifyWindow*(){.dynlib: dllname, importc.}
proc glutShowWindow*(){.dynlib: dllname, importc.}
proc glutHideWindow*(){.dynlib: dllname, importc.}
proc glutFullScreen*(){.dynlib: dllname, importc.}
proc glutSetCursor*(cursor: int){.dynlib: dllname, importc.}
proc glutWarpPointer*(x, y: int){.dynlib: dllname, importc.}
# GLUT overlay sub-API.
proc glutEstablishOverlay*(){.dynlib: dllname, importc.}
proc glutRemoveOverlay*(){.dynlib: dllname, importc.}
proc glutUseLayer*(layer: TGLenum){.dynlib: dllname, importc.}
proc glutPostOverlayRedisplay*(){.dynlib: dllname, importc.}
proc glutPostWindowOverlayRedisplay*(win: int){.dynlib: dllname, importc.}
proc glutShowOverlay*(){.dynlib: dllname, importc.}
proc glutHideOverlay*(){.dynlib: dllname, importc.}
# GLUT menu sub-API.
proc glutCreateMenu*(callback: TGlut1IntCallback): int{.dynlib: dllname, importc.}
proc glutDestroyMenu*(menu: int){.dynlib: dllname, importc.}
proc glutGetMenu*(): int{.dynlib: dllname, importc.}
proc glutSetMenu*(menu: int){.dynlib: dllname, importc.}
proc glutAddMenuEntry*(caption: cstring, value: int){.dynlib: dllname, importc.}
proc glutAddSubMenu*(caption: cstring, submenu: int){.dynlib: dllname, importc.}
proc glutChangeToMenuEntry*(item: int, caption: cstring, value: int){.
dynlib: dllname, importc.}
proc glutChangeToSubMenu*(item: int, caption: cstring, submenu: int){.
dynlib: dllname, importc.}
proc glutRemoveMenuItem*(item: int){.dynlib: dllname, importc.}
proc glutAttachMenu*(button: int){.dynlib: dllname, importc.}
proc glutDetachMenu*(button: int){.dynlib: dllname, importc.}
# GLUT window callback sub-API.
proc glutDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname, importc.}
proc glutReshapeFunc*(f: TGlut2IntCallback){.dynlib: dllname, importc.}
proc glutKeyboardFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname, importc.}
proc glutMouseFunc*(f: TGlut4IntCallback){.dynlib: dllname, importc.}
proc glutMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, importc.}
proc glutPassiveMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, importc.}
proc glutEntryFunc*(f: TGlut1IntCallback){.dynlib: dllname, importc.}
proc glutVisibilityFunc*(f: TGlut1IntCallback){.dynlib: dllname, importc.}
proc glutIdleFunc*(f: TGlutVoidCallback){.dynlib: dllname, importc.}
proc glutTimerFunc*(millis: int16, f: TGlut1IntCallback, value: int){.
dynlib: dllname, importc.}
proc glutMenuStateFunc*(f: TGlut1IntCallback){.dynlib: dllname, importc.}
proc glutSpecialFunc*(f: TGlut3IntCallback){.dynlib: dllname, importc.}
proc glutSpaceballMotionFunc*(f: TGlut3IntCallback){.dynlib: dllname, importc.}
proc glutSpaceballRotateFunc*(f: TGlut3IntCallback){.dynlib: dllname, importc.}
proc glutSpaceballButtonFunc*(f: TGlut2IntCallback){.dynlib: dllname, importc.}
proc glutButtonBoxFunc*(f: TGlut2IntCallback){.dynlib: dllname, importc.}
proc glutDialsFunc*(f: TGlut2IntCallback){.dynlib: dllname, importc.}
proc glutTabletMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname, importc.}
proc glutTabletButtonFunc*(f: TGlut4IntCallback){.dynlib: dllname, importc.}
proc glutMenuStatusFunc*(f: TGlut3IntCallback){.dynlib: dllname, importc.}
proc glutOverlayDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname, importc.}
proc glutWindowStatusFunc*(f: TGlut1IntCallback){.dynlib: dllname, importc.}
proc glutKeyboardUpFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname, importc.}
proc glutSpecialUpFunc*(f: TGlut3IntCallback){.dynlib: dllname, importc.}
proc glutJoystickFunc*(f: TGlut1UInt3IntCallback, pollInterval: int){.
dynlib: dllname, importc.}
# GLUT color index sub-API.
proc glutSetColor*(cell: int, red, green, blue: TGLfloat){.dynlib: dllname,
importc.}
proc glutGetColor*(ndx, component: int): TGLfloat{.dynlib: dllname, importc.}
proc glutCopyColormap*(win: int){.dynlib: dllname, importc.}
# GLUT state retrieval sub-API.
proc glutGet*(t: TGLenum): int{.dynlib: dllname, importc.}
proc glutDeviceGet*(t: TGLenum): int{.dynlib: dllname, importc.}
# GLUT extension support sub-API
proc glutExtensionSupported*(name: cstring): int{.dynlib: dllname, importc.}
proc glutGetModifiers*(): int{.dynlib: dllname, importc.}
proc glutLayerGet*(t: TGLenum): int{.dynlib: dllname, importc.}
# GLUT font sub-API
proc glutBitmapCharacter*(font: pointer, character: int){.dynlib: dllname,
importc.}
proc glutBitmapWidth*(font: pointer, character: int): int{.dynlib: dllname,
importc.}
proc glutStrokeCharacter*(font: pointer, character: int){.dynlib: dllname,
importc.}
proc glutStrokeWidth*(font: pointer, character: int): int{.dynlib: dllname,
importc.}
proc glutBitmapLength*(font: pointer, str: cstring): int{.dynlib: dllname,
importc.}
proc glutStrokeLength*(font: pointer, str: cstring): int{.dynlib: dllname,
importc.}
# GLUT pre-built models sub-API
proc glutWireSphere*(radius: TGLdouble, slices, stacks: TGLint){.dynlib: dllname,
importc.}
proc glutSolidSphere*(radius: TGLdouble, slices, stacks: TGLint){.dynlib: dllname,
importc.}
proc glutWireCone*(base, height: TGLdouble, slices, stacks: TGLint){.
dynlib: dllname, importc.}
proc glutSolidCone*(base, height: TGLdouble, slices, stacks: TGLint){.
dynlib: dllname, importc.}
proc glutWireCube*(size: TGLdouble){.dynlib: dllname, importc.}
proc glutSolidCube*(size: TGLdouble){.dynlib: dllname, importc.}
proc glutWireTorus*(innerRadius, outerRadius: TGLdouble, sides, rings: TGLint){.
dynlib: dllname, importc.}
proc glutSolidTorus*(innerRadius, outerRadius: TGLdouble, sides, rings: TGLint){.
dynlib: dllname, importc.}
proc glutWireDodecahedron*(){.dynlib: dllname, importc.}
proc glutSolidDodecahedron*(){.dynlib: dllname, importc.}
proc glutWireTeapot*(size: TGLdouble){.dynlib: dllname, importc.}
proc glutSolidTeapot*(size: TGLdouble){.dynlib: dllname, importc.}
proc glutWireOctahedron*(){.dynlib: dllname, importc.}
proc glutSolidOctahedron*(){.dynlib: dllname, importc.}
proc glutWireTetrahedron*(){.dynlib: dllname, importc.}
proc glutSolidTetrahedron*(){.dynlib: dllname, importc.}
proc glutWireIcosahedron*(){.dynlib: dllname, importc.}
proc glutSolidIcosahedron*(){.dynlib: dllname, importc.}
# GLUT video resize sub-API.
proc glutVideoResizeGet*(param: TGLenum): int{.dynlib: dllname, importc.}
proc glutSetupVideoResizing*(){.dynlib: dllname, importc.}
proc glutStopVideoResizing*(){.dynlib: dllname, importc.}
proc glutVideoResize*(x, y, width, height: int){.dynlib: dllname, importc.}
proc glutVideoPan*(x, y, width, height: int){.dynlib: dllname, importc.}
# GLUT debugging sub-API.
proc glutReportErrors*(){.dynlib: dllname, importc.}
# GLUT device control sub-API.
proc glutIgnoreKeyRepeat*(ignore: int){.dynlib: dllname, importc.}
proc glutSetKeyRepeat*(repeatMode: int){.dynlib: dllname, importc.}
proc glutForceJoystickFunc*(){.dynlib: dllname, importc.}
# GLUT game mode sub-API.
#example glutGameModeString('1280x1024:32@75');
proc glutGameModeString*(AString: cstring){.dynlib: dllname, importc.}
proc glutEnterGameMode*(): int{.dynlib: dllname, importc.}
proc glutLeaveGameMode*(){.dynlib: dllname, importc.}
proc glutGameModeGet*(mode: TGLenum): int{.dynlib: dllname, importc.}
# implementation

View File

@@ -1,148 +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, gl
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
GLX_BUFFER_SIZE* = 2
GLX_LEVEL* = 3
GLX_RGBA* = 4
GLX_DOUBLEBUFFER* = 5
GLX_STEREO* = 6
GLX_AUX_BUFFERS* = 7
GLX_RED_SIZE* = 8
GLX_GREEN_SIZE* = 9
GLX_BLUE_SIZE* = 10
GLX_ALPHA_SIZE* = 11
GLX_DEPTH_SIZE* = 12
GLX_STENCIL_SIZE* = 13
GLX_ACCUM_RED_SIZE* = 14
GLX_ACCUM_GREEN_SIZE* = 15
GLX_ACCUM_BLUE_SIZE* = 16
GLX_ACCUM_ALPHA_SIZE* = 17 # 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.}
proc glXCreateContext*(dpy: PDisplay, vis: PXVisualInfo, shareList: GLXContext,
direct: bool): GLXContext{.cdecl, dynlib: dllname,
importc.}
proc glXDestroyContext*(dpy: PDisplay, ctx: GLXContext){.cdecl, dynlib: dllname,
importc.}
proc glXMakeCurrent*(dpy: PDisplay, drawable: GLXDrawable, ctx: GLXContext): bool{.
cdecl, dynlib: dllname, importc.}
proc glXCopyContext*(dpy: PDisplay, src, dst: GLXContext, mask: int32){.cdecl,
dynlib: dllname, importc.}
proc glXSwapBuffers*(dpy: PDisplay, drawable: GLXDrawable){.cdecl,
dynlib: dllname, importc.}
proc glXCreateGLXPixmap*(dpy: PDisplay, visual: PXVisualInfo, pixmap: XPixmap): GLXPixmap{.
cdecl, dynlib: dllname, importc.}
proc glXDestroyGLXPixmap*(dpy: PDisplay, pixmap: GLXPixmap){.cdecl,
dynlib: dllname, importc.}
proc glXQueryExtension*(dpy: PDisplay, errorb, event: var int): bool{.cdecl,
dynlib: dllname, importc.}
proc glXQueryVersion*(dpy: PDisplay, maj, min: var int): bool{.cdecl,
dynlib: dllname, importc.}
proc glXIsDirect*(dpy: PDisplay, ctx: GLXContext): bool{.cdecl, dynlib: dllname,
importc.}
proc glXGetConfig*(dpy: PDisplay, visual: PXVisualInfo, attrib: int,
value: var int): int{.cdecl, dynlib: dllname, importc.}
proc glXGetCurrentContext*(): GLXContext{.cdecl, dynlib: dllname, importc.}
proc glXGetCurrentDrawable*(): GLXDrawable{.cdecl, dynlib: dllname, importc.}
proc glXWaitGL*(){.cdecl, dynlib: dllname, importc.}
proc glXWaitX*(){.cdecl, dynlib: dllname, importc.}
proc glXUseXFont*(font: XFont, first, count, list: int){.cdecl, dynlib: dllname,
importc.}
# GLX 1.1 and later
proc glXQueryExtensionsString*(dpy: PDisplay, screen: int): cstring{.cdecl,
dynlib: dllname, importc.}
proc glXQueryServerString*(dpy: PDisplay, screen, name: int): cstring{.cdecl,
dynlib: dllname, importc.}
proc glXGetClientString*(dpy: PDisplay, name: int): cstring{.cdecl,
dynlib: dllname, importc.}
# Mesa GLX Extensions
proc glXCreateGLXPixmapMESA*(dpy: PDisplay, visual: PXVisualInfo,
pixmap: XPixmap, cmap: XColormap): GLXPixmap{.
cdecl, dynlib: dllname, importc.}
proc glXReleaseBufferMESA*(dpy: PDisplay, d: GLXDrawable): bool{.cdecl,
dynlib: dllname, importc.}
proc glXCopySubBufferMESA*(dpy: PDisplay, drawbale: GLXDrawable,
x, y, width, height: int){.cdecl, dynlib: dllname,
importc.}
proc glXGetVideoSyncSGI*(counter: var int32): int{.cdecl, dynlib: dllname,
importc.}
proc glXWaitVideoSyncSGI*(divisor, remainder: int, count: var int32): int{.
cdecl, dynlib: dllname, importc.}
# implementation

View File

@@ -1,348 +0,0 @@
import
gl, windows
proc wglGetExtensionsStringARB*(hdc: HDC): cstring{.dynlib: dllname, importc.}
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.}
proc wglDeleteBufferRegionARB*(hRegion: THandle){.dynlib: dllname, importc.}
proc wglSaveBufferRegionARB*(hRegion: THandle, x: TGLint, y: TGLint,
width: TGLint, height: TGLint): BOOL{.
dynlib: dllname, importc.}
proc wglRestoreBufferRegionARB*(hRegion: THandle, x: TGLint, y: TGLint,
width: TGLint, height: TGLint, xSrc: TGLint,
ySrc: TGLint): BOOL{.dynlib: dllname, importc.}
proc wglAllocateMemoryNV*(size: TGLsizei, readFrequency: TGLfloat,
writeFrequency: TGLfloat, priority: TGLfloat): PGLvoid{.
dynlib: dllname, importc.}
proc wglFreeMemoryNV*(pointer: PGLvoid){.dynlib: dllname, importc.}
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.}
proc wglDestroyImageBufferI3D*(hDC: HDC, pAddress: PGLvoid): BOOL{.
dynlib: dllname, importc.}
proc wglAssociateImageBufferEventsI3D*(hdc: HDC, pEvent: PHandle,
pAddress: PGLvoid, pSize: PDWORD,
count: UINT): BOOL{.dynlib: dllname,
importc.}
proc wglReleaseImageBufferEventsI3D*(hdc: HDC, pAddress: PGLvoid, count: UINT): BOOL{.
dynlib: dllname, importc.}
proc wglEnableFrameLockI3D*(): BOOL{.dynlib: dllname, importc.}
proc wglDisableFrameLockI3D*(): BOOL{.dynlib: dllname, importc.}
proc wglIsEnabledFrameLockI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname, importc.}
proc wglQueryFrameLockMasterI3D*(pFlag: PBOOL): BOOL{.dynlib: dllname, importc.}
proc wglGetFrameUsageI3D*(pUsage: PGLfloat): BOOL{.dynlib: dllname, importc.}
proc wglBeginFrameTrackingI3D*(): BOOL{.dynlib: dllname, importc.}
proc wglEndFrameTrackingI3D*(): BOOL{.dynlib: dllname, importc.}
proc wglQueryFrameTrackingI3D*(pFrameCount: PDWORD, pMissedFrames: PDWORD,
pLastMissedUsage: PGLfloat): BOOL{.
dynlib: dllname, importc.}
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.}
proc wglGetPixelFormatAttribfvARB*(hdc: HDC, iPixelFormat: TGLint,
iLayerPlane: TGLint, nAttributes: TGLuint,
piAttributes: PGLint, pfValues: PGLfloat): BOOL{.
dynlib: dllname, importc.}
proc wglChoosePixelFormatARB*(hdc: HDC, piAttribIList: PGLint,
pfAttribFList: PGLfloat, nMaxFormats: TGLuint,
piFormats: PGLint, nNumFormats: PGLuint): BOOL{.
dynlib: dllname, importc.}
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.}
proc wglGetCurrentReadDCARB*(): HDC{.dynlib: dllname, importc.}
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.}
proc wglGetPbufferDCARB*(hPbuffer: THandle): HDC{.dynlib: dllname, importc.}
proc wglReleasePbufferDCARB*(hPbuffer: THandle, hDC: HDC): TGLint{.
dynlib: dllname, importc.}
proc wglDestroyPbufferARB*(hPbuffer: THandle): BOOL{.dynlib: dllname, importc.}
proc wglQueryPbufferARB*(hPbuffer: THandle, iAttribute: TGLint, piValue: PGLint): BOOL{.
dynlib: dllname, importc.}
proc wglSwapIntervalEXT*(interval: TGLint): BOOL{.dynlib: dllname, importc.}
proc wglGetSwapIntervalEXT*(): TGLint{.dynlib: dllname, importc.}
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.}
proc wglReleaseTexImageARB*(hPbuffer: THandle, iBuffer: TGLint): BOOL{.
dynlib: dllname, importc.}
proc wglSetPbufferAttribARB*(hPbuffer: THandle, piAttribList: PGLint): BOOL{.
dynlib: dllname, importc.}
proc wglGetExtensionsStringEXT*(): cstring{.dynlib: dllname, importc.}
proc wglMakeContextCurrentEXT*(hDrawDC: HDC, hReadDC: HDC, hglrc: HGLRC): BOOL{.
dynlib: dllname, importc.}
proc wglGetCurrentReadDCEXT*(): HDC{.dynlib: dllname, importc.}
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.}
proc wglGetPbufferDCEXT*(hPbuffer: THandle): HDC{.dynlib: dllname, importc.}
proc wglReleasePbufferDCEXT*(hPbuffer: THandle, hDC: HDC): TGLint{.
dynlib: dllname, importc.}
proc wglDestroyPbufferEXT*(hPbuffer: THandle): BOOL{.dynlib: dllname, importc.}
proc wglQueryPbufferEXT*(hPbuffer: THandle, iAttribute: TGLint, piValue: PGLint): BOOL{.
dynlib: dllname, importc.}
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.}
proc wglGetPixelFormatAttribfvEXT*(hdc: HDC, iPixelFormat: TGLint,
iLayerPlane: TGLint, nAttributes: TGLuint,
piAttributes: PGLint, pfValues: PGLfloat): BOOL{.
dynlib: dllname, importc.}
proc wglChoosePixelFormatEXT*(hdc: HDC, piAttribIList: PGLint,
pfAttribFList: PGLfloat, nMaxFormats: TGLuint,
piFormats: PGLint, nNumFormats: PGLuint): BOOL{.
dynlib: dllname, importc.}
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.}
proc wglSetDigitalVideoParametersI3D*(hDC: HDC, iAttribute: TGLint,
piValue: PGLint): BOOL{.dynlib: dllname,
importc.}
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.}
proc wglSetGammaTableParametersI3D*(hDC: HDC, iAttribute: TGLint,
piValue: PGLint): BOOL{.dynlib: dllname,
importc.}
proc wglGetGammaTableI3D*(hDC: HDC, iEntries: TGLint, puRed: PGLUSHORT,
puGreen: PGLUSHORT, puBlue: PGLUSHORT): BOOL{.
dynlib: dllname, importc.}
proc wglSetGammaTableI3D*(hDC: HDC, iEntries: TGLint, puRed: PGLUSHORT,
puGreen: PGLUSHORT, puBlue: PGLUSHORT): BOOL{.
dynlib: dllname, importc.}
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.}
proc wglDisableGenlockI3D*(hDC: HDC): BOOL{.dynlib: dllname, importc.}
proc wglIsEnabledGenlockI3D*(hDC: HDC, pFlag: PBOOL): BOOL{.dynlib: dllname,
importc.}
proc wglGenlockSourceI3D*(hDC: HDC, uSource: TGLuint): BOOL{.dynlib: dllname,
importc.}
proc wglGetGenlockSourceI3D*(hDC: HDC, uSource: PGLUINT): BOOL{.dynlib: dllname,
importc.}
proc wglGenlockSourceEdgeI3D*(hDC: HDC, uEdge: TGLuint): BOOL{.dynlib: dllname,
importc.}
proc wglGetGenlockSourceEdgeI3D*(hDC: HDC, uEdge: PGLUINT): BOOL{.
dynlib: dllname, importc.}
proc wglGenlockSampleRateI3D*(hDC: HDC, uRate: TGLuint): BOOL{.dynlib: dllname,
importc.}
proc wglGetGenlockSampleRateI3D*(hDC: HDC, uRate: PGLUINT): BOOL{.
dynlib: dllname, importc.}
proc wglGenlockSourceDelayI3D*(hDC: HDC, uDelay: TGLuint): BOOL{.
dynlib: dllname, importc.}
proc wglGetGenlockSourceDelayI3D*(hDC: HDC, uDelay: PGLUINT): BOOL{.
dynlib: dllname, importc.}
proc wglQueryGenlockMaxSourceDelayI3D*(hDC: HDC, uMaxLineDelay: PGLUINT,
uMaxPixelDelay: PGLUINT): BOOL{.
dynlib: dllname, importc.}
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

View File

@@ -7,17 +7,15 @@
# distribution, for details about the copyright.
#
{.compile: "pcre_all.c" .}
type
{.compile: "pcre_all.c".}
type
Pbyte = ptr byte
PPchar = ptr cstring
Pint = ptr cint
Ppcre* = ptr TPcre
Ppcre_callout_block* = ptr tpcre_callout_block
Ppcre_extra* = ptr Tpcre_extra
TPcre {.final, pure.} = object
PPcre* = ptr Tpcre
Pcallout_block* = ptr tcallout_block
Pextra* = ptr Textra
Tpcre {.final, pure.} = object
# The structure for passing additional data to pcre_exec(). This is defined
# in such as way as to be extensible.
# Bits for which fields are set
@@ -26,34 +24,34 @@ type
# Data passed back in callouts
# Const before type ignored
# Pointer to character tables
Tpcre_extra* {.final, pure.} = object
Textra*{.final, pure.} = object # The structure for passing out data via the pcre_callout_function. We use a
# structure so that new fields can be added on the end in future versions,
# without changing the API of the function, thereby allowing old clients to
# work without modification.
# Identifies version of block
# ------------------------ Version 0 -------------------------------
# Number compiled into pattern
# The offset vector
# Const before type ignored
# The subject being matched
# The length of the subject
# Offset to start of this match attempt
# Where we currently are in the subject
# Max current capture
# Most recently closed capture
# Data passed in with the call
# ------------------- Added for Version 1 --------------------------
# Offset to next item in the pattern
# Length of next item in the pattern
#
# ------------------------------------------------------------------
flags: cint
study_data: pointer
match_limit: cint
callout_data: pointer
tables: ptr byte
# The structure for passing out data via the pcre_callout_function. We use a
# structure so that new fields can be added on the end in future versions,
# without changing the API of the function, thereby allowing old clients to
# work without modification.
# Identifies version of block
# ------------------------ Version 0 -------------------------------
# Number compiled into pattern
# The offset vector
# Const before type ignored
# The subject being matched
# The length of the subject
# Offset to start of this match attempt
# Where we currently are in the subject
# Max current capture
# Most recently closed capture
# Data passed in with the call
# ------------------- Added for Version 1 --------------------------
# Offset to next item in the pattern
# Length of next item in the pattern
# ------------------------------------------------------------------
TPcre_callout_block* {.final, pure.} = object
Tcallout_block*{.final, pure.} = object
version: cint
callout_number: cint
offset_vector: ptr cint
@@ -110,7 +108,7 @@ type
# The file pcre.h is build by "configure". Do not edit it; instead
# make changes to pcre.in.
const
const
PCRE_MAJOR* = 6
PCRE_MINOR* = 3
PCRE_DATE* = "2005/11/29"
@@ -135,27 +133,27 @@ const
PCRE_DFA_RESTART* = 0x00020000
PCRE_FIRSTLINE* = 0x00040000
# Exec-time and get/set-time error codes
PCRE_ERROR_NOMATCH* = -(1)
PCRE_ERROR_NULL* = -(2)
PCRE_ERROR_BADOPTION* = -(3)
PCRE_ERROR_BADMAGIC* = -(4)
PCRE_ERROR_UNKNOWN_NODE* = -(5)
PCRE_ERROR_NOMEMORY* = -(6)
PCRE_ERROR_NOSUBSTRING* = -(7)
PCRE_ERROR_MATCHLIMIT* = -(8)
PCRE_ERROR_NOMATCH* = - (1)
PCRE_ERROR_NULL* = - (2)
PCRE_ERROR_BADOPTION* = - (3)
PCRE_ERROR_BADMAGIC* = - (4)
PCRE_ERROR_UNKNOWN_NODE* = - (5)
PCRE_ERROR_NOMEMORY* = - (6)
PCRE_ERROR_NOSUBSTRING* = - (7)
PCRE_ERROR_MATCHLIMIT* = - (8)
# Never used by PCRE itself
PCRE_ERROR_CALLOUT* = -(9)
PCRE_ERROR_BADUTF8* = -(10)
PCRE_ERROR_BADUTF8_OFFSET* = -(11)
PCRE_ERROR_PARTIAL* = -(12)
PCRE_ERROR_BADPARTIAL* = -(13)
PCRE_ERROR_INTERNAL* = -(14)
PCRE_ERROR_BADCOUNT* = -(15)
PCRE_ERROR_DFA_UITEM* = -(16)
PCRE_ERROR_DFA_UCOND* = -(17)
PCRE_ERROR_DFA_UMLIMIT* = -(18)
PCRE_ERROR_DFA_WSSIZE* = -(19)
PCRE_ERROR_DFA_RECURSE* = -(20)
PCRE_ERROR_CALLOUT* = - (9)
PCRE_ERROR_BADUTF8* = - (10)
PCRE_ERROR_BADUTF8_OFFSET* = - (11)
PCRE_ERROR_PARTIAL* = - (12)
PCRE_ERROR_BADPARTIAL* = - (13)
PCRE_ERROR_INTERNAL* = - (14)
PCRE_ERROR_BADCOUNT* = - (15)
PCRE_ERROR_DFA_UITEM* = - (16)
PCRE_ERROR_DFA_UCOND* = - (17)
PCRE_ERROR_DFA_UMLIMIT* = - (18)
PCRE_ERROR_DFA_WSSIZE* = - (19)
PCRE_ERROR_DFA_RECURSE* = - (20)
# Request types for pcre_fullinfo()
PCRE_INFO_OPTIONS* = 0
PCRE_INFO_SIZE* = 1
@@ -180,80 +178,60 @@ const
PCRE_CONFIG_STACKRECURSE* = 5
PCRE_CONFIG_UNICODE_PROPERTIES* = 6
# Bit flags for the pcre_extra structure
PCRE_EXTRA_STUDY_DATA* = 0x0001
PCRE_EXTRA_MATCH_LIMIT* = 0x0002
PCRE_EXTRA_CALLOUT_DATA* = 0x0004
PCRE_EXTRA_TABLES* = 0x0008
PCRE_EXTRA_STUDY_DATA* = 0x00000001
PCRE_EXTRA_MATCH_LIMIT* = 0x00000002
PCRE_EXTRA_CALLOUT_DATA* = 0x00000004
PCRE_EXTRA_TABLES* = 0x00000008
# Exported PCRE functions
proc pcre_compile*(para1: cstring, para2: cint, para3: ptr cstring,
para4: ptr int, para5: Pbyte): Ppcre {.
importc: "pcre_compile", noconv.}
proc pcre_compile2*(para1: cstring, para2: cint, para3: Pint, para4: PPchar,
para5: ptr int, para6: Pbyte): Ppcre {.
importc: "pcre_compile2", noconv.}
proc pcre_config*(para1: cint, para2: pointer): cint {.
importc: "pcre_config", noconv.}
proc pcre_copy_named_substring*(para1: Ppcre, para2: cstring, para3: Pint,
para4: cint, para5: cstring, para6: cstring,
para7: cint): cint {.
importc: "pcre_copy_named_substring", noconv.}
proc pcre_copy_substring*(para1: cstring, para2: Pint, para3: cint, para4: cint,
para5: cstring, para6: cint): cint {.
importc: "pcre_copy_substring", noconv.}
proc pcre_dfa_exec*(para1: Ppcre, para2: Ppcre_extra, para3: cstring,
para4: cint, para5: cint, para6: cint, para7: Pint,
para8: cint, para9: Pint, para10: cint): cint {.
importc: "pcre_dfa_exec", noconv.}
proc pcre_exec*(para1: Ppcre, para2: Ppcre_extra, para3: cstring,
para4: cint, para5: cint, para6: cint, para7: Pint,
para8: cint): cint {.importc: "pcre_exec", noconv.}
proc pcre_free_substring*(para1: cstring) {.
importc: "pcre_free_substring", noconv.}
proc pcre_free_substring_list*(para1: PPchar) {.
importc: "pcre_free_substring_list", noconv.}
proc pcre_fullinfo*(para1: Ppcre, para2: Ppcre_extra, para3: cint,
para4: pointer): cint {.importc: "pcre_fullinfo", noconv.}
proc pcre_get_named_substring*(para1: Ppcre, para2: cstring, para3: Pint,
para4: cint, para5: cstring, para6: PPchar): cint {.
importc: "pcre_get_named_substring", noconv.}
proc pcre_get_stringnumber*(para1: Ppcre, para2: cstring): cint {.
importc: "pcre_get_stringnumber", noconv.}
proc pcre_get_substring*(para1: cstring, para2: Pint, para3: cint,
para4: cint, para5: PPchar): cint {.
importc: "pcre_get_substring", noconv.}
proc pcre_get_substring_list*(para1: cstring, para2: Pint, para3: cint,
para4: ptr PPchar): cint {.
importc: "pcre_get_substring_list", noconv.}
proc pcre_info*(para1: Ppcre, para2: Pint, para3: Pint): cint {.
importc: "pcre_info", noconv.}
proc pcre_maketables*: ptr byte {.
importc: "pcre_maketables", noconv.}
proc pcre_refcount*(para1: Ppcre, para2: cint): cint {.
importc: "pcre_refcount", noconv.}
proc pcre_study*(para1: Ppcre, para2: cint,
para3: ptr CString): Ppcre_extra {.importc, noconv.}
proc pcre_version*: CString {.importc: "pcre_version", noconv.}
proc pcre_compile*(para1: cstring, para2: cint, para3: ptr cstring,
para4: ptr int, para5: Pbyte): PPcre{.importc: "pcre_compile",
noconv.}
proc pcre_compile2*(para1: cstring, para2: cint, para3: Pint, para4: PPchar,
para5: ptr int, para6: Pbyte): PPcre{.importc: "pcre_compile2",
noconv.}
proc pcre_config*(para1: cint, para2: pointer): cint{.importc: "pcre_config",
noconv.}
proc pcre_copy_named_substring*(para1: PPcre, para2: cstring, para3: Pint,
para4: cint, para5: cstring, para6: cstring,
para7: cint): cint{.
importc: "pcre_copy_named_substring", noconv.}
proc pcre_copy_substring*(para1: cstring, para2: Pint, para3: cint, para4: cint,
para5: cstring, para6: cint): cint{.
importc: "pcre_copy_substring", noconv.}
proc pcre_dfa_exec*(para1: PPcre, para2: Pextra, para3: cstring, para4: cint,
para5: cint, para6: cint, para7: Pint, para8: cint,
para9: Pint, para10: cint): cint{.importc: "pcre_dfa_exec",
noconv.}
proc pcre_exec*(para1: PPcre, para2: Pextra, para3: cstring, para4: cint,
para5: cint, para6: cint, para7: Pint, para8: cint): cint{.
importc: "pcre_exec", noconv.}
proc pcre_free_substring*(para1: cstring){.importc: "pcre_free_substring",
noconv.}
proc pcre_free_substring_list*(para1: PPchar){.
importc: "pcre_free_substring_list", noconv.}
proc pcre_fullinfo*(para1: PPcre, para2: Pextra, para3: cint, para4: pointer): cint{.
importc: "pcre_fullinfo", noconv.}
proc pcre_get_named_substring*(para1: PPcre, para2: cstring, para3: Pint,
para4: cint, para5: cstring, para6: PPchar): cint{.
importc: "pcre_get_named_substring", noconv.}
proc pcre_get_stringnumber*(para1: PPcre, para2: cstring): cint{.
importc: "pcre_get_stringnumber", noconv.}
proc pcre_get_substring*(para1: cstring, para2: Pint, para3: cint, para4: cint,
para5: PPchar): cint{.importc: "pcre_get_substring",
noconv.}
proc pcre_get_substring_list*(para1: cstring, para2: Pint, para3: cint,
para4: ptr PPchar): cint{.
importc: "pcre_get_substring_list", noconv.}
proc pcre_info*(para1: PPcre, para2: Pint, para3: Pint): cint{.importc: "pcre_info",
noconv.}
proc pcre_maketables*(): ptr byte{.importc: "pcre_maketables", noconv.}
proc pcre_refcount*(para1: PPcre, para2: cint): cint{.importc: "pcre_refcount",
noconv.}
proc pcre_study*(para1: PPcre, para2: cint, para3: ptr CString): Pextra{.
importc: "pcre_study", noconv.}
proc pcre_version*(): CString{.importc: "pcre_version", noconv.}
# Indirection for store get and free functions. These can be set to
# alternative malloc/free functions if required. Special ones are used in the
# non-recursive case for "frames". There is also an optional callout function
@@ -261,16 +239,18 @@ proc pcre_version*: CString {.importc: "pcre_version", noconv.}
#
# we use Nimrod's memory manager (but not GC!) for these functions:
type
TMalloc = proc (para1: int): pointer {.noconv.}
TFree = proc (para1: pointer) {.noconv.}
var
pcre_malloc {.importc: "pcre_malloc".}: TMalloc
pcre_free {.importc: "pcre_free".}: TFree
pcre_stack_malloc {.importc: "pcre_stack_malloc".}: TMalloc
pcre_stack_free {.importc: "pcre_stack_free".}: TFree
pcre_callout {.importc: "pcre_callout".}:
proc (para1: Ppcre_callout_block): cint {.noconv.}
type
TMalloc = proc (para1: int): pointer{.noconv.}
TFree = proc (para1: pointer){.noconv.}
var
pcre_malloc{.importc: "pcre_malloc".}: TMalloc
pcre_free{.importc: "pcre_free".}: TFree
pcre_stack_malloc{.importc: "pcre_stack_malloc".}: TMalloc
pcre_stack_free{.importc: "pcre_stack_free".}: TFree
pcre_callout{.importc: "pcre_callout".}: proc (para1: Pcallout_block): cint{.
noconv.}
pcre_malloc = cast[TMalloc](system.alloc)
pcre_free = cast[TFree](system.dealloc)

File diff suppressed because it is too large Load Diff

View File

@@ -1,386 +0,0 @@
# This module contains the definitions for structures and externs for
# functions used by frontend postgres applications. It is based on
# Postgresql's libpq-fe.h.
#
# It is for postgreSQL version 7.4 and higher with support for the v3.0
# connection-protocol.
#
{.deadCodeElim: on.}
when defined(windows):
const dllName = "pq.dll"
elif defined(macosx):
const dllName = "libpq.dylib"
else:
const dllName = "libpq.so(.5|)"
type
POid* = ptr Oid
Oid* = int32
const
ERROR_MSG_LENGTH* = 4096
CMDSTATUS_LEN* = 40
type
TSockAddr* = array[1..112, int8]
TPGresAttDesc*{.pure, final.} = object
name*: cstring
adtid*: Oid
adtsize*: int
PPGresAttDesc* = ptr TPGresAttDesc
PPPGresAttDesc* = ptr PPGresAttDesc
TPGresAttValue*{.pure, final.} = object
length*: int32
value*: cstring
PPGresAttValue* = ptr TPGresAttValue
PPPGresAttValue* = ptr PPGresAttValue
PExecStatusType* = ptr TExecStatusType
TExecStatusType* = enum
PGRES_EMPTY_QUERY = 0, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PGRES_COPY_OUT,
PGRES_COPY_IN, PGRES_BAD_RESPONSE, PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR
TPGlobjfuncs*{.pure, final.} = object
fn_lo_open*: Oid
fn_lo_close*: Oid
fn_lo_creat*: Oid
fn_lo_unlink*: Oid
fn_lo_lseek*: Oid
fn_lo_tell*: Oid
fn_lo_read*: Oid
fn_lo_write*: Oid
PPGlobjfuncs* = ptr TPGlobjfuncs
PConnStatusType* = ptr TConnStatusType
TConnStatusType* = enum
CONNECTION_OK, CONNECTION_BAD, CONNECTION_STARTED, CONNECTION_MADE,
CONNECTION_AWAITING_RESPONSE, CONNECTION_AUTH_OK, CONNECTION_SETENV,
CONNECTION_SSL_STARTUP, CONNECTION_NEEDED
TPGconn* {.pure, final.} = object
pghost*: cstring
pgtty*: cstring
pgport*: cstring
pgoptions*: cstring
dbName*: cstring
status*: TConnStatusType
errorMessage*: array[0..(ERROR_MSG_LENGTH) - 1, char]
Pfin*: TFile
Pfout*: TFile
Pfdebug*: TFile
sock*: int32
laddr*: TSockAddr
raddr*: TSockAddr
salt*: array[0..(2) - 1, char]
asyncNotifyWaiting*: int32
notifyList*: pointer
pguser*: cstring
pgpass*: cstring
lobjfuncs*: PPGlobjfuncs
PPGconn* = ptr TPGconn
TPGresult* {.pure, final.} = object
ntups*: int32
numAttributes*: int32
attDescs*: PPGresAttDesc
tuples*: PPPGresAttValue
tupArrSize*: int32
resultStatus*: TExecStatusType
cmdStatus*: array[0..(CMDSTATUS_LEN) - 1, char]
binary*: int32
conn*: PPGconn
PPGresult* = ptr TPGresult
PPostgresPollingStatusType* = ptr PostgresPollingStatusType
PostgresPollingStatusType* = enum
PGRES_POLLING_FAILED = 0, PGRES_POLLING_READING, PGRES_POLLING_WRITING,
PGRES_POLLING_OK, PGRES_POLLING_ACTIVE
PPGTransactionStatusType* = ptr PGTransactionStatusType
PGTransactionStatusType* = enum
PQTRANS_IDLE, PQTRANS_ACTIVE, PQTRANS_INTRANS, PQTRANS_INERROR,
PQTRANS_UNKNOWN
PPGVerbosity* = ptr PGVerbosity
PGVerbosity* = enum
PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE
PpgNotify* = ptr pgNotify
pgNotify* {.pure, final.} = object
relname*: cstring
be_pid*: int32
extra*: cstring
PQnoticeReceiver* = proc (arg: pointer, res: PPGresult){.cdecl.}
PQnoticeProcessor* = proc (arg: pointer, message: cstring){.cdecl.}
Ppqbool* = ptr pqbool
pqbool* = char
P_PQprintOpt* = ptr PQprintOpt
PQprintOpt* {.pure, final.} = object
header*: pqbool
align*: pqbool
standard*: pqbool
html3*: pqbool
expanded*: pqbool
pager*: pqbool
fieldSep*: cstring
tableOpt*: cstring
caption*: cstring
fieldName*: ptr cstring
P_PQconninfoOption* = ptr PQconninfoOption
PQconninfoOption* {.pure, final.} = object
keyword*: cstring
envvar*: cstring
compiled*: cstring
val*: cstring
label*: cstring
dispchar*: cstring
dispsize*: int32
PPQArgBlock* = ptr PQArgBlock
PQArgBlock* {.pure, final.} = object
length*: int32
isint*: int32
p*: pointer
proc PQconnectStart*(conninfo: cstring): PPGconn{.cdecl, dynlib: dllName,
importc: "PQconnectStart".}
proc PQconnectPoll*(conn: PPGconn): PostgresPollingStatusType{.cdecl,
dynlib: dllName, importc: "PQconnectPoll".}
proc PQconnectdb*(conninfo: cstring): PPGconn{.cdecl, dynlib: dllName,
importc: "PQconnectdb".}
proc PQsetdbLogin*(pghost: cstring, pgport: cstring, pgoptions: cstring,
pgtty: cstring, dbName: cstring, login: cstring, pwd: cstring): PPGconn{.
cdecl, dynlib: dllName, importc: "PQsetdbLogin".}
proc PQsetdb*(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): ppgconn
proc PQfinish*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQfinish".}
proc PQconndefaults*(): PPQconninfoOption{.cdecl, dynlib: dllName,
importc: "PQconndefaults".}
proc PQconninfoFree*(connOptions: PPQconninfoOption){.cdecl, dynlib: dllName,
importc: "PQconninfoFree".}
proc PQresetStart*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQresetStart".}
proc PQresetPoll*(conn: PPGconn): PostgresPollingStatusType{.cdecl,
dynlib: dllName, importc: "PQresetPoll".}
proc PQreset*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQreset".}
proc PQrequestCancel*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQrequestCancel".}
proc PQdb*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQdb".}
proc PQuser*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQuser".}
proc PQpass*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQpass".}
proc PQhost*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQhost".}
proc PQport*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQport".}
proc PQtty*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQtty".}
proc PQoptions*(conn: PPGconn): cstring{.cdecl, dynlib: dllName,
importc: "PQoptions".}
proc PQstatus*(conn: PPGconn): TConnStatusType{.cdecl, dynlib: dllName,
importc: "PQstatus".}
proc PQtransactionStatus*(conn: PPGconn): PGTransactionStatusType{.cdecl,
dynlib: dllName, importc: "PQtransactionStatus".}
proc PQparameterStatus*(conn: PPGconn, paramName: cstring): cstring{.cdecl,
dynlib: dllName, importc: "PQparameterStatus".}
proc PQprotocolVersion*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQprotocolVersion".}
proc PQerrorMessage*(conn: PPGconn): cstring{.cdecl, dynlib: dllName,
importc: "PQerrorMessage".}
proc PQsocket*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQsocket".}
proc PQbackendPID*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQbackendPID".}
proc PQclientEncoding*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQclientEncoding".}
proc PQsetClientEncoding*(conn: PPGconn, encoding: cstring): int32{.cdecl,
dynlib: dllName, importc: "PQsetClientEncoding".}
when defined(USE_SSL):
# Get the SSL structure associated with a connection
proc PQgetssl*(conn: PPGconn): PSSL{.cdecl, dynlib: dllName,
importc: "PQgetssl".}
proc PQsetErrorVerbosity*(conn: PPGconn, verbosity: PGVerbosity): PGVerbosity{.
cdecl, dynlib: dllName, importc: "PQsetErrorVerbosity".}
proc PQtrace*(conn: PPGconn, debug_port: TFile){.cdecl, dynlib: dllName,
importc: "PQtrace".}
proc PQuntrace*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQuntrace".}
proc PQsetNoticeReceiver*(conn: PPGconn, theProc: PQnoticeReceiver,
arg: pointer): PQnoticeReceiver {.
cdecl, dynlib: dllName, importc: "PQsetNoticeReceiver".}
proc PQsetNoticeProcessor*(conn: PPGconn, theProc: PQnoticeProcessor,
arg: pointer): PQnoticeProcessor{.
cdecl, dynlib: dllName, importc: "PQsetNoticeProcessor".}
proc PQexec*(conn: PPGconn, query: cstring): PPGresult{.cdecl, dynlib: dllName,
importc: "PQexec".}
proc PQexecParams*(conn: PPGconn, command: cstring, nParams: int32,
paramTypes: POid, paramValues: cstringArray,
paramLengths, paramFormats: ptr int32,
resultFormat: int32): PPGresult {.cdecl, dynlib: dllName,
importc: "PQexecParams".}
proc PQexecPrepared*(conn: PPGconn, stmtName: cstring, nParams: int32,
paramValues: cstringArray,
paramLengths, paramFormats: ptr int32,
resultFormat: int32): PPGresult {.
cdecl, dynlib: dllName, importc: "PQexecPrepared".}
proc PQsendQuery*(conn: PPGconn, query: cstring): int32{.cdecl, dynlib: dllName,
importc: "PQsendQuery".}
proc PQsendQueryParams*(conn: PPGconn, command: cstring, nParams: int32,
paramTypes: POid, paramValues: cstringArray,
paramLengths, paramFormats: ptr int32,
resultFormat: int32): int32 {.cdecl, dynlib: dllName,
importc: "PQsendQueryParams".}
proc PQsendQueryPrepared*(conn: PPGconn, stmtName: cstring, nParams: int32,
paramValues: cstringArray,
paramLengths, paramFormats: ptr int32,
resultFormat: int32): int32{.
cdecl, dynlib: dllName, importc: "PQsendQueryPrepared".}
proc PQgetResult*(conn: PPGconn): PPGresult{.cdecl, dynlib: dllName,
importc: "PQgetResult".}
proc PQisBusy*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQisBusy".}
proc PQconsumeInput*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQconsumeInput".}
proc PQnotifies*(conn: PPGconn): PPGnotify{.cdecl, dynlib: dllName,
importc: "PQnotifies".}
proc PQputCopyData*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{.
cdecl, dynlib: dllName, importc: "PQputCopyData".}
proc PQputCopyEnd*(conn: PPGconn, errormsg: cstring): int32{.cdecl,
dynlib: dllName, importc: "PQputCopyEnd".}
proc PQgetCopyData*(conn: PPGconn, buffer: cstringArray, async: int32): int32{.cdecl,
dynlib: dllName, importc: "PQgetCopyData".}
proc PQgetline*(conn: PPGconn, str: cstring, len: int32): int32{.cdecl,
dynlib: dllName, importc: "PQgetline".}
proc PQputline*(conn: PPGconn, str: cstring): int32{.cdecl, dynlib: dllName,
importc: "PQputline".}
proc PQgetlineAsync*(conn: PPGconn, buffer: cstring, bufsize: int32): int32{.
cdecl, dynlib: dllName, importc: "PQgetlineAsync".}
proc PQputnbytes*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{.cdecl,
dynlib: dllName, importc: "PQputnbytes".}
proc PQendcopy*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQendcopy".}
proc PQsetnonblocking*(conn: PPGconn, arg: int32): int32{.cdecl,
dynlib: dllName, importc: "PQsetnonblocking".}
proc PQisnonblocking*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
importc: "PQisnonblocking".}
proc PQflush*(conn: PPGconn): int32{.cdecl, dynlib: dllName, importc: "PQflush".}
proc PQfn*(conn: PPGconn, fnid: int32, result_buf,
result_len: ptr int32, result_is_int: int32, args: PPQArgBlock,
nargs: int32): PPGresult{.cdecl, dynlib: dllName, importc: "PQfn".}
proc PQresultStatus*(res: PPGresult): TExecStatusType{.cdecl, dynlib: dllName,
importc: "PQresultStatus".}
proc PQresStatus*(status: TExecStatusType): cstring{.cdecl, dynlib: dllName,
importc: "PQresStatus".}
proc PQresultErrorMessage*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
importc: "PQresultErrorMessage".}
proc PQresultErrorField*(res: PPGresult, fieldcode: int32): cstring{.cdecl,
dynlib: dllName, importc: "PQresultErrorField".}
proc PQntuples*(res: PPGresult): int32{.cdecl, dynlib: dllName,
importc: "PQntuples".}
proc PQnfields*(res: PPGresult): int32{.cdecl, dynlib: dllName,
importc: "PQnfields".}
proc PQbinaryTuples*(res: PPGresult): int32{.cdecl, dynlib: dllName,
importc: "PQbinaryTuples".}
proc PQfname*(res: PPGresult, field_num: int32): cstring{.cdecl,
dynlib: dllName, importc: "PQfname".}
proc PQfnumber*(res: PPGresult, field_name: cstring): int32{.cdecl,
dynlib: dllName, importc: "PQfnumber".}
proc PQftable*(res: PPGresult, field_num: int32): Oid{.cdecl, dynlib: dllName,
importc: "PQftable".}
proc PQftablecol*(res: PPGresult, field_num: int32): int32{.cdecl,
dynlib: dllName, importc: "PQftablecol".}
proc PQfformat*(res: PPGresult, field_num: int32): int32{.cdecl,
dynlib: dllName, importc: "PQfformat".}
proc PQftype*(res: PPGresult, field_num: int32): Oid{.cdecl, dynlib: dllName,
importc: "PQftype".}
proc PQfsize*(res: PPGresult, field_num: int32): int32{.cdecl, dynlib: dllName,
importc: "PQfsize".}
proc PQfmod*(res: PPGresult, field_num: int32): int32{.cdecl, dynlib: dllName,
importc: "PQfmod".}
proc PQcmdStatus*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
importc: "PQcmdStatus".}
proc PQoidStatus*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
importc: "PQoidStatus".}
proc PQoidValue*(res: PPGresult): Oid{.cdecl, dynlib: dllName,
importc: "PQoidValue".}
proc PQcmdTuples*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
importc: "PQcmdTuples".}
proc PQgetvalue*(res: PPGresult, tup_num: int32, field_num: int32): cstring{.
cdecl, dynlib: dllName, importc: "PQgetvalue".}
proc PQgetlength*(res: PPGresult, tup_num: int32, field_num: int32): int32{.
cdecl, dynlib: dllName, importc: "PQgetlength".}
proc PQgetisnull*(res: PPGresult, tup_num: int32, field_num: int32): int32{.
cdecl, dynlib: dllName, importc: "PQgetisnull".}
proc PQclear*(res: PPGresult){.cdecl, dynlib: dllName, importc: "PQclear".}
proc PQfreemem*(p: pointer){.cdecl, dynlib: dllName, importc: "PQfreemem".}
proc PQmakeEmptyPGresult*(conn: PPGconn, status: TExecStatusType): PPGresult{.
cdecl, dynlib: dllName, importc: "PQmakeEmptyPGresult".}
proc PQescapeString*(till, `from`: cstring, len: int): int{.cdecl,
dynlib: dllName, importc: "PQescapeString".}
proc PQescapeBytea*(bintext: cstring, binlen: int,
bytealen: var int): cstring{.
cdecl, dynlib: dllName, importc: "PQescapeBytea".}
proc PQunescapeBytea*(strtext: cstring, retbuflen: var int): cstring{.cdecl,
dynlib: dllName, importc: "PQunescapeBytea".}
proc PQprint*(fout: TFile, res: PPGresult, ps: PPQprintOpt){.cdecl,
dynlib: dllName, importc: "PQprint".}
proc PQdisplayTuples*(res: PPGresult, fp: TFile, fillAlign: int32,
fieldSep: cstring, printHeader: int32, quiet: int32){.
cdecl, dynlib: dllName, importc: "PQdisplayTuples".}
proc PQprintTuples*(res: PPGresult, fout: TFile, printAttName: int32,
terseOutput: int32, width: int32){.cdecl, dynlib: dllName,
importc: "PQprintTuples".}
proc lo_open*(conn: PPGconn, lobjId: Oid, mode: int32): int32{.cdecl,
dynlib: dllName, importc: "lo_open".}
proc lo_close*(conn: PPGconn, fd: int32): int32{.cdecl, dynlib: dllName,
importc: "lo_close".}
proc lo_read*(conn: PPGconn, fd: int32, buf: cstring, length: int): int32{.
cdecl, dynlib: dllName, importc: "lo_read".}
proc lo_write*(conn: PPGconn, fd: int32, buf: cstring, length: int): int32{.
cdecl, dynlib: dllName, importc: "lo_write".}
proc lo_lseek*(conn: PPGconn, fd: int32, offset: int32, whence: int32): int32{.
cdecl, dynlib: dllName, importc: "lo_lseek".}
proc lo_creat*(conn: PPGconn, mode: int32): Oid{.cdecl, dynlib: dllName,
importc: "lo_creat".}
proc lo_tell*(conn: PPGconn, fd: int32): int32{.cdecl, dynlib: dllName,
importc: "lo_tell".}
proc lo_unlink*(conn: PPGconn, lobjId: Oid): int32{.cdecl, dynlib: dllName,
importc: "lo_unlink".}
proc lo_import*(conn: PPGconn, filename: cstring): Oid{.cdecl, dynlib: dllName,
importc: "lo_import".}
proc lo_export*(conn: PPGconn, lobjId: Oid, filename: cstring): int32{.cdecl,
dynlib: dllName, importc: "lo_export".}
proc PQmblen*(s: cstring, encoding: int32): int32{.cdecl, dynlib: dllName,
importc: "PQmblen".}
proc PQenv2encoding*(): int32{.cdecl, dynlib: dllName, importc: "PQenv2encoding".}
proc PQsetdb(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): ppgconn =
result = PQsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, "", "")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,421 +0,0 @@
#
# $Id: sdl_gfx.pas,v 1.3 2007/05/29 21:31:04 savage Exp $
#
#
#
# $Log: sdl_gfx.pas,v $
# Revision 1.3 2007/05/29 21:31:04 savage
# Changes as suggested by Almindor for 64bit compatibility.
#
# Revision 1.2 2007/05/20 20:30:18 savage
# Initial Changes to Handle 64 Bits
#
# Revision 1.1 2005/01/03 19:08:32 savage
# Header for the SDL_Gfx library.
#
#
#
#
import
sdl
when defined(windows):
const SDLgfxLibName = "SDL_gfx.dll"
elif defined(macosx):
const SDLgfxLibName = "libSDL_gfx.dylib"
else:
const SDLgfxLibName = "libSDL_gfx.so"
const # Some rates in Hz
FPS_UPPER_LIMIT* = 200
FPS_LOWER_LIMIT* = 1
FPS_DEFAULT* = 30 # ---- Defines
SMOOTHING_OFF* = 0
SMOOTHING_ON* = 1
type
PFPSmanager* = ptr TFPSmanager
TFPSmanager*{.final.} = object # ---- Structures
framecount*: Uint32
rateticks*: float32
lastticks*: Uint32
rate*: Uint32
PColorRGBA* = ptr TColorRGBA
TColorRGBA*{.final.} = object
r*: Uint8
g*: Uint8
b*: Uint8
a*: Uint8
PColorY* = ptr TColorY
TColorY*{.final.} = object #
#
# SDL_framerate: framerate manager
#
# LGPL (c) A. Schiffler
#
#
y*: Uint8
proc SDL_initFramerate*(manager: PFPSmanager){.cdecl, importc, dynlib: SDLgfxLibName.}
proc SDL_setFramerate*(manager: PFPSmanager, rate: int): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
proc SDL_getFramerate*(manager: PFPSmanager): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc SDL_framerateDelay*(manager: PFPSmanager){.cdecl, importc, dynlib: SDLgfxLibName.}
#
#
# SDL_gfxPrimitives: graphics primitives for SDL
#
# LGPL (c) A. Schiffler
#
#
# Note: all ___Color routines expect the color to be in format 0xRRGGBBAA
# Pixel
proc pixelColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, color: Uint32): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
proc pixelRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, r: Uint8, g: Uint8,
b: Uint8, a: Uint8): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# Horizontal line
proc hlineColor*(dst: PSDL_Surface, x1: Sint16, x2: Sint16, y: Sint16,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc hlineRGBA*(dst: PSDL_Surface, x1: Sint16, x2: Sint16, y: Sint16, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# Vertical line
proc vlineColor*(dst: PSDL_Surface, x: Sint16, y1: Sint16, y2: Sint16,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc vlineRGBA*(dst: PSDL_Surface, x: Sint16, y1: Sint16, y2: Sint16, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# Rectangle
proc rectangleColor*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, color: Uint32): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
proc rectangleRGBA*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# Filled rectangle (Box)
proc boxColor*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc boxRGBA*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16, y2: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# Line
proc lineColor*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc lineRGBA*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# AA Line
proc aalineColor*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc aalineRGBA*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# Circle
proc circleColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, r: Sint16,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc circleRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, rad: Sint16, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# AA Circle
proc aacircleColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, r: Sint16,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc aacircleRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, rad: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# Filled Circle
proc filledCircleColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, r: Sint16,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc filledCircleRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, rad: Sint16,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# Ellipse
proc ellipseColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, rx: Sint16,
ry: Sint16, color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc ellipseRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, rx: Sint16,
ry: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# AA Ellipse
proc aaellipseColor*(dst: PSDL_Surface, xc: Sint16, yc: Sint16, rx: Sint16,
ry: Sint16, color: Uint32): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
proc aaellipseRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, rx: Sint16,
ry: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# Filled Ellipse
proc filledEllipseColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, rx: Sint16,
ry: Sint16, color: Uint32): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
proc filledEllipseRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, rx: Sint16,
ry: Sint16, r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# Pie
proc pieColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, rad: Sint16,
start: Sint16, finish: Sint16, color: Uint32): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
proc pieRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, rad: Sint16,
start: Sint16, finish: Sint16, r: Uint8, g: Uint8, b: Uint8,
a: Uint8): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# Filled Pie
proc filledPieColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, rad: Sint16,
start: Sint16, finish: Sint16, color: Uint32): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
proc filledPieRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, rad: Sint16,
start: Sint16, finish: Sint16, r: Uint8, g: Uint8, b: Uint8,
a: Uint8): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# Trigon
proc trigonColor*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, color: Uint32): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
proc trigonRGBA*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, r: Uint8, g: Uint8,
b: Uint8, a: Uint8): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# AA-Trigon
proc aatrigonColor*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, color: Uint32): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
proc aatrigonRGBA*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, r: Uint8, g: Uint8,
b: Uint8, a: Uint8): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# Filled Trigon
proc filledTrigonColor*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, color: Uint32): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
proc filledTrigonRGBA*(dst: PSDL_Surface, x1: Sint16, y1: Sint16, x2: Sint16,
y2: Sint16, x3: Sint16, y3: Sint16, r: Uint8, g: Uint8,
b: Uint8, a: Uint8): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# Polygon
proc polygonColor*(dst: PSDL_Surface, vx: PSint16, vy: PSint16, n: int,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc polygonRGBA*(dst: PSDL_Surface, vx: PSint16, vy: PSint16, n: int, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# AA-Polygon
proc aapolygonColor*(dst: PSDL_Surface, vx: PSint16, vy: PSint16, n: int,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc aapolygonRGBA*(dst: PSDL_Surface, vx: PSint16, vy: PSint16, n: int,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# Filled Polygon
proc filledPolygonColor*(dst: PSDL_Surface, vx: PSint16, vy: PSint16, n: int,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc filledPolygonRGBA*(dst: PSDL_Surface, vx: PSint16, vy: PSint16, n: int,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# Bezier
# s = number of steps
proc bezierColor*(dst: PSDL_Surface, vx: PSint16, vy: PSint16, n: int, s: int,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc bezierRGBA*(dst: PSDL_Surface, vx: PSint16, vy: PSint16, n: int, s: int,
r: Uint8, g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# Characters/Strings
proc characterColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, c: char,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc characterRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, c: char, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
proc stringColor*(dst: PSDL_Surface, x: Sint16, y: Sint16, c: cstring,
color: Uint32): int{.cdecl, importc, dynlib: SDLgfxLibName.}
proc stringRGBA*(dst: PSDL_Surface, x: Sint16, y: Sint16, c: cstring, r: Uint8,
g: Uint8, b: Uint8, a: Uint8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
proc gfxPrimitivesSetFont*(fontdata: Pointer, cw: int, ch: int){.cdecl,
importc, dynlib: SDLgfxLibName.}
#
#
# SDL_imageFilter - bytes-image "filter" routines
# (uses inline x86 MMX optimizations if available)
#
# LGPL (c) A. Schiffler
#
#
# Comments:
# 1.) MMX functions work best if all data blocks are aligned on a 32 bytes boundary.
# 2.) Data that is not within an 8 byte boundary is processed using the C routine.
# 3.) Convolution routines do not have C routines at this time.
# Detect MMX capability in CPU
proc SDL_imageFilterMMXdetect*(): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# Force use of MMX off (or turn possible use back on)
proc SDL_imageFilterMMXoff*(){.cdecl, importc, dynlib: SDLgfxLibName.}
proc SDL_imageFilterMMXon*(){.cdecl, importc, dynlib: SDLgfxLibName.}
#
# All routines return:
# 0 OK
# -1 Error (internal error, parameter error)
#
# SDL_imageFilterAdd: D = saturation255(S1 + S2)
proc SDL_imageFilterAdd*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterMean: D = S1/2 + S2/2
proc SDL_imageFilterMean*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterSub: D = saturation0(S1 - S2)
proc SDL_imageFilterSub*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterAbsDiff: D = | S1 - S2 |
proc SDL_imageFilterAbsDiff*(Src1: cstring, Src2: cstring, Dest: cstring,
len: int): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterMult: D = saturation(S1 * S2)
proc SDL_imageFilterMult*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterMultNor: D = S1 * S2 (non-MMX)
proc SDL_imageFilterMultNor*(Src1: cstring, Src2: cstring, Dest: cstring,
len: int): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterMultDivby2: D = saturation255(S1/2 * S2)
proc SDL_imageFilterMultDivby2*(Src1: cstring, Src2: cstring, Dest: cstring,
len: int): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterMultDivby4: D = saturation255(S1/2 * S2/2)
proc SDL_imageFilterMultDivby4*(Src1: cstring, Src2: cstring, Dest: cstring,
len: int): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterBitAnd: D = S1 & S2
proc SDL_imageFilterBitAnd*(Src1: cstring, Src2: cstring, Dest: cstring,
len: int): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterBitOr: D = S1 | S2
proc SDL_imageFilterBitOr*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterDiv: D = S1 / S2 (non-MMX)
proc SDL_imageFilterDiv*(Src1: cstring, Src2: cstring, Dest: cstring, len: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterBitNegation: D = !S
proc SDL_imageFilterBitNegation*(Src1: cstring, Dest: cstring, len: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterAddByte: D = saturation255(S + C)
proc SDL_imageFilterAddByte*(Src1: cstring, Dest: cstring, len: int, C: char): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterAddUint: D = saturation255(S + (uint)C)
proc SDL_imageFilterAddUint*(Src1: cstring, Dest: cstring, len: int, C: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterAddByteToHalf: D = saturation255(S/2 + C)
proc SDL_imageFilterAddByteToHalf*(Src1: cstring, Dest: cstring, len: int,
C: char): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterSubByte: D = saturation0(S - C)
proc SDL_imageFilterSubByte*(Src1: cstring, Dest: cstring, len: int, C: char): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterSubUint: D = saturation0(S - (uint)C)
proc SDL_imageFilterSubUint*(Src1: cstring, Dest: cstring, len: int, C: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterShiftRight: D = saturation0(S >> N)
proc SDL_imageFilterShiftRight*(Src1: cstring, Dest: cstring, len: int, N: char): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterShiftRightUint: D = saturation0((uint)S >> N)
proc SDL_imageFilterShiftRightUint*(Src1: cstring, Dest: cstring, len: int,
N: char): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterMultByByte: D = saturation255(S * C)
proc SDL_imageFilterMultByByte*(Src1: cstring, Dest: cstring, len: int, C: char): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterShiftRightAndMultByByte: D = saturation255((S >> N) * C)
proc SDL_imageFilterShiftRightAndMultByByte*(Src1: cstring, Dest: cstring,
len: int, N: char, C: char): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterShiftLeftByte: D = (S << N)
proc SDL_imageFilterShiftLeftByte*(Src1: cstring, Dest: cstring, len: int,
N: char): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterShiftLeftUint: D = ((uint)S << N)
proc SDL_imageFilterShiftLeftUint*(Src1: cstring, Dest: cstring, len: int,
N: char): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterShiftLeft: D = saturation255(S << N)
proc SDL_imageFilterShiftLeft*(Src1: cstring, Dest: cstring, len: int, N: char): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterBinarizeUsingThreshold: D = S >= T ? 255:0
proc SDL_imageFilterBinarizeUsingThreshold*(Src1: cstring, Dest: cstring,
len: int, T: char): int{.cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterClipToRange: D = (S >= Tmin) & (S <= Tmax) 255:0
proc SDL_imageFilterClipToRange*(Src1: cstring, Dest: cstring, len: int,
Tmin: int8, Tmax: int8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterNormalizeLinear: D = saturation255((Nmax - Nmin)/(Cmax - Cmin)*(S - Cmin) + Nmin)
proc SDL_imageFilterNormalizeLinear*(Src1: cstring, Dest: cstring, len: int,
Cmin: int, Cmax: int, Nmin: int, Nmax: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# !!! NO C-ROUTINE FOR THESE FUNCTIONS YET !!!
# SDL_imageFilterConvolveKernel3x3Divide: Dij = saturation0and255( ... )
proc SDL_imageFilterConvolveKernel3x3Divide*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, Divisor: int8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterConvolveKernel5x5Divide: Dij = saturation0and255( ... )
proc SDL_imageFilterConvolveKernel5x5Divide*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, Divisor: int8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterConvolveKernel7x7Divide: Dij = saturation0and255( ... )
proc SDL_imageFilterConvolveKernel7x7Divide*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, Divisor: int8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterConvolveKernel9x9Divide: Dij = saturation0and255( ... )
proc SDL_imageFilterConvolveKernel9x9Divide*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, Divisor: int8): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterConvolveKernel3x3ShiftRight: Dij = saturation0and255( ... )
proc SDL_imageFilterConvolveKernel3x3ShiftRight*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, NRightShift: char): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterConvolveKernel5x5ShiftRight: Dij = saturation0and255( ... )
proc SDL_imageFilterConvolveKernel5x5ShiftRight*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, NRightShift: char): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterConvolveKernel7x7ShiftRight: Dij = saturation0and255( ... )
proc SDL_imageFilterConvolveKernel7x7ShiftRight*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, NRightShift: char): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterConvolveKernel9x9ShiftRight: Dij = saturation0and255( ... )
proc SDL_imageFilterConvolveKernel9x9ShiftRight*(Src: cstring, Dest: cstring,
rows: int, columns: int, Kernel: PShortInt, NRightShift: char): int{.cdecl,
importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterSobelX: Dij = saturation255( ... )
proc SDL_imageFilterSobelX*(Src: cstring, Dest: cstring, rows: int, columns: int): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# SDL_imageFilterSobelXShiftRight: Dij = saturation255( ... )
proc SDL_imageFilterSobelXShiftRight*(Src: cstring, Dest: cstring, rows: int,
columns: int, NRightShift: char): int{.
cdecl, importc, dynlib: SDLgfxLibName.}
# Align/restore stack to 32 byte boundary -- Functionality untested! --
proc SDL_imageFilterAlignStack*(){.cdecl, importc, dynlib: SDLgfxLibName.}
proc SDL_imageFilterRestoreStack*(){.cdecl, importc, dynlib: SDLgfxLibName.}
#
#
# SDL_rotozoom - rotozoomer
#
# LGPL (c) A. Schiffler
#
#
#
#
# rotozoomSurface()
#
# Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
# 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1
# then the destination 32bit surface is anti-aliased. If the surface is not 8bit
# or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
#
#
proc rotozoomSurface*(src: PSDL_Surface, angle: float64, zoom: float64,
smooth: int): PSDL_Surface{.cdecl, importc, dynlib: SDLgfxLibName.}
proc rotozoomSurfaceXY*(src: PSDL_Surface, angle: float64, zoomx: float64,
zoomy: float64, smooth: int): PSDL_Surface{.cdecl,
importc, dynlib: SDLgfxLibName.}
# Returns the size of the target surface for a rotozoomSurface() call
proc rotozoomSurfaceSize*(width: int, height: int, angle: float64,
zoom: float64, dstwidth: var int, dstheight: var int){.
cdecl, importc, dynlib: SDLgfxLibName.}
proc rotozoomSurfaceSizeXY*(width: int, height: int, angle: float64,
zoomx: float64, zoomy: float64, dstwidth: var int,
dstheight: var int){.cdecl, importc, dynlib: SDLgfxLibName.}
#
#
# zoomSurface()
#
# Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
# 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1
# then the destination 32bit surface is anti-aliased. If the surface is not 8bit
# or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.
#
#
proc zoomSurface*(src: PSDL_Surface, zoomx: float64, zoomy: float64, smooth: int): PSDL_Surface{.
cdecl, importc, dynlib: SDLgfxLibName.}
# Returns the size of the target surface for a zoomSurface() call
proc zoomSurfaceSize*(width: int, height: int, zoomx: float64, zoomy: float64,
dstwidth: var int, dstheight: var int){.cdecl,
importc, dynlib: SDLgfxLibName.}
# implementation

View File

@@ -1,227 +0,0 @@
#
# $Id: sdl_image.pas,v 1.14 2007/05/29 21:31:13 savage Exp $
#
#
#******************************************************************************
#
# Borland Delphi SDL_Image - An example image loading library for use
# with SDL
# Conversion of the Simple DirectMedia Layer Image Headers
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : SDL_image.h
#
# The initial developer of this Pascal code was :
# Matthias Thoma <ma.thoma@gmx.de>
#
# Portions created by Matthias Thoma are
# Copyright (C) 2000 - 2001 Matthias Thoma.
#
#
# Contributor(s)
# --------------
# Dominique Louis <Dominique@SavageSoftware.com.au>
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
# A simple library to load images of various formats as SDL surfaces
#
# Requires
# --------
# SDL.pas in your search path.
#
# Programming Notes
# -----------------
# See the Aliens Demo on how to make use of this libaray
#
# Revision History
# ----------------
# April 02 2001 - MT : Initial Translation
#
# May 08 2001 - DL : Added ExternalSym derectives and copyright header
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 08 2003 - MK : Aka Mr Kroket - Added Better FPC support
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: sdl_image.pas,v $
# Revision 1.14 2007/05/29 21:31:13 savage
# Changes as suggested by Almindor for 64bit compatibility.
#
# Revision 1.13 2007/05/20 20:30:54 savage
# Initial Changes to Handle 64 Bits
#
# Revision 1.12 2006/12/02 00:14:40 savage
# Updated to latest version
#
# Revision 1.11 2005/04/10 18:22:59 savage
# Changes as suggested by Michalis, thanks.
#
# Revision 1.10 2005/04/10 11:48:33 savage
# Changes as suggested by Michalis, thanks.
#
# Revision 1.9 2005/01/05 01:47:07 savage
# Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
#
# Revision 1.8 2005/01/04 23:14:44 savage
# Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
#
# Revision 1.7 2005/01/01 02:03:12 savage
# Updated to v1.2.4
#
# Revision 1.6 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.5 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.4 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.3 2004/04/01 20:53:23 savage
# Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/14 23:35:42 savage
# version 1 of sdl_image, sdl_mixer and smpeg.
#
#
#
#******************************************************************************
import
sdl
when defined(windows):
const SDL_ImageLibName = "SDL_Image.dll"
elif defined(macosx):
const SDL_ImageLibName = "libSDL_image-1.2.0.dylib"
else:
const SDL_ImageLibName = "libSDL_image.so"
const
SDL_IMAGE_MAJOR_VERSION* = 1'i8
SDL_IMAGE_MINOR_VERSION* = 2'i8
SDL_IMAGE_PATCHLEVEL* = 5'i8
# This macro can be used to fill a version structure with the compile-time
# version of the SDL_image library.
proc SDL_IMAGE_VERSION*(X: var TSDL_Version)
# This function gets the version of the dynamically linked SDL_image library.
# it should NOT be used to fill a version structure, instead you should
# use the SDL_IMAGE_VERSION() macro.
#
proc IMG_Linked_Version*(): PSDL_version{.importc, dynlib: SDL_ImageLibName.}
# Load an image from an SDL data source.
# The 'type' may be one of: "BMP", "GIF", "PNG", etc.
#
# If the image format supports a transparent pixel, SDL will set the
# colorkey for the surface. You can enable RLE acceleration on the
# surface afterwards by calling:
# SDL_SetColorKey(image, SDL_RLEACCEL, image.format.colorkey);
#
proc IMG_LoadTyped_RW*(src: PSDL_RWops, freesrc: int, theType: cstring): PSDL_Surface{.
cdecl, importc, dynlib: SDL_ImageLibName.}
# Convenience functions
proc IMG_Load*(theFile: cstring): PSDL_Surface{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_Load_RW*(src: PSDL_RWops, freesrc: int): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
# Invert the alpha of a surface for use with OpenGL
# This function is now a no-op, and only provided for backwards compatibility.
proc IMG_InvertAlpha*(theOn: int): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
# Functions to detect a file type, given a seekable source
proc IMG_isBMP*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isGIF*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isJPG*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isLBM*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isPCX*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isPNG*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isPNM*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isTIF*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isXCF*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isXPM*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
proc IMG_isXV*(src: PSDL_RWops): int{.cdecl, importc, dynlib: SDL_ImageLibName.}
# Individual loading functions
proc IMG_LoadBMP_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadGIF_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadJPG_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadLBM_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadPCX_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadPNM_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadPNG_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadTGA_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadTIF_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadXCF_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadXPM_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_LoadXV_RW*(src: PSDL_RWops): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
proc IMG_ReadXPMFromArray*(xpm: cstringArray): PSDL_Surface{.cdecl,
importc, dynlib: SDL_ImageLibName.}
# Error Macros
# We'll use SDL for reporting errors
proc IMG_SetError*(fmt: cstring)
proc IMG_GetError*(): cstring
# implementation
proc SDL_IMAGE_VERSION(X: var TSDL_Version) =
X.major = SDL_IMAGE_MAJOR_VERSION
X.minor = SDL_IMAGE_MINOR_VERSION
X.patch = SDL_IMAGE_PATCHLEVEL
proc IMG_SetError(fmt: cstring) =
SDL_SetError(fmt)
proc IMG_GetError(): cstring =
result = SDL_GetError()

View File

@@ -1,737 +0,0 @@
#******************************************************************************
#
# $Id: sdl_mixer.pas,v 1.18 2007/05/29 21:31:44 savage Exp $
#
#
#
# Borland Delphi SDL_Mixer - Simple DirectMedia Layer Mixer Library
# Conversion of the Simple DirectMedia Layer Headers
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : SDL_mixer.h
# music_cmd.h
# wavestream.h
# timidity.h
# playmidi.h
# music_ogg.h
# mikmod.h
#
# The initial developer of this Pascal code was :
# Dominqiue Louis <Dominique@SavageSoftware.com.au>
#
# Portions created by Dominqiue Louis are
# Copyright (C) 2000 - 2001 Dominqiue Louis.
#
#
# Contributor(s)
# --------------
# Matthias Thoma <ma.thoma@gmx.de>
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
#
#
#
#
#
#
#
# Requires
# --------
# SDL.pas & SMPEG.pas somewhere within your search path.
#
# Programming Notes
# -----------------
# See the Aliens Demo to see how this library is used
#
# Revision History
# ----------------
# April 02 2001 - DL : Initial Translation
#
# February 02 2002 - DL : Update to version 1.2.1
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: sdl_mixer.pas,v $
# Revision 1.18 2007/05/29 21:31:44 savage
# Changes as suggested by Almindor for 64bit compatibility.
#
# Revision 1.17 2007/05/20 20:31:17 savage
# Initial Changes to Handle 64 Bits
#
# Revision 1.16 2006/12/02 00:16:17 savage
# Updated to latest version
#
# Revision 1.15 2005/04/10 11:48:33 savage
# Changes as suggested by Michalis, thanks.
#
# Revision 1.14 2005/02/24 20:20:07 savage
# Changed definition of MusicType and added GetMusicType function
#
# Revision 1.13 2005/01/05 01:47:09 savage
# Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
#
# Revision 1.12 2005/01/04 23:14:56 savage
# Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
#
# Revision 1.11 2005/01/01 02:05:19 savage
# Updated to v1.2.6
#
# Revision 1.10 2004/09/12 21:45:17 savage
# Robert Reed spotted that Mix_SetMusicPosition was missing from the conversion, so this has now been added.
#
# Revision 1.9 2004/08/27 21:48:24 savage
# IFDEFed out Smpeg support on MacOS X
#
# Revision 1.8 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.7 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.6 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.5 2004/04/01 20:53:23 savage
# Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.4 2004/03/31 22:20:02 savage
# Windows unit not used in this file, so it was removed to keep the code tidy.
#
# Revision 1.3 2004/03/31 10:05:08 savage
# Better defines for Endianess under FreePascal and Borland compilers.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/14 23:35:42 savage
# version 1 of sdl_image, sdl_mixer and smpeg.
#
#
#
#******************************************************************************
import
sdl, smpeg
when defined(windows):
const SDL_MixerLibName = "SDL_mixer.dll"
elif defined(macosx):
const SDL_MixerLibName = "libSDL_mixer-1.2.0.dylib"
else:
const SDL_MixerLibName = "libSDL_mixer.so"
const
SDL_MIXER_MAJOR_VERSION* = 1'i8
SDL_MIXER_MINOR_VERSION* = 2'i8
SDL_MIXER_PATCHLEVEL* = 7'i8 # Backwards compatibility
MIX_MAJOR_VERSION* = SDL_MIXER_MAJOR_VERSION
MIX_MINOR_VERSION* = SDL_MIXER_MINOR_VERSION
MIX_PATCHLEVEL* = SDL_MIXER_PATCHLEVEL # SDL_Mixer.h constants
# The default mixer has 8 simultaneous mixing channels
MIX_CHANNELS* = 8 # Good default values for a PC soundcard
MIX_DEFAULT_FREQUENCY* = 22050
when defined(IA32):
const
MIX_DEFAULT_FORMAT* = AUDIO_S16LSB
else:
const
MIX_DEFAULT_FORMAT* = AUDIO_S16MSB
const
MIX_DEFAULT_CHANNELS* = 2
MIX_MAX_VOLUME* = 128 # Volume of a chunk
PATH_MAX* = 255 # mikmod.h constants
#*
# * Library version
# *
LIBMIKMOD_VERSION_MAJOR* = 3
LIBMIKMOD_VERSION_MINOR* = 1
LIBMIKMOD_REVISION* = 8
LIBMIKMOD_VERSION* = ((LIBMIKMOD_VERSION_MAJOR shl 16) or
(LIBMIKMOD_VERSION_MINOR shl 8) or (LIBMIKMOD_REVISION))
type #music_cmd.h types
PMusicCMD* = ptr TMusicCMD
TMusicCMD*{.final.} = object #wavestream.h types
filename*: array[0..PATH_MAX - 1, char]
cmd*: array[0..PATH_MAX - 1, char]
pid*: TSYS_ThreadHandle
PWAVStream* = ptr TWAVStream
TWAVStream*{.final.} = object #playmidi.h types
wavefp*: Pointer
start*: int32
stop*: int32
cvt*: TSDL_AudioCVT
PMidiEvent* = ptr TMidiEvent
TMidiEvent*{.final.} = object
time*: int32
channel*: uint8
typ*: uint8
a*: uint8
b*: uint8
PMidiSong* = ptr TMidiSong
TMidiSong*{.final.} = object #music_ogg.h types
samples*: int32
events*: PMidiEvent
POGG_Music* = ptr TOGG_Music
TOGG_Music*{.final.} = object # mikmod.h types
#*
# * Error codes
# *
playing*: int
volume*: int #vf: OggVorbis_File;
section*: int
cvt*: TSDL_AudioCVT
len_available*: int
snd_available*: PUint8
TErrorEnum* = enum
MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING,
MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE,
MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER,
MMERR_LOADING_SAMPLEINFO, MMERR_NOT_A_MODULE, MMERR_NOT_A_STREAM,
MMERR_MED_SYNTHSAMPLES, MMERR_ITPACK_INVALID_DATA, MMERR_DETECTING_DEVICE,
MMERR_INVALID_DEVICE, MMERR_INITIALIZING_MIXER, MMERR_OPENING_AUDIO,
MMERR_8BIT_ONLY, MMERR_16BIT_ONLY, MMERR_STEREO_ONLY, MMERR_ULAW,
MMERR_NON_BLOCK, MMERR_AF_AUDIO_PORT, MMERR_AIX_CONFIG_INIT,
MMERR_AIX_CONFIG_CONTROL, MMERR_AIX_CONFIG_START, MMERR_GUS_SETTINGS,
MMERR_GUS_RESET, MMERR_GUS_TIMER, MMERR_HP_SETSAMPLESIZE, MMERR_HP_SETSPEED,
MMERR_HP_CHANNELS, MMERR_HP_AUDIO_OUTPUT, MMERR_HP_AUDIO_DESC,
MMERR_HP_BUFFERSIZE, MMERR_OSS_SETFRAGMENT, MMERR_OSS_SETSAMPLESIZE,
MMERR_OSS_SETSTEREO, MMERR_OSS_SETSPEED, MMERR_SGI_SPEED, MMERR_SGI_16BIT,
MMERR_SGI_8BIT, MMERR_SGI_STEREO, MMERR_SGI_MONO, MMERR_SUN_INIT,
MMERR_OS2_MIXSETUP, MMERR_OS2_SEMAPHORE, MMERR_OS2_TIMER, MMERR_OS2_THREAD,
MMERR_DS_PRIORITY, MMERR_DS_BUFFER, MMERR_DS_FORMAT, MMERR_DS_NOTIFY,
MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE,
MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT,
MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_MAX
PMODULE* = ptr TMODULE
TMODULE*{.final.} = object
PUNIMOD* = ptr TUNIMOD
TUNIMOD* = TMODULE #SDL_mixer.h types
# The internal format for an audio chunk
PMix_Chunk* = ptr TMix_Chunk
TMix_Chunk*{.final.} = object
allocated*: int
abuf*: PUint8
alen*: Uint32
volume*: Uint8 # Per-sample volume, 0-128
Mix_Chunk* = TMix_Chunk # The different fading types supported
TMix_Fading* = enum
MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN
Mix_Fading* = TMix_Fading
TMix_MusicType* = enum
MUS_NONE, MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG, MUS_MP3
Mix_MusicType* = TMix_MusicType #
# TMusicUnion = record
# case XXX: Byte of
# 0 : ( cmd : PMusicCMD );
# 1 : ( wave : PWAVStream );
# 2 : ( module : PUNIMOD );
# 3 : ( midi : TMidiSong );
# 4 : ( ogg : POGG_music );
# {$IFNDEF DARWIN}
# 5 : ( mp3 : PSMPEG );
# {$ENDIF}
# end;
PMix_Music* = ptr TMix_Music
TMix_Music*{.final.} = object # The internal format for a music chunk interpreted via mikmod
typ*: TMix_MusicType # other fields are not aviable
# data : TMusicUnion;
# fading : TMix_Fading;
# fade_volume : integer;
# fade_step : integer;
# fade_steps : integer;
# error : integer;
TMixFunction* = proc (udata: Pointer, stream: PUint8, length: int): Pointer{.
cdecl.} # This macro can be used to fill a version structure with the compile-time
# version of the SDL_mixer library.
proc SDL_MIXER_VERSION*(X: var TSDL_Version)
# This function gets the version of the dynamically linked SDL_mixer library.
# It should NOT be used to fill a version structure, instead you should use the
# SDL_MIXER_VERSION() macro.
proc Mix_Linked_Version*(): PSDL_version{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Open the mixer with a certain audio format
proc Mix_OpenAudio*(frequency: int, format: Uint16, channels: int,
chunksize: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Dynamically change the number of channels managed by the mixer.
# If decreasing the number of channels, the upper channels are
# stopped.
# This function returns the new number of allocated channels.
#
proc Mix_AllocateChannels*(numchannels: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Find out what the actual audio device parameters are.
# This function returns 1 if the audio has been opened, 0 otherwise.
#
proc Mix_QuerySpec*(frequency: var int, format: var Uint16, channels: var int): int{.
cdecl, importc, dynlib: SDL_MixerLibName.}
# Load a wave file or a music (.mod .s3m .it .xm) file
proc Mix_LoadWAV_RW*(src: PSDL_RWops, freesrc: int): PMix_Chunk{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_LoadWAV*(filename: cstring): PMix_Chunk
proc Mix_LoadMUS*(filename: cstring): PMix_Music{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Load a wave file of the mixer format from a memory buffer
proc Mix_QuickLoad_WAV*(mem: PUint8): PMix_Chunk{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Free an audio chunk previously loaded
proc Mix_FreeChunk*(chunk: PMix_Chunk){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_FreeMusic*(music: PMix_Music){.cdecl, importc, dynlib: SDL_MixerLibName.}
# Find out the music format of a mixer music, or the currently playing
# music, if 'music' is NULL.
proc Mix_GetMusicType*(music: PMix_Music): TMix_MusicType{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Set a function that is called after all mixing is performed.
# This can be used to provide real-time visual display of the audio stream
# or add a custom mixer filter for the stream data.
#
proc Mix_SetPostMix*(mix_func: TMixFunction, arg: Pointer){.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Add your own music player or additional mixer function.
# If 'mix_func' is NULL, the default music player is re-enabled.
#
proc Mix_HookMusic*(mix_func: TMixFunction, arg: Pointer){.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Add your own callback when the music has finished playing.
#
proc Mix_HookMusicFinished*(music_finished: Pointer){.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Get a pointer to the user data for the current music hook
proc Mix_GetMusicHookData*(): Pointer{.cdecl, importc, dynlib: SDL_MixerLibName.}
#* Add your own callback when a channel has finished playing. NULL
# * to disable callback.*
type
TChannel_finished* = proc (channel: int){.cdecl.}
proc Mix_ChannelFinished*(channel_finished: TChannel_finished){.cdecl,
importc, dynlib: SDL_MixerLibName.}
const
MIX_CHANNEL_POST* = - 2
# This is the format of a special effect callback:
# myeffect(int chan, void *stream, int len, void *udata);
#
# (chan) is the channel number that your effect is affecting. (stream) is
# the buffer of data to work upon. (len) is the size of (stream), and
# (udata) is a user-defined bit of data, which you pass as the last arg of
# Mix_RegisterEffect(), and is passed back unmolested to your callback.
# Your effect changes the contents of (stream) based on whatever parameters
# are significant, or just leaves it be, if you prefer. You can do whatever
# you like to the buffer, though, and it will continue in its changed state
# down the mixing pipeline, through any other effect functions, then finally
# to be mixed with the rest of the channels and music for the final output
# stream.
#
type
TMix_EffectFunc* = proc (chan: int, stream: Pointer, length: int,
udata: Pointer): Pointer{.cdecl.}
# * This is a callback that signifies that a channel has finished all its
# * loops and has completed playback. This gets called if the buffer
# * plays out normally, or if you call Mix_HaltChannel(), implicitly stop
# * a channel via Mix_AllocateChannels(), or unregister a callback while
# * it's still playing.
TMix_EffectDone* = proc (chan: int, udata: Pointer): Pointer{.cdecl.}
#* Register a special effect function. At mixing time, the channel data is
# * copied into a buffer and passed through each registered effect function.
# * After it passes through all the functions, it is mixed into the final
# * output stream. The copy to buffer is performed once, then each effect
# * function performs on the output of the previous effect. Understand that
# * this extra copy to a buffer is not performed if there are no effects
# * registered for a given chunk, which saves CPU cycles, and any given
# * effect will be extra cycles, too, so it is crucial that your code run
# * fast. Also note that the data that your function is given is in the
# * format of the sound device, and not the format you gave to Mix_OpenAudio(),
# * although they may in reality be the same. This is an unfortunate but
# * necessary speed concern. Use Mix_QuerySpec() to determine if you can
# * handle the data before you register your effect, and take appropriate
# * actions.
# * You may also specify a callback (Mix_EffectDone_t) that is called when
# * the channel finishes playing. This gives you a more fine-grained control
# * than Mix_ChannelFinished(), in case you need to free effect-specific
# * resources, etc. If you don't need this, you can specify NULL.
# * You may set the callbacks before or after calling Mix_PlayChannel().
# * Things like Mix_SetPanning() are just internal special effect functions,
# * so if you are using that, you've already incurred the overhead of a copy
# * to a separate buffer, and that these effects will be in the queue with
# * any functions you've registered. The list of registered effects for a
# * channel is reset when a chunk finishes playing, so you need to explicitly
# * set them with each call to Mix_PlayChannel*().
# * You may also register a special effect function that is to be run after
# * final mixing occurs. The rules for these callbacks are identical to those
# * in Mix_RegisterEffect, but they are run after all the channels and the
# * music have been mixed into a single stream, whereas channel-specific
# * effects run on a given channel before any other mixing occurs. These
# * global effect callbacks are call "posteffects". Posteffects only have
# * their Mix_EffectDone_t function called when they are unregistered (since
# * the main output stream is never "done" in the same sense as a channel).
# * You must unregister them manually when you've had enough. Your callback
# * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the
# * processing is considered a posteffect.
# *
# * After all these effects have finished processing, the callback registered
# * through Mix_SetPostMix() runs, and then the stream goes to the audio
# * device.
# *
# * returns zero if error (no such channel), nonzero if added.
# * Error messages can be retrieved from Mix_GetError().
# *
proc Mix_RegisterEffect*(chan: int, f: TMix_EffectFunc, d: TMix_EffectDone,
arg: Pointer): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
#* You may not need to call this explicitly, unless you need to stop an
# * effect from processing in the middle of a chunk's playback.
# * Posteffects are never implicitly unregistered as they are for channels,
# * but they may be explicitly unregistered through this function by
# * specifying MIX_CHANNEL_POST for a channel.
# * returns zero if error (no such channel or effect), nonzero if removed.
# * Error messages can be retrieved from Mix_GetError().
# *
proc Mix_UnregisterEffect*(channel: int, f: TMix_EffectFunc): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
#* You may not need to call this explicitly, unless you need to stop all
# * effects from processing in the middle of a chunk's playback. Note that
# * this will also shut off some internal effect processing, since
# * Mix_SetPanning( ) and others may use this API under the hood.This is
# * called internally when a channel completes playback.
# * Posteffects are never implicitly unregistered as they are for channels,
# * but they may be explicitly unregistered through this function by
# * specifying MIX_CHANNEL_POST for a channel.
# * returns zero if error( no such channel ), nonzero if all effects removed.
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_UnregisterAllEffects*(channel: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
const
MIX_EFFECTSMAXSPEED* = "MIX_EFFECTSMAXSPEED"
# * These are the internally - defined mixing effects.They use the same API that
# * effects defined in the application use, but are provided here as a
# * convenience.Some effects can reduce their quality or use more memory in
# * the name of speed; to enable this, make sure the environment variable
# * MIX_EFFECTSMAXSPEED( see above ) is defined before you call
# * Mix_OpenAudio( ).
# *
#* set the panning of a channel.The left and right channels are specified
# * as integers between 0 and 255, quietest to loudest, respectively.
# *
# * Technically, this is just individual volume control for a sample with
# * two( stereo )channels, so it can be used for more than just panning.
# * if you want real panning, call it like this :
# *
# * Mix_SetPanning( channel, left, 255 - left );
# *
# * ...which isn't so hard.
# *
# * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
# * the panning will be done to the final mixed stream before passing it on
# * to the audio device.
# *
# * This uses the Mix_RegisterEffect( )API internally, and returns without
# * registering the effect function if the audio device is not configured
# * for stereo output.Setting both( left ) and ( right ) to 255 causes this
# * effect to be unregistered, since that is the data's normal state.
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if panning effect enabled.Note that an audio device in mono
# * mode is a no - op, but this call will return successful in that case .
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_SetPanning*(channel: int, left: Uint8, right: Uint8): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# * set the position ofa channel.( angle ) is an integer from 0 to 360, that
# * specifies the location of the sound in relation to the listener.( angle )
# * will be reduced as neccesary( 540 becomes 180 degrees, -100 becomes 260 ).
# * Angle 0 is due north, and rotates clockwise as the value increases.
# * for efficiency, the precision of this effect may be limited( angles 1
# * through 7 might all produce the same effect, 8 through 15 are equal, etc ).
# * ( distance ) is an integer between 0 and 255 that specifies the space
# * between the sound and the listener.The larger the number, the further
# * away the sound is .Using 255 does not guarantee that the channel will be
# * culled from the mixing process or be completely silent.For efficiency,
# * the precision of this effect may be limited( distance 0 through 5 might
# * all produce the same effect, 6 through 10 are equal, etc ).Setting( angle )
# * and ( distance ) to 0 unregisters this effect, since the data would be
# * unchanged.
# *
# * if you need more precise positional audio, consider using OpenAL for
# * spatialized effects instead of SDL_mixer.This is only meant to be a
# * basic effect for simple "3D" games.
# *
# * if the audio device is configured for mono output, then you won't get
# * any effectiveness from the angle; however, distance attenuation on the
# * channel will still occur.While this effect will function with stereo
# * voices, it makes more sense to use voices with only one channel of sound,
# * so when they are mixed through this effect, the positioning will sound
# * correct.You can convert them to mono through SDL before giving them to
# * the mixer in the first place if you like.
# *
# * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
# * the positioning will be done to the final mixed stream before passing it
# * on to the audio device.
# *
# * This is a convenience wrapper over Mix_SetDistance( ) and Mix_SetPanning( ).
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if position effect is enabled.
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_SetPosition*(channel: int, angle: Sint16, distance: Uint8): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
#* set the "distance" of a channel.( distance ) is an integer from 0 to 255
# * that specifies the location of the sound in relation to the listener.
# * Distance 0 is overlapping the listener, and 255 is as far away as possible
# * A distance of 255 does not guarantee silence; in such a case , you might
# * want to try changing the chunk's volume, or just cull the sample from the
# * mixing process with Mix_HaltChannel( ).
# * for efficiency, the precision of this effect may be limited( distances 1
# * through 7 might all produce the same effect, 8 through 15 are equal, etc ).
# * ( distance ) is an integer between 0 and 255 that specifies the space
# * between the sound and the listener.The larger the number, the further
# * away the sound is .
# * Setting( distance ) to 0 unregisters this effect, since the data would be
# * unchanged.
# * if you need more precise positional audio, consider using OpenAL for
# * spatialized effects instead of SDL_mixer.This is only meant to be a
# * basic effect for simple "3D" games.
# *
# * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
# * the distance attenuation will be done to the final mixed stream before
# * passing it on to the audio device.
# *
# * This uses the Mix_RegisterEffect( )API internally.
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if position effect is enabled.
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_SetDistance*(channel: int, distance: Uint8): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# *
# * !!! FIXME : Haven't implemented, since the effect goes past the
# * end of the sound buffer.Will have to think about this.
# * - -ryan.
# * /
# { if 0
# { * Causes an echo effect to be mixed into a sound.( echo ) is the amount
# * of echo to mix.0 is no echo, 255 is infinite( and probably not
# * what you want ).
# *
# * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
# * the reverbing will be done to the final mixed stream before passing it on
# * to the audio device.
# *
# * This uses the Mix_RegisterEffect( )API internally.If you specify an echo
# * of zero, the effect is unregistered, as the data is already in that state.
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if reversing effect is enabled.
# * Error messages can be retrieved from Mix_GetError( ).
# *
# extern no_parse_DECLSPEC int Mix_SetReverb( int channel, Uint8 echo );
# #E ndif
# * Causes a channel to reverse its stereo.This is handy if the user has his
# * speakers hooked up backwards, or you would like to have a minor bit of
# * psychedelia in your sound code. : )Calling this function with ( flip )
# * set to non - zero reverses the chunks's usual channels. If (flip) is zero,
# * the effect is unregistered.
# *
# * This uses the Mix_RegisterEffect( )API internally, and thus is probably
# * more CPU intensive than having the user just plug in his speakers
# * correctly.Mix_SetReverseStereo( )returns without registering the effect
# * function if the audio device is not configured for stereo output.
# *
# * if you specify MIX_CHANNEL_POST for ( channel ), then this the effect is used
# * on the final mixed stream before sending it on to the audio device( a
# * posteffect ).
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if reversing effect is enabled.Note that an audio device in mono
# * mode is a no - op, but this call will return successful in that case .
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_SetReverseStereo*(channel: int, flip: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# end of effects API. - -ryan. *
# Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate
# them dynamically to the next sample if requested with a -1 value below.
# Returns the number of reserved channels.
#
proc Mix_ReserveChannels*(num: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Channel grouping functions
# Attach a tag to a channel. A tag can be assigned to several mixer
# channels, to form groups of channels.
# If 'tag' is -1, the tag is removed (actually -1 is the tag used to
# represent the group of all the channels).
# Returns true if everything was OK.
#
proc Mix_GroupChannel*(which: int, tag: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Assign several consecutive channels to a group
proc Mix_GroupChannels*(`from`: int, `to`: int, tag: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Finds the first available channel in a group of channels
proc Mix_GroupAvailable*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Returns the number of channels in a group. This is also a subtle
# way to get the total number of channels when 'tag' is -1
#
proc Mix_GroupCount*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Finds the "oldest" sample playing in a group of channels
proc Mix_GroupOldest*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Finds the "most recent" (i.e. last) sample playing in a group of channels
proc Mix_GroupNewer*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# The same as above, but the sound is played at most 'ticks' milliseconds
proc Mix_PlayChannelTimed*(channel: int, chunk: PMix_Chunk, loops: int,
ticks: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Play an audio chunk on a specific channel.
# If the specified channel is -1, play on the first free channel.
# If 'loops' is greater than zero, loop the sound that many times.
# If 'loops' is -1, loop inifinitely (~65000 times).
# Returns which channel was used to play the sound.
#
proc Mix_PlayChannel*(channel: int, chunk: PMix_Chunk, loops: int): int
proc Mix_PlayMusic*(music: PMix_Music, loops: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions
proc Mix_FadeInMusic*(music: PMix_Music, loops: int, ms: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_FadeInChannelTimed*(channel: int, chunk: PMix_Chunk, loops: int,
ms: int, ticks: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_FadeInChannel*(channel: int, chunk: PMix_Chunk, loops: int, ms: int): int
# Set the volume in the range of 0-128 of a specific channel or chunk.
# If the specified channel is -1, set volume for all channels.
# Returns the original volume.
# If the specified volume is -1, just return the current volume.
#
proc Mix_Volume*(channel: int, volume: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_VolumeChunk*(chunk: PMix_Chunk, volume: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_VolumeMusic*(volume: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Halt playing of a particular channel
proc Mix_HaltChannel*(channel: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_HaltGroup*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_HaltMusic*(): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Change the expiration delay for a particular channel.
# The sample will stop playing after the 'ticks' milliseconds have elapsed,
# or remove the expiration if 'ticks' is -1
#
proc Mix_ExpireChannel*(channel: int, ticks: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Halt a channel, fading it out progressively till it's silent
# The ms parameter indicates the number of milliseconds the fading
# will take.
#
proc Mix_FadeOutChannel*(which: int, ms: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_FadeOutGroup*(tag: int, ms: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_FadeOutMusic*(ms: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Query the fading status of a channel
proc Mix_FadingMusic*(): TMix_Fading{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_FadingChannel*(which: int): TMix_Fading{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Pause/Resume a particular channel
proc Mix_Pause*(channel: int){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_Resume*(channel: int){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_Paused*(channel: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Pause/Resume the music stream
proc Mix_PauseMusic*(){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_ResumeMusic*(){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_RewindMusic*(){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_PausedMusic*(): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Set the current position in the music stream.
# This returns 0 if successful, or -1 if it failed or isn't implemented.
# This function is only implemented for MOD music formats (set pattern
# order number) and for OGG music (set position in seconds), at the
# moment.
#
proc Mix_SetMusicPosition*(position: float64): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Check the status of a specific channel.
# If the specified channel is -1, check all channels.
#
proc Mix_Playing*(channel: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_PlayingMusic*(): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Stop music and set external music playback command
proc Mix_SetMusicCMD*(command: cstring): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Synchro value is set by MikMod from modules while playing
proc Mix_SetSynchroValue*(value: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_GetSynchroValue*(): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
#
# Get the Mix_Chunk currently associated with a mixer channel
# Returns nil if it's an invalid channel, or there's no chunk associated.
#
proc Mix_GetChunk*(channel: int): PMix_Chunk{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Close the mixer, halting all playing audio
proc Mix_CloseAudio*(){.cdecl, importc, dynlib: SDL_MixerLibName.}
# We'll use SDL for reporting errors
proc Mix_SetError*(fmt: cstring)
proc Mix_GetError*(): cstring
# implementation
proc SDL_MIXER_VERSION(X: var TSDL_version) =
X.major = SDL_MIXER_MAJOR_VERSION
X.minor = SDL_MIXER_MINOR_VERSION
X.patch = SDL_MIXER_PATCHLEVEL
proc Mix_LoadWAV(filename: cstring): PMix_Chunk =
result = Mix_LoadWAV_RW(SDL_RWFromFile(filename, "rb"), 1)
proc Mix_PlayChannel(channel: int, chunk: PMix_Chunk, loops: int): int =
result = Mix_PlayChannelTimed(channel, chunk, loops, - 1)
proc Mix_FadeInChannel(channel: int, chunk: PMix_Chunk, loops: int, ms: int): int =
result = Mix_FadeInChannelTimed(channel, chunk, loops, ms, - 1)
proc Mix_SetError(fmt: cstring) =
SDL_SetError(fmt)
proc Mix_GetError(): cstring =
result = SDL_GetError()

View File

@@ -1,572 +0,0 @@
#******************************************************************************
# Copy of SDL_Mixer without smpeg dependency and mp3 support
#******************************************************************************
import
sdl
when defined(windows):
const SDL_MixerLibName = "SDL_mixer.dll"
elif defined(macosx):
const SDL_MixerLibName = "libSDL_mixer-1.2.0.dylib"
else:
const SDL_MixerLibName = "libSDL_mixer.so"
const
SDL_MIXER_MAJOR_VERSION* = 1'i8
SDL_MIXER_MINOR_VERSION* = 2'i8
SDL_MIXER_PATCHLEVEL* = 7'i8 # Backwards compatibility
MIX_MAJOR_VERSION* = SDL_MIXER_MAJOR_VERSION
MIX_MINOR_VERSION* = SDL_MIXER_MINOR_VERSION
MIX_PATCHLEVEL* = SDL_MIXER_PATCHLEVEL # SDL_Mixer.h constants
# The default mixer has 8 simultaneous mixing channels
MIX_CHANNELS* = 8 # Good default values for a PC soundcard
MIX_DEFAULT_FREQUENCY* = 22050
when defined(IA32):
const
MIX_DEFAULT_FORMAT* = AUDIO_S16LSB
else:
const
MIX_DEFAULT_FORMAT* = AUDIO_S16MSB
const
MIX_DEFAULT_CHANNELS* = 2
MIX_MAX_VOLUME* = 128 # Volume of a chunk
PATH_MAX* = 255 # mikmod.h constants
#*
# * Library version
# *
LIBMIKMOD_VERSION_MAJOR* = 3
LIBMIKMOD_VERSION_MINOR* = 1
LIBMIKMOD_REVISION* = 8
LIBMIKMOD_VERSION* = ((LIBMIKMOD_VERSION_MAJOR shl 16) or
(LIBMIKMOD_VERSION_MINOR shl 8) or (LIBMIKMOD_REVISION))
type #music_cmd.h types
PMusicCMD* = ptr TMusicCMD
TMusicCMD*{.final.} = object #wavestream.h types
filename*: array[0..PATH_MAX - 1, char]
cmd*: array[0..PATH_MAX - 1, char]
pid*: TSYS_ThreadHandle
PWAVStream* = ptr TWAVStream
TWAVStream*{.final.} = object #playmidi.h types
wavefp*: Pointer
start*: int32
stop*: int32
cvt*: TSDL_AudioCVT
PMidiEvent* = ptr TMidiEvent
TMidiEvent*{.final.} = object
time*: int32
channel*: uint8
typ*: uint8
a*: uint8
b*: uint8
PMidiSong* = ptr TMidiSong
TMidiSong*{.final.} = object #music_ogg.h types
samples*: int32
events*: PMidiEvent
POGG_Music* = ptr TOGG_Music
TOGG_Music*{.final.} = object # mikmod.h types
#*
# * Error codes
# *
playing*: int
volume*: int #vf: OggVorbis_File;
section*: int
cvt*: TSDL_AudioCVT
len_available*: int
snd_available*: PUint8
TErrorEnum* = enum
MMERR_OPENING_FILE, MMERR_OUT_OF_MEMORY, MMERR_DYNAMIC_LINKING,
MMERR_SAMPLE_TOO_BIG, MMERR_OUT_OF_HANDLES, MMERR_UNKNOWN_WAVE_TYPE,
MMERR_LOADING_PATTERN, MMERR_LOADING_TRACK, MMERR_LOADING_HEADER,
MMERR_LOADING_SAMPLEINFO, MMERR_NOT_A_MODULE, MMERR_NOT_A_STREAM,
MMERR_MED_SYNTHSAMPLES, MMERR_ITPACK_INVALID_DATA, MMERR_DETECTING_DEVICE,
MMERR_INVALID_DEVICE, MMERR_INITIALIZING_MIXER, MMERR_OPENING_AUDIO,
MMERR_8BIT_ONLY, MMERR_16BIT_ONLY, MMERR_STEREO_ONLY, MMERR_ULAW,
MMERR_NON_BLOCK, MMERR_AF_AUDIO_PORT, MMERR_AIX_CONFIG_INIT,
MMERR_AIX_CONFIG_CONTROL, MMERR_AIX_CONFIG_START, MMERR_GUS_SETTINGS,
MMERR_GUS_RESET, MMERR_GUS_TIMER, MMERR_HP_SETSAMPLESIZE, MMERR_HP_SETSPEED,
MMERR_HP_CHANNELS, MMERR_HP_AUDIO_OUTPUT, MMERR_HP_AUDIO_DESC,
MMERR_HP_BUFFERSIZE, MMERR_OSS_SETFRAGMENT, MMERR_OSS_SETSAMPLESIZE,
MMERR_OSS_SETSTEREO, MMERR_OSS_SETSPEED, MMERR_SGI_SPEED, MMERR_SGI_16BIT,
MMERR_SGI_8BIT, MMERR_SGI_STEREO, MMERR_SGI_MONO, MMERR_SUN_INIT,
MMERR_OS2_MIXSETUP, MMERR_OS2_SEMAPHORE, MMERR_OS2_TIMER, MMERR_OS2_THREAD,
MMERR_DS_PRIORITY, MMERR_DS_BUFFER, MMERR_DS_FORMAT, MMERR_DS_NOTIFY,
MMERR_DS_EVENT, MMERR_DS_THREAD, MMERR_DS_UPDATE, MMERR_WINMM_HANDLE,
MMERR_WINMM_ALLOCATED, MMERR_WINMM_DEVICEID, MMERR_WINMM_FORMAT,
MMERR_WINMM_UNKNOWN, MMERR_MAC_SPEED, MMERR_MAC_START, MMERR_MAX
PMODULE* = ptr TMODULE
TMODULE*{.final.} = object
PUNIMOD* = ptr TUNIMOD
TUNIMOD* = TMODULE #SDL_mixer.h types
# The internal format for an audio chunk
PMix_Chunk* = ptr TMix_Chunk
TMix_Chunk*{.final.} = object
allocated*: int
abuf*: PUint8
alen*: Uint32
volume*: Uint8 # Per-sample volume, 0-128
Mix_Chunk* = TMix_Chunk # The different fading types supported
TMix_Fading* = enum
MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN
Mix_Fading* = TMix_Fading
TMix_MusicType* = enum
MUS_NONE, MUS_CMD, MUS_WAV, MUS_MOD, MUS_MID, MUS_OGG
PMix_Music* = ptr TMix_Music
TMix_Music*{.final.} = object
typ*: TMix_MusicType
TMixFunction* = proc (udata: Pointer, stream: PUint8, length: int): Pointer{.
cdecl.} # This macro can be used to fill a version structure with the compile-time
# version of the SDL_mixer library.
proc SDL_MIXER_VERSION*(X: var TSDL_Version)
# This function gets the version of the dynamically linked SDL_mixer library.
# It should NOT be used to fill a version structure, instead you should use the
# SDL_MIXER_VERSION() macro.
proc Mix_Linked_Version*(): PSDL_version{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Open the mixer with a certain audio format
proc Mix_OpenAudio*(frequency: int, format: Uint16, channels: int,
chunksize: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Dynamically change the number of channels managed by the mixer.
# If decreasing the number of channels, the upper channels are
# stopped.
# This function returns the new number of allocated channels.
#
proc Mix_AllocateChannels*(numchannels: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Find out what the actual audio device parameters are.
# This function returns 1 if the audio has been opened, 0 otherwise.
#
proc Mix_QuerySpec*(frequency: var int, format: var Uint16, channels: var int): int{.
cdecl, importc, dynlib: SDL_MixerLibName.}
# Load a wave file or a music (.mod .s3m .it .xm) file
proc Mix_LoadWAV_RW*(src: PSDL_RWops, freesrc: int): PMix_Chunk{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_LoadWAV*(filename: cstring): PMix_Chunk
proc Mix_LoadMUS*(filename: cstring): PMix_Music{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Load a wave file of the mixer format from a memory buffer
proc Mix_QuickLoad_WAV*(mem: PUint8): PMix_Chunk{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Free an audio chunk previously loaded
proc Mix_FreeChunk*(chunk: PMix_Chunk){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_FreeMusic*(music: PMix_Music){.cdecl, importc, dynlib: SDL_MixerLibName.}
# Find out the music format of a mixer music, or the currently playing
# music, if 'music' is NULL.
proc Mix_GetMusicType*(music: PMix_Music): TMix_MusicType{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Set a function that is called after all mixing is performed.
# This can be used to provide real-time visual display of the audio stream
# or add a custom mixer filter for the stream data.
#
proc Mix_SetPostMix*(mix_func: TMixFunction, arg: Pointer){.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Add your own music player or additional mixer function.
# If 'mix_func' is NULL, the default music player is re-enabled.
#
proc Mix_HookMusic*(mix_func: TMixFunction, arg: Pointer){.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Add your own callback when the music has finished playing.
#
proc Mix_HookMusicFinished*(music_finished: Pointer){.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Get a pointer to the user data for the current music hook
proc Mix_GetMusicHookData*(): Pointer{.cdecl, importc, dynlib: SDL_MixerLibName.}
#* Add your own callback when a channel has finished playing. NULL
# * to disable callback.*
type
TChannel_finished* = proc (channel: int){.cdecl.}
proc Mix_ChannelFinished*(channel_finished: TChannel_finished){.cdecl,
importc, dynlib: SDL_MixerLibName.}
const
MIX_CHANNEL_POST* = - 2 #* This is the format of a special effect callback:
# *
# * myeffect(int chan, void *stream, int len, void *udata);
# *
# * (chan) is the channel number that your effect is affecting. (stream) is
# * the buffer of data to work upon. (len) is the size of (stream), and
# * (udata) is a user-defined bit of data, which you pass as the last arg of
# * Mix_RegisterEffect(), and is passed back unmolested to your callback.
# * Your effect changes the contents of (stream) based on whatever parameters
# * are significant, or just leaves it be, if you prefer. You can do whatever
# * you like to the buffer, though, and it will continue in its changed state
# * down the mixing pipeline, through any other effect functions, then finally
# * to be mixed with the rest of the channels and music for the final output
# * stream.
# *
type
TMix_EffectFunc* = proc (chan: int, stream: Pointer, length: int,
udata: Pointer): Pointer{.cdecl.}
# * This is a callback that signifies that a channel has finished all its
# * loops and has completed playback. This gets called if the buffer
# * plays out normally, or if you call Mix_HaltChannel(), implicitly stop
# * a channel via Mix_AllocateChannels(), or unregister a callback while
# * it's still playing.
TMix_EffectDone* = proc (chan: int, udata: Pointer): Pointer{.cdecl.}
#* Register a special effect function. At mixing time, the channel data is
# * copied into a buffer and passed through each registered effect function.
# * After it passes through all the functions, it is mixed into the final
# * output stream. The copy to buffer is performed once, then each effect
# * function performs on the output of the previous effect. Understand that
# * this extra copy to a buffer is not performed if there are no effects
# * registered for a given chunk, which saves CPU cycles, and any given
# * effect will be extra cycles, too, so it is crucial that your code run
# * fast. Also note that the data that your function is given is in the
# * format of the sound device, and not the format you gave to Mix_OpenAudio(),
# * although they may in reality be the same. This is an unfortunate but
# * necessary speed concern. Use Mix_QuerySpec() to determine if you can
# * handle the data before you register your effect, and take appropriate
# * actions.
# * You may also specify a callback (Mix_EffectDone_t) that is called when
# * the channel finishes playing. This gives you a more fine-grained control
# * than Mix_ChannelFinished(), in case you need to free effect-specific
# * resources, etc. If you don't need this, you can specify NULL.
# * You may set the callbacks before or after calling Mix_PlayChannel().
# * Things like Mix_SetPanning() are just internal special effect functions,
# * so if you are using that, you've already incurred the overhead of a copy
# * to a separate buffer, and that these effects will be in the queue with
# * any functions you've registered. The list of registered effects for a
# * channel is reset when a chunk finishes playing, so you need to explicitly
# * set them with each call to Mix_PlayChannel*().
# * You may also register a special effect function that is to be run after
# * final mixing occurs. The rules for these callbacks are identical to those
# * in Mix_RegisterEffect, but they are run after all the channels and the
# * music have been mixed into a single stream, whereas channel-specific
# * effects run on a given channel before any other mixing occurs. These
# * global effect callbacks are call "posteffects". Posteffects only have
# * their Mix_EffectDone_t function called when they are unregistered (since
# * the main output stream is never "done" in the same sense as a channel).
# * You must unregister them manually when you've had enough. Your callback
# * will be told that the channel being mixed is (MIX_CHANNEL_POST) if the
# * processing is considered a posteffect.
# *
# * After all these effects have finished processing, the callback registered
# * through Mix_SetPostMix() runs, and then the stream goes to the audio
# * device.
# *
# * returns zero if error (no such channel), nonzero if added.
# * Error messages can be retrieved from Mix_GetError().
proc Mix_RegisterEffect*(chan: int, f: TMix_EffectFunc, d: TMix_EffectDone,
arg: Pointer): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
#* You may not need to call this explicitly, unless you need to stop an
# * effect from processing in the middle of a chunk's playback.
# * Posteffects are never implicitly unregistered as they are for channels,
# * but they may be explicitly unregistered through this function by
# * specifying MIX_CHANNEL_POST for a channel.
# * returns zero if error (no such channel or effect), nonzero if removed.
# * Error messages can be retrieved from Mix_GetError().
# *
proc Mix_UnregisterEffect*(channel: int, f: TMix_EffectFunc): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
#* You may not need to call this explicitly, unless you need to stop all
# * effects from processing in the middle of a chunk's playback. Note that
# * this will also shut off some internal effect processing, since
# * Mix_SetPanning( ) and others may use this API under the hood.This is
# * called internally when a channel completes playback.
# * Posteffects are never implicitly unregistered as they are for channels,
# * but they may be explicitly unregistered through this function by
# * specifying MIX_CHANNEL_POST for a channel.
# * returns zero if error( no such channel ), nonzero if all effects removed.
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_UnregisterAllEffects*(channel: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
const
MIX_EFFECTSMAXSPEED* = "MIX_EFFECTSMAXSPEED"
# * These are the internally - defined mixing effects.They use the same API that
# * effects defined in the application use, but are provided here as a
# * convenience.Some effects can reduce their quality or use more memory in
# * the name of speed; to enable this, make sure the environment variable
# * MIX_EFFECTSMAXSPEED( see above ) is defined before you call
# * Mix_OpenAudio( ).
# *
#* set the panning of a channel.The left and right channels are specified
# * as integers between 0 and 255, quietest to loudest, respectively.
# *
# * Technically, this is just individual volume control for a sample with
# * two( stereo )channels, so it can be used for more than just panning.
# * if you want real panning, call it like this :
# *
# * Mix_SetPanning( channel, left, 255 - left );
# *
# * ...which isn't so hard.
# *
# * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
# * the panning will be done to the final mixed stream before passing it on
# * to the audio device.
# *
# * This uses the Mix_RegisterEffect( )API internally, and returns without
# * registering the effect function if the audio device is not configured
# * for stereo output.Setting both( left ) and ( right ) to 255 causes this
# * effect to be unregistered, since that is the data's normal state.
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if panning effect enabled.Note that an audio device in mono
# * mode is a no - op, but this call will return successful in that case .
# * Error messages can be retrieved from Mix_GetError( ).
proc Mix_SetPanning*(channel: int, left: Uint8, right: Uint8): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# * set the position ofa channel.( angle ) is an integer from 0 to 360, that
# * specifies the location of the sound in relation to the listener.( angle )
# * will be reduced as neccesary( 540 becomes 180 degrees, -100 becomes 260 ).
# * Angle 0 is due north, and rotates clockwise as the value increases.
# * for efficiency, the precision of this effect may be limited( angles 1
# * through 7 might all produce the same effect, 8 through 15 are equal, etc ).
# * ( distance ) is an integer between 0 and 255 that specifies the space
# * between the sound and the listener.The larger the number, the further
# * away the sound is .Using 255 does not guarantee that the channel will be
# * culled from the mixing process or be completely silent.For efficiency,
# * the precision of this effect may be limited( distance 0 through 5 might
# * all produce the same effect, 6 through 10 are equal, etc ).Setting( angle )
# * and ( distance ) to 0 unregisters this effect, since the data would be
# * unchanged.
# *
# * if you need more precise positional audio, consider using OpenAL for
# * spatialized effects instead of SDL_mixer.This is only meant to be a
# * basic effect for simple "3D" games.
# *
# * if the audio device is configured for mono output, then you won't get
# * any effectiveness from the angle; however, distance attenuation on the
# * channel will still occur.While this effect will function with stereo
# * voices, it makes more sense to use voices with only one channel of sound,
# * so when they are mixed through this effect, the positioning will sound
# * correct.You can convert them to mono through SDL before giving them to
# * the mixer in the first place if you like.
# *
# * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
# * the positioning will be done to the final mixed stream before passing it
# * on to the audio device.
# *
# * This is a convenience wrapper over Mix_SetDistance( ) and Mix_SetPanning( ).
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if position effect is enabled.
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_SetPosition*(channel: int, angle: Sint16, distance: Uint8): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
#* set the "distance" of a channel.( distance ) is an integer from 0 to 255
# * that specifies the location of the sound in relation to the listener.
# * Distance 0 is overlapping the listener, and 255 is as far away as possible
# * A distance of 255 does not guarantee silence; in such a case , you might
# * want to try changing the chunk's volume, or just cull the sample from the
# * mixing process with Mix_HaltChannel( ).
# * for efficiency, the precision of this effect may be limited( distances 1
# * through 7 might all produce the same effect, 8 through 15 are equal, etc ).
# * ( distance ) is an integer between 0 and 255 that specifies the space
# * between the sound and the listener.The larger the number, the further
# * away the sound is .
# * Setting( distance ) to 0 unregisters this effect, since the data would be
# * unchanged.
# * if you need more precise positional audio, consider using OpenAL for
# * spatialized effects instead of SDL_mixer.This is only meant to be a
# * basic effect for simple "3D" games.
# *
# * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
# * the distance attenuation will be done to the final mixed stream before
# * passing it on to the audio device.
# *
# * This uses the Mix_RegisterEffect( )API internally.
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if position effect is enabled.
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_SetDistance*(channel: int, distance: Uint8): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# *
# * !!! FIXME : Haven't implemented, since the effect goes past the
# * end of the sound buffer.Will have to think about this.
# * - -ryan.
# * /
# { if 0
# { * Causes an echo effect to be mixed into a sound.( echo ) is the amount
# * of echo to mix.0 is no echo, 255 is infinite( and probably not
# * what you want ).
# *
# * Setting( channel ) to MIX_CHANNEL_POST registers this as a posteffect, and
# * the reverbing will be done to the final mixed stream before passing it on
# * to the audio device.
# *
# * This uses the Mix_RegisterEffect( )API internally.If you specify an echo
# * of zero, the effect is unregistered, as the data is already in that state.
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if reversing effect is enabled.
# * Error messages can be retrieved from Mix_GetError( ).
# *
# extern no_parse_DECLSPEC int Mix_SetReverb( int channel, Uint8 echo );
# #E ndif
# * Causes a channel to reverse its stereo.This is handy if the user has his
# * speakers hooked up backwards, or you would like to have a minor bit of
# * psychedelia in your sound code. : )Calling this function with ( flip )
# * set to non - zero reverses the chunks's usual channels. If (flip) is zero,
# * the effect is unregistered.
# *
# * This uses the Mix_RegisterEffect( )API internally, and thus is probably
# * more CPU intensive than having the user just plug in his speakers
# * correctly.Mix_SetReverseStereo( )returns without registering the effect
# * function if the audio device is not configured for stereo output.
# *
# * if you specify MIX_CHANNEL_POST for ( channel ), then this the effect is used
# * on the final mixed stream before sending it on to the audio device( a
# * posteffect ).
# *
# * returns zero if error( no such channel or Mix_RegisterEffect( )fails ),
# * nonzero if reversing effect is enabled.Note that an audio device in mono
# * mode is a no - op, but this call will return successful in that case .
# * Error messages can be retrieved from Mix_GetError( ).
# *
proc Mix_SetReverseStereo*(channel: int, flip: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# end of effects API. - -ryan. *
# Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate
# them dynamically to the next sample if requested with a -1 value below.
# Returns the number of reserved channels.
#
proc Mix_ReserveChannels*(num: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Channel grouping functions
# Attach a tag to a channel. A tag can be assigned to several mixer
# channels, to form groups of channels.
# If 'tag' is -1, the tag is removed (actually -1 is the tag used to
# represent the group of all the channels).
# Returns true if everything was OK.
#
proc Mix_GroupChannel*(which: int, tag: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Assign several consecutive channels to a group
proc Mix_GroupChannels*(`from`: int, `to`: int, tag: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Finds the first available channel in a group of channels
proc Mix_GroupAvailable*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Returns the number of channels in a group. This is also a subtle
# way to get the total number of channels when 'tag' is -1
#
proc Mix_GroupCount*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Finds the "oldest" sample playing in a group of channels
proc Mix_GroupOldest*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Finds the "most recent" (i.e. last) sample playing in a group of channels
proc Mix_GroupNewer*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# The same as above, but the sound is played at most 'ticks' milliseconds
proc Mix_PlayChannelTimed*(channel: int, chunk: PMix_Chunk, loops: int,
ticks: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Play an audio chunk on a specific channel.
# If the specified channel is -1, play on the first free channel.
# If 'loops' is greater than zero, loop the sound that many times.
# If 'loops' is -1, loop inifinitely (~65000 times).
# Returns which channel was used to play the sound.
#
proc Mix_PlayChannel*(channel: int, chunk: PMix_Chunk, loops: int): int
proc Mix_PlayMusic*(music: PMix_Music, loops: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions
proc Mix_FadeInMusic*(music: PMix_Music, loops: int, ms: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_FadeInChannelTimed*(channel: int, chunk: PMix_Chunk, loops: int,
ms: int, ticks: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_FadeInChannel*(channel: int, chunk: PMix_Chunk, loops: int, ms: int): int
# Set the volume in the range of 0-128 of a specific channel or chunk.
# If the specified channel is -1, set volume for all channels.
# Returns the original volume.
# If the specified volume is -1, just return the current volume.
#
proc Mix_Volume*(channel: int, volume: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_VolumeChunk*(chunk: PMix_Chunk, volume: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_VolumeMusic*(volume: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Halt playing of a particular channel
proc Mix_HaltChannel*(channel: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_HaltGroup*(tag: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_HaltMusic*(): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Change the expiration delay for a particular channel.
# The sample will stop playing after the 'ticks' milliseconds have elapsed,
# or remove the expiration if 'ticks' is -1
#
proc Mix_ExpireChannel*(channel: int, ticks: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Halt a channel, fading it out progressively till it's silent
# The ms parameter indicates the number of milliseconds the fading
# will take.
#
proc Mix_FadeOutChannel*(which: int, ms: int): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
proc Mix_FadeOutGroup*(tag: int, ms: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_FadeOutMusic*(ms: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Query the fading status of a channel
proc Mix_FadingMusic*(): TMix_Fading{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_FadingChannel*(which: int): TMix_Fading{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Pause/Resume a particular channel
proc Mix_Pause*(channel: int){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_Resume*(channel: int){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_Paused*(channel: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Pause/Resume the music stream
proc Mix_PauseMusic*(){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_ResumeMusic*(){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_RewindMusic*(){.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_PausedMusic*(): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Set the current position in the music stream.
# This returns 0 if successful, or -1 if it failed or isn't implemented.
# This function is only implemented for MOD music formats (set pattern
# order number) and for OGG music (set position in seconds), at the
# moment.
#
proc Mix_SetMusicPosition*(position: float64): int{.cdecl,
importc, dynlib: SDL_MixerLibName.}
# Check the status of a specific channel.
# If the specified channel is -1, check all channels.
#
proc Mix_Playing*(channel: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_PlayingMusic*(): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Stop music and set external music playback command
proc Mix_SetMusicCMD*(command: cstring): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Synchro value is set by MikMod from modules while playing
proc Mix_SetSynchroValue*(value: int): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
proc Mix_GetSynchroValue*(): int{.cdecl, importc, dynlib: SDL_MixerLibName.}
#
# Get the Mix_Chunk currently associated with a mixer channel
# Returns nil if it's an invalid channel, or there's no chunk associated.
#
proc Mix_GetChunk*(channel: int): PMix_Chunk{.cdecl, importc, dynlib: SDL_MixerLibName.}
# Close the mixer, halting all playing audio
proc Mix_CloseAudio*(){.cdecl, importc, dynlib: SDL_MixerLibName.}
# We'll use SDL for reporting errors
proc Mix_SetError*(fmt: cstring)
proc Mix_GetError*(): cstring
# implementation
proc SDL_MIXER_VERSION(X: var TSDL_version) =
X.major = SDL_MIXER_MAJOR_VERSION
X.minor = SDL_MIXER_MINOR_VERSION
X.patch = SDL_MIXER_PATCHLEVEL
proc Mix_LoadWAV(filename: cstring): PMix_Chunk =
result = Mix_LoadWAV_RW(SDL_RWFromFile(filename, "rb"), 1)
proc Mix_PlayChannel(channel: int, chunk: PMix_Chunk, loops: int): int =
result = Mix_PlayChannelTimed(channel, chunk, loops, - 1)
proc Mix_FadeInChannel(channel: int, chunk: PMix_Chunk, loops: int, ms: int): int =
result = Mix_FadeInChannelTimed(channel, chunk, loops, ms, - 1)
proc Mix_SetError(fmt: cstring) =
SDL_SetError(fmt)
proc Mix_GetError(): cstring =
result = SDL_GetError()

View File

@@ -1,431 +0,0 @@
#******************************************************************************
#
# $Id: sdl_net.pas,v 1.7 2005/01/01 02:14:21 savage Exp $
#
#
#
# Borland Delphi SDL_Net - A x-platform network library for use with SDL.
# Conversion of the Simple DirectMedia Layer Network Headers
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : SDL_net.h
#
# The initial developer of this Pascal code was :
# Dominqiue Louis <Dominique@SavageSoftware.com.au>
#
# Portions created by Dominqiue Louis are
# Copyright (C) 2000 - 2001 Dominqiue Louis.
#
#
# Contributor(s)
# --------------
# Matthias Thoma <ma.thoma@gmx.de>
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
#
#
#
#
#
#
#
# Requires
# --------
# SDL.pas somehere in your search path
#
# Programming Notes
# -----------------
#
#
#
#
# Revision History
# ----------------
# April 09 2001 - DL : Initial Translation
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: sdl_net.pas,v $
# Revision 1.7 2005/01/01 02:14:21 savage
# Updated to v1.2.5
#
# Revision 1.6 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.5 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.4 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.3 2004/04/01 20:53:23 savage
# Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/16 22:16:40 savage
# v1.0 changes
#
#
#
#******************************************************************************
import
sdl
when defined(windows):
const SDLNetLibName = "SDL_net.dll"
elif defined(macosx):
const SDLNetLibName = "libSDL_net.dylib"
else:
const SDLNetLibName = "libSDL_net.so"
const #* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *
SDL_NET_MAJOR_VERSION* = 1'i8
SDL_NET_MINOR_VERSION* = 2'i8
SDL_NET_PATCHLEVEL* = 5'i8 # SDL_Net.h constants
#* Resolve a host name and port to an IP address in network form.
# If the function succeeds, it will return 0.
# If the host couldn't be resolved, the host portion of the returned
# address will be INADDR_NONE, and the function will return -1.
# If 'host' is NULL, the resolved host will be set to INADDR_ANY.
# *
INADDR_ANY* = 0x00000000
INADDR_NONE* = 0xFFFFFFFF #***********************************************************************
#* UDP network API *
#***********************************************************************
#* The maximum channels on a a UDP socket *
SDLNET_MAX_UDPCHANNELS* = 32 #* The maximum addresses bound to a single UDP socket channel *
SDLNET_MAX_UDPADDRESSES* = 4
type # SDL_net.h types
#***********************************************************************
#* IPv4 hostname resolution API *
#***********************************************************************
PIPAddress* = ptr TIPAddress
TIPAddress*{.final.} = object #* TCP network API
host*: Uint32 # 32-bit IPv4 host address */
port*: Uint16 # 16-bit protocol port */
PTCPSocket* = ptr TTCPSocket
TTCPSocket*{.final.} = object #***********************************************************************
#* UDP network API *
#***********************************************************************
ready*: int
channel*: int
remoteAddress*: TIPaddress
localAddress*: TIPaddress
sflag*: int
PUDP_Channel* = ptr TUDP_Channel
TUDP_Channel*{.final.} = object
numbound*: int
address*: array[0..SDLNET_MAX_UDPADDRESSES - 1, TIPAddress]
PUDPSocket* = ptr TUDPSocket
TUDPSocket*{.final.} = object
ready*: int
channel*: int
address*: TIPAddress
binding*: array[0..SDLNET_MAX_UDPCHANNELS - 1, TUDP_Channel]
PUDPpacket* = ptr TUDPpacket
PPUDPpacket* = ptr PUDPpacket
TUDPpacket*{.final.} = object #***********************************************************************
#* Hooks for checking sockets for available data *
#***********************************************************************
channel*: int #* The src/dst channel of the packet *
data*: PUint8 #* The packet data *
length*: int #* The length of the packet data *
maxlen*: int #* The size of the data buffer *
status*: int #* packet status after sending *
address*: TIPAddress #* The source/dest address of an incoming/outgoing packet *
PSDLNet_Socket* = ptr TSDLNet_Socket
TSDLNet_Socket*{.final.} = object
ready*: int
channel*: int
PSDLNet_SocketSet* = ptr TSDLNet_SocketSet
TSDLNet_SocketSet*{.final.} = object #* Any network socket can be safely cast to this socket type *
numsockets*: int
maxsockets*: int
sockets*: PSDLNet_Socket
PSDLNet_GenericSocket* = ptr TSDLNet_GenericSocket
TSDLNet_GenericSocket*{.final.} = object # This macro can be used to fill a version structure with the compile-time
# version of the SDL_net library.
ready*: int
proc SDL_NET_VERSION*(X: var TSDL_version)
#* Initialize/Cleanup the network API
# SDL must be initialized before calls to functions in this library,
# because this library uses utility functions from the SDL library.
#*
proc SDLNet_Init*(): int{.cdecl, importc, dynlib: SDLNetLibName.}
proc SDLNet_Quit*(){.cdecl, importc, dynlib: SDLNetLibName.}
#* Resolve a host name and port to an IP address in network form.
# If the function succeeds, it will return 0.
# If the host couldn't be resolved, the host portion of the returned
# address will be INADDR_NONE, and the function will return -1.
# If 'host' is NULL, the resolved host will be set to INADDR_ANY.
# *
proc SDLNet_ResolveHost*(address: var TIPaddress, host: cstring, port: Uint16): int{.
cdecl, importc, dynlib: SDLNetLibName.}
#* Resolve an ip address to a host name in canonical form.
# If the ip couldn't be resolved, this function returns NULL,
# otherwise a pointer to a static buffer containing the hostname
# is returned. Note that this function is not thread-safe.
#*
proc SDLNet_ResolveIP*(ip: var TIPaddress): cstring{.cdecl,
importc, dynlib: SDLNetLibName.}
#***********************************************************************
#* TCP network API *
#***********************************************************************
#* Open a TCP network socket
# If ip.host is INADDR_NONE, this creates a local server socket on the
# given port, otherwise a TCP connection to the remote host and port is
# attempted. The address passed in should already be swapped to network
# byte order (addresses returned from SDLNet_ResolveHost() are already
# in the correct form).
# The newly created socket is returned, or NULL if there was an error.
#*
proc SDLNet_TCP_Open*(ip: var TIPaddress): PTCPSocket{.cdecl,
importc, dynlib: SDLNetLibName.}
#* Accept an incoming connection on the given server socket.
# The newly created socket is returned, or NULL if there was an error.
#*
proc SDLNet_TCP_Accept*(server: PTCPsocket): PTCPSocket{.cdecl,
importc, dynlib: SDLNetLibName.}
#* Get the IP address of the remote system associated with the socket.
# If the socket is a server socket, this function returns NULL.
#*
proc SDLNet_TCP_GetPeerAddress*(sock: PTCPsocket): PIPAddress{.cdecl,
importc, dynlib: SDLNetLibName.}
#* Send 'len' bytes of 'data' over the non-server socket 'sock'
# This function returns the actual amount of data sent. If the return value
# is less than the amount of data sent, then either the remote connection was
# closed, or an unknown socket error occurred.
#*
proc SDLNet_TCP_Send*(sock: PTCPsocket, data: Pointer, length: int): int{.cdecl,
importc, dynlib: SDLNetLibName.}
#* Receive up to 'maxlen' bytes of data over the non-server socket 'sock',
# and store them in the buffer pointed to by 'data'.
# This function returns the actual amount of data received. If the return
# value is less than or equal to zero, then either the remote connection was
# closed, or an unknown socket error occurred.
#*
proc SDLNet_TCP_Recv*(sock: PTCPsocket, data: Pointer, maxlen: int): int{.cdecl,
importc, dynlib: SDLNetLibName.}
#* Close a TCP network socket *
proc SDLNet_TCP_Close*(sock: PTCPsocket){.cdecl, importc, dynlib: SDLNetLibName.}
#***********************************************************************
#* UDP network API *
#***********************************************************************
#* Allocate/resize/free a single UDP packet 'size' bytes long.
# The new packet is returned, or NULL if the function ran out of memory.
# *
proc SDLNet_AllocPacket*(size: int): PUDPpacket{.cdecl, importc, dynlib: SDLNetLibName.}
proc SDLNet_ResizePacket*(packet: PUDPpacket, newsize: int): int{.cdecl,
importc, dynlib: SDLNetLibName.}
proc SDLNet_FreePacket*(packet: PUDPpacket){.cdecl, importc, dynlib: SDLNetLibName.}
#* Allocate/Free a UDP packet vector (array of packets) of 'howmany' packets,
# each 'size' bytes long.
# A pointer to the first packet in the array is returned, or NULL if the
# function ran out of memory.
# *
proc SDLNet_AllocPacketV*(howmany: int, size: int): PUDPpacket{.cdecl,
importc, dynlib: SDLNetLibName.}
proc SDLNet_FreePacketV*(packetV: PUDPpacket){.cdecl, importc, dynlib: SDLNetLibName.}
#* Open a UDP network socket
# If 'port' is non-zero, the UDP socket is bound to a local port.
# This allows other systems to send to this socket via a known port.
#*
proc SDLNet_UDP_Open*(port: Uint16): PUDPsocket{.cdecl, importc, dynlib: SDLNetLibName.}
#* Bind the address 'address' to the requested channel on the UDP socket.
# If the channel is -1, then the first unbound channel will be bound with
# the given address as it's primary address.
# If the channel is already bound, this new address will be added to the
# list of valid source addresses for packets arriving on the channel.
# If the channel is not already bound, then the address becomes the primary
# address, to which all outbound packets on the channel are sent.
# This function returns the channel which was bound, or -1 on error.
#*
proc SDLNet_UDP_Bind*(sock: PUDPsocket, channel: int, address: var TIPaddress): int{.
cdecl, importc, dynlib: SDLNetLibName.}
#* Unbind all addresses from the given channel *
proc SDLNet_UDP_Unbind*(sock: PUDPsocket, channel: int){.cdecl,
importc, dynlib: SDLNetLibName.}
#* Get the primary IP address of the remote system associated with the
# socket and channel. If the channel is -1, then the primary IP port
# of the UDP socket is returned -- this is only meaningful for sockets
# opened with a specific port.
# If the channel is not bound and not -1, this function returns NULL.
# *
proc SDLNet_UDP_GetPeerAddress*(sock: PUDPsocket, channel: int): PIPAddress{.
cdecl, importc, dynlib: SDLNetLibName.}
#* Send a vector of packets to the the channels specified within the packet.
# If the channel specified in the packet is -1, the packet will be sent to
# the address in the 'src' member of the packet.
# Each packet will be updated with the status of the packet after it has
# been sent, -1 if the packet send failed.
# This function returns the number of packets sent.
#*
proc SDLNet_UDP_SendV*(sock: PUDPsocket, packets: PPUDPpacket, npackets: int): int{.
cdecl, importc, dynlib: SDLNetLibName.}
#* Send a single packet to the specified channel.
# If the channel specified in the packet is -1, the packet will be sent to
# the address in the 'src' member of the packet.
# The packet will be updated with the status of the packet after it has
# been sent.
# This function returns 1 if the packet was sent, or 0 on error.
#*
proc SDLNet_UDP_Send*(sock: PUDPsocket, channel: int, packet: PUDPpacket): int{.
cdecl, importc, dynlib: SDLNetLibName.}
#* Receive a vector of pending packets from the UDP socket.
# The returned packets contain the source address and the channel they arrived
# on. If they did not arrive on a bound channel, the the channel will be set
# to -1.
# The channels are checked in highest to lowest order, so if an address is
# bound to multiple channels, the highest channel with the source address
# bound will be returned.
# This function returns the number of packets read from the network, or -1
# on error. This function does not block, so can return 0 packets pending.
#*
proc SDLNet_UDP_RecvV*(sock: PUDPsocket, packets: PPUDPpacket): int{.cdecl,
importc, dynlib: SDLNetLibName.}
#* Receive a single packet from the UDP socket.
# The returned packet contains the source address and the channel it arrived
# on. If it did not arrive on a bound channel, the the channel will be set
# to -1.
# The channels are checked in highest to lowest order, so if an address is
# bound to multiple channels, the highest channel with the source address
# bound will be returned.
# This function returns the number of packets read from the network, or -1
# on error. This function does not block, so can return 0 packets pending.
#*
proc SDLNet_UDP_Recv*(sock: PUDPsocket, packet: PUDPpacket): int{.cdecl,
importc, dynlib: SDLNetLibName.}
#* Close a UDP network socket *
proc SDLNet_UDP_Close*(sock: PUDPsocket){.cdecl, importc, dynlib: SDLNetLibName.}
#***********************************************************************
#* Hooks for checking sockets for available data *
#***********************************************************************
#* Allocate a socket set for use with SDLNet_CheckSockets()
# This returns a socket set for up to 'maxsockets' sockets, or NULL if
# the function ran out of memory.
# *
proc SDLNet_AllocSocketSet*(maxsockets: int): PSDLNet_SocketSet{.cdecl,
importc, dynlib: SDLNetLibName.}
#* Add a socket to a set of sockets to be checked for available data *
proc SDLNet_AddSocket*(theSet: PSDLNet_SocketSet, sock: PSDLNet_GenericSocket): int{.
cdecl, importc, dynlib: SDLNetLibName.}
proc SDLNet_TCP_AddSocket*(theSet: PSDLNet_SocketSet, sock: PTCPSocket): int
proc SDLNet_UDP_AddSocket*(theSet: PSDLNet_SocketSet, sock: PUDPSocket): int
#* Remove a socket from a set of sockets to be checked for available data *
proc SDLNet_DelSocket*(theSet: PSDLNet_SocketSet, sock: PSDLNet_GenericSocket): int{.
cdecl, importc, dynlib: SDLNetLibName.}
proc SDLNet_TCP_DelSocket*(theSet: PSDLNet_SocketSet, sock: PTCPSocket): int
# SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock)
proc SDLNet_UDP_DelSocket*(theSet: PSDLNet_SocketSet, sock: PUDPSocket): int
#SDLNet_DelSocket(set, (SDLNet_GenericSocket)sock)
#* This function checks to see if data is available for reading on the
# given set of sockets. If 'timeout' is 0, it performs a quick poll,
# otherwise the function returns when either data is available for
# reading, or the timeout in milliseconds has elapsed, which ever occurs
# first. This function returns the number of sockets ready for reading,
# or -1 if there was an error with the select() system call.
#*
proc SDLNet_CheckSockets*(theSet: PSDLNet_SocketSet, timeout: Sint32): int{.
cdecl, importc, dynlib: SDLNetLibName.}
#* After calling SDLNet_CheckSockets(), you can use this function on a
# socket that was in the socket set, to find out if data is available
# for reading.
#*
proc SDLNet_SocketReady*(sock: PSDLNet_GenericSocket): bool
#* Free a set of sockets allocated by SDL_NetAllocSocketSet() *
proc SDLNet_FreeSocketSet*(theSet: PSDLNet_SocketSet){.cdecl,
importc, dynlib: SDLNetLibName.}
#***********************************************************************
#* Platform-independent data conversion functions *
#***********************************************************************
#* Write a 16/32 bit value to network packet buffer *
proc SDLNet_Write16*(value: Uint16, area: Pointer){.cdecl, importc, dynlib: SDLNetLibName.}
proc SDLNet_Write32*(value: Uint32, area: Pointer){.cdecl, importc, dynlib: SDLNetLibName.}
#* Read a 16/32 bit value from network packet buffer *
proc SDLNet_Read16*(area: Pointer): Uint16{.cdecl, importc, dynlib: SDLNetLibName.}
proc SDLNet_Read32*(area: Pointer): Uint32{.cdecl, importc, dynlib: SDLNetLibName.}
#***********************************************************************
#* Error reporting functions *
#***********************************************************************
#* We'll use SDL's functions for error reporting *
proc SDLNet_SetError*(fmt: cstring)
proc SDLNet_GetError*(): cstring
# implementation
proc SDL_NET_VERSION(X: var TSDL_version) =
X.major = SDL_NET_MAJOR_VERSION
X.minor = SDL_NET_MINOR_VERSION
X.patch = SDL_NET_PATCHLEVEL
proc SDLNet_TCP_AddSocket(theSet: PSDLNet_SocketSet, sock: PTCPSocket): int =
result = SDLNet_AddSocket(theSet, cast[PSDLNet_GenericSocket](sock))
proc SDLNet_UDP_AddSocket(theSet: PSDLNet_SocketSet, sock: PUDPSocket): int =
result = SDLNet_AddSocket(theSet, cast[PSDLNet_GenericSocket](sock))
proc SDLNet_TCP_DelSocket(theSet: PSDLNet_SocketSet, sock: PTCPSocket): int =
result = SDLNet_DelSocket(theSet, cast[PSDLNet_GenericSocket](sock))
proc SDLNet_UDP_DelSocket(theSet: PSDLNet_SocketSet, sock: PUDPSocket): int =
result = SDLNet_DelSocket(theSet, cast[PSDLNet_GenericSocket](sock))
proc SDLNet_SocketReady(sock: PSDLNet_GenericSocket): bool =
result = ((sock != nil) and (sock.ready == 1))
proc SDLNet_SetError(fmt: cstring) =
SDL_SetError(fmt)
proc SDLNet_GetError(): cstring =
result = SDL_GetError()

View File

@@ -1,346 +0,0 @@
#
# $Id: sdl_ttf.pas,v 1.18 2007/06/01 11:16:33 savage Exp $
#
#
#******************************************************************************
#
# JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer
# Conversion of the Simple DirectMedia Layer Headers
#
# Portions created by Sam Lantinga <slouken@devolution.com> are
# Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
# 5635-34 Springhouse Dr.
# Pleasanton, CA 94588 (USA)
#
# All Rights Reserved.
#
# The original files are : SDL_ttf.h
#
# The initial developer of this Pascal code was :
# Dominqiue Louis <Dominique@SavageSoftware.com.au>
#
# Portions created by Dominqiue Louis are
# Copyright (C) 2000 - 2001 Dominqiue Louis.
#
#
# Contributor(s)
# --------------
# Tom Jones <tigertomjones@gmx.de> His Project inspired this conversion
#
# Obtained through:
# Joint Endeavour of Delphi Innovators ( Project JEDI )
#
# You may retrieve the latest version of this file at the Project
# JEDI home page, located at http://delphi-jedi.org
#
# The contents of this file are used with permission, subject to
# the Mozilla Public License Version 1.1 (the "License"); you may
# not use this file except in compliance with the License. You may
# obtain a copy of the License at
# http://www.mozilla.org/MPL/MPL-1.1.html
#
# Software distributed under the License is distributed on an
# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# Description
# -----------
#
#
#
#
#
#
#
# Requires
# --------
# The SDL Runtime libraris on Win32 : SDL.dll on Linux : libSDL.so
# They are available from...
# http://www.libsdl.org .
#
# Programming Notes
# -----------------
#
#
#
#
# Revision History
# ----------------
# December 08 2002 - DL : Fixed definition of TTF_RenderUnicode_Solid
#
# April 03 2003 - DL : Added jedi-sdl.inc include file to support more
# Pascal compilers. Initial support is now included
# for GnuPascal, VirtualPascal, TMT and obviously
# continue support for Delphi Kylix and FreePascal.
#
# April 24 2003 - DL : under instruction from Alexey Barkovoy, I have added
# better TMT Pascal support and under instruction
# from Prof. Abimbola Olowofoyeku (The African Chief),
# I have added better Gnu Pascal support
#
# April 30 2003 - DL : under instruction from David Mears AKA
# Jason Siletto, I have added FPC Linux support.
# This was compiled with fpc 1.1, so remember to set
# include file path. ie. -Fi/usr/share/fpcsrc/rtl/*
#
#
# $Log: sdl_ttf.pas,v $
# Revision 1.18 2007/06/01 11:16:33 savage
# Added IFDEF UNIX for Workaround.
#
# Revision 1.17 2007/06/01 08:38:21 savage
# Added TTF_RenderText_Solid workaround as suggested by Michalis Kamburelis
#
# Revision 1.16 2007/05/29 21:32:14 savage
# Changes as suggested by Almindor for 64bit compatibility.
#
# Revision 1.15 2007/05/20 20:32:45 savage
# Initial Changes to Handle 64 Bits
#
# Revision 1.14 2006/12/02 00:19:01 savage
# Updated to latest version
#
# Revision 1.13 2005/04/10 11:48:33 savage
# Changes as suggested by Michalis, thanks.
#
# Revision 1.12 2005/01/05 01:47:14 savage
# Changed LibName to reflect what MacOS X should have. ie libSDL*-1.2.0.dylib respectively.
#
# Revision 1.11 2005/01/04 23:14:57 savage
# Changed LibName to reflect what most Linux distros will have. ie libSDL*-1.2.so.0 respectively.
#
# Revision 1.10 2005/01/02 19:07:32 savage
# Slight bug fix to use LongInt instead of Long ( Thanks Michalis Kamburelis )
#
# Revision 1.9 2005/01/01 02:15:20 savage
# Updated to v2.0.7
#
# Revision 1.8 2004/10/07 21:02:32 savage
# Fix for FPC
#
# Revision 1.7 2004/09/30 22:39:50 savage
# Added a true type font class which contains a wrap text function.
# Changed the sdl_ttf.pas header to reflect the future of jedi-sdl.
#
# Revision 1.6 2004/08/14 22:54:30 savage
# Updated so that Library name defines are correctly defined for MacOS X.
#
# Revision 1.5 2004/05/10 14:10:04 savage
# Initial MacOS X support. Fixed defines for MACOS ( Classic ) and DARWIN ( MacOS X ).
#
# Revision 1.4 2004/04/13 09:32:08 savage
# Changed Shared object names back to just the .so extension to avoid conflicts on various Linux/Unix distros. Therefore developers will need to create Symbolic links to the actual Share Objects if necessary.
#
# Revision 1.3 2004/04/01 20:53:24 savage
# Changed Linux Shared Object names so they reflect the Symbolic Links that are created when installing the RPMs from the SDL site.
#
# Revision 1.2 2004/03/30 20:23:28 savage
# Tidied up use of UNIX compiler directive.
#
# Revision 1.1 2004/02/16 22:16:40 savage
# v1.0 changes
#
#
#
#******************************************************************************
#
# Define this to workaround a known bug in some freetype versions.
# The error manifests as TTF_RenderGlyph_Solid returning nil (error)
# and error message (in SDL_Error) is
# "Failed loading DPMSDisable: /usr/lib/libX11.so.6: undefined symbol: DPMSDisable"
# See [http://lists.libsdl.org/pipermail/sdl-libsdl.org/2007-March/060459.html]
#
import sdl
when defined(windows):
const SDLttfLibName = "SDL_ttf.dll"
elif defined(macosx):
const SDLttfLibName = "libSDL_ttf-2.0.0.dylib"
else:
const SDLttfLibName = "libSDL_ttf.so"
const
SDL_TTF_MAJOR_VERSION* = 2'i8
SDL_TTF_MINOR_VERSION* = 0'i8
SDL_TTF_PATCHLEVEL* = 8'i8 # Backwards compatibility
TTF_MAJOR_VERSION* = SDL_TTF_MAJOR_VERSION
TTF_MINOR_VERSION* = SDL_TTF_MINOR_VERSION
TTF_PATCHLEVEL* = SDL_TTF_PATCHLEVEL #*
# Set and retrieve the font style
# This font style is implemented by modifying the font glyphs, and
# doesn't reflect any inherent properties of the truetype font file.
#*
TTF_STYLE_NORMAL* = 0x00000000
TTF_STYLE_BOLD* = 0x00000001
TTF_STYLE_ITALIC* = 0x00000002
TTF_STYLE_UNDERLINE* = 0x00000004 # ZERO WIDTH NO-BREAKSPACE (Unicode byte order mark)
UNICODE_BOM_NATIVE* = 0x0000FEFF
UNICODE_BOM_SWAPPED* = 0x0000FFFE
type
PTTF_Font* = ptr TTTF_font
TTTF_Font*{.final.} = object # This macro can be used to fill a version structure with the compile-time
# version of the SDL_ttf library.
proc SDL_TTF_VERSION*(X: var TSDL_version)
# This function gets the version of the dynamically linked SDL_ttf library.
# It should NOT be used to fill a version structure, instead you should use the
# SDL_TTF_VERSION() macro.
proc TTF_Linked_Version*(): PSDL_version{.cdecl, importc, dynlib: SDLttfLibName.}
# This function tells the library whether UNICODE text is generally
# byteswapped. A UNICODE BOM character in a string will override
# this setting for the remainder of that string.
#
proc TTF_ByteSwappedUNICODE*(swapped: int){.cdecl, importc, dynlib: SDLttfLibName.}
#returns 0 on succes, -1 if error occurs
proc TTF_Init*(): int{.cdecl, importc, dynlib: SDLttfLibName.}
#
# Open a font file and create a font of the specified point size.
# Some .fon fonts will have several sizes embedded in the file, so the
# point size becomes the index of choosing which size. If the value
# is too high, the last indexed size will be the default.
#
proc TTF_OpenFont*(filename: cstring, ptsize: int): PTTF_Font{.cdecl,
importc, dynlib: SDLttfLibName.}
proc TTF_OpenFontIndex*(filename: cstring, ptsize: int, index: int32): PTTF_Font{.
cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_OpenFontRW*(src: PSDL_RWops, freesrc: int, ptsize: int): PTTF_Font{.
cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_OpenFontIndexRW*(src: PSDL_RWops, freesrc: int, ptsize: int,
index: int32): PTTF_Font{.cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_GetFontStyle*(font: PTTF_Font): int{.cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_SetFontStyle*(font: PTTF_Font, style: int){.cdecl,
importc, dynlib: SDLttfLibName.}
# Get the total height of the font - usually equal to point size
proc TTF_FontHeight*(font: PTTF_Font): int{.cdecl, importc, dynlib: SDLttfLibName.}
# Get the offset from the baseline to the top of the font
# This is a positive value, relative to the baseline.
#
proc TTF_FontAscent*(font: PTTF_Font): int{.cdecl, importc, dynlib: SDLttfLibName.}
# Get the offset from the baseline to the bottom of the font
# This is a negative value, relative to the baseline.
#
proc TTF_FontDescent*(font: PTTF_Font): int{.cdecl, importc, dynlib: SDLttfLibName.}
# Get the recommended spacing between lines of text for this font
proc TTF_FontLineSkip*(font: PTTF_Font): int{.cdecl, importc, dynlib: SDLttfLibName.}
# Get the number of faces of the font
proc TTF_FontFaces*(font: PTTF_Font): int32{.cdecl, importc, dynlib: SDLttfLibName.}
# Get the font face attributes, if any
proc TTF_FontFaceIsFixedWidth*(font: PTTF_Font): int{.cdecl,
importc, dynlib: SDLttfLibName.}
proc TTF_FontFaceFamilyName*(font: PTTF_Font): cstring{.cdecl,
importc, dynlib: SDLttfLibName.}
proc TTF_FontFaceStyleName*(font: PTTF_Font): cstring{.cdecl,
importc, dynlib: SDLttfLibName.}
# Get the metrics (dimensions) of a glyph
proc TTF_GlyphMetrics*(font: PTTF_Font, ch: Uint16, minx: var int,
maxx: var int, miny: var int, maxy: var int,
advance: var int): int{.cdecl, importc, dynlib: SDLttfLibName.}
# Get the dimensions of a rendered string of text
proc TTF_SizeText*(font: PTTF_Font, text: cstring, w: var int, y: var int): int{.
cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_SizeUTF8*(font: PTTF_Font, text: cstring, w: var int, y: var int): int{.
cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_SizeUNICODE*(font: PTTF_Font, text: PUint16, w: var int, y: var int): int{.
cdecl, importc, dynlib: SDLttfLibName.}
# Create an 8-bit palettized surface and render the given text at
# fast quality with the given font and color. The 0 pixel is the
# colorkey, giving a transparent background, and the 1 pixel is set
# to the text color.
# This function returns the new surface, or NULL if there was an error.
#
proc TTF_RenderUTF8_Solid*(font: PTTF_Font, text: cstring, fg: TSDL_Color): PSDL_Surface{.
cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_RenderUNICODE_Solid*(font: PTTF_Font, text: PUint16, fg: TSDL_Color): PSDL_Surface{.
cdecl, importc, dynlib: SDLttfLibName.}
#
#Create an 8-bit palettized surface and render the given glyph at
# fast quality with the given font and color. The 0 pixel is the
# colorkey, giving a transparent background, and the 1 pixel is set
# to the text color. The glyph is rendered without any padding or
# centering in the X direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc TTF_RenderGlyph_Solid*(font: PTTF_Font, ch: Uint16, fg: TSDL_Color): PSDL_Surface{.
cdecl, importc, dynlib: SDLttfLibName.}
# Create an 8-bit palettized surface and render the given text at
# high quality with the given font and colors. The 0 pixel is background,
# while other pixels have varying degrees of the foreground color.
# This function returns the new surface, or NULL if there was an error.
#
proc TTF_RenderText_Shaded*(font: PTTF_Font, text: cstring, fg: TSDL_Color,
bg: TSDL_Color): PSDL_Surface{.cdecl,
importc, dynlib: SDLttfLibName.}
proc TTF_RenderUTF8_Shaded*(font: PTTF_Font, text: cstring, fg: TSDL_Color,
bg: TSDL_Color): PSDL_Surface{.cdecl,
importc, dynlib: SDLttfLibName.}
proc TTF_RenderUNICODE_Shaded*(font: PTTF_Font, text: PUint16, fg: TSDL_Color,
bg: TSDL_Color): PSDL_Surface{.cdecl,
importc, dynlib: SDLttfLibName.}
# Create an 8-bit palettized surface and render the given glyph at
# high quality with the given font and colors. The 0 pixel is background,
# while other pixels have varying degrees of the foreground color.
# The glyph is rendered without any padding or centering in the X
# direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc TTF_RenderGlyph_Shaded*(font: PTTF_Font, ch: Uint16, fg: TSDL_Color,
bg: TSDL_Color): PSDL_Surface{.cdecl,
importc, dynlib: SDLttfLibName.}
# Create a 32-bit ARGB surface and render the given text at high quality,
# using alpha blending to dither the font with the given color.
# This function returns the new surface, or NULL if there was an error.
#
proc TTF_RenderText_Blended*(font: PTTF_Font, text: cstring, fg: TSDL_Color): PSDL_Surface{.
cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_RenderUTF8_Blended*(font: PTTF_Font, text: cstring, fg: TSDL_Color): PSDL_Surface{.
cdecl, importc, dynlib: SDLttfLibName.}
proc TTF_RenderUNICODE_Blended*(font: PTTF_Font, text: PUint16, fg: TSDL_Color): PSDL_Surface{.
cdecl, importc, dynlib: SDLttfLibName.}
# Create a 32-bit ARGB surface and render the given glyph at high quality,
# using alpha blending to dither the font with the given color.
# The glyph is rendered without any padding or centering in the X
# direction, and aligned normally in the Y direction.
# This function returns the new surface, or NULL if there was an error.
#
proc TTF_RenderGlyph_Blended*(font: PTTF_Font, ch: Uint16, fg: TSDL_Color): PSDL_Surface{.
cdecl, importc, dynlib: SDLttfLibName.}
# For compatibility with previous versions, here are the old functions
##define TTF_RenderText(font, text, fg, bg)
# TTF_RenderText_Shaded(font, text, fg, bg)
##define TTF_RenderUTF8(font, text, fg, bg)
# TTF_RenderUTF8_Shaded(font, text, fg, bg)
##define TTF_RenderUNICODE(font, text, fg, bg)
# TTF_RenderUNICODE_Shaded(font, text, fg, bg)
# Close an opened font file
proc TTF_CloseFont*(font: PTTF_Font){.cdecl, importc, dynlib: SDLttfLibName.}
#De-initialize TTF engine
proc TTF_Quit*(){.cdecl, importc, dynlib: SDLttfLibName.}
# Check if the TTF engine is initialized
proc TTF_WasInit*(): int{.cdecl, importc, dynlib: SDLttfLibName.}
# We'll use SDL for reporting errors
proc TTF_SetError*(fmt: cstring)
proc TTF_GetError*(): cstring
# implementation
proc SDL_TTF_VERSION(X: var TSDL_version) =
X.major = SDL_TTF_MAJOR_VERSION
X.minor = SDL_TTF_MINOR_VERSION
X.patch = SDL_TTF_PATCHLEVEL
proc TTF_SetError(fmt: cstring) =
SDL_SetError(fmt)
proc TTF_GetError(): cstring =
result = SDL_GetError()
when not(defined(Workaround_TTF_RenderText_Solid)):
proc TTF_RenderText_Solid*(font: PTTF_Font, text: cstring, fg: TSDL_Color): PSDL_Surface{.
cdecl, importc, dynlib: SDLttfLibName.}
else:
proc TTF_RenderText_Solid(font: PTTF_Font, text: cstring, fg: TSDL_Color): PSDL_Surface =
var Black: TSDL_Color # initialized to zero
Result = TTF_RenderText_Shaded(font, text, fg, Black)

Some files were not shown because too many files have changed in this diff Show More