For the include file guards, I'd suggest either looking at the
Stationary or Clippings features. Both should easily do what you want
to varying degrees.

- Steve

On Tue, Jan 28, 2020 at 12:45 PM Sam Hathaway <[email protected]> wrote:
>
> There are two tasks I end up doing manually in C a lot and I’d like to not.
>
> Thing one: putting guards around header files.
>
> Any module.h should start with:
>
> #ifndef MODULE_H
> #define MODULE_H
>
> and end with:
>
> #endif /* !MODULE_H */
>
> I usually get a few minutes into writing the header file and then remember 
> that I need have an include guard. I’d like to be able to hit a key or select 
> a menu item in order to add it. The name of the guard should be derived from 
> the file name.
>
> Thing two: maintaining function prototypes in header files.
>
> Given a file.c, prototypes for all non-static functions should exist in the 
> counterpart file.h.
>
> So given file.c:
>
> void file_init(int a, int b)
> {
>     /* stuff here */
> }
>
> static void helper(void)
> {
>     /* more stuff */
> }
>
> void file_scan(int a, int c)
> {
>     /* and again */
> }
>
> The corresponding file.h should look contain:
>
> void file_init(int a, int b);
> void file_scan(int a, int c);
>
> Again, I’d like to, from a C source file, hit a key or select a menu item to 
> add prototypes in the corresponding C header file. Bonus points if the 
> command creates the header file if it doesn’t exist yet, and adds the 
> appropriate include guard. More bonus points if it can update existing 
> prototypes if I change the return type or parameter list.
>
> Does that all make sense?
>
> I imagine AppleScript would be involved.
>
> Don’t feel like you have to write this for me, but if you already have tools 
> to do this (or part of this) please point me in their direction.
>
> Thanks for any ideas!
> -sam
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> rather than posting here. Follow @bbedit on Twitter: 
> <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/75A92463-3871-4AD6-8546-F8DEFF1DCA2B%40munkynet.org.

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CALLGbRJ%2BjgSta3xk%3DwcAZW8McZS6QYEH-u29TKc3ToXKxTQmAw%40mail.gmail.com.

Reply via email to