Fixing generated names when namespaced Windows :: #import calls and field accesses

This commit is contained in:
Krzosa Karol
2022-06-13 21:11:39 +02:00
2 changed files with 16 additions and 13 deletions

10
base.kl
View File

@@ -1,4 +1,4 @@
#import "Windows.kl"
Windows :: #import "Windows.kl"
SizeU :: #strict U64
OS_PAGE_SIZE :: 4096
@@ -26,10 +26,10 @@ align_up :: (size: SizeU, align: SizeU): SizeU
reserve :: (size: SizeU): OS_Memory
result := OS_Memory{reserve=align_up(size, OS_PAGE_SIZE)}
result.data = VirtualAlloc(
flProtect = PAGE_READWRITE,
result.data = Windows.VirtualAlloc(
flProtect = Windows.PAGE_READWRITE,
dwSize = result.reserve,
flAllocationType = MEM_RESERVE,
flAllocationType = Windows.MEM_RESERVE,
lpAddress = 0,
)->*U8
return result
@@ -45,7 +45,7 @@ commit :: (m: *OS_Memory, size: SizeU): Bool
clamped_commit := clamp_top_sizeu(total_commit, m.reserve)
adjusted_commit := clamped_commit - m.commit
if adjusted_commit != 0
result := VirtualFree(m.data->*void, 0, MEM_RELEASE)
result := Windows.VirtualFree(m.data->*void, 0, Windows.MEM_RELEASE)
m.commit += adjusted_commit
return true
return false