summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xcompiler/c2nim/cparse.nim21
-rwxr-xr-xcompiler/c2nim/tests/systest.c4
-rwxr-xr-xdoc/manual.txt6
-rwxr-xr-xexamples/lazarus/nimlaz.lpi2
-rw-r--r--examples/lazarus/nimlaz.rc6
-rwxr-xr-xlib/system.nim11
-rwxr-xr-xlib/wrappers/x11/x.nim2
-rwxr-xr-xlib/wrappers/x11/xlib.nim8
-rw-r--r--tests/reject/tenummix.nim2
-rwxr-xr-xtodo.txt1
10 files changed, 42 insertions, 21 deletions
diff --git a/compiler/c2nim/cparse.nim b/compiler/c2nim/cparse.nim
index 67ab6cf26..5715e1089 100755
--- a/compiler/c2nim/cparse.nim
+++ b/compiler/c2nim/cparse.nim
@@ -434,14 +434,21 @@ proc typeAtom(p: var TParser): PNode =
     getTok(p, nil)
     result = skipIdent(p)
   elif isIntType(p.tok.s):
-    var x = "c" & p.tok.s
-    getTok(p, nil)
-    while p.tok.xkind == pxSymbol and 
-        (isIntType(p.tok.s) or p.tok.s == "char"):
-      add(x, p.tok.s)
+    var x = ""
+    #getTok(p, nil)
+    var isUnsigned = false
+    while p.tok.xkind == pxSymbol and (isIntType(p.tok.s) or p.tok.s == "char"):
+      if p.tok.s == "unsigned":
+        isUnsigned = true
+      elif p.tok.s == "signed" or p.tok.s == "int":
+        nil
+      else:
+        add(x, p.tok.s)
       getTok(p, nil)
-    result = mangledIdent(x, p)
-  else: 
+    if x.len == 0: x = "int"
+    let xx = if isUnsigned: "cu" & x else: "c" & x
+    result = mangledIdent(xx, p)
+  else:
     result = mangledIdent(p.tok.s, p)
     getTok(p, result)
     
diff --git a/compiler/c2nim/tests/systest.c b/compiler/c2nim/tests/systest.c
index 389fdfdc2..241526e07 100755
--- a/compiler/c2nim/tests/systest.c
+++ b/compiler/c2nim/tests/systest.c
@@ -15,6 +15,8 @@ typedef const char* (*callback2)(int rc, long L, const char* buffer);
 int   aw_callback_set (AW_CALLBACK c, callback_t callback );
 int   aw_instance_callback_set (AW_CALLBACK c, callback_t callback);
 
+unsigned long int wawa;
+
 #define AW_BUILD 85 // AW 5.0
 // Limits
 #define AW_MAX_AVCHANGE_PER_SECOND 10
@@ -34,7 +36,7 @@ int   aw_instance_callback_set (AW_CALLBACK c, callback_t callback);
 #mangle "'XML_'{.*}" "$1"
 #private "'XML_ParserStruct'"
 
-#mangle cunsignedint cint
+#mangle cuint cint
 
 unsigned int uiVar;
 
diff --git a/doc/manual.txt b/doc/manual.txt
index 201d7be5e..543d5d3c1 100755
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -3590,10 +3590,8 @@ strings automatically:
 Dynlib pragma for import

 ------------------------

 With the `dynlib`:idx: pragma a procedure can be imported from

-

-a dynamic library (``.dll`` files for Windows, ``lib*.so`` files for UNIX). The

-

-non-optional argument has to be the name of the dynamic library:

