diff options
author | Zahary Karadjov <zahary@gmail.com> | 2013-01-27 23:41:45 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2013-01-27 23:41:45 +0200 |
commit | 81a3585872b1a327b62ba528addbee913d6bbe5a (patch) | |
tree | aff8358bc86704edbd89fd56ec4f7b0cd3583bca /lib/wrappers | |
parent | 67f37264b3f461fe46f5cfea7c35c0a4f709dcb0 (diff) | |
parent | 07585088955c1fe8fb815c40409ed9f5d66fd446 (diff) | |
download | Nim-81a3585872b1a327b62ba528addbee913d6bbe5a.tar.gz |
merged upstream master
Diffstat (limited to 'lib/wrappers')
-rwxr-xr-x | lib/wrappers/gtk/gtk2.nim | 19 | ||||
-rw-r--r-- | lib/wrappers/libffi.nim | 149 | ||||
-rwxr-xr-x | lib/wrappers/lua/lua.nim | 39 | ||||
-rwxr-xr-x | lib/wrappers/openssl.nim | 2 | ||||
-rwxr-xr-x | lib/wrappers/sdl/sdl_image.nim | 18 |
5 files changed, 205 insertions, 22 deletions
diff --git a/lib/wrappers/gtk/gtk2.nim b/lib/wrappers/gtk/gtk2.nim index a1bfa7fe1..6b418024e 100755 --- a/lib/wrappers/gtk/gtk2.nim +++ b/lib/wrappers/gtk/gtk2.nim @@ -16596,6 +16596,9 @@ proc message_dialog_new*(parent: PWindow, flags: TDialogFlags, thetype: TMessageType, buttons: TButtonsType, message_format: cstring): PMessageDialog{.varargs, cdecl, importc: "gtk_message_dialog_new", dynlib: lib.} +proc set_markup*(msgDialog: PMessageDialog, str: cstring) {.cdecl, + importc: "gtk_message_dialog_set_markup", dynlib: lib.} + proc signal_new*(name: cstring, signal_flags: TSignalRunType, object_type: TType, function_offset: guint, marshaller: TSignalMarshaller, return_val: TType, n_args: guint): guint{. @@ -16893,6 +16896,15 @@ type proc set_tooltip_text*(w: PWidget, t: cstring){.cdecl, dynlib: lib, importc: "gtk_widget_set_tooltip_text".} +proc get_tooltip_text*(w: PWidget): cstring{.cdecl, + dynlib: lib, importc: "gtk_widget_get_tooltip_text".} + +proc set_tooltip_markup*(w: PWidget, m: cstring) {.cdecl, dynlib: lib, + importc: "gtk_widget_set_tooltip_markup".} + +proc get_tooltip_markup*(w: PWidget): cstring {.cdecl, dynlib: lib, + importc: "gtk_widget_get_tooltip_markup".} + proc set_tooltip_column*(w: PTreeview, column: gint){.cdecl, dynlib: lib, importc: "gtk_tree_view_set_tooltip_column".} @@ -16905,6 +16917,9 @@ proc trigger_tooltip_query*(widg: PTooltip){.cdecl, dynlib: lib, proc set_has_tooltip*(widget: PWidget, b: gboolean){.cdecl, dynlib: lib, importc: "gtk_widget_set_has_tooltip".} +proc get_has_tooltip*(widget: PWidget): gboolean{.cdecl, dynlib: lib, + importc: "gtk_widget_get_has_tooltip".} + proc set_markup*(tp: PTooltip, mk: cstring){.cdecl, dynlib: lib, importc: "gtk_tooltip_set_markup".} @@ -17035,6 +17050,10 @@ proc remove*(combo_box: PComboBoxText; position: gint){.cdecl, importc: "gtk_combo_box_text_remove", dynlib: lib.} proc get_active_text*(combo_box: PComboBoxText): cstring{.cdecl, importc: "gtk_combo_box_text_get_active_text", dynlib: lib.} +proc is_active*(win: PWindow): gboolean{.cdecl, + importc: "gtk_window_is_active", dynlib: lib.} +proc has_toplevel_focus*(win: PWindow): gboolean{.cdecl, + importc: "gtk_window_has_toplevel_focus", dynlib: lib.} proc nimrod_init*() = var diff --git a/lib/wrappers/libffi.nim b/lib/wrappers/libffi.nim new file mode 100644 index 000000000..514ce024f --- /dev/null +++ b/lib/wrappers/libffi.nim @@ -0,0 +1,149 @@ +# -----------------------------------------------------------------*-C-*- +# libffi 3.0.10 - Copyright (c) 2011 Anthony Green +# - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. +# +# 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 libffidll* = "libffi.dll" +elif defined(macosx): + const libffidll* = "libffi.dylib" +else: + const libffidll* = "libffi.so" + +type + TArg* = int + TSArg* = int + +when defined(windows) and defined(x86): + type + TABI* {.size: sizeof(cint).} = enum + FIRST_ABI, SYSV, STDCALL + + const DEFAULT_ABI* = SYSV +elif defined(amd64) and defined(windows): + type + TABI* {.size: sizeof(cint).} = enum + FIRST_ABI, WIN64 + const DEFAULT_ABI* = WIN64 +else: + type + TABI* {.size: sizeof(cint).} = enum + FIRST_ABI, SYSV, UNIX64 + + when defined(i386): + const DEFAULT_ABI* = SYSV + else: + const DEFAULT_ABI* = UNIX64 + +const + tkVOID* = 0 + tkINT* = 1 + tkFLOAT* = 2 + tkDOUBLE* = 3 + tkLONGDOUBLE* = 4 + tkUINT8* = 5 + tkSINT8* = 6 + tkUINT16* = 7 + tkSINT16* = 8 + tkUINT32* = 9 + tkSINT32* = 10 + tkUINT64* = 11 + tkSINT64* = 12 + tkSTRUCT* = 13 + tkPOINTER* = 14 + + tkLAST = tkPOINTER + tkSMALL_STRUCT_1B* = (tkLAST + 1) + tkSMALL_STRUCT_2B* = (tkLAST + 2) + tkSMALL_STRUCT_4B* = (tkLAST + 3) + +type + TType* = object + size*: int + alignment*: uint16 + typ*: uint16 + elements*: ptr ptr TType + +var + type_void* {.importc: "ffi_type_void", dynlib: libffidll.}: TType + type_uint8* {.importc: "ffi_type_uint8", dynlib: libffidll.}: TType + type_sint8* {.importc: "ffi_type_sint8", dynlib: libffidll.}: TType + type_uint16* {.importc: "ffi_type_uint16", dynlib: libffidll.}: TType + type_sint16* {.importc: "ffi_type_sint16", dynlib: libffidll.}: TType + type_uint32* {.importc: "ffi_type_uint32", dynlib: libffidll.}: TType + type_sint32* {.importc: "ffi_type_sint32", dynlib: libffidll.}: TType + type_uint64* {.importc: "ffi_type_uint64", dynlib: libffidll.}: TType + type_sint64* {.importc: "ffi_type_sint64", dynlib: libffidll.}: TType + type_float* {.importc: "ffi_type_float", dynlib: libffidll.}: TType + type_double* {.importc: "ffi_type_double", dynlib: libffidll.}: TType + type_pointer* {.importc: "ffi_type_pointer", dynlib: libffidll.}: TType + type_longdouble* {.importc: "ffi_type_longdouble", dynlib: libffidll.}: TType + +type + Tstatus* {.size: sizeof(cint).} = enum + OK, BAD_TYPEDEF, BAD_ABI + TTypeKind* = cuint + TCif* {.pure, final.} = object + abi*: TABI + nargs*: cuint + arg_types*: ptr ptr TType + rtype*: ptr TType + bytes*: cuint + flags*: cuint + +type + TRaw* = object + sint*: TSArg + +proc raw_call*(cif: var Tcif; fn: proc () {.cdecl.}; rvalue: pointer; + avalue: ptr TRaw) {.cdecl, importc: "ffi_raw_call", + dynlib: libffidll.} +proc ptrarray_to_raw*(cif: var Tcif; args: ptr pointer; raw: ptr TRaw) {.cdecl, + importc: "ffi_ptrarray_to_raw", dynlib: libffidll.} +proc raw_to_ptrarray*(cif: var Tcif; raw: ptr TRaw; args: ptr pointer) {.cdecl, + importc: "ffi_raw_to_ptrarray", dynlib: libffidll.} +proc raw_size*(cif: var Tcif): int {.cdecl, importc: "ffi_raw_size", + dynlib: libffidll.} + +proc prep_cif*(cif: var Tcif; abi: TABI; nargs: cuint; rtype: ptr TType; + atypes: ptr ptr TType): TStatus {.cdecl, importc: "ffi_prep_cif", + dynlib: libffidll.} +proc call*(cif: var Tcif; fn: proc () {.cdecl.}; rvalue: pointer; + avalue: ptr pointer) {.cdecl, importc: "ffi_call", dynlib: libffidll.} + +# the same with an easier interface: +type + TParamList* = array[0..100, ptr TType] + TArgList* = array[0..100, pointer] + +proc prep_cif*(cif: var Tcif; abi: TABI; nargs: cuint; rtype: ptr TType; + atypes: TParamList): TStatus {.cdecl, importc: "ffi_prep_cif", + dynlib: libffidll.} +proc call*(cif: var Tcif; fn, rvalue: pointer; + avalue: TArgList) {.cdecl, importc: "ffi_call", dynlib: libffidll.} + +# Useful for eliminating compiler warnings +##define FFI_FN(f) ((void (*)(void))f) diff --git a/lib/wrappers/lua/lua.nim b/lib/wrappers/lua/lua.nim index 000e09993..0346c4285 100755 --- a/lib/wrappers/lua/lua.nim +++ b/lib/wrappers/lua/lua.nim @@ -35,19 +35,32 @@ #** 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" - +when defined(useLuajit): + when defined(MACOSX): + const + NAME* = "libluajit.dylib" + LIB_NAME* = "libluajit.dylib" + elif defined(UNIX): + const + NAME* = "libluajit.so(|.0)" + LIB_NAME* = "libluajit.so(|.0)" + else: + const + NAME* = "luajit.dll" + LIB_NAME* = "luajit.dll" +else: + 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" diff --git a/lib/wrappers/openssl.nim b/lib/wrappers/openssl.nim index d33eded68..438774a15 100755 --- a/lib/wrappers/openssl.nim +++ b/lib/wrappers/openssl.nim @@ -39,6 +39,8 @@ ## OpenSSL support +{.deadCodeElim: on.} + when defined(WINDOWS): const DLLSSLName = "(ssleay32|libssl32).dll" diff --git a/lib/wrappers/sdl/sdl_image.nim b/lib/wrappers/sdl/sdl_image.nim index 7df9aedd4..16e41070b 100755 --- a/lib/wrappers/sdl/sdl_image.nim +++ b/lib/wrappers/sdl/sdl_image.nim @@ -128,19 +128,19 @@ # #****************************************************************************** -import +import sdl -when defined(windows): - const +when defined(windows): + const ImageLibName = "SDL_Image.dll" -elif defined(macosx): - const +elif defined(macosx): + const ImageLibName = "libSDL_image-1.2.0.dylib" -else: - const - ImageLibName = "libSDL_image.so" -const +else: + const + ImageLibName = "libSDL_image(.so|-1.2.so.0)" +const IMAGE_MAJOR_VERSION* = 1 IMAGE_MINOR_VERSION* = 2 IMAGE_PATCHLEVEL* = 5 |