Skip to content

Commit

Permalink
Refactored register allocation. More work to do. But happy I got it p…
Browse files Browse the repository at this point in the history
…ulled out
  • Loading branch information
jimmyhmiller committed Nov 1, 2024
1 parent 6046c6c commit ff67062
Show file tree
Hide file tree
Showing 8 changed files with 885 additions and 5,412 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"kind": "bin"
}
},
"args": ["resources/persistent_vector.bg"],
"args": ["resources/ffi_test.bg"],
"cwd": "${workspaceFolder}"
},
{
Expand Down
3 changes: 2 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
* Figure out a print system for types like the vector
* I need to do indexing with [] I just need to figure out how to distinguish a literal and indexing. How do other languages do that?
* Make namespacing reference work for structs and enums better
* Builtins need better type checking setup
* Builtins need better type checking setup
* Need to make the tests start a process so if one crashes, we still know the total results
8 changes: 8 additions & 0 deletions resources/ffi_test.bg
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
namespace ffi_test

import "beagle.ffi" as ffi
import "beagle.primitive" as primitive


// TODO: I need to resolve not just functions as namespaced
Expand All @@ -14,6 +15,9 @@ import "beagle.ffi" as ffi
fn main() {
let sdl = ffi/load_library("/opt/homebrew/lib/libSDL2-2.0.0.dylib")
let sdl_init = ffi/get_function(sdl, "SDL_Init", [ffi/Type.U32], ffi/Type.I32)
// TODO: Fix closures
println(sdl_init)
// primitive/breakpoint()
sdl_init(0)

// TODO: This code causes me to have no free registers
Expand All @@ -24,8 +28,12 @@ fn main() {
[ffi/Type.String, ffi/Type.I32, ffi/Type.I32, ffi/Type.I32, ffi/Type.I32, ffi/Type.U32],
ffi/Type.Pointer
)

println(sdl_window_create);

let title = "SDL2 Window" // Window title
// primitive/breakpoint()

let window = sdl_window_create(title, 100, 100, 640, 480, 0)

println(sdl)
Expand Down
Loading

0 comments on commit ff67062

Please sign in to comment.