further enhancements for the GTK wrapper

This commit is contained in:
Andreas Rumpf 2010-03-01 19:37:33 +01:00
commit 4ee65a08dd
84 changed files with 7864 additions and 1288 deletions

59
deinstall.sh Executable file
View file

@ -0,0 +1,59 @@
#! /bin/sh
# Generated by niminst
if [ $# -eq 1 ] ; then
case $1 in
"--help"|"-h"|"help"|"h")
echo "Nimrod deinstallation script"
echo "Usage: [sudo] sh deinstall.sh DIR"
echo "Where DIR may be:"
echo " /usr/bin"
echo " /usr/local/bin"
echo " /opt"
echo " <some other dir> (treated like '/opt')"
exit 1
;;
"/usr/bin")
bindir=/usr/bin
configdir=/etc
libdir=/usr/lib/nimrod
docdir=/usr/share/nimrod/doc
datadir=/usr/share/nimrod/data
;;
"/usr/local/bin")
bindir=/usr/local/bin
configdir=/etc
libdir=/usr/local/lib/nimrod
docdir=/usr/local/share/nimrod/doc
datadir=/usr/local/share/nimrod/data
;;
*)
bindir="$1/nimrod/bin"
configdir="$1/nimrod/config"
libdir="$1/nimrod/lib"
docdir="$1/nimrod/doc"
datadir="$1/nimrod/data"
;;
esac
echo "removing files..."
rm -f $bindir/nimrod
rm -f $configdir/nimdoc.cfg
rm -f $configdir/nimrod.cfg
rm -f $configdir/nimdoc.tex.cfg
rm -rf $docdir
rm -rf $datadir
rm -rf $libdir
echo "deinstallation successful"
else
echo "Nimrod deinstallation script"
echo "Usage: [sudo] sh deinstall.sh DIR"
echo "Where DIR may be:"
echo " /usr/bin"
echo " /usr/local/bin"
echo " /opt"
echo " <some other dir> (treated like '/opt')"
exit 1
fi

View file

