aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2020-05-01 11:02:29 -0500
committerGanesh Viswanathan <dev@genotrance.com>2020-05-01 11:02:29 -0500
commit08f8ca32f41d16ade0b364e048a0a99b1a01eebe (patch)
tree3a5addd5d96d59e64420e4255c5146cb515e953d
parent4784616d987c3b7c73125af44bec999184444a22 (diff)
downloadnimterop-issue196.tar.gz
nimterop-issue196.zip
Fix #196 - more known typesissue196
-rw-r--r--nimterop/ast2.nim4
-rw-r--r--nimterop/getters.nim29
2 files changed, 26 insertions, 7 deletions
diff --git a/nimterop/ast2.nim b/nimterop/ast2.nim
index 13f2ba2..3ffa3f6 100644
--- a/nimterop/ast2.nim
+++ b/nimterop/ast2.nim
@@ -42,8 +42,6 @@ proc getOverrideOrSkip(gState: State, node: TSNode, origname: string, kind: NimS
else:
gecho &"\n# $1'{origname}' skipped" % skind
gState.skippedSyms.incl origname
- if gState.debug:
- gState.skipStr &= &"\n{gState.getNodeVal(node)}"
proc addOverrideFinal(gState: State, kind: NimSymKind) =
# Add all unused cOverride symbols for `kind` to AST
@@ -285,7 +283,7 @@ proc newXIdent(gState: State, node: TSNode, kind = nskType, fname = "", pragmas:
if name.Bl:
# Name skipped or overridden since blank
result = gState.getOverrideOrSkip(node, origname, kind)
- elif gState.addNewIdentifer(name):
+ elif origname notin gTypeMap and gState.addNewIdentifer(name):
if kind == nskType:
# type name* =
#
diff --git a/nimterop/getters.nim b/nimterop/getters.nim
index 42a5a57..69628f5 100644
--- a/nimterop/getters.nim
+++ b/nimterop/getters.nim
@@ -57,6 +57,30 @@ const gTypeMap* = {
"u_int": "cuint",
"size_t": "uint",
+ "int8_t": "int8",
+ "int16_t": "int16",
+ "int32_t": "int32",
+ "int64_t": "int64",
+
+ "intptr_t": "ptr int",
+
+ "Int8": "int8",
+ "Int16": "int16",
+ "Int32": "int32",
+ "Int64": "int64",
+
+ "uint8_t": "uint8",
+ "uint16_t": "uint16",
+ "uint32_t": "uint32",
+ "uint64_t": "uint64",
+
+ "uintptr_t": "ptr uint",
+
+ "Uint8": "uint8",
+ "Uint16": "uint16",
+ "Uint32": "uint32",
+ "Uint64": "uint64",
+
# long
"long": "clong",
"long int": "clong",
@@ -87,10 +111,7 @@ proc getType*(str: string): string =
if str == "void":
return "object"
- result = str.strip(chars={'_'}).
- replace(re"\s+", " ").
- replace(re"^([u]?int[\d]+)_t$", "$1").
- replace(re"^([u]?int)ptr_t$", "ptr $1")
+ result = str.strip(chars={'_'}).replace(re"\s+", " ")
if gTypeMap.hasKey(result):
result = gTypeMap[result]