mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-16 22:11:18 +00:00
version 0.8.8
This commit is contained in:
5
tests/accept/compile/tconvcolors.nim
Executable file
5
tests/accept/compile/tconvcolors.nim
Executable file
@@ -0,0 +1,5 @@
|
||||
|
||||
import colors
|
||||
|
||||
echo int32(colWhite), 'A'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import dialogs, gtk2
|
||||
|
||||
gtk_nimrod_init()
|
||||
gtk2.nimrod_init()
|
||||
|
||||
var x = ChooseFilesToOpen(nil)
|
||||
for a in items(x):
|
||||
|
||||
@@ -3,10 +3,10 @@ import
|
||||
gtk2, glib2, atk, gdk2, gdk2pixbuf, libglade2, pango,
|
||||
pangoutils
|
||||
|
||||
proc hello(widget: PGtkWidget, data: pointer) {.cdecl.} =
|
||||
proc hello(widget: PWidget, data: pointer) {.cdecl.} =
|
||||
write(stdout, "Hello World\n")
|
||||
|
||||
proc delete_event(widget: PGtkWidget, event: PGdkEvent,
|
||||
proc delete_event(widget: PWidget, event: PEvent,
|
||||
data: pointer): bool {.cdecl.} =
|
||||
# If you return FALSE in the "delete_event" signal handler,
|
||||
# GTK will emit the "destroy" signal. Returning TRUE means
|
||||
@@ -19,43 +19,33 @@ proc delete_event(widget: PGtkWidget, event: PGdkEvent,
|
||||
return false
|
||||
|
||||
# Another callback
|
||||
proc destroy(widget: PGtkWidget, data: pointer) {.cdecl.} =
|
||||
gtk_main_quit()
|
||||
proc mydestroy(widget: PWidget, data: pointer) {.cdecl.} =
|
||||
gtk2.main_quit()
|
||||
|
||||
proc main() =
|
||||
proc mymain() =
|
||||
# GtkWidget is the storage type for widgets
|
||||
var
|
||||
window: PGtkWindow
|
||||
button: PGtkButton
|
||||
|
||||
gtk_nimrod_init()
|
||||
window = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL))
|
||||
gtk2.nimrod_init()
|
||||
var window = window_new(gtk2.WINDOW_TOPLEVEL)
|
||||
discard g_signal_connect(window, "delete_event",
|
||||
Gcallback(delete_event), nil)
|
||||
discard g_signal_connect(window, "destroy", Gcallback(destroy), nil)
|
||||
discard g_signal_connect(window, "destroy", Gcallback(mydestroy), nil)
|
||||
# Sets the border width of the window.
|
||||
gtk_container_set_border_width(window, 10)
|
||||
set_border_width(window, 10)
|
||||
|
||||
# Creates a new button with the label "Hello World".
|
||||
button = GTK_BUTTON(gtk_button_new_with_label("Hello World"))
|
||||
var button = button_new("Hello World")
|
||||
|
||||
discard g_signal_connect(button, "clicked", Gcallback(hello), nil)
|
||||
|
||||
# This will cause the window to be destroyed by calling
|
||||
# gtk_widget_destroy(window) when "clicked". Again, the destroy
|
||||
# signal could come from here, or the window manager.
|
||||
discard g_signal_connect_swapped(button, "clicked",
|
||||
Gcallback(gtk_widget_destroy), window)
|
||||
|
||||
# This packs the button into the window (a gtk container).
|
||||
gtk_container_add(window, button)
|
||||
add(window, button)
|
||||
|
||||
# The final step is to display this newly created widget.
|
||||
gtk_widget_show(button)
|
||||
show(button)
|
||||
|
||||
# and the window
|
||||
gtk_widget_show(window)
|
||||
show(window)
|
||||
|
||||
gtk_main()
|
||||
gtk2.main()
|
||||
|
||||
main()
|
||||
mymain()
|
||||
|
||||
@@ -18,7 +18,7 @@ proc splitText(txt: string): seq[string] # splits a text into several lines
|
||||
# the comment continues here
|
||||
# this is not easy to parse!
|
||||
|
||||
proc anotherSplit(txt: string): list[string] =
|
||||
proc anotherSplit(txt: string): seq[string] =
|
||||
# the comment should belong to `anotherSplit`!
|
||||
# another problem: comments are statements!
|
||||
|
||||
|
||||
@@ -12,7 +12,10 @@ import
|
||||
cairowin32, cairoxlib,
|
||||
odbcsql,
|
||||
gl, glut, glu, glx, glext, wingl,
|
||||
lua, lualib, lauxlib, mysql, sqlite3, python, tcl
|
||||
lua, lualib, lauxlib, mysql, sqlite3, python, tcl,
|
||||
db_postgres, db_mysql, db_sqlite, ropes, sockets, browsers, httpserver,
|
||||
httpclient, parseutils, unidecode, xmldom, xmldomparser, xmltree, xmlparser,
|
||||
htmlparser, re, graphics, colors
|
||||
|
||||
when defined(linux):
|
||||
import
|
||||
|
||||
7
tests/accept/compile/tnoargopenarray.nim
Normal file
7
tests/accept/compile/tnoargopenarray.nim
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
import db_sqlite
|
||||
|
||||
var db: TDbConn
|
||||
Exec(db, sql"create table blabla()")
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ tbintree.nim;halloworld99110223
|
||||
tbug499771.nim;TSubRange: 5 from 1 to 10
|
||||
tbug511622.nim;3
|
||||
tcasestm.nim;ayyy
|
||||
tcgbug.nim;
|
||||
tclosure.nim;2 4 6 8 10
|
||||
tcnstseq.nim;AngelikaAnneAnnaAnkaAnja
|
||||
tconstr2.nim;69
|
||||
|
||||
|
17
tests/accept/run/tcgbug.nim
Normal file
17
tests/accept/run/tcgbug.nim
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
type
|
||||
TObj = object
|
||||
x, y: int
|
||||
PObj = ref TObj
|
||||
|
||||
proc p(a: PObj) =
|
||||
a.x = 0
|
||||
|
||||
proc q(a: var PObj) =
|
||||
a.p()
|
||||
|
||||
var
|
||||
a: PObj
|
||||
new(a)
|
||||
q(a)
|
||||
|
||||
6
tests/accept/run/txmlgen.nim
Executable file
6
tests/accept/run/txmlgen.nim
Executable file
@@ -0,0 +1,6 @@
|
||||
import xmlgen
|
||||
|
||||
var nim = "Nimrod"
|
||||
echo h1(a(href="http://force7.de/nimrod", nim))
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import xmltree
|
||||
import xmltree, strtabs
|
||||
|
||||
var x = <>a(href="nimrod.de", "www.nimrod-test.de")
|
||||
var x = <>a(href="nimrod.de", newText("www.nimrod-test.de"))
|
||||
|
||||
echo x == "<a href=\"nimrod.de\">www.nimrod-test.de"
|
||||
echo($x == "<a href=\"nimrod.de\">www.nimrod-test.de</a>")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user