Fix #196 - more known types
This commit is contained in:
parent
4784616d98
commit
08f8ca32f4
2 changed files with 26 additions and 7 deletions
|
|
@ -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* =
|
||||
#
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue