Skip to content

Commit

Permalink
Rename UpdateTypeFilter and UpdateTypeFilterMerged to ListTypes and L…
Browse files Browse the repository at this point in the history
…istTypesMerged
  • Loading branch information
ergrelet committed Mar 22, 2024
1 parent a85c773 commit f35ae68
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 39 deletions.
56 changes: 26 additions & 30 deletions resym/src/resym_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,18 +220,17 @@ impl ResymApp {
let on_query_update = |search_query: &str| {
// Update filtered list if filter has changed
let result = if let ResymAppMode::Comparing(..) = self.current_mode {
self.backend
.send_command(BackendCommand::UpdateTypeFilterMerged(
vec![
ResymPDBSlots::Main as usize,
ResymPDBSlots::Diff as usize,
],
search_query.to_string(),
self.settings.app_settings.search_case_insensitive,
self.settings.app_settings.search_use_regex,
))
self.backend.send_command(BackendCommand::ListTypesMerged(
vec![
ResymPDBSlots::Main as usize,
ResymPDBSlots::Diff as usize,
],
search_query.to_string(),
self.settings.app_settings.search_case_insensitive,
self.settings.app_settings.search_use_regex,
))
} else {
self.backend.send_command(BackendCommand::UpdateTypeFilter(
self.backend.send_command(BackendCommand::ListTypes(
ResymPDBSlots::Main as usize,
search_query.to_string(),
self.settings.app_settings.search_case_insensitive,
Expand Down Expand Up @@ -538,14 +537,12 @@ impl ResymApp {
self.xref_list.update_type_list(vec![]);

// Request a type list update
if let Err(err) =
self.backend.send_command(BackendCommand::UpdateTypeFilter(
ResymPDBSlots::Main as usize,
String::default(),
false,
false,
))
{
if let Err(err) = self.backend.send_command(BackendCommand::ListTypes(
ResymPDBSlots::Main as usize,
String::default(),
false,
false,
)) {
log::error!("Failed to update type filter value: {}", err);
}
// Request a module list update
Expand Down Expand Up @@ -575,16 +572,15 @@ impl ResymApp {

// Request a type list update
if let Err(err) =
self.backend
.send_command(BackendCommand::UpdateTypeFilterMerged(
vec![
ResymPDBSlots::Main as usize,
ResymPDBSlots::Diff as usize,
],
String::default(),
false,
false,
))
self.backend.send_command(BackendCommand::ListTypesMerged(
vec![
ResymPDBSlots::Main as usize,
ResymPDBSlots::Diff as usize,
],
String::default(),
false,
false,
))
{
log::error!("Failed to update type filter value: {}", err);
}
Expand Down Expand Up @@ -721,7 +717,7 @@ impl ResymApp {
}
},

FrontendCommand::UpdateFilteredTypes(filtered_types) => {
FrontendCommand::ListTypesResult(filtered_types) => {
self.type_list.update_type_list(filtered_types);
}

Expand Down
3 changes: 3 additions & 0 deletions resym/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub struct ResymAppSettings {
pub print_header: bool,
pub reconstruct_dependencies: bool,
pub print_access_specifiers: bool,
// Ignore types in the `std` namespace (e.g., STL-generated types)
pub ignore_std_types: bool,
pub print_line_numbers: bool,
}

Expand All @@ -29,6 +31,7 @@ impl Default for ResymAppSettings {
print_header: true,
reconstruct_dependencies: true,
print_access_specifiers: true,
ignore_std_types: true,
print_line_numbers: false,
}
}
Expand Down
12 changes: 6 additions & 6 deletions resym_core/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ pub enum BackendCommand {
/// Reconstruct all types found in a given PDB.
ReconstructAllTypes(PDBSlot, PrimitiveReconstructionFlavor, bool, bool),
/// Retrieve a list of types that match the given filter for a given PDB.
UpdateTypeFilter(PDBSlot, String, bool, bool),
ListTypes(PDBSlot, String, bool, bool),
/// Retrieve a list of types that match the given filter for multiple PDBs
/// and merge the result.
UpdateTypeFilterMerged(Vec<PDBSlot>, String, bool, bool),
ListTypesMerged(Vec<PDBSlot>, String, bool, bool),
/// Retrieve the list of all modules in a given PDB.
ListModules(PDBSlot, String, bool, bool),
/// Reconstruct a module given its index for a given PDB.
Expand Down Expand Up @@ -338,7 +338,7 @@ fn worker_thread_routine(
}
}

BackendCommand::UpdateTypeFilter(
BackendCommand::ListTypes(
pdb_slot,
search_filter,
case_insensitive_search,
Expand All @@ -353,11 +353,11 @@ fn worker_thread_routine(
true,
);
frontend_controller
.send_command(FrontendCommand::UpdateFilteredTypes(filtered_type_list))?;
.send_command(FrontendCommand::ListTypesResult(filtered_type_list))?;
}
}

BackendCommand::UpdateTypeFilterMerged(
BackendCommand::ListTypesMerged(
pdb_slots,
search_filter,
case_insensitive_search,
Expand All @@ -381,7 +381,7 @@ fn worker_thread_routine(
}));
}
}
frontend_controller.send_command(FrontendCommand::UpdateFilteredTypes(
frontend_controller.send_command(FrontendCommand::ListTypesResult(
filtered_type_set.into_iter().collect(),
))?;
}
Expand Down
2 changes: 1 addition & 1 deletion resym_core/src/frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub enum FrontendCommand {
/// Send result from `LoadURL` backend command.
/// Contains last path segment (i.e., file name) as a `String` and data as `Vec<u8>`.
LoadURLResult(Result<(PDBSlot, String, Vec<u8>)>),
UpdateFilteredTypes(TypeList),
ListTypesResult(TypeList),
ReconstructTypeResult(Result<String>),
ReconstructModuleResult(Result<String>),
UpdateModuleList(Result<ModuleList>),
Expand Down
4 changes: 2 additions & 2 deletions resymc/src/resymc_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ impl ResymcApp {

// Queue a request for the backend to return the list of types that
// match the given filter
self.backend.send_command(BackendCommand::UpdateTypeFilter(
self.backend.send_command(BackendCommand::ListTypes(
PDB_MAIN_SLOT,
type_name_filter,
case_insensitive,
use_regex,
))?;
// Wait for the backend to finish filtering types
if let FrontendCommand::UpdateFilteredTypes(type_list) =
if let FrontendCommand::ListTypesResult(type_list) =
self.frontend_controller.rx_ui.recv()?
{
// Dump output
Expand Down

0 comments on commit f35ae68

Please sign in to comment.