Slowly adding multiple return values

This commit is contained in:
Krzosa Karol
2022-06-16 11:48:47 +02:00
parent 2a3284f70e
commit c604b44458
8 changed files with 122 additions and 48 deletions

View File

@@ -100,6 +100,20 @@ string_to_string16 :: (in: String): String16
result.str[result.len] = 0
return result
test_unicode :: ()
string := " 豈 更 車 賈 滑 串 句 龜 龜 契 金 喇 奈 懶 癩 羅 蘿 螺 裸 邏 樂 洛 烙 珞 落 酪 駱 亂 卵 欄 爛 蘭 鸞 嵐 濫 藍 襤 拉 臘 蠟 廊 朗 浪 狼 郎 來 冷 勞 擄 櫓 爐 盧 老 蘆 虜 路 露 魯 鷺 碌 祿 綠 菉 錄 鹿 論 壟 弄 籠 聾 牢 磊 賂 雷 壘 屢 樓 淚 漏 累 縷 陋 勒 肋 凜 凌 稜 綾 菱 陵 讀 拏 樂 諾 丹 寧 怒 率 異 北 磻 便 復 不 泌 數 索 參 塞 省 葉 說 殺 辰 沈 拾 若 掠 略 亮 兩 凉 梁 糧 良 諒 量 勵 ..."
string_result := string_to_string16(string)
print(string_result)
result := utf8_to_utf32(&"A"[0], 1)
assert(result.out_str == 'A, "Invalid decode") // '
result = utf8_to_utf32(&"ć"[0], 2)
assert(result.out_str == 0x107, "Invalid decode")
result = utf8_to_utf32(&"ó"[0], 2)
assert(result.out_str == 0xF3, "Invalid decode")
Vec2I :: struct;; x: S64; y: S64
Vec2 :: struct;; x: F32; y: F32
Windows_Bitmap :: struct
@@ -128,7 +142,6 @@ create_bitmap :: (size: Vec2I, bottom_up: Bool = true): Windows_Bitmap
hdc := GetDC(0)
result.dib = CreateDIBSection(hdc, &bminfo, DIB_RGB_COLORS, (&result.data)->**void, 0, 0)
error := GetLastError()
result.hdc = CreateCompatibleDC(hdc)
return result
@@ -140,21 +153,11 @@ window_procedure :: (hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM): LRE
return 0
else;; return DefWindowProcW(hwnd, msg, wparam, lparam)
test_unicode :: ()
string := " 豈 更 車 賈 滑 串 句 龜 龜 契 金 喇 奈 懶 癩 羅 蘿 螺 裸 邏 樂 洛 烙 珞 落 酪 駱 亂 卵 欄 爛 蘭 鸞 嵐 濫 藍 襤 拉 臘 蠟 廊 朗 浪 狼 郎 來 冷 勞 擄 櫓 爐 盧 老 蘆 虜 路 露 魯 鷺 碌 祿 綠 菉 錄 鹿 論 壟 弄 籠 聾 牢 磊 賂 雷 壘 屢 樓 淚 漏 累 縷 陋 勒 肋 凜 凌 稜 綾 菱 陵 讀 拏 樂 諾 丹 寧 怒 率 異 北 磻 便 復 不 泌 數 索 參 塞 省 葉 說 殺 辰 沈 拾 若 掠 略 亮 兩 凉 梁 糧 良 諒 量 勵 ..."
string_result := string_to_string16(string)
print(string_result)
result := utf8_to_utf32(&"A"[0], 1)
assert(result.out_str == 'A, "Invalid decode") // '
result = utf8_to_utf32(&"ć"[0], 2)
assert(result.out_str == 0x107, "Invalid decode")
result = utf8_to_utf32(&"ó"[0], 2)
assert(result.out_str == 0xF3, "Invalid decode")
multiple_return_values :: (i: int): int, int
return i, i*2
WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nShowCmd: int): int
a, b := multiple_return_values(10)
window_name := string_to_string16("Have a wonderful day! 豈 更 車 賈 滑 串 句 龜 ")
w := WNDCLASSW{
lpfnWndProc = window_procedure,