@ -11,7 +11,7 @@ var
nimrod_init()
window = window_new(WINDOW_TOPLEVEL)
button = button_new_with_label("Click me")
button = button_new("Click me")
set_border_width(PContainer(Window), 5)
add(PContainer(window), button)
discard signal_connect(window, "destroy",

View file

@ -3,7 +3,7 @@ import
glib2, gtk2
proc newbutton(ALabel: cstring): PWidget =
Result = button_new_with_label(ALabel)
Result = button_new(ALabel)
show(result)
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =

View file

@ -3,7 +3,7 @@ import
glib2, gtk2
proc newbutton(ALabel: cstring): PWidget =
Result = button_new_with_label(ALabel)
Result = button_new(ALabel)
show(result)
proc destroy(widget: pWidget, data: pgpointer){.cdecl.} =

View file

@ -10,7 +10,7 @@ proc widgetDestroy(w: PWidget) {.cdecl.} =
nimrod_init()
var window = window_new(WINDOW_TOPLEVEL)
var button = button_new_with_label("Click me")
var button = button_new("Click me")
set_border_width(Window, 5)
add(window, button)
discard signal_connect(window, "destroy",

View file

@ -24,13 +24,12 @@ proc disablesignal(widget: pWidget, data: pgpointer){.cdecl.} =
s.disable = not s.disable
var
quitsignal: guint
QuitState: TButtonSignalState
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 quitbutton = button_new("Quit program")
var disablebutton = button_new("Disable button")
var windowbox = vbox_new(TRUE, 10)
pack_start(windowbox, disablebutton, True, false, 0)
pack_start(windowbox, quitbutton, True, false, 0)

View file

@ -15,7 +15,7 @@ var
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 button1 = button_new("Move mouse over button")
var buttonstyle = copy(get_style(Button1))
ButtonStyle.bg[STATE_PRELIGHT].pixel = 0
ButtonStyle.bg[STATE_PRELIGHT].red = -1'i16

464
install.sh Executable file
View file

@ -0,0 +1,464 @@
#! /bin/sh
# Generated by niminst
if [ $# -eq 1 ] ; then
if test -f bin/nimrod
then
echo "Nimrod build detected"
else
echo "Please build Nimrod before installing it"
exit 1
fi
case $1 in
"--help"|"-h"|"help"|"h")
echo "Nimrod installation script"
echo "Usage: [sudo] sh install.sh DIR"
echo "Where DIR may be:"
echo " /usr/bin"
echo " /usr/local/bin"
echo " /opt"
echo " <some other dir> (treated like '/opt')"
echo "To deinstall, use the command:"
echo "sh deinstall.sh DIR"
exit 1
;;
"/usr/bin")
bindir=/usr/bin
configdir=/etc
libdir=/usr/lib/nimrod
docdir=/usr/share/nimrod/doc
datadir=/usr/share/nimrod/data
;;
"/usr/local/bin")
bindir=/usr/local/bin
configdir=/etc
libdir=/usr/local/lib/nimrod
docdir=/usr/local/share/nimrod/doc
datadir=/usr/local/share/nimrod/data
;;
*)
bindir="$1/nimrod/bin"
configdir="$1/nimrod/config"
libdir="$1/nimrod/lib"
docdir="$1/nimrod/doc"
datadir="$1/nimrod/data"
mkdir -p $1/nimrod
mkdir -p $bindir
mkdir -p $configdir
;;
esac
mkdir -p $libdir
mkdir -p $docdir
echo "copying files..."
mkdir -p $libdir/system
mkdir -p $libdir/pure
mkdir -p $libdir/impure
mkdir -p $libdir/wrappers
mkdir -p $libdir/wrappers/cairo
mkdir -p $libdir/wrappers/gtk
mkdir -p $libdir/wrappers/lua
mkdir -p $libdir/wrappers/opengl
mkdir -p $libdir/wrappers/pcre
mkdir -p $libdir/wrappers/sdl
mkdir -p $libdir/wrappers/x11
mkdir -p $libdir/wrappers/zip
mkdir -p $libdir/windows
mkdir -p $libdir/posix
mkdir -p $libdir/ecmas
cp bin/nimrod $bindir/nimrod
chmod 755 $bindir/nimrod
cp config/nimdoc.cfg $configdir/nimdoc.cfg
chmod 644 $configdir/nimdoc.cfg
cp config/nimrod.cfg $configdir/nimrod.cfg
chmod 644 $configdir/nimrod.cfg
cp config/nimdoc.tex.cfg $configdir/nimdoc.tex.cfg
chmod 644 $configdir/nimdoc.tex.cfg
cp doc/abstypes.txt $docdir/abstypes.txt
chmod 644 $docdir/abstypes.txt
cp doc/altsyn.txt $docdir/altsyn.txt
chmod 644 $docdir/altsyn.txt
cp doc/apis.txt $docdir/apis.txt
chmod 644 $docdir/apis.txt
cp doc/astspec.txt $docdir/astspec.txt
chmod 644 $docdir/astspec.txt
cp doc/docs.txt $docdir/docs.txt
chmod 644 $docdir/docs.txt
cp doc/effects.txt $docdir/effects.txt
chmod 644 $docdir/effects.txt
cp doc/endb.txt $docdir/endb.txt
chmod 644 $docdir/endb.txt
cp doc/filelist.txt $docdir/filelist.txt
chmod 644 $docdir/filelist.txt
cp doc/filters.txt $docdir/filters.txt
chmod 644 $docdir/filters.txt
cp doc/gramcurl.txt $docdir/gramcurl.txt
chmod 644 $docdir/gramcurl.txt
cp doc/grammar.txt $docdir/grammar.txt
chmod 644 $docdir/grammar.txt
cp doc/intern.txt $docdir/intern.txt
chmod 644 $docdir/intern.txt
cp doc/lib.txt $docdir/lib.txt
chmod 644 $docdir/lib.txt
cp doc/manual.txt $docdir/manual.txt
chmod 644 $docdir/manual.txt
cp doc/nimrodc.txt $docdir/nimrodc.txt
chmod 644 $docdir/nimrodc.txt
cp doc/overview.txt $docdir/overview.txt
chmod 644 $docdir/overview.txt
cp doc/pegdocs.txt $docdir/pegdocs.txt
chmod 644 $docdir/pegdocs.txt
cp doc/readme.txt $docdir/readme.txt
chmod 644 $docdir/readme.txt
cp doc/regexprs.txt $docdir/regexprs.txt
chmod 644 $docdir/regexprs.txt
cp doc/rst.txt $docdir/rst.txt
chmod 644 $docdir/rst.txt
cp doc/theindex.txt $docdir/theindex.txt
chmod 644 $docdir/theindex.txt
cp doc/tut1.txt $docdir/tut1.txt
chmod 644 $docdir/tut1.txt
cp doc/tut2.txt $docdir/tut2.txt
chmod 644 $docdir/tut2.txt
cp doc/apis.html $docdir/apis.html
chmod 644 $docdir/apis.html
cp doc/cgi.html $docdir/cgi.html
chmod 644 $docdir/cgi.html
cp doc/complex.html $docdir/complex.html
chmod 644 $docdir/complex.html
cp doc/dynlib.html $docdir/dynlib.html
chmod 644 $docdir/dynlib.html
cp doc/endb.html $docdir/endb.html
chmod 644 $docdir/endb.html
cp doc/hashes.html $docdir/hashes.html
chmod 644 $docdir/hashes.html
cp doc/intern.html $docdir/intern.html
chmod 644 $docdir/intern.html
cp doc/lexbase.html $docdir/lexbase.html
chmod 644 $docdir/lexbase.html
cp doc/lib.html $docdir/lib.html
chmod 644 $docdir/lib.html
cp doc/macros.html $docdir/macros.html
chmod 644 $docdir/macros.html
cp doc/manual.html $docdir/manual.html
chmod 644 $docdir/manual.html
cp doc/math.html $docdir/math.html
chmod 644 $docdir/math.html
cp doc/nimrodc.html $docdir/nimrodc.html
chmod 644 $docdir/nimrodc.html
cp doc/os.html $docdir/os.html
chmod 644 $docdir/os.html
cp doc/osproc.html $docdir/osproc.html
chmod 644 $docdir/osproc.html
cp doc/overview.html $docdir/overview.html
chmod 644 $docdir/overview.html
cp doc/parsecfg.html $docdir/parsecfg.html
chmod 644 $docdir/parsecfg.html
cp doc/parsecsv.html $docdir/parsecsv.html
chmod 644 $docdir/parsecsv.html
cp doc/parseopt.html $docdir/parseopt.html
chmod 644 $docdir/parseopt.html
cp doc/parsesql.html $docdir/parsesql.html
chmod 644 $docdir/parsesql.html
cp doc/parsexml.html $docdir/parsexml.html
chmod 644 $docdir/parsexml.html
cp doc/pegs.html $docdir/pegs.html
chmod 644 $docdir/pegs.html
cp doc/regexprs.html $docdir/regexprs.html
chmod 644 $docdir/regexprs.html
cp doc/streams.html $docdir/streams.html
chmod 644 $docdir/streams.html
cp doc/strtabs.html $docdir/strtabs.html
chmod 644 $docdir/strtabs.html
cp doc/strutils.html $docdir/strutils.html
chmod 644 $docdir/strutils.html
cp doc/system.html $docdir/system.html
chmod 644 $docdir/system.html
cp doc/terminal.html $docdir/terminal.html
chmod 644 $docdir/terminal.html
cp doc/theindex.html $docdir/theindex.html
chmod 644 $docdir/theindex.html
cp doc/times.html $docdir/times.html
chmod 644 $docdir/times.html
cp doc/tut1.html $docdir/tut1.html
chmod 644 $docdir/tut1.html
cp doc/tut2.html $docdir/tut2.html
chmod 644 $docdir/tut2.html
cp doc/unicode.html $docdir/unicode.html
chmod 644 $docdir/unicode.html
cp doc/web.html $docdir/web.html
chmod 644 $docdir/web.html
cp doc/xmlgen.html $docdir/xmlgen.html
chmod 644 $docdir/xmlgen.html
cp doc/zipfiles.html $docdir/zipfiles.html
chmod 644 $docdir/zipfiles.html
cp doc/mytest.cfg $docdir/mytest.cfg
chmod 644 $docdir/mytest.cfg
cp lib/nimbase.h $libdir/nimbase.h
chmod 644 $libdir/nimbase.h
cp lib/cycle.h $libdir/cycle.h
chmod 644 $libdir/cycle.h
cp lib/system.nim $libdir/system.nim
chmod 644 $libdir/system.nim
cp lib/system/alloc.nim $libdir/system/alloc.nim
chmod 644 $libdir/system/alloc.nim
cp lib/system/ansi_c.nim $libdir/system/ansi_c.nim
chmod 644 $libdir/system/ansi_c.nim
cp lib/system/arithm.nim $libdir/system/arithm.nim
chmod 644 $libdir/system/arithm.nim
cp lib/system/assign.nim $libdir/system/assign.nim
chmod 644 $libdir/system/assign.nim
cp lib/system/cellsets.nim $libdir/system/cellsets.nim
chmod 644 $libdir/system/cellsets.nim
cp lib/system/cntbits.nim $libdir/system/cntbits.nim
chmod 644 $libdir/system/cntbits.nim
cp lib/system/debugger.nim $libdir/system/debugger.nim
chmod 644 $libdir/system/debugger.nim
cp lib/system/dyncalls.nim $libdir/system/dyncalls.nim
chmod 644 $libdir/system/dyncalls.nim
cp lib/system/ecmasys.nim $libdir/system/ecmasys.nim
chmod 644 $libdir/system/ecmasys.nim
cp lib/system/excpt.nim $libdir/system/excpt.nim
chmod 644 $libdir/system/excpt.nim
cp lib/system/gc.nim $libdir/system/gc.nim
chmod 644 $libdir/system/gc.nim
cp lib/system/hti.nim $libdir/system/hti.nim
chmod 644 $libdir/system/hti.nim
cp lib/system/mm.nim $libdir/system/mm.nim
chmod 644 $libdir/system/mm.nim
cp lib/system/profiler.nim $libdir/system/profiler.nim
chmod 644 $libdir/system/profiler.nim
cp lib/system/repr.nim $libdir/system/repr.nim
chmod 644 $libdir/system/repr.nim
cp lib/system/sets.nim $libdir/system/sets.nim
chmod 644 $libdir/system/sets.nim
cp lib/system/sysio.nim $libdir/system/sysio.nim
chmod 644 $libdir/system/sysio.nim
cp lib/system/sysstr.nim $libdir/system/sysstr.nim
chmod 644 $libdir/system/sysstr.nim
cp lib/pure/cgi.nim $libdir/pure/cgi.nim
chmod 644 $libdir/pure/cgi.nim
cp lib/pure/complex.nim $libdir/pure/complex.nim
chmod 644 $libdir/pure/complex.nim
cp lib/pure/dynlib.nim $libdir/pure/dynlib.nim
chmod 644 $libdir/pure/dynlib.nim
cp lib/pure/hashes.nim $libdir/pure/hashes.nim
chmod 644 $libdir/pure/hashes.nim
cp lib/pure/hashtabs.nim $libdir/pure/hashtabs.nim
chmod 644 $libdir/pure/hashtabs.nim
cp lib/pure/lexbase.nim $libdir/pure/lexbase.nim
chmod 644 $libdir/pure/lexbase.nim
cp lib/pure/macros.nim $libdir/pure/macros.nim
chmod 644 $libdir/pure/macros.nim
cp lib/pure/math.nim $libdir/pure/math.nim
chmod 644 $libdir/pure/math.nim
cp lib/pure/md5.nim $libdir/pure/md5.nim
chmod 644 $libdir/pure/md5.nim
cp lib/pure/os.nim $libdir/pure/os.nim
chmod 644 $libdir/pure/os.nim
cp lib/pure/osproc.nim $libdir/pure/osproc.nim
chmod 644 $libdir/pure/osproc.nim
cp lib/pure/parsecfg.nim $libdir/pure/parsecfg.nim
chmod 644 $libdir/pure/parsecfg.nim
cp lib/pure/parsecsv.nim $libdir/pure/parsecsv.nim
chmod 644 $libdir/pure/parsecsv.nim
cp lib/pure/parseopt.nim $libdir/pure/parseopt.nim
chmod 644 $libdir/pure/parseopt.nim
cp lib/pure/parsesql.nim $libdir/pure/parsesql.nim
chmod 644 $libdir/pure/parsesql.nim
cp lib/pure/parsexml.nim $libdir/pure/parsexml.nim
chmod 644 $libdir/pure/parsexml.nim
cp lib/pure/pegs.nim $libdir/pure/pegs.nim
chmod 644 $libdir/pure/pegs.nim
cp lib/pure/re.nim $libdir/pure/re.nim
chmod 644 $libdir/pure/re.nim
cp lib/pure/regexprs.nim $libdir/pure/regexprs.nim
chmod 644 $libdir/pure/regexprs.nim
cp lib/pure/streams.nim $libdir/pure/streams.nim
chmod 644 $libdir/pure/streams.nim
cp lib/pure/strtabs.nim $libdir/pure/strtabs.nim
chmod 644 $libdir/pure/strtabs.nim
cp lib/pure/strutils.nim $libdir/pure/strutils.nim
chmod 644 $libdir/pure/strutils.nim
cp lib/pure/terminal.nim $libdir/pure/terminal.nim
chmod 644 $libdir/pure/terminal.nim
cp lib/pure/times.nim $libdir/pure/times.nim
chmod 644 $libdir/pure/times.nim
cp lib/pure/unicode.nim $libdir/pure/unicode.nim
chmod 644 $libdir/pure/unicode.nim
cp lib/pure/variants.nim $libdir/pure/variants.nim
chmod 644 $libdir/pure/variants.nim
cp lib/pure/xmlgen.nim $libdir/pure/xmlgen.nim
chmod 644 $libdir/pure/xmlgen.nim
cp lib/impure/db_postgres.nim $libdir/impure/db_postgres.nim
chmod 644 $libdir/impure/db_postgres.nim
cp lib/impure/dialogs.nim $libdir/impure/dialogs.nim
chmod 644 $libdir/impure/dialogs.nim
cp lib/impure/web.nim $libdir/impure/web.nim
chmod 644 $libdir/impure/web.nim
cp lib/impure/zipfiles.nim $libdir/impure/zipfiles.nim
chmod 644 $libdir/impure/zipfiles.nim
cp lib/wrappers/iup.nim $libdir/wrappers/iup.nim
chmod 644 $libdir/wrappers/iup.nim
cp lib/wrappers/libcurl.nim $libdir/wrappers/libcurl.nim
chmod 644 $libdir/wrappers/libcurl.nim
cp lib/wrappers/mysql.nim $libdir/wrappers/mysql.nim
chmod 644 $libdir/wrappers/mysql.nim
cp lib/wrappers/odbcsql.nim $libdir/wrappers/odbcsql.nim
chmod 644 $libdir/wrappers/odbcsql.nim
cp lib/wrappers/postgres.nim $libdir/wrappers/postgres.nim
chmod 644 $libdir/wrappers/postgres.nim
cp lib/wrappers/python.nim $libdir/wrappers/python.nim
chmod 644 $libdir/wrappers/python.nim
cp lib/wrappers/sqlite3.nim $libdir/wrappers/sqlite3.nim
chmod 644 $libdir/wrappers/sqlite3.nim
cp lib/wrappers/tcl.nim $libdir/wrappers/tcl.nim
chmod 644 $libdir/wrappers/tcl.nim
cp lib/wrappers/cairo/cairo.nim $libdir/wrappers/cairo/cairo.nim
chmod 644 $libdir/wrappers/cairo/cairo.nim
cp lib/wrappers/cairo/cairoft.nim $libdir/wrappers/cairo/cairoft.nim
chmod 644 $libdir/wrappers/cairo/cairoft.nim
cp lib/wrappers/cairo/cairowin32.nim $libdir/wrappers/cairo/cairowin32.nim
chmod 644 $libdir/wrappers/cairo/cairowin32.nim
cp lib/wrappers/cairo/cairoxlib.nim $libdir/wrappers/cairo/cairoxlib.nim
chmod 644 $libdir/wrappers/cairo/cairoxlib.nim
cp lib/wrappers/gtk/atk.nim $libdir/wrappers/gtk/atk.nim
chmod 644 $libdir/wrappers/gtk/atk.nim
cp lib/wrappers/gtk/gdk2.nim $libdir/wrappers/gtk/gdk2.nim
chmod 644 $libdir/wrappers/gtk/gdk2.nim
cp lib/wrappers/gtk/gdk2pixbuf.nim $libdir/wrappers/gtk/gdk2pixbuf.nim
chmod 644 $libdir/wrappers/gtk/gdk2pixbuf.nim
cp lib/wrappers/gtk/gdkglext.nim $libdir/wrappers/gtk/gdkglext.nim
chmod 644 $libdir/wrappers/gtk/gdkglext.nim
cp lib/wrappers/gtk/glib2.nim $libdir/wrappers/gtk/glib2.nim
chmod 644 $libdir/wrappers/gtk/glib2.nim
cp lib/wrappers/gtk/gtk2.nim $libdir/wrappers/gtk/gtk2.nim
chmod 644 $libdir/wrappers/gtk/gtk2.nim
cp lib/wrappers/gtk/gtkglext.nim $libdir/wrappers/gtk/gtkglext.nim
chmod 644 $libdir/wrappers/gtk/gtkglext.nim
cp lib/wrappers/gtk/gtkhtml.nim $libdir/wrappers/gtk/gtkhtml.nim
chmod 644 $libdir/wrappers/gtk/gtkhtml.nim
cp lib/wrappers/gtk/libglade2.nim $libdir/wrappers/gtk/libglade2.nim
chmod 644 $libdir/wrappers/gtk/libglade2.nim
cp lib/wrappers/gtk/pango.nim $libdir/wrappers/gtk/pango.nim
chmod 644 $libdir/wrappers/gtk/pango.nim
cp lib/wrappers/gtk/pangoutils.nim $libdir/wrappers/gtk/pangoutils.nim
chmod 644 $libdir/wrappers/gtk/pangoutils.nim
cp lib/wrappers/lua/lauxlib.nim $libdir/wrappers/lua/lauxlib.nim
chmod 644 $libdir/wrappers/lua/lauxlib.nim
cp lib/wrappers/lua/lua.nim $libdir/wrappers/lua/lua.nim
chmod 644 $libdir/wrappers/lua/lua.nim
cp lib/wrappers/lua/lualib.nim $libdir/wrappers/lua/lualib.nim
chmod 644 $libdir/wrappers/lua/lualib.nim
cp lib/wrappers/opengl/gl.nim $libdir/wrappers/opengl/gl.nim
chmod 644 $libdir/wrappers/opengl/gl.nim
cp lib/wrappers/opengl/glext.nim $libdir/wrappers/opengl/glext.nim
chmod 644 $libdir/wrappers/opengl/glext.nim
cp lib/wrappers/opengl/glu.nim $libdir/wrappers/opengl/glu.nim
chmod 644 $libdir/wrappers/opengl/glu.nim
cp lib/wrappers/opengl/glut.nim $libdir/wrappers/opengl/glut.nim
chmod 644 $libdir/wrappers/opengl/glut.nim
cp lib/wrappers/opengl/glx.nim $libdir/wrappers/opengl/glx.nim
chmod 644 $libdir/wrappers/opengl/glx.nim
cp lib/wrappers/opengl/wingl.nim $libdir/wrappers/opengl/wingl.nim
chmod 644 $libdir/wrappers/opengl/wingl.nim
cp lib/wrappers/pcre/pcre.nim $libdir/wrappers/pcre/pcre.nim
chmod 644 $libdir/wrappers/pcre/pcre.nim
cp lib/wrappers/pcre/pcre_all.c $libdir/wrappers/pcre/pcre_all.c
chmod 644 $libdir/wrappers/pcre/pcre_all.c
cp lib/wrappers/sdl/sdl.nim $libdir/wrappers/sdl/sdl.nim
chmod 644 $libdir/wrappers/sdl/sdl.nim
cp lib/wrappers/sdl/sdl_gfx.nim $libdir/wrappers/sdl/sdl_gfx.nim
chmod 644 $libdir/wrappers/sdl/sdl_gfx.nim
cp lib/wrappers/sdl/sdl_image.nim $libdir/wrappers/sdl/sdl_image.nim
chmod 644 $libdir/wrappers/sdl/sdl_image.nim
cp lib/wrappers/sdl/sdl_mixer.nim $libdir/wrappers/sdl/sdl_mixer.nim
chmod 644 $libdir/wrappers/sdl/sdl_mixer.nim
cp lib/wrappers/sdl/sdl_mixer_nosmpeg.nim $libdir/wrappers/sdl/sdl_mixer_nosmpeg.nim
chmod 644 $libdir/wrappers/sdl/sdl_mixer_nosmpeg.nim
cp lib/wrappers/sdl/sdl_net.nim $libdir/wrappers/sdl/sdl_net.nim
chmod 644 $libdir/wrappers/sdl/sdl_net.nim
cp lib/wrappers/sdl/sdl_ttf.nim $libdir/wrappers/sdl/sdl_ttf.nim
chmod 644 $libdir/wrappers/sdl/sdl_ttf.nim
cp lib/wrappers/sdl/smpeg.nim $libdir/wrappers/sdl/smpeg.nim
chmod 644 $libdir/wrappers/sdl/smpeg.nim
cp lib/wrappers/x11/cursorfont.nim $libdir/wrappers/x11/cursorfont.nim
chmod 644 $libdir/wrappers/x11/cursorfont.nim
cp lib/wrappers/x11/keysym.nim $libdir/wrappers/x11/keysym.nim
chmod 644 $libdir/wrappers/x11/keysym.nim
cp lib/wrappers/x11/x.nim $libdir/wrappers/x11/x.nim
chmod 644 $libdir/wrappers/x11/x.nim
cp lib/wrappers/x11/xatom.nim $libdir/wrappers/x11/xatom.nim
chmod 644 $libdir/wrappers/x11/xatom.nim
cp lib/wrappers/x11/xcms.nim $libdir/wrappers/x11/xcms.nim
chmod 644 $libdir/wrappers/x11/xcms.nim
cp lib/wrappers/x11/xf86dga.nim $libdir/wrappers/x11/xf86dga.nim
chmod 644 $libdir/wrappers/x11/xf86dga.nim
cp lib/wrappers/x11/xf86vmode.nim $libdir/wrappers/x11/xf86vmode.nim
chmod 644 $libdir/wrappers/x11/xf86vmode.nim
cp lib/wrappers/x11/xi.nim $libdir/wrappers/x11/xi.nim
chmod 644 $libdir/wrappers/x11/xi.nim
cp lib/wrappers/x11/xinerama.nim $libdir/wrappers/x11/xinerama.nim
chmod 644 $libdir/wrappers/x11/xinerama.nim
cp lib/wrappers/x11/xkb.nim $libdir/wrappers/x11/xkb.nim
chmod 644 $libdir/wrappers/x11/xkb.nim
cp lib/wrappers/x11/xkblib.nim $libdir/wrappers/x11/xkblib.nim
chmod 644 $libdir/wrappers/x11/xkblib.nim
cp lib/wrappers/x11/xlib.nim $libdir/wrappers/x11/xlib.nim
chmod 644 $libdir/wrappers/x11/xlib.nim
cp lib/wrappers/x11/xrandr.nim $libdir/wrappers/x11/xrandr.nim
chmod 644 $libdir/wrappers/x11/xrandr.nim
cp lib/wrappers/x11/xrender.nim $libdir/wrappers/x11/xrender.nim
chmod 644 $libdir/wrappers/x11/xrender.nim
cp lib/wrappers/x11/xresource.nim $libdir/wrappers/x11/xresource.nim
chmod 644 $libdir/wrappers/x11/xresource.nim
cp lib/wrappers/x11/xshm.nim $libdir/wrappers/x11/xshm.nim
chmod 644 $libdir/wrappers/x11/xshm.nim
cp lib/wrappers/x11/xutil.nim $libdir/wrappers/x11/xutil.nim
chmod 644 $libdir/wrappers/x11/xutil.nim
cp lib/wrappers/x11/xv.nim $libdir/wrappers/x11/xv.nim
chmod 644 $libdir/wrappers/x11/xv.nim
cp lib/wrappers/x11/xvlib.nim $libdir/wrappers/x11/xvlib.nim
chmod 644 $libdir/wrappers/x11/xvlib.nim
cp lib/wrappers/zip/libzip.nim $libdir/wrappers/zip/libzip.nim
chmod 644 $libdir/wrappers/zip/libzip.nim
cp lib/wrappers/zip/zlib.nim $libdir/wrappers/zip/zlib.nim
chmod 644 $libdir/wrappers/zip/zlib.nim
cp lib/wrappers/zip/zzip.nim $libdir/wrappers/zip/zzip.nim
chmod 644 $libdir/wrappers/zip/zzip.nim
cp lib/wrappers/zip/libzip_all.c $libdir/wrappers/zip/libzip_all.c
chmod 644 $libdir/wrappers/zip/libzip_all.c
cp lib/windows/mmsystem.nim $libdir/windows/mmsystem.nim
chmod 644 $libdir/windows/mmsystem.nim
cp lib/windows/nb30.nim $libdir/windows/nb30.nim
chmod 644 $libdir/windows/nb30.nim
cp lib/windows/ole2.nim $libdir/windows/ole2.nim
chmod 644 $libdir/windows/ole2.nim
cp lib/windows/shellapi.nim $libdir/windows/shellapi.nim
chmod 644 $libdir/windows/shellapi.nim
cp lib/windows/shfolder.nim $libdir/windows/shfolder.nim
chmod 644 $libdir/windows/shfolder.nim
cp lib/windows/windows.nim $libdir/windows/windows.nim
chmod 644 $libdir/windows/windows.nim
cp lib/windows/winlean.nim $libdir/windows/winlean.nim
chmod 644 $libdir/windows/winlean.nim
cp lib/posix/posix.nim $libdir/posix/posix.nim
chmod 644 $libdir/posix/posix.nim
cp lib/ecmas/dom.nim $libdir/ecmas/dom.nim
chmod 644 $libdir/ecmas/dom.nim
echo "installation successful"
else
echo "Nimrod installation script"
echo "Usage: [sudo] sh install.sh DIR"
echo "Where DIR may be:"
echo " /usr/bin"
echo " /usr/local/bin"
echo " /opt"
echo " <some other dir> (treated like '/opt')"
echo "To deinstall, use the command:"
echo "sh deinstall.sh DIR"
exit 1
fi

