c2nim and system.nim now agree on a C type mapping
This commit is contained in:
parent
96be38e794
commit
1279bd2855
4 changed files with 34 additions and 8 deletions
|
|
@ -434,13 +434,20 @@ proc typeAtom(p: var TParser): PNode =
|
||||||
getTok(p, nil)
|
getTok(p, nil)
|
||||||
result = skipIdent(p)
|
result = skipIdent(p)
|
||||||
elif isIntType(p.tok.s):
|
elif isIntType(p.tok.s):
|
||||||
var x = "c" & p.tok.s
|
var x = ""
|
||||||
getTok(p, nil)
|
#getTok(p, nil)
|
||||||
while p.tok.xkind == pxSymbol and
|
var isUnsigned = false
|
||||||
(isIntType(p.tok.s) or p.tok.s == "char"):
|
while p.tok.xkind == pxSymbol and (isIntType(p.tok.s) or p.tok.s == "char"):
|
||||||
add(x, p.tok.s)
|
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)
|
getTok(p, nil)
|
||||||
result = mangledIdent(x, p)
|
if x.len == 0: x = "int"
|
||||||
|
let xx = if isUnsigned: "cu" & x else: "c" & x
|
||||||
|
result = mangledIdent(xx, p)
|
||||||
else:
|
else:
|
||||||
result = mangledIdent(p.tok.s, p)
|
result = mangledIdent(p.tok.s, p)
|
||||||
getTok(p, result)
|
getTok(p, result)
|
||||||
|
|
|
||||||
|
|
@ -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_callback_set (AW_CALLBACK c, callback_t callback );
|
||||||
int aw_instance_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
|
#define AW_BUILD 85 // AW 5.0
|
||||||
// Limits
|
// Limits
|
||||||
#define AW_MAX_AVCHANGE_PER_SECOND 10
|
#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"
|
#mangle "'XML_'{.*}" "$1"
|
||||||
#private "'XML_ParserStruct'"
|
#private "'XML_ParserStruct'"
|
||||||
|
|
||||||
#mangle cunsignedint cint
|
#mangle cuint cint
|
||||||
|
|
||||||
unsigned int uiVar;
|
unsigned int uiVar;
|
||||||
|
|
||||||
|
|
|
||||||
6
examples/lazarus/nimlaz.rc
Normal file
6
examples/lazarus/nimlaz.rc
Normal file
|
|
@ -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"
|
||||||
|
|
@ -946,6 +946,17 @@ type # these work for most platforms:
|
||||||
## This is the same as the type ``long double`` in *C*.
|
## This is the same as the type ``long double`` in *C*.
|
||||||
## This C type is not supported by Nimrod's code generator
|
## 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]
|
cstringArray* {.importc: "char**", nodecl.} = ptr array [0..50_000, cstring]
|
||||||
## This is binary compatible to the type ``char**`` in *C*. The array's
|
## This is binary compatible to the type ``char**`` in *C*. The array's
|
||||||
## high value is large enough to disable bounds checking in practice.
|
## high value is large enough to disable bounds checking in practice.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue