From 841d6b6aa991785d046e1070f8bfa86a5b113555 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Tue, 13 Dec 2011 22:49:06 +0200 Subject: [PATCH 1/3] fixed some recently introduced compilation errors in the standard library --- lib/core/locks.nim | 2 +- lib/windows/shellapi.nim | 2 +- tests/compile/tslurp.nim | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/locks.nim b/lib/core/locks.nim index 6f139c7a2..6de22ee72 100644 --- a/lib/core/locks.nim +++ b/lib/core/locks.nim @@ -15,7 +15,7 @@ ## to release its locks should it be part of a deadlock. This thread then ## re-acquires its locks and proceeds. -include "lib/system/syslocks" +include "system/syslocks" type TLock* = TSysLock ## Nimrod lock; whether this is re-entrant diff --git a/lib/windows/shellapi.nim b/lib/windows/shellapi.nim index 17b16fdbd..da3159176 100755 --- a/lib/windows/shellapi.nim +++ b/lib/windows/shellapi.nim @@ -105,7 +105,7 @@ proc ShellAbout*(HWND: hWnd, szApp: LPCSTR, szOtherStuff: LPCSTR, HICON: hIcon): stdcall, dynlib: "shell32.dll", importc: "ShellAboutA".} proc ShellAbout*(HWND: hWnd, szApp: LPCWSTR, szOtherStuff: LPCWSTR, HICON: hIcon): int32{. stdcall, dynlib: "shell32.dll", importc: "ShellAboutW".} -proc DuplicateIcon*(hinst: HINST, HICON: hIcon): HIcon{.stdcall, +proc DuplicateIcon*(inst: HINST, icon: HICON): HIcon{.stdcall, dynlib: "shell32.dll", importc: "DuplicateIcon".} proc ExtractAssociatedIconA*(hInst: HINST, lpIconPath: LPSTR, lpiIcon: LPWORD): HICON{. stdcall, dynlib: "shell32.dll", importc: "ExtractAssociatedIconA".} diff --git a/tests/compile/tslurp.nim b/tests/compile/tslurp.nim index c99fefe23..f9456ce6b 100644 --- a/tests/compile/tslurp.nim +++ b/tests/compile/tslurp.nim @@ -1,6 +1,6 @@ const - myRes = slurp"readme.txt" + myRes = slurp"../../readme.txt" echo myRes From fff9276cf66827b7ddde8636d1cf6b50a0dd4417 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Sun, 18 Dec 2011 22:16:19 +0000 Subject: [PATCH 2/3] Added a couple of GTK 2.12 functions. --- lib/wrappers/gtk/glib2.nim | 6 ++++++ lib/wrappers/gtk/gtk2.nim | 3 +++ 2 files changed, 9 insertions(+) diff --git a/lib/wrappers/gtk/glib2.nim b/lib/wrappers/gtk/glib2.nim index 9947e2a4b..57d561432 100755 --- a/lib/wrappers/gtk/glib2.nim +++ b/lib/wrappers/gtk/glib2.nim @@ -4507,3 +4507,9 @@ proc g_thread_init*(vtable: pointer) {. proc g_timeout_add*(interval: guint, function, data: gpointer): guint {. cdecl, dynlib: gliblib, importc: "g_timeout_add".} + +proc g_idle_add*(function, data: gpointer): guint {. + cdecl, dynlib: gliblib, importc: "g_idle_add".} + +proc g_source_remove*(tag: guint): gboolean {. + cdecl, dynlib: gliblib, importc: "g_source_remove".} diff --git a/lib/wrappers/gtk/gtk2.nim b/lib/wrappers/gtk/gtk2.nim index 801582cba..e81f1753a 100755 --- a/lib/wrappers/gtk/gtk2.nim +++ b/lib/wrappers/gtk/gtk2.nim @@ -16880,3 +16880,6 @@ proc nimrod_init*() = cmdLine{.importc: "cmdLine".}: array[0..255, cstring] cmdCount{.importc: "cmdCount".}: cint init(addr(cmdLine), addr(cmdCount)) + +proc set_tooltip_text*(w: PWidget, t: cstring){.cdecl, + dynlib: lib, importc: "gtk_widget_set_tooltip_text".} From 4f08946f64f04ef85a53c686fb89b8d84fbc6d65 Mon Sep 17 00:00:00 2001 From: dom96 Date: Mon, 19 Dec 2011 21:09:17 +0000 Subject: [PATCH 3/3] fixes #77 --- lib/pure/strutils.nim | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index 33bb5b5f0..46dcb3849 100755 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -467,6 +467,16 @@ proc ParseHexInt*(s: string): int {.noSideEffect, procvar, inc(i) of '\0': break else: raise newException(EInvalidValue, "invalid integer: " & s) + +proc parseBool*(s: string): bool = + ## Parses a value into a `bool`. If ``s`` is one of the following values: + ## ``y, yes, true, 1, on``, then returns `true`. If ``s`` is one of the + ## following values: ``n, no, false, 0, off``, then returns `false`. + ## If ``s`` is something else a ``EInvalidValue`` exception is raised. + case normalize(s) + of "y", "yes", "true", "1", "on": result = true + of "n", "no", "false", "0", "off": result = false + else: raise newException(EInvalidValue, "cannot interpret as a bool: " & s) proc repeatChar*(count: int, c: Char = ' '): string {.noSideEffect, rtl, extern: "nsuRepeatChar".} =