Finding and replacing data is a very straightforward process. To find
data, you select Edit.Find from the menu or use the keyboard
shortcut Ctrl+F. To replace data, you select Edit.Replace
from the menu or use the keyboard shortcut Ctrl+H. To
move to a specific line in the data display view, you select Edit.Go to
Line from the menu or use the keyboard shortcut Ctrl+G.
You can find data in any of the BARfly builds, but data replacement requires
BARfly Silver or better.
The "Find " dialog box
contains two fields that control the search data: the Search Type
field, and the Search Data field. The search type
choices available to you will vary depending on the context used to find
data. The search data is a line where you enter the actual content to
search for: text, UID, name, value, etc.
If you are searching for text, you are given the opportunity to choose whether
or not to perform a case-sensitive search or case
insensitive search. This is controlled by the Match Case
check box.
When the primary control displayed in the data display window is an edit
control, you can choose whether to search forward or backwards
from the cursor position in the edit control. The button "Down"
searches down (or forwards), which is the default. The button "Up"
searches up (or backwards).
The "Replace" dialog box
contains two fields that control the search data: the Search Type
field, and the Search Data field. The search type
choices available to you will vary depending on the context used to replace
data. The search data is a line where you enter the actual content to
search for: text or a value.
You provide replacement data in a third field: Replacement Data.
This can be text or a value.
If you are searching for text, you are given the opportunity to choose whether
or not to perform a case-sensitive search or case
insensitive search. This is controlled by the Match Case
check box.
Replacement operations only search forwards; you cannot search "up" or
"backwards."
You can choose to replace only a single instance or multiple instances.
The "Replace Once" button finds only a single instance and
replaces just that one instance. The "Replace All"
button locates all instances forward of the cursor and replaces each instance
in turn.
The "Go to Line" dialog
box contains only one field, which accepts a positive line number. You
can use this feature of BARfly to jump to a line number in any data display
view that has lines consistently organized vertically. This includes
views with edit controls (the line of text), list controls
(the list line item), and the raw view (the line of raw
words). This feature is unavailable with tree controls,
because vertical organization of lines is inconsistent.
Line numbers are one-based; the first line number of any control is always one.
BARfly has a sophisticated take on the typical desktop methods of finding and
replacing data in a file. There are three different contexts for finding
and replacing data:
-
Text: Finding and replacing text in an edit control.
-
Nodes: Finding nodes in the node browser.
-
Raw Data: Finding words in raw view.
Finding and Replacing Data: Edit Controls
When the Find or Replace dialogs are invoked when the primary control in the
data display window is an edit control, you only get one possible search
type: text. The Search Type field displays only
"Text."
If the search is successful, the text is highlighted in the control. For
replacement operations, the text is replaced with the Replacement Data.
If the search is unsuccessful, the log indicates the text was not found.
You can repeat the last find operation by pressing the F3 key.
Finding Data: Node Browser
When the last active window was the node browser window, the Find dialog gives
you a variety of search types to choose from. Use the Search Type
combo box to select the type of content.
You cannot replace data from the node browser. There is
no Replace dialog implementation for the node browser.
The possible search types are as follows:
-
Text (entire field)
-
Text (partial field)
-
Construct or Variable name
-
Construct UID
-
Construct Name
-
Variable Name
-
Number (any type)
-
Number (char)
-
Number (short)
-
Number (long)
-
Number (longlong)
-
Number (float)
-
Number (double)
The possible interpretations of the Search Value are explained
as follows.
Search Type = Text (entire field)
Search Type = Text (partial field)
Searching for text in the node browser is similar to searching for text in an
edit control. The search passes forward and down from the current
selection in the node browser. All children of a node are checked before
the next node is checked. If all children in a node have been checked,
focus moves back up to the parent, and the next sibling of the parent is
checked. The search stops when the text is found or the end of the tree
is reached.
If the search is successful, the node containing the text is selected in the
node browser, and the data display view is updated to indicate the found text
(results depend on node type containing the text). If the search is
unsuccessful, the log indicates the text was not found.
For text blocks, text entered into the Search Data field is
automatically scaled to match the character size. For all other nodes,
including non-text unorganized blocks and data structures, the characters
searched are assumed to have a unit size of one byte.
Markup is not processed in the search data. The text
entered in the Search Data field is exactly what is used in
the search, character for character.
It is important to distinguish searching for text over an entire field versus
searching for text in any part of the field. If the "Text (entire field)"
type is used, the node must be composed of only the search
data, with or without a null byte. If the size of the field does not
match the number of characters in the search data, there is no match for the
search.
If the "Text (partial field)" type is used, any part of the field
can contain the search data.
Search Type = Construct or Variable Name
Search Type = Construct Name
Search Type = Variable Name
You can search for names in the node browser. You can have the value in
the Search Data be treated as a construct name, a variable
name, or either a construct or a variable name. The search passes forward
and down from the current selection in the node browser. All children of
a node are checked before the next node is checked. If all children in a
node have been checked, focus moves back up to the parent, and the next sibling
of the parent is checked. The search stops when the node matching the
name is found or the end of the tree is reached.
If the search is successful, the node with the correct name is selected in the
node browser, and the data display view is updated to indicate the found node
(results depend on whether the node is visible in the node browser or in the
data display view). If the search is unsuccessful, the log indicates the
node was not found.
Constructs have unique names. Variables have unique names only within
the context of the structure in which they were declared.
While you can only find one type of construct if you search for a construct
name, you might find more than one type of construct if you search for a
variable name. This is because two data structures, for example, "xyz"
and "vwx," might both have the variable "x," and the search will turn up
whichever structure happens to be closest to the starting point of the search.
If you search for one of the built-in simple type construct names (char,
short, long, longlong, float,
or double), you can search for any unorganized block with the
simple type as a unit type, or any structure with the simple type used to
represent any one of its variables.
Search Type = Number
You can search for particular numerical values in the node browser. The
value in the Search Data is interpreted as either an integer
or floating-point number. The search passes forward and down from the
current selection in the node browser. All children of a node are checked
before the next node is checked. If all children in a node have been
checked, focus moves back up to the parent, and the next sibling of the parent
is checked. The search stops when the node with a matching number is
found or the end of the tree is reached.
If the search is successful, the node with the correct number contained within
is selected in the node browser, and the data display view is updated to
indicate the found node (results depend on node type containing the
number). If the search is unsuccessful, the log indicates the number was
not found.
The Search Data field is parsed according to the
subnode value-entry parsing rules. The number can be a numerical
quantity, a short string, or an enumerated constant name.
You can pick a specific simple type for comparison purposes in order to look for
numbers of only one simple-type format, or you can search for numbers
implemented in any simple type. The search type "Number (any type)"
searches for the first number in any format that matches the
search data. The remaining search types search for the first number in
just the specified type that matches the search data.
Finding and Replacing Data: Raw View
In raw view, finding and replacing data operates in a very different fashion as
other mechanisms for finding and replacing data. You can find and replace
text or numbers, but BARfly is much more liberal about the interpretation of
data as text and numbers in raw view than in other contexts.
The possible search types are as follows:
-
Text
-
Number (char)
-
Number (short)
-
Number (long)
-
Number (longlong)
-
Number (float)
-
Number (double)
The possible interpretations of the Search Value are explained
as follows.
Search Type = Text
Searching for text in raw view is very straightforward. The search passes
forward from the raw cursor. The search stops when the text is found or
the end of the data is reached.
If the search is successful, the raw cursor moves to the start of the
text. For replacement operations, the text is replaced with the Replacement
Data. If the search is unsuccessful, the log indicates the
text was not found.
Markup is not processed in the search data. The text
entered in the Search Data and Replacement Data
fields is exactly what is used, character for character.
There is no scaling of text characters in raw view beyond one
byte per character.
Replacement data cannot exceed the size of the search data. If the string
in Search Data is shorter than the string in Replacement
Data, only the number of characters from Search Data
are copied from Replacement Data.
Search Type = Number
Searching for numbers in raw view is a somewhat open-ended operation. You
specify the simple type of the number you are searching for, just like when
finding a number from the node browser, but the number does not need to be
directly represented as a word in the view. BARfly finds a number
based on any sequence of bytes that, when put together, constitute a matching
number. If this means the word size is 32 bits and the
search type is "Number (short)," the raw cursor can end up at any word that
contains all or part of the searched word's spanned bytes. BARfly
finds the number, aligned or not.
If the search is successful, the raw cursor moves to the word where the first
byte of the number was found. For replacement operations, the number is
replaced with the Replacement Data. If the search is
unsuccessful, the log indicates the number was not found.
The Search Data and Replacement Data fields
are parsed according to the subnode value-entry
parsing rules. The numbers can be numerical
quantities, short strings, or enumerated constant names.
See also: [Copying and pasting data]
[Undo/Redo capability] [Saving
files]
|