Compiler restructure, now can call compiler to compile files, fix error where strict type
was equal it's original type, working on examples
This commit is contained in:
@@ -41,93 +41,9 @@ create_bitmap :: (size: Vec2I, bottom_up: Bool = true): Windows_Bitmap
|
||||
result.hdc = CreateCompatibleDC(hdc)
|
||||
return result
|
||||
|
||||
_gcvt :: #foreign (value: F64, digits: int, buffer: *char): *char
|
||||
print_float :: (value: F64)
|
||||
buff: [100]char
|
||||
_gcvt(value, 10, &buff[0])
|
||||
OutputDebugStringA(&buff[0])
|
||||
|
||||
print_type :: (t: Type)
|
||||
type_info := get_type_info(t)
|
||||
if !type_info
|
||||
return
|
||||
|
||||
switch type_info.kind
|
||||
Type_Info_Kind.S64, Type_Info_Kind.S32, Type_Info_Kind.S16, Type_Info_Kind.S8, Type_Info_Kind.INT
|
||||
OutputDebugStringA("Integer")
|
||||
Type_Info_Kind.U64, Type_Info_Kind.U32, Type_Info_Kind.U16, Type_Info_Kind.U8
|
||||
OutputDebugStringA("Unsigned")
|
||||
Type_Info_Kind.F64, Type_Info_Kind.F32
|
||||
OutputDebugStringA("Float")
|
||||
Type_Info_Kind.POINTER
|
||||
OutputDebugStringA("*")
|
||||
print_type(type_info.base_type)
|
||||
default;; OutputDebugStringA("Unknown")
|
||||
|
||||
print :: (a: Any)
|
||||
type_info := get_type_info(a.type)
|
||||
if !type_info
|
||||
return
|
||||
|
||||
print_type(a.type)
|
||||
OutputDebugStringA(" - ")
|
||||
// @todo check for types here
|
||||
switch type_info.kind
|
||||
Type_Info_Kind.S64, Type_Info_Kind.S32, Type_Info_Kind.S16, Type_Info_Kind.S8, Type_Info_Kind.INT
|
||||
OutputDebugStringA("Integer")
|
||||
Type_Info_Kind.U64, Type_Info_Kind.U32, Type_Info_Kind.U16, Type_Info_Kind.U8
|
||||
OutputDebugStringA("Unsigned")
|
||||
Type_Info_Kind.F64
|
||||
data := a.data->*F64
|
||||
print_float(*data)
|
||||
Type_Info_Kind.POINTER
|
||||
OutputDebugStringA("Pointer")
|
||||
default;; OutputDebugStringA("Unknown")
|
||||
|
||||
// print_array :: (a: []Any)
|
||||
// for i := 0, i < length_of(a), i+=1
|
||||
// print(a[i])
|
||||
|
||||
|
||||
little_untyped_test :: ()
|
||||
if true == false;; pass
|
||||
if true;; pass
|
||||
cast_value1 := 32->S64
|
||||
cast_value2 := true->Bool
|
||||
value3 := !true
|
||||
value4 := !325252
|
||||
value5 := !42.42
|
||||
some_constant :: 10
|
||||
value6 := !some_constant
|
||||
var_not_const := 0
|
||||
value7 := some_constant + - -some_constant + +-32 + -var_not_const
|
||||
|
||||
|
||||
value3 = value3 + value4 + value5 + cast_value2 + value6
|
||||
cast_value1 += 1 + value7
|
||||
|
||||
|
||||
switch 4
|
||||
4;; OutputDebugStringA("4")
|
||||
3;; OutputDebugStringA("3")
|
||||
|
||||
some_type: Type = Vec2
|
||||
char_info := get_type_info(char)
|
||||
val := 4232.23
|
||||
thing: Any = val
|
||||
print(val)
|
||||
print(some_type)
|
||||
// print_array({125.23, 32})
|
||||
|
||||
assert(char_info.kind == Type_Info_Kind.CHAR)
|
||||
#assert(int == int)
|
||||
#assert(int != char)
|
||||
#assert(*char == *char)
|
||||
|
||||
|
||||
app_is_running := true
|
||||
window_procedure :: (hwnd: HWND, msg: UINT, wparam: WPARAM, lparam: LPARAM): LRESULT
|
||||
little_untyped_test()
|
||||
if msg == WM_DESTROY
|
||||
PostQuitMessage(0)
|
||||
app_is_running = false
|
||||
@@ -140,7 +56,6 @@ WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nS
|
||||
|
||||
arena: Arena
|
||||
|
||||
data: *int = arena_push_type(&arena, int)
|
||||
window_name := string_to_string16(&arena, "Have a wonderful day! 豈 更 車 賈 滑 串 句 龜 ")
|
||||
w := WNDCLASSW{
|
||||
lpfnWndProc = window_procedure,
|
||||
|
||||
Reference in New Issue
Block a user