+a dynamic library (``.dll`` files for Windows, ``lib*.so`` files for UNIX). 
+The non-optional argument has to be the name of the dynamic library:

 

 .. code-block:: Nimrod

   proc gtk_image_new(): PGtkWidget {.

diff --git a/examples/lazarus/nimlaz.lpi b/examples/lazarus/nimlaz.lpi
index 13417a09a..3b9abd129 100755
--- a/examples/lazarus/nimlaz.lpi
+++ b/examples/lazarus/nimlaz.lpi
@@ -51,7 +51,7 @@
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="Unit1"/>
         <CursorPos X="26" Y="27"/>
-        <TopLine Value="1"/>
+        <TopLine Value="2"/>
         <EditorIndex Value="0"/>
         <UsageCount Value="21"/>
         <Loaded Value="True"/>
diff --git a/examples/lazarus/nimlaz.rc b/examples/lazarus/nimlaz.rc
new file mode 100644
index 000000000..d66bb817c
--- /dev/null
+++ b/examples/lazarus/nimlaz.rc
@@ -0,0 +1,6 @@
+#define RT_MANIFEST  24

+#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1

+#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2

+#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3

+

+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "nimlaz.manifest"
diff --git a/lib/system.nim b/lib/system.nim
index 5e223eb10..6cb99b6cf 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -946,6 +946,17 @@ type # these work for most platforms:
     ## This is the same as the type ``long double`` in *C*.
     ## This C type is not supported by Nimrod's code generator
 
+  cuchar* {.importc: "unsigned char", nodecl.} = char
+    ## This is the same as the type ``unsigned char`` in *C*.
+  cushort* {.importc: "unsigned short", nodecl.} = uint16
+    ## This is the same as the type ``unsigned short`` in *C*.
+  cuint* {.importc: "int", nodecl.} = uint32
+    ## This is the same as the type ``unsigned int`` in *C*.
+  culong* {.importc: "unsigned long", nodecl.} = uint
+    ## This is the same as the type ``unsigned long`` in *C*.
+  culonglong* {.importc: "unsigned long long", nodecl.} = uint64
+    ## This is the same as the type ``unsigned long long`` in *C*.
+
   cstringArray* {.importc: "char**", nodecl.} = ptr array [0..50_000, cstring]
     ## This is binary compatible to the type ``char**`` in *C*. The array's
     ## high value is large enough to disable bounds checking in practice.
diff --git a/lib/wrappers/x11/x.nim b/lib/wrappers/x11/x.nim
index aa6e7f821..5763f9f16 100755
--- a/lib/wrappers/x11/x.nim
+++ b/lib/wrappers/x11/x.nim
@@ -16,8 +16,6 @@ const
   X_PROTOCOL_REVISION* = 0
 
 type
-  culong* = int
-  cuchar* = char
   PXID* = ptr TXID
   TXID* = culong
   PMask* = ptr TMask
diff --git a/lib/wrappers/x11/xlib.nim b/lib/wrappers/x11/xlib.nim
index f915f0eae..946f9566a 100755
--- a/lib/wrappers/x11/xlib.nim
+++ b/lib/wrappers/x11/xlib.nim
@@ -6,19 +6,17 @@ const
   libX11* = "libX11.so"
 
 type
-  cuint* = cint
   cunsigned* = cint
-  cushort* = int16
   Pcint* = ptr cint
   PPcint* = ptr Pcint
   PPcuchar* = ptr ptr cuchar
   PWideChar* = ptr int16
   PPChar* = ptr cstring
   PPPChar* = ptr ptr cstring
-  Pculong* = ptr int
+  Pculong* = ptr culong
   Pcuchar* = cstring
-  Pcuint* = ptr cint
-  Pcushort* = ptr int16
+  Pcuint* = ptr cuint
+  Pcushort* = ptr uint16
 #  Automatically converted by H2Pas 0.99.15 from xlib.h
 #  The following command line parameters were used:
 #    -p
diff --git a/tests/reject/tenummix.nim b/tests/reject/tenummix.nim
index 8965ab3c3..c9ea9a8f8 100644
--- a/tests/reject/tenummix.nim
+++ b/tests/reject/tenummix.nim
@@ -1,6 +1,6 @@
 discard """
   file: "system.nim"
-  line: 678
+  line: 637
   errormsg: "type mismatch"
 """
 
diff --git a/todo.txt b/todo.txt
index afa90cc70..751f8413d 100755
--- a/todo.txt
+++ b/todo.txt
@@ -1,6 +1,7 @@
 version 0.9.0
 =============
 
+- implement ``dynlib`` for variables
 - implicit deref for parameter matching
 - deprecate ``var x, y = 0`` as it's confusing for tuple consistency
 - test sequence of closures; especially that the GC does not leak for those!