convert all region/endregion directives to the comment signature used with editor plugins

This commit is contained in:
2025-06-30 09:26:17 -04:00
parent 74567ae98a
commit ff91e41da9
10 changed files with 81 additions and 187 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@ logs*.zip
ols.json
.vscode/settings.json
*.spall
sectr.user

View File

@ -16,7 +16,6 @@ https://github.com/user-attachments/assets/0a895478-4a04-4ac6-a0ac-5355ff87ef4e
The dependencies are:
* Odin Compiler (Slightly custom [fork](https://github.com/Ed94/Odin))
* Added #region, #endregion directives support for editors
* I added support for 'monlithic packages' or 'uniform-across-subdirectories packages'. It allows me to organize the main package with sub-directories.
* Added the ability to debug using statements on structs (fields get dumped to the stack as ptr refs)
* Remove implicit assignments for container allocators in the Base and Core packages
@ -78,3 +77,42 @@ They'll be elaborated in their own documentation
![img](docs/assets/sectr_host_2024-05-11_22-34-15.png)
![img](docs/assets/sectr_host_2024-05-15_03-32-36.png)
![img](docs/assets/Code_2024-05-21_23-15-16.gif)
## Notes
Due to bug with custom ols click file in root of sectr to get full symbol reflection setup on the monolithic package.
For support for regions - grab a region extension and use the following regex:
VS-Code Explicit Folding:
```json
"explicitFolding.rules": {
"odin": [
{
"beginRegex": "region\\b",
"endRegex": "endregion\\b"
},
{
"beginRegex": "{",
"endRegex": "}"
},
{
"beginRegex": "\\[",
"endRegex": "\\]"
},
{
"beginRegex": "\\(",
"endRegex": "\\)"
},
{
"beginRegex": "\"",
"endRegex": "\""
},
{
"beginRegex": "/\\*",
"endRegex": "\\*/"
}
]
},
```

View File

@ -8,7 +8,7 @@ import "core:os"
Str_App_State := "App State"
#region("Memory")
//region Memory
Memory_App : Memory
@ -133,9 +133,9 @@ MemoryConfig :: struct {
commit_initial_filebuffer : uint,
}
#endregion("Memory")
//endregion Memory
#region("State")
//region State
// ALl nobs available for this application
AppConfig :: struct {
@ -292,4 +292,4 @@ get_screen_extent :: #force_inline proc "contextless" () -> Extents2 { retu
get_ui_context_mut :: #force_inline proc "contextless" () -> ^UI_State { return get_state().ui_context }
set_ui_context :: #force_inline proc "contextless" ( ui : ^UI_State ) { get_state().ui_context = ui }
#endregion("State")
//endregion State

View File

@ -6,7 +6,7 @@ import str "core:strings"
import sokol_app "thirdparty:sokol/app"
#region("Sokol App")
//region Sokol App
sokol_app_init_callback :: proc "c" () {
context = get_state().sokol_context
@ -230,9 +230,9 @@ sokol_app_event_callback :: proc "c" (sokol_event : ^sokol_app.Event)
}
}
#endregion("Sokol App")
//endregion Sokol App
#region("Sokol GFX")
//region Sokol GFX
sokol_gfx_alloc :: proc "c" ( size : uint, user_data : rawptr ) -> rawptr {
context = get_state().sokol_context
@ -277,4 +277,4 @@ sokol_gfx_log_callback :: proc "c" (
log_fmt( "%-80s %s::%v", cloned_msg, cloned_tag, line_nr, level = odin_level )
}
#endregion("Sokol GFX")
//endregion Sokol GFX

View File

@ -670,7 +670,7 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render :
}
}
#region("Helpers")
//region Helpers
draw_shape :: proc(color : RGBAN, screen_size, position, scale : Vec2, zoom : f32, shape : ShapedText)
{
@ -890,4 +890,4 @@ render_set_view_space :: #force_inline proc( extent : Extents2 )
gp.project( -extent.x, extent.x, extent.y, -extent.y )
}
#endregion("Helpers")
//endregion Helpers

View File

@ -1,7 +1,7 @@
package sectr
#region("base")
//region base
import "base:builtin"
copy :: builtin.copy
@ -25,9 +25,9 @@ import "base:runtime"
SourceCodeLocation :: runtime.Source_Code_Location
debug_trap :: runtime.debug_trap
#endregion("base")
//endregion base
#region("core")
//region core
import c "core:c/libc"
@ -153,14 +153,14 @@ import "core:unicode/utf8"
runes_to_string :: utf8.runes_to_string
// string_to_runes :: utf8.string_to_runes
#endregion("core")
//endregion core
import "thirdparty:backtrace"
StackTraceData :: backtrace.Trace_Const
stacktrace :: backtrace.trace
stacktrace_lines :: backtrace.lines
#region("codebase")
//region codebase
import "codebase:grime"
// asserts
@ -345,9 +345,9 @@ import "codebase:grime"
varena_allocator :: grime.varena_allocator
#endregion("codebase")
//endregion codebase
#region("Procedure overload mappings")
//region Procedure overload mappings
// This has to be done on a per-module basis.
@ -717,4 +717,4 @@ wedge :: proc {
wedge_bivec3,
}
#endregion("Proc overload mappings")
//endregion Proc overload mappings

View File

@ -73,7 +73,7 @@ Vec3i :: [3]i32
vec2i_to_vec2 :: #force_inline proc "contextless" (v : Vec2i) -> Vec2 {return transmute(Vec2) v}
vec3i_to_vec3 :: #force_inline proc "contextless" (v : Vec3i) -> Vec3 {return transmute(Vec3) v}
#region("Range2")
//region Range2
// TODO(Ed): I rather keep the different usages as different types, then type coerece their procedure mappings
// to support the base p0, p1 range
@ -148,4 +148,4 @@ size_range2 :: #force_inline proc "contextless" ( value : Range2 ) -> Vec2 {
return { abs( value.p1.x - value.p0.x ), abs( value.p0.y - value.p1.y ) }
}
#endregion("Range2")
//endregion Range2

