How to "Find" ?

Go To Last Post
27 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greetings -

 

I'm stymied, a bit, by differences between AS7/MCS7 editor and my trusty BBEdit/TextWranger editor. With TextWrangler, I can have ALL of the code + header files of the project available to the editor (70+ for the project in question) and I can do the equivalent of GREP and find the occurrence of a character sequence in all of the files. BUT, AS7 seems to look only at the .c files. 

 

So, the burning question: How can I find all of the occurrences of "xyzzy" (or any other abstract character sequence) in BOTH code and header files in AS7?

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
How can I find all of the occurrences of "xyzzy"

Your in a maze of twisty passages all alike!

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I know that! Trying to find my way out of the twisty passages.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I thought there was a search (find) in all open files, or all files in project choice.

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When I try to do the "Find All", it SEEMS to only search the .c files. I will recheck that to make sure that my perception is accurate.

 

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes there is a find in files, when you select that, there is a look in drop down, default is entire solution, or all open documents, or current project.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Under find options in find and replace window, add *.h files, maybe that will help.

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Then go SE, down, down to escape! 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But, of course!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Arghh, I can't make it work until I open the header file that contains the #define in question, which presumes, of course, that you know that,

 

I tried: (1) Look in entire solution, (2) Look in entire solution (including external items), (3) Look in entire project (including external items) with "look in these file types" where I entered "*.h" 

 

Nada until I actually opened the required header file. Certainly, there must be a better way than opening 35+ header files!

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


 

 

Edit > Find and Replace > Find in Files

 

 

 

Expand 'Find Options' - there's where you specify file types:

 

 

 

 

EDIT

 

Also on the toolbar:

 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. Feb 23, 2021 - 12:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

That is exactly what I have been trying except via shortcut ctrl-shift-F

 

Will try again. Here is an example: I have a #define USBVIOPIN in header file pins.h (which I now know because I found it using my TextWrangler). 

Here is what the Find and Replace dialog shows

 

And here are the search results

 

Find all "USBVIOPIN", Subfolders, Find Results 1, Entire Solution, "*.c; *.h"
  C:\Users\wagne\Dropbox\ALogger_101A\ALogger_101R\ALogger_101R\init.c(135):    //USBVIOPIN is low output. Just change direction.
  C:\Users\wagne\Dropbox\ALogger_101A\ALogger_101R\ALogger_101R\init.c(136):    USBCTLDDR |= (1<<USBVIOPIN);
  C:\Users\wagne\Dropbox\ALogger_101A\ALogger_101R\ALogger_101R\USB.c(48):    USBCTLPORT |= (1<<USBVIOPIN);        
  C:\Users\wagne\Dropbox\ALogger_101A\ALogger_101R\ALogger_101R\USB.c(49):    //DDRC |= (1<<USBVIOPIN);            //USB Vio pin = output so will source current when on XYZZY
  C:\Users\wagne\Dropbox\ALogger_101A\ALogger_101R\ALogger_101R\USB.c(106):      USBCTLPORT &= ~(1<<USBVIOPIN);        //remove voltage from USB VIO pin.
  C:\Users\wagne\Dropbox\ALogger_101A\ALogger_101R\ALogger_101R\USB.c(107):    //DDRC &= ~(1<<USBVIOPIN);            //USB Vio pin = input so won't source or sink current when off XYZZY
  Matching lines: 6    Matching files: 2    Total files searched: 35
 

 Note that is says that 35 files were searched. That is the number of .c files. There are another 35+ .h files. Note the top line of the results where it appears to say to search both .c and .h files. It never found the #define in pins.h

 

Is it broken or am I missing something? BTW, this is 

 

Atmel Studio 7 (Version: 7.0.1931 - )
© 2015 Atmel Corp.
All rights reserved.

OS Version: Microsoft Windows NT 6.2.9200.0
Platform: Win32NT

Installed Packages: Shell VSIX manifest - 7.0
Shell VSIX manifest
Version: 7.0
Package GUID: e874ffe4-fbe3-4624-9a17-61014ede02d0
Company: Atmel Corporation

Installed Packages: Atmel Start - 1.0.158.0
Atmel Start
Version: 1.0.158.0
Package GUID: F8853255-9C7B-4DC2-8E0F-64D9324AEB0E
Company: Atmel