0
lib/oldwrappers/cairo/cairo.nim Normal file → Executable file
View file

0
lib/oldwrappers/cairo/cairoft.nim Normal file → Executable file
View file

0
lib/oldwrappers/cairo/cairowin32.nim Normal file → Executable file
View file

0
lib/oldwrappers/cairo/cairoxlib.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/atk.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/gdk2.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/gdk2pixbuf.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/gdkglext.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/glib2.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/gtk2.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/gtkglext.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/gtkhtml.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/libglade2.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/pango.nim Normal file → Executable file
View file

0
lib/oldwrappers/gtk/pangoutils.nim Normal file → Executable file
View file

0
lib/oldwrappers/iup.nim Normal file → Executable file
View file

0
lib/oldwrappers/libcurl.nim Normal file → Executable file
View file

0
lib/oldwrappers/lua/lauxlib.nim Normal file → Executable file
View file

0
lib/oldwrappers/lua/lua.nim Normal file → Executable file
View file

0
lib/oldwrappers/lua/lualib.nim Normal file → Executable file
View file

0
lib/oldwrappers/mysql.nim Normal file → Executable file
View file

0
lib/oldwrappers/odbcsql.nim Normal file → Executable file
View file

0
lib/oldwrappers/opengl/gl.nim Normal file → Executable file
View file

