Renamed str_fmt_alloc to str_fmt, str_fmt to str_fmt_out, allocator convention enforcement in context

I'm enforcing aprintf it as the default formatter.
I changed up the context allocator assignment to reflect how I've been intending to allocation in startup & platform events vs tick.
Tick uses the frame slab's by default with transient on temp. Startup & platform events use the transient by default & for temp, with any use of the persistent allocator being explicit.
This commit is contained in:
2024-05-22 17:13:56 -04:00
parent 368abefccf
commit cf81d3f9bd
18 changed files with 56 additions and 51 deletions

View File

@ -180,7 +180,7 @@ ui_graph_build_begin :: proc( ui : ^ UI_State, bounds : Vec2 = {} )
}
ui.built_box_count = 0
root = ui_box_make( {}, str_intern(str_fmt_tmp("%s: root#001", ui == & state.screen_ui ? "Screen" : "Workspace" )).str)
root = ui_box_make( {}, str_intern(str_fmt("%s: root#001", ui == & state.screen_ui ? "Screen" : "Workspace" )).str)
if ui == & state.screen_ui {
root.layout.size = range2(Vec2(state.app_window.extent) * 2, {})
}

View File

@ -21,7 +21,7 @@ ui_floating_startup :: proc( self : ^UI_FloatingManager, allocator : Allocator,
{
error : AllocatorError
queue_dbg_name := str_intern(str_fmt_tmp("%s: build_queue", dbg_name))
queue_dbg_name := str_intern(str_fmt("%s: build_queue", dbg_name))
self.build_queue, error = array_init_reserve( UI_Floating, allocator, build_queue_cap, dbg_name = queue_dbg_name.str )
if error != AllocatorError.None
{
@ -29,7 +29,7 @@ ui_floating_startup :: proc( self : ^UI_FloatingManager, allocator : Allocator,
return error
}
tracked_dbg_name := str_intern(str_fmt_tmp("%s: tracked", dbg_name))
tracked_dbg_name := str_intern(str_fmt("%s: tracked", dbg_name))
self.tracked, error = hmap_chained_init(UI_Floating, uint(tracked_cap), allocator, dbg_name = tracked_dbg_name.str )
if error != AllocatorError.None
{

View File

@ -61,7 +61,7 @@ test_draggable :: proc()
draggable.layout.pos = debug.draggable_box_pos
draggable.layout.size.min = debug.draggable_box_size
draggable.text = { str_fmt_alloc("%v", debug.draggable_box_pos), {} }
draggable.text = { str_fmt("%v", debug.draggable_box_pos), {} }
draggable.text.runes = to_runes(draggable.text.str)
}
@ -203,7 +203,7 @@ test_whitespace_ast :: proc( default_layout : ^UI_Layout, frame_style_default :
}
ui_layout( text_layout )
line_hbox := ui_widget(str_fmt_alloc( "line %v", line_id ), {.Mouse_Clickable})
line_hbox := ui_widget(str_fmt( "line %v", line_id ), {.Mouse_Clickable})
if line_hbox.key == ui.hot
{
@ -228,14 +228,14 @@ test_whitespace_ast :: proc( default_layout : ^UI_Layout, frame_style_default :
#partial switch head.type
{
case .Visible:
label := str_intern( str_fmt_alloc( "%v %v", head.content.str, label_id ))
label := str_intern( str_fmt( "%v %v", head.content.str, label_id ))
widget = ui_text( label.str, head.content )
label_id += 1
chunk_layout.pos.x += size_range2( widget.computed.bounds ).x
case .Spaces:
label := str_intern( str_fmt_alloc( "%v %v", "space", label_id ))
label := str_intern( str_fmt( "%v %v", "space", label_id ))
widget = ui_text_spaces( label.str )
label_id += 1
@ -247,7 +247,7 @@ test_whitespace_ast :: proc( default_layout : ^UI_Layout, frame_style_default :
chunk_layout.pos.x += size_range2( widget.computed.bounds ).x
case .Tabs:
label := str_intern( str_fmt_alloc( "%v %v", "tab", label_id ))
label := str_intern( str_fmt( "%v %v", "tab", label_id ))
widget = ui_text_tabs( label.str )
label_id += 1

View File

@ -307,7 +307,7 @@ ui_resizable_handles :: proc( parent : ^UI_Widget, pos : ^Vec2, size : ^Vec2,
name :: proc( label : string ) -> string {
parent_label := (transmute(^string) context.user_ptr) ^
return str_intern(str_fmt_alloc("%v: %v", parent_label, label )).str
return str_intern(str_fmt("%v: %v", parent_label, label )).str
}
context.user_ptr = & parent.label