Installed Packages: Atmel Software Framework - 3.40.0.1184
ASF
Version: 3.40.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.40.0
Release Description: ASF - 3.40.0 Release

ASF
Version: 3.39.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.39.0
Release Description: ASF - 3.39.0 Release

ASF
Version: 3.38.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.38.0
Release Description: ASF - 3.38.0 Release

ASF
Version: 3.37
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.37
Release Description: ASF - 3.37 Release

ASF
Version: 3.36.2
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.36.2
Release Description: ASF - 3.36.2 Release

ASF
Version: 3.36.1
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.36.1
Release Description: ASF - 3.36.1 Release

ASF
Version: 3.36.0
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.36.0
Release Description: ASF - 3.36.0 Release

ASF
Version: 3.35.1
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.35.1
Release Description: ASF - 3.35.1 Release

ASF
Version: 3.34.2
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.34.2
Release Description: ASF - 3.34.2 Release

ASF
Version: 3.34.1
Package GUID: 4CE20911-D794-4550-8B94-6C66A93228B8
Company: Atmel
HelpUrl: http://asf.atmel.com/3.34.1
Release Description: ASF - 3.34.1 Release

Installed Packages: LiveWatch - 2.0.65
LiveWatch
Version: 2.0.65
Package GUID: 7DF6DCFD-2BCA-41C7-9C0E-1B7F606B008E
Company: Atmel

Installed Packages: GdbConsole - 7.0.188
GdbConsole
Version: 7.0.188
Package GUID: 49258291-0FED-4501-881B-6BAA91BEBCA8
Company: Atmel

Installed Packages: Atmel Kits - 7.0.122
Atmel Kits
Version: 7.0.122
Package GUID: 6F4B8FE4-C464-4916-8B43-AC92431C1CDF
Company: Atmel

Installed Packages: AtmelToolchainProvider - 7.0.895
AtmelToolchainProvider
Version: 7.0.895
Package GUID: AtmelToolchainProvider.Atmel.10EF9C74-D8DA-4872-85F5-D8BB3101E245
Company: Atmel

Installed Packages: Data Visualizer Extension - 2.18.723
Data Visualizer Extension
Version: 2.18.723
Package GUID: 25dc067d-df31-4e22-be7f-cc6a77ccc7f3
Company: Atmel

Installed Packages: Microchip Gallery - 8.1.0
Microchip Gallery
Version: 8.1.0
Package GUID: AtmelStudio7ExtensionManager
Company: Microchip

Installed Packages: Visual Assist for Atmel Studio - 10.9.2093.2
Visual Assist for Atmel Studio
Version: 10.9.2093.2
Package GUID: 7997A33C-B154-4b75-B2AC658CD58C9510
Company: Whole Tomato Software

 

Thanks

Jim 

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Tue. Feb 23, 2021 - 12:24 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you have .h files that are not explicitly added to the project/solution?  This can easily happen with .c files that are created with an external editor, but of course then AS doesn't compile them and the build fails, so it's relatively obvious.   If you have .h files that are in "appropriate places", but not "added to project" (or whatever) I bet the compiler still finds them fine, but the IDE search functions don't know to look at them.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All of the .c and .h files are in the same directory (which happens to be a DropBox directory). None of the .h files are "added"; that is done by #include statements. I have been under the long-held assumption that you never "add" header files. Am I wrong?

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
... but the IDE search functions don't know to look at them.

Project Directories (Whole Tomato Software)

[1/3 page]

Proper Configuration of C/C++ Directories

...

... find no header files at all, ...

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That may be IT!

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Results 1, Entire Solution, "*.c; *.h"
.
You're searching amongst files in the solution... If the .h is not in the solution, it won't be searched. Either add the files to the solution, or change the Look In to a path and do a recursive file search...

:: Morten

 

(yes, I work for Microchip, yes, I do this in my spare time, now stop sending PMs)

 

The postings on this site are my own and do not represent Microchip’s positions, strategies, or opinions.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How do you make header files "part of the solution"? I get all kinds of multiple definitions even after removing endless #include statements. Is this not insanity?

 

OK, back to a shared drive and TextWrangler, I guess. What ever!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Tue. Feb 23, 2021 - 06:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

You hear a wumpus.  S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


meolsen wrote:
change the Look In to a path and do a recursive file search...

 

 When you put a directory path in the 'Look in' box, you then get an 'Include sub-folders' option:

 

 