0
lib/oldwrappers/opengl/glext.nim Normal file → Executable file
View file

0
lib/oldwrappers/opengl/glu.nim Normal file → Executable file
View file

0
lib/oldwrappers/opengl/glut.nim Normal file → Executable file
View file

0
lib/oldwrappers/opengl/glx.nim Normal file → Executable file
View file

0
lib/oldwrappers/opengl/wingl.nim Normal file → Executable file
View file

0
lib/oldwrappers/pcre/pcre.nim Normal file → Executable file
View file

0
lib/oldwrappers/pcre/pcre_all.c Normal file → Executable file
View file

0
lib/oldwrappers/postgres.nim Normal file → Executable file
View file

0
lib/oldwrappers/python.nim Normal file → Executable file
View file

0
lib/oldwrappers/sdl/sdl.nim Normal file → Executable file
View file

0
lib/oldwrappers/sdl/sdl_gfx.nim Normal file → Executable file
View file

0
lib/oldwrappers/sdl/sdl_image.nim Normal file → Executable file
View file

0
lib/oldwrappers/sdl/sdl_mixer.nim Normal file → Executable file
View file

0
lib/oldwrappers/sdl/sdl_mixer_nosmpeg.nim Normal file → Executable file
View file

0
lib/oldwrappers/sdl/sdl_net.nim Normal file → Executable file
View file

