views autocompletion; view doc coverage

This commit is contained in:
Ryan Fleury
2026-04-22 19:57:08 -07:00
parent 05d76b416a
commit 3c214cfbb5
7 changed files with 216 additions and 105 deletions
File diff suppressed because one or more lines are too long
+1
View File
@@ -444,6 +444,7 @@ typedef struct RD_NameSchemaInfo RD_NameSchemaInfo;
struct RD_NameSchemaInfo struct RD_NameSchemaInfo
{ {
String8 name; String8 name;
B32 is_view;
String8 schema; String8 schema;
}; };
+67 -63
View File
@@ -224,11 +224,11 @@ RD_VocabTable:
//////////////////////////////// ////////////////////////////////
//~ rjf: Schemas //~ rjf: Schemas
@table(name schema) RD_SchemaTable: @table(name is_view schema) RD_SchemaTable:
{ {
//- rjf: @schema users //- rjf: @schema user
{ {
user, user, 0,
``` ```
@expand_commands(edit_user_theme) x: @expand_commands(edit_user_theme) x:
{ {
@@ -312,8 +312,8 @@ RD_VocabTable:
// string and put it into a table cell... // string and put it into a table cell...
// //
{ {
project project, 0,
``` ```
@expand_commands(edit_project_theme) x: @expand_commands(edit_project_theme) x:
{ {
@display_name('Project Name') 'name': string, @display_name('Project Name') 'name': string,
@@ -414,7 +414,7 @@ RD_VocabTable:
//- rjf: @schema theme_color //- rjf: @schema theme_color
{ {
theme_color, theme_color, 0,
``` ```
@collection_commands(add_theme_color, fork_theme, save_theme, save_and_set_theme) @collection_commands(add_theme_color, fork_theme, save_theme, save_and_set_theme)
@row_commands(duplicate_cfg, remove_cfg) @row_commands(duplicate_cfg, remove_cfg)
@@ -428,7 +428,7 @@ RD_VocabTable:
//- rjf: @schema window //- rjf: @schema window
{ {
window, window, 0,
``` ```
x: x:
{ {
@@ -459,7 +459,7 @@ RD_VocabTable:
//- rjf: @schema tab //- rjf: @schema tab
{ {
tab, tab, 0,
``` ```
@row_commands(@file copy_tab_full_path, @file show_file_in_explorer, duplicate_tab, close_tab) @row_commands(@file copy_tab_full_path, @file show_file_in_explorer, duplicate_tab, close_tab)
x: x:
@@ -471,50 +471,50 @@ RD_VocabTable:
} }
//- rjf: @schema bin //- rjf: @schema bin
{bin ```x:{ @description('An expression to which the 2-radix display should apply.') 'expression': expr_string }```} {bin 1 ```x:{ @description('An expression to which the 2-radix display should apply.') 'expression': expr_string }```}
//- rjf: @schema oct //- rjf: @schema oct
{oct ```x:{ @description('An expression to which the 8-radix display should apply.') 'expression': expr_string }```} {oct 1 ```x:{ @description('An expression to which the 8-radix display should apply.') 'expression': expr_string }```}
//- rjf: @schema hex //- rjf: @schema hex
{hex ```x:{ @description('An expression to which the 16-radix display should apply.') 'expression': expr_string }```} {hex 1 ```x:{ @description('An expression to which the 16-radix display should apply.') 'expression': expr_string }```}
//- rjf: @schema digits //- rjf: @schema digits
{digits ```x:{ @description('An expression to which the digit display should apply.') 'expression': expr_string, @description('The minimum number of digits to display.') 'digit_count': u64 }```} {digits 1 ```x:{ @description('An expression to which the digit display should apply.') 'expression': expr_string, @description('The minimum number of digits to display.') 'digit_count': u64 }```}
//- rjf: @schema no_string //- rjf: @schema no_string
{no_string ```x:{ @description('The expression for which string visualization should be disabled.') 'expression': expr_string}```} {no_string 1 ```x:{ @description('The expression for which string visualization should be disabled.') 'expression': expr_string}```}
//- rjf: @schema no_char //- rjf: @schema no_char
{no_char ```x:{ @description('The expression for which character visualization should be disabled.') 'expression': expr_string}```} {no_char 1 ```x:{ @description('The expression for which character visualization should be disabled.') 'expression': expr_string}```}
//- rjf: @schema no_addr //- rjf: @schema no_addr
{no_addr ```x:{ @description('The expression for which address visualization should be disabled.') 'expression': expr_string}```} {no_addr 1 ```x:{ @description('The expression for which address visualization should be disabled.') 'expression': expr_string}```}
//- rjf: @schema sequence //- rjf: @schema sequence
{sequence ```x:{ @description('The number of expansions to generate.') 'count': expr_string}```} {sequence 1 ```x:{ @description('The number of expansions to generate.') 'count': expr_string}```}
//- rjf: @schema rows //- rjf: @schema rows
{rows ```x:{ @description('The expression for which rows should be generated.') 'expression': expr_string, @description('A list of expressions which will be used to generate rows.') '...'}```} {rows 1 ```x:{ @description('The expression for which rows should be generated.') 'expression': expr_string, @description('A list of expressions which will be used to generate rows.') '...'}```}
//- rjf: @schema columns //- rjf: @schema columns
{columns ```x:{ @description('The expression for whose expansions columns should be generated.') 'expression': expr_string, @description('A list of expressions which will be used to generate columns for each expansion from `expression`.') '...'}```} {columns 1 ```x:{ @description('The expression for whose expansions columns should be generated.') 'expression': expr_string, @description('A list of expressions which will be used to generate columns for each expansion from `expression`.') '...'}```}
//- rjf: @schema omit //- rjf: @schema omit
{omit ```x:{ @description('The expression for which certain members should be omitted.') 'expression': expr_string, @description('A list of member names to omit from the expansion.') '...'}```} {omit 1 ```x:{ @description('The expression for which certain members should be omitted.') 'expression': expr_string, @description('A list of member names to omit from the expansion.') '...'}```}
//- rjf: @schema range1 //- rjf: @schema range1
{range1 ```x:{ @description('The expression which should be bounded by `min` and `max`.') 'expression': expr_string, @description('The lower bound.') min, @description('The upper bound.') max}```} {range1 1 ```x:{ @description('The expression which should be bounded by `min` and `max`.') 'expression': expr_string, @description('The lower bound.') min, @description('The upper bound.') max}```}
//- rjf: @schema array //- rjf: @schema array
{array ```x:{ @description('An expression of the base address of the array.') 'base_address': expr_string, @description('The number of elements in the array.') count}```} {array 1 ```x:{ @description('An expression of the base address of the array.') 'base_address': expr_string, @description('The number of elements in the array.') count}```}
//- rjf: @schema slice //- rjf: @schema slice
{slice ```x:{ @description('An expression of a structure that is to be interpreted as a slice.') 'expression': expr_string}```} {slice 1 ```x:{ @description('An expression of a structure that is to be interpreted as a slice.') 'expression': expr_string}```}
//- rjf: @schema list //- rjf: @schema list
{ {
list, list, 1,
``` ```
x: x:
{ {
@@ -528,7 +528,7 @@ RD_VocabTable:
//- rjf: @schema watch //- rjf: @schema watch
{ {
watch, watch, 0,
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@@ -544,15 +544,15 @@ RD_VocabTable:
//- rjf: @schema text //- rjf: @schema text
{ {
text, text, 1,
``` ```
@inherit(tab) @expand_commands(@output clear_output) x: @inherit(tab) @expand_commands(@output clear_output) x:
{ {
@description("An expression to describe data which should be viewed as text or code.") @description("An expression to describe data which should be viewed as text or code.")
'expression': expr_string, 'expression': expr_string,
@description("The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.") @optional @description("The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.")
'lang': code_string, 'lang': code_string,
@default(1) @description("Controls whether or not line numbers are shown.") @no_callee_helper @default(1) @description("Controls whether or not line numbers are shown.")
'show_line_numbers':bool, 'show_line_numbers':bool,
@no_callee_helper @default(1) @display_name('Line Wrapping') @description("Splits textual lines into multiple visual lines, so that all text is within the visible area.") @no_callee_helper @default(1) @display_name('Line Wrapping') @description("Splits textual lines into multiple visual lines, so that all text is within the visible area.")
'line_wrapping': bool, 'line_wrapping': bool,
@@ -566,15 +566,18 @@ RD_VocabTable:
//- rjf: @schema disasm //- rjf: @schema disasm
{ {
disasm, disasm, 1,
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@description("An expression to describe the base address or offset of the disassembly.") @description("An expression to describe the base address or offset of the disassembly.")
'expression': expr_string, 'expression': expr_string,
'arch': code_string, @optional @description("The maximum number of bytes to disassemble.")
'syntax': code_string, 'size': expr_string,
'size': expr_string, @optional @description("The architecture to interpret the data as when disassembling.")
'arch': code_string,
@optional @description("The syntax style to use when displaying the disassembly textually.")
'syntax': code_string,
@no_callee_helper @default(1) @description("Controls whether or not addresses are shown in the disassembly text.") @no_callee_helper @default(1) @description("Controls whether or not addresses are shown in the disassembly text.")
'show_addresses': bool, 'show_addresses': bool,
@no_callee_helper @default(0) @description("Controls whether or not code bytes are shown in the disassembly text.") @no_callee_helper @default(0) @description("Controls whether or not code bytes are shown in the disassembly text.")
@@ -591,35 +594,35 @@ RD_VocabTable:
//- rjf: @schema memory //- rjf: @schema memory
{ {
memory, memory, 1,
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@display_name("Zoom") @description("The zoom level for displaying bytes in the memory view.")
@default(1.0) 'zoom': @range[0.5, 2] f32,
@display_name("Base Address") @description("An expression which refers to the base address of data which should be viewed as memory.") @display_name("Base Address") @description("An expression which refers to the base address of data which should be viewed as memory.")
'expression': expr_string, 'expression': expr_string,
@display_name("Address Range Size") @description("The number of bytes of the viewed memory range.") @no_callee_helper @display_name("Zoom") @description("The zoom level for displaying bytes in the memory view.")
@default(1.0) 'zoom': @range[0.5, 2] f32,
@optional @display_name("Address Range Size") @description("The number of bytes of the viewed memory range.")
'size': expr_string, 'size': expr_string,
@display_name("Cursor Address") @description("The address of the cursor.") @no_callee_helper @display_name("Cursor Address") @description("The address of the cursor.")
'cursor': expr_string, 'cursor': expr_string,
@default(1) @display_name("Cursor Size") @description("The size, in bytes, of the cursor.") @no_callee_helper @default(1) @display_name("Cursor Size") @description("The size, in bytes, of the cursor.")
'cursor_size': @range[1, 16] u64, 'cursor_size': @range[1, 16] u64,
@expand_if("!$.auto_columns") @default(16) @description("The number of columns to build before building new rows.") @optional @expand_if("!$.auto_columns") @default(16) @description("The number of columns to build before building new rows.")
'num_columns': @range[1, 64] u64, 'num_columns': @range[1, 64] u64,
@default(16) @display_name("Default Radix") @description("The default radix with which numeric values should be displayed, when peeking.") @optional @default(16) @display_name("Default Radix") @description("The default radix with which numeric values should be displayed, when peeking.")
@or(2, 8, 10, 16) @or(2, 8, 10, 16)
'default_radix': u64, 'default_radix': u64,
@default(1) @display_name("Track Mark To Cursor") @description("Ensures that the mark always follows the cursor, if the cursor value is updated.") @no_callee_helper @default(1) @display_name("Track Mark To Cursor") @description("Ensures that the mark always follows the cursor, if the cursor value is updated.")
'track_mark_to_cursor': bool, 'track_mark_to_cursor': bool,
@default(1) @display_name("Allow Mutation") @description("Allows operations which mutate memory.") @no_callee_helper @default(1) @display_name("Allow Mutation") @description("Allows operations which mutate memory.")
'allow_mutation': bool, 'allow_mutation': bool,
@default(0) @display_name("Automatically Size Columns") @description("Determines the number of columns based on the available space.") @no_callee_helper @default(0) @display_name("Automatically Size Columns") @description("Determines the number of columns based on the available space.")
'auto_columns': bool, 'auto_columns': bool,
@default(1) @display_name("Peek As Unsigned") 'peek_as_unsigned': bool, @no_callee_helper @default(1) @display_name("Peek As Unsigned") 'peek_as_unsigned': bool,
@default(1) @display_name("Peek As Signed") 'peek_as_signed': bool, @no_callee_helper @default(1) @display_name("Peek As Signed") 'peek_as_signed': bool,
@default(1) @display_name("Peek As Float") 'peek_as_float': bool, @no_callee_helper @default(1) @display_name("Peek As Float") 'peek_as_float': bool,
@display_name("Extra Peek Types") @description("A list of types as which to interpret selected memory.") @no_callee_helper @display_name("Extra Peek Types") @description("A list of types as which to interpret selected memory.")
'peek_types': set, 'peek_types': set,
} }
``` ```
@@ -627,7 +630,7 @@ RD_VocabTable:
//- rjf: @schema bitmap //- rjf: @schema bitmap
{ {
bitmap, bitmap, 1,
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@@ -643,7 +646,7 @@ RD_VocabTable:
//- rjf: @schema color //- rjf: @schema color
{ {
color, color, 1,
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@@ -655,7 +658,7 @@ RD_VocabTable:
//- rjf: @schema geo3d //- rjf: @schema geo3d
{ {
geo3d, geo3d, 1,
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@@ -673,7 +676,7 @@ RD_VocabTable:
//- rjf: @schema getting_started //- rjf: @schema getting_started
{ {
getting_started, getting_started, 0,
``` ```
@inherit(tab) x: @inherit(tab) x:
{ {
@@ -683,7 +686,7 @@ RD_VocabTable:
//- rjf: @schema target //- rjf: @schema target
{ {
target, target, 0,
``` ```
@row_commands(@cmd_line save_cfg_to_project, enable_cfg, launch_and_run, launch_and_step_into, duplicate_cfg, remove_cfg) @row_commands(@cmd_line save_cfg_to_project, enable_cfg, launch_and_run, launch_and_step_into, duplicate_cfg, remove_cfg)
@collection_commands(add_target) @collection_commands(add_target)
@@ -706,7 +709,7 @@ RD_VocabTable:
//- rjf: @schema breakpoint //- rjf: @schema breakpoint
{ {
breakpoint, breakpoint, 0,
``` ```
@row_commands(enable_cfg, duplicate_cfg, remove_cfg) @row_commands(enable_cfg, duplicate_cfg, remove_cfg)
@collection_commands(toggle_breakpoint, add_breakpoint, add_address_breakpoint, add_function_breakpoint, clear_breakpoints) @collection_commands(toggle_breakpoint, add_breakpoint, add_address_breakpoint, add_function_breakpoint, clear_breakpoints)
@@ -728,7 +731,7 @@ RD_VocabTable:
//- rjf: @schema watch_pin //- rjf: @schema watch_pin
{ {
watch_pin, watch_pin, 0,
``` ```
@row_commands(duplicate_cfg, remove_cfg) @row_commands(duplicate_cfg, remove_cfg)
@collection_commands(add_watch_pin, toggle_watch_pin) @collection_commands(add_watch_pin, toggle_watch_pin)
@@ -743,7 +746,7 @@ RD_VocabTable:
//- rjf: @schema debug_info //- rjf: @schema debug_info
{ {
debug_info, debug_info, 0,
``` ```
@row_commands(enable_cfg, duplicate_cfg, remove_cfg) @row_commands(enable_cfg, duplicate_cfg, remove_cfg)
@collection_commands(load_debug_info) @collection_commands(load_debug_info)
@@ -758,49 +761,49 @@ RD_VocabTable:
//- rjf: @schema file_path_map //- rjf: @schema file_path_map
{ {
file_path_map, file_path_map, 0,
```@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source': @no_relativize path, 'dest': @no_relativize path}```, ```@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source': @no_relativize path, 'dest': @no_relativize path}```,
} }
//- rjf: @schema type_view //- rjf: @schema type_view
{ {
type_view, type_view, 0,
```@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':expr_string, 'expr':expr_string}```, ```@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':expr_string, 'expr':expr_string}```,
} }
//- rjf: @schema recent_project //- rjf: @schema recent_project
{ {
recent_project, recent_project, 0,
```x:{'path':path}```, ```x:{'path':path}```,
} }
//- rjf: @schema recent_file //- rjf: @schema recent_file
{ {
recent_file, recent_file, 0,
```x:{'path':path}```, ```x:{'path':path}```,
} }
//- rjf: @schema machine //- rjf: @schema machine
{ {
machine, machine, 0,
```x:{'label':code_string, @no_expand 'active':bool, 'unattached_processes':set, 'processes':set}```, ```x:{'label':code_string, @no_expand 'active':bool, 'unattached_processes':set, 'processes':set}```,
} }
//- rjf: @schema process //- rjf: @schema process
{ {
process, process, 0,
```x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'modules':set, 'threads':set}```, ```x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'modules':set, 'threads':set}```,
} }
//- rjf: @schema module //- rjf: @schema module
{ {
module, module, 0,
```x:{'exe':path, 'dbg':path, 'vaddr_range':vaddr_range}```, ```x:{'exe':path, 'dbg':path, 'vaddr_range':vaddr_range}```,
} }
//- rjf: @schema thread //- rjf: @schema thread
{ {
thread, thread, 0,
```x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'call_stack':set}```, ```x:{'label':code_string, 'id':u64, @no_expand 'active':bool, 'call_stack':set}```,
} }
} }
@@ -808,12 +811,13 @@ RD_VocabTable:
@struct RD_NameSchemaInfo: @struct RD_NameSchemaInfo:
{ {
`String8 name`; `String8 name`;
`B32 is_view`;
`String8 schema`; `String8 schema`;
} }
@data(RD_NameSchemaInfo) rd_name_schema_info_table: @data(RD_NameSchemaInfo) rd_name_schema_info_table:
{ {
@expand(RD_SchemaTable a) `{str8_lit_comp("$(a.name)"), str8_lit_comp("$(a.schema)")}` @expand(RD_SchemaTable a) `{str8_lit_comp("$(a.name)"), $(a.is_view), str8_lit_comp("$(a.schema)")}`
} }
//////////////////////////////// ////////////////////////////////
+38 -2
View File
@@ -5988,7 +5988,13 @@ rd_window_frame(void)
} }
first = 0; first = 0;
UI_Key arg_key = ui_key_from_stringf(ui_active_seed_key(), "###arg_%p", child); UI_Key arg_key = ui_key_from_stringf(ui_active_seed_key(), "###arg_%p", child);
DR_FStrList arg_fstrs = rd_fstrs_from_code_string(scratch.arena, 1.f, 0, code_default, child->string); String8 arg_string = child->string;
B32 is_optional = md_node_has_tag(child, str8_lit("optional"), 0);
if(is_optional)
{
arg_string = str8f(scratch.arena, "[%S=...]", child->string);
}
DR_FStrList arg_fstrs = rd_fstrs_from_code_string(scratch.arena, 1.f, 0, code_default, arg_string);
if(child == ws->autocomp_cursor_info.arg_schema) if(child == ws->autocomp_cursor_info.arg_schema)
{ {
ui_set_next_flags(UI_BoxFlag_DrawSideBottom); ui_set_next_flags(UI_BoxFlag_DrawSideBottom);
@@ -6013,6 +6019,11 @@ rd_window_frame(void)
ui_spacer(ui_em(0.5f, 1.f)); ui_spacer(ui_em(0.5f, 1.f));
UI_TagF("weak") ui_label(display_name); UI_TagF("weak") ui_label(display_name);
} }
if(is_optional)
{
ui_spacer(ui_em(0.5f, 1.f));
UI_TagF("weak") ui_labelf("(Optional)");
}
} }
UI_TagF("weak") rd_label(desc); UI_TagF("weak") rd_label(desc);
} }
@@ -9205,7 +9216,7 @@ rd_set_autocomp_regs_(E_Eval dst_eval, RD_Regs *regs)
// rjf: calculate most general list expression, given the dst_eval space // rjf: calculate most general list expression, given the dst_eval space
B32 force_allow = 0; B32 force_allow = 0;
B32 expr_based_replace = 1; B32 expr_based_replace = 1;
String8 list_expr = str8_lit("query:locals, query:globals, query:thread_locals, query:procedures, query:types, query:constants"); String8 list_expr = str8_lit("query:locals, query:views, query:globals, query:thread_locals, query:procedures, query:types, query:constants");
{ {
E_TypeKey maybe_enum_type = e_type_key_unwrap(dst_eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative & ~E_TypeUnwrapFlag_Enums); E_TypeKey maybe_enum_type = e_type_key_unwrap(dst_eval.irtree.type_key, E_TypeUnwrapFlag_AllDecorative & ~E_TypeUnwrapFlag_Enums);
if(dst_eval.space.kind == RD_EvalSpaceKind_MetaCfg) if(dst_eval.space.kind == RD_EvalSpaceKind_MetaCfg)
@@ -11286,6 +11297,31 @@ rd_frame(void)
} }
} }
//- rjf: add macro for views
{
String8 names[] =
{
str8_lit("views"),
};
for EachElement(idx, names)
{
String8 name = names[idx];
E_TypeKey type_key = e_type_key_cons(.kind = E_TypeKind_Set,
.flags = E_TypeFlag_StubSingleLineExpansion,
.name = name,
.access = E_TYPE_ACCESS_FUNCTION_NAME(views),
.expand =
{
.info = E_TYPE_EXPAND_INFO_FUNCTION_NAME(views),
.range = E_TYPE_EXPAND_RANGE_FUNCTION_NAME(views),
});
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, r1u64(0, 0));
expr->type_key = type_key;
expr->space = e_space_make(RD_EvalSpaceKind_MetaQuery);
e_string2expr_map_insert(scratch.arena, macro_map, name, expr);
}
}
//- rjf: build schema types & cache (name -> type) mapping //- rjf: build schema types & cache (name -> type) mapping
for EachElement(idx, rd_name_schema_info_table) for EachElement(idx, rd_name_schema_info_table)
{ {
+1
View File
@@ -14,6 +14,7 @@ enum
RD_EvalSpaceKind_MetaCfg, RD_EvalSpaceKind_MetaCfg,
RD_EvalSpaceKind_MetaCmd, RD_EvalSpaceKind_MetaCmd,
RD_EvalSpaceKind_MetaTheme, RD_EvalSpaceKind_MetaTheme,
RD_EvalSpaceKind_MetaView,
RD_EvalSpaceKind_MetaCtrlEntity, RD_EvalSpaceKind_MetaCtrlEntity,
RD_EvalSpaceKind_MetaUnattachedProcess, RD_EvalSpaceKind_MetaUnattachedProcess,
RD_EvalSpaceKind_MetaCallStackTree, RD_EvalSpaceKind_MetaCallStackTree,
+62
View File
@@ -157,6 +157,68 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(themes)
} }
} }
////////////////////////////////
//~ rjf: `views` Type Hooks
E_TYPE_ACCESS_FUNCTION_DEF(views)
{
E_IRTreeAndType result = {&e_irnode_nil};
if(expr->kind == E_ExprKind_ArrayIndex &&
expr->first->next->kind == E_ExprKind_LeafStringLiteral)
{
Temp scratch = scratch_begin(&arena, 1);
String8 view_name = expr->first->next->string;
E_TypeKey view_type = e_type_key_cons(.kind = E_TypeKind_U64, .name = str8_lit("view"));
result.type_key = view_type;
result.mode = E_Mode_Null;
result.root = e_irtree_set_space(arena, e_space_make(RD_EvalSpaceKind_MetaView), e_irtree_const_u(arena, e_id_from_string(view_name)));
scratch_end(scratch);
}
return result;
}
E_TYPE_EXPAND_INFO_FUNCTION_DEF(views)
{
E_TypeExpandInfo result = {0};
{
Temp scratch = scratch_begin(&arena, 1);
//- rjf: gather cfgs
String8List names = {0};
for EachElement(idx, rd_name_schema_info_table)
{
if(rd_name_schema_info_table[idx].is_view)
{
String8 name = rd_name_schema_info_table[idx].name;
FuzzyMatchRangeList name_matches = fuzzy_match_find(scratch.arena, filter, name);
if(name_matches.count == name_matches.needle_part_count)
{
str8_list_push(scratch.arena, &names, name);
}
}
}
//- rjf: flatten & build accelerator
String8Array *accel = push_array(arena, String8Array, 1);
*accel = str8_array_from_list(arena, &names);
result.user_data = accel;
result.expr_count = accel->count;
scratch_end(scratch);
}
return result;
}
E_TYPE_EXPAND_RANGE_FUNCTION_DEF(views)
{
U64 out_idx = 0;
String8Array *accel = (String8Array *)user_data;
for(U64 idx = idx_range.min; idx < idx_range.max; idx += 1, out_idx += 1)
{
String8 name = accel->v[idx];
evals_out[out_idx] = e_eval_from_string(name);
}
}
//////////////////////////////// ////////////////////////////////
//~ rjf: `locals` Type Hooks //~ rjf: `locals` Type Hooks
+7
View File
@@ -18,6 +18,13 @@ E_TYPE_ACCESS_FUNCTION_DEF(themes);
E_TYPE_EXPAND_INFO_FUNCTION_DEF(themes); E_TYPE_EXPAND_INFO_FUNCTION_DEF(themes);
E_TYPE_EXPAND_RANGE_FUNCTION_DEF(themes); E_TYPE_EXPAND_RANGE_FUNCTION_DEF(themes);
////////////////////////////////
//~ rjf: `views` Type Hooks
E_TYPE_ACCESS_FUNCTION_DEF(views);
E_TYPE_EXPAND_INFO_FUNCTION_DEF(views);
E_TYPE_EXPAND_RANGE_FUNCTION_DEF(views);
//////////////////////////////// ////////////////////////////////
//~ rjf: `locals` Type Hooks //~ rjf: `locals` Type Hooks