LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   uncrustify/mystyle.cfg Can I add functions to Uncrustify (https://www.linuxquestions.org/questions/linux-general-1/uncrustify-mystyle-cfg-can-i-add-functions-to-uncrustify-4175602883/)

MrUmunhum 03-30-2017 07:37 PM

uncrustify/mystyle.cfg Can I add functions to Uncrustify
 
Hi group,
I need a way to add function to Uncrustify. Specifically, I wish to make him change "if (" to "if( " as well as while, for, etc. I would also like to make the closing brace on the last line of a group, not on a newline.
The config file for Uncrustify is daunting.

I know this is not an accepted style but it is what I need to be able to read my code. I AM DYSLEXIC! Trolls need not reply!

Thanks for your time and your replies.

norobro 03-31-2017 11:25 AM

You might try this config file instead of the default: https://github.com/uncrustify/uncrus...cs/ben.cfg.txt

For example, to remove the space in "if (" change "force" on line 61 to "remove":
Code:

sp_before_sparen                = remove                # "if (" vs "if("

MrUmunhum 04-01-2017 02:43 PM

Quote:

Originally Posted by norobro (Post 5690887)
You might try this config file instead of the default: https://github.com/uncrustify/uncrus...cs/ben.cfg.txt

For example, to remove the space in "if (" change "force" on line 61 to "remove":
Code:

sp_before_sparen                = remove                # "if (" vs "if("

Thanks for your post bit iy fails here:
Code:

uncrustify --version
uncrustify 0.64.517-g91f2ff0

uncrustify -c ben.cfg.txt -o test.unc
ben.cfg.txt:98 Unknown symbol 'align_var_def_star'

Then hangs, needed C-c to recover.

MrUmunhum 04-01-2017 03:53 PM

So I found a config file that gives me the Lisp style I want except for one little thing, I want this:
Code:

  if( ( Term = initscr() ) == NULL)  {
    fprintf( stderr, "Initscr error initializing ncurses.\n" );
    exit( EXIT_FAILURE );  }

and I get this:
Code:

  if( ( Term = initscr() ) == NULL)  {
      fprintf( stderr, "Initscr error initializing ncurses.\n" );
      exit( EXIT_FAILURE );
      }

Anyone know the magic word I need to change?


All times are GMT -5. The time now is 02:18 AM.