0
lib/oldwrappers/sdl/sdl_ttf.nim Normal file → Executable file
View file

0
lib/oldwrappers/sdl/smpeg.nim Normal file → Executable file
View file

0
lib/oldwrappers/sqlite3.nim Normal file → Executable file
View file

0
lib/oldwrappers/tcl.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/cursorfont.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/keysym.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/x.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xatom.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xcms.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xf86dga.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xf86vmode.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xi.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xinerama.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xkb.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xkblib.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xlib.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xrandr.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xrender.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xresource.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xshm.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xutil.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xv.nim Normal file → Executable file
View file

0
lib/oldwrappers/x11/xvlib.nim Normal file → Executable file
View file

0
lib/oldwrappers/zip/libzip.nim Normal file → Executable file
View file

0
lib/oldwrappers/zip/zlib.nim Normal file → Executable file
View file

0
lib/oldwrappers/zip/zzip.nim Normal file → Executable file
View file

View file

@ -1371,7 +1371,27 @@ proc peg*(pattern: string): TPeg =
## peg"{\ident} \s* '=' \s* {.*}"
result = parsePeg(pattern, "pattern")
proc escapePeg*(s: string): string =
## escapes `s` so that it is matched verbatim when used as a peg.
result = ""
var inQuote = false
for c in items(s):
case c
of '\0'..'\31', '\'', '"', '\\':
if inQuote:
result.add('\'')
inQuote = false
result.add("\\x")
result.add(toHex(ord(c), 2))
else:
if not inQuote:
result.add('\'')
inQuote = true
result.add(c)
if inQuote: result.add('\'')
when isMainModule:
assert escapePeg("abc''def'") == r"'abc'\x27\x27'def'\x27"
assert match("(a b c)", peg"'(' @ ')'")
assert match("W_HI_Le", peg"\y 'while'")
assert(not match("W_HI_L", peg"\y 'while'"))

