06-20-2012 09:37 AM
Is there a way to perform a global replace in a function tree file?
Wanting to replace some long prefixes in function names in the .c, .h, and .fp files generated when using the Create .NET controller or Create ActiveX controller tools.
06-21-2012 02:37 PM
JeffC,
I went through the same steps in Tools >> Create ActiveX Controller. Unfortunately, these dialogs did not give the option to specify the prefix since it is automatically generated and prepended to the function calls.
I opened up the .fp file in a text editor, but it is a binary file, and so there is no way to modify the function names. In addition to the .fp file, you would need to modify the .c and .h files as well (as you mentioned).
It may be possible to rename the functions in the .c and .h files (since they are text), but there is no way to modify the .fp file (since it is binary).
As an alternative, if you are seeking to just make the code more readable, it may be possible to use a #define to do an automatic substitution for the function names.
06-26-2012 12:07 PM
Hi Jeff,
Actually, you can do a search/replace on the .fp file. After you open the .fp file in CVI, select Edit>>Replace in the function tree editor and then select the check boxes that correspond to the changes you want to make:
06-26-2012 02:44 PM
Hi Jeff,
In addition to Luis's post, I found another way to change just the prefix in the Function Tree.
1. Open the Function Panel (*.fp) file in CVI.
2. Right-click the Title and choose Edit Node... (see image)
3. In the 'Edit Instrument Node' popup, you have the option of changing the Prefix used for all of the functions. (see image)
As an example, I shortened the hp34401a prefix to hp for my IVI driver.