I found this subject which was close to what I need. I use 64 bit UE 24.10.0.32 at the moment. The high level summary description is as follows:
I have a text file containing a list of ID strings. Let's call it the ID file.
Go line by line through the ID file. Each line contains an ID string.
- Start at line 1 in the ID file and search an entire directory of files for the ID string at line 1.
- For each match found in any file, append the suffix ' _ID' to the matching string in the file.
- Also on the same line in the file where we appended the _ID suffix, replace every occurrence of SP_Dev with ER_Dev.
- Repeat steps 2 and 3 for every line in the ID file until the end of the ID file is reached.
The following is an actual "snippet" from an ID file for an example.
The IDs are bracketed by the '{' and the first ',' delimiters. Ignore the rest of the junk in the line
Code: Select all
{ "ER_FW_VERSION_NUMBER", 0x15062917, BADDS_MASK, 0, 0 }, \
/* memory map */ \
{ "ER_FW_VERSION", 0xA0000000, BADDS_RO, 4, 0x15062917 }, \
{ "ER_FW_VERSION_YEAR", 0xFF000000, BADDS_MASK, 31, 24 }, \
{ "ER_FW_VERSION_MONTH", 0x00FF0000, BADDS_MASK, 23, 16 }, \
{ "ER_FW_VERSION_DAY", 0x0000FF00, BADDS_MASK, 15, 8 }, \
{ "ER_FW_VERSION_VERSION", 0x000000F0, BADDS_MASK, 7, 4 }, \
{ "ER_FW_VERSION_REVISION", 0x0000000F, BADDS_MASK, 3, 0 }, \
{ "ER_COMMON_SECTION_ADDR", 0xA0000000, BADDS_RW, 500, 0x00000000 }, \
So the first ID would be
ER_FW_VERSION_NUMBER, the second ID would be
ER_FW_VERSION and so forth.
The typical lines in files with matched IDs will be in one of the following forms:
Code: Select all
foo = SP_DevPort::read32(SP_DevPort::ER_FW_VERSION_NUMBER_);
SP_DevPort::write32(SP_DevPort::ER_FW_VERSION_NUMBER_,MmwBlah::11);
There will always be two
SP_Dev strings in lines with matched IDs preceding the matched ID. The matched IDs in the file will have an underscore suffix. The resulting ID name
ER_FW_VERSION_NUMBER__ID (two underscores) or
ER_FW_VERSION_NUMBER_ID (one underscore) is fine.
And there is one more task requirement. Using the same ID file, do the following:
- In the ID file, find first ID which is bracketed with " ",
- In the current line, search for: 0x
- Grab all 10 characters beginning with 0x and use as the search string.
- In all files in the directory, replace the 10 characters (beginning with 0x) with the ID name plus _ID suffix
- Repeat until end of ID file is reached.
So for example in the first line with an ID which is:
Code: Select all
{ "ER_FW_VERSION_NUMBER", 0x15062917, BADDS_MASK, 0, 0 }, \
We search all the files in the directory for
0x15062917 and replace all occurrences with
ER_FW_VERSION_NUMBER_ID.
This would be a huge timer saver for us. Thanks in advance.