View file

@ -273,6 +273,18 @@ proc split*(s: string, sep: TRegEx): seq[string] =
## Splits the string `s` into substrings.
accumulateResult(split(s, sep))
proc escapeRe*(s: string): string =
## escapes `s` so that it is matched verbatim when used as a regular
## expression.
result = ""
for c in items(s):
case c
of 'a'..'z', 'A'..'Z', '0'..'9', '_':
result.add(c)
else:
result.add("\\x")
result.add(toHex(ord(c), 2))
const ## common regular expressions
reIdentifier* = r"\b[a-zA-Z_]+[a-zA-Z_0-9]*\b" ## describes an identifier
reNatural* = r"\b\d+\b" ## describes a natural number

View file

@ -1012,11 +1012,11 @@ proc layout_line*(drawable: PDrawable, gc: PGC, x: gint, y: gint,
proc layout*(drawable: PDrawable, gc: PGC, x: gint, y: gint,
layout: PLayout){.cdecl, dynlib: lib,
importc: "gdk_draw_layout".}
proc layout_line_with_colors*(drawable: PDrawable, gc: PGC, x: gint,
proc layout_line*(drawable: PDrawable, gc: PGC, x: gint,
y: gint, line: PLayoutLine,
foreground: PColor, background: PColor){.
cdecl, dynlib: lib, importc: "gdk_draw_layout_line_with_colors".}
proc layout_with_colors*(drawable: PDrawable, gc: PGC, x: gint, y: gint,
proc layout*(drawable: PDrawable, gc: PGC, x: gint, y: gint,
layout: PLayout, foreground: PColor,
background: PColor){.cdecl, dynlib: lib,
importc: "gdk_draw_layout_with_colors".}
@ -1210,7 +1210,7 @@ proc GC_GET_CLASS*(obj: Pointer): PGCClass
proc gc_get_type*(): GType{.cdecl, dynlib: lib, importc: "gdk_gc_get_type".}
proc gc_new*(drawable: PDrawable): PGC{.cdecl, dynlib: lib,
importc: "gdk_gc_new".}
proc gc_new_with_values*(drawable: PDrawable, values: PGCValues,
proc gc_new*(drawable: PDrawable, values: PGCValues,
values_mask: TGCValuesMask): PGC{.cdecl, dynlib: lib,
importc: "gdk_gc_new_with_values".}
proc get_values*(gc: PGC, values: PGCValues){.cdecl, dynlib: lib,
@ -2844,7 +2844,7 @@ proc offset*(region: PRegion, dx: gint, dy: gint){.cdecl, dynlib: lib,
importc: "gdk_region_offset".}
proc shrink*(region: PRegion, dx: gint, dy: gint){.cdecl, dynlib: lib,
importc: "gdk_region_shrink".}
proc union_with_rect*(region: PRegion, rect: PRectangle){.cdecl,
proc union*(region: PRegion, rect: PRectangle){.cdecl,
dynlib: lib, importc: "gdk_region_union_with_rect".}
proc intersect*(source1: PRegion, source2: PRegion){.cdecl, dynlib: lib,
importc: "gdk_region_intersect".}
@ -3133,15 +3133,15 @@ const
bm_TWindowObject_destroyed* = 0x0018'i16
bp_TWindowObject_destroyed* = 3'i16
proc WindowObject_guffaw_gravity*(a: var TWindowObject): guint
proc WindowObject_set_guffaw_gravity*(a: var TWindowObject,
proc WindowObject_guffaw_gravity*(a: PWindowObject): guint
proc WindowObject_set_guffaw_gravity*(a: PWindowObject,
`guffaw_gravity`: guint)
proc WindowObject_input_only*(a: var TWindowObject): guint
proc WindowObject_set_input_only*(a: var TWindowObject, `input_only`: guint)
proc WindowObject_modal_hint*(a: var TWindowObject): guint
proc WindowObject_set_modal_hint*(a: var TWindowObject, `modal_hint`: guint)
proc WindowObject_destroyed*(a: var TWindowObject): guint
proc WindowObject_set_destroyed*(a: var TWindowObject, `destroyed`: guint)
proc WindowObject_input_only*(a: PWindowObject): guint
proc WindowObject_set_input_only*(a: PWindowObject, `input_only`: guint)
proc WindowObject_modal_hint*(a: PWindowObject): guint
proc WindowObject_set_modal_hint*(a: PWindowObject, `modal_hint`: guint)
proc WindowObject_destroyed*(a: PWindowObject): guint
proc WindowObject_set_destroyed*(a: PWindowObject, `destroyed`: guint)
proc window_object_get_type*(): GType{.cdecl, dynlib: lib,
importc: "gdk_window_object_get_type".}
proc new*(parent: PWindow, attributes: PWindowAttr, attributes_mask: gint): PWindow{.
@ -3800,39 +3800,39 @@ proc WINDOW_GET_CLASS*(obj: Pointer): PWindowObjectClass =
proc WINDOW_OBJECT*(anObject: Pointer): PWindowObject =
result = cast[PWindowObject](WINDOW(anObject))
proc WindowObject_guffaw_gravity*(a: var TWindowObject): guint =
proc WindowObject_guffaw_gravity*(a: PWindowObject): guint =
result = (a.flag0 and bm_TWindowObject_guffaw_gravity) shr
bp_TWindowObject_guffaw_gravity
proc WindowObject_set_guffaw_gravity*(a: var TWindowObject,
proc WindowObject_set_guffaw_gravity*(a: PWindowObject,
`guffaw_gravity`: guint) =
a.flag0 = a.flag0 or
(int16(`guffaw_gravity` shl bp_TWindowObject_guffaw_gravity) and
bm_TWindowObject_guffaw_gravity)
proc WindowObject_input_only*(a: var TWindowObject): guint =
proc WindowObject_input_only*(a: PWindowObject): guint =
result = (a.flag0 and bm_TWindowObject_input_only) shr
bp_TWindowObject_input_only
proc WindowObject_set_input_only*(a: var TWindowObject, `input_only`: guint) =
proc WindowObject_set_input_only*(a: PWindowObject, `input_only`: guint) =
a.flag0 = a.flag0 or
(int16(`input_only` shl bp_TWindowObject_input_only) and
bm_TWindowObject_input_only)
proc WindowObject_modal_hint*(a: var TWindowObject): guint =
proc WindowObject_modal_hint*(a: PWindowObject): guint =
result = (a.flag0 and bm_TWindowObject_modal_hint) shr
bp_TWindowObject_modal_hint
proc WindowObject_set_modal_hint*(a: var TWindowObject, `modal_hint`: guint) =
proc WindowObject_set_modal_hint*(a: PWindowObject, `modal_hint`: guint) =
a.flag0 = a.flag0 or
(int16(`modal_hint` shl bp_TWindowObject_modal_hint) and
bm_TWindowObject_modal_hint)
proc WindowObject_destroyed*(a: var TWindowObject): guint =
proc WindowObject_destroyed*(a: PWindowObject): guint =
result = (a.flag0 and bm_TWindowObject_destroyed) shr
bp_TWindowObject_destroyed
proc WindowObject_set_destroyed*(a: var TWindowObject, `destroyed`: guint) =
proc WindowObject_set_destroyed*(a: PWindowObject, `destroyed`: guint) =
a.flag0 = a.flag0 or
(int16(`destroyed` shl bp_TWindowObject_destroyed) and
bm_TWindowObject_destroyed)

271
lib/wrappers/gtk/gdk2pixbuf.nim Executable file
View file

@ -0,0 +1,271 @@
{.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*(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()

4498
lib/wrappers/gtk/glib2.nim Executable file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

111
lib/wrappers/gtk/libglade2.nim Executable file
View file

@ -0,0 +1,111 @@
{.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*(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()))

1157
lib/wrappers/gtk/pango.nim Executable file

File diff suppressed because it is too large Load diff

0
tests/accept/run/txmltree.nim Normal file → Executable file
View file

View file

@ -23,7 +23,7 @@
## Nimrod shall produce.
import
strutils, pegs, os, osproc, streams
strutils, pegs, os, osproc, streams, parsecsv
const
cmdTemplate = r"nimrod cc --hints:on $options $filename"
@ -169,7 +169,10 @@ proc main(options: string) =
inc(total)
Echo("[Tester] $#/$# tests passed\n" % [$passed, $total])
proc reject(options: string) =
## handle all the tests that the compiler should reject
proc accept(options: string) =

View file

@ -1,16 +0,0 @@
path="$lib/pure"
path="$lib/impure"
path="$lib/newwrap"
path="$lib/newwrap/cairo"
path="$lib/newwrap/gtk"
path="$lib/newwrap/lua"
path="$lib/newwrap/opengl"
path="$lib/newwrap/pcre"
path="$lib/newwrap/sdl"
path="$lib/newwrap/x11"
path="$lib/newwrap/zip"
path="$lib/wrappers/x11"
path="$lib/windows"
path="$lib/posix"
path="$lib/ecmas"

View file

@ -44,8 +44,8 @@ proc FileSaveClicked(menuitem: PMenuItem, userdata: pgpointer) {.cdecl.} =
var endIter: TTextIter
get_start_iter(InputTextBuffer, addr(startIter))
get_end_iter(InputTextBuffer, addr(endIter))
var InputText = get_text(InputTextBuffer, addr(startIter), addr(endIter), False)
var InputText = get_text(InputTextBuffer, addr(startIter),
addr(endIter), False)
var f: TFile
if open(f, path, fmWrite):
f.write(InputText)
@ -54,12 +54,17 @@ proc FileSaveClicked(menuitem: PMenuItem, userdata: pgpointer) {.cdecl.} =
error(w, "Unable to write to file")
proc inputKeyPressed(widget: PWidget, event: PEventKey, userdata: pgpointer): bool =
proc inputKeyPressed(widget: PWidget, event: PEventKey,
userdata: pgpointer): bool =
if ($keyval_name(event.keyval)).tolower() == "shift_l":
# SHIFT is pressed
shiftPressed = True
proc inputKeyReleased(widget: PWidget, event: PEventKey, userdata: pgpointer): bool =
proc setError(msg: string) =
outputTextBuffer.setText(msg, msg.len)
proc inputKeyReleased(widget: PWidget, event: PEventKey,
userdata: pgpointer): bool =
echo(keyval_name(event.keyval))
if ($keyval_name(event.keyval)).tolower() == "shift_l":
# SHIFT is released
@ -73,13 +78,14 @@ proc inputKeyReleased(widget: PWidget, event: PEventKey, userdata: pgpointer): b
var endIter: TTextIter
get_start_iter(InputTextBuffer, addr(startIter))
get_end_iter(InputTextBuffer, addr(endIter))
var InputText = get_text(InputTextBuffer, addr(startIter), addr(endIter), False)
var InputText = get_text(InputTextBuffer, addr(startIter),
addr(endIter), False)
try:
var r = execCode($InputText)
set_text(OutputTextBuffer, r[0] & r[1], len(r[0] & r[1]))
except:
set_text(OutputTextBuffer, "Error: Could not open file temp.nim", len("Error: Could not open file temp.nim"))
setError("Error: Could not open file temp.nim")
proc initControls() =
@ -97,17 +103,17 @@ proc initControls() =
show(TopMenu)
var FileMenu = menu_new()
var OpenMenuItem = menu_item_new_with_label("Open")
var OpenMenuItem = menu_item_new("Open")
append(FileMenu, OpenMenuItem)
show(OpenMenuItem)
discard signal_connect(OpenMenuItem, "activate",
SIGNAL_FUNC(FileOpenClicked), nil)
var SaveMenuItem = menu_item_new_with_label("Save...")
var SaveMenuItem = menu_item_new("Save...")
append(FileMenu, SaveMenuItem)
show(SaveMenuItem)
discard signal_connect(SaveMenuItem, "activate",
SIGNAL_FUNC(FileSaveClicked), nil)
var FileMenuItem = menu_item_new_with_label("File")
var FileMenuItem = menu_item_new("File")
set_submenu(FileMenuItem, FileMenu)
@ -129,7 +135,7 @@ proc initControls() =
# InputTextView (TextView)
var InputScrolledWindow = scrolled_window_new(nil, nil)
set_policy(InputScrolledWindow, POLICY_AUTOMATIC, POLICY_AUTOMATIC)
var InputTextView = text_view_new_with_buffer(InputTextBuffer)
var InputTextView = text_view_new(InputTextBuffer)
add_with_viewport(InputScrolledWindow, InputTextView)
add1(paned, InputScrolledWindow)
show(InputScrolledWindow)
@ -143,7 +149,7 @@ proc initControls() =
# OutputTextView (TextView)
var OutputScrolledWindow = scrolled_window_new(nil, nil)
set_policy(OutputScrolledWindow, POLICY_AUTOMATIC, POLICY_AUTOMATIC)
var OutputTextView = text_view_new_with_buffer(OutputTextBuffer)
var OutputTextView = text_view_new(OutputTextBuffer)
add_with_viewport(OutputScrolledWindow, OutputTextView)
add2(paned, OutputScrolledWindow)
show(OutputScrolledWindow)