mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
Merge branch 'master' of github.com:Araq/Nimrod
This commit is contained in:
@@ -411,7 +411,7 @@ proc JoinPath*(head, tail: string): string {.
|
||||
else:
|
||||
result = head & DirSep & tail
|
||||
|
||||
proc JoinPath*(parts: openarray[string]): string {.noSideEffect,
|
||||
proc JoinPath*(parts: varargs[string]): string {.noSideEffect,
|
||||
rtl, extern: "nos$1OpenArray".} =
|
||||
## The same as `JoinPath(head, tail)`, but works with any number
|
||||
## of directory parts.
|
||||
|
||||
@@ -194,7 +194,7 @@ proc ssAtEnd(s: PStream): bool =
|
||||
|
||||
proc ssSetPosition(s: PStream, pos: int) =
|
||||
var s = PStringStream(s)
|
||||
s.pos = min(pos, s.data.len-1)
|
||||
s.pos = clamp(pos, 0, s.data.high)
|
||||
|
||||
proc ssGetPosition(s: PStream): int =
|
||||
var s = PStringStream(s)
|
||||
|
||||
@@ -654,6 +654,20 @@ proc find*(s: string, chars: set[char], start: int = 0): int {.noSideEffect,
|
||||
for i in start..s.len-1:
|
||||
if s[i] in chars: return i
|
||||
return -1
|
||||
|
||||
proc rfind*(s, sub: string, start: int = -1): int {.noSideEffect.} =
|
||||
## Searches for `sub` in `s` in reverse, starting at `start` and going
|
||||
## backwards to 0. Searching is case-sensitive. If `sub` is not in `s`, -1 is
|
||||
## returned.
|
||||
let realStart = if start == -1: s.len else: start
|
||||
for i in countdown(realStart-sub.len, 0):
|
||||
for j in 0..sub.len-1:
|
||||
result = i
|
||||
if sub[j] != s[i+j]:
|
||||
result = -1
|
||||
break
|
||||
if result != -1: return
|
||||
return -1
|
||||
|
||||
proc quoteIfContainsWhite*(s: string): string =
|
||||
## returns ``'"' & s & '"'`` if `s` contains a space and does not
|
||||
|
||||
@@ -4529,3 +4529,6 @@ proc g_idle_add_full*(priority: guint, function,
|
||||
|
||||
proc g_source_remove*(tag: guint): gboolean {.
|
||||
cdecl, dynlib: gliblib, importc: "g_source_remove".}
|
||||
|
||||
proc g_signal_emit_by_name*(instance: gpointer, detailed_signal: cstring) {.
|
||||
cdecl, varargs, dynlib: gobjectlib, importc.}
|
||||
|
||||
@@ -4444,6 +4444,10 @@ proc get_value*(adjustment: PAdjustment): gdouble{.cdecl,
|
||||
dynlib: lib, importc: "gtk_adjustment_get_value".}
|
||||
proc set_value*(adjustment: PAdjustment, value: gdouble){.cdecl,
|
||||
dynlib: lib, importc: "gtk_adjustment_set_value".}
|
||||
proc get_upper*(adjustment: PAdjustment): gdouble{.cdecl,
|
||||
dynlib: lib, importc: "gtk_adjustment_get_upper".}
|
||||
proc get_page_size*(adjustment: PAdjustment): gdouble{.cdecl,
|
||||
dynlib: lib, importc: "gtk_adjustment_get_page_size".}
|
||||
proc TYPE_ALIGNMENT*(): GType
|
||||
proc ALIGNMENT*(obj: pointer): PAlignment
|
||||
proc ALIGNMENT_CLASS*(klass: pointer): PAlignmentClass
|
||||
@@ -9507,6 +9511,14 @@ proc get_line_log_attrs*(buffer: PTextBuffer,
|
||||
dynlib: lib, importc: "_gtk_text_buffer_get_line_log_attrs".}
|
||||
proc notify_will_remove_tag*(buffer: PTextBuffer, tag: PTextTag){.
|
||||
cdecl, dynlib: lib, importc: "_gtk_text_buffer_notify_will_remove_tag".}
|
||||
proc get_has_selection*(buffer: PTextBuffer): bool {.cdecl,
|
||||
dynlib: lib, importc: "gtk_text_buffer_get_has_selection".}
|
||||
proc select_range*(buffer: PTextBuffer, ins,
|
||||
bound: PTextIter) {.cdecl, dynlib: lib, importc: "gtk_text_buffer_select_range".}
|
||||
proc backspace*(buffer: PTextBuffer, iter: PTextIter,
|
||||
interactive, defaultEditable: bool): bool {.cdecl,
|
||||
dynlib: lib, importc: "gtk_text_buffer_backspace".}
|
||||
|
||||
proc TYPE_TEXT_LAYOUT*(): GType
|
||||
proc TEXT_LAYOUT*(obj: pointer): PTextLayout
|
||||
proc TEXT_LAYOUT_CLASS*(klass: pointer): PTextLayoutClass
|
||||
@@ -16874,12 +16886,6 @@ proc get_realized*(w: PWidget): gboolean {.cdecl, dynlib: lib,
|
||||
proc set_skip_taskbar_hint*(window: PWindow, setting: gboolean){.cdecl,
|
||||
dynlib: lib, importc: "gtk_window_set_skip_taskbar_hint".}
|
||||
|
||||
proc nimrod_init*() =
|
||||
var
|
||||
cmdLine{.importc: "cmdLine".}: array[0..255, cstring]
|
||||
cmdCount{.importc: "cmdCount".}: cint
|
||||
init(addr(cmdLine), addr(cmdCount))
|
||||
|
||||
type
|
||||
TTooltip* {.pure, final.} = object
|
||||
PTooltip* = ptr TTooltip
|
||||
@@ -16904,3 +16910,12 @@ proc set_markup*(tp: PTooltip, mk: cstring){.cdecl, dynlib: lib,
|
||||
|
||||
proc set_visible_window*(evBox: PEventBox, v: gboolean){.cdecl, dynlib: lib,
|
||||
importc: "gtk_event_box_set_visible_window".}
|
||||
|
||||
proc get_vadjustment*(scrolled_window: PTextView): PAdjustment{.
|
||||
cdecl, dynlib: lib, importc: "gtk_text_view_get_vadjustment".}
|
||||
|
||||
proc nimrod_init*() =
|
||||
var
|
||||
cmdLine{.importc: "cmdLine".}: array[0..255, cstring]
|
||||
cmdCount{.importc: "cmdCount".}: cint
|
||||
init(addr(cmdLine), addr(cmdCount))
|
||||
|
||||
Reference in New Issue
Block a user