View File

@ -168,7 +168,7 @@ UI_State :: struct {
last_invalid_input_time : Time,
}
#region("Lifetime")
//region Lifetime
ui_startup :: proc( ui : ^ UI_State, spacial_indexing_method : UI_SpacialIndexingMethod = .QuadTree, cache_allocator : Allocator, cache_table_size : uint )
{
@ -362,9 +362,9 @@ ui_render_entry_tranverse :: proc( entry : ^UI_RenderEntry ) -> ^UI_RenderEntry
@(deferred_in = ui_graph_build_end)
ui_graph_build :: #force_inline proc( ui : ^ UI_State ) { ui_graph_build_begin( ui ) }
#endregion("Lifetime")
//endregion Lifetime
#region("Caching")
//region Caching
// Mainly referenced from RAD Debugger
// TODO(Ed): Need to setup the proper hashing convention for strings the other reference imguis use.
@ -399,7 +399,7 @@ ui_key_from_string :: #force_inline proc "contextless" ( value : string ) -> UI_
return key
}
#endregion("Caching")
//endregion Caching
ui_cursor_pos :: #force_inline proc "contextless" () -> Vec2 {
using state := get_state()

View File

@ -23,7 +23,8 @@ ui_button :: #force_inline proc( label : string, flags : UI_BoxFlags = {} ) -> (
return
}
#region("Drop Down")
//region Drop Down
UI_DropDown :: struct {
btn : UI_Widget,
title : UI_Widget,
@ -106,9 +107,10 @@ ui_drop_down_end_auto :: proc( drop_down : ^UI_DropDown) {
ui_vbox_end(drop_down.vbox, compute_layout = false)
ui_parent_pop()
}
#endregion("Drop Down")
#region("Horizontal Box")
//endregion Drop Down
//region Horizontal Box
/*
Horizontal Boxes automatically manage a collection of widgets and
attempt to slot them adjacent to each other along the x-axis.
@ -166,9 +168,10 @@ ui_hbox_end_auto :: #force_inline proc( direction : UI_LayoutDirection_X, label
ui_hbox_end(hbox, width_ref)
ui_parent_pop()
}
#endregion("Horizontal Box")
//endregion Horizontal Box
//region Resizable
#region("Resizable")
// Parameterized widget def for ui_resizable_handles
UI_Resizable :: struct {
using widget : UI_Widget,
@ -497,8 +500,10 @@ ui_resizable_handles :: #force_no_inline proc( parent : ^UI_Widget, pos : ^Vec2,
// if drag_signal && compute_layout do ui_box_compute_layout(parent)
return
}
#endregion("Resizable")
//endregion Resizable
//region Text
ui_spacer :: proc( label : string ) -> (widget : UI_Widget) {
widget.box = ui_box_make( {.Mouse_Clickable}, label )
widget.signal = ui_signal_from_box( widget.box )
@ -519,7 +524,6 @@ ui_scroll_box :: proc( label : string, flags : UI_BoxFlags ) -> (scroll_box : UI
return
}
#region("Text")
ui_text :: #force_inline proc( label : string, content : StrCached, flags : UI_BoxFlags = {} ) -> UI_Widget
{
profile(#procedure)
@ -566,9 +570,10 @@ ui_text_wrap_panel :: proc( parent : ^UI_Widget )
{
fatal("NOT IMPLEMENTED")
}
#endregion("Text")
//endregion Text
//region Text Input
#region("Text Input")
UI_TextInput_Policy :: struct {
disallow_decimal : b32,
disallow_leading_zeros : b32,
@ -741,9 +746,9 @@ ui_text_input_box :: proc( text_input_box : ^UI_TextInputBox, label : string,
}
}
}
#endregion("Text Input")
//endregion Text Input
#region("Vertical Box")
//region Vertical Box
/*
Vertical Boxes automatically manage a collection of widgets and
attempt to slot them adjacent to each other along the y-axis.
@ -800,4 +805,4 @@ ui_vbox :: #force_inline proc( direction : UI_LayoutDirection_Y, label : string,
ui_parent_push(vbox.widget)
return
}
#endregion("Vertical Box")
//endregion Vertical Box

View File

@ -1,150 +0,0 @@
// raddbg 0.9.18 user file
recent_project: path: "sectr.proj"
window:
{
size: 2048.000000 1152.000000
pos: 182 182
monitor: "\\\\.\\DISPLAY1"
maximized
panels:
{
0.731895: getting_started text:
{
selected
expression: "file:\"C:/projects/sectrprototype/code/host/host.odin\".data"
auto: 1
query: input: ""
cursor_line: 222
cursor_column: 23
mark_line: 222
mark_column: 23
}
0.268105:
{
selected
watch: expression: ""
watch: selected expression: "query:targets"
}
}
}
keybindings:
{
{ kill_all f5 shift }
{ step_into_inst f11 alt }
{ step_over_inst f10 alt }
{ step_out f11 shift }
{ halt x ctrl shift }
{ halt pause }
{ run f5 }
{ restart f5 ctrl shift }
{ step_into f11 }
{ step_over f10 }
{ run_to_line f10 ctrl }
{ set_next_statement f10 ctrl shift }
{ inc_window_font_size equal alt }
{ dec_window_font_size minus alt }
{ window n ctrl shift }
{ toggle_fullscreen return ctrl }
{ new_panel_right p ctrl }
{ new_panel_down minus ctrl }
{ rotate_panel_columns 2 ctrl }
{ next_panel comma ctrl }
{ prev_panel comma ctrl shift }
{ focus_panel_right right ctrl alt }
{ focus_panel_left left ctrl alt }
{ focus_panel_up up ctrl alt }
{ focus_panel_down down ctrl alt }
{ undo z ctrl }
{ redo y ctrl }
{ go_back left alt }
{ go_forward right alt }
{ close_panel p ctrl shift alt }
{ next_tab page_down ctrl }
{ prev_tab page_up ctrl }
{ next_tab tab ctrl }
{ prev_tab tab ctrl shift }
{ move_tab_right page_down ctrl shift }
{ move_tab_left page_up ctrl shift }
{ close_tab w ctrl }
{ tab_bar_top up ctrl shift alt }
{ tab_bar_bottom down ctrl shift alt }
{ open_tab t ctrl }
{ open o ctrl }
{ switch i ctrl }
{ switch_to_partner_file o alt }
{ open_user n ctrl shift alt }
{ open_project n ctrl alt }
{ open_user o ctrl shift alt }
{ open_project o ctrl alt }
{ save_user s ctrl shift alt }
{ save_project s ctrl shift }
{ edit f2 }
{ accept return }
{ accept space }
{ cancel esc }
{ move_left left }
{ move_right right }
{ move_up up }
{ move_down down }
{ move_left_select left shift }
{ move_right_select right shift }
{ move_up_select up shift }
{ move_down_select down shift }
{ move_left_chunk left ctrl }
{ move_right_chunk right ctrl }
{ move_up_chunk up ctrl }
{ move_down_chunk down ctrl }
{ move_up_page page_up }
{ move_down_page page_down }
{ move_up_whole home ctrl }
{ move_down_whole end ctrl }
{ move_left_chunk_select left ctrl shift }
{ move_right_chunk_select right ctrl shift }
{ move_up_chunk_select up ctrl shift }
{ move_down_chunk_select down ctrl shift }
{ move_up_page_select page_up shift }
{ move_down_page_select page_down shift }
{ move_up_whole_select home ctrl shift }
{ move_down_whole_select end ctrl shift }
{ move_up_reorder up alt }
{ move_down_reorder down alt }
{ move_home home }
{ move_end end }
{ move_home_select home shift }
{ move_end_select end shift }
{ select_all a ctrl }
{ delete_single delete }
{ delete_chunk delete ctrl }
{ backspace_single backspace }
{ backspace_chunk backspace ctrl }
{ copy c ctrl }
{ copy insert ctrl }
{ cut x ctrl }
{ paste v ctrl }
{ paste insert shift }
{ insert_text null }
{ move_next tab }
{ move_prev tab shift }
{ goto_line g ctrl }
{ goto_address g alt }
{ search f ctrl }
{ search_backwards r ctrl }
{ find_next f3 }
{ find_prev f3 ctrl }
{ find_selected_thread f4 }
{ goto_name j ctrl }
{ goto_name_at_cursor f12 }
{ toggle_watch_expr_at_cursor w alt }
{ toggle_watch_expr_at_mouse d ctrl }
{ toggle_watch_pin f9 ctrl }
{ toggle_breakpoint f9 }
{ add_address_breakpoint f9 shift }
{ add_function_breakpoint f9 ctrl shift }
{ attach f6 shift }
{ open_palette f1 }
{ open_palette p ctrl shift }
{ log_marker m ctrl shift alt }
{ toggle_dev_menu d ctrl shift alt }
}
current_path: "C:/projects/SectrPrototype/build"