Most of Vedit macros can be called from Wildfilew.vdm. However, making your macros wildfile aware gives you more possibilities. Here is some technical information about Wildfilew.vdm.
Wildfilew.vdm uses numeric registers #41 to #97. Wildfilew pushes these register in stack before calling user macro. These registers can be used by user macro, but their values are not retainet on successive calls of user macro.
Registers #0 to #39 are not used by Wildfilew. These registers can be used by user macro to pass information between successive calls.
For more information of the special registers, see below.
User macro should only use free text registers in range 10 to 99 (use Reg_Free to check for free text registers). Any text registers used must be emptied at the end.
Usually, the macro should be made such way that it can be called either directly or from Wildfilew.vdm. This may require different operation in case macro is called from Wildfile (and thus multiple files are being processed). In addition, Wildfilew allows controlling some functions of Wildfilew from user macro.
If numerig register #99 has value 0x57495C44 ("WILD"), the macro was called from Wildfile. You can check this e.g. with the following command:
if (#99==0x57495C44) { // Wildfile is running }
If the user macro collects information from multiple files, it is necessary to do some initializations on the first call and store or display results on the last call. You can check if this is the firs call or last call by checking value of numreg #98. Example:
if (#98 == 0) { // first call, do initializations etc. #98 = 1 // initializations have been done } if (#98 == 2) { // last call, display results etc. }
Some of the supplied macros can be used as an example of how to create Wildfile aware macros.
Count2.vdm is a simple example. You enter a search string in a dialog box and the macro then counts how many times the string occurs in the file. The result is displayed on status line. If you call the macro directly, it counts the strings in current file only. If you call the macro from Wildfile, the strings are counted in all the specified files. The dialog box is only displayed once in the beginning.
C_paren.vdm is a more complex example of Wildfile aware macro is. It checks that all the parentheses in C file(s) are balanced. Just like count2.vdm, it can be called either directly or from Wildfile.