doc updates; fixes 'inc' for 'char'
This commit is contained in:
parent
165619552a
commit
edc4940c26
8 changed files with 97 additions and 191 deletions
|
|
@ -492,7 +492,7 @@ proc binaryArithOverflowRaw(p: BProc, t: PType, a, b: TLoc;
|
||||||
else: getTypeDesc(p.module, t)
|
else: getTypeDesc(p.module, t)
|
||||||
result = getTempName()
|
result = getTempName()
|
||||||
linefmt(p, cpsLocals, "$1 $2;$n", storage, result)
|
linefmt(p, cpsLocals, "$1 $2;$n", storage, result)
|
||||||
lineCg(p, cpsStmts, frmt, result, rdLoc(a), rdLoc(b))
|
lineCg(p, cpsStmts, frmt, result, rdCharLoc(a), rdCharLoc(b))
|
||||||
if size < platform.intSize or t.kind in {tyRange, tyEnum}:
|
if size < platform.intSize or t.kind in {tyRange, tyEnum}:
|
||||||
linefmt(p, cpsStmts, "if ($1 < $2 || $1 > $3) #raiseOverflow();$n",
|
linefmt(p, cpsStmts, "if ($1 < $2 || $1 > $3) #raiseOverflow();$n",
|
||||||
result, intLiteral(firstOrd(t)), intLiteral(lastOrd(t)))
|
result, intLiteral(firstOrd(t)), intLiteral(lastOrd(t)))
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ deprecated pragma
|
||||||
|
|
||||||
The deprecated pragma is used to mark a symbol as deprecated:
|
The deprecated pragma is used to mark a symbol as deprecated:
|
||||||
|
|
||||||
.. code-block:: nimrod
|
.. code-block:: nim
|
||||||
proc p() {.deprecated.}
|
proc p() {.deprecated.}
|
||||||
var x {.deprecated.}: char
|
var x {.deprecated.}: char
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ It can also be used as a statement. Then it takes a list of *renamings*. The
|
||||||
upcoming ``nimfix`` tool can automatically update the code and perform these
|
upcoming ``nimfix`` tool can automatically update the code and perform these
|
||||||
renamings:
|
renamings:
|
||||||
|
|
||||||
.. code-block:: nimrod
|
.. code-block:: nim
|
||||||
type
|
type
|
||||||
File = object
|
File = object
|
||||||
Stream = ref object
|
Stream = ref object
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,9 @@ contain a ``ref`` or ``closure`` type. This enforces
|
||||||
the *no heap sharing restriction*.
|
the *no heap sharing restriction*.
|
||||||
|
|
||||||
Routines that are imported from C are always assumed to be ``gcsafe``.
|
Routines that are imported from C are always assumed to be ``gcsafe``.
|
||||||
To enable the GC-safety checking the ``--threadAnalysis:on`` command line
|
To disable the GC-safety checking the ``--threadAnalysis:off`` command line
|
||||||
switch must be used. This is a temporary workaround to ease the porting effort
|
switch can be used. This is a temporary workaround to ease the porting effort
|
||||||
from old code to the new threading model. In the future the thread analysis
|
from old code to the new threading model.
|
||||||
will always be performed.
|
|
||||||
|
|
||||||
|
|
||||||
Future directions:
|
Future directions:
|
||||||
|
|
@ -206,5 +205,4 @@ restrictions / changes:
|
||||||
* Every array access has to be provably within bounds. This is called
|
* Every array access has to be provably within bounds. This is called
|
||||||
the *bounds check*.
|
the *bounds check*.
|
||||||
* Slices are optimized so that no copy is performed. This optimization is not
|
* Slices are optimized so that no copy is performed. This optimization is not
|
||||||
yet performed for ordinary slices outside of a ``parallel`` section. Slices
|
yet performed for ordinary slices outside of a ``parallel`` section.
|
||||||
are also special in that they currently do not support negative indexes!
|
|
||||||
|
|
|
||||||
10
tests/misc/tcharinc.nim
Normal file
10
tests/misc/tcharinc.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
discard """
|
||||||
|
output: "1"
|
||||||
|
"""
|
||||||
|
|
||||||
|
var c = '\0'
|
||||||
|
while true:
|
||||||
|
if c == '\xFF': break
|
||||||
|
inc c
|
||||||
|
|
||||||
|
echo "1"
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
discard """
|
|
||||||
disabled: true
|
|
||||||
"""
|
|
||||||
import
|
|
||||||
gtk2, glib2, atk, gdk2, gdk2pixbuf, libglade2, pango,
|
|
||||||
pangoutils
|
|
||||||
|
|
||||||
proc hello(widget: PWidget, data: pointer) {.cdecl.} =
|
|
||||||
write(stdout, "Hello World\n")
|
|
||||||
|
|
||||||
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
|
|
||||||
# you don't want the window to be destroyed.
|
|
||||||
# This is useful for popping up 'are you sure you want to quit?'
|
|
||||||
# type dialogs.
|
|
||||||
write(stdout, "delete event occurred\n")
|
|
||||||
# Change TRUE to FALSE and the main window will be destroyed with
|
|
||||||
# a "delete_event".
|
|
||||||
return false
|
|
||||||
|
|
||||||
# Another callback
|
|
||||||
proc mydestroy(widget: PWidget, data: pointer) {.cdecl.} =
|
|
||||||
gtk2.main_quit()
|
|
||||||
|
|
||||||
proc mymain() =
|
|
||||||
# GtkWidget is the storage type for widgets
|
|
||||||
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(mydestroy), nil)
|
|
||||||
# Sets the border width of the window.
|
|
||||||
set_border_width(window, 10)
|
|
||||||
|
|
||||||
# Creates a new button with the label "Hello World".
|
|
||||||
var button = button_new("Hello World")
|
|
||||||
|
|
||||||
discard g_signal_connect(button, "clicked", Gcallback(hello), nil)
|
|
||||||
|
|
||||||
# This packs the button into the window (a gtk container).
|
|
||||||
add(window, button)
|
|
||||||
|
|
||||||
# The final step is to display this newly created widget.
|
|
||||||
show(button)
|
|
||||||
|
|
||||||
# and the window
|
|
||||||
show(window)
|
|
||||||
|
|
||||||
gtk2.main()
|
|
||||||
|
|
||||||
mymain()
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
discard """
|
|
||||||
disabled: true
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Test wether the bindings at least compile...
|
|
||||||
|
|
||||||
import
|
|
||||||
unicode, cgi, terminal, libcurl,
|
|
||||||
parsexml, parseopt, parsecfg,
|
|
||||||
osproc, complex,
|
|
||||||
sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf,
|
|
||||||
sdl_image, sdl_mixer_nosmpeg,
|
|
||||||
cursorfont, xatom, xf86vmode, xkb, xrandr, xshm, xvlib, keysym, xcms, xi,
|
|
||||||
xkblib, xrender, xutil, x, xf86dga, xinerama, xlib, xresource, xv,
|
|
||||||
gtk2, glib2, pango, gdk2,
|
|
||||||
cairowin32, cairoxlib,
|
|
||||||
odbcsql,
|
|
||||||
gl, glut, glu, glx, glext, wingl,
|
|
||||||
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, pegs, subexes, dialogs
|
|
||||||
|
|
||||||
when defined(linux):
|
|
||||||
import
|
|
||||||
zlib, zipfiles
|
|
||||||
|
|
||||||
writeln(stdout, "test compilation of binding modules")
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
discard """
|
|
||||||
disabled: true
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Test wether the bindings at least compile...
|
|
||||||
|
|
||||||
import
|
|
||||||
tcl,
|
|
||||||
sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf,
|
|
||||||
sdl_image, sdl_mixer_nosmpeg,
|
|
||||||
gtk2, glib2, pango, gdk2,
|
|
||||||
unicode, cgi, terminal, libcurl,
|
|
||||||
parsexml, parseopt, parsecfg,
|
|
||||||
osproc,
|
|
||||||
cairowin32, cairoxlib,
|
|
||||||
gl, glut, glu, glx, glext, wingl,
|
|
||||||
lua, lualib, lauxlib, mysql, sqlite3, db_mongo, md5, asyncio, mimetypes,
|
|
||||||
cookies, events, ftpclient, scgi, irc
|
|
||||||
|
|
||||||
|
|
||||||
writeln(stdout, "test compilation of binding modules")
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue