Skip to content

Commit

Permalink
remove last hardcoded value
Browse files Browse the repository at this point in the history
  • Loading branch information
planetis-m committed Oct 19, 2024
1 parent 572875b commit d38631e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/raylib.nim
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,11 @@ type
count: uint32 ## Events entries count
events: ptr UncheckedArray[AutomationEvent] ## Events entries

Quaternion* {.borrow: `.`.} = distinct Vector4 ## Quaternion, 4 components (Vector4 alias)
Texture2D* = Texture ## Texture2D, same as Texture
TextureCubemap* = Texture ## TextureCubemap, same as Texture
RenderTexture2D* = RenderTexture ## RenderTexture2D, same as RenderTexture
Camera* = Camera3D ## Camera type fallback, defaults to Camera3D
Quaternion* = Vector4 ## Quaternion, 4 components (Vector4 alias)
Texture2D* {.borrow: `.`.} = distinct Texture ## Texture2D, same as Texture
TextureCubemap* {.borrow: `.`.} = distinct Texture ## TextureCubemap, same as Texture
RenderTexture2D* {.borrow: `.`.} = distinct RenderTexture ## RenderTexture2D, same as RenderTexture
Camera* {.borrow: `.`.} = distinct Camera3D ## Camera type fallback, defaults to Camera3D
FontRecs* = distinct Font
FontGlyphs* = distinct Font
MeshVertices* = distinct Mesh
Expand Down
3 changes: 3 additions & 0 deletions wrapper/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type
noSideEffectsFuncs*: HashSet[string]
mangledSymbols*: HashSet[string]
incompleteStructs*: HashSet[string]
distinctAliases*: HashSet[string]
keepNamespacePrefix*: HashSet[string]
enumValuePrefixes*: seq[string]
namespacePrefix*: string
Expand Down Expand Up @@ -65,6 +66,8 @@ proc processKeyWithoutValue(config: var ConfigData; section: string, key: string
config.mangledSymbols.incl(key)
of "IncompleteStructs":
config.incompleteStructs.incl(key)
of "DistinctAliases":
config.distinctAliases.incl(key)
of "KeepNamespacePrefix":
config.keepNamespacePrefix.incl(key)
of "EnumValuePrefixes":
Expand Down
4 changes: 4 additions & 0 deletions wrapper/config/raylib.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ Rectangle
rAudioBuffer
rAudioProcessor

[ DistinctAliases ]

Quaternion

[ EnumValuePrefixes ]

FLAG_
Expand Down
5 changes: 4 additions & 1 deletion wrapper/processor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ proc shouldMarkAsMangled(name: string, config: ConfigData): bool =
proc shouldMarkAsComplete(name: string, config: ConfigData): bool =
name notin config.incompleteStructs

proc shouldMarkAsDistinct(name: string, config: ConfigData): bool =
name notin config.distinctAliases

proc shouldMarkAsPrivate(name: string, config: ConfigData): bool =
isPrivateSymbol(name, config)

Expand All @@ -73,7 +76,7 @@ proc processEnums*(ctx: var ApiContext; config: ConfigData) =

proc processAliases*(ctx: var ApiContext; config: ConfigData) =
for alias in mitems(ctx.api.aliases):
if alias.name == "Quaternion":
if shouldMarkAsDistinct(alias.name, config):
alias.flags.incl isDistinct

proc preprocessStructs(ctx: var ApiContext, config: ConfigData) =
Expand Down

0 comments on commit d38631e

Please sign in to comment.