include file references

Given that include files can themselves reference other include files, is there a quick method to identify the programs that require to be recompiled after a change to an include file?

That is, how can I check which programs reference an include file?
 

Crittar

Member
Norman,

What operating system are you using?

If you are using unix the easiest way is to use the grep command to find out which programs contain the string "{file.i}" where file.i is the include program you have changed.
 
Yes, but consider the following

/* code for loop.i */
PROCEDURE p-Loop:
DEF INPUT PARAM ip-cList AS CHAR NO-UNDO.
DEF OUTPUT PARAM op-cList AS CHAR NO-UNDO.
{defvars.i}
ASSIGN iEntries = NUM-ENTRIES(ip-cList).
DO iLoop = 1 TO iEntries:
.......
END.
END PROCEDURE.

If I wanted to find all programs that referenced defvars.i, I would also need to find all files that referenced loop.i or any other include file that itself referenced defvars.i.
 

Crittar

Member
Norman,

good point - the only other way I could think of would be to write some progress code to identify the required programs:

First pass to produce a list of all required include files.

second pass to search for all programs which contain those files.

Using OS-COMMAND it should still be possible to use grep.

not the worlds most elegant solution I know - but it should work.
 

jongpau

Member
Norman,

There must be some tools around that do this for you, but how about compiling your procedures with the XREF option and then parsing the xref files (and storing the info in a db table)? As you probably know the xref file contains all sorts of handy info, including include file references.

When stored in a db table, you can run any query on the xref table(s) to find whatever you want to know - for instance: 'where used' for includes, procedures, fields, tables etc.

If you cannot find a ready to use solution, it will be a bit of work to write it yourself, but I am sure in the end it will get you your money's worth :)
 

Tranborg

New Member
I have written my own Search.w program for just that.

1. The input is a include, many includes or any string.
2. The output is a list of all program that needs recompiling.


The program loops our project and finds all .p, .w and .i depending on search string. It keeps looking down the tree for all includes/includes until it reaches the bottom.

If the search string is found in a comment, a warning color is used so I can delete the include from the result list. And all includes/programs depending on that include is automatically also deleted.


You can define filters.
You can cancel the process anytime.
You can minimize the window when running.
You can turn off Recursing subfolders.
It gives a funny sound when finished.

The comments are in Swedish and rather customized for our project. We are 5 people using it every day in our development.

Let me know if you are intrerrested. I can send you the code.

:awink:
 
Thanks Tranborg, that would be great.

We'll cope somehow with the Swedish comments.

I have amended my profile so you can send your file.
 
Top