You can type or paste into the 'Look in' box, or use the  button to browse

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ka7ehk wrote:
How do you make header files "part of the solution"?

You just add them - exactly as for 'C' files.

 

AS should recognise .h as something not to be compiled

 

ka7ehk wrote:
after removing endless #include statements

Why would you do that?

 

You still need the #includes for the compiler to do the #including.

 

Adding headers to the project does not affect the compiler at all - it purely for your access via the GUI.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

 

 

ka7ehk wrote:
How do you make header files "part of the solution"?

Just use...

 

 

and then select all the .h in the file selector:

 

 

so you end up with:

 

 

Although they are now listed in the project/solution it does not imply that they are actually part of the build. It could be that main.c only #include's main.h and adc.h and that spi.h and timer.h are unused but they will still now be searched when you ctrl-shift-F and search "Solution".

 

Now one thing that didn't make the transition from VS2015 to MCS7 is the concept of "filters". In VS you can "organize" things much better:

 

 

(that may look very like MCS7 but it is VS2017 in fact). Here "Header Files" and "Source Files" are not really sub-directories on disk but are simply "Virtual folders" so you can make a tidy grouping of related items.

 

In MCS7 you can do this:

 

 

but this really does create a physical folder on disk. So if I use this and call a new folder "Include" or "Headers" or something then in my project directory on disk it really will create a sub-directory called "Include" or "Headers" or whatever I choose. But if you have 30 odd headers I think I might suggest doing this anyway. Then move all the .h files into it. Then in the Project here use "add existing item(s)" to then add all the files it contains (simply so they can be searched). But they'll be neatly grouped together away from the .c and .cpp files.

 

Of course if you do this you will need to add "Headers"/"Include"/whatever to "Directories" in the project setup so the preprocessor knows where the .h files have moved to.

 

Talking of VS2015/VS0217, I lose track but I think it was between VS2015 and VS2017 that Microsoft added this:

 

 

so in that you not only have "Entire Solution" now but also "Entire Solution (including External Items)" which basically means it will also search in all the Dependencies (that is "headers found while processing #include's") in the build. In which case you don't actually need to have added all the .h files to the solution. Sadly MCS7 doesn't have anything like this (and presumably never will now).

 

EDIT: sorry, I am wrong. MCS7 *does* have:

 

 

in which case you should be able to use this. (but as "Dependencies" is not created until you have a successful build you may need to do that first). Let me run an experiment...

 

EDIT: OK so that does not look like it actually works?!? I changed things so:

 

I removed the .h files from the project but then made sure that main.c includes adc.h and spi.h (each of which are just a single #define in fact). When I build successfully the Dependencies are generated as expected:

 

And yet when I do a search for "#define" in "Entire solution (including external items)" it does not find the #define's in adc.h and spi.h. Which is a bit sad :-(

 

Actually I just noticed that it says:

 Matching lines: 14    Matching files: 1    Total files searched: 3

So it only search 3 files ?!? I know stdlib.h is one of them. 

 

Oh I see, perhaps I misunderstand "external" it means "items not in the project directory tree" I think . In which case if I put the headers somewhere completely separate on disk it should find things in them. Let me try that...

 

EDIT again : OK so not that. Perhaps forget searching "Entire Solution (including external items)" then as it seems tricky to pin down what it actually means by "external item" !

Last Edited: Tue. Feb 23, 2021 - 09:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
You can type or paste into the 'Look in' box, or use the  button to browse

Now that's what I'd call a UI Design screw-up. It exists in VS2017 also, I would consider typing an entry into what looks like a ComboBox.

 

Not that I've ever needed to do that - but nice to know that I can.

 

Last Edited: Tue. Feb 23, 2021 - 04:22 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cliff's failure to find items in header files exactly what I ran into, I think. Just what are "external items"?

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

so in that you not only have "Entire Solution" now but also "Entire Solution (including External Items)" 

I wonder where it ends....maybe   "Entire Solution (including External Items) & including your other PC surprise   

 

This exact same issue had me scratching my head a while back---the "virtual folders"/groupings weren't apparent, until I used file explorer to see what was stored where (and maybe even file explore "lies"??). 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In my system, the .c and .h files are all in a single folder, along with some project files and a "debug" folder as shown by FileExplorer. The parent folder (up a couple of levels) happens to be a folder maintained by DropBox.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim, as noted above the solution (oops!) is simple. Just add the .h files to the project.