uncrustify-0.59/0000755000175000017500000000000011642741501010664 500000000000000uncrustify-0.59/make_token_names.sh0000755000175000017500000000114211506773274014454 00000000000000#! /bin/sh # # Scans src/token_enum.h and creates token_names.h # infile="token_enum.h" outfile="token_names.h" if [ -d src ] ; then infile="src/"${infile} outfile="src/"${outfile} fi cat > $outfile <> $outfile cat >> $outfile <, 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: uncrustify-0.59/src/0000755000175000017500000000000011642741502011454 500000000000000uncrustify-0.59/src/semicolons.cpp0000644000175000017500000000636511630457175014274 00000000000000/** * @file semicolons.cpp * Removes extra semicolons * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "ChunkStack.h" #include "prototypes.h" #include #include #include #include #include "unc_ctype.h" #include static void check_unknown_brace_close(chunk_t *semi, chunk_t *brace_close); static void remove_semicolon(chunk_t *pc) { LOG_FMT(LDELSEMI, "%s: Removed semicolon at line %d, col %d\n", __func__, pc->orig_line, pc->orig_col); /* TODO: do we want to shift stuff back a column? */ chunk_del(pc); } /** * Removes superfluous semicolons: * - after brace close whose parent is IF, ELSE, SWITCH, WHILE, FOR * - after another semicolon where parent is not FOR * - (D) after brace close whose parent is ENUM/STRUCT/UNION * - after an open brace */ void remove_extra_semicolons(void) { chunk_t *pc; chunk_t *next; chunk_t *prev; pc = chunk_get_head(); while (pc != NULL) { next = chunk_get_next_ncnl(pc); if ((pc->type == CT_SEMICOLON) && ((prev = chunk_get_prev_ncnl(pc)) != NULL)) { LOG_FMT(LSCANSEMI, "Semi on %d:%d, prev = '%s' [%s/%s]\n", pc->orig_line, pc->orig_col, prev->str.c_str(), get_token_name(prev->type), get_token_name(prev->parent_type)); if ((prev->type == CT_BRACE_CLOSE) && ((prev->parent_type == CT_IF) || (prev->parent_type == CT_ELSEIF) || (prev->parent_type == CT_ELSE) || (prev->parent_type == CT_SWITCH) || (prev->parent_type == CT_WHILE) || (prev->parent_type == CT_USING_STMT) || (prev->parent_type == CT_FOR) || (prev->parent_type == CT_FUNC_DEF) || (prev->parent_type == CT_OC_MSG_DECL) || (prev->parent_type == CT_FUNC_CLASS))) { remove_semicolon(pc); } else if ((prev->type == CT_BRACE_CLOSE) && (prev->parent_type == CT_NONE)) { check_unknown_brace_close(pc, prev); } else if ((prev->type == CT_SEMICOLON) && (prev->parent_type != CT_FOR)) { remove_semicolon(pc); } else if ((cpd.lang_flags & LANG_D) && ((prev->parent_type == CT_ENUM) || (prev->parent_type == CT_UNION) || (prev->parent_type == CT_STRUCT))) { remove_semicolon(pc); } else if (prev->type == CT_BRACE_OPEN) { remove_semicolon(pc); } } pc = next; } } /** * We are on a semicolon that is after an unidentified brace close. * Check for what is before the brace open. * Do not remove if it is a square close, word or type. */ static void check_unknown_brace_close(chunk_t *semi, chunk_t *brace_close) { chunk_t *pc; pc = chunk_get_prev_type(brace_close, CT_BRACE_OPEN, brace_close->level); pc = chunk_get_prev_ncnl(pc); if ((pc != NULL) && (pc->type != CT_WORD) && (pc->type != CT_TYPE) && (pc->type != CT_SQUARE_CLOSE) && (pc->type != CT_TSQUARE)) { remove_semicolon(semi); } } uncrustify-0.59/src/logmask.h0000644000175000017500000000321011614421167013177 00000000000000/** * @file logmask.h * * Functions to manipulate a log severity mask. * * @author Ben Gardner * @license GPL v2+ */ #ifndef LOGMASK_H_INCLUDED #define LOGMASK_H_INCLUDED #include "base_types.h" #include /* memset() */ #include typedef UINT8 log_sev_t; /** A simple array of 256 bits */ typedef std::bitset<256> log_mask_t; /** * Tests whether a sev bit is set in the mask * * @param sev The severity to check * @return true (is set) or false (not set) */ static_inline bool logmask_test(const log_mask_t& mask, log_sev_t sev) { return(mask.test(sev)); } /** * Sets a set bit in the mask * * @param sev The severity to check * @param value true (set bit) or false (clear bit) */ static_inline void logmask_set_sev(log_mask_t& mask, log_sev_t sev, bool value) { mask.set(sev, value); } /** * Sets all bits to the same value * * @param value true (set bit) or false (clear bit) */ static_inline void logmask_set_all(log_mask_t& mask, bool value) { if (value) { mask.set(); } else { mask.reset(); } } /** * Convert a logmask into a string. * The string is a comma-delimited list of severities. * Example: 1,3,5-10 * * @param mask the mask to convert * @param buf the buffer to hold the string * @param size the size of the buffer * @return buf (pass through) */ char *logmask_to_str(const log_mask_t& mask, char *buf, int size); /** * Parses a string into a log severity * * @param str The string to parse * @param mask The mask to populate */ void logmask_from_string(const char *str, log_mask_t& mask); #endif /* LOGMASK_H_INCLUDED */ uncrustify-0.59/src/space.cpp0000644000175000017500000013525311631562113013201 00000000000000/** * @file space.cpp * Adds or removes inter-chunk spaces. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" #include "char_table.h" #include #include #include #include #include "unc_ctype.h" static argval_t do_space(chunk_t *first, chunk_t *second, int& min_sp, bool complete); struct no_space_table_s { c_token_t first; c_token_t second; }; /** this table lists out all combos where a space should NOT be present * CT_UNKNOWN is a wildcard. * * TODO: some of these are no longer needed. */ struct no_space_table_s no_space_table[] = { { CT_INCDEC_BEFORE, CT_WORD }, { CT_UNKNOWN, CT_INCDEC_AFTER }, { CT_UNKNOWN, CT_LABEL_COLON }, { CT_UNKNOWN, CT_PRIVATE_COLON }, { CT_UNKNOWN, CT_SEMICOLON }, { CT_UNKNOWN, CT_D_TEMPLATE }, { CT_D_TEMPLATE, CT_UNKNOWN }, { CT_MACRO_FUNC, CT_FPAREN_OPEN }, { CT_PAREN_OPEN, CT_UNKNOWN }, { CT_UNKNOWN, CT_PAREN_CLOSE }, { CT_FPAREN_OPEN, CT_UNKNOWN }, { CT_UNKNOWN, CT_SPAREN_CLOSE }, { CT_SPAREN_OPEN, CT_UNKNOWN }, { CT_UNKNOWN, CT_FPAREN_CLOSE }, { CT_UNKNOWN, CT_COMMA }, { CT_POS, CT_UNKNOWN }, { CT_STAR, CT_UNKNOWN }, { CT_VBRACE_CLOSE, CT_UNKNOWN }, { CT_VBRACE_OPEN, CT_UNKNOWN }, { CT_UNKNOWN, CT_VBRACE_CLOSE }, { CT_UNKNOWN, CT_VBRACE_OPEN }, { CT_PREPROC, CT_UNKNOWN }, { CT_PREPROC_INDENT, CT_UNKNOWN }, { CT_NEG, CT_UNKNOWN }, { CT_UNKNOWN, CT_SQUARE_OPEN }, { CT_UNKNOWN, CT_SQUARE_CLOSE }, { CT_SQUARE_OPEN, CT_UNKNOWN }, { CT_PAREN_CLOSE, CT_WORD }, { CT_PAREN_CLOSE, CT_FUNC_DEF }, { CT_PAREN_CLOSE, CT_FUNC_CALL }, { CT_PAREN_CLOSE, CT_ADDR }, { CT_PAREN_CLOSE, CT_FPAREN_OPEN }, { CT_OC_SEL_NAME, CT_OC_SEL_NAME }, }; #define log_rule(rule) \ do { if (log_sev_on(LSPACE)) { \ log_rule2(__LINE__, (rule), first, second, complete); } \ } while (0) static void log_rule2(int line, const char *rule, chunk_t *first, chunk_t *second, bool complete) { if (second->type != CT_NEWLINE) { LOG_FMT(LSPACE, "Spacing: line %d [%s/%s] '%s' <===> [%s/%s] '%s' : %s[%d]%s", first->orig_line, get_token_name(first->type), get_token_name(first->parent_type), first->str.c_str(), get_token_name(second->type), get_token_name(second->parent_type), second->str.c_str(), rule, line, complete ? "\n" : ""); } } /** * Decides how to change inter-chunk spacing. * Note that the order of the if statements is VERY important. * * @param first The first chunk * @param second The second chunk * @return AV_IGNORE, AV_ADD, AV_REMOVE or AV_FORCE */ static argval_t do_space(chunk_t *first, chunk_t *second, int& min_sp, bool complete = true) { int idx; argval_t arg; chunk_t *next; min_sp = 1; if ((first->type == CT_IGNORED) || (second->type == CT_IGNORED)) { log_rule("IGNORED"); return(AV_REMOVE); } if ((first->type == CT_PP) || (second->type == CT_PP)) { log_rule("sp_pp_concat"); return(cpd.settings[UO_sp_pp_concat].a); } if (first->type == CT_POUND) { log_rule("sp_pp_stringify"); return(cpd.settings[UO_sp_pp_stringify].a); } if ((first->type == CT_SPACE) || (second->type == CT_SPACE)) { log_rule("REMOVE"); return(AV_REMOVE); } if ((second->type == CT_NEWLINE) || (second->type == CT_VBRACE_OPEN)) { log_rule("REMOVE"); return(AV_REMOVE); } if ((first->type == CT_VBRACE_OPEN) && (second->type != CT_NL_CONT)) { log_rule("ADD"); return(AV_ADD); } if ((first->type == CT_VBRACE_CLOSE) && (second->type != CT_NL_CONT)) { log_rule("REMOVE"); return(AV_REMOVE); } if (second->type == CT_VSEMICOLON) { log_rule("REMOVE"); return(AV_REMOVE); } if (first->type == CT_MACRO_FUNC) { log_rule("REMOVE"); return(AV_REMOVE); } if (second->type == CT_NL_CONT) { log_rule("sp_before_nl_cont"); return(cpd.settings[UO_sp_before_nl_cont].a); } if ((first->type == CT_D_ARRAY_COLON) || (second->type == CT_D_ARRAY_COLON)) { log_rule("sp_d_array_colon"); return(cpd.settings[UO_sp_d_array_colon].a); } if ((first->type == CT_CASE) && CharTable::IsKw1(second->str[0])) { log_rule("sp_case_label"); return(argval_t(cpd.settings[UO_sp_case_label].a | AV_ADD)); } if ((first->type == CT_QUESTION) || (second->type == CT_QUESTION)) { if (cpd.settings[UO_sp_cond_question].a != AV_IGNORE) { return(cpd.settings[UO_sp_cond_question].a); } } if ((first->type == CT_COND_COLON) || (second->type == CT_COND_COLON)) { if (cpd.settings[UO_sp_cond_colon].a != AV_IGNORE) { return(cpd.settings[UO_sp_cond_colon].a); } } if ((first->type == CT_RANGE) || (second->type == CT_RANGE)) { return(cpd.settings[UO_sp_range].a); } if ((first->type == CT_COLON) && (first->parent_type == CT_SQL_EXEC)) { log_rule("REMOVE"); return(AV_REMOVE); } /* Macro stuff can only return IGNORE, ADD, or FORCE */ if (first->type == CT_MACRO) { log_rule("sp_macro"); arg = cpd.settings[UO_sp_macro].a; return((argval_t)(arg | ((arg != AV_IGNORE) ? AV_ADD : AV_IGNORE))); } if ((first->type == CT_FPAREN_CLOSE) && (first->parent_type == CT_MACRO_FUNC)) { log_rule("sp_macro_func"); arg = cpd.settings[UO_sp_macro_func].a; return((argval_t)(arg | ((arg != AV_IGNORE) ? AV_ADD : AV_IGNORE))); } if (first->type == CT_PREPROC) { /* Remove spaces, unless we are ignoring. See indent_preproc() */ if (cpd.settings[UO_pp_space].a == AV_IGNORE) { log_rule("IGNORE"); return(AV_IGNORE); } log_rule("REMOVE"); return(AV_REMOVE); } if (second->type == CT_SEMICOLON) { if (second->parent_type == CT_FOR) { if ((cpd.settings[UO_sp_before_semi_for_empty].a != AV_IGNORE) && ((first->type == CT_SPAREN_OPEN) || (first->type == CT_SEMICOLON))) { log_rule("sp_before_semi_for_empty"); return(cpd.settings[UO_sp_before_semi_for_empty].a); } if (cpd.settings[UO_sp_before_semi_for].a != AV_IGNORE) { log_rule("sp_before_semi_for"); return(cpd.settings[UO_sp_before_semi_for].a); } } arg = cpd.settings[UO_sp_before_semi].a; log_rule("sp_before_semi"); if ((first->type == CT_SPAREN_CLOSE) && (first->parent_type != CT_WHILE_OF_DO)) { log_rule("sp_special_semi"); arg = (argval_t)(arg | cpd.settings[UO_sp_special_semi].a); } return(arg); } if ((second->type == CT_COMMENT) && ((first->type == CT_PP_ELSE) || (first->type == CT_PP_ENDIF))) { if (cpd.settings[UO_sp_endif_cmt].a != AV_IGNORE) { second->type = CT_COMMENT_ENDIF; log_rule("sp_endif_cmt"); return(cpd.settings[UO_sp_endif_cmt].a); } } if ((cpd.settings[UO_sp_before_tr_emb_cmt].a != AV_IGNORE) && ((second->parent_type == CT_COMMENT_END) || (second->parent_type == CT_COMMENT_EMBED))) { log_rule("sp_before_tr_emb_cmt"); min_sp = cpd.settings[UO_sp_num_before_tr_emb_cmt].n; return(cpd.settings[UO_sp_before_tr_emb_cmt].a); } /* "for (;;)" vs "for (;; )" and "for (a;b;c)" vs "for (a; b; c)" */ if (first->type == CT_SEMICOLON) { if (first->parent_type == CT_FOR) { if ((cpd.settings[UO_sp_after_semi_for_empty].a != AV_IGNORE) && (second->type == CT_SPAREN_CLOSE)) { log_rule("sp_after_semi_for_empty"); return(cpd.settings[UO_sp_after_semi_for_empty].a); } if (cpd.settings[UO_sp_after_semi_for].a != AV_IGNORE) { log_rule("sp_after_semi_for"); return(cpd.settings[UO_sp_after_semi_for].a); } } else if (!chunk_is_comment(second)) { log_rule("sp_after_semi"); return(cpd.settings[UO_sp_after_semi].a); } /* Let the comment spacing rules handle this */ } if (((first->type == CT_NEG) || (first->type == CT_POS) || (first->type == CT_ARITH)) && ((second->type == CT_NEG) || (second->type == CT_POS) || (second->type == CT_ARITH))) { log_rule("ADD"); return(AV_ADD); } /* "return(a);" vs "return (foo_t)a + 3;" vs "return a;" vs "return;" */ if (first->type == CT_RETURN) { if ((second->type == CT_PAREN_OPEN) && (second->parent_type == CT_RETURN)) { log_rule("sp_return_paren"); return(cpd.settings[UO_sp_return_paren].a); } /* everything else requires a space */ log_rule("FORCE"); return(AV_FORCE); } /* "sizeof(foo_t)" vs "sizeof foo_t" */ if (first->type == CT_SIZEOF) { if (second->type == CT_PAREN_OPEN) { log_rule("sp_sizeof_paren"); return(cpd.settings[UO_sp_sizeof_paren].a); } log_rule("FORCE"); return(AV_FORCE); } /* handle '::' */ if (first->type == CT_DC_MEMBER) { log_rule("sp_after_dc"); return(cpd.settings[UO_sp_after_dc].a); } if ((second->type == CT_DC_MEMBER) && ((first->type == CT_WORD) || (first->type == CT_TYPE) || CharTable::IsKw1(first->str[0]))) { log_rule("sp_before_dc"); return(cpd.settings[UO_sp_before_dc].a); } /* "a,b" vs "a, b" */ if (first->type == CT_COMMA) { log_rule("sp_after_comma"); return(cpd.settings[UO_sp_after_comma].a); } if (second->type == CT_COMMA) { if ((first->type == CT_PAREN_OPEN) && (cpd.settings[UO_sp_paren_comma].a != AV_IGNORE)) { log_rule("sp_paren_comma"); return(cpd.settings[UO_sp_paren_comma].a); } log_rule("sp_before_comma"); return(cpd.settings[UO_sp_before_comma].a); } if (second->type == CT_ELLIPSIS) { /* non-punc followed by a ellipsis */ if (((first->flags & PCF_PUNCTUATOR) == 0) && (cpd.settings[UO_sp_before_ellipsis].a != AV_IGNORE)) { log_rule("sp_before_ellipsis"); return(cpd.settings[UO_sp_before_ellipsis].a); } if (first->type == CT_TAG_COLON) { log_rule("FORCE"); return(AV_FORCE); } } if ((first->type == CT_ELLIPSIS) && CharTable::IsKw1(second->str[0])) { log_rule("FORCE"); return(AV_FORCE); } if (first->type == CT_TAG_COLON) { log_rule("sp_after_tag"); return(cpd.settings[UO_sp_after_tag].a); } if (second->type == CT_TAG_COLON) { log_rule("REMOVE"); return(AV_REMOVE); } /* handle '~' */ if (first->type == CT_DESTRUCTOR) { log_rule("REMOVE"); return(AV_REMOVE); } /* "((" vs "( (" */ if ((chunk_is_str(first, "(", 1) && chunk_is_str(second, "(", 1)) || (chunk_is_str(first, ")", 1) && chunk_is_str(second, ")", 1))) { log_rule("sp_paren_paren"); return(cpd.settings[UO_sp_paren_paren].a); } if ((first->type == CT_CATCH) && (second->type == CT_SPAREN_OPEN) && (cpd.settings[UO_sp_catch_paren].a != AV_IGNORE)) { log_rule("sp_catch_paren"); return(cpd.settings[UO_sp_catch_paren].a); } if ((first->type == CT_D_VERSION_IF) && (second->type == CT_SPAREN_OPEN) && (cpd.settings[UO_sp_version_paren].a != AV_IGNORE)) { log_rule("sp_version_paren"); return(cpd.settings[UO_sp_version_paren].a); } if ((first->type == CT_D_SCOPE_IF) && (second->type == CT_SPAREN_OPEN) && (cpd.settings[UO_sp_scope_paren].a != AV_IGNORE)) { log_rule("sp_scope_paren"); return(cpd.settings[UO_sp_scope_paren].a); } /* "if (" vs "if(" */ if (second->type == CT_SPAREN_OPEN) { log_rule("sp_before_sparen"); return(cpd.settings[UO_sp_before_sparen].a); } if ((first->type == CT_LAMBDA) || (second->type == CT_LAMBDA)) { log_rule("sp_assign (lambda)"); return(cpd.settings[UO_sp_assign].a); } if (second->type == CT_OC_BLOCK_CARET) { log_rule("sp_before_oc_block_caret"); return(cpd.settings[UO_sp_before_oc_block_caret].a); } if (first->type == CT_OC_BLOCK_CARET) { log_rule("sp_after_oc_block_caret"); return(cpd.settings[UO_sp_after_oc_block_caret].a); } if (second->type == CT_ASSIGN) { if (second->flags & PCF_IN_ENUM) { if (cpd.settings[UO_sp_enum_before_assign].a != AV_IGNORE) { log_rule("sp_enum_before_assign"); return(cpd.settings[UO_sp_enum_before_assign].a); } log_rule("sp_enum_assign"); return(cpd.settings[UO_sp_enum_assign].a); } if ((cpd.settings[UO_sp_assign_default].a != AV_IGNORE) && (second->parent_type == CT_FUNC_PROTO)) { log_rule("sp_assign_default"); return(cpd.settings[UO_sp_assign_default].a); } if (cpd.settings[UO_sp_before_assign].a != AV_IGNORE) { log_rule("sp_before_assign"); return(cpd.settings[UO_sp_before_assign].a); } log_rule("sp_assign"); return(cpd.settings[UO_sp_assign].a); } if (first->type == CT_ASSIGN) { if (first->flags & PCF_IN_ENUM) { if (cpd.settings[UO_sp_enum_after_assign].a != AV_IGNORE) { log_rule("sp_enum_after_assign"); return(cpd.settings[UO_sp_enum_after_assign].a); } log_rule("sp_enum_assign"); return(cpd.settings[UO_sp_enum_assign].a); } if ((cpd.settings[UO_sp_assign_default].a != AV_IGNORE) && (first->parent_type == CT_FUNC_PROTO)) { log_rule("sp_assign_default"); return(cpd.settings[UO_sp_assign_default].a); } if (cpd.settings[UO_sp_after_assign].a != AV_IGNORE) { log_rule("sp_after_assign"); return(cpd.settings[UO_sp_after_assign].a); } log_rule("sp_assign"); return(cpd.settings[UO_sp_assign].a); } /* "a [x]" vs "a[x]" */ if ((second->type == CT_SQUARE_OPEN) && (second->parent_type != CT_OC_MSG)) { log_rule("sp_before_square"); return(cpd.settings[UO_sp_before_square].a); } /* "byte[]" vs "byte []" */ if (second->type == CT_TSQUARE) { log_rule("sp_before_squares"); return(cpd.settings[UO_sp_before_squares].a); } if ((cpd.settings[UO_sp_angle_shift].a != AV_IGNORE) && (first->type == CT_ANGLE_CLOSE) && (second->type == CT_ANGLE_CLOSE)) { log_rule("sp_angle_shift"); return(cpd.settings[UO_sp_angle_shift].a); } /* spacing around template < > stuff */ if ((first->type == CT_ANGLE_OPEN) || (second->type == CT_ANGLE_CLOSE)) { log_rule("sp_inside_angle"); return(cpd.settings[UO_sp_inside_angle].a); } if (second->type == CT_ANGLE_OPEN) { if ((first->type == CT_TEMPLATE) && (cpd.settings[UO_sp_template_angle].a != AV_IGNORE)) { log_rule("sp_template_angle"); return(cpd.settings[UO_sp_template_angle].a); } log_rule("sp_before_angle"); return(cpd.settings[UO_sp_before_angle].a); } if (first->type == CT_ANGLE_CLOSE) { if ((second->type == CT_WORD) || CharTable::IsKw1(second->str[0])) { if (cpd.settings[UO_sp_angle_word].a != AV_IGNORE) { log_rule("sp_angle_word"); return(cpd.settings[UO_sp_angle_word].a); } } if ((second->type == CT_FPAREN_OPEN) || (second->type == CT_PAREN_OPEN)) { log_rule("sp_angle_paren"); return(cpd.settings[UO_sp_angle_paren].a); } if (second->type == CT_DC_MEMBER) { log_rule("sp_before_dc"); return(cpd.settings[UO_sp_before_dc].a); } if ((second->type != CT_BYREF) && (second->type != CT_PTR_TYPE)) { log_rule("sp_after_angle"); return(cpd.settings[UO_sp_after_angle].a); } } if ((first->type == CT_BYREF) && (cpd.settings[UO_sp_after_byref_func].a != AV_IGNORE) && ((first->parent_type == CT_FUNC_DEF) || (first->parent_type == CT_FUNC_PROTO))) { log_rule("sp_after_byref_func"); return(cpd.settings[UO_sp_after_byref_func].a); } if ((first->type == CT_BYREF) && CharTable::IsKw1(second->str[0])) { log_rule("sp_after_byref"); return(cpd.settings[UO_sp_after_byref].a); } if (second->type == CT_BYREF) { if (cpd.settings[UO_sp_before_byref_func].a != AV_IGNORE) { next = chunk_get_next(second); if ((next != NULL) && ((next->type == CT_FUNC_DEF) || (next->type == CT_FUNC_PROTO))) { return(cpd.settings[UO_sp_before_byref_func].a); } } if (cpd.settings[UO_sp_before_unnamed_byref].a != AV_IGNORE) { next = chunk_get_next_nc(second); if ((next != NULL) && (next->type != CT_WORD)) { log_rule("sp_before_unnamed_byref"); return(cpd.settings[UO_sp_before_unnamed_byref].a); } } log_rule("sp_before_byref"); return(cpd.settings[UO_sp_before_byref].a); } if (first->type == CT_SPAREN_CLOSE) { if ((second->type == CT_BRACE_OPEN) && (cpd.settings[UO_sp_sparen_brace].a != AV_IGNORE)) { log_rule("sp_sparen_brace"); return(cpd.settings[UO_sp_sparen_brace].a); } if (!chunk_is_comment(second) && (cpd.settings[UO_sp_after_sparen].a != AV_IGNORE)) { log_rule("sp_after_sparen"); return(cpd.settings[UO_sp_after_sparen].a); } } if ((second->type == CT_FPAREN_OPEN) && (first->parent_type == CT_OPERATOR) && (cpd.settings[UO_sp_after_operator_sym].a != AV_IGNORE)) { log_rule("sp_after_operator_sym"); return(cpd.settings[UO_sp_after_operator_sym].a); } /* spaces between function and open paren */ if ((first->type == CT_FUNC_CALL) || (first->type == CT_FUNC_CTOR_VAR)) { if ((cpd.settings[UO_sp_func_call_paren_empty].a != AV_IGNORE) && (second->type == CT_FPAREN_OPEN)) { next = chunk_get_next_ncnl(second); if (next && (next->type == CT_FPAREN_CLOSE)) { log_rule("sp_func_call_paren_empty"); return(cpd.settings[UO_sp_func_call_paren_empty].a); } } log_rule("sp_func_call_paren"); return(cpd.settings[UO_sp_func_call_paren].a); } if (first->type == CT_FUNC_CALL_USER) { log_rule("sp_func_call_user_paren"); return(cpd.settings[UO_sp_func_call_user_paren].a); } if (first->type == CT_ATTRIBUTE) { log_rule("sp_attribute_paren"); return(cpd.settings[UO_sp_attribute_paren].a); } if (first->type == CT_FUNC_DEF) { log_rule("sp_func_def_paren"); return(cpd.settings[UO_sp_func_def_paren].a); } if ((first->type == CT_CPP_CAST) || (first->type == CT_TYPE_WRAP)) { log_rule("sp_cpp_cast_paren"); return(cpd.settings[UO_sp_cpp_cast_paren].a); } if ((first->type == CT_PAREN_CLOSE) && ((second->type == CT_PAREN_OPEN) || (second->type == CT_FPAREN_OPEN))) { /* "(int)a" vs "(int) a" or "cast(int)a" vs "cast(int) a" */ if ((first->parent_type == CT_C_CAST) || (first->parent_type == CT_D_CAST)) { log_rule("sp_after_cast"); return(cpd.settings[UO_sp_after_cast].a); } /* Must be an indirect/chained function call? */ log_rule("REMOVE"); return(AV_REMOVE); /* TODO: make this configurable? */ } if ((first->type == CT_FUNC_PROTO) || ((second->type == CT_FPAREN_OPEN) && (second->parent_type == CT_FUNC_PROTO))) { log_rule("sp_func_proto_paren"); return(cpd.settings[UO_sp_func_proto_paren].a); } if (first->type == CT_FUNC_CLASS) { log_rule("sp_func_class_paren"); return(cpd.settings[UO_sp_func_class_paren].a); } if ((first->type == CT_CLASS) && !(first->flags & PCF_IN_OC_MSG)) { log_rule("FORCE"); return(AV_FORCE); } if ((first->type == CT_BRACE_OPEN) && (second->type == CT_BRACE_CLOSE)) { log_rule("sp_inside_braces_empty"); return(cpd.settings[UO_sp_inside_braces_empty].a); } if (second->type == CT_BRACE_CLOSE) { if (second->parent_type == CT_ENUM) { log_rule("sp_inside_braces_enum"); return(cpd.settings[UO_sp_inside_braces_enum].a); } if ((second->parent_type == CT_STRUCT) || (second->parent_type == CT_UNION)) { log_rule("sp_inside_braces_struct"); return(cpd.settings[UO_sp_inside_braces_struct].a); } log_rule("sp_inside_braces"); return(cpd.settings[UO_sp_inside_braces].a); } if (first->type == CT_D_CAST) { log_rule("REMOVE"); return(AV_REMOVE); } if ((first->type == CT_PP_DEFINED) && (second->type == CT_PAREN_OPEN)) { log_rule("sp_defined_paren"); return(cpd.settings[UO_sp_defined_paren].a); } if ((first->type == CT_THROW) && (second->type == CT_PAREN_OPEN)) { log_rule("sp_throw_paren"); return(cpd.settings[UO_sp_throw_paren].a); } if ((first->type == CT_THIS) && (second->type == CT_PAREN_OPEN)) { log_rule("REMOVE"); return(AV_REMOVE); } if ((first->type == CT_STATE) && (second->type == CT_PAREN_OPEN)) { log_rule("ADD"); return(AV_ADD); } if ((first->type == CT_DELEGATE) && (second->type == CT_PAREN_OPEN)) { log_rule("REMOVE"); return(AV_REMOVE); } if ((first->type == CT_MEMBER) || (second->type == CT_MEMBER)) { log_rule("sp_member"); return(cpd.settings[UO_sp_member].a); } if (first->type == CT_C99_MEMBER) { log_rule("REMOVE"); return(AV_REMOVE); } if ((first->type == CT_SUPER) && (second->type == CT_PAREN_OPEN)) { log_rule("REMOVE"); return(AV_REMOVE); } if ((first->type == CT_FPAREN_CLOSE) && (second->type == CT_BRACE_OPEN)) { log_rule("sp_fparen_brace"); return(cpd.settings[UO_sp_fparen_brace].a); } if ((first->type == CT_D_TEMPLATE) || (second->type == CT_D_TEMPLATE)) { log_rule("REMOVE"); return(AV_REMOVE); } if ((first->type == CT_ELSE) && (second->type == CT_BRACE_OPEN)) { log_rule("sp_else_brace"); return(cpd.settings[UO_sp_else_brace].a); } if ((first->type == CT_ELSE) && (second->type == CT_ELSEIF)) { log_rule("FORCE"); return(AV_FORCE); } if ((first->type == CT_CATCH) && (second->type == CT_BRACE_OPEN)) { log_rule("sp_catch_brace"); return(cpd.settings[UO_sp_catch_brace].a); } if ((first->type == CT_FINALLY) && (second->type == CT_BRACE_OPEN)) { log_rule("sp_finally_brace"); return(cpd.settings[UO_sp_finally_brace].a); } if ((first->type == CT_TRY) && (second->type == CT_BRACE_OPEN)) { log_rule("sp_try_brace"); return(cpd.settings[UO_sp_try_brace].a); } if ((first->type == CT_GETSET) && (second->type == CT_BRACE_OPEN)) { log_rule("sp_getset_brace"); return(cpd.settings[UO_sp_getset_brace].a); } if ((second->type == CT_PAREN_OPEN) && (second->parent_type == CT_INVARIANT)) { log_rule("sp_invariant_paren"); return(cpd.settings[UO_sp_invariant_paren].a); } if (first->type == CT_PAREN_CLOSE) { if (first->parent_type == CT_D_TEMPLATE) { log_rule("FORCE"); return(AV_FORCE); } if (first->parent_type == CT_INVARIANT) { log_rule("sp_after_invariant_paren"); return(cpd.settings[UO_sp_after_invariant_paren].a); } /* Arith after a cast comes first */ if (second->type == CT_ARITH) { log_rule("sp_arith"); return(cpd.settings[UO_sp_arith].a); } /* "(struct foo) {...}" vs "(struct foo){...}" */ if (second->type == CT_BRACE_OPEN) { log_rule("sp_paren_brace"); return(cpd.settings[UO_sp_paren_brace].a); } /* D-specific: "delegate(some thing) dg */ if (first->parent_type == CT_DELEGATE) { log_rule("ADD"); return(AV_ADD); } /* PAWN-specific: "state (condition) next" */ if (first->parent_type == CT_STATE) { log_rule("ADD"); return(AV_ADD); } } /* "foo(...)" vs "foo( ... )" */ if ((first->type == CT_FPAREN_OPEN) || (second->type == CT_FPAREN_CLOSE)) { if ((first->type == CT_FPAREN_OPEN) && (second->type == CT_FPAREN_CLOSE)) { log_rule("sp_inside_fparens"); return(cpd.settings[UO_sp_inside_fparens].a); } log_rule("sp_inside_fparen"); return(cpd.settings[UO_sp_inside_fparen].a); } if (first->type == CT_PAREN_CLOSE) { if (first->parent_type == CT_OC_RTYPE) { log_rule("sp_after_oc_return_type"); return(cpd.settings[UO_sp_after_oc_return_type].a); } else if ((first->parent_type == CT_OC_MSG_SPEC) || (first->parent_type == CT_OC_MSG_DECL)) { log_rule("sp_after_oc_type"); return(cpd.settings[UO_sp_after_oc_type].a); } else if ((first->parent_type == CT_OC_SEL) && (second->type != CT_SQUARE_CLOSE)) { log_rule("sp_after_oc_at_sel_parens"); return(cpd.settings[UO_sp_after_oc_at_sel_parens].a); } } if (cpd.settings[UO_sp_inside_oc_at_sel_parens].a != AV_IGNORE) { if (((first->type == CT_PAREN_OPEN) && ((first->parent_type == CT_OC_SEL) || (first->parent_type == CT_OC_PROTOCOL))) || ((second->type == CT_PAREN_CLOSE) && ((second->parent_type == CT_OC_SEL) || (second->parent_type == CT_OC_PROTOCOL)))) { log_rule("sp_inside_oc_at_sel_parens"); return(cpd.settings[UO_sp_inside_oc_at_sel_parens].a); } } if ((second->type == CT_PAREN_OPEN) && ((first->type == CT_OC_SEL) || (first->type == CT_OC_PROTOCOL))) { log_rule("sp_after_oc_at_sel"); return(cpd.settings[UO_sp_after_oc_at_sel].a); } /* C cast: "(int)" vs "( int )" * D cast: "cast(int)" vs "cast( int )" * CPP cast: "int(a + 3)" vs "int( a + 3 )" */ if (first->type == CT_PAREN_OPEN) { if ((first->parent_type == CT_C_CAST) || (first->parent_type == CT_CPP_CAST) || (first->parent_type == CT_D_CAST)) { log_rule("sp_inside_paren_cast"); return(cpd.settings[UO_sp_inside_paren_cast].a); } log_rule("sp_inside_paren"); return(cpd.settings[UO_sp_inside_paren].a); } if (second->type == CT_PAREN_CLOSE) { if ((second->parent_type == CT_C_CAST) || (second->parent_type == CT_CPP_CAST) || (second->parent_type == CT_D_CAST)) { log_rule("sp_inside_paren_cast"); return(cpd.settings[UO_sp_inside_paren_cast].a); } log_rule("sp_inside_paren"); return(cpd.settings[UO_sp_inside_paren].a); } /* "[3]" vs "[ 3 ]" */ if ((first->type == CT_SQUARE_OPEN) || (second->type == CT_SQUARE_CLOSE)) { log_rule("sp_inside_square"); return(cpd.settings[UO_sp_inside_square].a); } if ((first->type == CT_SQUARE_CLOSE) && (second->type == CT_FPAREN_OPEN)) { log_rule("sp_square_fparen"); return(cpd.settings[UO_sp_square_fparen].a); } /* "if(...)" vs "if( ... )" */ if ((second->type == CT_SPAREN_CLOSE) && (cpd.settings[UO_sp_inside_sparen_close].a != AV_IGNORE)) { log_rule("sp_inside_sparen_close"); return(cpd.settings[UO_sp_inside_sparen_close].a); } if ((first->type == CT_SPAREN_OPEN) || (second->type == CT_SPAREN_CLOSE)) { log_rule("sp_inside_sparen"); return(cpd.settings[UO_sp_inside_sparen].a); } if ((cpd.settings[UO_sp_after_class_colon].a != AV_IGNORE) && (first->type == CT_CLASS_COLON)) { log_rule("sp_after_class_colon"); return(cpd.settings[UO_sp_after_class_colon].a); } if ((cpd.settings[UO_sp_before_class_colon].a != AV_IGNORE) && (second->type == CT_CLASS_COLON)) { log_rule("sp_before_class_colon"); return(cpd.settings[UO_sp_before_class_colon].a); } if ((cpd.settings[UO_sp_before_case_colon].a != AV_IGNORE) && (second->type == CT_CASE_COLON)) { log_rule("sp_before_case_colon"); return(cpd.settings[UO_sp_before_case_colon].a); } if (first->type == CT_DOT) { log_rule("REMOVE"); return(AV_REMOVE); } if (second->type == CT_DOT) { log_rule("ADD"); return(AV_ADD); } if ((first->type == CT_ARITH) || (second->type == CT_ARITH)) { log_rule("sp_arith"); return(cpd.settings[UO_sp_arith].a); } if ((first->type == CT_BOOL) || (second->type == CT_BOOL)) { arg = cpd.settings[UO_sp_bool].a; if ((cpd.settings[UO_pos_bool].tp != TP_IGNORE) && (first->orig_line != second->orig_line) && (arg != AV_REMOVE)) { arg = (argval_t)(arg | AV_ADD); } log_rule("sp_bool"); return(arg); } if ((first->type == CT_COMPARE) || (second->type == CT_COMPARE)) { log_rule("sp_compare"); return(cpd.settings[UO_sp_compare].a); } if ((first->type == CT_PAREN_OPEN) && (second->type == CT_PTR_TYPE)) { log_rule("REMOVE"); return(AV_REMOVE); } if ((first->type == CT_PTR_TYPE) && (second->type == CT_PTR_TYPE) && (cpd.settings[UO_sp_between_ptr_star].a != AV_IGNORE)) { log_rule("sp_between_ptr_star"); return(cpd.settings[UO_sp_between_ptr_star].a); } if ((first->type == CT_PTR_TYPE) && (cpd.settings[UO_sp_after_ptr_star_func].a != AV_IGNORE) && ((first->parent_type == CT_FUNC_DEF) || (first->parent_type == CT_FUNC_PROTO))) { log_rule("sp_after_ptr_star_func"); return(cpd.settings[UO_sp_after_ptr_star_func].a); } if ((first->type == CT_PTR_TYPE) && (cpd.settings[UO_sp_after_ptr_star].a != AV_IGNORE) && CharTable::IsKw1(second->str[0])) { log_rule("sp_after_ptr_star"); return(cpd.settings[UO_sp_after_ptr_star].a); } if (second->type == CT_PTR_TYPE) { if (cpd.settings[UO_sp_before_ptr_star_func].a != AV_IGNORE) { /* Find the next non-'*' chunk */ next = second; do { next = chunk_get_next(next); } while ((next != NULL) && (next->type == CT_PTR_TYPE)); if ((next != NULL) && ((next->type == CT_FUNC_DEF) || (next->type == CT_FUNC_PROTO))) { return(cpd.settings[UO_sp_before_ptr_star_func].a); } } if (cpd.settings[UO_sp_before_unnamed_ptr_star].a != AV_IGNORE) { next = chunk_get_next_nc(second); while ((next != NULL) && (next->type == CT_PTR_TYPE)) { next = chunk_get_next_nc(next); } if ((next != NULL) && (next->type != CT_WORD)) { log_rule("sp_before_unnamed_ptr_star"); return(cpd.settings[UO_sp_before_unnamed_ptr_star].a); } } if (cpd.settings[UO_sp_before_ptr_star].a != AV_IGNORE) { log_rule("sp_before_ptr_star"); return(cpd.settings[UO_sp_before_ptr_star].a); } } if (first->type == CT_OPERATOR) { log_rule("sp_after_operator"); return(cpd.settings[UO_sp_after_operator].a); } if ((second->type == CT_FUNC_PROTO) || (second->type == CT_FUNC_DEF)) { if (first->type != CT_PTR_TYPE) { log_rule("sp_type_func|ADD"); return((argval_t)(cpd.settings[UO_sp_type_func].a | AV_ADD)); } log_rule("sp_type_func"); return(cpd.settings[UO_sp_type_func].a); } /* "(int)a" vs "(int) a" or "cast(int)a" vs "cast(int) a" */ if ((first->parent_type == CT_C_CAST) || (first->parent_type == CT_D_CAST)) { log_rule("sp_after_cast"); return(cpd.settings[UO_sp_after_cast].a); } if (first->type == CT_BRACE_CLOSE) { if (second->type == CT_ELSE) { log_rule("sp_brace_else"); return(cpd.settings[UO_sp_brace_else].a); } else if (second->type == CT_CATCH) { log_rule("sp_brace_catch"); return(cpd.settings[UO_sp_brace_catch].a); } else if (second->type == CT_FINALLY) { log_rule("sp_brace_finally"); return(cpd.settings[UO_sp_brace_finally].a); } } if (first->type == CT_BRACE_OPEN) { if (first->parent_type == CT_ENUM) { log_rule("sp_inside_braces_enum"); return(cpd.settings[UO_sp_inside_braces_enum].a); } else if ((first->parent_type == CT_UNION) || (first->parent_type == CT_STRUCT)) { log_rule("sp_inside_braces_struct"); return(cpd.settings[UO_sp_inside_braces_struct].a); } else if (!chunk_is_comment(second)) { log_rule("sp_inside_braces"); return(cpd.settings[UO_sp_inside_braces].a); } } if (second->type == CT_BRACE_CLOSE) { if (second->parent_type == CT_ENUM) { log_rule("sp_inside_braces_enum"); return(cpd.settings[UO_sp_inside_braces_enum].a); } else if ((second->parent_type == CT_UNION) || (second->parent_type == CT_STRUCT)) { log_rule("sp_inside_braces_struct"); return(cpd.settings[UO_sp_inside_braces_struct].a); } log_rule("sp_inside_braces"); return(cpd.settings[UO_sp_inside_braces].a); } if ((first->type == CT_BRACE_CLOSE) && (first->flags & PCF_IN_TYPEDEF) && ((first->parent_type == CT_ENUM) || (first->parent_type == CT_STRUCT) || (first->parent_type == CT_UNION))) { log_rule("sp_brace_typedef"); return(cpd.settings[UO_sp_brace_typedef].a); } if (second->type == CT_SPAREN_OPEN) { log_rule("sp_before_sparen"); return(cpd.settings[UO_sp_before_sparen].a); } if ((second->type != CT_PTR_TYPE) && ((first->type == CT_QUALIFIER) || (first->type == CT_TYPE))) { arg = cpd.settings[UO_sp_after_type].a; log_rule("sp_after_type"); return((arg != AV_REMOVE) ? arg : AV_FORCE); } if ((first->type == CT_MACRO_OPEN) || (first->type == CT_MACRO_CLOSE) || (first->type == CT_MACRO_ELSE)) { if (second->type == CT_PAREN_OPEN) { log_rule("sp_func_call_paren"); return(cpd.settings[UO_sp_func_call_paren].a); } log_rule("IGNORE"); return(AV_IGNORE); } /* If nothing claimed the PTR_TYPE, then return ignore */ if ((first->type == CT_PTR_TYPE) || (second->type == CT_PTR_TYPE)) { log_rule("IGNORE"); return(AV_IGNORE); } if (first->type == CT_NOT) { log_rule("sp_not"); return(cpd.settings[UO_sp_not].a); } if (first->type == CT_INV) { log_rule("sp_inv"); return(cpd.settings[UO_sp_inv].a); } if (first->type == CT_ADDR) { log_rule("sp_addr"); return(cpd.settings[UO_sp_addr].a); } if (first->type == CT_DEREF) { log_rule("sp_deref"); return(cpd.settings[UO_sp_deref].a); } if ((first->type == CT_POS) || (first->type == CT_NEG)) { log_rule("sp_sign"); return(cpd.settings[UO_sp_sign].a); } if ((first->type == CT_INCDEC_BEFORE) || (second->type == CT_INCDEC_AFTER)) { log_rule("sp_incdec"); return(cpd.settings[UO_sp_incdec].a); } if (second->type == CT_CS_SQ_COLON) { log_rule("REMOVE"); return(AV_REMOVE); } if (first->type == CT_CS_SQ_COLON) { log_rule("FORCE"); return(AV_FORCE); } if (first->type == CT_OC_SCOPE) { log_rule("sp_after_oc_scope"); return(cpd.settings[UO_sp_after_oc_scope].a); } if (first->type == CT_OC_COLON) { if (first->flags & PCF_IN_OC_MSG) { log_rule("sp_after_send_oc_colon"); return(cpd.settings[UO_sp_after_send_oc_colon].a); } else { log_rule("sp_after_oc_colon"); return(cpd.settings[UO_sp_after_oc_colon].a); } } if (second->type == CT_OC_COLON) { if ((first->flags & PCF_IN_OC_MSG) && ((first->type == CT_OC_MSG_FUNC) || (first->type == CT_OC_MSG_NAME))) { log_rule("sp_before_send_oc_colon"); return(cpd.settings[UO_sp_before_send_oc_colon].a); } else { log_rule("sp_before_oc_colon"); return(cpd.settings[UO_sp_before_oc_colon].a); } } if ((second->type == CT_COMMENT) && (second->parent_type == CT_COMMENT_EMBED)) { log_rule("FORCE"); return(AV_FORCE); } if (chunk_is_comment(second)) { log_rule("IGNORE"); return(AV_IGNORE); } if (first->type == CT_COMMENT) { log_rule("FORCE"); return(AV_FORCE); } if ((first->type == CT_NEW) || (first->type == CT_DELETE) || ((first->type == CT_TSQUARE) && (first->parent_type == CT_DELETE))) { log_rule("sp_after_new"); return(cpd.settings[UO_sp_after_new].a); } for (idx = 0; idx < (int)ARRAY_SIZE(no_space_table); idx++) { if (((no_space_table[idx].first == CT_UNKNOWN) || (no_space_table[idx].first == first->type)) && ((no_space_table[idx].second == CT_UNKNOWN) || (no_space_table[idx].second == second->type))) { log_rule("REMOVE"); return(AV_REMOVE); } } log_rule("ADD"); return(AV_ADD); } /** * Marches through the whole file and checks to see how many spaces should be * between two chunks */ void space_text(void) { chunk_t *pc; chunk_t *next; chunk_t *tmp; int column, prev_column; int delta; pc = chunk_get_head(); if (pc == NULL) { return; } column = pc->column; while (pc != NULL) { next = chunk_get_next(pc); if (next == NULL) { break; } /* If the current chunk contains a newline, do not change the column * of the next item */ if ((pc->type == CT_NEWLINE) || (pc->type == CT_NL_CONT) || (pc->type == CT_COMMENT_MULTI)) { column = next->column; } else { /* Set to the minimum allowed column */ if (pc->nl_count == 0) { column += pc->len(); } else { column = pc->orig_col_end; } prev_column = column; /** * Apply a general safety check * If the two chunks combined will tokenize differently, then we * must force a space. * Two chunks -- "()" and "[]" will always tokenize differently. * They are always safe to not have a space after them. */ pc->flags &= ~PCF_FORCE_SPACE; if ((pc->len() > 0) && !chunk_is_str(pc, "[]", 2) && !chunk_is_str(pc, "()", 2)) { /* Find the next non-empty chunk on this line */ tmp = next; while ((tmp != NULL) && (tmp->len() == 0) && !chunk_is_newline(tmp)) { tmp = chunk_get_next(tmp); } if ((tmp != NULL) && (tmp->len() > 0)) { bool kw1 = CharTable::IsKw2(pc->str[pc->len() - 1]); bool kw2 = CharTable::IsKw1(next->str[0]); if (kw1 && kw2) { /* back-to-back words need a space */ pc->flags |= PCF_FORCE_SPACE; } else if (!kw1 && !kw2 && (pc->len() < 4) && (next->len() < 4)) { /* We aren't dealing with keywords. concat and try punctuators */ char buf[9]; memcpy(buf, pc->text(), pc->len()); memcpy(buf + pc->len(), next->text(), next->len()); buf[pc->len() + next->len()] = 0; const chunk_tag_t *ct; ct = find_punctuator(buf, cpd.lang_flags); if ((ct != NULL) && ((int)strlen(ct->tag) != pc->len())) { /* punctuator parsed to a different size.. */ pc->flags |= PCF_FORCE_SPACE; } } } } int min_sp; int av = do_space(pc, next, min_sp, false); if (pc->flags & PCF_FORCE_SPACE) { LOG_FMT(LSPACE, " ", pc->str.c_str(), next->str.c_str()); av |= AV_ADD; } min_sp = max(1, min_sp); switch (av) { case AV_FORCE: /* add exactly the specified # of spaces */ column += min_sp; break; case AV_ADD: delta = min_sp; if ((next->orig_col >= pc->orig_col_end) && (pc->orig_col_end != 0)) { /* Keep the same relative spacing, minimum 1 */ delta = next->orig_col - pc->orig_col_end; if (delta < min_sp) { delta = min_sp; } } column += delta; break; case AV_REMOVE: /* the symbols will be back-to-back "a+3" */ break; default: /* Keep the same relative spacing, if possible */ if ((next->orig_col >= pc->orig_col_end) && (pc->orig_col_end != 0)) { column += next->orig_col - pc->orig_col_end; } break; } if (chunk_is_comment(next) && chunk_is_newline(chunk_get_next(next)) && (column < (int)next->orig_col)) { if (((cpd.settings[UO_sp_before_tr_emb_cmt].a == AV_IGNORE) || ((next->parent_type != CT_COMMENT_END) && (next->parent_type != CT_COMMENT_EMBED))) && ((cpd.settings[UO_sp_endif_cmt].a == AV_IGNORE) || ((pc->type != CT_PP_ELSE) && (pc->type != CT_PP_ENDIF)))) { if (cpd.settings[UO_indent_relative_single_line_comments].b) { LOG_FMT(LSPACE, " "); column = pc->column + (next->orig_col - pc->orig_col_end); } else { LOG_FMT(LSPACE, " "); column = next->orig_col; } } } next->column = column; LOG_FMT(LSPACE, " = %s @ %d\n", (av == AV_IGNORE) ? "IGNORE" : (av == AV_ADD) ? "ADD" : (av == AV_REMOVE) ? "REMOVE" : "FORCE", column - prev_column); } pc = next; } } /** * Marches through the whole file and adds spaces around nested parens */ void space_text_balance_nested_parens(void) { chunk_t *first; chunk_t *next; chunk_t *cur; chunk_t *prev; first = chunk_get_head(); while (first != NULL) { next = chunk_get_next(first); if (next == NULL) { break; } if (chunk_is_str(first, "(", 1) && chunk_is_str(next, "(", 1)) { /* insert a space between the two opening parens */ space_add_after(first, 1); /* find the closing paren that matches the 'first' open paren and force * a space before it */ cur = next; prev = cur; while ((cur = chunk_get_next(cur)) != NULL) { if (cur->level == first->level) { space_add_after(prev, 1); break; } prev = cur; } } else if (chunk_is_str(first, ")", 1) && chunk_is_str(next, ")", 1)) { /* insert a space between the two closing parens */ space_add_after(first, 1); /* find the opening paren that matches the 'next' close paren and force * a space after it */ cur = first; while ((cur = chunk_get_prev(cur)) != NULL) { if (cur->level == next->level) { space_add_after(cur, 1); break; } } } first = next; } } /** * Determines if a space is required between two chunks */ int space_needed(chunk_t *first, chunk_t *second) { int min_sp; switch (do_space(first, second, min_sp)) { case AV_ADD: case AV_FORCE: return(max(1, min_sp)); case AV_REMOVE: return(0); case AV_IGNORE: default: return(second->orig_col > (first->orig_col + first->len())); } } /** * Calculates the column difference between two chunks. * The rules are bent a bit here, as AV_IGNORE and AV_ADD become AV_FORCE. * So the column difference is either first->len or first->len + 1. * * @param first The first chunk * @param second The second chunk * @return the column difference between the two chunks */ int space_col_align(chunk_t *first, chunk_t *second) { int coldiff, min_sp; argval_t av; av = do_space(first, second, min_sp); coldiff = first->len(); switch (av) { case AV_ADD: case AV_FORCE: coldiff++; break; case AV_REMOVE: break; case AV_IGNORE: if (second->orig_col > (first->orig_col + first->len())) { coldiff++; } break; } return(coldiff); } void space_add_after(chunk_t *pc, int count) { if (count <= 0) { return; } chunk_t *next = chunk_get_next(pc); /* don't add at the end of the file or before a newline */ if ((next == NULL) || chunk_is_newline(next)) { return; } /* Limit to 16 spaces */ if (count > 16) { count = 16; } /* Two CT_SPACE in a row -- use the max of the two */ if (next->type == CT_SPACE) { if (next->len() < count) { while (next->len() < count) { next->str.append(' '); } } return; } chunk_t sp; sp.flags = pc->flags & PCF_COPY_FLAGS; sp.type = CT_SPACE; sp.str = " "; // 16 spaces sp.str.resize(count); sp.level = pc->level; sp.brace_level = pc->brace_level; sp.pp_level = pc->pp_level; sp.column = pc->column + pc->len(); sp.orig_line = pc->orig_line; chunk_add_after(&sp, pc); } uncrustify-0.59/src/brace_cleanup.cpp0000644000175000017500000007233111630457175014700 00000000000000/** * @file brace_cleanup.cpp * Determines the brace level and paren level. * Inserts virtual braces as needed. * Handles all that preprocessor crap. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "char_table.h" #include "prototypes.h" #include "chunk_list.h" #include #include #include #include #include "unc_ctype.h" static chunk_t *insert_vbrace(chunk_t *pc, bool after, struct parse_frame *frm); #define insert_vbrace_close_after(pc, frm) insert_vbrace(pc, true, frm) #define insert_vbrace_open_before(pc, frm) insert_vbrace(pc, false, frm) static void parse_cleanup(struct parse_frame *frm, chunk_t *pc); static bool close_statement(struct parse_frame *frm, chunk_t *pc); static bool check_complex_statements(struct parse_frame *frm, chunk_t *pc); static bool handle_complex_close(struct parse_frame *frm, chunk_t *pc); static int preproc_start(struct parse_frame *frm, chunk_t *pc) { chunk_t *next; int pp_level = cpd.pp_level; /* Get the type of preprocessor and handle it */ next = chunk_get_next_ncnl(pc); if (next != NULL) { cpd.in_preproc = next->type; /** * If we are in a define, push the frame stack. */ if (cpd.in_preproc == CT_PP_DEFINE) { pf_push(frm); /* a preproc body starts a new, blank frame */ memset(frm, 0, sizeof(*frm)); frm->level = 1; frm->brace_level = 1; /*TODO: not sure about the next 3 lines */ frm->pse_tos = 1; frm->pse[frm->pse_tos].type = CT_PP_DEFINE; frm->pse[frm->pse_tos].stage = BS_NONE; } else { /* Check for #if, #else, #endif, etc */ pp_level = pf_check(frm, pc); } } return(pp_level); } static void print_stack(int logsev, const char *str, struct parse_frame *frm, chunk_t *pc) { if (log_sev_on(logsev)) { int idx; log_fmt(logsev, "%8.8s", str); for (idx = 1; idx <= frm->pse_tos; idx++) { if (frm->pse[idx].stage != BS_NONE) { LOG_FMT(logsev, " [%s - %d]", get_token_name(frm->pse[idx].type), frm->pse[idx].stage); } else { LOG_FMT(logsev, " [%s]", get_token_name(frm->pse[idx].type)); } } log_fmt(logsev, "\n"); } } /** * Scans through the whole list and does stuff. * It has to do some tricks to parse preprocessors. * * TODO: This can be cleaned up and simplified - we can look both forward and backward! */ void brace_cleanup(void) { chunk_t *pc; chunk_t vs_chunk; struct parse_frame frm; int pp_level; memset(&frm, 0, sizeof(frm)); cpd.frame_count = 0; cpd.in_preproc = CT_NONE; cpd.pp_level = 0; pc = chunk_get_head(); while (pc != NULL) { /* Check for leaving a #define body */ if ((cpd.in_preproc != CT_NONE) && ((pc->flags & PCF_IN_PREPROC) == 0)) { if (cpd.in_preproc == CT_PP_DEFINE) { /* out of the #define body, restore the frame */ pf_pop(&frm); } cpd.in_preproc = CT_NONE; } /* Check for a preprocessor start */ pp_level = cpd.pp_level; if (pc->type == CT_PREPROC) { pp_level = preproc_start(&frm, pc); } /* Do before assigning stuff from the frame */ if ((cpd.lang_flags & LANG_PAWN) != 0) { if ((frm.pse[frm.pse_tos].type == CT_VBRACE_OPEN) && (pc->type == CT_NEWLINE)) { pc = pawn_check_vsemicolon(pc); } } /* Assume the level won't change */ pc->level = frm.level; pc->brace_level = frm.brace_level; pc->pp_level = pp_level; /** * #define bodies get the full formatting treatment * Also need to pass in the initial '#' to close out any virtual braces. */ if (!chunk_is_comment(pc) && !chunk_is_newline(pc) && ((cpd.in_preproc == CT_PP_DEFINE) || (cpd.in_preproc == CT_NONE))) { cpd.consumed = false; parse_cleanup(&frm, pc); print_stack(LBCSAFTER, (pc->type == CT_VBRACE_CLOSE) ? "Virt-}" : pc->str, &frm, pc); } pc = chunk_get_next(pc); } } /** * pc is a CT_WHILE. * Scan backwards to see if we find a brace/vbrace with the parent set to CT_DO */ static bool maybe_while_of_do(chunk_t *pc) { chunk_t *prev; prev = chunk_get_prev_ncnl(pc); if ((prev == NULL) || !(prev->flags & PCF_IN_PREPROC)) { return(false); } /* Find the chunk before the preprocessor */ while ((prev != NULL) && (prev->flags & PCF_IN_PREPROC)) { prev = chunk_get_prev_ncnl(prev); } if ((prev != NULL) && (prev->parent_type == CT_DO) && ((prev->type == CT_VBRACE_CLOSE) || (prev->type == CT_BRACE_CLOSE))) { return(true); } return(false); } static void push_fmr_pse(struct parse_frame *frm, chunk_t *pc, brstage_e stage, const char *logtext) { if (frm->pse_tos < ((int)ARRAY_SIZE(frm->pse) - 1)) { frm->pse_tos++; frm->pse[frm->pse_tos].type = pc->type; frm->pse[frm->pse_tos].stage = stage; frm->pse[frm->pse_tos].pc = pc; print_stack(LBCSPUSH, logtext, frm, pc); } else { LOG_FMT(LWARN, "%s:%d Error: Frame stack overflow, Unable to properly process this file.\n", cpd.filename, cpd.line_number); cpd.error_count++; } } /** * At the heart of this algorithm are two stacks. * There is the Paren Stack (PS) and the Frame stack. * * The PS (pse in the code) keeps track of braces, parens, * if/else/switch/do/while/etc items -- anything that is nestable. * Complex statements go through stages. * Take this simple if statement as an example: * if ( x ) { x--; } * * The stack would change like so: 'token' stack afterwards * 'if' [IF - 1] * '(' [IF - 1] [PAREN OPEN] * 'x' [IF - 1] [PAREN OPEN] * ')' [IF - 2] <- note that the state was incremented * '{' [IF - 2] [BRACE OPEN] * 'x' [IF - 2] [BRACE OPEN] * '--' [IF - 2] [BRACE OPEN] * ';' [IF - 2] [BRACE OPEN] * '}' [IF - 3] * <- lack of else kills the IF, closes statement * * Virtual braces example: * if ( x ) x--; else x++; * * 'if' [IF - 1] * '(' [IF - 1] [PAREN OPEN] * 'x' [IF - 1] [PAREN OPEN] * ')' [IF - 2] * 'x' [IF - 2] [VBRACE OPEN] <- VBrace open inserted before because '{' was not next * '--' [IF - 2] [VBRACE OPEN] * ';' [IF - 3] <- VBrace close inserted after semicolon * 'else' [ELSE - 0] <- IF changed into ELSE * 'x' [ELSE - 0] [VBRACE OPEN] <- lack of '{' -> VBrace * '++' [ELSE - 0] [VBRACE OPEN] * ';' [ELSE - 0] <- VBrace close inserted after semicolon * <- ELSE removed after statement close * * The pse stack is kept on a frame stack. * The frame stack is need for languages that support preprocessors (C, C++, C#) * that can arbitrarily change code flow. It also isolates #define macros so * that they are indented independently and do not affect the rest of the program. * * When an #if is hit, a copy of the current frame is push on the frame stack. * When an #else/#elif is hit, a copy of the current stack is pushed under the * #if frame and the original (pre-#if) frame is copied to the current frame. * When #endif is hit, the top frame is popped. * This has the following effects: * - a simple #if / #endif does not affect program flow * - #if / #else /#endif - continues from the #if clause * * When a #define is entered, the current frame is pushed and cleared. * When a #define is exited, the frame is popped. */ static void parse_cleanup(struct parse_frame *frm, chunk_t *pc) { c_token_t parent = CT_NONE; chunk_t *prev; LOG_FMT(LTOK, "%s:%d] %16s - tos:%d/%16s stg:%d\n", __func__, pc->orig_line, get_token_name(pc->type), frm->pse_tos, get_token_name(frm->pse[frm->pse_tos].type), frm->pse[frm->pse_tos].stage); /* Mark statement starts */ if (((frm->stmt_count == 0) || (frm->expr_count == 0)) && !chunk_is_semicolon(pc) && (pc->type != CT_BRACE_CLOSE) && (pc->type != CT_VBRACE_CLOSE)) { pc->flags |= PCF_EXPR_START; pc->flags |= (frm->stmt_count == 0) ? PCF_STMT_START : 0; LOG_FMT(LSTMT, "%d] 1.marked %s as stmt start st:%d ex:%d\n", pc->orig_line, pc->str.c_str(), frm->stmt_count, frm->expr_count); } frm->stmt_count++; frm->expr_count++; if (frm->sparen_count > 0) { int tmp; pc->flags |= PCF_IN_SPAREN; /* Mark everything in the a for statement */ for (tmp = frm->pse_tos - 1; tmp >= 0; tmp--) { if (frm->pse[tmp].type == CT_FOR) { pc->flags |= PCF_IN_FOR; break; } } /* Mark the parent on semicolons in for() stmts */ if ((pc->type == CT_SEMICOLON) && (frm->pse_tos > 1) && (frm->pse[frm->pse_tos - 1].type == CT_FOR)) { pc->parent_type = CT_FOR; } } /* Check the progression of complex statements */ if (frm->pse[frm->pse_tos].stage != BS_NONE) { if (check_complex_statements(frm, pc)) { return; } } /** * Check for a virtual brace statement close due to a semicolon. * The virtual brace will get handled the next time through. * The semicolon isn't handled at all. * TODO: may need to float VBRACE past comments until newline? */ if (frm->pse[frm->pse_tos].type == CT_VBRACE_OPEN) { if (chunk_is_semicolon(pc)) { cpd.consumed = true; close_statement(frm, pc); } else if ((cpd.lang_flags & LANG_PAWN) != 0) { if (pc->type == CT_BRACE_CLOSE) { close_statement(frm, pc); } } } /* Handle close paren, vbrace, brace, and square */ if ((pc->type == CT_PAREN_CLOSE) || (pc->type == CT_BRACE_CLOSE) || (pc->type == CT_VBRACE_CLOSE) || (pc->type == CT_ANGLE_CLOSE) || (pc->type == CT_MACRO_CLOSE) || (pc->type == CT_SQUARE_CLOSE)) { /* Change CT_PAREN_CLOSE into CT_SPAREN_CLOSE or CT_FPAREN_CLOSE */ if ((pc->type == CT_PAREN_CLOSE) && ((frm->pse[frm->pse_tos].type == CT_FPAREN_OPEN) || (frm->pse[frm->pse_tos].type == CT_SPAREN_OPEN))) { pc->type = (c_token_t)(frm->pse[frm->pse_tos].type + 1); if (pc->type == CT_SPAREN_CLOSE) { frm->sparen_count--; pc->flags &= ~PCF_IN_SPAREN; } } /* Make sure the open / close match */ if (pc->type != (frm->pse[frm->pse_tos].type + 1)) { if ((frm->pse[frm->pse_tos].type != CT_NONE) && (frm->pse[frm->pse_tos].type != CT_PP_DEFINE)) { LOG_FMT(LWARN, "%s:%d Error: Unexpected '%s' for '%s', which was on line %d\n", cpd.filename, pc->orig_line, pc->str.c_str(), get_token_name(frm->pse[frm->pse_tos].pc->type), frm->pse[frm->pse_tos].pc->orig_line); print_stack(LBCSPOP, "=Error ", frm, pc); cpd.error_count++; } } else { cpd.consumed = true; /* Copy the parent, update the paren/brace levels */ pc->parent_type = frm->pse[frm->pse_tos].parent; frm->level--; if ((pc->type == CT_BRACE_CLOSE) || (pc->type == CT_VBRACE_CLOSE) || (pc->type == CT_MACRO_CLOSE)) { frm->brace_level--; } pc->level = frm->level; pc->brace_level = frm->brace_level; /* Pop the entry */ frm->pse_tos--; print_stack(LBCSPOP, "-Close ", frm, pc); /* See if we are in a complex statement */ if (frm->pse[frm->pse_tos].stage != BS_NONE) { handle_complex_close(frm, pc); } } } /* In this state, we expect a semicolon, but we'll also hit the closing * sparen, so we need to check cpd.consumed to see if the close sparen was * aleady handled. */ if (frm->pse[frm->pse_tos].stage == BS_WOD_SEMI) { chunk_t *tmp = pc; if (cpd.consumed) { /* If consumed, then we are on the close sparen. * PAWN: Check the next chunk for a semicolon. If it isn't, then * add a virtual semicolon, which will get handled on the next pass. */ if (cpd.lang_flags & LANG_PAWN) { tmp = chunk_get_next_ncnl(pc); if ((tmp->type != CT_SEMICOLON) && (tmp->type != CT_VSEMICOLON)) { pawn_add_vsemi_after(pc); } } } else { /* Complain if this ISN'T a semicolon, but close out WHILE_OF_DO anyway */ if ((pc->type == CT_SEMICOLON) || (pc->type == CT_VSEMICOLON)) { cpd.consumed = true; pc->parent_type = CT_WHILE_OF_DO; } else { LOG_FMT(LWARN, "%s:%d: Error: Expected a semicolon for WHILE_OF_DO, but got '%s'\n", cpd.filename, pc->orig_line, get_token_name(pc->type)); cpd.error_count++; } handle_complex_close(frm, pc); } } /* Get the parent type for brace and paren open */ parent = pc->parent_type; if ((pc->type == CT_PAREN_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->type == CT_SPAREN_OPEN) || (pc->type == CT_BRACE_OPEN)) { prev = chunk_get_prev_ncnl(pc); if (prev != NULL) { if ((pc->type == CT_PAREN_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->type == CT_SPAREN_OPEN)) { /* Set the parent for parens and change paren type */ if (frm->pse[frm->pse_tos].stage != BS_NONE) { pc->type = CT_SPAREN_OPEN; parent = frm->pse[frm->pse_tos].type; frm->sparen_count++; } else if (prev->type == CT_FUNCTION) { pc->type = CT_FPAREN_OPEN; parent = CT_FUNCTION; } else { /* no need to set parent */ } } else /* must be CT_BRACE_OPEN */ { /* Set the parent for open braces */ if (frm->pse[frm->pse_tos].stage != BS_NONE) { parent = frm->pse[frm->pse_tos].type; } else if ((prev->type == CT_ASSIGN) && (prev->str[0] == '=')) { parent = CT_ASSIGN; } else if (prev->type == CT_FPAREN_CLOSE) { parent = CT_FUNCTION; } else { /* no need to set parent */ } } } } /** * Adjust the level for opens & create a stack entry * Note that CT_VBRACE_OPEN has already been handled. */ if ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_PAREN_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->type == CT_SPAREN_OPEN) || (pc->type == CT_ANGLE_OPEN) || (pc->type == CT_MACRO_OPEN) || (pc->type == CT_SQUARE_OPEN)) { frm->level++; if ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_MACRO_OPEN)) { frm->brace_level++; } push_fmr_pse(frm, pc, BS_NONE, "+Open "); frm->pse[frm->pse_tos].parent = parent; pc->parent_type = parent; } pattern_class patcls = get_token_pattern_class(pc->type); /** Create a stack entry for complex statements IF/DO/FOR/WHILE/SWITCH */ if (patcls == PATCLS_BRACED) { push_fmr_pse(frm, pc, (pc->type == CT_DO) ? BS_BRACE_DO : BS_BRACE2, "+ComplexBraced"); } else if (patcls == PATCLS_PBRACED) { brstage_e bs = BS_PAREN1; if ((pc->type == CT_WHILE) && maybe_while_of_do(pc)) { pc->type = CT_WHILE_OF_DO; bs = BS_WOD_PAREN; } push_fmr_pse(frm, pc, bs, "+ComplexParenBraced"); } else if (patcls == PATCLS_OPBRACED) { push_fmr_pse(frm, pc, BS_OP_PAREN1, "+ComplexOpParenBraced"); } else if (patcls == PATCLS_ELSE) { push_fmr_pse(frm, pc, BS_ELSEIF, "+ComplexElse"); } /* Mark simple statement/expression starts * - after { or } * - after ';', but not if the paren stack top is a paren * - after '(' that has a parent type of CT_FOR */ if ((pc->type == CT_SQUARE_OPEN) || ((pc->type == CT_BRACE_OPEN) && (pc->parent_type != CT_ASSIGN)) || (pc->type == CT_BRACE_CLOSE) || (pc->type == CT_VBRACE_CLOSE) || ((pc->type == CT_SPAREN_OPEN) && (pc->parent_type == CT_FOR)) || (chunk_is_semicolon(pc) && (frm->pse[frm->pse_tos].type != CT_PAREN_OPEN) && (frm->pse[frm->pse_tos].type != CT_FPAREN_OPEN) && (frm->pse[frm->pse_tos].type != CT_SPAREN_OPEN))) { LOG_FMT(LSTMT, "%s: %d> reset stmt on %s\n", __func__, pc->orig_line, pc->str.c_str()); frm->stmt_count = 0; frm->expr_count = 0; } /* Mark expression starts */ chunk_t *tmp = chunk_get_next_ncnl(pc); if ((pc->type == CT_ARITH) || (pc->type == CT_ASSIGN) || (pc->type == CT_CASE) || (pc->type == CT_COMPARE) || ((pc->type == CT_STAR) && tmp && (tmp->type != CT_STAR)) || (pc->type == CT_BOOL) || (pc->type == CT_MINUS) || (pc->type == CT_PLUS) || (pc->type == CT_ANGLE_OPEN) || (pc->type == CT_ANGLE_CLOSE) || (pc->type == CT_RETURN) || (pc->type == CT_GOTO) || (pc->type == CT_CONTINUE) || (pc->type == CT_PAREN_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->type == CT_SPAREN_OPEN) || (pc->type == CT_BRACE_OPEN) || chunk_is_semicolon(pc) || (pc->type == CT_COMMA) || (pc->type == CT_NOT) || (pc->type == CT_INV) || (pc->type == CT_COLON) || (pc->type == CT_QUESTION)) { frm->expr_count = 0; LOG_FMT(LSTMT, "%s: %d> reset expr on %s\n", __func__, pc->orig_line, pc->str.c_str()); } } /** * Checks the progression of complex statements. * - checks for else after if * - checks for if after else * - checks for while after do * - checks for open brace in BRACE2 and BRACE_DO stages, inserts open VBRACE * - checks for open paren in PAREN1 and PAREN2 stages, complains * * @param frm The parse frame * @param pc The current chunk * @return true - done with this chunk, false - keep processing */ static bool check_complex_statements(struct parse_frame *frm, chunk_t *pc) { c_token_t parent; chunk_t *vbrace; /* Turn an optional paren into either a real paren or a brace */ if (frm->pse[frm->pse_tos].stage == BS_OP_PAREN1) { frm->pse[frm->pse_tos].stage = (pc->type != CT_PAREN_OPEN) ? BS_BRACE2 : BS_PAREN1; } /* Check for CT_ELSE after CT_IF */ while (frm->pse[frm->pse_tos].stage == BS_ELSE) { if (pc->type == CT_ELSE) { /* Replace CT_IF with CT_ELSE on the stack & we are done */ frm->pse[frm->pse_tos].type = CT_ELSE; frm->pse[frm->pse_tos].stage = BS_ELSEIF; print_stack(LBCSSWAP, "=Swap ", frm, pc); return(true); } /* Remove the CT_IF and close the statement */ frm->pse_tos--; print_stack(LBCSPOP, "-IF-CCS ", frm, pc); if (close_statement(frm, pc)) { return(true); } } /* Check for CT_IF after CT_ELSE */ if (frm->pse[frm->pse_tos].stage == BS_ELSEIF) { if (pc->type == CT_IF) { if (!cpd.settings[UO_indent_else_if].b || !chunk_is_newline(chunk_get_prev_nc(pc))) { /* Replace CT_ELSE with CT_IF */ pc->type = CT_ELSEIF; frm->pse[frm->pse_tos].type = CT_ELSEIF; frm->pse[frm->pse_tos].stage = BS_PAREN1; return(true); } } /* Jump to the 'expecting brace' stage */ frm->pse[frm->pse_tos].stage = BS_BRACE2; } /* Check for CT_CATCH or CT_FINALLY after CT_TRY or CT_CATCH */ while (frm->pse[frm->pse_tos].stage == BS_CATCH) { if ((pc->type == CT_CATCH) || (pc->type == CT_FINALLY)) { /* Replace CT_TRY with CT_CATCH on the stack & we are done */ frm->pse[frm->pse_tos].type = pc->type; frm->pse[frm->pse_tos].stage = (pc->type == CT_CATCH) ? BS_OP_PAREN1 : BS_BRACE2; print_stack(LBCSSWAP, "=Swap ", frm, pc); return(true); } /* Remove the CT_TRY and close the statement */ frm->pse_tos--; print_stack(LBCSPOP, "-TRY-CCS ", frm, pc); if (close_statement(frm, pc)) { return(true); } } /* Check for CT_WHILE after the CT_DO */ if (frm->pse[frm->pse_tos].stage == BS_WHILE) { if (pc->type == CT_WHILE) { pc->type = CT_WHILE_OF_DO; frm->pse[frm->pse_tos].type = CT_WHILE_OF_DO; //CT_WHILE; frm->pse[frm->pse_tos].stage = BS_WOD_PAREN; return(true); } LOG_FMT(LWARN, "%s:%d Error: Expected 'while', got '%s'\n", cpd.filename, pc->orig_line, pc->str.c_str()); frm->pse_tos--; print_stack(LBCSPOP, "-Error ", frm, pc); cpd.error_count++; } /* Insert a CT_VBRACE_OPEN, if needed */ if ((pc->type != CT_BRACE_OPEN) && ((frm->pse[frm->pse_tos].stage == BS_BRACE2) || (frm->pse[frm->pse_tos].stage == BS_BRACE_DO))) { parent = frm->pse[frm->pse_tos].type; vbrace = insert_vbrace_open_before(pc, frm); vbrace->parent_type = parent; frm->level++; frm->brace_level++; push_fmr_pse(frm, vbrace, BS_NONE, "+VBrace "); frm->pse[frm->pse_tos].parent = parent; /* update the level of pc */ pc->level = frm->level; pc->brace_level = frm->brace_level; /* Mark as a start of a statement */ frm->stmt_count = 0; frm->expr_count = 0; pc->flags |= PCF_STMT_START | PCF_EXPR_START; frm->stmt_count = 1; frm->expr_count = 1; LOG_FMT(LSTMT, "%d] 2.marked %s as stmt start\n", pc->orig_line, pc->str.c_str()); } /* Verify open paren in complex statement */ if ((pc->type != CT_PAREN_OPEN) && ((frm->pse[frm->pse_tos].stage == BS_PAREN1) || (frm->pse[frm->pse_tos].stage == BS_WOD_PAREN))) { LOG_FMT(LWARN, "%s:%d Error: Expected '(', got '%s' for '%s'\n", cpd.filename, pc->orig_line, pc->str.c_str(), get_token_name(frm->pse[frm->pse_tos].type)); /* Throw out the complex statement */ frm->pse_tos--; print_stack(LBCSPOP, "-Error ", frm, pc); cpd.error_count++; } return(false); } /** * Handles a close paren or brace - just progress the stage, if the end * of the statement is hit, call close_statement() * * @param frm The parse frame * @param pc The current chunk * @return true - done with this chunk, false - keep processing */ static bool handle_complex_close(struct parse_frame *frm, chunk_t *pc) { chunk_t *next; if (frm->pse[frm->pse_tos].stage == BS_PAREN1) { /* PAREN1 always => BRACE2 */ frm->pse[frm->pse_tos].stage = BS_BRACE2; } else if (frm->pse[frm->pse_tos].stage == BS_BRACE2) { /* BRACE2: IF => ELSE, anyting else => close */ if ((frm->pse[frm->pse_tos].type == CT_IF) || (frm->pse[frm->pse_tos].type == CT_ELSEIF)) { frm->pse[frm->pse_tos].stage = BS_ELSE; /* If the next chunk isn't CT_ELSE, close the statement */ next = chunk_get_next_ncnl(pc); if ((next != NULL) && (next->type != CT_ELSE)) { frm->pse_tos--; print_stack(LBCSPOP, "-IF-HCS ", frm, pc); if (close_statement(frm, pc)) { return(true); } } } else if ((frm->pse[frm->pse_tos].type == CT_TRY) || (frm->pse[frm->pse_tos].type == CT_CATCH)) { frm->pse[frm->pse_tos].stage = BS_CATCH; /* If the next chunk isn't CT_CATCH or CT_FINALLY, close the statement */ next = chunk_get_next_ncnl(pc); if ((next != NULL) && (next->type != CT_CATCH) && (next->type != CT_FINALLY)) { frm->pse_tos--; print_stack(LBCSPOP, "-TRY-HCS ", frm, pc); if (close_statement(frm, pc)) { return(true); } } } else { LOG_FMT(LNOTE, "%s: close_statement on %s BS_BRACE2\n", __func__, get_token_name(frm->pse[frm->pse_tos].type)); frm->pse_tos--; print_stack(LBCSPOP, "-HCC B2 ", frm, pc); if (close_statement(frm, pc)) { return(true); } } } else if (frm->pse[frm->pse_tos].stage == BS_BRACE_DO) { frm->pse[frm->pse_tos].stage = BS_WHILE; } else if (frm->pse[frm->pse_tos].stage == BS_WOD_PAREN) { LOG_FMT(LNOTE, "%s: close_statement on %s BS_WOD_PAREN\n", __func__, get_token_name(frm->pse[frm->pse_tos].type)); frm->pse[frm->pse_tos].stage = BS_WOD_SEMI; print_stack(LBCSPOP, "-HCC WoDP ", frm, pc); } else if (frm->pse[frm->pse_tos].stage == BS_WOD_SEMI) { LOG_FMT(LNOTE, "%s: close_statement on %s BS_WOD_SEMI\n", __func__, get_token_name(frm->pse[frm->pse_tos].type)); frm->pse_tos--; print_stack(LBCSPOP, "-HCC WoDS ", frm, pc); if (close_statement(frm, pc)) { return(true); } } else { /* PROBLEM */ LOG_FMT(LWARN, "%s:%d Error: TOS.type='%s' TOS.stage=%d\n", cpd.filename, pc->orig_line, get_token_name(frm->pse[frm->pse_tos].type), frm->pse[frm->pse_tos].stage); cpd.error_count++; } return(false); } static chunk_t *insert_vbrace(chunk_t *pc, bool after, struct parse_frame *frm) { chunk_t chunk; chunk_t *rv; chunk_t *ref; chunk.orig_line = pc->orig_line; chunk.parent_type = frm->pse[frm->pse_tos].type; chunk.level = frm->level; chunk.brace_level = frm->brace_level; chunk.flags = pc->flags & PCF_COPY_FLAGS; chunk.str = ""; if (after) { chunk.type = CT_VBRACE_CLOSE; rv = chunk_add_after(&chunk, pc); } else { ref = chunk_get_prev(pc); if ((ref->flags & PCF_IN_PREPROC) == 0) { chunk.flags &= ~PCF_IN_PREPROC; } while (chunk_is_newline(ref) || chunk_is_comment(ref)) { ref->level++; ref->brace_level++; ref = chunk_get_prev(ref); } /* Don't back into a preprocessor */ if (((pc->flags & PCF_IN_PREPROC) == 0) && ((ref->flags & PCF_IN_PREPROC) != 0)) { if (ref->type == CT_PREPROC_BODY) { do { ref = chunk_get_prev(ref); } while ((ref != NULL) && ((ref->flags & PCF_IN_PREPROC) != 0)); } else { ref = chunk_get_next(ref); } } chunk.orig_line = ref->orig_line; chunk.column = ref->column + ref->len() + 1; chunk.type = CT_VBRACE_OPEN; rv = chunk_add_after(&chunk, ref); } return(rv); } /** * Called when a statement was just closed and the pse_tos was just * decremented. * * - if the TOS is now VBRACE, insert a CT_VBRACE_CLOSE and recurse. * - if the TOS is a complex statement, call handle_complex_close() * * @return true - done with this chunk, false - keep processing */ bool close_statement(struct parse_frame *frm, chunk_t *pc) { chunk_t *vbc = pc; LOG_FMT(LTOK, "%s:%d] %s '%s' type %s stage %d\n", __func__, pc->orig_line, get_token_name(pc->type), pc->str.c_str(), get_token_name(frm->pse[frm->pse_tos].type), frm->pse[frm->pse_tos].stage); if (cpd.consumed) { frm->stmt_count = 0; frm->expr_count = 0; LOG_FMT(LSTMT, "%s: %d> reset stmt on %s\n", __func__, pc->orig_line, pc->str.c_str()); } /** * If we are in a virtual brace and we are not ON a CT_VBRACE_CLOSE add one */ if (frm->pse[frm->pse_tos].type == CT_VBRACE_OPEN) { /* If the current token has already been consumed, then add after it */ if (cpd.consumed) { insert_vbrace_close_after(pc, frm); } else { /* otherwise, add before it and consume the vbrace */ vbc = chunk_get_prev_ncnl(pc); vbc = insert_vbrace_close_after(vbc, frm); vbc->parent_type = frm->pse[frm->pse_tos].parent; frm->level--; frm->brace_level--; frm->pse_tos--; /* Update the token level */ pc->level = frm->level; pc->brace_level = frm->brace_level; print_stack(LBCSPOP, "-CS VB ", frm, pc); /* And repeat the close */ close_statement(frm, pc); return(true); } } /* See if we are done with a complex statement */ if (frm->pse[frm->pse_tos].stage != BS_NONE) { if (handle_complex_close(frm, vbc)) { return(true); } } return(false); } uncrustify-0.59/src/align.cpp0000644000175000017500000014371311630457175013212 00000000000000/** * @file align.cpp * Does all the aligning stuff. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "ChunkStack.h" #include "align_stack.h" #include "prototypes.h" #include #include #include #include #include "unc_ctype.h" static chunk_t *align_var_def_brace(chunk_t *pc, int span, int *nl_count); static chunk_t *align_trailing_comments(chunk_t *start); static void align_init_brace(chunk_t *start); static void align_func_params(); static void align_same_func_call_params(); static void align_func_proto(int span); static void align_oc_msg_spec(int span); static void align_typedefs(int span); static void align_left_shift(void); static void align_oc_msg_colons(); static void align_oc_msg_colon(chunk_t *so); static void align_oc_decl_colon(void); /* * Here are the items aligned: * * - enum value assignments * enum { * cat = 1, * fred = 2, * }; * * - struct/union variable & bit definitions * struct foo { * char cat; * int id : 5; * int name_len : 6; * int heigth : 12; * }; * * - variable definitions & assignments in normal code * const char *cat = "feline"; * int id = 4; * a = 5; * bat = 14; * * - simple array initializers * int a[] = { * 1, 2, 3, 4, 5, * 6, 7, 8, 9, 10 * }; * * - c99 array initializers * const char *name[] = { * [FRED] = "fred", * [JOE] = "joe", * [PETER] = "peter", * }; * struct foo b[] = { * { .id = 1, .name = "text 1" }, * { .id = 567, .name = "text 2" }, * }; * struct foo_t bars[] = * { * [0] = { .name = "bar", * .age = 21 }, * [1] = { .name = "barley", * .age = 55 }, * }; * * - compact array initializers * struct foo b[] = { * { 3, "dog" }, { 6, "spider" }, * { 8, "elephant" }, { 3, "cat" }, * }; * * - multiline array initializers (2nd line indented, not aligned) * struct foo b[] = { * { AD_NOT_ALLOWED, "Sorry, you failed to guess the password.", * "Try again?", "Yes", "No" }, * { AD_SW_ERROR, "A software error has occured.", "Bye!", NULL, NULL }, * }; * * - Trailing comments * * - Back-slash newline groups * * - Function prototypes * int foo(); * void bar(); * * - Preprocessors * #define FOO_VAL 15 * #define MAX_TIMEOUT 60 * #define FOO(x) ((x) * 65) * * - typedefs * typedef uint8_t BYTE; * typedef int32_t INT32; * typedef uint32_t UINT32; */ /** * Aligns everything in the chunk stack to a particular column. * The stack is empty after this function. * * @param col the column * @param align_single align even if there is only one item on the stack */ static void align_stack(ChunkStack& cs, int col, bool align_single, log_sev_t sev) { chunk_t *pc; if (cpd.settings[UO_align_on_tabstop].b) { col = align_tab_column(col); } if ((cs.Len() > 1) || (align_single && (cs.Len() == 1))) { LOG_FMT(sev, "%s: max_col=%d\n", __func__, col); while ((pc = cs.Pop()) != NULL) { align_to_column(pc, col); pc->flags |= PCF_WAS_ALIGNED; LOG_FMT(sev, "%s: indented [%s] on line %d to %d\n", __func__, pc->str.c_str(), pc->orig_line, pc->column); } } cs.Reset(); } /** * Adds an item to the align stack and adjust the nl_count and max_col. * Adjust max_col as needed * * @param pc the item to add * @param max_col pointer to the column variable * @param extra_pad extra padding */ static void align_add(ChunkStack& cs, chunk_t *pc, int& max_col, int min_pad, bool squeeze) { chunk_t *prev; int min_col; prev = chunk_get_prev(pc); if ((prev == NULL) || chunk_is_newline(prev)) { min_col = squeeze ? 1 : pc->column; LOG_FMT(LALADD, "%s: pc->col=%d max_col=%d min_pad=%d min_col=%d\n", __func__, pc->column, max_col, min_pad, min_col); } else { if (prev->type == CT_COMMENT_MULTI) { min_col = prev->orig_col_end + min_pad; } else { min_col = prev->column + prev->len() + min_pad; } if (!squeeze) { if (min_col < pc->column) { min_col = pc->column; } } LOG_FMT(LALADD, "%s: pc->col=%d max_col=%d min_pad=%d min_col=%d multi:%s prev->col=%d prev->len=%d %s\n", __func__, pc->column, max_col, min_pad, min_col, (prev->type == CT_COMMENT_MULTI) ? "Y" : "N", (prev->type == CT_COMMENT_MULTI) ? prev->orig_col_end : prev->column, prev->len(), get_token_name(prev->type)); } if (cs.Empty()) { max_col = 0; } cs.Push(pc); if (min_col > max_col) { max_col = min_col; } } void quick_align_again(void) { chunk_t *pc; chunk_t *tmp; AlignStack as; LOG_FMT(LALAGAIN, "%s:\n", __func__); for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if ((pc->align.next != NULL) && (pc->flags & PCF_ALIGN_START)) { as.Start(100, 0); as.m_right_align = pc->align.right_align; as.m_star_style = (AlignStack::StarStyle)pc->align.star_style; as.m_amp_style = (AlignStack::StarStyle)pc->align.amp_style; as.m_gap = pc->align.gap; LOG_FMT(LALAGAIN, " [%s:%d]", pc->str.c_str(), pc->orig_line); as.Add(pc->align.start); pc->flags |= PCF_WAS_ALIGNED; for (tmp = pc->align.next; tmp != NULL; tmp = tmp->align.next) { tmp->flags |= PCF_WAS_ALIGNED; as.Add(tmp->align.start); LOG_FMT(LALAGAIN, " => [%s:%d]", tmp->str.c_str(), tmp->orig_line); } LOG_FMT(LALAGAIN, "\n"); as.End(); } } } void align_all(void) { if (cpd.settings[UO_align_typedef_span].n > 0) { align_typedefs(cpd.settings[UO_align_typedef_span].n); } if (cpd.settings[UO_align_left_shift].b) { align_left_shift(); } if (cpd.settings[UO_align_oc_msg_colon_span].n > 0) { align_oc_msg_colons(); } if (cpd.settings[UO_align_oc_decl_colon].b) { align_oc_decl_colon(); } /* Align variable definitions */ if ((cpd.settings[UO_align_var_def_span].n > 0) || (cpd.settings[UO_align_var_struct_span].n > 0)) { align_var_def_brace(chunk_get_head(), cpd.settings[UO_align_var_def_span].n, NULL); } /* Align assignments */ align_assign(chunk_get_head(), cpd.settings[UO_align_assign_span].n, cpd.settings[UO_align_assign_thresh].n); /* Align structure initializers */ if (cpd.settings[UO_align_struct_init_span].n > 0) { align_struct_initializers(); } /* Align function prototypes */ if ((cpd.settings[UO_align_func_proto_span].n > 0) && !cpd.settings[UO_align_mix_var_proto].b) { align_func_proto(cpd.settings[UO_align_func_proto_span].n); } /* Align function prototypes */ if (cpd.settings[UO_align_oc_msg_spec_span].n > 0) { align_oc_msg_spec(cpd.settings[UO_align_oc_msg_spec_span].n); } /* Align variable defs in function prototypes */ if (cpd.settings[UO_align_func_params].b) { align_func_params(); } if (cpd.settings[UO_align_same_func_call_params].b) { align_same_func_call_params(); } /* Just in case something was aligned out of order... do it again */ quick_align_again(); } /** * Aligns all function prototypes in the file. */ static void align_oc_msg_spec(int span) { chunk_t *pc; AlignStack as; LOG_FMT(LALIGN, "%s\n", __func__); as.Start(span, 0); for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (chunk_is_newline(pc)) { as.NewLines(pc->nl_count); } else if (pc->type == CT_OC_MSG_SPEC) { as.Add(pc); } } as.End(); } /** * Aligns all backslash-newline combos in the file. * This should be done LAST. */ void align_backslash_newline(void) { chunk_t *pc; pc = chunk_get_head(); while (pc != NULL) { if (pc->type != CT_NL_CONT) { pc = chunk_get_next_type(pc, CT_NL_CONT, -1); continue; } pc = align_nl_cont(pc); } } void align_right_comments(void) { chunk_t *pc; chunk_t *prev; bool skip; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if ((pc->type == CT_COMMENT) || (pc->type == CT_COMMENT_CPP) || (pc->type == CT_COMMENT_MULTI)) { skip = false; if (pc->parent_type == CT_COMMENT_END) { prev = chunk_get_prev(pc); if (pc->orig_col < (prev->orig_col_end + cpd.settings[UO_align_right_cmt_gap].n)) { LOG_FMT(LALTC, "NOT changing END comment on line %d (%d <= %d + %d)\n", pc->orig_line, pc->orig_col, prev->orig_col_end, cpd.settings[UO_align_right_cmt_gap].n); skip = true; } if (!skip) { LOG_FMT(LALTC, "Changing END comment on line %d into a RIGHT-comment\n", pc->orig_line); pc->flags |= PCF_RIGHT_COMMENT; } } /* Change certain WHOLE comments into RIGHT-alignable comments */ if (pc->parent_type == CT_COMMENT_WHOLE) { int max_col = pc->column_indent + cpd.settings[UO_input_tab_size].n; /* If the comment is further right than the brace level... */ if (pc->column >= max_col) { LOG_FMT(LALTC, "Changing WHOLE comment on line %d into a RIGHT-comment (col=%d col_ind=%d max_col=%d)\n", pc->orig_line, pc->column, pc->column_indent, max_col); pc->flags |= PCF_RIGHT_COMMENT; } } } } pc = chunk_get_head(); while (pc != NULL) { if ((pc->flags & PCF_RIGHT_COMMENT) != 0) { pc = align_trailing_comments(pc); } else { pc = chunk_get_next(pc); } } } /** * Aligns stuff inside a multi-line "= { ... }" sequence. */ void align_struct_initializers(void) { chunk_t *pc; chunk_t *prev; pc = chunk_get_head(); while (pc != NULL) { prev = chunk_get_prev_ncnl(pc); if ((prev != NULL) && (prev->type == CT_ASSIGN) && ((pc->type == CT_BRACE_OPEN) || ((cpd.lang_flags & LANG_D) && (pc->type == CT_SQUARE_OPEN)))) { align_init_brace(pc); } pc = chunk_get_next_type(pc, CT_BRACE_OPEN, -1); } } /** * Scans the whole file for #defines. Aligns all within X lines of each other */ void align_preprocessor(void) { chunk_t *pc; AlignStack as; // value macros AlignStack asf; // function macros AlignStack *cur_as = &as; as.Start(cpd.settings[UO_align_pp_define_span].n); as.m_gap = cpd.settings[UO_align_pp_define_gap].n; asf.Start(cpd.settings[UO_align_pp_define_span].n); asf.m_gap = cpd.settings[UO_align_pp_define_gap].n; pc = chunk_get_head(); while (pc != NULL) { /* Note: not counting back-slash newline combos */ if (pc->type == CT_NEWLINE) { as.NewLines(pc->nl_count); asf.NewLines(pc->nl_count); } /* If we aren't on a 'define', then skip to the next non-comment */ if (pc->type != CT_PP_DEFINE) { pc = chunk_get_next_nc(pc); continue; } /* step past the 'define' */ pc = chunk_get_next_nc(pc); if (pc == NULL) { break; } LOG_FMT(LALPP, "%s: define (%s) on line %d col %d\n", __func__, pc->str.c_str(), pc->orig_line, pc->orig_col); cur_as = &as; if (pc->type == CT_MACRO_FUNC) { cur_as = &asf; /* Skip to the close paren */ pc = chunk_get_next_nc(pc); // point to open ( pc = chunk_get_next_type(pc, CT_FPAREN_CLOSE, pc->level); LOG_FMT(LALPP, "%s: jumped to (%s) on line %d col %d\n", __func__, pc->str.c_str(), pc->orig_line, pc->orig_col); } /* step to the value past the close paren or the macro name */ pc = chunk_get_next(pc); if (pc == NULL) { break; } /* don't align anything if the first line ends with a newline before * a value is given */ if (!chunk_is_newline(pc)) { LOG_FMT(LALPP, "%s: align on '%s', line %d col %d\n", __func__, pc->str.c_str(), pc->orig_line, pc->orig_col); cur_as->Add(pc); } } as.End(); asf.End(); } /** * Aligns all assignment operators on the same level as first, starting with * first. * * For variable definitions, only consider the '=' for the first variable. * Otherwise, only look at the first '=' on the line. */ chunk_t *align_assign(chunk_t *first, int span, int thresh) { int my_level; chunk_t *pc; int tmp; int var_def_cnt = 0; int equ_count = 0; if (first == NULL) { return(NULL); } my_level = first->level; if (span <= 0) { return(chunk_get_next(first)); } LOG_FMT(LALASS, "%s[%d]: checking %s on line %d - span=%d thresh=%d\n", __func__, my_level, first->str.c_str(), first->orig_line, span, thresh); AlignStack as; // regular assigns AlignStack vdas; // variable def assigns /* If we are aligning on a tabstop, we shouldn't right-align */ as.Start(span, thresh); as.m_right_align = !cpd.settings[UO_align_on_tabstop].b; vdas.Start(span, thresh); vdas.m_right_align = as.m_right_align; pc = first; while ((pc != NULL) && ((pc->level >= my_level) || (pc->level == 0))) { /* Don't check inside PAREN or SQUARE groups */ if ((pc->type == CT_SPAREN_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->type == CT_SQUARE_OPEN) || (pc->type == CT_PAREN_OPEN)) { tmp = pc->orig_line; pc = chunk_skip_to_match(pc); if (pc != NULL) { as.NewLines(pc->orig_line - tmp); vdas.NewLines(pc->orig_line - tmp); } continue; } /* Recurse if a brace set is found */ if ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_VBRACE_OPEN)) { int myspan; int mythresh; tmp = pc->orig_line; if (pc->parent_type == CT_ENUM) { myspan = cpd.settings[UO_align_enum_equ_span].n; mythresh = cpd.settings[UO_align_enum_equ_thresh].n; } else { myspan = cpd.settings[UO_align_assign_span].n; mythresh = cpd.settings[UO_align_assign_thresh].n; } pc = align_assign(chunk_get_next_ncnl(pc), myspan, mythresh); if (pc != NULL) { /* do a rough count of the number of lines just spanned */ as.NewLines(pc->orig_line - tmp); vdas.NewLines(pc->orig_line - tmp); } continue; } if (chunk_is_newline(pc)) { as.NewLines(pc->nl_count); vdas.NewLines(pc->nl_count); var_def_cnt = 0; equ_count = 0; } else if ((pc->flags & PCF_VAR_DEF) != 0) { var_def_cnt++; } else if (var_def_cnt > 1) { /* we hit the second variable def - don't look for assigns */ } else if ((equ_count == 0) && (pc->type == CT_ASSIGN)) { //fprintf(stderr, "%s: ** %s level=%d line=%d col=%d prev=%d count=%d\n", // __func__, pc->str, pc->level, pc->orig_line, pc->orig_col, prev_equ_type, // equ_count); equ_count++; if (var_def_cnt != 0) { vdas.Add(pc); } else { as.Add(pc); } } pc = chunk_get_next(pc); } as.End(); vdas.End(); if (pc != NULL) { LOG_FMT(LALASS, "%s: done on %s on line %d\n", __func__, pc->str.c_str(), pc->orig_line); } else { LOG_FMT(LALASS, "%s: done on NULL\n", __func__); } return(pc); } /** * Counts how many '*' pointers are in a row, going backwards * * @param pc Pointer to the last '*' in the series * @return The count, including the current one */ int count_prev_ptr_type(chunk_t *pc) { int count = 0; while ((pc != NULL) && (pc->type == CT_PTR_TYPE)) { count++; pc = chunk_get_prev_nc(pc); } return(count); } static chunk_t *align_func_param(chunk_t *start) { AlignStack as; chunk_t *pc = start; as.Start(2, 0); as.m_star_style = (AlignStack::StarStyle)cpd.settings[UO_align_var_def_star_style].n; as.m_amp_style = (AlignStack::StarStyle)cpd.settings[UO_align_var_def_amp_style].n; bool did_this_line = false; int comma_count = 0; int chunk_count = 0; while ((pc = chunk_get_next(pc)) != NULL) { chunk_count++; if (chunk_is_newline(pc)) { did_this_line = false; comma_count = 0; chunk_count = 0; } else if (pc->level <= start->level) { break; } else if (!did_this_line && (pc->flags & PCF_VAR_DEF)) { if (chunk_count > 1) { as.Add(pc); } did_this_line = true; } else if (comma_count > 0) { if (!chunk_is_comment(pc)) { comma_count = 2; break; } } else if (pc->type == CT_COMMA) { comma_count++; } } if (comma_count <= 1) { as.End(); } return(pc); } static void align_func_params() { chunk_t *pc; pc = chunk_get_head(); while ((pc = chunk_get_next(pc)) != NULL) { if ((pc->type != CT_FPAREN_OPEN) || ((pc->parent_type != CT_FUNC_PROTO) && (pc->parent_type != CT_FUNC_DEF) && (pc->parent_type != CT_FUNC_CLASS) && (pc->parent_type != CT_TYPEDEF))) { continue; } /* We're on a open paren of a prototype */ pc = align_func_param(pc); } } static void align_params(chunk_t *start, deque& chunks) { chunk_t *pc = start; bool hit_comma = true; chunks.clear(); pc = chunk_get_next_type(start, CT_FPAREN_OPEN, start->level); while ((pc = chunk_get_next(pc)) != NULL) { if (chunk_is_newline(pc) || (pc->type == CT_SEMICOLON) || ((pc->type == CT_FPAREN_CLOSE) && (pc->level == start->level))) { break; } if (pc->level == (start->level + 1)) { if (hit_comma) { chunks.push_back(pc); hit_comma = false; } else if (pc->type == CT_COMMA) { hit_comma = true; } } } } static void align_same_func_call_params() { chunk_t *pc; chunk_t *align_root = NULL; chunk_t *align_cur = NULL; int align_len = 0; deque chunks; deque as; AlignStack fcn_as; int idx; const char *add_str; fcn_as.Start(3); for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type != CT_FUNC_CALL) { if (chunk_is_newline(pc)) { for (idx = 0; idx <= (int)as.size(); idx++) { as[idx].NewLines(pc->nl_count); } fcn_as.NewLines(pc->nl_count); } continue; } /* Only align function calls that are right after a newline */ if (!chunk_is_newline(chunk_get_prev(pc))) { continue; } add_str = NULL; if (align_root != NULL) { if (pc->str.equals(align_root->str)) { fcn_as.Add(pc); align_cur->align.next = pc; align_cur = pc; align_len++; add_str = " Add"; } else { LOG_FMT(LASFCP, " ++ Ended with %d fcns\n", align_len); /* Flush it all! */ fcn_as.Flush(); for (idx = 0; idx < (int)as.size(); idx++) { as[idx].Flush(); } align_root = NULL; } } if (align_root == NULL) { fcn_as.Add(pc); align_root = pc; align_cur = pc; align_len = 1; add_str = "Start"; } if (add_str != NULL) { LOG_FMT(LASFCP, "%s '%s' on line %d -", add_str, pc->str.c_str(), pc->orig_line); align_params(pc, chunks); LOG_FMT(LASFCP, " %d items:", (int)chunks.size()); for (idx = 0; idx < (int)chunks.size(); idx++) { LOG_FMT(LASFCP, " [%s]", chunks[idx]->str.c_str()); if (idx >= (int)as.size()) { as.resize(idx + 1); as[idx].Start(3); if (!cpd.settings[UO_align_number_left].b) { if ((chunks[idx]->type == CT_NUMBER_FP) || (chunks[idx]->type == CT_NUMBER) || (chunks[idx]->type == CT_POS) || (chunks[idx]->type == CT_NEG)) { as[idx].m_right_align = !cpd.settings[UO_align_on_tabstop].b; } } } as[idx].Add(chunks[idx]); } LOG_FMT(LASFCP, "\n"); } } if (align_len > 1) { LOG_FMT(LASFCP, " ++ Ended with %d fcns\n", align_len); fcn_as.End(); for (idx = 0; idx < (int)as.size(); idx++) { as[idx].End(); } } } chunk_t *step_back_over_member(chunk_t *pc) { chunk_t *tmp; /* Skip over any class stuff: bool CFoo::bar() */ while (((tmp = chunk_get_prev_ncnl(pc)) != NULL) && (tmp->type == CT_DC_MEMBER)) { /* TODO: verify that we are pointing at something sane? */ pc = chunk_get_prev_ncnl(tmp); } return(pc); } /** * Aligns all function prototypes in the file. */ static void align_func_proto(int span) { chunk_t *pc; chunk_t *toadd; bool look_bro = false; AlignStack as; AlignStack as_br; LOG_FMT(LALIGN, "%s\n", __func__); as.Start(span, 0); as.m_gap = cpd.settings[UO_align_func_proto_gap].n; as_br.Start(span, 0); as_br.m_gap = cpd.settings[UO_align_single_line_brace_gap].n; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (chunk_is_newline(pc)) { look_bro = false; as.NewLines(pc->nl_count); as_br.NewLines(pc->nl_count); } else if ((pc->type == CT_FUNC_PROTO) || ((pc->type == CT_FUNC_DEF) && cpd.settings[UO_align_single_line_func].b)) { if ((pc->parent_type == CT_OPERATOR) && cpd.settings[UO_align_on_operator].b) { toadd = chunk_get_prev_ncnl(pc); } else { toadd = pc; } as.Add(step_back_over_member(toadd)); look_bro = (pc->type == CT_FUNC_DEF) && cpd.settings[UO_align_single_line_brace].b; } else if (look_bro && (pc->type == CT_BRACE_OPEN) && (pc->flags & PCF_ONE_LINER)) { as_br.Add(pc); look_bro = false; } } as.End(); as_br.End(); } /** * Scan everything at the current level until the close brace and find the * variable def align column. Also aligns bit-colons, but that assumes that * bit-types are the same! But that should always be the case... */ static chunk_t *align_var_def_brace(chunk_t *start, int span, int *p_nl_count) { chunk_t *pc; chunk_t *next; chunk_t *prev; UINT64 align_mask = PCF_IN_FCN_DEF | PCF_VAR_1ST; int myspan = span; int mythresh = 0; int mygap = 0; AlignStack as; /* var/proto/def */ AlignStack as_bc; /* bit-colon */ AlignStack as_at; /* attribute */ AlignStack as_br; /* one-liner brace open */ bool fp_active = cpd.settings[UO_align_mix_var_proto].b; bool fp_look_bro = false; if (start == NULL) { return(NULL); } /* Override the span, if this is a struct/union */ if ((start->parent_type == CT_STRUCT) || (start->parent_type == CT_UNION)) { myspan = cpd.settings[UO_align_var_struct_span].n; mythresh = cpd.settings[UO_align_var_struct_thresh].n; mygap = cpd.settings[UO_align_var_struct_gap].n; } else { mythresh = cpd.settings[UO_align_var_def_thresh].n; mygap = cpd.settings[UO_align_var_def_gap].n; } /* can't be any variable definitions in a "= {" block */ prev = chunk_get_prev_ncnl(start); if ((prev != NULL) && (prev->type == CT_ASSIGN)) { LOG_FMT(LAVDB, "%s: start=%s [%s] on line %d (abort due to assign)\n", __func__, start->str.c_str(), get_token_name(start->type), start->orig_line); pc = chunk_get_next_type(start, CT_BRACE_CLOSE, start->level); return(chunk_get_next_ncnl(pc)); } LOG_FMT(LAVDB, "%s: start=%s [%s] on line %d\n", __func__, start->str.c_str(), get_token_name(start->type), start->orig_line); if (!cpd.settings[UO_align_var_def_inline].b) { align_mask |= PCF_VAR_INLINE; } /* Set up the var/proto/def aligner */ as.Start(myspan, mythresh); as.m_gap = mygap; as.m_star_style = (AlignStack::StarStyle)cpd.settings[UO_align_var_def_star_style].n; as.m_amp_style = (AlignStack::StarStyle)cpd.settings[UO_align_var_def_amp_style].n; /* Set up the bit colon aligner */ as_bc.Start(myspan, 0); as_bc.m_gap = cpd.settings[UO_align_var_def_colon_gap].n; as_at.Start(myspan, 0); /* Set up the brace open aligner */ as_br.Start(myspan, mythresh); as_br.m_gap = cpd.settings[UO_align_single_line_brace_gap].n; bool did_this_line = false; pc = chunk_get_next(start); while ((pc != NULL) && ((pc->level >= start->level) || (pc->level == 0))) { if (chunk_is_comment(pc)) { if (pc->nl_count > 0) { as.NewLines(pc->nl_count); as_bc.NewLines(pc->nl_count); as_at.NewLines(pc->nl_count); as_br.NewLines(pc->nl_count); } pc = chunk_get_next(pc); continue; } if (fp_active) { if ((pc->type == CT_FUNC_PROTO) || ((pc->type == CT_FUNC_DEF) && cpd.settings[UO_align_single_line_func].b)) { LOG_FMT(LAVDB, " add=[%s] line=%d col=%d level=%d\n", pc->str.c_str(), pc->orig_line, pc->orig_col, pc->level); as.Add(pc); fp_look_bro = (pc->type == CT_FUNC_DEF) && cpd.settings[UO_align_single_line_brace].b; } else if (fp_look_bro && (pc->type == CT_BRACE_OPEN) && (pc->flags & PCF_ONE_LINER)) { as_br.Add(pc); fp_look_bro = false; } } /* process nested braces */ if (pc->type == CT_BRACE_OPEN) { int sub_nl_count = 0; pc = align_var_def_brace(pc, span, &sub_nl_count); if (sub_nl_count > 0) { fp_look_bro = false; did_this_line = false; as.NewLines(sub_nl_count); as_bc.NewLines(sub_nl_count); as_at.NewLines(sub_nl_count); as_br.NewLines(sub_nl_count); if (p_nl_count != NULL) { *p_nl_count += sub_nl_count; } } continue; } /* Done with this brace set? */ if (pc->type == CT_BRACE_CLOSE) { pc = chunk_get_next(pc); break; } if (chunk_is_newline(pc)) { fp_look_bro = false; did_this_line = false; as.NewLines(pc->nl_count); as_bc.NewLines(pc->nl_count); as_at.NewLines(pc->nl_count); as_br.NewLines(pc->nl_count); if (p_nl_count != NULL) { *p_nl_count += pc->nl_count; } } /* don't align stuff inside parens/squares/angles */ if (pc->level > pc->brace_level) { pc = chunk_get_next(pc); continue; } /* If this is a variable def, update the max_col */ if ((pc->type != CT_FUNC_CLASS) && ((pc->flags & align_mask) == PCF_VAR_1ST) && ((pc->level == (start->level + 1)) || (pc->level == 0))) { if (!did_this_line) { LOG_FMT(LAVDB, " add=[%s] line=%d col=%d level=%d\n", pc->str.c_str(), pc->orig_line, pc->orig_col, pc->level); as.Add(step_back_over_member(pc)); if (cpd.settings[UO_align_var_def_colon].b) { next = chunk_get_next_nc(pc); if (next->type == CT_BIT_COLON) { as_bc.Add(next); } } if (cpd.settings[UO_align_var_def_attribute].b) { next = pc; while ((next = chunk_get_next_nc(next)) != NULL) { if (next->type == CT_ATTRIBUTE) { as_at.Add(next); break; } if ((next->type == CT_SEMICOLON) || chunk_is_newline(next)) { break; } } } } did_this_line = true; } else if (pc->type == CT_BIT_COLON) { if (!did_this_line) { as_bc.Add(pc); did_this_line = true; } } pc = chunk_get_next(pc); } as.End(); as_bc.End(); as_at.End(); as_br.End(); return(pc); } /** * For a series of lines ending in backslash-newline, align them. * The series ends when a newline or multi-line C comment is encountered. * * @param start Start point * @return pointer the last item looked at (NULL/newline/comment) */ chunk_t *align_nl_cont(chunk_t *start) { int max_col = 0; chunk_t *pc = start; chunk_t *tmp; ChunkStack cs; LOG_FMT(LALNLC, "%s: start on [%s] on line %d\n", __func__, get_token_name(start->type), start->orig_line); /* Find the max column */ while ((pc != NULL) && (pc->type != CT_NEWLINE) && (pc->type != CT_COMMENT_MULTI)) { if (pc->type == CT_NL_CONT) { align_add(cs, pc, max_col, 1, true); } pc = chunk_get_next(pc); } /* NL_CONT is always the last thing on a line */ while ((tmp = cs.Pop()) != NULL) { tmp->flags |= PCF_WAS_ALIGNED; tmp->column = max_col; } return(pc); } enum CmtAlignType { CAT_REGULAR, CAT_BRACE, CAT_ENDIF, }; static CmtAlignType get_comment_align_type(chunk_t *cmt) { chunk_t *prev; CmtAlignType cmt_type = CAT_REGULAR; if (!cpd.settings[UO_align_right_cmt_mix].b && ((prev = chunk_get_prev(cmt)) != NULL)) { if ((prev->type == CT_PP_ENDIF) || (prev->type == CT_PP_ELSE) || (prev->type == CT_ELSE) || (prev->type == CT_BRACE_CLOSE)) { /* REVISIT: someone may want this configurable */ if ((cmt->column - (prev->column + prev->len())) < 3) { cmt_type = (prev->type == CT_PP_ENDIF) ? CAT_ENDIF : CAT_BRACE; } } } return(cmt_type); } /** * For a series of lines ending in a comment, align them. * The series ends when more than align_right_cmt_span newlines are found. * * Interesting info: * - least pysically allowed column * - intended column * - least original cmt column * * min_col is the minimum allowed column (based on prev token col/size) * cmt_col less than * * @param start Start point * @return pointer the last item looked at */ chunk_t *align_trailing_comments(chunk_t *start) { int min_col = 0; int min_orig = -1; chunk_t *pc = start; int nl_count = 0; ChunkStack cs; CmtAlignType cmt_type_start, cmt_type_cur; int col; int intended_col = cpd.settings[UO_align_right_cmt_at_col].n; cmt_type_start = get_comment_align_type(pc); LOG_FMT(LALADD, "%s: start on line=%d\n", __func__, pc->orig_line); /* Find the max column */ while ((pc != NULL) && (nl_count < cpd.settings[UO_align_right_cmt_span].n)) { if (((pc->flags & PCF_RIGHT_COMMENT) != 0) && (pc->column > 1)) { cmt_type_cur = get_comment_align_type(pc); if (cmt_type_cur == cmt_type_start) { col = 1 + (pc->brace_level * cpd.settings[UO_indent_columns].n); LOG_FMT(LALADD, "%s: line=%d col=%d max_col=%d pc->col=%d pc->len=%d %s\n", __func__, pc->orig_line, col, min_col, pc->column, pc->len(), get_token_name(pc->type)); if ((min_orig < 0) || (min_orig > pc->column)) { min_orig = pc->column; } if (pc->column < col) { pc->column = col; } align_add(cs, pc, min_col, 1, true);//(intended_col < col)); nl_count = 0; } } if (chunk_is_newline(pc)) { nl_count += pc->nl_count; } pc = chunk_get_next(pc); } /* Start with the minimum original column */ col = min_orig; /* fall back to the intended column */ if ((intended_col > 0) && (col > intended_col)) { col = intended_col; } /* if less than allowed, bump it out */ if (col < min_col) { col = min_col; } /* bump out to the intended column */ if (col < intended_col) { col = intended_col; } LOG_FMT(LALADD, "%s: -- min_orig=%d intend=%d min_allowed=%d ==> col=%d\n", __func__, min_orig, intended_col, min_col, col); align_stack(cs, col, (intended_col != 0), LALTC); return(chunk_get_next(pc)); } /** * Shifts out all columns by a certain amount. * * @param idx The index to start shifting * @param num The number of columns to shift */ void ib_shift_out(int idx, int num) { while (idx < cpd.al_cnt) { cpd.al[idx].col += num; idx++; } } /** * Scans a line for stuff to align on. * * We trigger on BRACE_OPEN, FPAREN_OPEN, ASSIGN, and COMMA. * We want to align the NEXT item. */ static chunk_t *scan_ib_line(chunk_t *start, bool first_pass) { chunk_t *pc; chunk_t *next; chunk_t *prev_match = NULL; int token_width; int idx = 0; bool last_was_comment = false; /* Skip past C99 "[xx] =" stuff */ if (start->type == CT_SQUARE_OPEN) { start->parent_type = CT_TSQUARE; start = chunk_get_next_type(start, CT_ASSIGN, start->level); start = chunk_get_next_ncnl(start); cpd.al_c99_array = true; } pc = start; if (pc != NULL) { LOG_FMT(LSIB, "%s: start=%s col %d/%d line %d\n", __func__, get_token_name(pc->type), pc->column, pc->orig_col, pc->orig_line); } while ((pc != NULL) && !chunk_is_newline(pc) && (pc->level >= start->level)) { //LOG_FMT(LSIB, "%s: '%s' col %d/%d line %d\n", __func__, // pc->str.c_str(), pc->column, pc->orig_col, pc->orig_line); next = chunk_get_next(pc); if ((next == NULL) || chunk_is_comment(next)) { /* do nothing */ } else if ((pc->type == CT_ASSIGN) || (pc->type == CT_BRACE_OPEN) || (pc->type == CT_BRACE_CLOSE) || (pc->type == CT_COMMA)) { token_width = space_col_align(pc, next); /*TODO: need to handle missing structure defs? ie NULL vs { ... } ?? */ /* Is this a new entry? */ if (idx >= cpd.al_cnt) { LOG_FMT(LSIB, " - New [%d] %.2d/%d - %10.10s\n", idx, pc->column, token_width, get_token_name(pc->type)); cpd.al[cpd.al_cnt].type = pc->type; cpd.al[cpd.al_cnt].col = pc->column; cpd.al[cpd.al_cnt].len = token_width; cpd.al_cnt++; idx++; last_was_comment = false; } else { /* expect to match stuff */ if (cpd.al[idx].type == pc->type) { LOG_FMT(LSIB, " - Match [%d] %.2d/%d - %10.10s", idx, pc->column, token_width, get_token_name(pc->type)); /* Shift out based on column */ if (prev_match == NULL) { if (pc->column > cpd.al[idx].col) { LOG_FMT(LSIB, " [ pc->col(%d) > col(%d) ] ", pc->column, cpd.al[idx].col); ib_shift_out(idx, pc->column - cpd.al[idx].col); cpd.al[idx].col = pc->column; } } else if (idx > 0) { int min_col_diff = pc->column - prev_match->column; int cur_col_diff = cpd.al[idx].col - cpd.al[idx - 1].col; if (cur_col_diff < min_col_diff) { LOG_FMT(LSIB, " [ min_col_diff(%d) > cur_col_diff(%d) ] ", min_col_diff, cur_col_diff); ib_shift_out(idx, min_col_diff - cur_col_diff); } } LOG_FMT(LSIB, " - now col %d, len %d\n", cpd.al[idx].col, cpd.al[idx].len); idx++; } } prev_match = pc; } last_was_comment = chunk_is_comment(pc); pc = chunk_get_next_nc(pc); } //if (last_was_comment && (cpd.al[cpd.al_cnt - 1].type == CT_COMMA)) //{ // cpd.al_cnt--; //} return(pc); } static void align_log_al(log_sev_t sev, int line) { int idx; if (log_sev_on(sev)) { log_fmt(sev, "%s: line %d, %d)", __func__, line, cpd.al_cnt); for (idx = 0; idx < cpd.al_cnt; idx++) { log_fmt(sev, " %d/%d=%s", cpd.al[idx].col, cpd.al[idx].len, get_token_name(cpd.al[idx].type)); } log_fmt(sev, "\n"); } } /** * Generically aligns on '=', '{', '(' and item after ',' * It scans the first line and picks up the location of those tags. * It then scans subsequent lines and adjusts the column. * Finally it does a second pass to align everything. * * Aligns all the '=' signs in stucture assignments. * a = { * .a = 1; * .type = fast; * }; * * And aligns on '{', numbers, strings, words. * colors[] = { * {"red", {255, 0, 0}}, {"blue", { 0, 255, 0}}, * {"green", { 0, 0, 255}}, {"purple", {255, 255, 0}}, * }; * * For the C99 indexed array assignment, the leading []= is skipped (no aligning) * struct foo_t bars[] = * { * [0] = { .name = "bar", * .age = 21 }, * [1] = { .name = "barley", * .age = 55 }, * }; * * NOTE: this assumes that spacing is at the minimum correct spacing (ie force) * if it isn't, some extra spaces will be inserted. * * @param start Points to the open brace chunk */ static void align_init_brace(chunk_t *start) { int idx; chunk_t *pc; chunk_t *next; chunk_t *prev; chunk_t *num_token = NULL; cpd.al_cnt = 0; cpd.al_c99_array = false; LOG_FMT(LALBR, "%s: line %d, col %d\n", __func__, start->orig_line, start->orig_col); pc = chunk_get_next_ncnl(start); pc = scan_ib_line(pc, true); if ((pc == NULL) || ((pc->type == CT_BRACE_CLOSE) && (pc->parent_type == CT_ASSIGN))) { /* single line - nothing to do */ return; } do { pc = scan_ib_line(pc, false); /* debug dump the current frame */ align_log_al(LALBR, pc->orig_line); while (chunk_is_newline(pc)) { pc = chunk_get_next(pc); } } while ((pc != NULL) && (pc->level > start->level)); /* debug dump the current frame */ align_log_al(LALBR, start->orig_line); if (cpd.settings[UO_align_on_tabstop].b && (cpd.al_cnt >= 1) && (cpd.al[0].type == CT_ASSIGN)) { cpd.al[0].col = align_tab_column(cpd.al[0].col); } pc = chunk_get_next(start); idx = 0; do { if ((idx == 0) && (pc->type == CT_SQUARE_OPEN)) { pc = chunk_get_next_type(pc, CT_ASSIGN, pc->level); pc = chunk_get_next(pc); if (pc != NULL) { LOG_FMT(LALBR, " -%d- skipped '[] =' to %s\n", pc->orig_line, get_token_name(pc->type)); } continue; } next = pc; if (idx < cpd.al_cnt) { LOG_FMT(LALBR, " (%d) check %s vs %s -- ", idx, get_token_name(pc->type), get_token_name(cpd.al[idx].type)); if (pc->type == cpd.al[idx].type) { if ((idx == 0) && cpd.al_c99_array) { prev = chunk_get_prev(pc); if (chunk_is_newline(prev)) { pc->flags |= PCF_DONT_INDENT; } } LOG_FMT(LALBR, " [%s] to col %d\n", pc->str.c_str(), cpd.al[idx].col); if (num_token != NULL) { int col_diff = pc->column - num_token->column; reindent_line(num_token, cpd.al[idx].col - col_diff); //LOG_FMT(LSYS, "-= %d =- NUM indent [%s] col=%d diff=%d\n", // num_token->orig_line, // num_token->str.c_str(), cpd.al[idx - 1].col, col_diff); num_token->flags |= PCF_WAS_ALIGNED; num_token = NULL; } /* Comma's need to 'fall back' to the previous token */ if (pc->type == CT_COMMA) { next = chunk_get_next(pc); if ((next != NULL) && !chunk_is_newline(next)) { //LOG_FMT(LSYS, "-= %d =- indent [%s] col=%d len=%d\n", // next->orig_line, // next->str.c_str(), cpd.al[idx].col, cpd.al[idx].len); if ((idx < (cpd.al_cnt - 1)) && cpd.settings[UO_align_number_left].b && ((next->type == CT_NUMBER_FP) || (next->type == CT_NUMBER) || (next->type == CT_POS) || (next->type == CT_NEG))) { /* Need to wait until the next match to indent numbers */ num_token = next; } else { reindent_line(next, cpd.al[idx].col + cpd.al[idx].len); next->flags |= PCF_WAS_ALIGNED; } } } else { /* first item on the line */ reindent_line(pc, cpd.al[idx].col); pc->flags |= PCF_WAS_ALIGNED; /* see if we need to right-align a number */ if ((idx < (cpd.al_cnt - 1)) && cpd.settings[UO_align_number_left].b) { next = chunk_get_next(pc); if ((next != NULL) && !chunk_is_newline(next) && ((next->type == CT_NUMBER_FP) || (next->type == CT_NUMBER) || (next->type == CT_POS) || (next->type == CT_NEG))) { /* Need to wait until the next match to indent numbers */ num_token = next; } } } idx++; } else { LOG_FMT(LALBR, " no match\n"); } } if (chunk_is_newline(pc) || chunk_is_newline(next)) { idx = 0; } pc = chunk_get_next(pc); } while ((pc != NULL) && (pc->level > start->level)); } /** * Aligns simple typedefs that are contained on a single line each. * This should be called after the typedef target is marked as a type. * * Won't align function typedefs. * * typedef int foo_t; * typedef char bar_t; * typedef const char cc_t; */ static void align_typedefs(int span) { chunk_t *pc; chunk_t *c_type = NULL; chunk_t *c_typedef = NULL; AlignStack as; as.Start(span); as.m_gap = cpd.settings[UO_align_typedef_gap].n; as.m_star_style = (AlignStack::StarStyle)cpd.settings[UO_align_typedef_star_style].n; as.m_amp_style = (AlignStack::StarStyle)cpd.settings[UO_align_typedef_amp_style].n; pc = chunk_get_head(); while (pc != NULL) { if (chunk_is_newline(pc)) { as.NewLines(pc->nl_count); c_typedef = NULL; } else if (c_typedef != NULL) { if (pc->flags & PCF_ANCHOR) { as.Add(pc); c_typedef = NULL; } } else { if (pc->type == CT_TYPEDEF) { LOG_FMT(LALTD, "%s: line %d, col %d\n", __func__, pc->orig_line, pc->orig_col); c_typedef = pc; c_type = NULL; } } pc = chunk_get_next(pc); } as.End(); } /** * Align '<<' (CT_ARITH?) */ static void align_left_shift(void) { chunk_t *pc; chunk_t *start = NULL; AlignStack as; as.Start(2); pc = chunk_get_head(); while (pc != NULL) { if (chunk_is_newline(pc)) { as.NewLines(pc->nl_count); } else if ((start != NULL) && (pc->level < start->level)) { /* A drop in level restarts the aligning */ as.Flush(); start = NULL; } else if ((start != NULL) && (pc->level > start->level)) { /* Ignore any deeper levels when aligning */ } else if (pc->type == CT_SEMICOLON) { /* A semicolon at the same level flushes */ as.Flush(); start = NULL; } else if (chunk_is_str(pc, "<<", 2)) { if (as.m_aligned.Empty()) { /* first one can be anywhere */ as.Add(pc); start = pc; } else if (chunk_is_newline(chunk_get_prev(pc))) { /* subsequent ones must be after a newline */ as.Add(pc); } } pc = chunk_get_next(pc); } as.End(); } /** * Aligns an OC message * * @param so the square open of the message * @param span the span value */ static void align_oc_msg_colon(chunk_t *so) { int span = cpd.settings[UO_align_oc_msg_colon_span].n; chunk_t *pc; chunk_t *tmp; AlignStack cas; /* for the colons */ AlignStack nas; /* for the parameter tag */ int level; bool did_line; int lcnt; /* line count with no colon for span */ bool has_colon; nas.Reset(); nas.m_right_align = !cpd.settings[UO_align_on_tabstop].b; cas.Start(span); level = so->level; pc = chunk_get_next_ncnl(so, CNAV_PREPROC); did_line = false; has_colon = false; lcnt = 0; while ((pc != NULL) && (pc->level > level)) { if (pc->level > (level + 1)) { /* do nothing */ } else if (chunk_is_newline(pc)) { if (!has_colon) { ++lcnt; } did_line = false; has_colon = !has_colon; } else if (!did_line && (lcnt - 1 < span) && (pc->type == CT_OC_COLON)) { has_colon = true; cas.Add(pc); tmp = chunk_get_prev(pc); if ((tmp != NULL) && ((tmp->type == CT_OC_MSG_FUNC) || (tmp->type == CT_OC_MSG_NAME))) { nas.Add(tmp); } did_line = true; } pc = chunk_get_next(pc, CNAV_PREPROC); } nas.End(); cas.End(); } /** * Aligns OC messages */ static void align_oc_msg_colons() { chunk_t *pc; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if ((pc->type == CT_SQUARE_OPEN) && (pc->parent_type == CT_OC_MSG)) { align_oc_msg_colon(pc); } } } /** * Aligns OC declarations on the colon * -(void) doSomething: (NSString*) param1 * with: (NSString*) param2 */ static void align_oc_decl_colon(void) { chunk_t *pc = chunk_get_head(); chunk_t *tmp; chunk_t *tmp2; AlignStack cas; /* for the colons */ AlignStack nas; /* for the parameter label */ int level; bool did_line; cas.Start(4); nas.Start(4); nas.m_right_align = !cpd.settings[UO_align_on_tabstop].b; while (pc != NULL) { if (pc->type != CT_OC_SCOPE) { pc = chunk_get_next(pc); continue; } nas.Reset(); cas.Reset(); level = pc->level; pc = chunk_get_next_ncnl(pc, CNAV_PREPROC); did_line = false; while ((pc != NULL) && (pc->level >= level)) { /* The decl ends with an open brace or semicolon */ if ((pc->type == CT_BRACE_OPEN) || chunk_is_semicolon(pc)) { break; } if (chunk_is_newline(pc)) { nas.NewLines(pc->nl_count); cas.NewLines(pc->nl_count); did_line = false; } else if (!did_line && (pc->type == CT_OC_COLON)) { cas.Add(pc); tmp = chunk_get_prev(pc, CNAV_PREPROC); tmp2 = chunk_get_prev_ncnl(tmp, CNAV_PREPROC); /* Check for an un-labeled parameter */ if ((tmp != NULL) && (tmp2 != NULL) && ((tmp->type == CT_WORD) || (tmp->type == CT_TYPE) || (tmp->type == CT_OC_MSG_DECL)) && ((tmp2->type == CT_WORD) || (tmp2->type == CT_TYPE) || (tmp2->type == CT_PAREN_CLOSE))) { nas.Add(tmp); } did_line = true; } pc = chunk_get_next(pc, CNAV_PREPROC); } nas.End(); cas.End(); } } uncrustify-0.59/src/sorting.cpp0000644000175000017500000000750111630457175013577 00000000000000/** * @file braces.cpp * Adds or removes braces. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" /** * Compare two series of chunks, starting with the given ones. */ static int compare_chunks(chunk_t *pc1, chunk_t *pc2) { if (pc1 == pc2) { return(0); } while ((pc1 != NULL) && (pc2 != NULL)) { int min_len = (pc1->len() < pc2->len()) ? pc1->len() : pc2->len(); int ret_val = unc_text::compare(pc1->str, pc2->str, min_len); if (ret_val != 0) { return(ret_val); } if (pc1->len() != pc2->len()) { return(pc1->len() - pc2->len()); } /* Same word, same length. Step to the next chunk. */ pc1 = chunk_get_next(pc1); pc2 = chunk_get_next(pc2); /* If we hit a newline or NULL, we are done */ if ((pc1 == NULL) || chunk_is_newline(pc1) || (pc2 == NULL) || chunk_is_newline(pc2)) { break; } } if ((pc1 == NULL) || !chunk_is_newline(pc2)) { return(-1); } if (!chunk_is_newline(pc1)) { return(1); } return(0); } /** * Sorting should be pretty rare and should usually only include a few chunks. * We need to minimize the number of swaps, as those are expensive. * So, we do a min sort. */ static void do_the_sort(chunk_t **chunks, int num_chunks) { int start_idx, min_idx, idx; LOG_FMT(LSORT, "%s: %d chunks:", __func__, num_chunks); for (idx = 0; idx < num_chunks; idx++) { LOG_FMT(LSORT, " [%s]", chunks[idx]->str.c_str()); } LOG_FMT(LSORT, "\n"); for (start_idx = 0; start_idx < (num_chunks - 1); start_idx++) { /* Find the index of the minimum value */ min_idx = start_idx; for (idx = start_idx + 1; idx < num_chunks; idx++) { if (compare_chunks(chunks[idx], chunks[min_idx]) < 0) { min_idx = idx; } } /* Swap the lines if the minimum isn't the first entry */ if (min_idx != start_idx) { chunk_swap_lines(chunks[start_idx], chunks[min_idx]); /* Don't need to swap, since we only want the side-effects */ chunks[min_idx] = chunks[start_idx]; } } } void sort_imports(void) { chunk_t *chunks[256]; /* 256 should be enough, right? */ int num_chunks = 0; chunk_t *pc; chunk_t *next; chunk_t *p_last = NULL; chunk_t *p_imp = NULL; pc = chunk_get_head(); while (pc != NULL) { next = chunk_get_next(pc); if (chunk_is_newline(pc)) { bool did_import = false; if ((p_imp != NULL) && (p_last != NULL) && ((p_last->type == CT_SEMICOLON) || (p_imp->flags & PCF_IN_PREPROC))) { if (num_chunks < (int)ARRAY_SIZE(chunks)) { chunks[num_chunks++] = p_imp; } did_import = true; } if (!did_import || (pc->nl_count > 1)) { if (num_chunks > 1) { do_the_sort(chunks, num_chunks); } num_chunks = 0; memset(chunks, 0, sizeof(chunks)); } p_imp = NULL; p_last = NULL; } else if (pc->type == CT_IMPORT) { if (cpd.settings[UO_mod_sort_import].b) { p_imp = chunk_get_next(pc); } } else if (pc->type == CT_USING) { if (cpd.settings[UO_mod_sort_using].b) { p_imp = chunk_get_next(pc); } } else if (pc->type == CT_PP_INCLUDE) { if (cpd.settings[UO_mod_sort_include].b) { p_imp = chunk_get_next(pc); p_last = pc; } } else if (!chunk_is_comment(pc)) { p_last = pc; } pc = next; } } uncrustify-0.59/src/token_enum.h0000644000175000017500000002542511631562113013716 00000000000000/** * @file token_enum.h * List of the different tokens used in the program. * * @author Ben Gardner * @license GPL v2+ */ #ifndef TOKEN_ENUM_H_INCLUDED #define TOKEN_ENUM_H_INCLUDED /** * This is an enum of all the different chunks/tokens/elements that the * program can work with. The parser and scanner assigns one of these to * each chunk/token. * * The script 'make_token_names.sh' creates token_names.h, so be sure to run * that after adding or removing an entry. */ typedef enum { CT_NONE, CT_EOF, CT_UNKNOWN, CT_JUNK, /* junk collected when parsing is disabled */ CT_WHITESPACE, /* whitespace without any newlines */ CT_SPACE, /* a fixed number of spaces to support weird spacing rules */ CT_NEWLINE, /* CRA, one or more newlines */ CT_NL_CONT, /* CRA, backslash-newline */ CT_COMMENT_CPP, /* C++ comment (always followed by CT_NEWLINE) */ CT_COMMENT, /* C-comment, single line */ CT_COMMENT_MULTI, /* Multi-lined comment */ CT_COMMENT_EMBED, /* comment parent_type: non-newline before and after */ CT_COMMENT_START, /* comment parent_type: newline before */ CT_COMMENT_END, /* comment parent_type: newline after */ CT_COMMENT_WHOLE, /* comment parent_type: newline before and after */ CT_COMMENT_ENDIF, /* C-comment, single line, after ENDIF */ CT_IGNORED, /* a chunk of ignored text */ CT_WORD, /* variable, type, function name, etc */ CT_NUMBER, CT_NUMBER_FP, CT_STRING, /* quoted string "hi" or 'a' or for include */ CT_STRING_MULTI, /* quoted string with embedded newline */ CT_IF, /* built-in keywords */ CT_ELSE, CT_ELSEIF, CT_FOR, CT_WHILE, CT_WHILE_OF_DO, CT_SWITCH, CT_CASE, CT_DO, CT_VOLATILE, CT_TYPEDEF, CT_STRUCT, CT_ENUM, CT_SIZEOF, CT_RETURN, CT_BREAK, CT_UNION, CT_GOTO, CT_CONTINUE, CT_C_CAST, /* C-style cast: "(int)5.6" */ CT_CPP_CAST, /* C++-style cast: "int(5.6)" */ CT_D_CAST, /* D-style cast: "cast(type)" and "const(type)" */ CT_TYPE_CAST, /* static_cast(exp) */ CT_TYPENAME, /* typename type */ CT_TEMPLATE, /* template<...> */ CT_ASSIGN, /* =, +=, /=, etc */ CT_ASSIGN_NL, /* Assign followed by a newline - fake item for indenting */ CT_SASSIGN, /* 'and_eq' */ CT_COMPARE, /* ==, !=, <=, >= */ CT_SCOMPARE, /* compare op that is a string 'is', 'neq' */ CT_BOOL, /* || or && */ CT_SBOOL, /* or, and */ CT_ARITH, /* +, -, /, <<, etc */ CT_SARITH, /* 'not', 'xor' */ CT_DEREF, /* * dereference */ CT_INCDEC_BEFORE, /* ++a or --a */ CT_INCDEC_AFTER, /* a++ or a-- */ CT_MEMBER, /* . or -> */ CT_DC_MEMBER, /* :: */ CT_C99_MEMBER, /* . in structure stuff */ CT_INV, /* ~ */ CT_DESTRUCTOR, /* ~ */ CT_NOT, /* ! */ CT_D_TEMPLATE, /* ! as in Foo!(A) */ CT_ADDR, /* & */ CT_NEG, /* - as in -1 */ CT_POS, /* + as in +1 */ CT_STAR, /* * : raw char to be changed */ CT_PLUS, /* + : raw char to be changed */ CT_MINUS, /* - : raw char to be changed */ CT_AMP, /* & : raw char to be changed */ CT_BYREF, /* & in function def/proto params */ CT_POUND, /* # */ CT_PREPROC, /* # at the start of a line */ CT_PREPROC_INDENT, /* # at the start of a line that gets indented: #region */ CT_PREPROC_BODY, /* body of every preproc EXCEPT #define */ CT_PP, /* ## */ CT_ELLIPSIS, /* ... */ CT_RANGE, /* .. */ CT_SEMICOLON, CT_VSEMICOLON, /* virtual semicolon for PAWN */ CT_COLON, CT_CASE_COLON, CT_CLASS_COLON, /* colon after a class def or constructor */ CT_D_ARRAY_COLON, /* D named array initializer colon */ CT_COND_COLON, /* conditional colon in 'b ? t : f' */ CT_QUESTION, CT_COMMA, CT_ASM, CT_ATTRIBUTE, CT_CATCH, CT_CLASS, CT_DELETE, CT_EXPORT, CT_FRIEND, CT_NAMESPACE, CT_NEW, /* may turn into CT_PBRACED if followed by a '(' */ CT_OPERATOR, CT_OPERATOR_VAL, CT_PRIVATE, CT_PRIVATE_COLON, CT_THROW, CT_TRY, CT_USING, CT_USING_STMT, /* using (xxx) ... */ CT_D_WITH, /* D: paren+braced */ CT_D_MODULE, CT_SUPER, CT_DELEGATE, CT_BODY, CT_DEBUG, CT_DEBUGGER, CT_INVARIANT, CT_UNITTEST, CT_UNSAFE, CT_FINALLY, CT_IMPORT, CT_D_SCOPE, CT_D_SCOPE_IF, CT_LAZY, CT_D_MACRO, CT_D_VERSION, /* turns into CT_D_VERSION_IF if not followed by '=' */ CT_D_VERSION_IF, /* version(x) { } */ /* note for paren/brace/square pairs: close MUST be open + 1 */ CT_PAREN_OPEN, CT_PAREN_CLOSE, CT_ANGLE_OPEN, /* template */ CT_ANGLE_CLOSE, CT_SPAREN_OPEN, /* 'special' paren after if/for/switch/while */ CT_SPAREN_CLOSE, CT_FPAREN_OPEN, /* 'function' paren after fcn/macro fcn */ CT_FPAREN_CLOSE, CT_BRACE_OPEN, CT_BRACE_CLOSE, CT_VBRACE_OPEN, CT_VBRACE_CLOSE, CT_SQUARE_OPEN, CT_SQUARE_CLOSE, CT_TSQUARE, /* special case of [] */ CT_MACRO_OPEN, /* stuff specified via custom-pair */ CT_MACRO_CLOSE, CT_MACRO_ELSE, /* agregate types */ CT_LABEL, /* a non-case label */ CT_LABEL_COLON, /* the colon for a label */ CT_FUNCTION, /* function - unspecified, call mark_function() */ CT_FUNC_CALL, /* function call */ CT_FUNC_CALL_USER, /* function call (special user) */ CT_FUNC_DEF, /* function definition/implementation */ CT_FUNC_PROTO, /* function prototype */ CT_FUNC_CLASS, /* ctor or dtor for a class */ CT_FUNC_CTOR_VAR, /* variable or class initialization */ CT_FUNC_WRAP, /* macro that wraps the function name */ CT_MACRO_FUNC, /* function-like macro */ CT_MACRO, /* a macro def */ CT_QUALIFIER, /* static, const, etc */ CT_EXTERN, /* extern */ CT_ALIGN, /* paren'd qualifier: align(4) struct a { } */ CT_TYPE, CT_PTR_TYPE, /* a '*' as part of a type */ CT_TYPE_WRAP, /* macro that wraps a type name */ CT_BIT_COLON, /* a ':' in a variable declaration */ CT_OC_DYNAMIC, CT_OC_END, /* ObjC: @end */ CT_OC_IMPL, /* ObjC: @implementation */ CT_OC_INTF, /* ObjC: @interface */ CT_OC_PROTOCOL, /* ObjC: @protocol or @protocol() */ CT_OC_PROTO_LIST, /* ObjC: protocol list < > (parent token only) */ CT_OC_PROPERTY, /* ObjC: @property */ CT_OC_CLASS, /* ObjC: the name after @interface or @implementation */ CT_OC_CLASS_EXT, /* ObjC: a pair of empty parens after the class name in a @interface or @implementation */ CT_OC_CATEGORY, /* ObjC: the category name in parens after the class name in a @interface or @implementation */ CT_OC_SCOPE, /* ObjC: the '-' or '+' in '-(void) func: (int) i;' */ CT_OC_MSG, /* ObjC: parent type to '[', ']' and ';' in '[class func : param name: param];' */ CT_OC_MSG_CLASS, /* ObjC: 'class' in '[class func : param name: param];' (see also PCF_IN_OC_MSG) */ CT_OC_MSG_FUNC, /* ObjC: 'func' in '[class func : param name: param];' (see also PCF_IN_OC_MSG) */ CT_OC_MSG_NAME, /* ObjC: 'name' in '[class func : param name: param];' (see also PCF_IN_OC_MSG) */ CT_OC_MSG_SPEC, /* ObjC: msg spec '-(void) func: (int) i;' */ CT_OC_MSG_DECL, /* ObjC: msg decl '-(void) func: (int) i { }' */ CT_OC_RTYPE, /* ObjC: marks closing parens of the return type after scope */ CT_OC_COLON, /* ObjC: the colon in a msg spec */ CT_OC_SEL, /* ObjC: @selector */ CT_OC_SEL_NAME, /* ObjC: selector name */ CT_OC_BLOCK_ARG, /* ObjC: block arguments parent type. */ CT_OC_BLOCK_TYPE, /* ObjC: block declaration parent type, e.g. mainly the '(^block_t)' in 'void (^block_t)(int arg);' */ CT_OC_BLOCK_EXPR, /* ObjC: block expression with arg: '^(int arg) { arg++; };' and without (called a block literal): '^{ ... };' */ CT_OC_BLOCK_CARET, /* ObjC: block pointer caret: '^' */ /* start PP types */ CT_PP_DEFINE, /* #define */ CT_PP_DEFINED, /* #if defined */ CT_PP_INCLUDE, /* #include */ CT_PP_IF, /* #if, #ifdef, or #ifndef */ CT_PP_ELSE, /* #else or #elif */ CT_PP_ENDIF, /* #endif */ CT_PP_ASSERT, CT_PP_EMIT, CT_PP_ENDINPUT, CT_PP_ERROR, CT_PP_FILE, CT_PP_LINE, CT_PP_SECTION, CT_PP_UNDEF, CT_PP_BODYCHUNK, /* everything after this gets put in CT_PREPROC_BODY */ CT_PP_PRAGMA, /* pragma's should not be altered */ CT_PP_REGION, /* C# #region */ CT_PP_ENDREGION, /* C# #endregion */ CT_PP_REGION_INDENT, /* Dummy token for indenting a C# #region */ CT_PP_IF_INDENT, /* Dummy token for indenting a #if stuff */ CT_PP_OTHER, /* #line, #error, #pragma, etc */ /* end PP types */ /* PAWN stuff */ CT_CHAR, CT_DEFINED, CT_FORWARD, CT_NATIVE, CT_STATE, CT_STOCK, CT_TAGOF, CT_DOT, CT_TAG, CT_TAG_COLON, /* C-sharp crap */ CT_LOCK, /* lock/unlock */ CT_AS, CT_IN, /* "foreach (T c in x)" or "foo(in char c)" or "in { ..." */ CT_BRACED, /* simple braced items: try {} */ CT_THIS, /* may turn into CT_PBRACED if followed by a '(' */ CT_BASE, /* C# thingy */ CT_DEFAULT, /* may be changed into CT_CASE */ CT_GETSET, /* must be followed by CT_BRACE_OPEN or reverts to CT_WORD */ CT_GETSET_EMPTY, /* get/set/add/remove followed by a semicolon */ CT_CONCAT, /* The '~' between strings */ CT_CS_SQ_STMT, /* '[assembly: xxx]' or '[Attribute()]' or '[Help()]', etc */ CT_CS_SQ_COLON, /* the colon in one of those [] thingys */ CT_CS_PROPERTY, /* word or ']' followed by '{' */ /* Embedded SQL - always terminated with a semicolon */ CT_SQL_EXEC, /* the 'EXEC' in 'EXEC SQL ...' */ CT_SQL_BEGIN, /* the 'EXEC' in 'EXEC SQL BEGIN ...' */ CT_SQL_END, /* the 'EXEC' in 'EXEC SQL END ...' */ CT_SQL_WORD, /* CT_WORDs in the 'EXEC SQL' statement */ /* Vala stuff */ CT_CONSTRUCT, /* braced "construct { }" or qualifier "(construct int x)" */ CT_LAMBDA, /* Java */ CT_ASSERT, /* assert EXP1 [ : EXP2 ] ; */ } c_token_t; #endif /* TOKEN_ENUM_H_INCLUDED */ uncrustify-0.59/src/ListManager.h0000644000175000017500000000644011506773274013771 00000000000000/** * @file ListManager.h * Template class that manages items in a double-linked list. * If C++ could do it, this would just be a class that worked on an interface. * * @author Ben Gardner * @license GPL v2+ */ /** * A simple list manager for a double-linked list. * Class T must define 'next' and 'prev', which must be pointers to type T. */ template class ListManager { protected: /* Pointers to the head and tail. * They are either both NULL or both non-NULL. */ T *first; T *last; private: /* Hide copy constructor */ ListManager(const ListManager& ref) { first = NULL; last = NULL; } public: ListManager() { first = NULL; last = NULL; } T *GetHead() { return(first); } T *GetTail() { return(last); } T *GetNext(T *ref) { return((ref != NULL) ? ref->next : NULL); } T *GetPrev(T *ref) { return((ref != NULL) ? ref->prev : NULL); } void InitEntry(T *obj) const { if (obj != NULL) { obj->next = NULL; obj->prev = NULL; } } void Pop(T *obj) { if (obj != NULL) { if (first == obj) { first = obj->next; } if (last == obj) { last = obj->prev; } if (obj->next != NULL) { obj->next->prev = obj->prev; } if (obj->prev != NULL) { obj->prev->next = obj->next; } obj->next = NULL; obj->prev = NULL; } } void Swap(T *obj1, T *obj2) { if ((obj1 != NULL) && (obj2 != NULL)) { if (obj1->prev == obj2) { Pop(obj1); AddBefore(obj1, obj2); } else if (obj2->prev == obj1) { Pop(obj2); AddBefore(obj2, obj1); } else { T *prev1 = obj1->prev; Pop(obj1); T *prev2 = obj2->prev; Pop(obj2); AddAfter(obj1, prev2); AddAfter(obj2, prev1); } } } void AddAfter(T *obj, T *ref) { if ((obj != NULL) && (ref != NULL)) { Pop(obj); obj->next = ref->next; obj->prev = ref; if (ref->next != NULL) { ref->next->prev = obj; } else { last = obj; } ref->next = obj; } } void AddBefore(T *obj, T *ref) { if ((obj != NULL) && (ref != NULL)) { Pop(obj); obj->next = ref; obj->prev = ref->prev; if (ref->prev != NULL) { ref->prev->next = obj; } else { first = obj; } ref->prev = obj; } } void AddTail(T *obj) { obj->next = NULL; obj->prev = last; if (last == NULL) { last = obj; first = obj; } else { last->next = obj; } last = obj; } void AddHead(T *obj) { obj->next = first; obj->prev = NULL; if (first == NULL) { last = obj; first = obj; } else { first->prev = obj; } first = obj; } }; uncrustify-0.59/src/indent.cpp0000644000175000017500000016235611635773724013413 00000000000000/** * @file indent.cpp * Does all the indenting stuff. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" #include #include #include #include #include "unc_ctype.h" /** * General indenting approach: * Indenting levels are put into a stack. * * The stack entries contain: * - opening type * - brace column * - continuation column * * Items that start a new stack item: * - preprocessor (new parse frame) * - Brace Open (Virtual brace also) * - Paren, Square, Angle open * - Assignments * - C++ '<<' operator (ie, cout << "blah") * - case * - class colon * - return * - types * - any other continued statement * * Note that the column of items marked 'PCF_WAS_ALIGNED' is not changed. * * For an open brace: * - indent increases by indent_columns * - if part of if/else/do/while/switch/etc, an extra indent may be applied * - if in a paren, then cont-col is set to column + 1, ie "({ some code })" * * Open paren/square/angle: * cont-col is set to the column of the item after the open paren, unless * followed by a newline, then it is set to (brace-col + indent_columns). * Examples: * a_really_long_funcion_name( * param1, param2); * a_really_long_funcion_name(param1, * param2); * * Assignments: * Assignments are continued aligned with the first item after the assignment, * unless the assign is followed by a newline. * Examples: * some.variable = asdf + asdf + * asdf; * some.variable = * asdf + asdf + asdf; * * C++ << operator: * Handled the same as assignment. * Examples: * cout << "this is test number: " * << test_number; * * case: * Started with case or default. * Terminated with close brace at level or another case or default. * Special indenting according to various rules. * - indent of case label * - indent of case body * - how to handle optional braces * Examples: * { * case x: { * a++; * break; * } * case y: * b--; * break; * default: * c++; * break; * } * * Class colon: * Indent continuation by indent_columns: * class my_class : * baseclass1, * baseclass2 * { * * Return: same as assignemts * If the return statement is not fully paren'd, then the indent continues at * the column of the item after the return. If it is paren'd, then the paren * rules apply. * return somevalue + * othervalue; * * Type: pretty much the same as assignments * Examples: * int foo, * bar, * baz; * * Any other continued item: * There shouldn't be anything not covered by the above cases, but any other * continued item is indented by indent_columns: * Example: * somereallycrazylongname.with[lotsoflongstuff]. * thatreallyannoysme.whenIhavetomaintain[thecode] = 3; */ static void indent_comment(chunk_t *pc, int col); void indent_to_column(chunk_t *pc, int column) { if (column < pc->column) { column = pc->column; } reindent_line(pc, column); } enum align_mode { ALMODE_SHIFT, /* shift relative to the current column */ ALMODE_KEEP_ABS, /* try to keep the original absolute column */ ALMODE_KEEP_REL, /* try to keep the original gap */ }; /* Same as indent_to_column, except we can move both ways */ void align_to_column(chunk_t *pc, int column) { if (column == pc->column) { return; } LOG_FMT(LINDLINE, "%s: %d] col %d on %s [%s] => %d\n", __func__, pc->orig_line, pc->column, pc->str.c_str(), get_token_name(pc->type), column); int col_delta = column - pc->column; int min_col = column; int min_delta; pc->column = column; do { chunk_t *next = chunk_get_next(pc); chunk_t *prev; align_mode almod = ALMODE_SHIFT; if (next == NULL) { break; } min_delta = space_col_align(pc, next); min_col += min_delta; prev = pc; pc = next; if (chunk_is_comment(pc) && (pc->parent_type != CT_COMMENT_EMBED)) { almod = (chunk_is_single_line_comment(pc) && cpd.settings[UO_indent_relative_single_line_comments].b) ? ALMODE_KEEP_REL : ALMODE_KEEP_ABS; } if (almod == ALMODE_KEEP_ABS) { /* Keep same absolute column */ pc->column = pc->orig_col; if (pc->column < min_col) { pc->column = min_col; } } else if (almod == ALMODE_KEEP_REL) { /* Keep same relative column */ int orig_delta = pc->orig_col - prev->orig_col; if (orig_delta < min_delta) { orig_delta = min_delta; } pc->column = prev->column + orig_delta; } else /* ALMODE_SHIFT */ { /* Shift by the same amount */ pc->column += col_delta; if (pc->column < min_col) { pc->column = min_col; } } LOG_FMT(LINDLINED, " %s set column of %s on line %d to col %d (orig %d)\n", (almod == ALMODE_KEEP_ABS) ? "abs" : (almod == ALMODE_KEEP_REL) ? "rel" : "sft", get_token_name(pc->type), pc->orig_line, pc->column, pc->orig_col); } while ((pc != NULL) && (pc->nl_count == 0)); } /** * Changes the initial indent for a line to the given column * * @param pc The chunk at the start of the line * @param column The desired column */ void reindent_line2(chunk_t *pc, int column, const char *fcn_name, int lineno) { LOG_FMT(LINDLINE, "%s: %d] col %d on %s [%s] => %d orig_line, pc->column, pc->str.c_str(), get_token_name(pc->type), column, fcn_name, lineno); if (column == pc->column) { return; } int col_delta = column - pc->column; int min_col = column; pc->column = column; do { chunk_t *next = chunk_get_next(pc); if (next == NULL) { break; } min_col += space_col_align(pc, next); pc = next; bool is_comment = chunk_is_comment(pc); bool keep = is_comment && chunk_is_single_line_comment(pc) && cpd.settings[UO_indent_relative_single_line_comments].b; if (is_comment && (pc->parent_type != CT_COMMENT_EMBED) && !keep) { pc->column = pc->orig_col; if (pc->column < min_col) { pc->column = min_col; // + 1; } LOG_FMT(LINDLINE, "%s: set comment on line %d to col %d (orig %d)\n", __func__, pc->orig_line, pc->column, pc->orig_col); } else { pc->column += col_delta; if (pc->column < min_col) { pc->column = min_col; } LOG_FMT(LINDLINED, " set column of '%s' to %d (orig %d)\n", pc->str.c_str(), pc->column, pc->orig_col); } } while ((pc != NULL) && (pc->nl_count == 0)); } /** * Starts a new entry * * @param frm The parse frame * @param pc The chunk causing the push */ static void indent_pse_push(struct parse_frame& frm, chunk_t *pc) { static int ref = 0; /* check the stack depth */ if (frm.pse_tos < ((int)ARRAY_SIZE(frm.pse) - 1)) { /* Bump up the index and initialize it */ frm.pse_tos++; memset(&frm.pse[frm.pse_tos], 0, sizeof(frm.pse[frm.pse_tos])); LOG_FMT(LINDPSE, "%4d] (pp=%d) OPEN [%d,%s] level=%d\n", pc->orig_line, cpd.pp_level, frm.pse_tos, get_token_name(pc->type), pc->level); frm.pse[frm.pse_tos].pc = pc; frm.pse[frm.pse_tos].type = pc->type; frm.pse[frm.pse_tos].level = pc->level; frm.pse[frm.pse_tos].open_line = pc->orig_line; frm.pse[frm.pse_tos].ref = ++ref; frm.pse[frm.pse_tos].in_preproc = (pc->flags & PCF_IN_PREPROC) != 0; frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos - 1].indent_tab; frm.pse[frm.pse_tos].non_vardef = false; } } /** * Removes the top entry * * @param frm The parse frame * @param pc The chunk causing the push */ static void indent_pse_pop(struct parse_frame& frm, chunk_t *pc) { /* Bump up the index and initialize it */ if (frm.pse_tos > 0) { if (pc != NULL) { LOG_FMT(LINDPSE, "%4d] (pp=%d) CLOSE [%d,%s] on %s, started on line %d, level=%d/%d\n", pc->orig_line, cpd.pp_level, frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), get_token_name(pc->type), frm.pse[frm.pse_tos].open_line, frm.pse[frm.pse_tos].level, pc->level); } else { LOG_FMT(LINDPSE, " EOF] CLOSE [%d,%s], started on line %d\n", frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), frm.pse[frm.pse_tos].open_line); } /* Don't clear the stack entry because some code 'cheats' and uses the * just-popped indent values */ frm.pse_tos--; } } static int token_indent(c_token_t type) { switch (type) { case CT_IF: case CT_DO: return(3); case CT_FOR: case CT_ELSE: // wacky, but that's what is wanted return(4); case CT_WHILE: case CT_USING_STMT: return(6); case CT_SWITCH: return(7); case CT_ELSEIF: return(8); default: return(0); } } #define indent_column_set(X) \ do { \ indent_column = (X); \ LOG_FMT(LINDENT2, "[line %d] indent_column = %d\n", \ __LINE__, indent_column); \ } while (0) /** * Determines the continuation indent if indent_continue is non-zero. */ static int continue_indent(chunk_t *pc) { return(1 + (pc->level * cpd.settings[UO_indent_columns].n) + cpd.settings[UO_indent_continue].n); } /** * Change the top-level indentation only by changing the column member in * the chunk structures. * The level indicator must already be set. */ void indent_text(void) { chunk_t *pc; chunk_t *next; chunk_t *prev = NULL; bool did_newline = true; int idx; int vardefcol = 0; int indent_size = cpd.settings[UO_indent_columns].n; int tmp; struct parse_frame frm; bool in_preproc = false, was_preproc = false; int indent_column; int parent_token_indent = 0; int xml_indent = 0; bool token_used; int sql_col = 0; int sql_orig_col = 0; memset(&frm, 0, sizeof(frm)); cpd.frame_count = 0; /* dummy top-level entry */ frm.pse[0].indent = 1; frm.pse[0].indent_tmp = 1; frm.pse[0].indent_tab = 1; frm.pse[0].type = CT_EOF; pc = chunk_get_head(); while (pc != NULL) { /* Handle proprocessor transitions */ was_preproc = in_preproc; in_preproc = (pc->flags & PCF_IN_PREPROC) != 0; if (cpd.settings[UO_indent_brace_parent].b) { parent_token_indent = token_indent(pc->parent_type); } /* Clean up after a #define, etc */ if (!in_preproc) { while ((frm.pse_tos > 0) && frm.pse[frm.pse_tos].in_preproc) { c_token_t type = frm.pse[frm.pse_tos].type; indent_pse_pop(frm, pc); /* If we just removed an #endregion, then check to see if a * PP_REGION_INDENT entry is right below it */ if ((type == CT_PP_ENDREGION) && (frm.pse[frm.pse_tos].type == CT_PP_REGION_INDENT)) { indent_pse_pop(frm, pc); } } } else if (pc->type == CT_PREPROC) { /* Close out PP_IF_INDENT before playing with the parse frames */ if ((frm.pse[frm.pse_tos].type == CT_PP_IF_INDENT) && ((pc->parent_type == CT_PP_ENDIF) || (pc->parent_type == CT_PP_ELSE))) { indent_pse_pop(frm, pc); } pf_check(&frm, pc); /* Indent the body of a #region here */ if (cpd.settings[UO_pp_region_indent_code].b && (pc->parent_type == CT_PP_REGION)) { next = chunk_get_next(pc); /* Hack to get the logs to look right */ next->type = CT_PP_REGION_INDENT; indent_pse_push(frm, next); next->type = CT_PP_REGION; /* Indent one level */ frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos - 1].indent_tab + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].in_preproc = false; } /* Indent the body of a #if here */ if (cpd.settings[UO_pp_if_indent_code].b && ((pc->parent_type == CT_PP_IF) || (pc->parent_type == CT_PP_ELSE))) { next = chunk_get_next(pc); /* Hack to get the logs to look right */ next->type = CT_PP_IF_INDENT; indent_pse_push(frm, next); next->type = CT_PP_IF; /* Indent one level */ frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos - 1].indent_tab + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].in_preproc = false; } /* Transition into a preproc by creating a dummy indent */ frm.level++; indent_pse_push(frm, chunk_get_next(pc)); if (pc->parent_type == CT_PP_DEFINE) { frm.pse[frm.pse_tos].indent_tmp = cpd.settings[UO_pp_define_at_level].b ? frm.pse[frm.pse_tos - 1].indent_tmp : 1; frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos].indent_tmp + indent_size; } else { if ((frm.pse[frm.pse_tos - 1].type == CT_PP_REGION_INDENT) || ((frm.pse[frm.pse_tos - 1].type == CT_PP_IF_INDENT) && (frm.pse[frm.pse_tos].type != CT_PP_ENDIF))) { frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 2].indent; } else { frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent; } if ((pc->parent_type == CT_PP_REGION) || (pc->parent_type == CT_PP_ENDREGION)) { int val = cpd.settings[UO_pp_indent_region].n; if (val > 0) { frm.pse[frm.pse_tos].indent = val; } else { frm.pse[frm.pse_tos].indent += val; } } else if ((pc->parent_type == CT_PP_IF) || (pc->parent_type == CT_PP_ELSE) || (pc->parent_type == CT_PP_ENDIF)) { int val = cpd.settings[UO_pp_indent_if].n; if (val > 0) { frm.pse[frm.pse_tos].indent = val; } else { frm.pse[frm.pse_tos].indent += val; } } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; } } /* Check for close XML tags " 0) { if (pc->type == CT_STRING) { if ((pc->len() > 4) && (xml_indent > 0) && (pc->str[1] == '<') && (pc->str[2] == '/')) { xml_indent -= cpd.settings[UO_indent_xml_string].n; } } else { if (!chunk_is_comment(pc) && !chunk_is_newline(pc)) { xml_indent = 0; } } } /** * Handle non-brace closures */ token_used = false; int old_pse_tos; do { old_pse_tos = frm.pse_tos; /* End anything that drops a level */ if (!chunk_is_newline(pc) && !chunk_is_comment(pc) && (frm.pse[frm.pse_tos].level > pc->level)) { indent_pse_pop(frm, pc); } if (frm.pse[frm.pse_tos].level >= pc->level) { /* process virtual braces closes (no text output) */ if ((pc->type == CT_VBRACE_CLOSE) && (frm.pse[frm.pse_tos].type == CT_VBRACE_OPEN)) { indent_pse_pop(frm, pc); frm.level--; pc = chunk_get_next(pc); } /* End any assign operations with a semicolon on the same level */ if (((frm.pse[frm.pse_tos].type == CT_ASSIGN_NL) || (frm.pse[frm.pse_tos].type == CT_ASSIGN)) && (chunk_is_semicolon(pc) || (pc->type == CT_COMMA) || (pc->type == CT_BRACE_OPEN) || (pc->type == CT_SPAREN_CLOSE) || ((pc->type == CT_SQUARE_OPEN) && (pc->parent_type == CT_ASSIGN)))) { indent_pse_pop(frm, pc); } /* End any assign operations with a semicolon on the same level */ if (chunk_is_semicolon(pc) && ((frm.pse[frm.pse_tos].type == CT_IMPORT) || (frm.pse[frm.pse_tos].type == CT_USING))) { indent_pse_pop(frm, pc); } /* End any custom macro-based open/closes */ if (!token_used && (frm.pse[frm.pse_tos].type == CT_MACRO_OPEN) && (pc->type == CT_MACRO_CLOSE)) { token_used = true; indent_pse_pop(frm, pc); } /* End any CPP/ObjC class colon stuff */ if ((frm.pse[frm.pse_tos].type == CT_CLASS_COLON) && ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_OC_END) || (pc->type == CT_OC_SCOPE) || (pc->type == CT_OC_PROPERTY) || chunk_is_semicolon(pc))) { indent_pse_pop(frm, pc); } /* a case is ended with another case or a close brace */ if ((frm.pse[frm.pse_tos].type == CT_CASE) && ((pc->type == CT_BRACE_CLOSE) || (pc->type == CT_CASE))) { indent_pse_pop(frm, pc); } /* a class scope is ended with another class scope or a close brace */ if (cpd.settings[UO_indent_access_spec_body].b && (frm.pse[frm.pse_tos].type == CT_PRIVATE) && ((pc->type == CT_BRACE_CLOSE) || (pc->type == CT_PRIVATE))) { indent_pse_pop(frm, pc); } /* return & throw are ended with a semicolon */ if (chunk_is_semicolon(pc) && ((frm.pse[frm.pse_tos].type == CT_RETURN) || (frm.pse[frm.pse_tos].type == CT_THROW))) { indent_pse_pop(frm, pc); } /* an OC SCOPE ('-' or '+') ends with a semicolon or brace open */ if ((frm.pse[frm.pse_tos].type == CT_OC_SCOPE) && (chunk_is_semicolon(pc) || (pc->type == CT_BRACE_OPEN))) { indent_pse_pop(frm, pc); } /* an SQL EXEC is ended with a semicolon */ if ((frm.pse[frm.pse_tos].type == CT_SQL_EXEC) && chunk_is_semicolon(pc)) { indent_pse_pop(frm, pc); } /* Close out parens and squares */ if ((frm.pse[frm.pse_tos].type == (pc->type - 1)) && ((pc->type == CT_PAREN_CLOSE) || (pc->type == CT_SPAREN_CLOSE) || (pc->type == CT_FPAREN_CLOSE) || (pc->type == CT_SQUARE_CLOSE) || (pc->type == CT_ANGLE_CLOSE))) { indent_pse_pop(frm, pc); frm.paren_count--; } } } while (old_pse_tos > frm.pse_tos); /* Grab a copy of the current indent */ indent_column_set(frm.pse[frm.pse_tos].indent_tmp); if (!chunk_is_newline(pc) && !chunk_is_comment(pc)) { LOG_FMT(LINDPC, " -=[ %s ]=- top=%d %s %d/%d\n", pc->str.c_str(), frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), frm.pse[frm.pse_tos].indent_tmp, frm.pse[frm.pse_tos].indent); } /** * Handle stuff that can affect the current indent: * - brace close * - vbrace open * - brace open * - case (immediate) * - labels (immediate) * - class colons (immediate) * * And some stuff that can't * - open paren * - open square * - assignment * - return */ bool brace_indent = false; if ((pc->type == CT_BRACE_CLOSE) || (pc->type == CT_BRACE_OPEN)) { brace_indent = (cpd.settings[UO_indent_braces].b && (!cpd.settings[UO_indent_braces_no_func].b || (pc->parent_type != CT_FUNC_DEF)) && (!cpd.settings[UO_indent_braces_no_func].b || (pc->parent_type != CT_FUNC_CLASS)) && (!cpd.settings[UO_indent_braces_no_class].b || (pc->parent_type != CT_CLASS)) && (!cpd.settings[UO_indent_braces_no_struct].b || (pc->parent_type != CT_STRUCT))); } if (pc->type == CT_BRACE_CLOSE) { if (frm.pse[frm.pse_tos].type == CT_BRACE_OPEN) { /* Indent the brace to match the open brace */ indent_column_set(frm.pse[frm.pse_tos].brace_indent); indent_pse_pop(frm, pc); frm.level--; } } else if (pc->type == CT_VBRACE_OPEN) { frm.level++; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos].indent; /* Always indent on virtual braces */ indent_column_set(frm.pse[frm.pse_tos].indent_tmp); } else if (pc->type == CT_BRACE_OPEN) { frm.level++; indent_pse_push(frm, pc); if (frm.paren_count != 0) { /* We are inside ({ ... }) -- indent one tab from the paren */ frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; } else { /* Use the prev indent level + indent_size. */ frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; /* If this brace is part of a statement, bump it out by indent_brace */ if ((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE) || (pc->parent_type == CT_ELSEIF) || (pc->parent_type == CT_TRY) || (pc->parent_type == CT_CATCH) || (pc->parent_type == CT_DO) || (pc->parent_type == CT_WHILE) || (pc->parent_type == CT_USING_STMT) || (pc->parent_type == CT_SWITCH) || (pc->parent_type == CT_FOR)) { if (parent_token_indent != 0) { frm.pse[frm.pse_tos].indent += parent_token_indent - indent_size; } else { frm.pse[frm.pse_tos].indent += cpd.settings[UO_indent_brace].n; indent_column_set(indent_column + cpd.settings[UO_indent_brace].n); } } else if (pc->parent_type == CT_CASE) { /* An open brace with the parent of case does not indent by default * UO_indent_case_brace can be used to indent the brace. * So we need to take the CASE indent, subtract off the * indent_size that was added above and then add indent_case_brace. */ indent_column_set(frm.pse[frm.pse_tos - 1].indent - indent_size + cpd.settings[UO_indent_case_brace].n); /* Stuff inside the brace still needs to be indented */ frm.pse[frm.pse_tos].indent = indent_column + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; } else if ((pc->parent_type == CT_CLASS) && !cpd.settings[UO_indent_class].b) { frm.pse[frm.pse_tos].indent -= indent_size; } else if (pc->parent_type == CT_NAMESPACE) { if ((pc->flags & PCF_LONG_BLOCK) || !cpd.settings[UO_indent_namespace].b) { /* don't indent long blocks */ frm.pse[frm.pse_tos].indent -= indent_size; } else /* indenting 'short' namespace */ { if (cpd.settings[UO_indent_namespace_level].n > 0) { frm.pse[frm.pse_tos].indent -= indent_size; frm.pse[frm.pse_tos].indent += cpd.settings[UO_indent_namespace_level].n; } } } else if ((pc->parent_type == CT_EXTERN) && !cpd.settings[UO_indent_extern].b) { frm.pse[frm.pse_tos].indent -= indent_size; } frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos].indent; } if ((pc->flags & PCF_DONT_INDENT) != 0) { frm.pse[frm.pse_tos].indent = pc->column; indent_column_set(pc->column); } else { /** * If there isn't a newline between the open brace and the next * item, just indent to wherever the next token is. * This covers this sort of stuff: * { a++; * b--; }; */ next = chunk_get_next_ncnl(pc); if (!chunk_is_newline_between(pc, next)) { frm.pse[frm.pse_tos].indent = next->column; } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].open_line = pc->orig_line; /* Update the indent_column if needed */ if (brace_indent || (parent_token_indent != 0)) { indent_column_set(frm.pse[frm.pse_tos].indent_tmp); } } /* Save the brace indent */ frm.pse[frm.pse_tos].brace_indent = indent_column; } else if (pc->type == CT_SQL_END) { if (frm.pse[frm.pse_tos].type == CT_SQL_BEGIN) { indent_pse_pop(frm, pc); frm.level--; indent_column_set(frm.pse[frm.pse_tos].indent_tmp); } } else if (pc->type == CT_SQL_BEGIN) { frm.level++; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos].indent; } else if (pc->type == CT_SQL_EXEC) { frm.level++; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; } else if (pc->type == CT_MACRO_OPEN) { frm.level++; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos].indent; } else if (pc->type == CT_MACRO_ELSE) { if (frm.pse[frm.pse_tos].type == CT_MACRO_OPEN) { indent_column_set(frm.pse[frm.pse_tos - 1].indent); } } else if (pc->type == CT_CASE) { /* Start a case - indent UO_indent_switch_case from the switch level */ tmp = frm.pse[frm.pse_tos].indent + cpd.settings[UO_indent_switch_case].n; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = tmp; frm.pse[frm.pse_tos].indent_tmp = tmp - indent_size + cpd.settings[UO_indent_case_shift].n; frm.pse[frm.pse_tos].indent_tab = tmp; /* Always set on case statements */ indent_column_set(frm.pse[frm.pse_tos].indent_tmp); /* comments before 'case' need to be aligned with the 'case' */ chunk_t *pct = pc; while (((pct = chunk_get_prev_nnl(pct)) != NULL) && chunk_is_comment(pct)) { chunk_t *t2 = chunk_get_prev(pct); if (chunk_is_newline(t2)) { pct->column = frm.pse[frm.pse_tos].indent_tmp; pct->column_indent = pct->column; } } } else if (pc->type == CT_BREAK) { prev = chunk_get_prev_ncnl(pc); if ((prev != NULL) && (prev->type == CT_BRACE_CLOSE) && (prev->parent_type == CT_CASE)) { /* This only affects the 'break', so no need for a stack entry */ indent_column_set(prev->column); } } else if (pc->type == CT_LABEL) { /* Labels get sent to the left or backed up */ if (cpd.settings[UO_indent_label].n > 0) { indent_column_set(cpd.settings[UO_indent_label].n); } else { indent_column_set(frm.pse[frm.pse_tos].indent + cpd.settings[UO_indent_label].n); } } else if (pc->type == CT_PRIVATE) { if (cpd.settings[UO_indent_access_spec_body].b) { tmp = frm.pse[frm.pse_tos].indent + indent_size; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = tmp; frm.pse[frm.pse_tos].indent_tmp = tmp - indent_size; frm.pse[frm.pse_tos].indent_tab = tmp; /* If we are indenting the body, then we must leave the access spec * indented at brace level */ indent_column_set(frm.pse[frm.pse_tos].indent_tmp); } else { /* Access spec labels get sent to the left or backed up */ if (cpd.settings[UO_indent_access_spec].n > 0) { indent_column_set(cpd.settings[UO_indent_access_spec].n); } else { indent_column_set(frm.pse[frm.pse_tos].indent + cpd.settings[UO_indent_access_spec].n); } } } else if (pc->type == CT_CLASS_COLON) { /* just indent one level */ indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos].indent; indent_column_set(frm.pse[frm.pse_tos].indent_tmp); if (cpd.settings[UO_indent_class_colon].b) { prev = chunk_get_prev(pc); if (chunk_is_newline(prev)) { frm.pse[frm.pse_tos].indent += 2; if (cpd.settings[UO_indent_ctor_init].n > 0) { frm.pse[frm.pse_tos].indent += cpd.settings[UO_indent_ctor_init].n; frm.pse[frm.pse_tos].indent_tmp += cpd.settings[UO_indent_ctor_init].n; frm.pse[frm.pse_tos].indent_tab += cpd.settings[UO_indent_ctor_init].n; indent_column_set(frm.pse[frm.pse_tos].indent_tmp); } } else { next = chunk_get_next(pc); if ((next != NULL) && !chunk_is_newline(next)) { frm.pse[frm.pse_tos].indent = next->column; } } } } else if ((pc->type == CT_PAREN_OPEN) || (pc->type == CT_SPAREN_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->type == CT_SQUARE_OPEN) || (pc->type == CT_ANGLE_OPEN)) { /* Open parens and squares - never update indent_column, unless right * after a newline. */ indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = pc->column + pc->len(); if (((pc->type == CT_FPAREN_OPEN) || (pc->type == CT_ANGLE_OPEN)) && ((cpd.settings[UO_indent_func_call_param].b && ((pc->parent_type == CT_FUNC_CALL) || (pc->parent_type == CT_FUNC_CALL_USER))) || (cpd.settings[UO_indent_func_proto_param].b && ((pc->parent_type == CT_FUNC_PROTO) || (pc->parent_type == CT_FUNC_CLASS))) || (cpd.settings[UO_indent_func_class_param].b && (pc->parent_type == CT_FUNC_CLASS)) || (cpd.settings[UO_indent_template_param].b && (pc->parent_type == CT_TEMPLATE)) || (cpd.settings[UO_indent_func_ctor_var_param].b && (pc->parent_type == CT_FUNC_CTOR_VAR)) || (cpd.settings[UO_indent_func_def_param].b && (pc->parent_type == CT_FUNC_DEF)))) { /* Skip any continuation indents */ idx = frm.pse_tos - 1; while ((idx > 0) && (frm.pse[idx].type != CT_BRACE_OPEN) && (frm.pse[idx].type != CT_VBRACE_OPEN) && (frm.pse[idx].type != CT_PAREN_OPEN) && (frm.pse[idx].type != CT_FPAREN_OPEN) && (frm.pse[idx].type != CT_SPAREN_OPEN) && (frm.pse[idx].type != CT_SQUARE_OPEN) && (frm.pse[idx].type != CT_ANGLE_OPEN) && (frm.pse[idx].type != CT_CLASS_COLON) && (frm.pse[idx].type != CT_ASSIGN_NL)) { idx--; } frm.pse[frm.pse_tos].indent = frm.pse[idx].indent + indent_size; if (cpd.settings[UO_indent_func_param_double].b) { frm.pse[frm.pse_tos].indent += indent_size; } frm.pse[frm.pse_tos].indent_tab = frm.pse[frm.pse_tos].indent; } else if ((chunk_is_str(pc, "(", 1) && !cpd.settings[UO_indent_paren_nl].b) || (chunk_is_str(pc, "<", 1) && !cpd.settings[UO_indent_paren_nl].b) || /* TODO: add indent_angle_nl? */ (chunk_is_str(pc, "[", 1) && !cpd.settings[UO_indent_square_nl].b)) { next = chunk_get_next_nc(pc); if (chunk_is_newline(next)) { int sub = 1; if (frm.pse[frm.pse_tos - 1].type == CT_ASSIGN) { sub = 2; } frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - sub].indent + indent_size; } else { if (next && !chunk_is_comment(next)) { if (next->type == CT_SPACE) { next = chunk_get_next_nc(next); } frm.pse[frm.pse_tos].indent = next->column; } } } if ((pc->type == CT_FPAREN_OPEN) && chunk_is_newline(chunk_get_prev(pc)) && !chunk_is_newline(chunk_get_next(pc))) { frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; indent_column_set(frm.pse[frm.pse_tos].indent); } if (cpd.settings[UO_indent_continue].n != 0) { frm.pse[frm.pse_tos].indent = continue_indent(pc); /* the continuation indent applies to the next line, not the current */ //indent_column_set(frm.pse[frm.pse_tos].indent); } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.paren_count++; } else if ((pc->type == CT_ASSIGN) || (pc->type == CT_IMPORT) || (pc->type == CT_USING)) { /** * if there is a newline after the '=' or the line starts with a '=', * just indent one level, * otherwise align on the '='. */ if ((pc->type == CT_ASSIGN) && chunk_is_newline(chunk_get_prev(pc))) { frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent + indent_size; indent_column_set(frm.pse[frm.pse_tos].indent_tmp); LOG_FMT(LINDENT, "%s: %d] assign => %d [%s]\n", __func__, pc->orig_line, indent_column, pc->str.c_str()); reindent_line(pc, frm.pse[frm.pse_tos].indent_tmp); } next = chunk_get_next(pc); if (next != NULL) { indent_pse_push(frm, pc); if (cpd.settings[UO_indent_continue].n) { frm.pse[frm.pse_tos].indent = continue_indent(pc); } else if (chunk_is_newline(next) || !cpd.settings[UO_indent_align_assign].b) { frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; if (pc->type == CT_ASSIGN) { frm.pse[frm.pse_tos].type = CT_ASSIGN_NL; } } else { frm.pse[frm.pse_tos].indent = pc->column + pc->len() + 1; } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; } } else if ((pc->type == CT_RETURN) || ((pc->type == CT_THROW) && (pc->parent_type == CT_NONE))) { /* don't count returns inside a () or [] */ if (pc->level == pc->brace_level) { indent_pse_push(frm, pc); if (chunk_is_newline(chunk_get_next(pc))) { frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; } else { frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + pc->len() + 1; } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos - 1].indent; } } else if (pc->type == CT_OC_SCOPE) { indent_pse_push(frm, pc); if (cpd.settings[UO_indent_continue].n != 0) { frm.pse[frm.pse_tos].indent += cpd.settings[UO_indent_continue].n; } else { frm.pse[frm.pse_tos].indent += indent_size; } } else { /* anything else? */ } /** * Handle variable definition continuation indenting */ if ((vardefcol == 0) && (pc->type == CT_WORD) && ((pc->flags & PCF_IN_FCN_DEF) == 0) && ((pc->flags & PCF_VAR_1ST_DEF) == PCF_VAR_1ST_DEF)) { if (cpd.settings[UO_indent_continue].n != 0) { vardefcol = frm.pse[frm.pse_tos].indent + cpd.settings[UO_indent_continue].n; } else if (cpd.settings[UO_indent_var_def_cont].b || chunk_is_newline(chunk_get_prev(pc))) { vardefcol = frm.pse[frm.pse_tos].indent + indent_size; } else { vardefcol = pc->column; } } if (chunk_is_semicolon(pc) || ((pc->type == CT_BRACE_OPEN) && (pc->parent_type == CT_FUNCTION))) { vardefcol = 0; } /** * Indent the line if needed */ if (did_newline && !chunk_is_newline(pc) && (pc->len() != 0)) { pc->column_indent = frm.pse[frm.pse_tos].indent_tab; LOG_FMT(LINDENT2, "%s: %d] %d for %s\n", __func__, pc->orig_line, pc->column_indent, pc->str.c_str()); /** * Check for special continuations. * Note that some of these could be done as a stack item like * everything else */ prev = chunk_get_prev_ncnl(pc); next = chunk_get_next_ncnl(pc); if ((pc->flags & PCF_DONT_INDENT) != 0) { /* no change */ } else if ((pc->parent_type == CT_SQL_EXEC) && cpd.settings[UO_indent_preserve_sql].b) { reindent_line(pc, sql_col + (pc->orig_col - sql_orig_col)); LOG_FMT(LINDENT, "Indent SQL: [%s] to %d (%d/%d)\n", pc->str.c_str(), pc->column, sql_col, sql_orig_col); } else if (((pc->flags & PCF_STMT_START) == 0) && ((pc->type == CT_MEMBER) || (pc->type == CT_DC_MEMBER) || ((prev != NULL) && ((prev->type == CT_MEMBER) || (prev->type == CT_DC_MEMBER))))) { tmp = cpd.settings[UO_indent_member].n + indent_column; LOG_FMT(LINDENT, "%s: %d] member => %d\n", __func__, pc->orig_line, tmp); reindent_line(pc, tmp); } else if ((vardefcol > 0) && (pc->level == pc->brace_level) && (pc->type == CT_WORD) && (prev != NULL) && ((prev->type == CT_COMMA) || (prev->type == CT_TYPE) || (prev->type == CT_WORD)) && ((pc->flags & PCF_VAR_DEF) != 0)) { LOG_FMT(LINDENT, "%s: %d] Vardefcol => %d\n", __func__, pc->orig_line, vardefcol); reindent_line(pc, vardefcol); } else if ((pc->type == CT_STRING) && (prev->type == CT_STRING) && cpd.settings[UO_indent_align_string].b) { tmp = (xml_indent != 0) ? xml_indent : prev->column; LOG_FMT(LINDENT, "%s: %d] String => %d\n", __func__, pc->orig_line, tmp); reindent_line(pc, tmp); } else if (chunk_is_comment(pc)) { LOG_FMT(LINDENT, "%s: %d] comment => %d\n", __func__, pc->orig_line, frm.pse[frm.pse_tos].indent_tmp); indent_comment(pc, frm.pse[frm.pse_tos].indent_tmp); } else if (pc->type == CT_PREPROC) { LOG_FMT(LINDENT, "%s: %d] pp-indent => %d [%s]\n", __func__, pc->orig_line, indent_column, pc->str.c_str()); reindent_line(pc, indent_column); } else if (chunk_is_paren_close(pc) || (pc->type == CT_ANGLE_CLOSE)) { /* This is a big hack. We assume that since we hit a paren close, * that we just removed a paren open */ if (frm.pse[frm.pse_tos + 1].type == c_token_t(pc->type - 1)) { chunk_t *ck1 = frm.pse[frm.pse_tos + 1].pc; chunk_t *ck2 = chunk_get_prev(ck1); /* If the open paren was the first thing on the line or we are * doing mode 1, then put the close paren in the same column */ if (chunk_is_newline(ck2) || (cpd.settings[UO_indent_paren_close].n == 1)) { indent_column_set(ck1->column); } else { if (cpd.settings[UO_indent_paren_close].n != 2) { indent_column_set(frm.pse[frm.pse_tos + 1].indent_tmp); if (cpd.settings[UO_indent_paren_close].n == 1) { indent_column--; } } } } LOG_FMT(LINDENT, "%s: %d] cl paren => %d [%s]\n", __func__, pc->orig_line, indent_column, pc->str.c_str()); reindent_line(pc, indent_column); } else if (pc->type == CT_COMMA) { if (cpd.settings[UO_indent_comma_paren].b && chunk_is_paren_open(frm.pse[frm.pse_tos].pc)) { indent_column_set(frm.pse[frm.pse_tos].pc->column); } LOG_FMT(LINDENT, "%s: %d] comma => %d [%s]\n", __func__, pc->orig_line, indent_column, pc->str.c_str()); reindent_line(pc, indent_column); } else if (cpd.settings[UO_indent_func_const].n && (pc->type == CT_QUALIFIER) && (strncasecmp(pc->text(), "const", pc->len()) == 0) && ((next == NULL) || (next->type == CT_BRACED) || (next->type == CT_BRACE_OPEN) || (next->type == CT_NEWLINE) || (next->type == CT_SEMICOLON) || (next->type == CT_THROW) || (next->type == CT_VBRACE_OPEN))) { // indent const - void GetFoo(void)\n const\n { return (m_Foo); } indent_column_set(cpd.settings[UO_indent_func_const].n); LOG_FMT(LINDENT, "%s: %d] const => %d [%s]\n", __func__, pc->orig_line, indent_column, pc->str.c_str()); reindent_line(pc, indent_column); } else if (cpd.settings[UO_indent_func_throw].n && (pc->type == CT_THROW) && (pc->parent_type != CT_NONE)) { // indent throw - void GetFoo(void)\n throw()\n { return (m_Foo); } indent_column_set(cpd.settings[UO_indent_func_throw].n); LOG_FMT(LINDENT, "%s: %d] throw => %d [%s]\n", __func__, pc->orig_line, indent_column, pc->str.c_str()); reindent_line(pc, indent_column); } else if (pc->type == CT_BOOL) { if (cpd.settings[UO_indent_bool_paren].b && chunk_is_paren_open(frm.pse[frm.pse_tos].pc)) { indent_column_set(frm.pse[frm.pse_tos].pc->column); if (cpd.settings[UO_indent_first_bool_expr].b) { reindent_line(chunk_get_next(frm.pse[frm.pse_tos].pc), indent_column + pc->len() + 1); } } LOG_FMT(LINDENT, "%s: %d] bool => %d [%s]\n", __func__, pc->orig_line, indent_column, pc->str.c_str()); reindent_line(pc, indent_column); } else { if (pc->column != indent_column) { LOG_FMT(LINDENT, "%s: %d] indent => %d [%s]\n", __func__, pc->orig_line, indent_column, pc->str.c_str()); reindent_line(pc, indent_column); } } did_newline = false; if ((pc->type == CT_SQL_EXEC) || (pc->type == CT_SQL_BEGIN) || (pc->type == CT_SQL_END)) { sql_col = pc->column; sql_orig_col = pc->orig_col; } /* Handle indent for variable defs at the top of a block of code */ if (pc->flags & PCF_VAR_TYPE) { if (!frm.pse[frm.pse_tos].non_vardef && (frm.pse[frm.pse_tos].type == CT_BRACE_OPEN)) { tmp = indent_column; if (cpd.settings[UO_indent_var_def_blk].n > 0) { tmp = cpd.settings[UO_indent_var_def_blk].n; } else { tmp += cpd.settings[UO_indent_var_def_blk].n; } reindent_line(pc, tmp); LOG_FMT(LINDENT, "%s: %d] var_type indent => %d [%s]\n", __func__, pc->orig_line, tmp, pc->str.c_str()); } } else { if (pc != frm.pse[frm.pse_tos].pc) { frm.pse[frm.pse_tos].non_vardef = true; } } } /* if we hit a newline, reset indent_tmp */ if (chunk_is_newline(pc) || (pc->type == CT_COMMENT_MULTI) || (pc->type == CT_COMMENT_CPP)) { frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; /** * Handle the case of a multi-line #define w/o anything on the * first line (indent_tmp will be 1 or 0) */ if ((pc->type == CT_NL_CONT) && (frm.pse[frm.pse_tos].indent_tmp <= indent_size)) { frm.pse[frm.pse_tos].indent_tmp = indent_size + 1; } /* Get ready to indent the next item */ did_newline = true; } /* Check for open XML tags " 0) { if (pc->type == CT_STRING) { if ((pc->len() > 4) && (pc->str[1] == '<') && (pc->str[2] != '/') && (pc->str[pc->len() - 3] != '/')) { if (xml_indent <= 0) { xml_indent = pc->column; } xml_indent += cpd.settings[UO_indent_xml_string].n; } } } if (!chunk_is_comment(pc) && !chunk_is_newline(pc)) { prev = pc; } pc = chunk_get_next(pc); } /* Throw out any stuff inside a preprocessor - no need to warn */ while ((frm.pse_tos > 0) && frm.pse[frm.pse_tos].in_preproc) { indent_pse_pop(frm, pc); } for (idx = 1; idx <= frm.pse_tos; idx++) { LOG_FMT(LWARN, "%s:%d Unmatched %s\n", cpd.filename, frm.pse[idx].open_line, get_token_name(frm.pse[idx].type)); cpd.error_count++; } quick_align_again(); } /** * returns true if forward scan reveals only single newlines or comments * stops when hits code * false if next thing hit is a closing brace, also if 2 newlines in a row */ static bool single_line_comment_indent_rule_applies(chunk_t *start) { chunk_t *pc = start; int nl_count = 0; if (!chunk_is_single_line_comment(pc)) { return(false); } /* scan forward, if only single newlines and comments before next line of * code, we want to apply */ while ((pc = chunk_get_next(pc)) != NULL) { if (chunk_is_newline(pc)) { if ((nl_count > 0) || (pc->nl_count > 1)) { return(false); } nl_count++; } else { nl_count = 0; if (!chunk_is_single_line_comment(pc)) { /* here we check for things to run into that we wouldn't want to * indent the comment for. for example, non-single line comment, * closing brace */ if (chunk_is_comment(pc) || chunk_is_closing_brace(pc)) { return(false); } return(true); } } } return(false); } /** * REVISIT: This needs to be re-checked, maybe cleaned up * * Indents comments in a (hopefully) smart manner. * * There are two type of comments that get indented: * - stand alone (ie, no tokens on the line before the comment) * - trailing comments (last token on the line apart from a linefeed) * + note that a stand-alone comment is a special case of a trailing * * The stand alone comments will get indented in one of three ways: * - column 1: * + There is an empty line before the comment AND the indent level is 0 * + The comment was originally in column 1 * * - Same column as trailing comment on previous line (ie, aligned) * + if originally within TBD (3) columns of the previous comment * * - syntax indent level * + doesn't fit in the previous categories * * Options modify this behavior: * - keep original column (don't move the comment, if possible) * - keep relative column (move out the same amount as first item on line) * - fix trailing comment in column TBD * * @param pc The comment, which is the first item on a line * @param col The column if this is to be put at indent level */ static void indent_comment(chunk_t *pc, int col) { chunk_t *nl; chunk_t *prev; LOG_FMT(LCMTIND, "%s: line %d, col %d, level %d: ", __func__, pc->orig_line, pc->orig_col, pc->level); /* force column 1 comment to column 1 if not changing them */ if ((pc->orig_col == 1) && !cpd.settings[UO_indent_col1_comment].b && ((pc->flags & PCF_INSERTED) == 0)) { LOG_FMT(LCMTIND, "rule 1 - keep in col 1\n"); reindent_line(pc, 1); return; } nl = chunk_get_prev(pc); /* outside of any expression or statement? */ if (pc->level == 0) { if ((nl != NULL) && (nl->nl_count > 1)) { LOG_FMT(LCMTIND, "rule 2 - level 0, nl before\n"); reindent_line(pc, 1); return; } } prev = chunk_get_prev(nl); if (chunk_is_comment(prev) && (nl->nl_count == 1)) { int coldiff = prev->orig_col - pc->orig_col; if ((coldiff <= 3) && (coldiff >= -3)) { reindent_line(pc, prev->column); LOG_FMT(LCMTIND, "rule 3 - prev comment, coldiff = %d, now in %d\n", coldiff, pc->column); return; } } /* check if special single line comment rule applies */ if ((cpd.settings[UO_indent_sing_line_comments].n > 0) && single_line_comment_indent_rule_applies(pc)) { reindent_line(pc, col + cpd.settings[UO_indent_sing_line_comments].n); LOG_FMT(LCMTIND, "rule 4 - single line comment indent, now in %d\n", pc->column); return; } LOG_FMT(LCMTIND, "rule 5 - fall-through, stay in %d\n", col); reindent_line(pc, col); } /** * Scan to see if the whole file is covered by one #ifdef */ static bool ifdef_over_whole_file() { chunk_t *pc; chunk_t *next; int stage = 0; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (chunk_is_comment(pc) || chunk_is_newline(pc)) { continue; } if (stage == 0) { /* Check the first PP, make sure it is an #if type */ if (pc->type != CT_PREPROC) { break; } next = chunk_get_next(pc); if ((next == NULL) || (next->type != CT_PP_IF)) { break; } stage = 1; } else if (stage == 1) { /* Scan until a PP at level 0 is found - the close to the #if */ if ((pc->type == CT_PREPROC) && (pc->pp_level == 0)) { stage = 2; } continue; } else if (stage == 2) { /* We should only see the rest of the preprocessor */ if ((pc->type == CT_PREPROC) || ((pc->flags & PCF_IN_PREPROC) == 0)) { stage = 0; break; } } } if (stage == 2) { LOG_FMT(LINFO, "The whole file is covered by a #IF\n"); return(true); } return(stage == 2); } /** * Indent the preprocessor stuff from column 1. * FIXME: This is broken if there is a comment or escaped newline * between '#' and 'define'. */ void indent_preproc(void) { chunk_t *pc; chunk_t *next; int pp_level; int pp_level_sub = 0; /* Scan to see if the whole file is covered by one #ifdef */ if (ifdef_over_whole_file()) { pp_level_sub = 1; } for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type != CT_PREPROC) { continue; } next = chunk_get_next_ncnl(pc); pp_level = pc->pp_level - pp_level_sub; if (pp_level < 0) { pp_level = 0; } /* Adjust the indent of the '#' */ if ((cpd.settings[UO_pp_indent].a & AV_ADD) != 0) { reindent_line(pc, 1 + pp_level * cpd.settings[UO_pp_indent_count].n); } else if ((cpd.settings[UO_pp_indent].a & AV_REMOVE) != 0) { reindent_line(pc, 1); } /* Add spacing by adjusting the length */ if ((cpd.settings[UO_pp_space].a != AV_IGNORE) && (next != NULL)) { if ((cpd.settings[UO_pp_space].a & AV_ADD) != 0) { int mult = cpd.settings[UO_pp_space_count].n; if (mult < 1) { mult = 1; } reindent_line(next, pc->column + pc->len() + (pp_level * mult)); } else if ((cpd.settings[UO_pp_space].a & AV_REMOVE) != 0) { reindent_line(next, pc->column + pc->len()); } } /* Mark as already handled if not region stuff or in column 1 */ if ((!cpd.settings[UO_pp_indent_at_level].b || (pc->brace_level <= (pc->parent_type == CT_PP_DEFINE ? 1 : 0))) && (pc->parent_type != CT_PP_REGION) && (pc->parent_type != CT_PP_ENDREGION)) { if (!cpd.settings[UO_pp_define_at_level].b || (pc->parent_type != CT_PP_DEFINE)) { pc->flags |= PCF_DONT_INDENT; } } LOG_FMT(LPPIS, "%s: Indent line %d to %d (len %d, next->col %d)\n", __func__, pc->orig_line, 1 + pp_level, pc->len(), next->column); } } uncrustify-0.59/src/width.cpp0000644000175000017500000003255611630457175013241 00000000000000/** * @file width.cpp * Limits line width. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" static void split_line(chunk_t *pc); static void split_fcn_params(chunk_t *start); static void split_fcn_params_full(chunk_t *start); static void split_for_stmt(chunk_t *start); static_inline bool is_past_width(chunk_t *pc) { return((pc->column + pc->len()) > cpd.settings[UO_code_width].n); } /** * Split right after the chunk */ static void split_before_chunk(chunk_t *pc) { LOG_FMT(LSPLIT, "%s: %s\n", __func__, pc->str.c_str()); if (!chunk_is_newline(pc) && !chunk_is_newline(chunk_get_prev(pc))) { newline_add_before(pc); reindent_line(pc, pc->brace_level * cpd.settings[UO_indent_columns].n); cpd.changes++; } } /** * Step forward until a token goes beyond the limit and then call split_line() * to split the line at or before that point. */ void do_code_width(void) { chunk_t *pc; LOG_FMT(LSPLIT, "%s\n", __func__); for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (!chunk_is_newline(pc) && !chunk_is_comment(pc) && (pc->type != CT_SPACE) && is_past_width(pc)) { split_line(pc); } } } struct cw_entry { chunk_t *pc; int pri; }; struct token_pri { c_token_t tok; int pri; }; static const token_pri pri_table[] = { { CT_SEMICOLON, 1 }, { CT_COMMA, 2 }, { CT_BOOL, 3 }, { CT_COMPARE, 4 }, { CT_ARITH, 5 }, { CT_ASSIGN, 6 }, //{ CT_DC_MEMBER, 10 }, //{ CT_MEMBER, 10 }, }; static int get_split_pri(c_token_t tok) { int idx; for (idx = 0; idx < (int)ARRAY_SIZE(pri_table); idx++) { if (pri_table[idx].tok == tok) { return(pri_table[idx].pri); } } return(0); } /** * Checks to see if pc is a better spot to split. * This should only be called going BACKWARDS (ie prev) * A lower level wins * * Splitting Preference: * - semicolon * - comma * - boolean op * - comparison * - arithmetic op * - assignment */ static void try_split_here(cw_entry& ent, chunk_t *pc) { chunk_t *prev; int pc_pri = get_split_pri(pc->type); if (pc_pri == 0) { return; } /* Can't split after a newline */ prev = chunk_get_prev(pc); if ((prev == NULL) || chunk_is_newline(prev)) { return; } /* Check levels first */ bool change = false; if ((ent.pc == NULL) || (pc->level < ent.pc->level)) { change = true; } else { if ((pc->level > ent.pc->level) && (pc_pri <= ent.pri)) { change = true; } } if (change) { ent.pc = pc; ent.pri = pc_pri; } } /** * Scan backwards to find the most appropriate spot to split the line * and insert a newline. * * See if this needs special function handling. * Scan backwards and find the best token for the split. * * @param start The first chunk that exceeded the limit */ static void split_line(chunk_t *start) { LOG_FMT(LSPLIT, "%s: line %d, col %d token:%s[%s] (IN_FUNC=%d) ", __func__, start->orig_line, start->column, start->str.c_str(), get_token_name(start->type), (start->flags & (PCF_IN_FCN_DEF | PCF_IN_FCN_CALL)) != 0); /* Don't break before a close, comma, or colon */ if ((start->type == CT_PAREN_CLOSE) || (start->type == CT_PAREN_OPEN) || (start->type == CT_FPAREN_CLOSE) || (start->type == CT_FPAREN_OPEN) || (start->type == CT_SPAREN_CLOSE) || (start->type == CT_SPAREN_OPEN) || (start->type == CT_ANGLE_CLOSE) || (start->type == CT_BRACE_CLOSE) || (start->type == CT_COMMA) || (start->type == CT_SEMICOLON) || (start->type == CT_VSEMICOLON) || (start->len() == 0)) { LOG_FMT(LSPLIT, " ** NO GO **\n"); /*TODO: Add in logic to handle 'hard' limits by backing up a token */ return; } /* Check to see if we are in a for statement */ if ((start->flags & PCF_IN_FOR) != 0) { LOG_FMT(LSPLIT, " ** FOR SPLIT **\n"); split_for_stmt(start); if (!is_past_width(start)) { return; } LOG_FMT(LSPLIT, "%s: for split didn't work\n", __func__); } /* If this is in a function call or prototype, split on commas or right * after the open paren */ else if (((start->flags & PCF_IN_FCN_DEF) != 0) || ((start->level == (start->brace_level + 1)) && ((start->flags & PCF_IN_FCN_CALL) != 0))) { LOG_FMT(LSPLIT, " ** FUNC SPLIT **\n"); if (cpd.settings[UO_ls_func_split_full].b) { split_fcn_params_full(start); if (!is_past_width(start)) { return; } } split_fcn_params(start); if (!is_past_width(start)) { return; } LOG_FMT(LSPLIT, "%s: func split didn't work\n", __func__); } /** * Try to find the best spot to split the line */ cw_entry ent; memset(&ent, 0, sizeof(ent)); chunk_t *pc = start; chunk_t *prev; while (((pc = chunk_get_prev(pc)) != NULL) && !chunk_is_newline(pc)) { if (pc->type != CT_SPACE) { try_split_here(ent, pc); } } if (ent.pc == NULL) { LOG_FMT(LSPLIT, "%s: TRY_SPLIT yielded NO SOLUTION for line %d at %s [%s]\n", __func__, start->orig_line, start->str.c_str(), get_token_name(start->type)); } else { LOG_FMT(LSPLIT, "%s: TRY_SPLIT yielded '%s' [%s] on line %d\n", __func__, ent.pc->str.c_str(), get_token_name(ent.pc->type), ent.pc->orig_line); } /* Break before the token instead of after it according to the pos_xxx rules */ if ((chunk_is_token(ent.pc, CT_ARITH) && (cpd.settings[UO_pos_arith].tp & TP_LEAD)) || (chunk_is_token(ent.pc, CT_ASSIGN) && (cpd.settings[UO_pos_assign].tp & TP_LEAD)) || (chunk_is_token(ent.pc, CT_COMPARE) && (cpd.settings[UO_pos_compare].tp & TP_LEAD)) || ((chunk_is_token(ent.pc, CT_COND_COLON) || chunk_is_token(ent.pc, CT_QUESTION)) && (cpd.settings[UO_pos_conditional].tp & TP_LEAD)) || (chunk_is_token(ent.pc, CT_BOOL) && (cpd.settings[UO_pos_bool].tp & TP_LEAD))) { pc = ent.pc; } else { pc = chunk_get_next(ent.pc); } if (pc == NULL) { pc = start; } /* add a newline before pc */ prev = chunk_get_prev(pc); if ((prev != NULL) && !chunk_is_newline(pc) && !chunk_is_newline(prev)) { int plen = (pc->len() < 5) ? pc->len() : 5; int slen = (start->len() < 5) ? start->len() : 5; LOG_FMT(LSPLIT, " '%.*s' [%s], started on token '%.*s' [%s]\n", plen, pc->str.c_str(), get_token_name(pc->type), slen, start->str.c_str(), get_token_name(start->type)); split_before_chunk(pc); } } /** * A for statement is too long. * Step backwards and forwards to find the semicolons * Try splitting at the semicolons first. * If that doesn't work, then look for a comma at paren level. * If that doesn't work, then look for an assignment at paren level. * If that doesn't work, then give up. */ static void split_for_stmt(chunk_t *start) { int count = 0; int max_cnt = cpd.settings[UO_ls_for_split_full].b ? 2 : 1; chunk_t *st[2]; chunk_t *pc; chunk_t *open_paren = NULL; int nl_cnt = 0; LOG_FMT(LSPLIT, "%s: starting on %s, line %d\n", __func__, start->str.c_str(), start->orig_line); /* Find the open paren so we know the level and count newlines */ pc = start; while ((pc = chunk_get_prev(pc)) != NULL) { if (pc->type == CT_SPAREN_OPEN) { open_paren = pc; break; } if (pc->nl_count > 0) { nl_cnt += pc->nl_count; } } if (open_paren == NULL) { LOG_FMT(LSYS, "No open paren\n"); return; } /* see if we started on the semicolon */ pc = start; if ((pc->type == CT_SEMICOLON) && (pc->parent_type == CT_FOR)) { st[count++] = pc; } /* first scan backwards for the semicolons */ while ((count < max_cnt) && ((pc = chunk_get_prev(pc)) != NULL) && (pc->flags & PCF_IN_SPAREN)) { if ((pc->type == CT_SEMICOLON) && (pc->parent_type == CT_FOR)) { st[count++] = pc; } } /* And now scan forward */ pc = start; while ((count < max_cnt) && ((pc = chunk_get_next(pc)) != NULL) && (pc->flags & PCF_IN_SPAREN)) { if ((pc->type == CT_SEMICOLON) && (pc->parent_type == CT_FOR)) { st[count++] = pc; } } while (--count >= 0) { LOG_FMT(LSPLIT, "%s: split before %s\n", __func__, st[count]->str.c_str()); split_before_chunk(chunk_get_next(st[count])); } if (!is_past_width(start) || (nl_cnt > 0)) { return; } /* Still past width, check for commas at paren level */ pc = open_paren; while ((pc = chunk_get_next(pc)) != start) { if ((pc->type == CT_COMMA) && (pc->level == (open_paren->level + 1))) { split_before_chunk(chunk_get_next(pc)); if (!is_past_width(pc)) { return; } } } /* Still past width, check for a assignments at paren level */ pc = open_paren; while ((pc = chunk_get_next(pc)) != start) { if ((pc->type == CT_ASSIGN) && (pc->level == (open_paren->level + 1))) { split_before_chunk(chunk_get_next(pc)); if (!is_past_width(pc)) { return; } } } /* Oh, well. We tried. */ } /** * Splits the parameters at every comma that is at the fparen level. * * @param start the offending token */ static void split_fcn_params_full(chunk_t *start) { LOG_FMT(LSPLIT, "%s", __func__); chunk_t *fpo; chunk_t *pc; /* Find the opening fparen */ fpo = start; while (((fpo = chunk_get_prev(fpo)) != NULL) && (fpo->type != CT_FPAREN_OPEN)) { /* do nothing */ } /* Now break after every comma */ pc = fpo; while ((pc = chunk_get_next_ncnl(pc)) != NULL) { if (pc->level <= fpo->level) { break; } if ((pc->level == (fpo->level + 1)) && (pc->type == CT_COMMA)) { split_before_chunk(chunk_get_next(pc)); } } } /** * Figures out where to split a function def/proto/call * * For fcn protos and defs. Also fcn calls where level == brace_level: * - find the open fparen * + if it doesn't have a newline right after it * * see if all parameters will fit individually after the paren * * if not, throw a newline after the open paren & return * - scan backwards to the open fparen or comma * + if there isn't a newline after that item, add one & return * + otherwise, add a newline before the start token * * @param start the offending token * @return the token that should have a newline * inserted before it */ static void split_fcn_params(chunk_t *start) { LOG_FMT(LSPLIT, " %s: ", __func__); chunk_t *prev; chunk_t *fpo; chunk_t *pc; /* Find the opening fparen */ fpo = start; while (((fpo = chunk_get_prev(fpo)) != NULL) && (fpo->type != CT_FPAREN_OPEN)) { /* do nothing */ } pc = chunk_get_next(fpo); if (!chunk_is_newline(pc)) { int min_col = pc->column; int max_width = 0; int cur_width = 0; int last_col = -1; LOG_FMT(LSPLIT, " mincol=%d, max_width=%d ", min_col, cpd.settings[UO_code_width].n - min_col); while (pc != NULL) { if (chunk_is_newline(pc)) { last_col = -1; } else { if (last_col < 0) { last_col = pc->column; } cur_width += (pc->column - last_col) + pc->len(); last_col = pc->column + pc->len(); if ((pc->type == CT_COMMA) || (pc->type == CT_FPAREN_CLOSE)) { cur_width--; LOG_FMT(LSPLIT, " width=%d ", cur_width); if (cur_width > max_width) { max_width = cur_width; if ((max_width + min_col) > cpd.settings[UO_code_width].n) { break; } } cur_width = 0; last_col = -1; if (pc->type == CT_FPAREN_CLOSE) { break; } } } pc = chunk_get_next(pc); } if ((max_width + min_col) > cpd.settings[UO_code_width].n) { LOG_FMT(LSPLIT, " - A param won't fit, nl after open paren."); split_before_chunk(chunk_get_next(fpo)); return; } } /* back up until the prev is a comma */ prev = pc; while ((prev = chunk_get_prev(prev)) != NULL) { if (chunk_is_newline(prev) || (prev->type == CT_COMMA)) { break; } if (prev->type == CT_FPAREN_OPEN) { /* Don't split "()" */ pc = chunk_get_next(prev); if (pc->type != c_token_t(prev->type + 1)) { break; } } } if (prev != NULL) { LOG_FMT(LSPLIT, " -- ended on [%s] -- ", get_token_name(prev->type)); } if (prev != NULL) { split_before_chunk(chunk_get_next(prev)); } } uncrustify-0.59/src/ChunkStack.h0000644000175000017500000000232211604503370013577 00000000000000/** * @file ChunkStack.h * Manages a simple stack of chunks * * @author Ben Gardner * @license GPL v2+ */ #ifndef CHUNKSTACK_H_INCLUDED #define CHUNKSTACK_H_INCLUDED #include "uncrustify_types.h" #include class ChunkStack { public: struct Entry { Entry() : m_seqnum(0), m_pc(0) { } Entry(const Entry& ref) : m_seqnum(ref.m_seqnum), m_pc(ref.m_pc) { } Entry(int sn, chunk_t *pc) : m_seqnum(sn), m_pc(pc) { } int m_seqnum; chunk_t *m_pc; }; protected: deque m_cse; int m_seqnum; // current seq num public: ChunkStack() : m_seqnum(0) { } ChunkStack(const ChunkStack& cs) { Set(cs); } virtual ~ChunkStack() { } void Set(const ChunkStack& cs); void Push(chunk_t *pc) { Push(pc, ++m_seqnum); } bool Empty() const { return(m_cse.empty()); } int Len() const { return(m_cse.size()); } const Entry *Top() const; const Entry *Get(int idx) const; chunk_t *GetChunk(int idx) const; chunk_t *Pop(); void Push(chunk_t *pc, int seqnum); void Reset() { m_cse.clear(); } void Zap(int idx); void Collapse(); }; #endif /* CHUNKSTACK_H_INCLUDED */ uncrustify-0.59/src/char_table.h0000644000175000017500000000464511560403150013633 00000000000000/** * @file char_table.h * A simple table to help tokenize stuff. * Used to parse strings (paired char) and words. * * @author Ben Gardner * @license GPL v2+ */ #ifndef CHAR_TABLE_H_INCLUDED #define CHAR_TABLE_H_INCLUDED /** * bit0-7 = paired char * bit8 = OK for keyword 1st char * bit9 = OK for keyword 2+ char */ struct CharTable { static int chars[128]; enum { KW1 = 0x0100, KW2 = 0x0200, }; static inline int Get(char ch) { if ((ch & 0x80) == 0) { return(chars[(int)ch]); } /* HACK: If the top bit is set, then we are likely dealing with UTF-8, * and since that is only allowed in identifiers, then assume that is * what this is. This only prevents corruption, it does not properly * handle UTF-8 because the byte length and screen size are assumed to be * the same. */ return(KW1 | KW2); } static inline bool IsKw1(char ch) { return((Get(ch) & KW1) != 0); } static inline bool IsKw2(char ch) { return((Get(ch) & KW2) != 0); } }; #ifdef DEFINE_CHAR_TABLE int CharTable::chars[128] = { 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, /* [........] */ 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, /* [........] */ 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, /* [........] */ 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, /* [........] */ 0x000, 0x000, 0x022, 0x000, 0x300, 0x000, 0x000, 0x027, /* [ !"#$%&'] */ 0x029, 0x028, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, /* [()*+,-./] */ 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, 0x200, /* [01234567] */ 0x200, 0x200, 0x000, 0x000, 0x03e, 0x000, 0x03c, 0x000, /* [89:;<=>?] */ 0x200, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, /* [@ABCDEFG] */ 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, /* [HIJKLMNO] */ 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, /* [PQRSTUVW] */ 0x300, 0x300, 0x300, 0x05d, 0x000, 0x05b, 0x000, 0x300, /* [XYZ[\]^_] */ 0x060, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, /* [`abcdefg] */ 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, /* [hijklmno] */ 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, 0x300, /* [pqrstuvw] */ 0x300, 0x300, 0x300, 0x07d, 0x000, 0x07b, 0x000, 0x000, /* [xyz{|}~.] */ }; #endif /* DEFINE_CHAR_TABLE */ #endif /* CHAR_TABLE_H_INCLUDED */ uncrustify-0.59/src/logger.cpp0000644000175000017500000001637211630457175013377 00000000000000/** * @file logger.cpp * * Functions to do logging. * * If a log statement ends in a newline, the current log is ended. * When the log severity changes, an implicit newline is inserted. * * @author Ben Gardner * @license GPL v2+ */ #include "logger.h" #include #include #include "unc_ctype.h" /** Private log structure */ struct log_buf { log_buf() : log_file(0), sev(0), in_log(0), buf_len(0), show_hdr(false) { } FILE *log_file; log_sev_t sev; int in_log; char buf[256]; int buf_len; log_mask_t mask; bool show_hdr; }; static struct log_buf g_log; /** * Initializes the log subsystem - call this first. * This function sets the log stream and enables the top 3 sevs (0-2). * * @param log_file NULL for stderr or the FILE stream for logs. */ void log_init(FILE *log_file) { /* set the top 3 severities */ logmask_set_all(g_log.mask, false); log_set_sev(0, true); log_set_sev(1, true); log_set_sev(2, true); g_log.log_file = (log_file != NULL) ? log_file : stderr; } /** * Show or hide the severity prefix "<1>" * * @param true=show false=hide */ void log_show_sev(bool show) { g_log.show_hdr = show; } /** * Returns whether a log severity is active. * * @param sev The severity * @return true/false */ bool log_sev_on(log_sev_t sev) { return(logmask_test(g_log.mask, sev)); } /** * Sets a log sev on or off * * @param sev The severity * @return true/false */ void log_set_sev(log_sev_t sev, bool value) { logmask_set_sev(g_log.mask, sev, value); } /** * Sets the log mask * * @param mask The mask to copy */ void log_set_mask(const log_mask_t& mask) { g_log.mask = mask; } /** * Gets the log mask * * @param mask Where to copy the mask */ void log_get_mask(log_mask_t& mask) { mask = g_log.mask; } /** * Flushes the cached log text to the stream * * @param force_nl Append NL if not present */ static void log_flush(bool force_nl) { int dummy; /* get the compiler to shut up */ if (g_log.buf_len > 0) { if (force_nl && (g_log.buf[g_log.buf_len - 1] != '\n')) { g_log.buf[g_log.buf_len++] = '\n'; g_log.buf[g_log.buf_len] = 0; } dummy = fwrite(g_log.buf, 1, g_log.buf_len, g_log.log_file); g_log.buf_len = 0; } } /** * Starts the log statement by flushing if needed and printing the header * * @param sev The log severity * @return The number of bytes available */ static size_t log_start(log_sev_t sev) { if (sev != g_log.sev) { if (g_log.buf_len > 0) { log_flush(true); } g_log.sev = sev; g_log.in_log = false; } /* If not in a log, the buffer is empty. Add the header, if enabled. */ if (!g_log.in_log && g_log.show_hdr) { g_log.buf_len = snprintf(g_log.buf, sizeof(g_log.buf), "<%d>", sev); } int cap = ((int)sizeof(g_log.buf) - 2) - g_log.buf_len; return((cap > 0) ? (size_t)cap : 0); } /** * Cleans up after a log statement by detecting whether the log is done, * (it ends in a newline) and possibly flushing the log. */ static void log_end(void) { g_log.in_log = (g_log.buf[g_log.buf_len - 1] != '\n'); if (!g_log.in_log || (g_log.buf_len > (int)(sizeof(g_log.buf) / 2))) { log_flush(false); } } /** * Logs a string of known length * * @param sev The severity * @param str The pointer to the string * @param len The length of the string from strlen(str) */ void log_str(log_sev_t sev, const char *str, int len) { if ((str == NULL) || (len <= 0) || !log_sev_on(sev)) { return; } size_t cap = log_start(sev); if (cap > 0) { if (len > (int)cap) { len = cap; } memcpy(&g_log.buf[g_log.buf_len], str, len); g_log.buf_len += len; g_log.buf[g_log.buf_len] = 0; } log_end(); } /** * Logs a formatted string -- similiar to printf() * * @param sev The severity * @param fmt The format string * @param ... Additional arguments */ void log_fmt(log_sev_t sev, const char *fmt, ...) { va_list args; int len; size_t cap; if ((fmt == NULL) || !log_sev_on(sev)) { return; } /* Some implementation of vsnprintf() return the number of characters * that would have been stored if the buffer was large enough instead of * the number of characters actually stored. */ cap = log_start(sev); /* Add on the variable log parameters to the log string */ va_start(args, fmt); len = vsnprintf(&g_log.buf[g_log.buf_len], cap, fmt, args); va_end(args); if (len > 0) { if (len > (int)cap) { len = cap; } g_log.buf_len += len; g_log.buf[g_log.buf_len] = 0; } log_end(); } /** * Dumps hex characters inline, no newlines inserted * * @param sev The severity * @param data The data to log * @param len The number of bytes to log */ void log_hex(log_sev_t sev, const void *vdata, int len) { const UINT8 *dat = (const UINT8 *)vdata; int idx; char buf[80]; if ((vdata == NULL) || !log_sev_on(sev)) { return; } idx = 0; while (len-- > 0) { buf[idx++] = to_hex_char(*dat >> 4); buf[idx++] = to_hex_char(*dat); dat++; if (idx >= (int)(sizeof(buf) - 3)) { buf[idx] = 0; log_str(sev, buf, idx); idx = 0; } } if (idx > 0) { buf[idx] = 0; log_str(sev, buf, idx); } } /** * Logs a block of data in a pretty hex format * Numbers on the left, characters on the right, just like I like it. * * @param sev The severity * @param data The data to log * @param len The number of bytes to log */ void log_hex_blk(log_sev_t sev, const void *data, int len) { static char buf[80] = "nnn | XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX | cccccccccccccccc\n"; const UINT8 *dat = (const UINT8 *)data; int idx; int count; int str_idx = 0; int chr_idx = 0; int tmp; int total; if ((data == NULL) || (len <= 0) || !log_sev_on(sev)) { return; } /* * Dump the specified number of bytes in hex, 16 byte per line by * creating a string and then calling log_str() */ /* Loop through the data of the current iov */ count = 0; total = 0; for (idx = 0; idx < len; idx++) { if (count == 0) { str_idx = 6; chr_idx = 56; buf[0] = to_hex_char(total >> 12); buf[1] = to_hex_char(total >> 8); buf[2] = to_hex_char(total >> 4); } tmp = dat[idx]; buf[str_idx] = to_hex_char(tmp >> 4); buf[str_idx + 1] = to_hex_char(tmp); str_idx += 3; buf[chr_idx++] = unc_isprint(tmp) ? tmp : '.'; total++; count++; if (count >= 16) { count = 0; log_str(sev, buf, 73); } } /* ** Print partial line if any */ if (count != 0) { /* Clear out any junk */ while (count < 16) { buf[str_idx] = ' '; /* MSB hex */ buf[str_idx + 1] = ' '; /* LSB hex */ str_idx += 3; buf[chr_idx++] = ' '; count++; } log_str(sev, buf, 73); } } uncrustify-0.59/src/unc_ctype.h0000644000175000017500000000250711625615300013537 00000000000000/** * @file unc_ctype.h * The ctype function are only required to handle values 0-255 and EOF. * A char is sign-extended when cast to an int. * With some C libraries, these values cause a crash. * These wrappers will properly handle all char values. * * @author Ben Gardner * @license GPL v2+ */ #ifndef UNC_CTYPE_H_INCLUDED #define UNC_CTYPE_H_INCLUDED #include /** * Truncate anything except EOF (-1) to 0-255 */ static inline int unc_fix_ctype(int ch) { return((ch == -1) ? -1 : (ch & 0xff)); } static inline int unc_isspace(int ch) { return(isspace(unc_fix_ctype(ch))); } static inline int unc_isprint(int ch) { return(isprint(unc_fix_ctype(ch))); } static inline int unc_isalpha(int ch) { return(isalpha(unc_fix_ctype(ch))); } static inline int unc_isalnum(int ch) { return(isalnum(unc_fix_ctype(ch))); } static inline int unc_toupper(int ch) { return(toupper(unc_fix_ctype(ch))); } static inline int unc_tolower(int ch) { return(tolower(unc_fix_ctype(ch))); } static inline int unc_isxdigit(int ch) { return(isxdigit(unc_fix_ctype(ch))); } static inline int unc_isdigit(int ch) { return(isdigit(unc_fix_ctype(ch))); } static inline int unc_isupper(int ch) { return(isalpha(unc_fix_ctype(ch)) && (unc_toupper(unc_fix_ctype(ch)) == ch)); } #endif /* UNC_CTYPE_H_INCLUDED */ uncrustify-0.59/src/prototypes.h0000644000175000017500000001635511631560313014004 00000000000000/** * @file prototypes.h * Big jumble of prototypes used in Uncrustify. * * @author Ben Gardner * @license GPL v2+ */ #ifndef C_PARSE_PROTOTYPES_H_INCLUDED #define C_PARSE_PROTOTYPES_H_INCLUDED #include "uncrustify_types.h" #include "chunk_list.h" #include #include /* * uncrustify.cpp */ const char *get_token_name(c_token_t token); c_token_t find_token_name(const char *text); void log_pcf_flags(log_sev_t sev, UINT64 flags); const char *path_basename(const char *path); int path_dirname_len(const char *filename); const char *get_file_extension(int& idx); /* * detect.cpp */ void detect_options(); /* * output.cpp */ void output_text(FILE *pfile); void output_parsed(FILE *pfile); void output_options(FILE *pfile); void add_long_preprocessor_conditional_block_comment(void); /* * options.cpp */ void unc_begin_group(uncrustify_groups id, const char *short_desc, const char *long_desc = NULL); void register_options(void); void set_option_defaults(void); int load_option_file(const char *filename); int save_option_file(FILE *pfile, bool withDoc); int set_option_value(const char *name, const char *value); const group_map_value *get_group_name(int ug); const option_map_value *get_option_name(int uo); void print_options(FILE *pfile, bool verbose); string argtype_to_string(argtype_e argtype); string bool_to_string(bool val); string argval_to_string(argval_t argval); string number_to_string(int number); string lineends_to_string(lineends_e linends); string tokenpos_to_string(tokenpos_e tokenpos); string op_val_to_string(argtype_e argtype, op_val_t op_val); /* * indent.cpp */ void indent_text(void); void indent_preproc(void); void indent_to_column(chunk_t *pc, int column); void align_to_column(chunk_t *pc, int column); #define reindent_line(pc, col) reindent_line2(pc, col, __func__, __LINE__) void reindent_line2(chunk_t *pc, int column, const char *fcn_name, int lineno); /* * align.cpp */ void align_all(void); void align_backslash_newline(void); void align_right_comments(void); void align_preprocessor(void); void align_struct_initializers(void); chunk_t *align_nl_cont(chunk_t *start); chunk_t *align_assign(chunk_t *first, int span, int thresh); void quick_align_again(void); /* * braces.cpp */ void do_braces(void); void add_long_closebrace_comment(void); chunk_t *insert_comment_after(chunk_t *ref, c_token_t cmt_type, const unc_text& cmt_text); /* * sorting.cpp */ void sort_imports(void); /* * parens.cpp */ void do_parens(void); /* * space.cpp */ void space_text(void); void space_text_balance_nested_parens(void); int space_col_align(chunk_t *first, chunk_t *second); int space_needed(chunk_t *first, chunk_t *second); void space_add_after(chunk_t *pc, int count); /* * combine.cpp */ void fix_symbols(void); void combine_labels(void); void mark_comments(void); void make_type(chunk_t *pc); void flag_series(chunk_t *start, chunk_t *end, UINT64 flags, chunk_nav_t nav = CNAV_ALL); chunk_t *skip_template_next(chunk_t *ang_open); chunk_t *skip_template_prev(chunk_t *ang_close); chunk_t *skip_attribute_next(chunk_t *attr); chunk_t *skip_attribute_prev(chunk_t *fp_close); void remove_extra_returns(); /* * newlines.cpp */ void newlines_cleanup_braces(void); void newlines_insert_blank_lines(void); void newlines_squeeze_ifdef(void); void newlines_eat_start_end(void); void newlines_chunk_pos(c_token_t chunk_type, tokenpos_e mode); void newlines_class_colon_pos(void); void newlines_cleanup_dup(void); void newline_after_multiline_comment(void); void do_blank_lines(void); void newline_iarf(chunk_t *pc, argval_t av); #define newline_add_before(pc) newline_add_before2(pc, __func__, __LINE__) chunk_t *newline_add_before2(chunk_t *pc, const char *fcn, int line); #define newline_add_after(pc) newline_add_after2(pc, __func__, __LINE__) chunk_t *newline_add_after2(chunk_t *pc, const char *fcn, int line); #define newline_del_between(start, end) \ newline_del_between2(start, end, __func__, __LINE__) void newline_del_between2(chunk_t *start, chunk_t *end, const char *func, int line); #define newline_add_between(start, end) \ newline_add_between2(start, end, __func__, __LINE__) chunk_t *newline_add_between2(chunk_t *start, chunk_t *end, const char *func, int line); /* * tokenize.cpp */ void tokenize(const deque& data, chunk_t *ref); /* * tokenize_cleanup.cpp */ void tokenize_cleanup(void); /* * brace_cleanup.cpp */ void brace_cleanup(void); /* * keywords.cpp */ int load_keyword_file(const char *filename); c_token_t find_keyword_type(const char *word, int len); void add_keyword(const char *tag, c_token_t type); void output_types(FILE *pfile); void print_keywords(FILE *pfile); void clear_keyword_file(void); pattern_class get_token_pattern_class(c_token_t tok); bool keywords_are_sorted(void); /* * defines.cpp */ int load_define_file(const char *filename); void add_define(const char *tag, const char *value); void output_defines(FILE *pfile); void print_defines(FILE *pfile); void clear_defines(void); /* * punctuators.cpp */ const chunk_tag_t *find_punctuator(const char *str, int lang_flags); /* * parse_frame.cpp */ void pf_copy(struct parse_frame *dst, const struct parse_frame *src); void pf_push(struct parse_frame *pf); void pf_push_under(struct parse_frame *pf); void pf_copy_tos(struct parse_frame *pf); void pf_trash_tos(void); void pf_pop(struct parse_frame *pf); int pf_check(struct parse_frame *frm, chunk_t *pc); /* * width.cpp */ void do_code_width(void); /* * lang_pawn.cpp */ void pawn_prescan(void); void pawn_add_virtual_semicolons(); chunk_t *pawn_check_vsemicolon(chunk_t *pc); void pawn_scrub_vsemi(void); chunk_t *pawn_add_vsemi_after(chunk_t *pc); /* * universalindentgui.cpp */ void print_universal_indent_cfg(FILE *pfile); /* * unicode.cpp */ void write_bom(FILE *pf, CharEncoding enc); void write_char(FILE *pf, int ch, CharEncoding enc); void write_string(FILE *pf, const deque& text, CharEncoding enc); void write_string(FILE *pf, const char *ascii_text, CharEncoding enc); bool decode_unicode(const vector& in_data, deque& out_data, CharEncoding& enc, bool& has_bom); void encode_utf8(int ch, vector& res); /* * semicolons.cpp */ void remove_extra_semicolons(void); /** * Advances to the next tab stop. * Column 1 is the left-most column. * * @param col The current column * @param tabsize The tabsize * @return the next tabstop column */ static_inline int calc_next_tab_column(int col, int tabsize) { if (col <= 0) { col = 1; } col = 1 + ((((col - 1) / tabsize) + 1) * tabsize); return(col); } /** * Advances to the next tab stop for output. * * @param col The current column * @return the next tabstop column */ static_inline int next_tab_column(int col) { return(calc_next_tab_column(col, cpd.settings[UO_output_tab_size].n)); } /** * Advances to the next tab stop if not currently on one. * * @param col The current column * @return the next tabstop column */ static_inline int align_tab_column(int col) { if (col <= 0) { col = 1; } if ((col % cpd.settings[UO_output_tab_size].n) != 1) { col = next_tab_column(col); } return(col); } #endif /* C_PARSE_PROTOTYPES_H_INCLUDED */ uncrustify-0.59/src/args.h0000644000175000017500000000614611506773274012522 00000000000000/** * @file args.h * Parses command line arguments. * * This differs from the GNU/getopt way in that: * - parameters cannot mixed "-e -f" is not the same as "-ef" * - knowledge of the complete set of parameters is not required * - this means you can handle args in multiple spots * - it is more portable * * @author Ben Gardner * @license GPL v2+ */ #ifndef ARGS_H_INCLUDED #define ARGS_H_INCLUDED #include "base_types.h" class Args { protected: int m_count; char **m_values; UINT8 *m_used; /* array of bits */ public: /** * Initializes the argument library. * This keeps a reference to argv, so don't change it. * * @param argc The argc that was passed to main() * @param argv The argv that was passed to main() */ Args(int argc, char **argv); /** Standard destructor */ ~Args(); /** * Checks to see if an arg w/o a value is present. * Just scans the args looking for an exact match. * * "-c" matches "-c", but not "-call" or "-ec" * * @param token The token string to match * @return true/false -- Whether the argument was present */ bool Present(const char *token); /** * Check for an arg with a value. * Returns only the first match. * * Assuming the token "-c"... * "-call" returns "all" * "-c=all" returns "all" * "-c", "all" returns "all" * "-c=", "all" returns "" * * @param token The token string to match * @return NULL or the pointer to the string */ const char *Param(const char *token); /** * Similiar to arg_param, but can iterate over all matches. * Set index to 0 before the first call. * * @param token The token string to match * @param idx Pointer to the index that you initialized to 0 * @return NULL or the pointer to the string. */ const char *Params(const char *token, int& index); /** * Marks an argument as being used. * * @param idx The index of the argument */ void SetUsed(int idx); /** * Gets whether an argument has been used, by index. * * @param idx The index of the argument */ bool GetUsed(int idx); /** * This function retrieves all unused parameters. * You must set the index before the first call. * Set the index to 1 to skip argv[0]. * * @param idx Pointer to the index * @return NULL (done) or the pointer to the string */ const char *Unused(int& idx); /** * Takes text and splits it into arguments. * args is an array of char * pointers that will get populated. * num_args is the maximum number of args split off. * If there are more than num_args, the remaining text is ignored. * Note that text is modified (zeroes are inserted) * * @param text The text to split (modified) * @param args The char * array to populate * @param num_args The number of items in args * @return The number of arguments parsed (always <= num_args) */ static int SplitLine(char *text, char *args[], int num_args); }; #endif /* ARGS_H_INCLUDED */ uncrustify-0.59/src/parse_frame.cpp0000644000175000017500000001606611506773274014407 00000000000000/** * @file parse_frame.cpp * Does the parse frame stuff, which is used to handle #ifdef stuff * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "prototypes.h" #include "chunk_list.h" #include #include #include /** * Logs one parse frame */ void pf_log(int logsev, struct parse_frame *pf) { int idx; LOG_FMT(logsev, "[%s] BrLevel=%d Level=%d PseTos=%d\n", get_token_name(pf->in_ifdef), pf->brace_level, pf->level, pf->pse_tos); LOG_FMT(logsev, " *"); for (idx = 1; idx <= pf->pse_tos; idx++) { LOG_FMT(logsev, " [%s-%d]", get_token_name(pf->pse[idx].type), pf->pse[idx].stage); } LOG_FMT(logsev, "\n"); } static void pf_log_frms(int logsev, const char *txt, struct parse_frame *pf) { int idx; LOG_FMT(logsev, "%s Parse Frames(%d):", txt, cpd.frame_count); for (idx = 0; idx < cpd.frame_count; idx++) { LOG_FMT(logsev, " [%s-%d]", get_token_name(cpd.frames[idx].in_ifdef), cpd.frames[idx].ref_no); } LOG_FMT(logsev, "-[%s-%d]\n", get_token_name(pf->in_ifdef), pf->ref_no); } /** * Logs the entire parse frame stack */ void pf_log_all(int logsev) { int idx; LOG_FMT(logsev, "##=- Parse Frame : %d entries\n", cpd.frame_count); for (idx = 0; idx < cpd.frame_count; idx++) { LOG_FMT(logsev, "## <%d> ", idx); pf_log(logsev, &cpd.frames[idx]); } LOG_FMT(logsev, "##=-\n"); } /** * Copies src to dst. */ void pf_copy(struct parse_frame *dst, const struct parse_frame *src) { memcpy(dst, src, sizeof(struct parse_frame)); } /** * Push a copy of the parse frame onto the stack. * This is called on #if and #ifdef. */ void pf_push(struct parse_frame *pf) { static int ref_no = 1; if (cpd.frame_count < (int)ARRAY_SIZE(cpd.frames)) { pf_copy(&cpd.frames[cpd.frame_count], pf); cpd.frame_count++; pf->ref_no = ref_no++; } LOG_FMT(LPF, "%s: count = %d\n", __func__, cpd.frame_count); } /** * Push a copy of the parse frame onto the stack, under the tos. * If this were a linked list, just add before the last item. * This is called on the first #else and #elif. */ void pf_push_under(struct parse_frame *pf) { struct parse_frame *npf1; struct parse_frame *npf2; LOG_FMT(LPF, "%s: before count = %d\n", __func__, cpd.frame_count); if ((cpd.frame_count < (int)ARRAY_SIZE(cpd.frames)) && (cpd.frame_count >= 1)) { npf1 = &cpd.frames[cpd.frame_count - 1]; npf2 = &cpd.frames[cpd.frame_count]; pf_copy(npf2, npf1); pf_copy(npf1, pf); cpd.frame_count++; } LOG_FMT(LPF, "%s: after count = %d\n", __func__, cpd.frame_count); } /** * Copy the top item off the stack into pf. * This is called on #else and #elif. */ void pf_copy_tos(struct parse_frame *pf) { if (cpd.frame_count > 0) { pf_copy(pf, &cpd.frames[cpd.frame_count - 1]); } LOG_FMT(LPF, "%s: count = %d\n", __func__, cpd.frame_count); } /** * Copy the 2nd top item off the stack into pf. * This is called on #else and #elif. * The stack contains [...] [base] [if] at this point. * We want to copy [base]. */ static void pf_copy_2nd_tos(struct parse_frame *pf) { if (cpd.frame_count > 1) { pf_copy(pf, &cpd.frames[cpd.frame_count - 2]); } LOG_FMT(LPF, "%s: count = %d\n", __func__, cpd.frame_count); } /** * Deletes the top frame from the stack. */ void pf_trash_tos(void) { if (cpd.frame_count > 0) { cpd.frame_count--; } LOG_FMT(LPF, "%s: count = %d\n", __func__, cpd.frame_count); } /** * Pop the top item off the stack and copy into pf. * This is called on #endif */ void pf_pop(struct parse_frame *pf) { if (cpd.frame_count > 0) { pf_copy_tos(pf); pf_trash_tos(); } //fprintf(stderr, "%s: count = %d\n", __func__, cpd.frame_count); } /** * Returns the pp_indent to use for this line */ int pf_check(struct parse_frame *frm, chunk_t *pc) { int in_ifdef = frm->in_ifdef; int b4_cnt = cpd.frame_count; int pp_level = cpd.pp_level; const char *txt = NULL; chunk_t *next; if (pc->type != CT_PREPROC) { return(pp_level); } next = chunk_get_next(pc); if (pc->parent_type != next->type) { LOG_FMT(LNOTE, "%s: Preproc parent not set correctly on line %d: got %s expected %s\n", __func__, pc->orig_line, get_token_name(pc->parent_type), get_token_name(next->type)); pc->parent_type = next->type; } LOG_FMT(LPFCHK, "%s: %5d] %s\n", __func__, pc->orig_line, get_token_name(pc->parent_type)); pf_log_frms(LPFCHK, "TOP", frm); if ((pc->flags & PCF_IN_PREPROC) != 0) { LOG_FMT(LPF, " "); pf_log(LPF, frm); if (pc->parent_type == CT_PP_IF) { /* An #if pushes a copy of the current frame on the stack */ cpd.pp_level++; pf_push(frm); frm->in_ifdef = CT_PP_IF; txt = "if-push"; } else if (pc->parent_type == CT_PP_ELSE) { pp_level--; /** * For #else of #elif, we want to keep the #if part and throw out the * else parts. * We check to see what the top type is to see if we just push or * pop and then push. * We need to use the copy right before the if. */ if (frm->in_ifdef == CT_PP_IF) { /* we have [...] [base]-[if], so push an [else] */ pf_push(frm); frm->in_ifdef = CT_PP_ELSE; } /* we have [...] [base] [if]-[else], copy [base] over [else] */ pf_copy_2nd_tos(frm); frm->in_ifdef = CT_PP_ELSE; txt = "else-push"; } else if (pc->parent_type == CT_PP_ENDIF) { /** * we may have [...] [base] [if]-[else] or [...] [base]-[if]. * Throw out the [else]. */ cpd.pp_level--; pp_level--; if (frm->in_ifdef == CT_PP_ELSE) { /** * We have: [...] [base] [if]-[else] * We want: [...]-[if] */ pf_copy_tos(frm); /* [...] [base] [if]-[if] */ frm->in_ifdef = cpd.frames[cpd.frame_count - 2].in_ifdef; pf_trash_tos(); /* [...] [base]-[if] */ pf_trash_tos(); /* [...]-[if] */ txt = "endif-trash/pop"; } else if (frm->in_ifdef == CT_PP_IF) { /** * We have: [...] [base] [if] * We want: [...] [base] */ pf_pop(frm); txt = "endif-pop"; } else { txt = "???"; } } } if (txt != NULL) { LOG_FMT(LPF, "%s: %d> %s: %s in_ifdef=%d/%d counts=%d/%d\n", __func__, pc->orig_line, get_token_name(pc->parent_type), txt, in_ifdef, frm->in_ifdef, b4_cnt, cpd.frame_count); pf_log_all(LPF); LOG_FMT(LPF, " "); pf_log(LPF, frm); } pf_log_frms(LPFCHK, "END", frm); return(pp_level); } uncrustify-0.59/src/uncrustify.cpp0000644000175000017500000013432111640475544014327 00000000000000/** * @file uncrustify.cpp * This file takes an input C/C++/D/Java file and reformats it. * * @author Ben Gardner * @license GPL v2+ */ #define DEFINE_PCF_NAMES #define DEFINE_CHAR_TABLE #include "uncrustify_version.h" #include "uncrustify_types.h" #include "char_table.h" #include "chunk_list.h" #include "prototypes.h" #include "token_names.h" #include "args.h" #include "logger.h" #include "log_levels.h" #include "md5.h" #include "backup.h" #include #include #include #include #include #include "unc_ctype.h" #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_STRINGS_H #include /* strcasecmp() */ #endif #include #include /* Global data */ struct cp_data cpd; static int language_from_tag(const char *tag); static int language_from_filename(const char *filename); static const char *language_to_string(int lang); static bool read_stdin(file_mem& fm); static void uncrustify_start(const deque& data); static void uncrustify_end(); static void uncrustify_file(const file_mem& fm, FILE *pfout, const char *parsed_file); static void do_source_file(const char *filename_in, const char *filename_out, const char *parsed_file, bool no_backup, bool keep_mtime); static void process_source_list(const char *source_list, const char *prefix, const char *suffix, bool no_backup, bool keep_mtime); static int load_header_files(); static const char *make_output_filename(char *buf, int buf_size, const char *filename, const char *prefix, const char *suffix); static int load_mem_file(const char *filename, file_mem& fm); /** * Replace the brain-dead and non-portable basename(). * Returns a pointer to the character after the last '/'. * The returned value always points into path, unless path is NULL. * * Input Returns * NULL => "" * "/some/path/" => "" * "/some/path" => "path" * "afile" => "afile" * * @param path The path to look at * @return Pointer to the character after the last path seperator */ const char *path_basename(const char *path) { if (path == NULL) { return(""); } const char *last_path = path; char ch; while ((ch = *path) != 0) { path++; /* Check both slash types to support windows */ if ((ch == '/') || (ch == '\\')) { last_path = path; } } return(last_path); } /** * Returns the length of the directory part of the filename. */ int path_dirname_len(const char *filename) { if (filename == NULL) { return(0); } return((int)(path_basename(filename) - filename)); } static void usage_exit(const char *msg, const char *argv0, int code) { if (msg != NULL) { fprintf(stderr, "%s\n", msg); } if ((code != EXIT_SUCCESS) || (argv0 == NULL)) { fprintf(stderr, "Try running with -h for usage information\n"); exit(code); } fprintf(stdout, "Usage:\n" "%s [options] [files ...]\n" "\n" "If no input files are specified, the input is read from stdin\n" "If reading from stdin, you should specify the language using -l\n" "\n" "If -F is used or files are specified on the command line, the output filename is\n" "'prefix/filename' + suffix\n" "\n" "When reading from stdin or doing a single file via the '-f' option,\n" "the output is dumped to stdout, unless redirected with -o FILE.\n" "\n" "Errors are always dumped to stderr\n" "\n" "The '-f' and '-o' options may not be used with '-F', '--replace' or '--no-backup'.\n" "The '--prefix' and '--suffix' options may not be used with '--replace' or '--no-backup'.\n" "\n" "Basic Options:\n" " -c CFG : use the config file CFG\n" " -f FILE : process the single file FILE (output to stdout, use with -o)\n" " -o FILE : Redirect stdout to FILE\n" " -F FILE : read files to process from FILE, one filename per line\n" " files : files to process (can be combined with -F)\n" " --suffix SFX : Append SFX to the output filename. The default is '.uncrustify'\n" " --prefix PFX : Prepend PFX to the output filename path.\n" " --replace : replace source files (creates a backup)\n" " --no-backup : replace files, no backup. Useful if files are under source control\n" #ifdef HAVE_UTIME_H " --mtime : preserve mtime on replaced files\n" #endif " -l : language override: C, CPP, D, CS, JAVA, PAWN, OC, OC+\n" " -t : load a file with types (usually not needed)\n" " -q : quiet mode - no output on stderr (-L will override)\n" " --frag : code fragment, assume the first line is indented correctly\n" "\n" "Config/Help Options:\n" " -h -? --help --usage : print this message and exit\n" " --version : print the version and exit\n" " --show-config : print out option documentation and exit\n" " --update-config : Output a new config file. Use with -o FILE\n" " --update-config-with-doc : Output a new config file. Use with -o FILE\n" " --universalindent : Output a config file for Universal Indent GUI\n" " --detect : detects the config from a source file. Use with '-f FILE'\n" " Detection is fairly limited.\n" "\n" "Debug Options:\n" " -p FILE : dump debug info to a file\n" " -L SEV : Set the log severity (see log_levels.h)\n" " -s : Show the log severity in the logs\n" " --decode FLAG: Print FLAG (chunk flags) as text and exit\n" "\n" "Usage Examples\n" "cat foo.d | uncrustify -q -c my.cfg -l d\n" "uncrustify -c my.cfg -f foo.d\n" "uncrustify -c my.cfg -f foo.d -L0-2,20-23,51\n" "uncrustify -c my.cfg -f foo.d -o foo.d\n" "uncrustify -c my.cfg foo.d\n" "uncrustify -c my.cfg --replace foo.d\n" "uncrustify -c my.cfg --no-backup foo.d\n" "uncrustify -c my.cfg --prefix=out -F files.txt\n" "\n" "Note: Use comments containing ' *INDENT-OFF*' and ' *INDENT-ON*' to disable\n" " processing of parts of the source file.\n" "\n" "There are currently %d options and minimal documentation.\n" "Try UniversalIndentGUI and good luck.\n" "\n" , path_basename(argv0), UO_option_count); exit(code); } static void version_exit(void) { printf("uncrustify %s\n", UNCRUSTIFY_VERSION); exit(0); } static void redir_stdout(const char *output_file) { /* Reopen stdout */ FILE *my_stdout = stdout; if (output_file != NULL) { my_stdout = freopen(output_file, "wb", stdout); if (my_stdout == NULL) { LOG_FMT(LERR, "Unable to open %s for write: %s (%d)\n", output_file, strerror(errno), errno); usage_exit(NULL, NULL, 56); } LOG_FMT(LNOTE, "Redirecting output to %s\n", output_file); } } int main(int argc, char *argv[]) { const char *cfg_file = "uncrustify.cfg"; const char *parsed_file = NULL; const char *source_file = NULL; const char *output_file = NULL; const char *source_list = NULL; log_mask_t mask; int idx; const char *p_arg; /* If ran without options... check keyword sort and show the usage info */ if (argc == 1) { keywords_are_sorted(); usage_exit(NULL, argv[0], EXIT_SUCCESS); } /* Build options map */ register_options(); Args arg(argc, argv); if (arg.Present("--version") || arg.Present("-v")) { version_exit(); } if (arg.Present("--help") || arg.Present("-h") || arg.Present("--usage") || arg.Present("-?")) { usage_exit(NULL, argv[0], EXIT_SUCCESS); } if (arg.Present("--show-config")) { print_options(stdout, true); return(0); } #ifdef WIN32 /* tell windoze not to change what I write to stdout */ (void)_setmode(_fileno(stdout), _O_BINARY); #endif /* Init logging */ log_init(stderr); if (arg.Present("-q")) { logmask_from_string("", mask); log_set_mask(mask); } if (((p_arg = arg.Param("-L")) != NULL) || ((p_arg = arg.Param("--log")) != NULL)) { logmask_from_string(p_arg, mask); log_set_mask(mask); } cpd.frag = arg.Present("--frag"); if ((p_arg = arg.Param("--decode")) != NULL) { log_pcf_flags(LSYS, strtoul(p_arg, NULL, 16)); exit(EXIT_SUCCESS); } /* Get the config file name */ if (((cfg_file = arg.Param("--config")) == NULL) && ((cfg_file = arg.Param("-c")) == NULL)) { /* Handled later */ } #ifndef WIN32 /* Try to file a config at an alternate location */ char buf[512]; if (cfg_file == NULL) { cfg_file = getenv("UNCRUSTIFY_CONFIG"); if (cfg_file == NULL) { const char *home = getenv("HOME"); if (home != NULL) { struct stat tmp_stat; snprintf(buf, sizeof(buf), "%s/.uncrustify.cfg", home); if (stat(buf, &tmp_stat) == 0) { cfg_file = buf; } } } } #endif /* Get the parsed file name */ if (((parsed_file = arg.Param("--parsed")) != NULL) || ((parsed_file = arg.Param("-p")) != NULL)) { LOG_FMT(LNOTE, "Will export parsed data to: %s\n", parsed_file); } /* Enable log sevs? */ if (arg.Present("-s") || arg.Present("--show")) { log_show_sev(true); } /* Load the config file */ set_option_defaults(); /* Load type files */ idx = 0; while ((p_arg = arg.Params("-t", idx)) != NULL) { load_keyword_file(p_arg); } /* add types */ idx = 0; while ((p_arg = arg.Params("--type", idx)) != NULL) { add_keyword(p_arg, CT_TYPE); } /* Load define files */ idx = 0; while ((p_arg = arg.Params("-d", idx)) != NULL) { load_define_file(p_arg); } /* add defines */ idx = 0; while ((p_arg = arg.Params("--define", idx)) != NULL) { add_define(p_arg, NULL); } /* Check for a language override */ if ((p_arg = arg.Param("-l")) != NULL) { cpd.lang_flags = language_from_tag(p_arg); if (cpd.lang_flags == 0) { LOG_FMT(LWARN, "Ignoring unknown language: %s\n", p_arg); } else { cpd.lang_forced = true; } } /* Get the source file name */ if (((source_file = arg.Param("--file")) == NULL) && ((source_file = arg.Param("-f")) == NULL)) { // not using a single file, source_file is NULL } if (((source_list = arg.Param("--files")) == NULL) && ((source_list = arg.Param("-F")) == NULL)) { // not using a file list, source_list is NULL } const char *prefix = arg.Param("--prefix"); const char *suffix = arg.Param("--suffix"); bool no_backup = arg.Present("--no-backup"); bool replace = arg.Present("--replace"); bool keep_mtime = arg.Present("--mtime"); bool update_config = arg.Present("--update-config"); bool update_config_wd = arg.Present("--update-config-with-doc"); bool detect = arg.Present("--detect"); /* Grab the output override */ output_file = arg.Param("-o"); LOG_FMT(LDATA, "output_file = %s\n", (output_file != NULL) ? output_file : "null"); LOG_FMT(LDATA, "source_file = %s\n", (source_file != NULL) ? source_file : "null"); LOG_FMT(LDATA, "source_list = %s\n", (source_list != NULL) ? source_list : "null"); LOG_FMT(LDATA, "prefix = %s\n", (prefix != NULL) ? prefix : "null"); LOG_FMT(LDATA, "suffix = %s\n", (suffix != NULL) ? suffix : "null"); LOG_FMT(LDATA, "replace = %d\n", replace); LOG_FMT(LDATA, "no_backup = %d\n", no_backup); LOG_FMT(LDATA, "detect = %d\n", detect); if (replace || no_backup) { if ((prefix != NULL) || (suffix != NULL)) { usage_exit("Cannot use --replace with --prefix or --suffix", argv[0], 66); } if ((source_file != NULL) || (output_file != NULL)) { usage_exit("Cannot use --replace or --no-backup with -f or -o", argv[0], 66); } } else { if ((prefix == NULL) && (suffix == NULL)) { suffix = ".uncrustify"; } } /* Try to load the config file, if available. * It is optional for "--universalindent" and "--detect", but required for * everything else. */ if (cfg_file != NULL) { cpd.filename = cfg_file; if (load_option_file(cfg_file) < 0) { usage_exit("Unable to load the config file", argv[0], 56); } } if (arg.Present("--universalindent")) { FILE *pfile = stdout; if (output_file != NULL) { pfile = fopen(output_file, "w"); if (pfile == NULL) { fprintf(stderr, "Unable to open %s for write: %s (%d)\n", output_file, strerror(errno), errno); return(EXIT_FAILURE); } } print_universal_indent_cfg(pfile); return(EXIT_SUCCESS); } if (detect) { file_mem fm; if ((source_file == NULL) || (source_list != NULL)) { fprintf(stderr, "The --detect option requires a single input file\n"); return(EXIT_FAILURE); } /* Do some simple language detection based on the filename extension */ if (!cpd.lang_forced || (cpd.lang_flags == 0)) { cpd.lang_flags = language_from_filename(source_file); } /* Try to read in the source file */ if (load_mem_file(source_file, fm) < 0) { LOG_FMT(LERR, "Failed to load (%s)\n", source_file); cpd.error_count++; return(EXIT_FAILURE); } uncrustify_start(fm.data); detect_options(); uncrustify_end(); redir_stdout(output_file); save_option_file(stdout, update_config_wd); return(EXIT_SUCCESS); } /* Everything beyond this point requires a config file, so complain and * bail if we don't have one. */ if (cfg_file == NULL) { #ifdef WIN32 usage_exit("Specify the config file: -c file", argv[0], 58); #else usage_exit("Specify the config file with '-c file' or set UNCRUSTIFY_CONFIG", argv[0], 58); #endif } /* * Done parsing args */ if (update_config || update_config_wd) { redir_stdout(output_file); save_option_file(stdout, update_config_wd); return(0); } /* Check for unused args (ignore them) */ idx = 1; p_arg = arg.Unused(idx); /* Check args - for multifile options */ if ((source_list != NULL) || (p_arg != NULL)) { if (source_file != NULL) { usage_exit("Cannot specify both the single file option and a multi-file option.", argv[0], 67); } if (output_file != NULL) { usage_exit("Cannot specify -o with a multi-file option.", argv[0], 68); } } /* This relies on cpd.filename being the config file name */ load_header_files(); if ((source_file == NULL) && (source_list == NULL) && (p_arg == NULL)) { /* no input specified, so use stdin */ if (cpd.lang_flags == 0) { cpd.lang_flags = LANG_C; } redir_stdout(output_file); file_mem fm; if (!read_stdin(fm)) { LOG_FMT(LERR, "Failed to read stdin\n"); return(100); } cpd.filename = "stdin"; /* Done reading from stdin */ LOG_FMT(LSYS, "Parsing: %d bytes (%d chars) from stdin as language %s\n", (int)fm.raw.size(), (int)fm.data.size(), language_to_string(cpd.lang_flags)); uncrustify_file(fm, stdout, parsed_file); } else if (source_file != NULL) { /* Doing a single file */ do_source_file(source_file, output_file, parsed_file, no_backup, keep_mtime); } else { /* Doing multiple files */ if (prefix != NULL) { LOG_FMT(LSYS, "Output prefix: %s/\n", prefix); } if (suffix != NULL) { LOG_FMT(LSYS, "Output suffix: %s\n", suffix); } /* Do the files on the command line first */ idx = 1; while ((p_arg = arg.Unused(idx)) != NULL) { char outbuf[1024]; do_source_file(p_arg, make_output_filename(outbuf, sizeof(outbuf), p_arg, prefix, suffix), NULL, no_backup, keep_mtime); } if (source_list != NULL) { process_source_list(source_list, prefix, suffix, no_backup, keep_mtime); } } clear_keyword_file(); clear_defines(); return((cpd.error_count != 0) ? 1 : 0); } static void process_source_list(const char *source_list, const char *prefix, const char *suffix, bool no_backup, bool keep_mtime) { FILE *p_file = fopen(source_list, "r"); if (p_file == NULL) { LOG_FMT(LERR, "%s: fopen(%s) failed: %s (%d)\n", __func__, source_list, strerror(errno), errno); cpd.error_count++; return; } char linebuf[256]; int argc; char *args[3]; int line = 0; int idx; while (fgets(linebuf, sizeof(linebuf), p_file) != NULL) { line++; argc = Args::SplitLine(linebuf, args, ARRAY_SIZE(args)); LOG_FMT(LFILELIST, "%3d]", line); for (idx = 0; idx < argc; idx++) { LOG_FMT(LFILELIST, " [%s]", args[idx]); } LOG_FMT(LFILELIST, "\n"); if ((argc == 1) && (*args[0] != '#')) { char outbuf[1024]; do_source_file(args[0], make_output_filename(outbuf, sizeof(outbuf), args[0], prefix, suffix), NULL, no_backup, keep_mtime); } } fclose(p_file); } static bool read_stdin(file_mem& fm) { deque dq; char buf[4096]; int len; int idx; fm.raw.clear(); fm.data.clear(); fm.enc = ENC_ASCII; while (!feof(stdin)) { len = fread(buf, 1, sizeof(buf), stdin); for (idx = 0; idx < len; idx++) { dq.push_back(buf[idx]); } } /* Copy the raw data from the deque to the vector */ fm.raw.insert(fm.raw.end(), dq.begin(), dq.end()); return decode_unicode(fm.raw, fm.data, fm.enc, fm.bom); } static void make_folders(const string& filename) { int idx; int last_idx = 0; char outname[4096]; snprintf(outname, sizeof(outname), "%s", filename.c_str()); for (idx = 0; outname[idx] != 0; idx++) { if ((outname[idx] == '/') || (outname[idx] == '\\')) { outname[idx] = PATH_SEP; } if ((idx > last_idx) && (outname[idx] == PATH_SEP)) { outname[idx] = 0; if ((strcmp(&outname[last_idx], ".") != 0) && (strcmp(&outname[last_idx], "..") != 0)) { //fprintf(stderr, "%s: %s\n", __func__, outname); mkdir(outname, 0750); } outname[idx] = PATH_SEP; } if (outname[idx] == PATH_SEP) { last_idx = idx + 1; } } } /** * Loads a file into memory */ static int load_mem_file(const char *filename, file_mem& fm) { int retval = -1; struct stat my_stat; FILE *p_file; fm.raw.clear(); fm.data.clear(); fm.enc = ENC_ASCII; /* Grab the stat info for the file */ if (stat(filename, &my_stat) < 0) { return(-1); } #ifdef HAVE_UTIME_H /* Save off mtime */ fm.utb.modtime = my_stat.st_mtime; #endif /* Try to read in the file */ p_file = fopen(filename, "rb"); if (p_file == NULL) { return(-1); } fm.raw.resize(my_stat.st_size); if (my_stat.st_size == 0) { /* Empty file */ retval = 0; fm.bom = false; fm.enc = ENC_ASCII; fm.data.clear(); } else { /* read the raw data */ if (fread(&fm.raw[0], fm.raw.size(), 1, p_file) != 1) { LOG_FMT(LERR, "%s: fread(%s) failed: %s (%d)\n", __func__, filename, strerror(errno), errno); cpd.error_count++; } else if (!decode_unicode(fm.raw, fm.data, fm.enc, fm.bom)) { LOG_FMT(LERR, "%s: failed to decode the file '%s'\n", __func__, filename); } else { LOG_FMT(LNOTE, "%s: '%s' encoding looks like %d\n", __func__, filename, fm.enc); retval = 0; } } fclose(p_file); return(retval); } /** * Try to load the file from the config folder first and then by name */ static int load_mem_file_config(const char *filename, file_mem& fm) { int retval; char buf[1024]; snprintf(buf, sizeof(buf), "%.*s%s", path_dirname_len(cpd.filename), cpd.filename, filename); retval = load_mem_file(buf, fm); if (retval < 0) { retval = load_mem_file(filename, fm); if (retval < 0) { LOG_FMT(LERR, "Failed to load (%s) or (%s)\n", buf, filename); cpd.error_count++; } } return(retval); } static int load_header_files() { int retval = 0; if ((cpd.settings[UO_cmt_insert_file_header].str != NULL) && (cpd.settings[UO_cmt_insert_file_header].str[0] != 0)) { retval |= load_mem_file_config(cpd.settings[UO_cmt_insert_file_header].str, cpd.file_hdr); } if ((cpd.settings[UO_cmt_insert_file_footer].str != NULL) && (cpd.settings[UO_cmt_insert_file_footer].str[0] != 0)) { retval |= load_mem_file_config(cpd.settings[UO_cmt_insert_file_footer].str, cpd.file_ftr); } if ((cpd.settings[UO_cmt_insert_func_header].str != NULL) && (cpd.settings[UO_cmt_insert_func_header].str[0] != 0)) { retval |= load_mem_file_config(cpd.settings[UO_cmt_insert_func_header].str, cpd.func_hdr); } if ((cpd.settings[UO_cmt_insert_class_header].str != NULL) && (cpd.settings[UO_cmt_insert_class_header].str[0] != 0)) { retval |= load_mem_file_config(cpd.settings[UO_cmt_insert_class_header].str, cpd.class_hdr); } if ((cpd.settings[UO_cmt_insert_oc_msg_header].str != NULL) && (cpd.settings[UO_cmt_insert_oc_msg_header].str[0] != 0)) { retval |= load_mem_file_config(cpd.settings[UO_cmt_insert_oc_msg_header].str, cpd.oc_msg_hdr); } return(retval); } static const char *make_output_filename(char *buf, int buf_size, const char *filename, const char *prefix, const char *suffix) { int len = 0; if (prefix != NULL) { len = snprintf(buf, buf_size, "%s/", prefix); } snprintf(&buf[len], buf_size - len, "%s%s", filename, (suffix != NULL) ? suffix : ""); return(buf); } /** * Reinvent the wheel with a file comparision function... */ static bool file_content_matches(const string& filename1, const string& filename2) { struct stat st1, st2; int fd1, fd2; UINT8 buf1[1024], buf2[1024]; int len1 = 0, len2 = 0; int minlen; /* Check the sizes first */ if ((stat(filename1.c_str(), &st1) != 0) || (stat(filename2.c_str(), &st2) != 0) || (st1.st_size != st2.st_size)) { return(false); } if ((fd1 = open(filename1.c_str(), O_RDONLY)) < 0) { return(false); } if ((fd2 = open(filename2.c_str(), O_RDONLY)) < 0) { close(fd1); return(false); } while ((len1 >= 0) && (len2 >= 0)) { if (len1 == 0) { len1 = read(fd1, buf1, sizeof(buf1)); } if (len2 == 0) { len2 = read(fd2, buf2, sizeof(buf2)); } if ((len1 <= 0) || (len2 <= 0)) { break; } minlen = (len1 < len2) ? len1 : len2; if (memcmp(buf1, buf2, minlen) != 0) { break; } len1 -= minlen; len2 -= minlen; } close(fd1); close(fd2); return((len1 == 0) && (len2 == 0)); } const char *fix_filename(const char *filename) { char *tmp_file; /* Create 'outfile.uncrustify' */ tmp_file = new char[strlen(filename) + 16 + 1]; /* + 1 for '\0' */ if (tmp_file != NULL) { sprintf(tmp_file, "%s.uncrustify", filename); } return(tmp_file); } /** * Does a source file. * * @param filename_in the file to read * @param filename_out NULL (stdout) or the file to write * @param parsed_file NULL or the filename for the parsed debug info * @param no_backup don't create a backup, if filename_out == filename_in * @param keep_mtime don't change the mtime (dangerous) */ static void do_source_file(const char *filename_in, const char *filename_out, const char *parsed_file, bool no_backup, bool keep_mtime) { FILE *pfout; bool did_open = false; bool need_backup = false; file_mem fm; string filename_tmp; /* Do some simple language detection based on the filename extension */ if (!cpd.lang_forced || (cpd.lang_flags == 0)) { cpd.lang_flags = language_from_filename(filename_in); } /* Try to read in the source file */ if (load_mem_file(filename_in, fm) < 0) { LOG_FMT(LERR, "Failed to load (%s)\n", filename_in); cpd.error_count++; return; } LOG_FMT(LSYS, "Parsing: %s as language %s\n", filename_in, language_to_string(cpd.lang_flags)); if (filename_out == NULL) { pfout = stdout; } else { /* If the out file is the same as the in file, then use a temp file */ filename_tmp = filename_out; if (strcmp(filename_in, filename_out) == 0) { /* Create 'outfile.uncrustify' */ filename_tmp = fix_filename(filename_out); if (!no_backup) { if (backup_copy_file(filename_in, fm.raw) != SUCCESS) { LOG_FMT(LERR, "%s: Failed to create backup file for %s\n", __func__, filename_in); cpd.error_count++; return; } need_backup = true; } } make_folders(filename_tmp); pfout = fopen(filename_tmp.c_str(), "wb"); if (pfout == NULL) { LOG_FMT(LERR, "%s: Unable to create %s: %s (%d)\n", __func__, filename_tmp.c_str(), strerror(errno), errno); cpd.error_count++; return; } did_open = true; //LOG_FMT(LSYS, "Output file %s\n", filename_out); } cpd.filename = filename_in; uncrustify_file(fm, pfout, parsed_file); if (did_open) { fclose(pfout); if (need_backup) { backup_create_md5_file(filename_in); } if (filename_tmp != filename_out) { /* We need to compare and then do a rename */ if (file_content_matches(filename_tmp, filename_out)) { /* No change - remove tmp file */ (void)unlink(filename_tmp.c_str()); } else { #ifdef WIN32 /* windows can't rename a file if the target exists, so delete it * first. This may cause data loss if the tmp file gets deleted * or can't be renamed. */ (void)unlink(filename_out); #endif /* Change - rename filename_tmp to filename_out */ if (rename(filename_tmp.c_str(), filename_out) != 0) { LOG_FMT(LERR, "%s: Unable to rename '%s' to '%s'\n", __func__, filename_tmp.c_str(), filename_out); cpd.error_count++; } } } #ifdef HAVE_UTIME_H if (keep_mtime) { /* update mtime -- don't care if it fails */ fm.utb.actime = time(NULL); (void)utime(filename_in, &fm.utb); } #endif } } static void add_file_header() { if (!chunk_is_comment(chunk_get_head())) { /*TODO: detect the typical #ifndef FOO / #define FOO sequence */ tokenize(cpd.file_hdr.data, chunk_get_head()); } } static void add_file_footer() { chunk_t *pc = chunk_get_tail(); /* Back up if the file ends with a newline */ if ((pc != NULL) && chunk_is_newline(pc)) { pc = chunk_get_prev(pc); } if ((pc != NULL) && (!chunk_is_comment(pc) || !chunk_is_newline(chunk_get_prev(pc)))) { pc = chunk_get_tail(); if (!chunk_is_newline(pc)) { LOG_FMT(LSYS, "Adding a newline at the end of the file\n"); newline_add_after(pc); } tokenize(cpd.file_ftr.data, NULL); } } static void add_func_header(c_token_t type, file_mem& fm) { chunk_t *pc; chunk_t *ref; chunk_t *tmp; bool do_insert; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnlnp(pc)) { if (pc->type != type) { continue; } do_insert = false; /* On a function proto or def. Back up to a close brace or semicolon on * the same level */ ref = pc; while ((ref = chunk_get_prev(ref)) != NULL) { /* Bail if we change level or find an access specifier colon */ if ((ref->level != pc->level) || (ref->type == CT_PRIVATE_COLON)) { do_insert = true; break; } /* If we hit an angle close, back up to the angle open */ if (ref->type == CT_ANGLE_CLOSE) { ref = chunk_get_prev_type(ref, CT_ANGLE_OPEN, ref->level, CNAV_PREPROC); continue; } /* Bail if we hit a preprocessor and cmt_insert_before_preproc is false */ if (ref->flags & PCF_IN_PREPROC) { tmp = chunk_get_prev_type(ref, CT_PREPROC, ref->level); if ((tmp != NULL) && (tmp->parent_type == CT_PP_IF)) { tmp = chunk_get_prev_nnl(tmp); if (chunk_is_comment(tmp) && !cpd.settings[UO_cmt_insert_before_preproc].b) { break; } } } /* Ignore 'right' comments */ if (chunk_is_comment(ref) && chunk_is_newline(chunk_get_prev(ref))) { break; } if ((ref->level == pc->level) && ((ref->flags & PCF_IN_PREPROC) || (ref->type == CT_SEMICOLON) || (ref->type == CT_BRACE_CLOSE))) { do_insert = true; break; } } if (do_insert) { /* Insert between after and ref */ chunk_t *after = chunk_get_next_ncnl(ref); tokenize(fm.data, after); for (tmp = chunk_get_next(ref); tmp != after; tmp = chunk_get_next(tmp)) { tmp->level = after->level; } } } } static void add_msg_header(c_token_t type, file_mem& fm) { chunk_t *pc; chunk_t *ref; chunk_t *tmp; bool do_insert; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnlnp(pc)) { if (pc->type != type) { continue; } do_insert = false; /* On a function proto or def. Back up to a close brace or semicolon on * the same level */ ref = pc; while ((ref = chunk_get_prev(ref)) != NULL) { /* ignore the CT_TYPE token that is the result type */ if ((ref->level != pc->level) && ((ref->type == CT_TYPE) || (ref->type == CT_PTR_TYPE))) { continue; } if ((ref->level != pc->level) && (ref->type == CT_OC_CATEGORY)) { ref = chunk_get_next_ncnl(ref); if (ref) { do_insert = true; } break; } /* Bail if we change level or find an access specifier colon */ if ((ref->level != pc->level) || (ref->type == CT_PRIVATE_COLON)) { do_insert = true; break; } /* If we hit an angle close, back up to the angle open */ if (ref->type == CT_ANGLE_CLOSE) { ref = chunk_get_prev_type(ref, CT_ANGLE_OPEN, ref->level, CNAV_PREPROC); continue; } /* Bail if we hit a preprocessor and cmt_insert_before_preproc is false */ if (ref->flags & PCF_IN_PREPROC) { tmp = chunk_get_prev_type(ref, CT_PREPROC, ref->level); if ((tmp != NULL) && (tmp->parent_type == CT_PP_IF)) { tmp = chunk_get_prev_nnl(tmp); if (chunk_is_comment(tmp) && !cpd.settings[UO_cmt_insert_before_preproc].b) { break; } } } /* Ignore 'right' comments */ if (chunk_is_comment(ref) && chunk_is_newline(chunk_get_prev(ref))) { break; } if ((ref->level == pc->level) && ((ref->flags & PCF_IN_PREPROC) || (ref->type == CT_SEMICOLON) || (ref->type == CT_BRACE_CLOSE) || (ref->type == CT_OC_CLASS))) { do_insert = true; break; } } if (do_insert) { /* Insert between after and ref */ chunk_t *after = chunk_get_next_ncnl(ref); tokenize(fm.data, after); for (tmp = chunk_get_next(ref); tmp != after; tmp = chunk_get_next(tmp)) { tmp->level = after->level; } } } } static void uncrustify_start(const deque& data) { /** * Parse the text into chunks */ tokenize(data, NULL); /* Get the column for the fragment indent */ if (cpd.frag) { chunk_t *pc = chunk_get_head(); cpd.frag_cols = (pc != NULL) ? pc->orig_col : 0; } /* Add the file header */ if (cpd.file_hdr.data.size() > 0) { add_file_header(); } /* Add the file footer */ if (cpd.file_ftr.data.size() > 0) { add_file_footer(); } /** * Change certain token types based on simple sequence. * Example: change '[' + ']' to '[]' * Note that level info is not yet available, so it is OK to do all * processing that doesn't need to know level info. (that's very little!) */ tokenize_cleanup(); /** * Detect the brace and paren levels and insert virtual braces. * This handles all that nasty preprocessor stuff */ brace_cleanup(); /** * At this point, the level information is available and accurate. */ if ((cpd.lang_flags & LANG_PAWN) != 0) { pawn_prescan(); } /** * Re-type chunks, combine chunks */ fix_symbols(); mark_comments(); /** * Look at all colons ':' and mark labels, :? sequences, etc. */ combine_labels(); } static void uncrustify_file(const file_mem& fm, FILE *pfout, const char *parsed_file) { const deque& data = fm.data; /* Save off the encoding and whether a BOM is required */ cpd.bom = fm.bom; cpd.enc = fm.enc; if (cpd.settings[UO_utf8_force].b || ((cpd.enc == ENC_BYTE) && cpd.settings[UO_utf8_byte].b)) { cpd.enc = ENC_UTF8; } argval_t av; switch (cpd.enc) { case ENC_UTF8: av = cpd.settings[UO_utf8_bom].a; break; case ENC_UTF16_LE: case ENC_UTF16_BE: av = AV_FORCE; break; default: av = AV_IGNORE; break; } if (av == AV_REMOVE) { cpd.bom = false; } else if (av != AV_IGNORE) { cpd.bom = true; } /* Check for embedded 0's (represents a decoding failure or corrupt file) */ for (int idx = 0; idx < (int)data.size() - 1; idx++) { if (data[idx] == 0) { LOG_FMT(LERR, "An embedded 0 was found in '%s'.\n", cpd.filename); LOG_FMT(LERR, "The file may be encoded in an unsupported Unicode format.\n"); LOG_FMT(LERR, "Aborting.\n"); cpd.error_count++; return; } } uncrustify_start(data); /** * Done with detection. Do the rest only if the file will go somewhere. * The detection code needs as few changes as possible. */ if (pfout != NULL) { /** * Add comments before function defs and classes */ if (cpd.func_hdr.data.size() > 0) { add_func_header(CT_FUNC_DEF, cpd.func_hdr); } if (cpd.class_hdr.data.size() > 0) { add_func_header(CT_CLASS, cpd.class_hdr); } if (cpd.oc_msg_hdr.data.size() > 0) { add_msg_header(CT_OC_MSG_DECL, cpd.oc_msg_hdr); } /** * Change virtual braces into real braces... */ do_braces(); /* Scrub extra semicolons */ if (cpd.settings[UO_mod_remove_extra_semicolon].b) { remove_extra_semicolons(); } /* Remove unnecessary returns */ if (cpd.settings[UO_mod_remove_empty_return].b) { remove_extra_returns(); } /** * Add parens */ do_parens(); /** * Insert line breaks as needed */ //do_newlines(); int old_changes; cpd.pass_count = 3; do { old_changes = cpd.changes; LOG_FMT(LNEWLINE, "Newline loop start: %d\n", cpd.changes); newlines_cleanup_dup(); newlines_cleanup_braces(); if (cpd.settings[UO_nl_after_multiline_comment].b) { newline_after_multiline_comment(); } newlines_insert_blank_lines(); if (cpd.settings[UO_pos_bool].tp != TP_IGNORE) { newlines_chunk_pos(CT_BOOL, cpd.settings[UO_pos_bool].tp); } if (cpd.settings[UO_pos_compare].tp != TP_IGNORE) { newlines_chunk_pos(CT_COMPARE, cpd.settings[UO_pos_compare].tp); } if (cpd.settings[UO_pos_conditional].tp != TP_IGNORE) { newlines_chunk_pos(CT_COND_COLON, cpd.settings[UO_pos_conditional].tp); newlines_chunk_pos(CT_QUESTION, cpd.settings[UO_pos_conditional].tp); } if (cpd.settings[UO_pos_comma].tp != TP_IGNORE) { newlines_chunk_pos(CT_COMMA, cpd.settings[UO_pos_comma].tp); } if (cpd.settings[UO_pos_assign].tp != TP_IGNORE) { newlines_chunk_pos(CT_ASSIGN, cpd.settings[UO_pos_assign].tp); } if (cpd.settings[UO_pos_arith].tp != TP_IGNORE) { newlines_chunk_pos(CT_ARITH, cpd.settings[UO_pos_arith].tp); } newlines_class_colon_pos(); if (cpd.settings[UO_nl_squeeze_ifdef].b) { newlines_squeeze_ifdef(); } do_blank_lines(); newlines_eat_start_end(); newlines_cleanup_dup(); } while ((old_changes != cpd.changes) && (cpd.pass_count-- > 0)); mark_comments(); /** * Add balanced spaces around nested params */ if (cpd.settings[UO_sp_balance_nested_parens].b) { space_text_balance_nested_parens(); } /* Scrub certain added semicolons */ if (((cpd.lang_flags & LANG_PAWN) != 0) && cpd.settings[UO_mod_pawn_semicolon].b) { pawn_scrub_vsemi(); } /* Sort imports/using/include */ if (cpd.settings[UO_mod_sort_import].b || cpd.settings[UO_mod_sort_include].b || cpd.settings[UO_mod_sort_using].b) { sort_imports(); } /** * Fix same-line inter-chunk spacing */ space_text(); /** * Do any aligning of preprocessors */ if (cpd.settings[UO_align_pp_define_span].n > 0) { align_preprocessor(); } /** * Indent the text */ indent_preproc(); indent_text(); /* Insert trailing comments after certain close braces */ if ((cpd.settings[UO_mod_add_long_switch_closebrace_comment].n > 0) || (cpd.settings[UO_mod_add_long_function_closebrace_comment].n > 0)) { add_long_closebrace_comment(); } /* Insert trailing comments after certain preprocessor conditional blocks */ if ((cpd.settings[UO_mod_add_long_ifdef_else_comment].n > 0) || (cpd.settings[UO_mod_add_long_ifdef_endif_comment].n > 0)) { add_long_preprocessor_conditional_block_comment(); } /** * Aligning everything else and reindent */ align_all(); indent_text(); if (cpd.settings[UO_code_width].n > 0) { cpd.pass_count = 3; do { old_changes = cpd.changes; do_code_width(); if (old_changes != cpd.changes) { align_all(); indent_text(); } } while ((old_changes != cpd.changes) && (cpd.pass_count-- > 0)); } /** * And finally, align the backslash newline stuff */ align_right_comments(); if (cpd.settings[UO_align_nl_cont].b) { align_backslash_newline(); } /** * Now render it all to the output file */ output_text(pfout); } /* Special hook for dumping parsed data for debugging */ if (parsed_file != NULL) { FILE *p_file = fopen(parsed_file, "w"); if (p_file != NULL) { output_parsed(p_file); fclose(p_file); } else { LOG_FMT(LERR, "%s: Failed to open '%s' for write: %s (%d)\n", __func__, parsed_file, strerror(errno), errno); } } uncrustify_end(); } static void uncrustify_end() { /* Free all the memory */ chunk_t *pc; while ((pc = chunk_get_head()) != NULL) { chunk_del(pc); } /* Clean up some state variables */ cpd.unc_off = false; cpd.al_cnt = 0; cpd.did_newline = true; cpd.frame_count = 0; cpd.pp_level = 0; cpd.changes = 0; cpd.in_preproc = CT_NONE; cpd.consumed = false; memset(cpd.le_counts, 0, sizeof(cpd.le_counts)); cpd.preproc_ncnl_count = 0; } const char *get_token_name(c_token_t token) { if ((token >= 0) && (token < (int)ARRAY_SIZE(token_names)) && (token_names[token] != NULL)) { return(token_names[token]); } return("???"); } /** * Grab the token id for the text. * returns CT_NONE on failure to match */ c_token_t find_token_name(const char *text) { int idx; if ((text != NULL) && (*text != 0)) { for (idx = 1; idx < (int)ARRAY_SIZE(token_names); idx++) { if (strcasecmp(text, token_names[idx]) == 0) { return((c_token_t)idx); } } } return(CT_NONE); } static bool ends_with(const char *filename, const char *tag) { int len1 = strlen(filename); int len2 = strlen(tag); if ((len2 <= len1) && (strcmp(&filename[len1 - len2], tag) == 0)) { return(true); } return(false); } struct file_lang { const char *ext; const char *tag; int lang; }; struct file_lang languages[] = { { ".c", "C", LANG_C }, { ".cpp", "CPP", LANG_CPP }, { ".d", "D", LANG_D }, { ".cs", "CS", LANG_CS }, { ".vala", "VALA", LANG_VALA }, { ".java", "JAVA", LANG_JAVA }, { ".pawn", "PAWN", LANG_PAWN }, { ".p", "", LANG_PAWN }, { ".sma", "", LANG_PAWN }, { ".inl", "", LANG_PAWN }, { ".h", "", LANG_CPP }, { ".cxx", "", LANG_CPP }, { ".hpp", "", LANG_CPP }, { ".hxx", "", LANG_CPP }, { ".cc", "", LANG_CPP }, { ".di", "", LANG_D }, { ".m", "OC", LANG_OC }, { ".mm", "OC+", LANG_OC | LANG_CPP }, { ".sqc", "", LANG_C }, // embedded SQL { ".es", "ECMA", LANG_ECMA }, }; /** * Set idx = 0 before the first call. * Done when returns NULL */ const char *get_file_extension(int& idx) { const char *val = NULL; if (idx < (int)ARRAY_SIZE(languages)) { val = languages[idx].ext; } idx++; return(val); } /** * Find the language for the file extension * Default to C * * @param filename The name of the file * @return LANG_xxx */ static int language_from_filename(const char *filename) { int i; for (i = 0; i < (int)ARRAY_SIZE(languages); i++) { if (ends_with(filename, languages[i].ext)) { return(languages[i].lang); } } return(LANG_C); } /** * Find the language for the file extension * * @param filename The name of the file * @return LANG_xxx or 0 (no match) */ static int language_from_tag(const char *tag) { int i; for (i = 0; i < (int)ARRAY_SIZE(languages); i++) { if (strcasecmp(tag, languages[i].tag) == 0) { return(languages[i].lang); } } return(0); } /** * Gets the tag text for a language * * @param lang The LANG_xxx enum * @return A string */ static const char *language_to_string(int lang) { int i; /* Check for an exact match first */ for (i = 0; i < (int)ARRAY_SIZE(languages); i++) { if (languages[i].lang == lang) { return(languages[i].tag); } } /* Check for the first set language bit */ for (i = 0; i < (int)ARRAY_SIZE(languages); i++) { if ((languages[i].lang & lang) != 0) { return(languages[i].tag); } } return("???"); } void log_pcf_flags(log_sev_t sev, UINT64 flags) { if (!log_sev_on(sev)) { return; } log_fmt(sev, "[0x%" PRIx64 ":", flags); const char *tolog = NULL; for (int i = 0; i < (int)ARRAY_SIZE(pcf_names); i++) { if ((flags & (1ULL << i)) != 0) { if (tolog != NULL) { log_str(sev, tolog, strlen(tolog)); log_str(sev, ",", 1); } tolog = pcf_names[i]; } } if (tolog != NULL) { log_str(sev, tolog, strlen(tolog)); } log_str(sev, "]\n", 2); } uncrustify-0.59/src/token_names.h0000644000175000017500000000724111632024633014052 00000000000000/* * Generated by make_token_names.sh on Sat Sep 3 10:59:51 CDT 2011 */ #ifndef TOKEN_NAMES_H_INCLUDED #define TOKEN_NAMES_H_INCLUDED const char *token_names[] = { "NONE", "EOF", "UNKNOWN", "JUNK", "WHITESPACE", "SPACE", "NEWLINE", "NL_CONT", "COMMENT_CPP", "COMMENT", "COMMENT_MULTI", "COMMENT_EMBED", "COMMENT_START", "COMMENT_END", "COMMENT_WHOLE", "COMMENT_ENDIF", "IGNORED", "WORD", "NUMBER", "NUMBER_FP", "STRING", "STRING_MULTI", "IF", "ELSE", "ELSEIF", "FOR", "WHILE", "WHILE_OF_DO", "SWITCH", "CASE", "DO", "VOLATILE", "TYPEDEF", "STRUCT", "ENUM", "SIZEOF", "RETURN", "BREAK", "UNION", "GOTO", "CONTINUE", "C_CAST", "CPP_CAST", "D_CAST", "TYPE_CAST", "TYPENAME", "TEMPLATE", "ASSIGN", "ASSIGN_NL", "SASSIGN", "COMPARE", "SCOMPARE", "BOOL", "SBOOL", "ARITH", "SARITH", "DEREF", "INCDEC_BEFORE", "INCDEC_AFTER", "MEMBER", "DC_MEMBER", "C99_MEMBER", "INV", "DESTRUCTOR", "NOT", "D_TEMPLATE", "ADDR", "NEG", "POS", "STAR", "PLUS", "MINUS", "AMP", "BYREF", "POUND", "PREPROC", "PREPROC_INDENT", "PREPROC_BODY", "PP", "ELLIPSIS", "RANGE", "SEMICOLON", "VSEMICOLON", "COLON", "CASE_COLON", "CLASS_COLON", "D_ARRAY_COLON", "COND_COLON", "QUESTION", "COMMA", "ASM", "ATTRIBUTE", "CATCH", "CLASS", "DELETE", "EXPORT", "FRIEND", "NAMESPACE", "NEW", "OPERATOR", "OPERATOR_VAL", "PRIVATE", "PRIVATE_COLON", "THROW", "TRY", "USING", "USING_STMT", "D_WITH", "D_MODULE", "SUPER", "DELEGATE", "BODY", "DEBUG", "DEBUGGER", "INVARIANT", "UNITTEST", "UNSAFE", "FINALLY", "IMPORT", "D_SCOPE", "D_SCOPE_IF", "LAZY", "D_MACRO", "D_VERSION", "D_VERSION_IF", "PAREN_OPEN", "PAREN_CLOSE", "ANGLE_OPEN", "ANGLE_CLOSE", "SPAREN_OPEN", "SPAREN_CLOSE", "FPAREN_OPEN", "FPAREN_CLOSE", "BRACE_OPEN", "BRACE_CLOSE", "VBRACE_OPEN", "VBRACE_CLOSE", "SQUARE_OPEN", "SQUARE_CLOSE", "TSQUARE", "MACRO_OPEN", "MACRO_CLOSE", "MACRO_ELSE", "LABEL", "LABEL_COLON", "FUNCTION", "FUNC_CALL", "FUNC_CALL_USER", "FUNC_DEF", "FUNC_PROTO", "FUNC_CLASS", "FUNC_CTOR_VAR", "FUNC_WRAP", "MACRO_FUNC", "MACRO", "QUALIFIER", "EXTERN", "ALIGN", "TYPE", "PTR_TYPE", "TYPE_WRAP", "BIT_COLON", "OC_DYNAMIC", "OC_END", "OC_IMPL", "OC_INTF", "OC_PROTOCOL", "OC_PROTO_LIST", "OC_PROPERTY", "OC_CLASS", "OC_CLASS_EXT", "OC_CATEGORY", "OC_SCOPE", "OC_MSG", "OC_MSG_CLASS", "OC_MSG_FUNC", "OC_MSG_NAME", "OC_MSG_SPEC", "OC_MSG_DECL", "OC_RTYPE", "OC_COLON", "OC_SEL", "OC_SEL_NAME", "OC_BLOCK_ARG", "OC_BLOCK_TYPE", "OC_BLOCK_EXPR", "OC_BLOCK_CARET", "PP_DEFINE", "PP_DEFINED", "PP_INCLUDE", "PP_IF", "PP_ELSE", "PP_ENDIF", "PP_ASSERT", "PP_EMIT", "PP_ENDINPUT", "PP_ERROR", "PP_FILE", "PP_LINE", "PP_SECTION", "PP_UNDEF", "PP_BODYCHUNK", "PP_PRAGMA", "PP_REGION", "PP_ENDREGION", "PP_REGION_INDENT", "PP_IF_INDENT", "PP_OTHER", "CHAR", "DEFINED", "FORWARD", "NATIVE", "STATE", "STOCK", "TAGOF", "DOT", "TAG", "TAG_COLON", "LOCK", "AS", "IN", "BRACED", "THIS", "BASE", "DEFAULT", "GETSET", "GETSET_EMPTY", "CONCAT", "CS_SQ_STMT", "CS_SQ_COLON", "CS_PROPERTY", "SQL_EXEC", "SQL_BEGIN", "SQL_END", "SQL_WORD", "CONSTRUCT", "LAMBDA", "ASSERT", }; #endif /* TOKEN_NAMES_H_INCLUDED */ uncrustify-0.59/src/md5.cpp0000644000175000017500000002207111506773274012601 00000000000000/** * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. * * @license Public Domain / GPL v2+ */ #include "md5.h" #include /* memcpy, memset */ /** * Reverse the bytes in 32-bit chunks. * 'buf' might not be word-aligned. * * @param buf The byte array to reverse * @param n_u32 The number of UINT32's in the data */ void MD5::reverse_u32(UINT8 *buf, int n_u32) { UINT8 tmp; if (m_big_endian) { /* change { 4, 3, 2, 1 } => { 1, 2, 3, 4 } */ while (n_u32-- > 0) { tmp = buf[0]; buf[0] = buf[3]; buf[3] = tmp; tmp = buf[1]; buf[1] = buf[2]; buf[2] = tmp; buf += 4; } } else { /* change { 4, 3, 2, 1 } => { 3, 4, 1, 2 } */ while (n_u32-- > 0) { tmp = buf[0]; buf[0] = buf[1]; buf[1] = tmp; tmp = buf[2]; buf[2] = buf[3]; buf[3] = tmp; buf += 4; } } } MD5::MD5() { m_buf[0] = 0x01020304; /* * Little endian = { 4, 3, 2, 1 } * Big endian = { 1, 2, 3, 4 } * PDP endian = { 3, 4, 1, 2 } * * The MD5 stuff is written for little endian. */ m_need_byteswap = *(UINT8 *)m_buf != 4; m_big_endian = *(UINT8 *)m_buf == 1; } /** * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void MD5::Init() { m_buf[0] = 0x67452301; m_buf[1] = 0xefcdab89; m_buf[2] = 0x98badcfe; m_buf[3] = 0x10325476; m_bits[0] = 0; m_bits[1] = 0; } /** * Update context to reflect the concatenation of another buffer full * of bytes. */ void MD5::Update(const void *data, UINT32 len) { const UINT8 *buf = (const UINT8 *)data; UINT32 t; /* Update bitcount */ t = m_bits[0]; if ((m_bits[0] = t + ((UINT32)len << 3)) < t) { m_bits[1]++; /* Carry from low to high */ } m_bits[1] += len >> 29; t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ /* Handle any leading odd-sized chunks */ if (t) { UINT8 *p = (UINT8 *)m_in + t; t = 64 - t; if (len < t) { memcpy(p, buf, len); return; } memcpy(p, buf, t); if (m_need_byteswap) { reverse_u32(m_in, 16); } Transform(m_buf, (UINT32 *)m_in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(m_in, buf, 64); if (m_need_byteswap) { reverse_u32(m_in, 16); } Transform(m_buf, (UINT32 *)m_in); buf += 64; len -= 64; } /* Save off any remaining bytes of data */ memcpy(m_in, buf, len); } /** * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void MD5::Final(UINT8 digest[16]) { UINT32 count; UINT8 *p; /* Compute number of bytes mod 64 */ count = (m_bits[0] >> 3) & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is * always at least one byte free */ p = m_in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); if (m_need_byteswap) { reverse_u32(m_in, 16); } Transform(m_buf, (UINT32 *)m_in); /* Now fill the next block with 56 bytes */ memset(m_in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } if (m_need_byteswap) { reverse_u32(m_in, 14); } /* Append length in bits and transform */ ((UINT32 *)m_in)[14] = m_bits[0]; ((UINT32 *)m_in)[15] = m_bits[1]; Transform(m_buf, (UINT32 *)m_in); if (m_need_byteswap) { reverse_u32((UINT8 *)m_buf, 4); } memcpy(digest, m_buf, 16); } /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ (w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5::Update blocks * the data and converts bytes into longwords for this routine. */ void MD5::Transform(UINT32 buf[4], UINT32 in_data[16]) { UINT32 a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in_data[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in_data[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in_data[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in_data[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in_data[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in_data[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in_data[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in_data[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in_data[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in_data[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in_data[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in_data[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in_data[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in_data[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in_data[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in_data[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in_data[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in_data[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in_data[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in_data[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in_data[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in_data[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in_data[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in_data[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in_data[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in_data[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in_data[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in_data[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in_data[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in_data[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in_data[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in_data[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in_data[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in_data[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in_data[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in_data[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in_data[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in_data[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in_data[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in_data[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in_data[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in_data[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in_data[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in_data[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in_data[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in_data[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in_data[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in_data[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in_data[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in_data[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in_data[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in_data[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in_data[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in_data[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in_data[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in_data[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in_data[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in_data[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in_data[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in_data[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in_data[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in_data[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in_data[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in_data[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } void MD5::Calc(const void *data, UINT32 length, UINT8 digest[16]) { MD5 md5; md5.Init(); md5.Update(data, length); md5.Final(digest); } uncrustify-0.59/src/logmask.cpp0000644000175000017500000000550411614421167013542 00000000000000/** * @file logmask.cpp * * Functions to convert between a string and a severity mask. * * @author Ben Gardner * @license GPL v2+ */ #include "logmask.h" #include /* snprintf() */ #include /* strtoul() */ #include "unc_ctype.h" /** * Convert a logmask into a string * * @param mask the mask to convert * @param buf the buffer to hold the string * @param size the size of the buffer * @return buf (pass through) */ char *logmask_to_str(const log_mask_t& mask, char *buf, int size) { int last_sev = -1; bool is_range = false; int sev; int len = 0; if ((buf == NULL) || (size <= 0)) { return(buf); } for (sev = 0; sev < 256; sev++) { if (logmask_test(mask, sev)) { if (last_sev == -1) { len += snprintf(&buf[len], size - len, "%d,", sev); } else { is_range = true; } last_sev = sev; } else { if (is_range) { buf[len - 1] = '-'; /* change last comma to a dash */ len += snprintf(&buf[len], size - len, "%d,", last_sev); is_range = false; } last_sev = -1; } } /* handle a range that ends on the last bit */ if (is_range && (last_sev != -1)) { buf[len - 1] = '-'; /* change last comma to a dash */ len += snprintf(&buf[len], size - len, "%d", last_sev); } else { /* Eat the last comma */ if (len > 0) { len--; } } buf[len] = 0; return(buf); } /** * Parses a string into a log severity * * @param str The string to parse * @param mask The mask to populate */ void logmask_from_string(const char *str, log_mask_t& mask) { char *ptmp; bool was_dash = false; int last_level = -1; int level; int idx; if (str == NULL) { return; } /* Start with a clean mask */ logmask_set_all(mask, false); /* If the first character is 'A', set all sevs */ if (unc_toupper(*str) == 'A') { logmask_set_all(mask, true); str++; } while (*str != 0) { if (unc_isspace(*str)) { str++; continue; } if (unc_isdigit(*str)) { level = strtoul(str, &ptmp, 10); str = ptmp; logmask_set_sev(mask, level, true); if (was_dash) { for (idx = last_level + 1; idx < level; idx++) { logmask_set_sev(mask, idx, true); } was_dash = false; } last_level = level; } else if (*str == '-') { was_dash = true; str++; } else /* probably a comma */ { last_level = -1; was_dash = false; str++; } } } uncrustify-0.59/src/align_stack.cpp0000644000175000017500000003174111630457175014374 00000000000000/** * @file align_stack.cpp * Manages a align stack, which is just a pair of chunk stacks. * There can be at most 1 item per line in the stack. * The seqnum is actually a line counter. * * @author Ben Gardner * @license GPL v2+ */ #include "align_stack.h" #include "prototypes.h" #include "chunk_list.h" /** * Resets the two ChunkLists and zeroes local vars. * * @param span The row span limit * @param thresh The column threshold */ void AlignStack::Start(int span, int thresh) { LOG_FMT(LAS, "Start(%d, %d)\n", span, thresh); m_aligned.Reset(); m_skipped.Reset(); m_span = span; m_thresh = thresh; m_min_col = 9999; m_max_col = 0; m_nl_seqnum = 0; m_seqnum = 0; m_gap = 0; m_right_align = false; m_star_style = SS_IGNORE; m_amp_style = SS_IGNORE; } /** * Calls Add on all the skipped items */ void AlignStack::ReAddSkipped() { if (!m_skipped.Empty()) { /* Make a copy of the ChunkStack and clear m_skipped */ m_scratch.Set(m_skipped); m_skipped.Reset(); const ChunkStack::Entry *ce; /* Need to add them in order so that m_nl_seqnum is correct */ for (int idx = 0; idx < m_scratch.Len(); idx++) { ce = m_scratch.Get(idx); LOG_FMT(LAS, "ReAddSkipped [%d] - ", ce->m_seqnum); Add(ce->m_pc, ce->m_seqnum); } /* Check to see if we need to flush right away */ NewLines(0); } } /** * Adds an entry to the appropriate stack. * * @param pc The chunk * @param seqnum Optional seqnum (0=assign one) */ void AlignStack::Add(chunk_t *start, int seqnum) { /* Assign a seqnum if needed */ if (seqnum == 0) { seqnum = m_seqnum; } chunk_t *ali; chunk_t *ref; chunk_t *tmp; chunk_t *prev; chunk_t *next; int col_adj = 0; /* Amount the column is shifted for 'dangle' mode */ int tmp_col; int endcol; int gap; m_last_added = 0; /* Check threshold limits */ if ((m_max_col == 0) || (m_thresh == 0) || (((start->column + m_gap) <= (m_max_col + m_thresh)) && (((start->column + m_gap) >= (m_max_col - m_thresh)) || (start->column >= m_min_col)))) { /* we are adding it, so update the newline seqnum */ if (seqnum > m_nl_seqnum) { m_nl_seqnum = seqnum; } /** * SS_IGNORE: no special handling of '*' or '&', only 'foo' is aligned * void foo; // gap=5, 'foo' is aligned * char * foo; // gap=3, 'foo' is aligned * foomatic foo; // gap=1, 'foo' is aligned * The gap is the columns between 'foo' and the previous token. * [void - foo], ['*' - foo], etc * * SS_INCLUDE: - space between variable and '*' or '&' is eaten * void foo; // gap=5, 'foo' is aligned * char *foo; // gap=5, '*' is aligned * foomatic foo; // gap=1, 'foo' is aligned * The gap is the columns between the first '*' or '&' before foo * and the previous token. [void - foo], [char - '*'], etc * * SS_DANGLE: - space between variable and '*' or '&' is eaten * void foo; // gap=5 * char *bar; // gap=5, as the '*' doesn't count * foomatic foo; // gap=1 * The gap is the columns between 'foo' and the chunk before the first * '*' or '&'. [void - foo], [char - bar], etc * * If the gap < m_gap, then the column is bumped out by the difference. * So, if m_gap is 2, then the above would be: * SS_IGNORE: * void foo; // gap=6 * char * foo; // gap=4 * foomatic foo; // gap=2 * SS_INCLUDE: * void foo; // gap=6 * char *foo; // gap=6 * foomatic foo; // gap=2 * SS_DANGLE: * void foo; // gap=6 * char *bar; // gap=6, as the '*' doesn't count * foomatic foo; // gap=2 * Right aligned numbers: * #define A -1 * #define B 631 * #define C 3 * Left aligned numbers: * #define A -1 * #define B 631 * #define C 3 * * In the code below, pc is set to the item that is aligned. * In the above examples, that is 'foo', '*', '-', or 63. * * Ref is set to the last part of the type. * In the above examples, that is 'void', 'char', 'foomatic', 'A', or 'B'. * * The '*' and '&' can float between the two. * * If align_on_tabstop=true, then SS_DANGLE is changed to SS_INCLUDE. */ if (cpd.settings[UO_align_on_tabstop].b && (m_star_style == SS_DANGLE)) { m_star_style = SS_INCLUDE; } /* Find ref. Back up to the real item that is aligned. */ prev = start; while (((prev = chunk_get_prev(prev)) != NULL) && (chunk_is_star(prev) || chunk_is_addr(prev) || (chunk_is_str(prev, "(", 1) && (prev->parent_type == CT_TYPEDEF)))) { /* do nothing - we want prev when this exits */ } ref = prev; if (chunk_is_newline(ref)) { ref = chunk_get_next(ref); } /* Find the item that we are going to align. */ ali = start; if (m_star_style != SS_IGNORE) { /* back up to the first '*' preceding the token */ prev = chunk_get_prev(ali); while (chunk_is_star(prev)) { ali = prev; prev = chunk_get_prev(ali); } if (chunk_is_str(prev, "(", 1) && (prev->parent_type == CT_TYPEDEF)) { ali = prev; prev = chunk_get_prev(ali); } } if (m_amp_style != SS_IGNORE) { /* back up to the first '&' preceding the token */ prev = chunk_get_prev(ali); while (chunk_is_addr(prev)) { ali = prev; prev = chunk_get_prev(ali); } } /* Tighten down the spacing between ref and start */ tmp_col = ref->column; tmp = ref; while (tmp != start) { next = chunk_get_next(tmp); tmp_col += space_col_align(tmp, next); if (next->column != tmp_col) { align_to_column(next, tmp_col); } tmp = next; } /* Set the column adjust and gap */ col_adj = 0; gap = 0; if (ref != ali) { gap = ali->column - (ref->column + ref->len()); } tmp = ali; if (chunk_is_str(tmp, "(", 1) && (tmp->parent_type == CT_TYPEDEF)) { tmp = chunk_get_next(tmp); } if ((chunk_is_star(tmp) && (m_star_style == SS_DANGLE)) || (chunk_is_addr(tmp) && (m_amp_style == SS_DANGLE))) { col_adj = start->column - ali->column; gap = start->column - (ref->column + ref->len()); } /* See if this pushes out the max_col */ endcol = ali->column + col_adj; if (gap < m_gap) { endcol += m_gap - gap; } // LOG_FMT(LSYS, "[%p] line %d pc='%s' [%s] col:%d ali='%s' [%s] col:%d ref='%s' [%s] col:%d col_adj=%d endcol=%d, ss=%d as=%d, gap=%d\n", // this, // start->orig_line, // start->str.c_str(), get_token_name(start->type), start->column, // ali->str.c_str(), get_token_name(ali->type), ali->column, // ref->str.c_str(), get_token_name(ref->type), ref->column, // col_adj, endcol, m_star_style, m_amp_style, gap); ali->align.col_adj = col_adj; ali->align.ref = ref; ali->align.start = start; m_aligned.Push(ali, seqnum); m_last_added = 1; LOG_FMT(LAS, "Add-[%s]: line %d, col %d, adj %d : ref=[%s] endcol=%d\n", ali->str.c_str(), ali->orig_line, ali->column, ali->align.col_adj, ref->str.c_str(), endcol); if (m_min_col > endcol) { m_min_col = endcol; } if (endcol > m_max_col) { LOG_FMT(LAS, "Add-aligned [%d/%d/%d]: line %d, col %d : max_col old %d, new %d - min_col %d\n", seqnum, m_nl_seqnum, m_seqnum, ali->orig_line, ali->column, m_max_col, endcol, m_min_col); m_max_col = endcol; /** * If there were any entries that were skipped, re-add them as they * may now be within the threshold */ if (!m_skipped.Empty()) { ReAddSkipped(); } } else { LOG_FMT(LAS, "Add-aligned [%d/%d/%d]: line %d, col %d : col %d <= %d - min_col %d\n", seqnum, m_nl_seqnum, m_seqnum, ali->orig_line, ali->column, endcol, m_max_col, m_min_col); } } else { /* The threshold check failed, so add it to the skipped list */ m_skipped.Push(start, seqnum); m_last_added = 2; LOG_FMT(LAS, "Add-skipped [%d/%d/%d]: line %d, col %d <= %d + %d\n", seqnum, m_nl_seqnum, m_seqnum, start->orig_line, start->column, m_max_col, m_thresh); } } /** * Adds some newline and calls Flush() if needed */ void AlignStack::NewLines(int cnt) { if (!m_aligned.Empty()) { m_seqnum += cnt; if (m_seqnum > (m_nl_seqnum + m_span)) { LOG_FMT(LAS, "Newlines<%d>-", cnt); Flush(); } else { LOG_FMT(LAS, "Newlines<%d>\n", cnt); } } } /** * Aligns all the stuff in m_aligned. * Re-adds 'newer' items in m_skipped. */ void AlignStack::Flush() { int last_seqnum = 0; int idx; int tmp_col; const ChunkStack::Entry *ce = NULL; chunk_t *pc; LOG_FMT(LAS, "Flush (min=%d, max=%d)\n", m_min_col, m_max_col); m_last_added = 0; m_max_col = 0; /* Recalculate the max_col - it may have shifted since the last Add() */ for (idx = 0; idx < m_aligned.Len(); idx++) { pc = m_aligned.Get(idx)->m_pc; /* Set the column adjust and gap */ int col_adj = 0; int gap = 0; if (pc != pc->align.ref) { gap = pc->column - (pc->align.ref->column + pc->align.ref->len()); } chunk_t *tmp = pc; if (chunk_is_str(tmp, "(", 1) && (tmp->parent_type == CT_TYPEDEF)) { tmp = chunk_get_next(tmp); } if ((chunk_is_star(tmp) && (m_star_style == SS_DANGLE)) || (chunk_is_addr(tmp) && (m_amp_style == SS_DANGLE))) { col_adj = pc->align.start->column - pc->column; gap = pc->align.start->column - (pc->align.ref->column + pc->align.ref->len()); } if (m_right_align) { /* Adjust the width for signed numbers */ int start_len = pc->align.start->len(); if (pc->align.start->type == CT_NEG) { tmp = chunk_get_next(pc->align.start); if ((tmp != NULL) && (tmp->type == CT_NUMBER)) { start_len += tmp->len(); } } col_adj += start_len; } pc->align.col_adj = col_adj; /* See if this pushes out the max_col */ int endcol = pc->column + col_adj; if (gap < m_gap) { endcol += m_gap - gap; } if (endcol > m_max_col) { m_max_col = endcol; } } if (cpd.settings[UO_align_on_tabstop].b && (m_aligned.Len() > 1)) { m_max_col = align_tab_column(m_max_col); } for (idx = 0; idx < m_aligned.Len(); idx++) { ce = m_aligned.Get(idx); pc = ce->m_pc; if (idx == 0) { pc->flags |= PCF_ALIGN_START; pc->align.right_align = m_right_align; pc->align.amp_style = (int)m_amp_style; pc->align.star_style = (int)m_star_style; pc->align.gap = m_gap; } pc->align.next = m_aligned.GetChunk(idx + 1); /* Indent the token, taking col_adj into account */ tmp_col = m_max_col - pc->align.col_adj; LOG_FMT(LAS, "%s: line %d: '%s' to col %d (adj=%d)\n", __func__, pc->orig_line, pc->str.c_str(), tmp_col, pc->align.col_adj); align_to_column(pc, tmp_col); } if (ce != NULL) { last_seqnum = ce->m_seqnum; m_aligned.Reset(); } m_min_col = 9999; m_max_col = 0; if (m_skipped.Empty()) { /* Nothing was skipped, sync the seqnums */ m_nl_seqnum = m_seqnum; } else { /* Remove all items with seqnum < last_seqnum */ for (idx = 0; idx < m_skipped.Len(); idx++) { if (m_skipped.Get(idx)->m_seqnum < last_seqnum) { m_skipped.Zap(idx); } } m_skipped.Collapse(); /* Add all items from the skipped list */ ReAddSkipped(); } } /** * Resets the stack, discarding anything that was previously added */ void AlignStack::Reset() { m_aligned.Reset(); m_skipped.Reset(); } /** * Aligns everything else and resets the lists. */ void AlignStack::End() { if (!m_aligned.Empty()) { LOG_FMT(LAS, "End-"); Flush(); } m_aligned.Reset(); m_skipped.Reset(); } uncrustify-0.59/src/unicode.cpp0000644000175000017500000002524011633534053013532 00000000000000/** * @file unicode.cpp * Detects, read and writes characters in the proper format. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "prototypes.h" #include "unc_ctype.h" #include #include /** * See if all characters are ASCII (0-127) */ bool is_ascii(const vector& data, int& non_ascii_cnt, int& zero_cnt) { non_ascii_cnt = zero_cnt = 0; for (int idx = 0; idx < (int)data.size(); idx++) { if (data[idx] & 0x80) { non_ascii_cnt++; } if (!data[idx]) { zero_cnt++; } } return((non_ascii_cnt + zero_cnt) == 0); } /** * Convert the array of bytes into an array of ints */ bool decode_bytes(const vector& in_data, deque& out_data) { out_data.resize(in_data.size()); for (int idx = 0; idx < (int)in_data.size(); idx++) { out_data[idx] = in_data[idx]; } return true; } void encode_utf8(int ch, vector& res) { if (ch < 0) { /* illegal code - do not store */ } else if (ch < 0x80) { /* 0xxxxxxx */ res.push_back(ch); } else if (ch < 0x0800) { /* 110xxxxx 10xxxxxx */ res.push_back(0xC0 | (ch >> 6)); res.push_back(0x80 | (ch & 0x3f)); } else if (ch < 0x10000) { /* 1110xxxx 10xxxxxx 10xxxxxx */ res.push_back(0xE0 | (ch >> 12)); res.push_back(0x80 | ((ch >> 6) & 0x3f)); res.push_back(0x80 | (ch & 0x3f)); } else if (ch < 0x200000) { /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ res.push_back(0xF0 | (ch >> 18)); res.push_back(0x80 | ((ch >> 12) & 0x3f)); res.push_back(0x80 | ((ch >> 6) & 0x3f)); res.push_back(0x80 | (ch & 0x3f)); } else if (ch < 0x4000000) { /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ res.push_back(0xF8 | (ch >> 24)); res.push_back(0x80 | ((ch >> 18) & 0x3f)); res.push_back(0x80 | ((ch >> 12) & 0x3f)); res.push_back(0x80 | ((ch >> 6) & 0x3f)); res.push_back(0x80 | (ch & 0x3f)); } else /* (ch <= 0x7fffffff) */ { /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ res.push_back(0xFC | (ch >> 30)); res.push_back(0x80 | ((ch >> 24) & 0x3f)); res.push_back(0x80 | ((ch >> 18) & 0x3f)); res.push_back(0x80 | ((ch >> 12) & 0x3f)); res.push_back(0x80 | ((ch >> 6) & 0x3f)); res.push_back(0x80 | (ch & 0x3f)); } } /** * Decode UTF-8 sequences from in_data and put the chars in out_data. * If there are any decoding errors, then return false. */ bool decode_utf8(const vector& in_data, deque& out_data) { int idx = 0; int ch, tmp, cnt; out_data.clear(); /* check for UTF-8 BOM silliness and skip */ if (in_data.size() >= 3) { if ((in_data[0] == 0xef) && (in_data[1] == 0xbb) && (in_data[2] == 0xbf)) { /* skip it */ idx = 3; } } while (idx < (int)in_data.size()) { ch = in_data[idx++]; if (ch < 0x80) /* 1-byte sequence */ { out_data.push_back(ch); continue; } else if ((ch & 0xE0) == 0xC0) /* 2-byte sequence */ { ch &= 0x1F; cnt = 1; } else if ((ch & 0xF0) == 0xE0) /* 3-byte sequence */ { ch &= 0x0F; cnt = 2; } else if ((ch & 0xF8) == 0xF0) /* 4-byte sequence */ { ch &= 0x07; cnt = 3; } else if ((ch & 0xFC) == 0xF8) /* 5-byte sequence */ { ch &= 0x03; cnt = 4; } else if ((ch & 0xFE) == 0xFC) /* 6-byte sequence */ { ch &= 0x01; cnt = 5; } else { /* invalid UTF-8 sequence */ return false; } while ((cnt-- > 0) && (idx < (int)in_data.size())) { tmp = in_data[idx++]; if ((tmp & 0xC0) != 0x80) { /* invalid UTF-8 sequence */ return false; } ch = (ch << 6) | (tmp & 0x3f); } if (cnt >= 0) { /* short UTF-8 sequence */ return false; } out_data.push_back(ch); } return true; } /** * Extract 2 bytes from the stream and increment idx by 2 */ static int get_word(const vector& in_data, int& idx, bool be) { int ch; if ((idx + 2) > (int)in_data.size()) { ch = -1; } else if (be) { ch = (in_data[idx] << 8) | in_data[idx + 1]; } else { ch = in_data[idx] | (in_data[idx + 1] << 8); } idx += 2; return ch; } /** * Deocde a UTF-16 sequence. * Sets enc based on the BOM. * Must have the BOM as the first two bytes. */ bool decode_utf16(const vector& in_data, deque& out_data, CharEncoding& enc) { out_data.clear(); if (in_data.size() & 1) { /* can't have and odd length */ return false; } if (in_data.size() < 2) { /* we require the BOM or at least 1 char */ return false; } int idx = 2; if ((in_data[0] == 0xfe) && (in_data[1] == 0xff)) { enc = ENC_UTF16_BE; } else if ((in_data[0] == 0xff) && (in_data[1] == 0xfe)) { enc = ENC_UTF16_LE; } else { /* If we have a few words, we can take a guess, assuming the first few * chars are ASCII */ enc = ENC_ASCII; idx = 0; if (in_data.size() >= 6) { if ((in_data[0] == 0) && (in_data[2] == 0) && (in_data[4] == 0)) { enc = ENC_UTF16_BE; } else if ((in_data[1] == 0) && (in_data[3] == 0) && (in_data[5] == 0)) { enc = ENC_UTF16_LE; } } if (enc == ENC_ASCII) { return false; } } bool be = (enc == ENC_UTF16_BE); while (idx < (int)in_data.size()) { int ch = get_word(in_data, idx, be); if ((ch & 0xfc00) == 0xd800) { ch &= 0x3ff; ch <<= 10; int tmp = get_word(in_data, idx, be); if ((tmp & 0xfc00) != 0xdc00) { return false; } ch |= (tmp & 0x3ff); ch += 0x10000; out_data.push_back(ch); } else if (((ch >= 0) && (ch < 0xD800)) || (ch >= 0xE000)) { out_data.push_back(ch); } else { /* invalid character */ return false; } } return true; } /** * Looks for the BOM of UTF-16 BE/LE and UTF-8. * If found, set enc and return true. * Sets enc to ENC_ASCII and returns false if not found. */ bool decode_bom(const vector& in_data, CharEncoding& enc) { enc = ENC_ASCII; if (in_data.size() >= 2) { if ((in_data[0] == 0xfe) && (in_data[1] == 0xff)) { enc = ENC_UTF16_BE; return true; } else if ((in_data[0] == 0xff) && (in_data[1] == 0xfe)) { enc = ENC_UTF16_LE; return true; } else if ((in_data.size() >= 3) && (in_data[0] == 0xef) && (in_data[1] == 0xbb) && (in_data[2] == 0xbf)) { enc = ENC_UTF8; return true; } } return false; } /** * Figure out the encoding and convert to an int sequence */ bool decode_unicode(const vector& in_data, deque& out_data, CharEncoding& enc, bool& has_bom) { /* check for a BOM */ if (decode_bom(in_data, enc)) { has_bom = true; if (enc == ENC_UTF8) { return decode_utf8(in_data, out_data); } else { return decode_utf16(in_data, out_data, enc); } } has_bom = false; /* Check for simple ASCII */ int non_ascii_cnt; int zero_cnt; if (is_ascii(in_data, non_ascii_cnt, zero_cnt)) { enc = ENC_ASCII; return decode_bytes(in_data, out_data); } /* There are alot of 0's in UTF-16 (~50%) */ if ((zero_cnt > ((int)in_data.size() / 4)) && (zero_cnt <= ((int)in_data.size() / 2))) { /* likely is UTF-16 */ if (decode_utf16(in_data, out_data, enc)) { return true; } } if (decode_utf8(in_data, out_data)) { enc = ENC_UTF8; return true; } /* it is an unrecognized byte sequence */ enc = ENC_BYTE; return decode_bytes(in_data, out_data); } /** * Write for ASCII and BYTE encoding */ void write_byte(int ch, FILE *pf) { if (ch < 0x100) { fputc(ch, pf); } else { /* illegal code - do not store */ } } /** * Writes a single character to a file using UTF-8 encoding */ void write_utf8(int ch, FILE *pf) { vector dq; dq.reserve(6); encode_utf8(ch, dq); fwrite(&dq[0], dq.size(), 1, pf); } void write_utf16(int ch, bool be, FILE *pf) { /* U+0000 to U+D7FF and U+E000 to U+FFFF */ if (((ch >= 0) && (ch < 0xD800)) || ((ch >= 0xE000) && (ch < 0x10000))) { if (be) { fputc((ch >> 8), pf); fputc((ch & 0xff), pf); } else { fputc((ch & 0xff), pf); fputc((ch >> 8), pf); } } else if ((ch >= 0x10000) && (ch < 0x110000)) { int v1 = ch - 0x10000; int w1 = 0xD800 + (v1 >> 10); int w2 = 0xDC00 + (v1 & 0x3ff); if (be) { fputc((w1 >> 8), pf); fputc((w1 & 0xff), pf); fputc((w2 >> 8), pf); fputc((w2 & 0xff), pf); } else { fputc((w1 & 0xff), pf); fputc((w1 >> 8), pf); fputc((w2 & 0xff), pf); fputc((w2 >> 8), pf); } } else { /* illegal code - do not store */ } } void write_bom(FILE *pf, CharEncoding enc) { switch (enc) { case ENC_UTF8: write_byte(0xef, pf); write_byte(0xbb, pf); write_byte(0xbf, pf); break; case ENC_UTF16_LE: write_utf16(0xfeff, false, pf); break; case ENC_UTF16_BE: write_utf16(0xfeff, true, pf); break; default: break; } } /** * @param ch the 31-bit char value */ void write_char(FILE *pf, int ch, CharEncoding enc) { if (ch >= 0) { switch (enc) { case ENC_BYTE: write_byte(ch & 0xff, pf); break; case ENC_ASCII: default: write_byte(ch, pf); break; case ENC_UTF8: write_utf8(ch, pf); break; case ENC_UTF16_LE: write_utf16(ch, false, pf); break; case ENC_UTF16_BE: write_utf16(ch, true, pf); break; } } } void write_string(FILE *pf, const char *ascii_text, CharEncoding enc) { while (*ascii_text) { write_char(pf, *ascii_text, enc); ascii_text++; } } void write_string(FILE *pf, const deque& text, CharEncoding enc) { for (int idx = 0; idx < (int)text.size(); idx++) { write_char(pf, text[idx], enc); } } uncrustify-0.59/src/output.cpp0000644000175000017500000014020611630510366013442 00000000000000/** * @file output.cpp * Does all the output & comment formatting. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "prototypes.h" #include "chunk_list.h" #include "unc_ctype.h" #include static void output_comment_multi(chunk_t *pc); static void output_comment_multi_simple(chunk_t *pc); struct cmt_reflow { chunk_t *pc; int column; /* Column of the comment start */ int brace_col; /* Brace column (for indenting with tabs) */ int base_col; /* Base column (for indenting with tabs) */ int word_count; /* number of words on this line */ bool kw_subst; /* do keyword substitution */ int xtra_indent; /* extra indent of non-first lines (0 or 1) */ unc_text cont_text; /* fixed text to output at the start of a line (0 to 3 chars) */ bool reflow; /* reflow the current line */ }; static chunk_t *output_comment_c(chunk_t *pc); static chunk_t *output_comment_cpp(chunk_t *pc); static void add_comment_text(const unc_text& text, cmt_reflow& cmt, bool esc_close); /** * All output text is sent here, one char at a time. */ static void add_char(UINT32 ch) { static int last_char = 0; /* If we did a '\r' and it isn't followed by a '\n', then output a newline */ if ((last_char == '\r') && (ch != '\n')) { write_string(cpd.fout, cpd.newline.get(), cpd.enc); cpd.column = 1; cpd.did_newline = 1; cpd.spaces = 0; } /* convert a newline into the LF/CRLF/CR sequence */ if (ch == '\n') { write_string(cpd.fout, cpd.newline.get(), cpd.enc); cpd.column = 1; cpd.did_newline = 1; cpd.spaces = 0; } else if (ch == '\r') { /* do not output '\r' */ cpd.column = 1; cpd.did_newline = 1; cpd.spaces = 0; } else { /* Explicitly disallow a tab after a space */ if ((ch == '\t') && (last_char == ' ')) { int endcol = next_tab_column(cpd.column); while (cpd.column < endcol) { add_char(' '); } return; } else if (ch == ' ') { cpd.spaces++; cpd.column++; } else { while (cpd.spaces > 0) { write_char(cpd.fout, ' ', cpd.enc); cpd.spaces--; } write_char(cpd.fout, ch, cpd.enc); if (ch == '\t') { cpd.column = next_tab_column(cpd.column); } else { cpd.column++; } } } last_char = ch; } static void add_text(const char *ascii_text) { char ch; while ((ch = *ascii_text) != 0) { ascii_text++; add_char(ch); } } static void add_text(const unc_text& text) { for (int idx = 0; idx < text.size(); idx++) { add_char(text[idx]); } } /** * Count the number of characters to the end of the next chunk of text. * If it exceeds the limit, return true. */ static bool next_word_exceeds_limit(const unc_text& text, int idx) { int length = 0; /* Count any whitespace */ while ((idx < text.size()) && unc_isspace(text[idx])) { idx++; length++; } /* Count non-whitespace */ while ((idx < text.size()) && !unc_isspace(text[idx])) { idx++; length++; } return((cpd.column + length - 1) > cpd.settings[UO_cmt_width].n); } /** * Advance to a specific column * cpd.column is the current column * * @param column The column to advance to */ static void output_to_column(int column, bool allow_tabs) { int nc; cpd.did_newline = 0; if (allow_tabs) { /* tab out as far as possible and then use spaces */ while ((nc = next_tab_column(cpd.column)) <= column) { add_text("\t"); } } /* space out the final bit */ while (cpd.column < column) { add_text(" "); } } /** * Output a comment to the column using indent_with_tabs and * indent_cmt_with_tabs as the rules. * base_col is the indent of the first line of the comment. * On the first line, column == base_col. * On subsequnet lines, column >= base_col. * * @param brace_col the brace-level indent of the comment * @param base_col the indent of the start of the comment (multiline) * @param column the column that we should end up in */ static void cmt_output_indent(int brace_col, int base_col, int column) { int iwt; int tab_col; iwt = cpd.settings[UO_indent_cmt_with_tabs].b ? 2 : (cpd.settings[UO_indent_with_tabs].n ? 1 : 0); tab_col = (iwt == 0) ? 0 : ((iwt == 1) ? brace_col : base_col); //LOG_FMT(LSYS, "%s(brace=%d base=%d col=%d iwt=%d) tab=%d cur=%d\n", // __func__, brace_col, base_col, column, iwt, tab_col, cpd.column); cpd.did_newline = 0; if ((iwt == 2) || ((cpd.column == 1) && (iwt == 1))) { /* tab out as far as possible and then use spaces */ while (next_tab_column(cpd.column) <= tab_col) { add_text("\t"); } } /* space out the rest */ while (cpd.column < column) { add_text(" "); } } void output_parsed(FILE *pfile) { chunk_t *pc; int cnt; output_options(pfile); output_defines(pfile); output_types(pfile); fprintf(pfile, "-=====-\n"); fprintf(pfile, "Line Tag Parent Columns Br/Lvl/pp Flag Nl Text"); for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { fprintf(pfile, "\n%3d> %13.13s[%13.13s][%2d/%2d/%2d][%d/%d/%d][%10" PRIx64 "][%d-%d]", pc->orig_line, get_token_name(pc->type), get_token_name(pc->parent_type), pc->column, pc->orig_col, pc->orig_col_end, pc->brace_level, pc->level, pc->pp_level, pc->flags, pc->nl_count, pc->after_tab); if ((pc->type != CT_NEWLINE) && (pc->len() != 0)) { for (cnt = 0; cnt < pc->column; cnt++) { fprintf(pfile, " "); } if (pc->type != CT_NL_CONT) { fprintf(pfile, "%s", pc->str.c_str()); } else { fprintf(pfile, "\\"); } } } fprintf(pfile, "\n-=====-\n"); fflush(pfile); } void output_options(FILE *pfile) { int idx; const option_map_value *ptr; fprintf(pfile, "-== Options ==-\n"); for (idx = 0; idx < UO_option_count; idx++) { ptr = get_option_name(idx); if (ptr != NULL) { if (ptr->type == AT_STRING) { fprintf(pfile, "%3d) %32s = \"%s\"\n", ptr->id, ptr->name, op_val_to_string(ptr->type, cpd.settings[ptr->id]).c_str()); } else { fprintf(pfile, "%3d) %32s = %s\n", ptr->id, ptr->name, op_val_to_string(ptr->type, cpd.settings[ptr->id]).c_str()); } } } } /** * This renders the chunk list to a file. */ void output_text(FILE *pfile) { chunk_t *pc; chunk_t *prev; int cnt; int lvlcol; bool allow_tabs; cpd.fout = pfile; cpd.did_newline = 1; cpd.column = 1; if (cpd.bom) { write_bom(pfile, cpd.enc); } if (cpd.frag_cols > 0) { int indent = cpd.frag_cols - 1; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { pc->column += indent; pc->column_indent += indent; } cpd.frag_cols = 0; } for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type == CT_NEWLINE) { for (cnt = 0; cnt < pc->nl_count; cnt++) { add_char('\n'); } cpd.did_newline = 1; cpd.column = 1; LOG_FMT(LOUTIND, " xx\n"); } else if (pc->type == CT_NL_CONT) { /* FIXME: this really shouldn't be done here! */ if ((pc->flags & PCF_WAS_ALIGNED) == 0) { if (cpd.settings[UO_sp_before_nl_cont].a & AV_REMOVE) { pc->column = cpd.column + (cpd.settings[UO_sp_before_nl_cont].a == AV_FORCE); } else { /* Try to keep the same relative spacing */ prev = chunk_get_prev(pc); while ((prev != NULL) && (prev->orig_col == 0) && (prev->nl_count == 0)) { prev = chunk_get_prev(prev); } if ((prev != NULL) && (prev->nl_count == 0)) { int orig_sp = (pc->orig_col - prev->orig_col_end); pc->column = cpd.column + orig_sp; if ((cpd.settings[UO_sp_before_nl_cont].a != AV_IGNORE) && (pc->column < (cpd.column + 1))) { pc->column = cpd.column + 1; } } } } output_to_column(pc->column, (cpd.settings[UO_indent_with_tabs].n == 2)); add_char('\\'); add_char('\n'); cpd.did_newline = 1; cpd.column = 1; LOG_FMT(LOUTIND, " \\xx\n"); } else if (pc->type == CT_COMMENT_MULTI) { if (cpd.settings[UO_cmt_indent_multi].b) { output_comment_multi(pc); } else { output_comment_multi_simple(pc); } } else if (pc->type == CT_COMMENT_CPP) { pc = output_comment_cpp(pc); } else if (pc->type == CT_COMMENT) { pc = output_comment_c(pc); } else if ((pc->type == CT_JUNK) || (pc->type == CT_IGNORED)) { /* do not adjust the column for junk */ add_text(pc->str); } else if (pc->len() == 0) { /* don't do anything for non-visible stuff */ LOG_FMT(LOUTIND, " <%d> -", pc->column); } else { /* indent to the 'level' first */ if (cpd.did_newline) { if (cpd.settings[UO_indent_with_tabs].n == 1) { /* FIXME: it would be better to properly set column_indent in * indent_text(), but this hack for '}' and ':' seems to work. */ if ((pc->type == CT_BRACE_CLOSE) || chunk_is_str(pc, ":", 1) || (pc->type == CT_PREPROC)) { lvlcol = pc->column; } else { lvlcol = pc->column_indent; if (lvlcol > pc->column) { lvlcol = pc->column; } } if (lvlcol > 1) { output_to_column(lvlcol, true); } } allow_tabs = (cpd.settings[UO_indent_with_tabs].n == 2) || (chunk_is_comment(pc) && (cpd.settings[UO_indent_with_tabs].n != 0)); LOG_FMT(LOUTIND, " %d> col %d/%d - ", pc->orig_line, pc->column, cpd.column); } else { /** * Reformatting multi-line comments can screw up the column. * Make sure we don't mess up the spacing on this line. * This has to be done here because comments are not formatted * until the output phase. */ if (pc->column < cpd.column) { reindent_line(pc, cpd.column); } /* not the first item on a line */ prev = chunk_get_prev(pc); allow_tabs = (cpd.settings[UO_align_with_tabs].b && ((pc->flags & PCF_WAS_ALIGNED) != 0) && ((prev->column + prev->len() + 1) != pc->column)); if (cpd.settings[UO_align_keep_tabs].b) { allow_tabs |= pc->after_tab; } LOG_FMT(LOUTIND, " %d(%d) -", pc->column, allow_tabs); } output_to_column(pc->column, allow_tabs); add_text(pc->str); cpd.did_newline = chunk_is_newline(pc); } } } /** * Checks for and updates the lead chars. * * @param line the comment line * @return 0=not present, >0=number of chars that are part of the lead */ static int cmt_parse_lead(const unc_text& line, int is_last) { int len = 0; while ((len < 32) && (len < line.size())) { if ((len > 0) && (line[len] == '/')) { /* ignore combined comments */ int tmp = len + 1; while ((tmp < line.size()) && unc_isspace(line[tmp])) { tmp++; } if ((tmp < line.size()) && (line[tmp] == '/')) { return 1; } break; } else if (strchr("*|\\#+", line[len]) == NULL) { break; } len++; } if (len > 30) { return 1; } if ((len > 0) && ((len >= line.size()) || unc_isspace(line[len]))) { return len; } if (is_last && (len > 0)) { return len; } return 0; } /** * Scans a multiline comment to determine the following: * - the extra indent of the non-first line (0 or 1) * - the continuation text ('' or '* ') * * The decision is based on: * - cmt_indent_multi * - cmt_star_cont * - the first line length * - the second line leader length * - the last line length * * If the first and last line are the same length and don't contain any alnum * chars and (the first line len > 2 or the second leader is the same as the * first line length), then the indent is 0. * * If the leader on the second line is 1 wide or missing, then the indent is 1. * * Otherwise, the indent is 0. * * @param str The comment string * @param len Length of the comment * @param start_col Starting column * @return 0 or 1 */ static void calculate_comment_body_indent(cmt_reflow &cmt, const unc_text& str) { int idx = 0; int first_len = 0; int last_len = 0; int width = 0; int len = str.size(); cmt.xtra_indent = 0; if (!cpd.settings[UO_cmt_indent_multi].b) { return; } if (cpd.settings[UO_cmt_multi_check_last].b) { /* find the last line length */ for (idx = len - 1; idx > 0; idx--) { if ((str[idx] == '\n') || (str[idx] == '\r')) { idx++; while ((idx < len) && ((str[idx] == ' ') || (str[idx] == '\t'))) { idx++; } last_len = len - idx; break; } } } /* find the first line length */ for (idx = 0; idx < len; idx++) { if ((str[idx] == '\n') || (str[idx] == '\r')) { first_len = idx; while ((str[first_len - 1] == ' ') || (str[first_len - 1] == '\t')) { first_len--; } /* handle DOS endings */ if ((str[idx] == '\r') && (str[idx + 1] == '\n')) { idx++; } idx++; break; } } /* Scan the second line */ width = 0; for (/* nada */; idx < len - 1; idx++) { if ((str[idx] == ' ') || (str[idx] == '\t')) { if (width > 0) { break; } continue; } if ((str[idx] == '\n') || (str[idx] == '\r')) { /* Done with second line */ break; } /* Count the leading chars */ if ((str[idx] == '*') || (str[idx] == '|') || (str[idx] == '\\') || (str[idx] == '#') || (str[idx] == '+')) { width++; } else { width = 0; break; } } //LOG_FMT(LSYS, "%s: first=%d last=%d width=%d\n", __func__, first_len, last_len, width); /*TODO: make the first_len minimum (4) configurable? */ if ((first_len == last_len) && ((first_len > 4) || (first_len == width))) { return; } cmt.xtra_indent = ((width == 2) ? 0 : 1); } static chunk_t *get_next_function(chunk_t *pc) { while ((pc = chunk_get_next(pc)) != NULL) { if ((pc->type == CT_FUNC_DEF) || (pc->type == CT_OC_MSG_DECL) || (pc->type == CT_FUNC_PROTO)) { return(pc); } } return(NULL); } static chunk_t *get_next_class(chunk_t *pc) { while ((pc = chunk_get_next(pc)) != NULL) { if (pc->type == CT_CLASS) { return(chunk_get_next(pc)); } } return(NULL); } /** * Adds the javadoc-style @param and @return stuff, based on the params and * return value for pc. * If the arg list is '()' or '(void)', then no @params are added. * Likewise, if the return value is 'void', then no @return is added. */ static void add_comment_javaparam(chunk_t *pc, cmt_reflow& cmt) { chunk_t *fpo; chunk_t *fpc; chunk_t *tmp; chunk_t *prev; bool has_param = true; bool need_nl = false; fpo = chunk_get_next_type(pc, CT_FPAREN_OPEN, pc->level); if (fpo == NULL) { return; } fpc = chunk_get_next_type(fpo, CT_FPAREN_CLOSE, pc->level); if (fpc == NULL) { return; } /* Check for 'foo()' and 'foo(void)' */ if (chunk_get_next_ncnl(fpo) == fpc) { has_param = false; } else { tmp = chunk_get_next_ncnl(fpo); if ((tmp == chunk_get_prev_ncnl(fpc)) && chunk_is_str(tmp, "void", 4)) { has_param = false; } } if (has_param) { tmp = fpo; prev = NULL; while ((tmp = chunk_get_next(tmp)) != NULL) { if ((tmp->type == CT_COMMA) || (tmp == fpc)) { if (need_nl) { add_comment_text("\n ", cmt, false); } need_nl = true; add_text("@param"); if (prev != NULL) { add_text(" "); add_text(prev->str); add_text(" TODO"); } prev = NULL; if (tmp == fpc) { break; } } if (tmp->type == CT_WORD) { prev = tmp; } } } /* Do the return stuff */ tmp = chunk_get_prev_ncnl(pc); if ((tmp != NULL) && !chunk_is_str(tmp, "void", 4)) { if (need_nl) { add_comment_text("\n ", cmt, false); } add_text("@return TODO"); } } /** * text starts with '$('. see if this matches a keyword and add text based * on that keyword. * @return the number of characters eaten from the text */ static int add_comment_kw(const unc_text& text, int idx, cmt_reflow& cmt) { if (text.startswith("$(filename)", idx)) { add_text(path_basename(cpd.filename)); return(11); } if (text.startswith("$(class)", idx)) { chunk_t *tmp = get_next_class(cmt.pc); if (tmp != NULL) { add_text(tmp->str); return(8); } } /* If we can't find the function, we are done */ chunk_t *fcn = get_next_function(cmt.pc); if (fcn == NULL) { return(0); } if (text.startswith("$(message)", idx)) { add_text(fcn->str); chunk_t *tmp = chunk_get_next_ncnl(fcn); chunk_t *word = NULL; while (tmp) { if ((tmp->type == CT_BRACE_OPEN) || (tmp->type == CT_SEMICOLON)) { break; } if (tmp->type == CT_OC_COLON) { if (word != NULL) { add_text(word->str); word = NULL; } add_text(":"); } if (tmp->type == CT_WORD) { word = tmp; } tmp = chunk_get_next_ncnl(tmp); } return(10); } if (text.startswith("$(function)", idx)) { if (fcn->parent_type == CT_OPERATOR) { add_text("operator "); } add_text(fcn->str); return(11); } if (text.startswith("$(javaparam)", idx)) { add_comment_javaparam(fcn, cmt); return(12); } if (text.startswith("$(fclass)", idx)) { chunk_t *tmp = chunk_get_prev_ncnl(fcn); if ((tmp != NULL) && (tmp->type == CT_OPERATOR)) { tmp = chunk_get_prev_ncnl(tmp); } if ((tmp != NULL) && ((tmp->type == CT_DC_MEMBER) || (tmp->type == CT_MEMBER))) { tmp = chunk_get_prev_ncnl(tmp); add_text(tmp->str); return(9); } } return(0); } static int next_up(const unc_text& text, int idx, unc_text& tag) { int offs = 0; while ((idx < text.size()) && unc_isspace(text[idx])) { idx++; offs++; } if (text.startswith(tag, idx)) { return(offs); } return(-1); } /** * Outputs a comment. The initial opening '//' may be included in the text. * Subsequent openings (if combining comments), should not be included. * The closing (for C/D comments) should not be included. * * TODO: * If reflowing text, the comment should be added one word (or line) at a time. * A newline should only be sent if a blank line is encountered or if the next * line is indented beyond the current line (optional?). * If the last char on a line is a ':' or '.', then the next line won't be * combined. */ static void add_comment_text(const unc_text& text, cmt_reflow& cmt, bool esc_close) { bool was_star = false; bool was_slash = false; bool was_dollar = false; bool in_word = false; int tmp; int len = text.size(); for (int idx = 0; idx < len; idx++) { if (!was_dollar && cmt.kw_subst && (text[idx] == '$') && (len > (idx + 3)) && (text[idx + 1] == '(')) { idx += add_comment_kw(text, idx, cmt); if (idx >= len) { break; } } /* Split the comment */ if (text[idx] == '\n') { in_word = false; add_char('\n'); cmt_output_indent(cmt.brace_col, cmt.base_col, cmt.column); if (cmt.xtra_indent) { add_char(' '); } /* hack to get escaped newlines to align and not dup the leading '//' */ tmp = next_up(text, idx + 1, cmt.cont_text); if (tmp < 0) { add_text(cmt.cont_text); } else { idx += tmp; } } else if (cmt.reflow && (text[idx] == ' ') && (cpd.settings[UO_cmt_width].n > 0) && ((cpd.column > cpd.settings[UO_cmt_width].n) || next_word_exceeds_limit(text, idx))) { in_word = false; add_char('\n'); cmt_output_indent(cmt.brace_col, cmt.base_col, cmt.column); if (cmt.xtra_indent) { add_char(' '); } add_text(cmt.cont_text); } else { /* Escape a C closure in a CPP comment */ if (esc_close && ((was_star && (text[idx] == '/')) || (was_slash && (text[idx] == '*')))) { add_char(' '); } if (!in_word && !unc_isspace(text[idx])) { cmt.word_count++; } in_word = !unc_isspace(text[idx]); add_char(text[idx]); was_star = (text[idx] == '*'); was_slash = (text[idx] == '/'); was_dollar = (text[idx] == '$'); } } } static void output_cmt_start(cmt_reflow& cmt, chunk_t *pc) { cmt.pc = pc; cmt.column = pc->column; cmt.brace_col = pc->column_indent; cmt.base_col = pc->column_indent; cmt.word_count = 0; cmt.kw_subst = false; cmt.xtra_indent = 0; cmt.cont_text.clear(); cmt.reflow = false; if (cmt.brace_col == 0) { cmt.brace_col = 1 + (pc->brace_level * cpd.settings[UO_output_tab_size].n); } //LOG_FMT(LSYS, "%s: line %d, brace=%d base=%d col=%d orig=%d aligned=%x\n", // __func__, pc->orig_line, cmt.brace_col, cmt.base_col, cmt.column, pc->orig_col, // pc->flags & (PCF_WAS_ALIGNED | PCF_RIGHT_COMMENT)); if ((pc->parent_type == CT_COMMENT_START) || (pc->parent_type == CT_COMMENT_WHOLE)) { if (!cpd.settings[UO_indent_col1_comment].b && (pc->orig_col == 1) && !(pc->flags & PCF_INSERTED)) { cmt.column = 1; cmt.base_col = 1; cmt.brace_col = 1; } } else if (pc->parent_type == CT_COMMENT_END) { /* Make sure we have at least one space past the last token */ chunk_t *prev = chunk_get_prev(pc); if (prev != NULL) { int col_min = prev->column + prev->len() + 1; if (cmt.column < col_min) { cmt.column = col_min; } } } /* tab aligning code */ if (cpd.settings[UO_indent_cmt_with_tabs].b && ((pc->parent_type == CT_COMMENT_END) || (pc->parent_type == CT_COMMENT_WHOLE))) { cmt.column = align_tab_column(cmt.column - 1); //LOG_FMT(LSYS, "%s: line %d, orig:%d new:%d\n", // __func__, pc->orig_line, pc->column, cmt.column); pc->column = cmt.column; } cmt.base_col = cmt.column; //LOG_FMT(LSYS, "%s: -- brace=%d base=%d col=%d\n", // __func__, cmt.brace_col, cmt.base_col, cmt.column); /* Bump out to the column */ cmt_output_indent(cmt.brace_col, cmt.base_col, cmt.column); cmt.kw_subst = (pc->flags & PCF_INSERTED) != 0; } /** * Checks to see if the current comment can be combined with the next comment. * The two can be combined if: * 1. They are the same type * 2. There is exactly one newline between then * 3. They are indented to the same level */ static bool can_combine_comment(chunk_t *pc, cmt_reflow& cmt) { /* We can't combine if there is something other than a newline next */ if (pc->parent_type == CT_COMMENT_START) { return(false); } /* next is a newline for sure, make sure it is a single newline */ chunk_t *next = chunk_get_next(pc); if ((next != NULL) && (next->nl_count == 1)) { /* Make sure the comment is the same type at the same column */ next = chunk_get_next(next); if ((next != NULL) && (next->type == pc->type) && (((next->column == 1) && (pc->column == 1)) || ((next->column == cmt.base_col) && (pc->column == cmt.base_col)) || ((next->column > cmt.base_col) && (pc->parent_type == CT_COMMENT_END)))) { return(true); } } return(false); } /** * Outputs the C comment at pc. * C comment combining is done here * * @return the last chunk output'd */ static chunk_t *output_comment_c(chunk_t *first) { cmt_reflow cmt; output_cmt_start(cmt, first); cmt.reflow = (cpd.settings[UO_cmt_reflow_mode].n != 1); cmt.cont_text = cpd.settings[UO_cmt_star_cont].b ? " *" : " "; /* See if we can combine this comment with the next comment */ if (!cpd.settings[UO_cmt_c_group].b || !can_combine_comment(first, cmt)) { /* Just add the single comment */ add_comment_text(first->str, cmt, false); return(first); } add_text("/*"); if (cpd.settings[UO_cmt_c_nl_start].b) { add_comment_text("\n", cmt, false); } chunk_t *pc = first; unc_text tmp; while (can_combine_comment(pc, cmt)) { tmp.set(pc->str, 2, pc->len() - 4); add_comment_text(tmp, cmt, false); add_comment_text("\n", cmt, false); pc = chunk_get_next(chunk_get_next(pc)); } tmp.set(pc->str, 2, pc->len() - 4); add_comment_text(tmp, cmt, false); if (cpd.settings[UO_cmt_c_nl_end].b) { cmt.cont_text = " "; add_comment_text("\n", cmt, false); } add_comment_text("*/", cmt, false); return(pc); } /** * Outputs the CPP comment at pc. * CPP comment combining is done here * * @return the last chunk output'd */ static chunk_t *output_comment_cpp(chunk_t *first) { cmt_reflow cmt; unc_text tmp; output_cmt_start(cmt, first); cmt.reflow = (cpd.settings[UO_cmt_reflow_mode].n != 1); /* CPP comments can't be grouped unless they are converted to C comments */ if (!cpd.settings[UO_cmt_cpp_to_c].b) { cmt.cont_text = (cpd.settings[UO_sp_cmt_cpp_start].a & AV_REMOVE) ? "//" : "// "; if (cpd.settings[UO_sp_cmt_cpp_start].a == AV_IGNORE) { add_comment_text(first->str, cmt, false); } else { unc_text tmp(first->str, 0, 2); add_comment_text(tmp, cmt, false); tmp.set(first->str, 2, first->len() - 2); if (cpd.settings[UO_sp_cmt_cpp_start].a & AV_REMOVE) { while ((tmp.size() > 0) && unc_isspace(tmp[0])) { tmp.pop_front(); } } if (tmp.size() > 0) { if (cpd.settings[UO_sp_cmt_cpp_start].a & AV_ADD) { if (!unc_isspace(tmp[0])) { add_comment_text(" ", cmt, false); } } add_comment_text(tmp, cmt, false); } } return(first); } /* We are going to convert the CPP comments to C comments */ cmt.cont_text = cpd.settings[UO_cmt_star_cont].b ? " * " : " "; /* See if we can combine this comment with the next comment */ if (!cpd.settings[UO_cmt_cpp_group].b || !can_combine_comment(first, cmt)) { /* nothing to group: just output a single line */ add_text("/*"); if (!unc_isspace(first->str[2])) { add_char(' '); } tmp.set(first->str, 2, first->len() - 2); add_comment_text(tmp, cmt, true); add_text(" */"); return(first); } add_text("/*"); if (cpd.settings[UO_cmt_cpp_nl_start].b) { add_comment_text("\n", cmt, false); } else { add_text(" "); } chunk_t *pc = first; int offs; while (can_combine_comment(pc, cmt)) { offs = unc_isspace(pc->str[2]) ? 1 : 0; tmp.set(pc->str, 2 + offs, pc->len() - (2 + offs)); add_comment_text(tmp, cmt, true); add_comment_text("\n", cmt, false); pc = chunk_get_next(chunk_get_next(pc)); } offs = unc_isspace(pc->str[2]) ? 1 : 0; tmp.set(pc->str, 2 + offs, pc->len() - (2 + offs)); add_comment_text(tmp, cmt, true); if (cpd.settings[UO_cmt_cpp_nl_end].b) { cmt.cont_text = ""; add_comment_text("\n", cmt, false); } add_comment_text(" */", cmt, false); return(pc); } static void cmt_trim_whitespace(unc_text& line, bool in_preproc) { /* Remove trailing whitespace on the line */ while ((line.size() > 0) && ((line.back() == ' ') || (line.back() == '\t'))) { line.pop_back(); } /* If in a preproc, shift any bs-nl back to the comment text */ if (in_preproc && (line.size() > 1) && (line.back() == '\\')) { bool do_space = false; /* If there was any space before the backslash, change it to 1 space */ line.pop_back(); while ((line.size() > 0) && ((line.back() == ' ') || (line.back() == '\t'))) { do_space = true; line.pop_back(); } if (do_space) { line.append(' '); } line.append('\\'); } } /** * A multiline comment -- woopeee! * The only trick here is that we have to trim out whitespace characters * to get the comment to line up. */ static void output_comment_multi(chunk_t *pc) { int cmt_col; int cmt_idx; int ch; chunk_t *prev; unc_text line; int line_count = 0; int ccol; /* the col of subsequent comment lines */ int col_diff = 0; bool nl_end = false; cmt_reflow cmt; //LOG_FMT(LSYS, "%s: line %d\n", __func__, pc->orig_line); prev = chunk_get_prev(pc); output_cmt_start(cmt, pc); cmt.reflow = (cpd.settings[UO_cmt_reflow_mode].n != 1); cmt_col = cmt.base_col; col_diff = pc->orig_col - cmt.base_col; calculate_comment_body_indent(cmt, pc->str); cmt.cont_text = !cpd.settings[UO_cmt_indent_multi].b ? "" : (cpd.settings[UO_cmt_star_cont].b ? "* " : " "); //LOG_FMT(LSYS, "Indenting1 line %d to col %d (orig=%d) col_diff=%d xtra=%d cont='%s'\n", // pc->orig_line, cmt_col, pc->orig_col, col_diff, cmt.xtra_indent, cmt.cont_text.c_str()); ccol = pc->column; cmt_idx = 0; line.clear(); while (cmt_idx < pc->len()) { ch = pc->str[cmt_idx++]; /* handle the CRLF and CR endings. convert both to LF */ if (ch == '\r') { ch = '\n'; if ((cmt_idx < pc->len()) && (pc->str[cmt_idx] == '\n')) { cmt_idx++; } } /* Find the start column */ if (line.size() == 0) { nl_end = false; if (ch == ' ') { ccol++; continue; } else if (ch == '\t') { ccol = calc_next_tab_column(ccol, cpd.settings[UO_input_tab_size].n); continue; } else { //LOG_FMT(LSYS, "%d] Text starts in col %d\n", line_count, ccol); } } /* * Now see if we need/must fold the next line with the current to enable * full reflow */ if ((cpd.settings[UO_cmt_reflow_mode].n == 2) && (ch == '\n') && (cmt_idx < pc->len())) { int nxt_len = 0; int next_nonempty_line = -1; int prev_nonempty_line = -1; int nwidx = line.size(); bool star_is_bullet = false; /* strip trailing whitespace from the line collected so far */ while (nwidx > 0) { nwidx--; if ((prev_nonempty_line < 0) && !unc_isspace(line[nwidx]) && (line[nwidx] != '*') && // block comment: skip '*' at end of line ((pc->flags & PCF_IN_PREPROC) ? (line[nwidx] != '\\') || ((line[nwidx + 1] != 'r') && (line[nwidx + 1] != '\n')) : true)) { prev_nonempty_line = nwidx; // last nonwhitespace char in the previous line } } int remaining = pc->len() - cmt_idx; for (nxt_len = 0; (nxt_len <= remaining) && (pc->str[nxt_len] != 'r') && (pc->str[nxt_len] != '\n'); nxt_len++) { if ((next_nonempty_line < 0) && !unc_isspace(pc->str[nxt_len]) && (pc->str[nxt_len] != '*') && ((nxt_len == remaining) || ((pc->flags & PCF_IN_PREPROC) ? (pc->str[nxt_len] != '\\') || ((pc->str[nxt_len + 1] != 'r') && (pc->str[nxt_len + 1] != '\n')) : true))) { next_nonempty_line = nxt_len; // first nonwhitespace char in the next line } } /* * see if we should fold up; usually that'd be a YES, but there are a few * situations where folding/reflowing by merging lines is frowned upon: * * - ASCII art in the comments (most often, these are drawings done in +-\/|.,*) * * - Doxygen/JavaDoc/etc. parameters: these often start with \ or @, at least * something clearly non-alphanumeric (you see where we're going with this?) * * - bullet lists that are closely spaced: bullets are always non-alphanumeric * characters, such as '-' or '+' (or, oh horor, '*' - that's bloody ambiguous * to parse :-( ... with or without '*' comment start prefix, that's the * question, then.) * * - semi-HTML formatted code, e.g.
...
comment sections (NDoc, etc.) * * - New lines which form a new paragraph without there having been added an * extra empty line between the last sentence and the new one. * A bit like this, really; so it is opportune to check if the last line ended * in a terminal (that would be the set '.:;!?') and the new line starts with * a capital. * Though new lines starting with comment delimiters, such as '(', should be * pulled up. * * So it bores down to this: the only folding (& reflowing) that's going to happen * is when the next line starts with an alphanumeric character AND the last * line didn't end with an non-alphanumeric character, except: ',' AND the next * line didn't start with a '*' all of a sudden while the previous one didn't * (the ambiguous '*'-for-bullet case!) */ if ((prev_nonempty_line >= 0) && (next_nonempty_line >= 0) && (((unc_isalnum(line[prev_nonempty_line]) || strchr(",)]", line[prev_nonempty_line])) && (unc_isalnum(pc->str[next_nonempty_line]) || strchr("([", pc->str[next_nonempty_line]))) || (('.' == line[prev_nonempty_line]) && // dot followed by non-capital is NOT a new sentence start unc_isupper(pc->str[next_nonempty_line]))) && !star_is_bullet) { // rewind the line to the last non-alpha: line.resize(prev_nonempty_line + 1); // roll the current line forward to the first non-alpha: cmt_idx += next_nonempty_line; // override the NL and make it a single whitespace: ch = ' '; } } line.append(ch); /* If we just hit an end of line OR we just hit end-of-comment... */ if ((ch == '\n') || (cmt_idx == pc->len())) { line_count++; /* strip trailing tabs and spaces before the newline */ if (ch == '\n') { nl_end = true; line.pop_back(); cmt_trim_whitespace(line, pc->flags & PCF_IN_PREPROC); } //LOG_FMT(LSYS, "[%3d]%s\n", ccol, line); if (line_count == 1) { /* this is the first line - add unchanged */ add_comment_text(line, cmt, false); if (nl_end) { add_char('\n'); } } else { /* This is not the first line, so we need to indent to the * correct column. Each line is indented 0 or more spaces. */ ccol -= col_diff; if (ccol < (cmt_col + 3)) { ccol = cmt_col + 3; } if (line.size() == 0) { /* Empty line - just a '\n' */ if (cpd.settings[UO_cmt_star_cont].b) { cmt.column = cmt_col + cpd.settings[UO_cmt_sp_before_star_cont].n; cmt_output_indent(cmt.brace_col, cmt.base_col, cmt.column); if (cmt.xtra_indent) { add_char(' '); } add_text(cmt.cont_text); } add_char('\n'); } else { /* If this doesn't start with a '*' or '|'. * '\name' is a common parameter documentation thing. */ if (cpd.settings[UO_cmt_indent_multi].b && (line[0] != '*') && (line[0] != '|') && (line[0] != '#') && ((line[0] != '\\') || unc_isalpha(line[1])) && (line[0] != '+')) { int start_col = cmt_col + cpd.settings[UO_cmt_sp_before_star_cont].n; if (cpd.settings[UO_cmt_star_cont].b) { cmt.column = start_col; cmt_output_indent(cmt.brace_col, cmt.base_col, cmt.column); if (cmt.xtra_indent) { add_char(' '); } add_text(cmt.cont_text); output_to_column(ccol + cpd.settings[UO_cmt_sp_after_star_cont].n, false); } else { cmt.column = ccol; cmt_output_indent(cmt.brace_col, cmt.base_col, cmt.column); } } else { cmt.column = cmt_col + cpd.settings[UO_cmt_sp_before_star_cont].n; cmt_output_indent(cmt.brace_col, cmt.base_col, cmt.column); if (cmt.xtra_indent) { add_char(' '); } int idx; idx = cmt_parse_lead(line, (cmt_idx == pc->len())); if (idx > 0) { cmt.cont_text.set(line, 0, idx); } else { add_text(cmt.cont_text); } } add_comment_text(line, cmt, false); if (nl_end) { add_text("\n"); } } } line.clear(); ccol = 1; } } } /** * Output a multiline comment without any reformatting other than shifting * it left or right to get the column right. * Oh, and trim trailing whitespace. */ static void output_comment_multi_simple(chunk_t *pc) { int cmt_col = pc->column; int cmt_idx; char ch; int line_count = 0; int ccol; int col_diff = 0; bool nl_end = false; cmt_reflow cmt; unc_text line; output_cmt_start(cmt, pc); if (chunk_is_newline(chunk_get_prev(pc))) { /* The comment should be indented correctly */ cmt_col = pc->column; col_diff = pc->orig_col - pc->column; } else { /* The comment starts after something else */ cmt_col = pc->orig_col; col_diff = 0; } ccol = pc->column; cmt_idx = 0; line.clear(); while (cmt_idx < pc->len()) { ch = pc->str[cmt_idx++]; /* handle the CRLF and CR endings. convert both to LF */ if (ch == '\r') { ch = '\n'; if ((cmt_idx < pc->len()) && (pc->str[cmt_idx] == '\n')) { cmt_idx++; } } /* Find the start column */ if (line.size() == 0) { nl_end = false; if (ch == ' ') { ccol++; continue; } else if (ch == '\t') { ccol = calc_next_tab_column(ccol, cpd.settings[UO_input_tab_size].n); continue; } else { //LOG_FMT(LSYS, "%d] Text starts in col %d, col_diff=%d, real=%d\n", // line_count, ccol, col_diff, ccol - col_diff); } } line.append(ch); /* If we just hit an end of line OR we just hit end-of-comment... */ if ((ch == '\n') || (cmt_idx == pc->len())) { line_count++; /* strip trailing tabs and spaces before the newline */ if (ch == '\n') { line.pop_back(); nl_end = true; /* Say we aren't in a preproc to prevent changing any bs-nl */ cmt_trim_whitespace(line, false); } if (line_count > 1) { ccol -= col_diff; } if (line.size() > 0) { cmt.column = ccol; cmt_output_indent(cmt.brace_col, cmt.base_col, cmt.column); add_text(line); } if (nl_end) { add_char('\n'); } line.clear(); ccol = 1; } } } /** * This renders the #if condition to a string buffer. */ static void generate_if_conditional_as_text(unc_text& dst, chunk_t *ifdef) { chunk_t *pc; int column = -1; dst.clear(); for (pc = ifdef; pc != NULL; pc = chunk_get_next(pc)) { if (column == -1) { column = pc->column; } if ((pc->type == CT_NEWLINE) || (pc->type == CT_COMMENT_MULTI) || (pc->type == CT_COMMENT_CPP)) { break; } else if (pc->type == CT_NL_CONT) { dst += ' '; column = -1; } else if ((pc->type == CT_COMMENT) || (pc->type == CT_COMMENT_EMBED)) { } else // if (pc->type == CT_JUNK) || else { int spacing; for (spacing = pc->column - column; spacing > 0; spacing--) { dst += ' '; column++; } dst.append(pc->str); column += pc->len(); } } } /* * See also it's preprocessor counterpart * add_long_closebrace_comment * in braces.cpp * * Note: since this concerns itself with the preprocessor -- which is line-oriented -- * it turns out that just looking at pc->pp_level is NOT the right thing to do. * See a --parsed dump if you don't believe this: an '#endif' will be one level * UP from the corresponding #ifdef when you look at the tokens 'ifdef' versus 'endif', * but it's a whole another story when you look at their CT_PREPROC ('#') tokens! * * Hence we need to track and seek matching CT_PREPROC pp_levels here, which complicates * things a little bit, but not much. */ void add_long_preprocessor_conditional_block_comment(void) { chunk_t *pc; chunk_t *tmp; chunk_t *br_open; chunk_t *br_close; chunk_t *pp_start = NULL; chunk_t *pp_end = NULL; int nl_count; for (pc = chunk_get_head(); pc; pc = chunk_get_next_ncnl(pc)) { /* just track the preproc level: */ if (pc->type == CT_PREPROC) { pp_end = pp_start = pc; } if (pc->type != CT_PP_IF) { continue; } #if 0 if ((pc->flags & PCF_IN_PREPROC) != 0) { continue; } #endif br_open = pc; nl_count = 0; tmp = pc; while ((tmp = chunk_get_next(tmp)) != NULL) { /* just track the preproc level: */ if (tmp->type == CT_PREPROC) { pp_end = tmp; } if (chunk_is_newline(tmp)) { nl_count += tmp->nl_count; } else if ((pp_end->pp_level == pp_start->pp_level) && ((tmp->type == CT_PP_ENDIF) || (br_open->type == CT_PP_IF ? tmp->type == CT_PP_ELSE : 0))) { br_close = tmp; LOG_FMT(LPPIF, "found #if / %s section on lines %d and %d, nl_count=%d\n", (tmp->type == CT_PP_ENDIF ? "#endif" : "#else"), br_open->orig_line, br_close->orig_line, nl_count); /* Found the matching #else or #endif - make sure a newline is next */ tmp = chunk_get_next(tmp); LOG_FMT(LPPIF, "next item type %d (is %s)\n", (tmp ? tmp->type : -1), (tmp ? chunk_is_newline(tmp) ? "newline" : chunk_is_comment(tmp) ? "comment" : "other" : "---")); if ((tmp == NULL) || (tmp->type == CT_NEWLINE) /* chunk_is_newline(tmp) */) { int nl_min; if (br_close->type == CT_PP_ENDIF) { nl_min = cpd.settings[UO_mod_add_long_ifdef_endif_comment].n; } else { nl_min = cpd.settings[UO_mod_add_long_ifdef_else_comment].n; } const char *txt = !tmp ? "EOF" : ((tmp->type == CT_PP_ENDIF) ? "#endif" : "#else"); LOG_FMT(LPPIF, "#if / %s section candidate for augmenting when over NL threshold %d != 0 (nl_count=%d)\n", txt, nl_min, nl_count); if ((nl_min > 0) && (nl_count > nl_min)) /* nl_count is 1 too large at all times as #if line was counted too */ { /* determine the added comment style */ c_token_t style = (cpd.lang_flags & (LANG_CPP | LANG_CS)) ? CT_COMMENT_CPP : CT_COMMENT; unc_text str; generate_if_conditional_as_text(str, br_open); LOG_FMT(LPPIF, "#if / %s section over threshold %d (nl_count=%d) --> insert comment after the %s: %s\n", txt, nl_min, nl_count, txt, str.c_str()); /* Add a comment after the close brace */ insert_comment_after(br_close, style, str); } } /* checks both the #else and #endif for a given level, only then look further in the main loop */ if (br_close->type == CT_PP_ENDIF) { break; } } } } } uncrustify-0.59/src/uncrustify_types.h0000644000175000017500000002634111631034073015206 00000000000000/** * @file uncrustify_types.h * * Defines some types for the uncrustify program * * @author Ben Gardner * @license GPL v2+ */ #ifndef UNCRUSTIFY_TYPES_H_INCLUDED #define UNCRUSTIFY_TYPES_H_INCLUDED #include #include using namespace std; #include "base_types.h" #include "options.h" #include "token_enum.h" /* c_token_t */ #include "log_levels.h" #include "logger.h" #include "unc_text.h" #include #include #ifdef HAVE_UTIME_H #include #endif #define UNCRUSTIFY_OFF_TEXT " *INDENT-OFF*" #define UNCRUSTIFY_ON_TEXT " *INDENT-ON*" /** * Brace stage enum used in brace_cleanup */ enum brstage_e { BS_NONE, BS_PAREN1, /* if/for/switch/while */ BS_OP_PAREN1, /* optional paren: catch () { */ BS_WOD_PAREN, /* while of do parens */ BS_WOD_SEMI, /* semicolon after while of do */ BS_BRACE_DO, /* do */ BS_BRACE2, /* if/else/for/switch/while */ BS_ELSE, /* expecting 'else' after 'if' */ BS_ELSEIF, /* expecting 'if' after 'else' */ BS_WHILE, /* expecting 'while' after 'do' */ BS_CATCH, /* expecting 'catch' or 'finally' after 'try' */ }; enum CharEncoding { ENC_ASCII, /* 0-127 */ ENC_BYTE, /* 0-255, not UTF-8 */ ENC_UTF8, ENC_UTF16_LE, ENC_UTF16_BE, }; struct chunk_t; /** * Structure for counting nested level */ struct paren_stack_entry { c_token_t type; /**< the type that opened the entry */ int level; /**< Level of opening type */ int open_line; /**< line that open symbol is on */ chunk_t *pc; /**< Chunk that opened the level */ int brace_indent; /**< indent for braces - may not relate to indent */ int indent; /**< indent level (depends on use) */ int indent_tmp; /**< temporary indent level (depends on use) */ int indent_tab; /**< the 'tab' indent (always <= real column) */ int ref; c_token_t parent; /**< if, for, function, etc */ brstage_e stage; bool in_preproc; /**< whether this was created in a preprocessor */ bool non_vardef; /**< Hit a non-vardef line */ }; /* TODO: put this on a linked list */ struct parse_frame { int ref_no; int level; // level of parens/square/angle/brace int brace_level; // level of brace/vbrace int pp_level; // level of preproc #if stuff int sparen_count; struct paren_stack_entry pse[128]; int pse_tos; int paren_count; c_token_t in_ifdef; int stmt_count; int expr_count; bool maybe_decl; bool maybe_cast; }; #define PCF_BIT(b) (1ULL << b) /* Copy flags are in the lower 16 bits */ #define PCF_COPY_FLAGS 0x0000ffff #define PCF_IN_PREPROC PCF_BIT(0) /* in a preprocessor */ #define PCF_IN_STRUCT PCF_BIT(1) /* in a struct */ #define PCF_IN_ENUM PCF_BIT(2) /* in enum */ #define PCF_IN_FCN_DEF PCF_BIT(3) /* inside function def parens */ #define PCF_IN_FCN_CALL PCF_BIT(4) /* inside function call parens */ #define PCF_IN_SPAREN PCF_BIT(5) /* inside for/if/while/switch parens */ #define PCF_IN_TEMPLATE PCF_BIT(6) #define PCF_IN_TYPEDEF PCF_BIT(7) #define PCF_IN_CONST_ARGS PCF_BIT(8) #define PCF_IN_ARRAY_ASSIGN PCF_BIT(9) #define PCF_IN_CLASS PCF_BIT(10) #define PCF_IN_NAMESPACE PCF_BIT(11) #define PCF_IN_FOR PCF_BIT(12) #define PCF_IN_OC_MSG PCF_BIT(13) /* Non-Copy flags are in the upper 48 bits */ #define PCF_FORCE_SPACE PCF_BIT(16) /* must have a space after this token */ #define PCF_STMT_START PCF_BIT(17) /* marks the start of a statement */ #define PCF_EXPR_START PCF_BIT(18) #define PCF_DONT_INDENT PCF_BIT(19) /* already aligned! */ #define PCF_ALIGN_START PCF_BIT(20) #define PCF_WAS_ALIGNED PCF_BIT(21) #define PCF_VAR_TYPE PCF_BIT(22) /* part of a variable def type */ #define PCF_VAR_DEF PCF_BIT(23) /* variable name in a variable def */ #define PCF_VAR_1ST PCF_BIT(24) /* 1st variable def in a statement */ #define PCF_VAR_1ST_DEF (PCF_VAR_DEF | PCF_VAR_1ST) #define PCF_VAR_INLINE PCF_BIT(25) /* type was an inline struct/enum/union */ #define PCF_RIGHT_COMMENT PCF_BIT(26) #define PCF_OLD_FCN_PARAMS PCF_BIT(27) #define PCF_LVALUE PCF_BIT(28) /* left of assignment */ #define PCF_ONE_LINER PCF_BIT(29) #define PCF_ONE_CLASS (PCF_ONE_LINER | PCF_IN_CLASS) #define PCF_EMPTY_BODY PCF_BIT(30) #define PCF_ANCHOR PCF_BIT(31) /* aligning anchor */ #define PCF_PUNCTUATOR PCF_BIT(32) #define PCF_INSERTED PCF_BIT(33) /* chunk was inserted from another file */ #define PCF_LONG_BLOCK PCF_BIT(34) /* the block is 'long' by some measure */ #ifdef DEFINE_PCF_NAMES static const char *pcf_names[] = { "IN_PREPROC", // 0 "IN_STRUCT", // 1 "IN_ENUM", // 2 "IN_FCN_DEF", // 3 "IN_FCN_CALL", // 4 "IN_SPAREN", // 5 "IN_TEMPLATE", // 6 "IN_TYPEDEF", // 7 "IN_CONST_ARGS", // 8 "IN_ARRAY_ASSIGN", // 9 "IN_CLASS", // 10 "IN_NAMESPACE", // 11 "IN_FOR", // 12 "IN_OC_MSG", // 13 "#14", // 14 "#15", // 15 "FORCE_SPACE", // 16 "STMT_START", // 17 "EXPR_START", // 18 "DONT_INDENT", // 19 "ALIGN_START", // 20 "WAS_ALIGNED", // 21 "VAR_TYPE", // 22 "VAR_DEF", // 23 "VAR_1ST", // 24 "VAR_INLINE", // 25 "RIGHT_COMMENT", // 26 "OLD_FCN_PARAMS", // 27 "LVALUE", // 28 "ONE_LINER", // 29 "EMPTY_BODY", // 30 "ANCHOR", // 31 "PUNCTUATOR", // 32 "INSERTED", // 33 "LONG_BLOCK", // 34 "#35", // 35 "#36", // 36 "#37", // 37 "#38", // 38 }; #endif struct align_ptr_t { chunk_t *next; /* NULL or the chunk that should be under this one */ bool right_align; /* AlignStack.m_right_align */ int star_style; /* AlignStack.m_star_style */ int amp_style; /* AlignStack.m_amp_style */ int gap; /* AlignStack.m_gap */ /* col_adj is the amount to alter the column for the token. * For example, a dangling '*' would be set to -1. * A right-aligned word would be a positive value. */ int col_adj; chunk_t *ref; chunk_t *start; }; /** This is the main type of this program */ struct chunk_t { chunk_t() { reset(); } void reset() { memset(&align, 0, sizeof(align)); next = 0; prev = 0; type = CT_NONE; parent_type = CT_NONE; orig_line = 0; orig_col = 0; orig_col_end = 0; flags = 0; column = 0; column_indent = 0; nl_count = 0; level = 0; brace_level = 0; pp_level = 0; after_tab = false; str.clear(); } int len() { return str.size(); } const char *text() { return str.c_str(); } chunk_t *next; chunk_t *prev; align_ptr_t align; c_token_t type; c_token_t parent_type; /* usually CT_NONE */ UINT32 orig_line; UINT32 orig_col; UINT32 orig_col_end; UINT64 flags; /* see PCF_xxx */ int column; /* column of chunk */ int column_indent; /* if 1st on a line, set to the 'indent' * column, which may be less that the real column */ int nl_count; /* number of newlines in CT_NEWLINE */ int level; /* nest level in {, (, or [ */ int brace_level; /* nest level in braces only */ int pp_level; /* nest level in #if stuff */ bool after_tab; /* whether this token was after a tab */ unc_text str; /* pointer to the token text */ }; enum { LANG_C = 0x0001, LANG_CPP = 0x0002, LANG_D = 0x0004, LANG_CS = 0x0008, /*<< C# or C-sharp */ LANG_JAVA = 0x0010, LANG_OC = 0x0020, /*<< Objective C */ LANG_VALA = 0x0040, /*<< Like C# */ LANG_PAWN = 0x0080, LANG_ECMA = 0x0100, LANG_ALLC = 0x017f, LANG_ALL = 0x0fff, FLAG_PP = 0x8000, /*<< only appears in a preprocessor */ }; /** * Pattern classes for special keywords */ enum pattern_class { PATCLS_NONE, PATCLS_BRACED, // keyword + braced stmt: do, try PATCLS_PBRACED, // keyword + parens + braced stmt: switch, if, for, while PATCLS_OPBRACED, // keyword + optional parens + braced stmt: catch, version PATCLS_VBRACED, // keyword + value + braced stmt: namespace PATCLS_PAREN, // keyword + parens: while-of-do PATCLS_OPPAREN, // keyword + optional parens: invariant (D lang) PATCLS_ELSE, // Special case of PATCLS_BRACED for handling CT_IF }; struct chunk_tag_t { const char *tag; c_token_t type; int lang_flags; }; struct lookup_entry_t { char ch; char left_in_group; UINT16 next_idx; const chunk_tag_t *tag; }; struct align_t { int col; c_token_t type; int len; // of the token + space }; struct file_mem { vector raw; deque data; bool bom; CharEncoding enc; #ifdef HAVE_UTIME_H struct utimbuf utb; #endif }; struct cp_data { FILE *fout; UINT32 error_count; const char *filename; file_mem file_hdr; /* for cmt_insert_file_header */ file_mem file_ftr; /* for cmt_insert_file_footer */ file_mem func_hdr; /* for cmt_insert_func_header */ file_mem oc_msg_hdr; /* for cmt_insert_oc_msg_header */ file_mem class_hdr; /* for cmt_insert_class_header */ int lang_flags; // LANG_xxx bool lang_forced; bool unc_off; UINT32 line_number; UINT16 column; /* column for parsing */ UINT16 spaces; /* space count on output */ bool frag; UINT16 frag_cols; /* stuff to auto-detect line endings */ UINT32 le_counts[LE_AUTO]; unc_text newline; bool consumed; int did_newline; c_token_t in_preproc; int preproc_ncnl_count; bool bom; CharEncoding enc; /* bumped up when a line is split or indented */ int changes; int pass_count; struct align_t al[80]; int al_cnt; bool al_c99_array; /* Here are all the settings */ op_val_t settings[UO_option_count]; int max_option_name_len; struct parse_frame frames[16]; int frame_count; int pp_level; }; extern struct cp_data cpd; #endif /* UNCRUSTIFY_TYPES_H_INCLUDED */ uncrustify-0.59/src/chunk_list.cpp0000644000175000017500000003023711630457175014257 00000000000000/** * @file chunk_list.cpp * Manages and navigates the list of chunks. * * @author Ben Gardner * @license GPL v2+ */ #include "chunk_list.h" #include #include #include "ListManager.h" #include "prototypes.h" typedef ListManager ChunkList; ChunkList g_cl; chunk_t *chunk_get_head(void) { return(g_cl.GetHead()); } chunk_t *chunk_get_tail(void) { return(g_cl.GetTail()); } chunk_t *chunk_get_next(chunk_t *cur, chunk_nav_t nav) { if (cur == NULL) { return(NULL); } chunk_t *pc = g_cl.GetNext(cur); if ((pc == NULL) || (nav == CNAV_ALL)) { return(pc); } if (cur->flags & PCF_IN_PREPROC) { /* If in a preproc, return NULL if trying to leave */ if ((pc->flags & PCF_IN_PREPROC) == 0) { return(NULL); } return(pc); } /* Not in a preproc, skip any proproc */ while ((pc != NULL) && (pc->flags & PCF_IN_PREPROC)) { pc = g_cl.GetNext(pc); } return(pc); } chunk_t *chunk_get_prev(chunk_t *cur, chunk_nav_t nav) { if (cur == NULL) { return(NULL); } chunk_t *pc = g_cl.GetPrev(cur); if ((pc == NULL) || (nav == CNAV_ALL)) { return(pc); } if (cur->flags & PCF_IN_PREPROC) { /* If in a preproc, return NULL if trying to leave */ if ((pc->flags & PCF_IN_PREPROC) == 0) { return(NULL); } return(pc); } /* Not in a preproc, skip any proproc */ while ((pc != NULL) && (pc->flags & PCF_IN_PREPROC)) { pc = g_cl.GetPrev(pc); } return(pc); } chunk_t *chunk_dup(const chunk_t *pc_in) { chunk_t *pc; /* Allocate the entry */ pc = new chunk_t; if (pc == NULL) { exit(1); } /* Copy all fields and then init the entry */ *pc = *pc_in; g_cl.InitEntry(pc); return(pc); } /** * Add to the tail of the list */ chunk_t *chunk_add(const chunk_t *pc_in) { chunk_t *pc; if ((pc = chunk_dup(pc_in)) != NULL) { g_cl.AddTail(pc); } return(pc); } /** * Add a copy after the given chunk. * If ref is NULL, add at the head. */ chunk_t *chunk_add_after(const chunk_t *pc_in, chunk_t *ref) { chunk_t *pc; if ((pc = chunk_dup(pc_in)) != NULL) { if (ref != NULL) { g_cl.AddAfter(pc, ref); } else { g_cl.AddHead(pc); } } return(pc); } /** * Add a copy before the given chunk. * If ref is NULL, add at the head. */ chunk_t *chunk_add_before(const chunk_t *pc_in, chunk_t *ref) { chunk_t *pc; if ((pc = chunk_dup(pc_in)) != NULL) { if (ref != NULL) { g_cl.AddBefore(pc, ref); } else { g_cl.AddTail(pc); } } return(pc); } void chunk_del(chunk_t *pc) { g_cl.Pop(pc); //if ((pc->flags & PCF_OWN_STR) && (pc->str != NULL)) //{ // delete[] (char *)pc->str; // pc->str = NULL; //} delete pc; } void chunk_move_after(chunk_t *pc_in, chunk_t *ref) { g_cl.Pop(pc_in); g_cl.AddAfter(pc_in, ref); /* HACK: Adjust the original column */ pc_in->column = ref->column + space_col_align(ref, pc_in); pc_in->orig_col = pc_in->column; pc_in->orig_col_end = pc_in->orig_col + pc_in->len(); } /** * Gets the next NEWLINE chunk */ chunk_t *chunk_get_next_nl(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_next(pc, nav); } while ((pc != NULL) && !chunk_is_newline(pc)); return(pc); } /** * Gets the prev NEWLINE chunk */ chunk_t *chunk_get_prev_nl(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_prev(pc, nav); } while ((pc != NULL) && !chunk_is_newline(pc)); return(pc); } /** * Gets the next non-NEWLINE chunk */ chunk_t *chunk_get_next_nnl(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_next(pc, nav); } while (chunk_is_newline(pc)); return(pc); } /** * Gets the prev non-NEWLINE chunk */ chunk_t *chunk_get_prev_nnl(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_prev(pc, nav); } while ((pc != NULL) && chunk_is_newline(pc)); return(pc); } /** * Gets the next non-NEWLINE and non-comment chunk */ chunk_t *chunk_get_next_ncnl(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_next(pc, nav); } while ((pc != NULL) && (chunk_is_comment(pc) || chunk_is_newline(pc))); return(pc); } /** * Gets the next non-NEWLINE and non-comment chunk, non-preprocessor chunk */ chunk_t *chunk_get_next_ncnlnp(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; if (chunk_is_preproc(cur)) { do { pc = chunk_get_next(pc, nav); } while ((pc != NULL) && chunk_is_preproc(pc) && (chunk_is_comment(pc) || chunk_is_newline(pc))); } else { do { pc = chunk_get_next(pc, nav); } while ((pc != NULL) && (chunk_is_comment(pc) || chunk_is_newline(pc) || chunk_is_preproc(pc))); } return(pc); } /** * Gets the prev non-NEWLINE and non-comment chunk, non-preprocessor chunk */ chunk_t *chunk_get_prev_ncnlnp(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; if (chunk_is_preproc(cur)) { do { pc = chunk_get_prev(pc, nav); } while ((pc != NULL) && chunk_is_preproc(pc) && (chunk_is_comment(pc) || chunk_is_newline(pc))); } else { do { pc = chunk_get_prev(pc, nav); } while ((pc != NULL) && (chunk_is_comment(pc) || chunk_is_newline(pc) || chunk_is_preproc(pc))); } return(pc); } /** * Gets the next non-blank chunk */ chunk_t *chunk_get_next_nblank(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_next(pc, nav); } while ((pc != NULL) && (chunk_is_comment(pc) || chunk_is_newline(pc) || chunk_is_blank(pc))); return(pc); } /** * Gets the prev non-blank chunk */ chunk_t *chunk_get_prev_nblank(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_prev(pc, nav); } while ((pc != NULL) && (chunk_is_comment(pc) || chunk_is_newline(pc) || chunk_is_blank(pc))); return(pc); } /** * Gets the next non-comment chunk */ chunk_t *chunk_get_next_nc(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_next(pc, nav); } while ((pc != NULL) && chunk_is_comment(pc)); return(pc); } /** * Gets the prev non-NEWLINE and non-comment chunk */ chunk_t *chunk_get_prev_ncnl(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_prev(pc, nav); } while ((pc != NULL) && (chunk_is_comment(pc) || chunk_is_newline(pc))); return(pc); } /** * Gets the prev non-comment chunk */ chunk_t *chunk_get_prev_nc(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_prev(pc, nav); } while ((pc != NULL) && chunk_is_comment(pc)); return(pc); } /** * Grabs the next chunk of the given type at the level. * * @param cur Starting chunk * @param type The type to look for * @param level -1 (any level) or the level to match * @return NULL or the match */ chunk_t *chunk_get_next_type(chunk_t *cur, c_token_t type, int level, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_next(pc, nav); if ((pc == NULL) || ((pc->type == type) && ((pc->level == level) || (level < 0)))) { break; } } while (pc != NULL); return(pc); } chunk_t *chunk_get_next_str(chunk_t *cur, const char *str, int len, int level, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_next(pc, nav); if ((pc == NULL) || ((pc->len() == len) && (memcmp(str, pc->text(), len) == 0) && ((pc->level == level) || (level < 0)))) { break; } } while (pc != NULL); return(pc); } /** * Grabs the prev chunk of the given type at the level. * * @param cur Starting chunk * @param type The type to look for * @param level -1 (any level) or the level to match * @return NULL or the match */ chunk_t *chunk_get_prev_type(chunk_t *cur, c_token_t type, int level, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_prev(pc, nav); if ((pc == NULL) || ((pc->type == type) && ((pc->level == level) || (level < 0)))) { break; } } while (pc != NULL); return(pc); } chunk_t *chunk_get_prev_str(chunk_t *cur, const char *str, int len, int level, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_prev(pc, nav); if ((pc == NULL) || ((pc->len() == len) && (memcmp(str, pc->text(), len) == 0) && ((pc->level == level) || (level < 0)))) { break; } } while (pc != NULL); return(pc); } /** * Check to see if there is a newline bewteen the two chunks */ bool chunk_is_newline_between(chunk_t *start, chunk_t *end) { chunk_t *pc; for (pc = start; pc != end; pc = chunk_get_next(pc)) { if (chunk_is_newline(pc)) { return(true); } } return(false); } /** * Swaps the two chunks. * * @param pc1 The first chunk * @param pc2 The second chunk */ void chunk_swap(chunk_t *pc1, chunk_t *pc2) { g_cl.Swap(pc1, pc2); } /** * Finds the first chunk on the line that pc is on. * This just backs up until a newline or NULL is hit. * * given: [ a - b - c - n1 - d - e - n2 ] * input: [ a | b | c | n1 ] => a * input: [ d | e | n2 ] => d */ chunk_t *chunk_first_on_line(chunk_t *pc) { chunk_t *first = pc; while (((pc = chunk_get_prev(pc)) != NULL) && !chunk_is_newline(pc)) { first = pc; } return(first); } /** * Swaps two lines that are started with the specified chunks. * * @param pc1 The first chunk of line 1 * @param pc2 The first chunk of line 2 */ void chunk_swap_lines(chunk_t *pc1, chunk_t *pc2) { chunk_t *ref2; chunk_t *tmp; pc1 = chunk_first_on_line(pc1); pc2 = chunk_first_on_line(pc2); if ((pc1 == NULL) || (pc2 == NULL) || (pc1 == pc2)) { return; } /** * Example start: * ? - start1 - a1 - b1 - nl1 - ? - ref2 - start2 - a2 - b2 - nl2 - ? * ^- pc1 ^- pc2 */ ref2 = chunk_get_prev(pc2); /* Move the line started at pc2 before pc1 */ while ((pc2 != NULL) && !chunk_is_newline(pc2)) { tmp = chunk_get_next(pc2); g_cl.Pop(pc2); g_cl.AddBefore(pc2, pc1); pc2 = tmp; } /** * Should now be: * ? - start2 - a2 - b2 - start1 - a1 - b1 - nl1 - ? - ref2 - nl2 - ? * ^- pc1 ^- pc2 */ /* Now move the line started at pc1 after ref2 */ while ((pc1 != NULL) && !chunk_is_newline(pc1)) { tmp = chunk_get_next(pc1); g_cl.Pop(pc1); if (ref2 != NULL) { g_cl.AddAfter(pc1, ref2); } else { g_cl.AddHead(pc1); } ref2 = pc1; pc1 = tmp; } /** * Should now be: * ? - start2 - a2 - b2 - nl1 - ? - ref2 - start1 - a1 - b1 - nl2 - ? * ^- pc1 ^- pc2 */ /* pc1 and pc2 should be the newlines for their lines. * swap the chunks and the nl_count so that the spacing remains the same. */ if ((pc1 != NULL) && (pc2 != NULL)) { int nl_count = pc1->nl_count; pc1->nl_count = pc2->nl_count; pc2->nl_count = nl_count; chunk_swap(pc1, pc2); } } /** * Gets the next non-vbrace chunk */ chunk_t *chunk_get_next_nvb(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_next(pc, nav); } while (chunk_is_vbrace(pc)); return(pc); } /** * Gets the prev non-vbrace chunk */ chunk_t *chunk_get_prev_nvb(chunk_t *cur, chunk_nav_t nav) { chunk_t *pc = cur; do { pc = chunk_get_prev(pc, nav); } while (chunk_is_vbrace(pc)); return(pc); } uncrustify-0.59/src/base_types.h0000644000175000017500000000204611506773274013717 00000000000000/** * @file base_types.h * * Defines some base types, includes config.h * * @author Ben Gardner * @license GPL v2+ */ #ifndef BASE_TYPES_H_INCLUDED #define BASE_TYPES_H_INCLUDED #ifdef WIN32 #include "../win32/windows_compat.h" #else /* not WIN32 */ #include "config.h" #define PATH_SEP '/' #define __STDC_FORMAT_MACROS #if defined HAVE_INTTYPES_H #include #else #error "Don't know where int8_t is defined" #endif /* some of my favorite aliases */ typedef char CHAR; typedef int8_t INT8; typedef int16_t INT16; typedef int32_t INT32; typedef uint8_t UINT8; typedef uint16_t UINT16; typedef uint32_t UINT32; typedef uint64_t UINT64; #endif /* ifdef WIN32 */ /* and the good old SUCCESS/FAILURE */ #define SUCCESS 0 #define FAILURE -1 /* and a nice macro to keep SlickEdit happy */ #define static_inline static inline /* and the ever-so-important array size macro */ #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif #endif /* BASE_TYPES_H_INCLUDED */ uncrustify-0.59/src/combine.cpp0000644000175000017500000034353011632275471013532 00000000000000/** * @file combine.cpp * Labels the chunks as needed. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "ChunkStack.h" #include "prototypes.h" #include #include #include #include #include "unc_ctype.h" #include static void fix_fcn_def_params(chunk_t *pc); static void fix_typedef(chunk_t *pc); static void fix_enum_struct_union(chunk_t *pc); static void fix_casts(chunk_t *pc); static void fix_type_cast(chunk_t *pc); static chunk_t *fix_var_def(chunk_t *pc); static void mark_function(chunk_t *pc); static void mark_struct_union_body(chunk_t *start); static chunk_t *mark_variable_definition(chunk_t *start); static void mark_define_expressions(void); static void process_returns(void); static chunk_t *process_return(chunk_t *pc); static void mark_class_ctor(chunk_t *pclass); static void mark_namespace(chunk_t *pns); static void mark_function_type(chunk_t *pc); static void mark_cpp_constructor(chunk_t *pc); static void mark_lvalue(chunk_t *pc); static void mark_template_func(chunk_t *pc, chunk_t *pc_next); static void mark_exec_sql(chunk_t *pc); static void handle_oc_class(chunk_t *pc); static void handle_oc_block(chunk_t *pc); static void handle_oc_message_decl(chunk_t *pc); static void handle_oc_message_send(chunk_t *pc); static void handle_cs_square_stmt(chunk_t *pc); static void handle_cs_property(chunk_t *pc); static void handle_template(chunk_t *pc); static void handle_wrap(chunk_t *pc); static bool is_oc_block(chunk_t *pc); static void handle_java_assert(chunk_t *pc); void make_type(chunk_t *pc) { if (pc != NULL) { if (pc->type == CT_WORD) { pc->type = CT_TYPE; } else if (chunk_is_star(pc)) { pc->type = CT_PTR_TYPE; } else if (chunk_is_addr(pc)) { pc->type = CT_BYREF; } } } void flag_series(chunk_t *start, chunk_t *end, UINT64 flags, chunk_nav_t nav) { while ((start != NULL) && (start != end)) { start->flags |= flags; start = chunk_get_next(start, nav); } if (end) { end->flags |= flags; } } /** * Flags everything from the open paren to the close paren. * * @param po Pointer to the open parenthesis * @return The token after the close paren */ static chunk_t *flag_parens(chunk_t *po, UINT64 flags, c_token_t opentype, c_token_t parenttype, bool parent_all) { chunk_t *paren_close; chunk_t *pc; if (is_oc_block(po)) { return(NULL); } paren_close = chunk_skip_to_match(po, CNAV_PREPROC); if (paren_close == NULL) { LOG_FMT(LERR, "%s: no match for [%s] at [%d:%d]\n", __func__, po->str.c_str(), po->orig_line, po->orig_col); return(NULL); } if ((paren_close != NULL) && (po != paren_close)) { if ((flags != 0) || (parent_all && (parenttype != CT_NONE))) { for (pc = chunk_get_next(po, CNAV_PREPROC); pc != paren_close; pc = chunk_get_next(pc, CNAV_PREPROC)) { pc->flags |= flags; if (parent_all) { pc->parent_type = parenttype; } } } if (opentype != CT_NONE) { po->type = opentype; paren_close->type = (c_token_t)(opentype + 1); } if (parenttype != CT_NONE) { po->parent_type = parenttype; paren_close->parent_type = parenttype; } } return(chunk_get_next_ncnl(paren_close, CNAV_PREPROC)); } /** * Sets the parent of the open paren/brace/square/angle and the closing. * Note - it is assumed that pc really does point to an open item and the * close must be open + 1. * * @param start The open paren * @param parent The type to assign as the parent * @reutrn The chunk after the close paren */ chunk_t *set_paren_parent(chunk_t *start, c_token_t parent) { chunk_t *end; end = chunk_skip_to_match(start, CNAV_PREPROC); if (end != NULL) { start->parent_type = parent; end->parent_type = parent; } return(chunk_get_next_ncnl(end, CNAV_PREPROC)); } /* Scan backwards to see if we might be on a type declaration */ static bool chunk_ends_type(chunk_t *pc) { bool ret = false; for (/* nada */; pc != NULL; pc = chunk_get_prev_ncnl(pc)) { LOG_FMT(LFTYPE, "%s: [%s] %s flags %" PRIx64 " on line %d, col %d\n", __func__, get_token_name(pc->type), pc->str.c_str(), pc->flags, pc->orig_line, pc->orig_col); if ((pc->type == CT_WORD) || (pc->type == CT_TYPE) || (pc->type == CT_STRUCT) || (pc->type == CT_DC_MEMBER) || (pc->type == CT_QUALIFIER)) { continue; } if (chunk_is_semicolon(pc) || (pc->type == CT_BRACE_OPEN) || (pc->type == CT_BRACE_CLOSE)) { ret = true; } break; } if (pc == NULL) { /* first token */ ret = true; } LOG_FMT(LFTYPE, "%s verdict: %s\n", __func__, ret ? "yes" : "no"); return(ret); } /** * This is called on every chunk. * First on all non-preprocessor chunks and then on each preprocessor chunk. * It does all the detection and classifying. */ void do_symbol_check(chunk_t *prev, chunk_t *pc, chunk_t *next) { chunk_t *tmp; // LOG_FMT(LSYS, " %3d > ['%s' %s] ['%s' %s] ['%s' %s]\n", // pc->orig_line, // prev->str.c_str(), get_token_name(prev->type), // pc->str.c_str(), get_token_name(pc->type), // next->str.c_str(), get_token_name(next->type)); /* D stuff */ if ((cpd.lang_flags & LANG_D) && (pc->type == CT_QUALIFIER) && chunk_is_str(pc, "const", 5) && (next->type == CT_PAREN_OPEN)) { pc->type = CT_D_CAST; set_paren_parent(next, pc->type); } if ((next->type == CT_PAREN_OPEN) && ((pc->type == CT_D_CAST) || (pc->type == CT_DELEGATE) || (pc->type == CT_ALIGN))) { /* mark the parenthesis parent */ tmp = set_paren_parent(next, pc->type); /* For a D cast - convert the next item */ if ((pc->type == CT_D_CAST) && (tmp != NULL)) { if (tmp->type == CT_STAR) { tmp->type = CT_DEREF; } else if (tmp->type == CT_AMP) { tmp->type = CT_ADDR; } else if (tmp->type == CT_MINUS) { tmp->type = CT_NEG; } else if (tmp->type == CT_PLUS) { tmp->type = CT_POS; } } /* For a delegate, mark previous words as types and the item after the * close paren as a variable def */ if (pc->type == CT_DELEGATE) { if (tmp != NULL) { tmp->parent_type = CT_DELEGATE; if (tmp->level == tmp->brace_level) { tmp->flags |= PCF_VAR_1ST_DEF; } } for (tmp = chunk_get_prev_ncnl(pc); tmp != NULL; tmp = chunk_get_prev_ncnl(tmp)) { if (chunk_is_semicolon(tmp) || (tmp->type == CT_BRACE_OPEN) || (tmp->type == CT_VBRACE_OPEN)) { break; } make_type(tmp); } } if ((pc->type == CT_ALIGN) && (tmp != NULL)) { if (tmp->type == CT_BRACE_OPEN) { set_paren_parent(tmp, pc->type); } else if (tmp->type == CT_COLON) { tmp->parent_type = pc->type; } } } /* paren open + cast/align/delegate */ if (pc->type == CT_INVARIANT) { if (next->type == CT_PAREN_OPEN) { next->parent_type = pc->type; tmp = chunk_get_next(next); while (tmp != NULL) { if (tmp->type == CT_PAREN_CLOSE) { tmp->parent_type = pc->type; break; } make_type(tmp); tmp = chunk_get_next(tmp); } } else { pc->type = CT_QUALIFIER; } } /* Objective C stuff */ if (cpd.lang_flags & LANG_OC) { /* Check for message declarations */ if (pc->flags & PCF_STMT_START) { if ((chunk_is_str(pc, "-", 1) || chunk_is_str(pc, "+", 1)) && chunk_is_str(next, "(", 1)) { handle_oc_message_decl(pc); } } if (pc->flags & PCF_EXPR_START) { if (pc->type == CT_SQUARE_OPEN) { handle_oc_message_send(pc); } } if ((pc->type == CT_OC_BLOCK_CARET) && (pc->parent_type != CT_OC_MSG_SPEC) && (pc->parent_type != CT_OC_MSG_DECL)) { handle_oc_block(pc); } } /* C# stuff */ if (cpd.lang_flags & LANG_CS) { /* '[assembly: xxx]' stuff */ if ((pc->flags & PCF_EXPR_START) && (pc->type == CT_SQUARE_OPEN)) { handle_cs_square_stmt(pc); } if ((next != NULL) && (next->type == CT_BRACE_OPEN) && (next->parent_type == CT_NONE) && ((pc->type == CT_SQUARE_CLOSE) || (pc->type == CT_WORD))) { handle_cs_property(next); } } if ((pc->type == CT_ASSIGN) && (next->type == CT_SQUARE_OPEN)) { set_paren_parent(next, CT_ASSIGN); /* Mark one-liner assignment */ tmp = next; while ((tmp = chunk_get_next_nc(tmp)) != NULL) { if (chunk_is_newline(tmp)) { break; } if ((tmp->type == CT_SQUARE_CLOSE) && (next->level == tmp->level)) { tmp->flags |= PCF_ONE_LINER; next->flags |= PCF_ONE_LINER; break; } } } if (pc->type == CT_ASSERT) { handle_java_assert(pc); } /* A [] in C# and D only follows a type */ if ((pc->type == CT_TSQUARE) && ((cpd.lang_flags & (LANG_D | LANG_CS | LANG_VALA)) != 0)) { if ((prev != NULL) && (prev->type == CT_WORD)) { prev->type = CT_TYPE; } if ((next != NULL) && (next->type == CT_WORD)) { next->flags |= PCF_VAR_1ST_DEF; } } if ((pc->type == CT_SQL_EXEC) || (pc->type == CT_SQL_BEGIN) || (pc->type == CT_SQL_END)) { mark_exec_sql(pc); } if ((pc->type == CT_FUNC_WRAP) || (pc->type == CT_TYPE_WRAP)) { handle_wrap(pc); next = chunk_get_next_ncnl(pc); } /* Handle the typedef */ if (pc->type == CT_TYPEDEF) { fix_typedef(pc); } if ((pc->type == CT_ENUM) || (pc->type == CT_STRUCT) || (pc->type == CT_UNION)) { if (prev->type != CT_TYPEDEF) { fix_enum_struct_union(pc); } } if (pc->type == CT_EXTERN) { tmp = chunk_get_next_type(next, CT_BRACE_OPEN, next->level); if (tmp != NULL) { set_paren_parent(tmp, CT_EXTERN); } } if (pc->type == CT_TEMPLATE) { handle_template(pc); } if ((pc->type == CT_WORD) && (next->type == CT_ANGLE_OPEN) && (next->parent_type == CT_TEMPLATE)) { mark_template_func(pc, next); } if ((pc->type == CT_SQUARE_CLOSE) && (next->type == CT_PAREN_OPEN)) { flag_parens(next, 0, CT_FPAREN_OPEN, CT_NONE, false); } if (pc->type == CT_TYPE_CAST) { fix_type_cast(pc); } if (pc->type == CT_ASSIGN) { mark_lvalue(pc); } if ((pc->parent_type == CT_ASSIGN) && ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_SQUARE_OPEN))) { /* Mark everything in here as in assign */ flag_parens(pc, PCF_IN_ARRAY_ASSIGN, pc->type, CT_NONE, false); } if (pc->type == CT_D_TEMPLATE) { set_paren_parent(next, pc->type); } /** * A word before an open paren is a function call or definition. * CT_WORD => CT_FUNC_CALL or CT_FUNC_DEF */ if ((next->type == CT_PAREN_OPEN) && (next->next != NULL) && (next->next->type != CT_OC_BLOCK_CARET)) { if ((pc->type == CT_WORD) || (pc->type == CT_OPERATOR_VAL)) { pc->type = CT_FUNCTION; } else if (pc->type == CT_TYPE) { /** * If we are on a type, then we are either on a C++ style cast, a * function or we are on a function type. * The only way to tell for sure is to find the close paren and see * if it is followed by an open paren. * "int(5.6)" * "int()" * "int(foo)(void)" * * FIXME: this check can be done better... */ tmp = chunk_get_next_type(next, CT_PAREN_CLOSE, next->level); tmp = chunk_get_next(tmp); if ((tmp != NULL) && (tmp->type == CT_PAREN_OPEN)) { /* we have "TYPE(...)(" */ pc->type = CT_FUNCTION; } else { if ((pc->parent_type == CT_NONE) && ((pc->flags & PCF_IN_TYPEDEF) == 0)) { tmp = chunk_get_next_ncnl(next); if ((tmp != NULL) && (tmp->type == CT_PAREN_CLOSE)) { /* we have TYPE() */ pc->type = CT_FUNCTION; } else { /* we have TYPE(...) */ pc->type = CT_CPP_CAST; set_paren_parent(next, CT_CPP_CAST); } } } } else if (pc->type == CT_ATTRIBUTE) { flag_parens(next, 0, CT_FPAREN_OPEN, CT_ATTRIBUTE, false); } } if ((cpd.lang_flags & LANG_PAWN) != 0) { if ((pc->type == CT_FUNCTION) && (pc->brace_level > 0)) { pc->type = CT_FUNC_CALL; } if ((pc->type == CT_STATE) && (next != NULL) && (next->type == CT_PAREN_OPEN)) { set_paren_parent(next, pc->type); } } else { if ((pc->type == CT_FUNCTION) && !is_oc_block(pc)) { mark_function(pc); } } /* Detect C99 member stuff */ if ((pc->type == CT_MEMBER) && ((prev->type == CT_COMMA) || (prev->type == CT_BRACE_OPEN))) { pc->type = CT_C99_MEMBER; next->parent_type = CT_C99_MEMBER; } /* Mark function parens and braces */ if ((pc->type == CT_FUNC_DEF) || (pc->type == CT_FUNC_CALL) || (pc->type == CT_FUNC_CALL_USER) || (pc->type == CT_FUNC_PROTO)) { tmp = next; if (tmp->type == CT_SQUARE_OPEN) { tmp = set_paren_parent(tmp, pc->type); } else if ((tmp->type == CT_TSQUARE) || (tmp->parent_type == CT_OPERATOR)) { tmp = chunk_get_next_ncnl(tmp); } tmp = flag_parens(tmp, 0, CT_FPAREN_OPEN, pc->type, false); if (tmp != NULL) { if (tmp->type == CT_BRACE_OPEN) { if ((pc->flags & PCF_IN_CONST_ARGS) == 0) { set_paren_parent(tmp, pc->type); } } else if (chunk_is_semicolon(tmp) && (pc->type == CT_FUNC_PROTO)) { tmp->parent_type = pc->type; } } } /* Mark the parameters in catch() */ if ((pc->type == CT_CATCH) && (next->type == CT_SPAREN_OPEN)) { fix_fcn_def_params(next); } if ((pc->type == CT_THROW) && (prev->type == CT_FPAREN_CLOSE)) { pc->parent_type = prev->parent_type; if (next->type == CT_PAREN_OPEN) { set_paren_parent(next, CT_THROW); } } /* Mark the braces in: "for_each_entry(xxx) { }" */ if ((pc->type == CT_BRACE_OPEN) && (prev->type == CT_FPAREN_CLOSE) && ((prev->parent_type == CT_FUNC_CALL) || (prev->parent_type == CT_FUNC_CALL_USER)) && ((pc->flags & PCF_IN_CONST_ARGS) == 0)) { set_paren_parent(pc, CT_FUNC_CALL); } /* Check for a close paren followed by an open paren, which means that * we are on a function type declaration (C/C++ only?). * Note that typedefs are already taken care of. */ if ((next != NULL) && ((pc->flags & (PCF_IN_TYPEDEF | PCF_IN_TEMPLATE)) == 0) && (pc->parent_type != CT_CPP_CAST) && (pc->parent_type != CT_C_CAST) && ((pc->flags & PCF_IN_PREPROC) == 0) && (!is_oc_block(pc)) && (pc->parent_type != CT_OC_MSG_DECL) && (pc->parent_type != CT_OC_MSG_SPEC) && chunk_is_str(pc, ")", 1) && chunk_is_str(next, "(", 1)) { if ((cpd.lang_flags & LANG_D) != 0) { flag_parens(next, 0, CT_FPAREN_OPEN, CT_FUNC_CALL, false); } else { mark_function_type(pc); } } if (((pc->type == CT_CLASS) || (pc->type == CT_STRUCT)) && (pc->level == pc->brace_level)) { if ((pc->type != CT_STRUCT) || ((cpd.lang_flags & LANG_C) == 0)) { mark_class_ctor(pc); } } if (pc->type == CT_OC_CLASS) { handle_oc_class(pc); } if (pc->type == CT_NAMESPACE) { mark_namespace(pc); } /*TODO: Check for stuff that can only occur at the start of an statement */ if ((cpd.lang_flags & LANG_D) == 0) { /** * Check a paren pair to see if it is a cast. * Note that SPAREN and FPAREN have already been marked. */ if ((pc->type == CT_PAREN_OPEN) && ((pc->parent_type == CT_NONE) || (pc->parent_type == CT_OC_MSG) || (pc->parent_type == CT_OC_BLOCK_EXPR)) && ((next->type == CT_WORD) || (next->type == CT_TYPE) || (next->type == CT_STRUCT) || (next->type == CT_QUALIFIER) || (next->type == CT_MEMBER) || (next->type == CT_DC_MEMBER) || (next->type == CT_ENUM) || (next->type == CT_UNION)) && (prev->type != CT_SIZEOF) && (prev->parent_type != CT_OPERATOR) && ((pc->flags & PCF_IN_TYPEDEF) == 0)) { fix_casts(pc); } } /* Check for stuff that can only occur at the start of an expression */ if ((pc->flags & PCF_EXPR_START) != 0) { /* Change STAR, MINUS, and PLUS in the easy cases */ if (pc->type == CT_STAR) { pc->type = (prev->type == CT_ANGLE_CLOSE) ? CT_PTR_TYPE : CT_DEREF; } if (pc->type == CT_MINUS) { pc->type = CT_NEG; } if (pc->type == CT_PLUS) { pc->type = CT_POS; } if (pc->type == CT_INCDEC_AFTER) { pc->type = CT_INCDEC_BEFORE; //fprintf(stderr, "%s: %d> changed INCDEC_AFTER to INCDEC_BEFORE\n", __func__, pc->orig_line); } if (pc->type == CT_AMP) { //fprintf(stderr, "Changed AMP to ADDR on line %d\n", pc->orig_line); pc->type = CT_ADDR; } } /* Detect a variable definition that starts with struct/enum/union */ if (((pc->flags & PCF_IN_TYPEDEF) == 0) && (prev->parent_type != CT_CPP_CAST) && ((prev->flags & PCF_IN_FCN_DEF) == 0) && ((pc->type == CT_STRUCT) || (pc->type == CT_UNION) || (pc->type == CT_ENUM))) { tmp = next; if (tmp->type == CT_TYPE) { tmp = chunk_get_next_ncnl(tmp); } if ((tmp != NULL) && (tmp->type == CT_BRACE_OPEN)) { tmp = chunk_skip_to_match(tmp); tmp = chunk_get_next_ncnl(tmp); } if ((tmp != NULL) && (chunk_is_star(tmp) || (tmp->type == CT_WORD))) { mark_variable_definition(tmp); } } /** * Change the paren pair after a function/macrofunc. * CT_PAREN_OPEN => CT_FPAREN_OPEN */ if (pc->type == CT_MACRO_FUNC) { flag_parens(next, PCF_IN_FCN_CALL, CT_FPAREN_OPEN, CT_MACRO_FUNC, false); } if ((pc->type == CT_MACRO_OPEN) || (pc->type == CT_MACRO_ELSE) || (pc->type == CT_MACRO_CLOSE)) { if (next->type == CT_PAREN_OPEN) { flag_parens(next, 0, CT_FPAREN_OPEN, pc->type, false); } } if ((pc->type == CT_DELETE) && (next->type == CT_TSQUARE)) { next->parent_type = CT_DELETE; } /* Change CT_STAR to CT_PTR_TYPE or CT_ARITH or CT_DEREF */ if (pc->type == CT_STAR) { if (chunk_is_paren_close(next)) { pc->type = CT_PTR_TYPE; } else if ((cpd.lang_flags & LANG_OC) && (next->type == CT_STAR)) { /* Change pointer-to-pointer types in OC_MSG_DECLs * from ARITH <===> DEREF to PTR_TYPE <===> PTR_TYPE */ pc->type = CT_PTR_TYPE; pc->parent_type = prev->parent_type; next->type = CT_PTR_TYPE; next->parent_type = pc->parent_type; } else if ((prev->type == CT_SIZEOF) || (prev->type == CT_DELETE)) { pc->type = CT_DEREF; } else if (((prev->type == CT_WORD) && chunk_ends_type(prev)) || (prev->type == CT_DC_MEMBER) || (prev->type == CT_PTR_TYPE)) { pc->type = CT_PTR_TYPE; } else if (next->type == CT_SQUARE_OPEN) { pc->type = CT_PTR_TYPE; } else { /* most PCF_PUNCTUATOR chunks except a paren close would make this * a deref. A paren close may end a cast or may be part of a macro fcn. */ pc->type = ((prev->flags & PCF_PUNCTUATOR) && (!chunk_is_paren_close(prev) || (prev->parent_type == CT_MACRO_FUNC)) && (prev->type != CT_SQUARE_CLOSE) && (prev->type != CT_DC_MEMBER)) ? CT_DEREF : CT_ARITH; } } if (pc->type == CT_AMP) { if (prev->type == CT_DELETE) { pc->type = CT_ADDR; } else if (prev->type == CT_TYPE) { pc->type = CT_BYREF; } else { pc->type = CT_ARITH; if (prev->type == CT_WORD) { tmp = chunk_get_prev_ncnl(prev); if ((tmp != NULL) && (chunk_is_semicolon(tmp) || (tmp->type == CT_BRACE_OPEN) || (tmp->type == CT_QUALIFIER))) { prev->type = CT_TYPE; pc->type = CT_ADDR; next->flags |= PCF_VAR_1ST; } } } } if ((pc->type == CT_MINUS) || (pc->type == CT_PLUS)) { if ((prev->type == CT_POS) || (prev->type == CT_NEG)) { pc->type = (pc->type == CT_MINUS) ? CT_NEG : CT_POS; } else if (prev->type == CT_OC_CLASS) { pc->type = (pc->type == CT_MINUS) ? CT_NEG : CT_POS; } else { pc->type = CT_ARITH; } } } /** * Change CT_INCDEC_AFTER + WORD to CT_INCDEC_BEFORE * Change number/word + CT_ADDR to CT_ARITH * Change number/word + CT_STAR to CT_ARITH * Change number/word + CT_NEG to CT_ARITH * Change word + ( to a CT_FUNCTION * Cahnge struct/union/enum + CT_WORD => CT_TYPE * Force parens on return. * * TODO: This could be done earlier. * * Patterns detected: * STRUCT/ENUM/UNION + WORD :: WORD => TYPE * WORD + '(' :: WORD => FUNCTION */ void fix_symbols(void) { chunk_t *pc; chunk_t *next; chunk_t *prev; chunk_t dummy; mark_define_expressions(); pc = chunk_get_head(); if (chunk_is_newline(pc) || chunk_is_comment(pc)) { pc = chunk_get_next_ncnl(pc); } while (pc != NULL) { prev = chunk_get_prev_ncnl(pc, CNAV_PREPROC); if (prev == NULL) { prev = &dummy; } next = chunk_get_next_ncnl(pc, CNAV_PREPROC); if (next == NULL) { next = &dummy; } do_symbol_check(prev, pc, next); pc = chunk_get_next_ncnl(pc); } pawn_add_virtual_semicolons(); process_returns(); /** * 2nd pass - handle variable definitions * REVISIT: We need function params marked to do this (?) */ pc = chunk_get_head(); int square_level = -1; while (pc != NULL) { /* Can't have a variable definition inside [ ] */ if (square_level < 0) { if (pc->type == CT_SQUARE_OPEN) { square_level = pc->level; } } else { if (pc->level <= square_level) { square_level = -1; } } /** * A variable definition is possible after at the start of a statement * that starts with: QUALIFIER, TYPE, or WORD */ if ((square_level < 0) && ((pc->flags & PCF_STMT_START) != 0) && ((pc->type == CT_QUALIFIER) || (pc->type == CT_TYPE) || (pc->type == CT_WORD)) && (pc->parent_type != CT_ENUM) && ((pc->flags & PCF_IN_ENUM) == 0)) { pc = fix_var_def(pc); } else { pc = chunk_get_next_ncnl(pc); } } } /* Just hit an assign. Go backwards until we hit an open brace/paren/square or * semicolon (TODO: other limiter?) and mark as a LValue. */ static void mark_lvalue(chunk_t *pc) { chunk_t *prev; if ((pc->flags & PCF_IN_PREPROC) != 0) { return; } for (prev = chunk_get_prev_ncnl(pc); prev != NULL; prev = chunk_get_prev_ncnl(prev)) { if ((prev->level < pc->level) || (prev->type == CT_ASSIGN) || (prev->type == CT_COMMA) || (prev->type == CT_BOOL) || chunk_is_semicolon(prev) || chunk_is_str(prev, "(", 1) || chunk_is_str(prev, "{", 1) || chunk_is_str(prev, "[", 1) || (prev->flags & PCF_IN_PREPROC)) { break; } prev->flags |= PCF_LVALUE; if ((prev->level == pc->level) && chunk_is_str(prev, "&", 1)) { make_type(prev); } } } /** * Process a function type that is not in a typedef. * pc points to the first close paren. * * void (*func)(params); * * @param pc Points to the closing paren */ static void mark_function_type(chunk_t *pc) { chunk_t *tmp; LOG_FMT(LFTYPE, "%s: [%s] %s on line %d, col %d\n", __func__, get_token_name(pc->type), pc->str.c_str(), pc->orig_line, pc->orig_col); int star_count = 0; int word_count = 0; bool nogo = false; /* Scan backwards across the name, which can only be a word and single star */ tmp = chunk_get_prev_ncnl(pc); while ((tmp = chunk_get_prev_ncnl(tmp)) != NULL) { LOG_FMT(LFTYPE, " -- [%s] %s on line %d, col %d\n", get_token_name(tmp->type), tmp->str.c_str(), tmp->orig_line, tmp->orig_col); if (chunk_is_star(tmp)) { star_count++; } else if ((tmp->type == CT_WORD) || (tmp->type == CT_TYPE)) { word_count++; } else if (tmp->type == CT_DC_MEMBER) { word_count = 0; } else if (chunk_is_str(tmp, "(", 1)) { break; } else { LOG_FMT(LFTYPE, "%s: unexpected token [%s] %s on line %d, col %d\n", __func__, get_token_name(tmp->type), tmp->str.c_str(), tmp->orig_line, tmp->orig_col); nogo = true; } } if (!nogo && ((star_count > 1) || (word_count > 1) || ((star_count + word_count) == 0))) { LOG_FMT(LFTYPE, "%s: bad counts word:%d, star:%d\n", __func__, word_count, star_count); nogo = true; } if (nogo) { tmp = chunk_get_next_ncnl(pc); flag_parens(tmp, 0, CT_FPAREN_OPEN, CT_FUNC_CALL, false); return; } pc->type = CT_PAREN_CLOSE; pc->parent_type = CT_NONE; /* Step backwards to the previous open paren and mark everything a */ tmp = pc; while ((tmp = chunk_get_prev_ncnl(tmp)) != NULL) { if (*tmp->str == '(') { tmp->flags |= PCF_VAR_1ST_DEF; tmp->type = CT_PAREN_OPEN; tmp->parent_type = CT_NONE; tmp = chunk_get_prev_ncnl(tmp); if (tmp != NULL) { if ((tmp->type == CT_FUNCTION) || (tmp->type == CT_FUNC_CALL) || (tmp->type == CT_FUNC_CALL_USER) || (tmp->type == CT_FUNC_DEF) || (tmp->type == CT_FUNC_PROTO)) { tmp->type = CT_TYPE; tmp->flags &= ~PCF_VAR_1ST_DEF; } } break; } } } static void process_returns(void) { chunk_t *pc; pc = chunk_get_head(); while (pc != NULL) { if ((pc->type != CT_RETURN) || (pc->flags & PCF_IN_PREPROC)) { pc = chunk_get_next_type(pc, CT_RETURN, -1); continue; } pc = process_return(pc); } } /** * Processes a return statement, labeling the parens and marking the parent. * May remove or add parens around the return statement * * @param pc Pointer to the return chunk */ static chunk_t *process_return(chunk_t *pc) { chunk_t *next; chunk_t *temp; chunk_t *semi; chunk_t *cpar; chunk_t chunk; /* grab next and bail if it is a semicolon */ next = chunk_get_next_ncnl(pc); if ((next == NULL) || chunk_is_semicolon(next)) { return(next); } if (cpd.settings[UO_nl_return_expr].a != AV_IGNORE) { newline_iarf(pc, cpd.settings[UO_nl_return_expr].a); } if (next->type == CT_PAREN_OPEN) { /* See if the return is fully paren'd */ cpar = chunk_get_next_type(next, CT_PAREN_CLOSE, next->level); semi = chunk_get_next_ncnl(cpar); if (chunk_is_semicolon(semi)) { if (cpd.settings[UO_mod_paren_on_return].a == AV_REMOVE) { LOG_FMT(LRETURN, "%s: removing parens on line %d\n", __func__, pc->orig_line); /* lower the level of everything */ for (temp = next; temp != cpar; temp = chunk_get_next(temp)) { temp->level--; } /* delete the parens */ chunk_del(next); chunk_del(cpar); /* back up the semicolon */ semi->column--; semi->orig_col--; semi->orig_col_end--; } else { LOG_FMT(LRETURN, "%s: keeping parens on line %d\n", __func__, pc->orig_line); /* mark & keep them */ next->parent_type = CT_RETURN; cpar->parent_type = CT_RETURN; } return(semi); } } /* We don't have a fully paren'd return. Should we add some? */ if ((cpd.settings[UO_mod_paren_on_return].a & AV_ADD) == 0) { return(next); } /* find the next semicolon on the same level */ semi = next; while ((semi = chunk_get_next(semi)) != NULL) { if ((chunk_is_semicolon(semi) && (pc->level == semi->level)) || (semi->level < pc->level)) { break; } } if (chunk_is_semicolon(semi) && (pc->level == semi->level)) { /* add the parens */ chunk.type = CT_PAREN_OPEN; chunk.str = "("; chunk.level = pc->level; chunk.brace_level = pc->brace_level; chunk.orig_line = pc->orig_line; chunk.parent_type = CT_RETURN; chunk.flags = pc->flags & PCF_COPY_FLAGS; chunk_add_before(&chunk, next); chunk.type = CT_PAREN_CLOSE; chunk.str = ")"; chunk.orig_line = semi->orig_line; cpar = chunk_add_before(&chunk, semi); LOG_FMT(LRETURN, "%s: added parens on line %d\n", __func__, pc->orig_line); for (temp = next; temp != cpar; temp = chunk_get_next(temp)) { temp->level++; } } return(semi); } static bool is_ucase_str(const char *str, int len) { while (len-- > 0) { if (unc_toupper(*str) != *str) { return(false); } str++; } return(true); } static bool is_oc_block(chunk_t *pc) { return((pc != NULL) && ((pc->parent_type == CT_OC_BLOCK_TYPE) || (pc->parent_type == CT_OC_BLOCK_EXPR) || (pc->parent_type == CT_OC_BLOCK_ARG) || (pc->type == CT_OC_BLOCK_CARET) || (pc->next && pc->next->type == CT_OC_BLOCK_CARET) || (pc->prev && pc->prev->type == CT_OC_BLOCK_CARET))); } /** * Checks to see if the current paren is part of a cast. * We already verified that this doesn't follow function, TYPE, IF, FOR, * SWITCH, or WHILE and is followed by WORD, TYPE, STRUCT, ENUM, or UNION. * * @param start Pointer to the open paren */ static void fix_casts(chunk_t *start) { chunk_t *pc; chunk_t *prev; chunk_t *first; chunk_t *after; chunk_t *last = NULL; chunk_t *paren_close; const char *verb = "likely"; const char *detail = ""; int count = 0; int word_count = 0; int word_consec = 0; bool nope; bool doubtful_cast = false; LOG_FMT(LCASTS, "%s:line %d, col %d:", __func__, start->orig_line, start->orig_col); prev = chunk_get_prev_ncnl(start); if ((prev != NULL) && (prev->type == CT_PP_DEFINED)) { LOG_FMT(LCASTS, " -- not a cast - after defined\n"); return; } /* Make sure there is only WORD, TYPE, and '*' before the close paren */ pc = chunk_get_next_ncnl(start); first = pc; while ((pc != NULL) && (chunk_is_type(pc) || (pc->type == CT_WORD) || (pc->type == CT_QUALIFIER) || (pc->type == CT_DC_MEMBER) || (pc->type == CT_STAR))) { LOG_FMT(LCASTS, " [%s]", get_token_name(pc->type)); if (pc->type == CT_WORD) { word_count++; word_consec++; } else if (pc->type == CT_DC_MEMBER) { word_count--; } else { word_consec = 0; } last = pc; pc = chunk_get_next_ncnl(pc); count++; } if ((pc == NULL) || (pc->type != CT_PAREN_CLOSE) || (prev->type == CT_OC_CLASS)) { LOG_FMT(LCASTS, " -- not a cast, hit [%s]\n", pc == NULL ? "NULL" : get_token_name(pc->type)); return; } if (word_count > 1) { LOG_FMT(LCASTS, " -- too many words: %d\n", word_count); return; } paren_close = pc; /* If last is a type or star, we have a cast for sure */ if ((last->type == CT_STAR) || (last->type == CT_PTR_TYPE) || (last->type == CT_TYPE)) { verb = "for sure"; } else if (count == 1) { /** * We are on a potential cast of the form "(word)". * We don't know if the word is a type. So lets guess based on some * simple rules: * - if all caps, likely a type * - if it ends in _t, likely a type */ verb = "guessed"; if ((last->len() > 3) && (last->str[last->len() - 2] == '_') && (last->str[last->len() - 1] == 't')) { detail = " -- '_t'"; } else if (is_ucase_str(last->text(), last->len())) { detail = " -- upper case"; } else { /* If we can't tell for sure whether this is a cast, decide against it */ detail = " -- mixed case"; doubtful_cast = true; } /** * If the next item is a * or &, the next item after that can't be a * number or string. * * If the next item is a +, the next item has to be a number. * * If the next item is a -, the next item can't be a string. * * For this to be a cast, the close paren must be followed by: * - constant (number or string) * - paren open * - word * * Find the next non-open paren item. */ pc = chunk_get_next_ncnl(paren_close); after = pc; do { after = chunk_get_next_ncnl(after); } while ((after != NULL) && (after->type == CT_PAREN_OPEN)); if (after == NULL) { LOG_FMT(LCASTS, " -- not a cast - hit NULL\n"); return; } nope = false; if (chunk_is_star(pc) || chunk_is_addr(pc)) { /* star (*) and addr (&) are ambiguous */ if ((after->type == CT_NUMBER_FP) || (after->type == CT_NUMBER) || (after->type == CT_STRING) || doubtful_cast) { nope = true; } } else if (pc->type == CT_MINUS) { /* (UINT8)-1 or (foo)-1 or (FOO)-'a' */ if ((after->type == CT_STRING) || doubtful_cast) { nope = true; } } else if (pc->type == CT_PLUS) { /* (UINT8)+1 or (foo)+1 */ if (((after->type != CT_NUMBER) && (after->type != CT_NUMBER_FP)) || doubtful_cast) { nope = true; } } else if ((pc->type != CT_NUMBER_FP) && (pc->type != CT_NUMBER) && (pc->type != CT_WORD) && (pc->type != CT_PAREN_OPEN) && (pc->type != CT_STRING) && (pc->type != CT_SIZEOF) && (pc->type != CT_FUNC_CALL) && (pc->type != CT_FUNC_CALL_USER) && (pc->type != CT_FUNCTION) && (pc->type != CT_BRACE_OPEN)) { LOG_FMT(LCASTS, " -- not a cast - followed by '%s' %s\n", pc->str.c_str(), get_token_name(pc->type)); return; } if (nope) { LOG_FMT(LCASTS, " -- not a cast - '%s' followed by %s\n", pc->str.c_str(), get_token_name(after->type)); return; } } start->parent_type = CT_C_CAST; paren_close->parent_type = CT_C_CAST; LOG_FMT(LCASTS, " -- %s c-cast: (", verb); for (pc = first; pc != paren_close; pc = chunk_get_next_ncnl(pc)) { pc->parent_type = CT_C_CAST; make_type(pc); LOG_FMT(LCASTS, " %s", pc->str.c_str()); } LOG_FMT(LCASTS, " )%s\n", detail); /* Mark the next item as an expression start */ pc = chunk_get_next_ncnl(paren_close); if (pc != NULL) { pc->flags |= PCF_EXPR_START; if (chunk_is_opening_brace(pc)) { set_paren_parent(pc, start->parent_type); } } } /** * CT_TYPE_CAST follows this pattern: * dynamic_cast<...>(...) * * Mark everything between the <> as a type and set the paren parent */ static void fix_type_cast(chunk_t *start) { chunk_t *pc; pc = chunk_get_next_ncnl(start); if ((pc == NULL) || (pc->type != CT_ANGLE_OPEN)) { return; } while (((pc = chunk_get_next_ncnl(pc)) != NULL) && (pc->level >= start->level)) { if ((pc->level == start->level) && (pc->type == CT_ANGLE_CLOSE)) { pc = chunk_get_next_ncnl(pc); if (chunk_is_str(pc, "(", 1)) { set_paren_parent(pc, CT_TYPE_CAST); } return; } make_type(pc); } } /** * We are on an enum/struct/union tag that is NOT inside a typedef. * If there is a {...} and words before the ';', then they are variables. * * tag { ... } [*] word [, [*]word] ; * tag [word/type] { ... } [*] word [, [*]word] ; * enum [word/type [: int_type]] { ... } [*] word [, [*]word] ; * tag [word/type] [word]; -- this gets caught later. * fcn(tag [word/type] [word]) * a = (tag [word/type] [*])&b; * * REVISIT: should this be consolidated with the typedef code? */ static void fix_enum_struct_union(chunk_t *pc) { chunk_t *next; int flags = PCF_VAR_1ST_DEF; int in_fcn_paren = pc->flags & PCF_IN_FCN_DEF; /* Make sure this wasn't a cast */ if (pc->parent_type == CT_C_CAST) { return; } /* the next item is either a type or open brace */ next = chunk_get_next_ncnl(pc); if (next && (next->type == CT_TYPE)) { next->parent_type = pc->type; next = chunk_get_next_ncnl(next); /* next up is either a colon, open brace, or open paren (pawn) */ if (!next) { return; } else if (((cpd.lang_flags & LANG_PAWN) != 0) && (next->type == CT_PAREN_OPEN)) { next = set_paren_parent(next, CT_ENUM); } else if ((pc->type == CT_ENUM) && (next->type == CT_COLON)) { /* enum TYPE : INT_TYPE { */ next = chunk_get_next_ncnl(next); if (next) { make_type(next); next = chunk_get_next_ncnl(next); } } } if (next && (next->type == CT_BRACE_OPEN)) { flag_parens(next, (pc->type == CT_ENUM) ? PCF_IN_ENUM : PCF_IN_STRUCT, CT_NONE, CT_NONE, false); if ((pc->type == CT_UNION) || (pc->type == CT_STRUCT)) { mark_struct_union_body(next); } /* Skip to the closing brace */ next->parent_type = pc->type; next = chunk_get_next_type(next, CT_BRACE_CLOSE, pc->level); flags |= PCF_VAR_INLINE; if (next != NULL) { next->parent_type = pc->type; next = chunk_get_next_ncnl(next); } } if ((next == NULL) || (next->type == CT_PAREN_CLOSE)) { return; } if (!chunk_is_semicolon(next)) { /* Pawn does not require a semicolon after an enum */ if (cpd.lang_flags & LANG_PAWN) { return; } /* D does not require a semicolon after an enum, but we add one to make * other code happy. */ if (cpd.lang_flags & LANG_D) { next = pawn_add_vsemi_after(chunk_get_prev_ncnl(next)); } } /* We are either pointing to a ';' or a variable */ while ((next != NULL) && !chunk_is_semicolon(next) && (next->type != CT_ASSIGN) && ((in_fcn_paren ^ (next->flags & PCF_IN_FCN_DEF)) == 0)) { if (next->level == pc->level) { if (next->type == CT_WORD) { next->flags |= flags; flags &= ~PCF_VAR_1ST; /* clear the first flag for the next items */ } if (next->type == CT_STAR) { next->type = CT_PTR_TYPE; } /* If we hit a comma in a function param, we are done */ if (((next->type == CT_COMMA) || (next->type == CT_FPAREN_CLOSE)) && ((next->flags & (PCF_IN_FCN_DEF | PCF_IN_FCN_CALL)) != 0)) { return; } } next = chunk_get_next_ncnl(next); } if (next && (next->type == CT_SEMICOLON)) { next->parent_type = pc->type; } } /** * We are on a typedef. * If the next word is not enum/union/struct, then the last word before the * next ',' or ';' or '__attribute__' is a type. * * typedef [type...] [*] type [, [*]type] ; * typedef ([*]func)(params); * typedef [type] [*] type [, [*]type] ; * typedef [type] { ... } [*] type [, [*]type] ; */ static void fix_typedef(chunk_t *start) { chunk_t *next; chunk_t *prev; chunk_t *the_type = NULL; chunk_t *open_paren; c_token_t tag; LOG_FMT(LTYPEDEF, "%s: looking at line %d\n", __func__, start->orig_line); /* Mark everything in the typedef and scan for ")(", which makes it a * function type */ next = start; while (((next = chunk_get_next_ncnl(next)) != NULL) && (next->level >= start->level)) { next->flags |= PCF_IN_TYPEDEF; if (start->level == next->level) { if (chunk_is_semicolon(next)) { next->parent_type = CT_TYPEDEF; break; } if (next->type == CT_ATTRIBUTE) { break; } if ((cpd.lang_flags & LANG_D) && (next->type == CT_ASSIGN)) { next->parent_type = CT_TYPEDEF; break; } make_type(next); if (next->type == CT_TYPE) { the_type = next; } next->flags &= ~PCF_VAR_1ST_DEF; if (*next->str == '(') { prev = chunk_get_prev_ncnl(next); if (*prev->str != ')') { continue; } prev->parent_type = CT_TYPEDEF; open_paren = chunk_get_prev_type(prev, c_token_t(prev->type - 1), prev->level); open_paren->parent_type = CT_TYPEDEF; flag_parens(next, 0, CT_FPAREN_OPEN, CT_TYPEDEF, false); fix_fcn_def_params(next); /* Grab the type name (right before the close paren */ the_type = chunk_get_prev_ncnl(prev); LOG_FMT(LTYPEDEF, "%s: fcn typedef [%s] on line %d\n", __func__, the_type->str.c_str(), the_type->orig_line); /* If we are aligning on the open paren, grab that instead */ if (cpd.settings[UO_align_typedef_func].n == 1) { the_type = open_paren; } if (cpd.settings[UO_align_typedef_func].n != 0) { the_type->flags |= PCF_ANCHOR; } /* already did everything we need to do */ return; } } } /** * Skip over enum/struct/union stuff, as we know it isn't a return type * for a function type */ next = chunk_get_next_ncnl(start); if ((next->type != CT_ENUM) && (next->type != CT_STRUCT) && (next->type != CT_UNION)) { if (the_type != NULL) { /* We have just a regular typedef */ LOG_FMT(LTYPEDEF, "%s: regular typedef [%s] on line %d\n", __func__, the_type->str.c_str(), the_type->orig_line); the_type->flags |= PCF_ANCHOR; } return; } /* We have a struct/union/enum type, set the parent */ tag = next->type; /* the next item should be either a type or { */ next = chunk_get_next_ncnl(next); if (next->type == CT_TYPE) { next = chunk_get_next_ncnl(next); } if (next->type == CT_BRACE_OPEN) { next->parent_type = tag; /* Skip to the closing brace */ next = chunk_get_next_type(next, CT_BRACE_CLOSE, next->level); if (next != NULL) { next->parent_type = tag; } } if (the_type != NULL) { LOG_FMT(LTYPEDEF, "%s: %s typedef [%s] on line %d\n", __func__, get_token_name(tag), the_type->str.c_str(), the_type->orig_line); the_type->flags |= PCF_ANCHOR; } } /** * Examines the whole file and changes CT_COLON to * CT_Q_COLON, CT_LABEL_COLON, or CT_CASE_COLON. * It also changes the CT_WORD before CT_LABEL_COLON into CT_LABEL. */ void combine_labels(void) { chunk_t *cur; chunk_t *prev; chunk_t *next; chunk_t *tmp; int question_count = 0; bool hit_case = false; bool hit_class = false; prev = chunk_get_head(); cur = chunk_get_next_nc(prev); next = chunk_get_next_nc(cur); /* unlikely that the file will start with a label... */ while (next != NULL) { if (!(next->flags & PCF_IN_OC_MSG) && /* filter OC case of [self class] msg send */ ((next->type == CT_CLASS) || (next->type == CT_OC_CLASS) || (next->type == CT_TEMPLATE))) { hit_class = true; } if (chunk_is_semicolon(next) || (next->type == CT_BRACE_OPEN)) { hit_class = false; } if (next->type == CT_QUESTION) { question_count++; } else if (next->type == CT_CASE) { if (cur->type == CT_GOTO) { /* handle "goto case x;" */ next->type = CT_QUALIFIER; } else { hit_case = true; } } else if (next->type == CT_COLON) { if (cur->type == CT_DEFAULT) { cur->type = CT_CASE; hit_case = true; } if (question_count > 0) { next->type = CT_COND_COLON; question_count--; } else if (hit_case) { hit_case = false; next->type = CT_CASE_COLON; tmp = chunk_get_next_ncnl(next); if ((tmp != NULL) && (tmp->type == CT_BRACE_OPEN)) { tmp->parent_type = CT_CASE; tmp = chunk_get_next_type(tmp, CT_BRACE_CLOSE, tmp->level); if (tmp != NULL) { tmp->parent_type = CT_CASE; } } } else { chunk_t *nextprev = chunk_get_prev_ncnl(next); if ((cpd.lang_flags & LANG_PAWN) != 0) { if ((cur->type == CT_WORD) || (cur->type == CT_BRACE_CLOSE)) { c_token_t new_type = CT_TAG; tmp = chunk_get_next_nc(next); if (chunk_is_newline(prev) && chunk_is_newline(tmp)) { new_type = CT_LABEL; next->type = CT_LABEL_COLON; } else { next->type = CT_TAG_COLON; } if (cur->type == CT_WORD) { cur->type = new_type; } } } else if (next->flags & PCF_IN_ARRAY_ASSIGN) { next->type = CT_D_ARRAY_COLON; } else if (cur->type == CT_WORD) { tmp = chunk_get_next_nc(next, CNAV_PREPROC); if (chunk_is_newline(prev) && ((tmp == NULL) || (tmp->type != CT_NUMBER))) { cur->type = CT_LABEL; next->type = CT_LABEL_COLON; } else if (next->flags & PCF_IN_FCN_CALL) { /* Must be a macro thingy, assume some sort of label */ next->type = CT_LABEL_COLON; } else { next->type = CT_BIT_COLON; tmp = chunk_get_next(next); while ((tmp = chunk_get_next(tmp)) != NULL) { if (tmp->type == CT_SEMICOLON) { break; } if (tmp->type == CT_COLON) { tmp->type = CT_BIT_COLON; } } } } else if (nextprev->type == CT_FPAREN_CLOSE) { /* it's a class colon */ next->type = CT_CLASS_COLON; } else if (next->level > next->brace_level) { /* ignore it, as it is inside a paren */ } else if (cur->type == CT_TYPE) { next->type = CT_BIT_COLON; } else if ((cur->type == CT_ENUM) || (cur->type == CT_PRIVATE) || (cur->type == CT_QUALIFIER) || (cur->parent_type == CT_ALIGN)) { /* ignore it - bit field, align or public/private, etc */ } else if ((cur->type == CT_ANGLE_CLOSE) || hit_class) { /* ignore it - template thingy */ } else if (cur->parent_type == CT_SQL_EXEC) { /* ignore it - SQL variable name */ } else if (next->parent_type == CT_ASSERT) { /* ignore it - Java assert thing */ } else { tmp = chunk_get_next_ncnl(next); if ((tmp != NULL) && ((tmp->type == CT_BASE) || (tmp->type == CT_THIS))) { /* ignore it, as it is a C# base thingy */ } else { LOG_FMT(LWARN, "%s:%d unexpected colon in col %d n-parent=%s c-parent=%s l=%d bl=%d\n", cpd.filename, next->orig_line, next->orig_col, get_token_name(next->parent_type), get_token_name(cur->parent_type), next->level, next->brace_level); cpd.error_count++; } } } } prev = cur; cur = next; next = chunk_get_next_nc(cur); } } static void mark_variable_stack(ChunkStack& cs, log_sev_t sev) { chunk_t *var_name; chunk_t *word_type; /* throw out the last word and mark the rest */ var_name = cs.Pop(); if (var_name != NULL) { LOG_FMT(LFCNP, "%s: parameter on line %d :", __func__, var_name->orig_line); while ((word_type = cs.Pop()) != NULL) { LOG_FMT(LFCNP, " <%s>", word_type->str.c_str()); word_type->type = CT_TYPE; word_type->flags |= PCF_VAR_TYPE; } LOG_FMT(LFCNP, " [%s]\n", var_name->str.c_str()); var_name->flags |= PCF_VAR_DEF; } } /** * Simply change any STAR to PTR_TYPE and WORD to TYPE * * @param start points to the open paren */ static void fix_fcn_def_params(chunk_t *start) { LOG_FMT(LFCNP, "%s: %s [%s] on line %d, level %d\n", __func__, start->str.c_str(), get_token_name(start->type), start->orig_line, start->level); while ((start != NULL) && !chunk_is_paren_open(start)) { start = chunk_get_next_ncnl(start); } assert((start->len() == 1) && (start->str[0] == '(')); ChunkStack cs; int level = start->level + 1; chunk_t *pc = start; while ((pc = chunk_get_next_ncnl(pc)) != NULL) { if (((start->len() == 1) && (start->str[0] == ')')) || (pc->level < level)) { LOG_FMT(LFCNP, "%s: bailed on %s on line %d\n", __func__, pc->str.c_str(), pc->orig_line); break; } LOG_FMT(LFCNP, "%s: %s %s on line %d, level %d\n", __func__, (pc->level > level) ? "skipping" : "looking at", pc->str.c_str(), pc->orig_line, pc->level); if (pc->level > level) { continue; } if (chunk_is_star(pc)) { pc->type = CT_PTR_TYPE; } else if (pc->type == CT_AMP) { pc->type = CT_BYREF; } else if ((pc->type == CT_WORD) || (pc->type == CT_TYPE)) { cs.Push(pc); } else if ((pc->type == CT_COMMA) || (pc->type == CT_ASSIGN)) { mark_variable_stack(cs, LFCNP); if (pc->type == CT_ASSIGN) { /* Mark assignment for default param spacing */ pc->parent_type = CT_FUNC_PROTO; } } } mark_variable_stack(cs, LFCNP); } //#define DEBUG_FIX_VAR_DEF /** * Skips to the start of the next statement. */ static chunk_t *skip_to_next_statement(chunk_t *pc) { while ((pc != NULL) && !chunk_is_semicolon(pc) && (pc->type != CT_BRACE_OPEN) && (pc->type != CT_BRACE_CLOSE)) { pc = chunk_get_next_ncnl(pc); } return(pc); } /** * We are on the start of a sequence that could be a var def * - FPAREN_OPEN (parent == CT_FOR) * - BRACE_OPEN * - SEMICOLON * */ static chunk_t *fix_var_def(chunk_t *start) { chunk_t *pc = start; chunk_t *end; chunk_t *tmp_pc; ChunkStack cs; int idx, ref_idx; LOG_FMT(LFVD, "%s: top[%d]", __func__, pc->orig_line); /* Scan for words and types and stars oh my! */ while ((pc != NULL) && ((pc->type == CT_TYPE) || (pc->type == CT_WORD) || (pc->type == CT_QUALIFIER) || (pc->type == CT_DC_MEMBER) || (pc->type == CT_MEMBER) || chunk_is_addr(pc) || chunk_is_star(pc))) { LOG_FMT(LFVD, " %s[%s]", pc->str.c_str(), get_token_name(pc->type)); cs.Push(pc); pc = chunk_get_next_ncnl(pc); /* Skip templates and attributes */ pc = skip_template_next(pc); pc = skip_attribute_next(pc); } end = pc; LOG_FMT(LFVD, " end=[%s]\n", (end != NULL) ? get_token_name(end->type) : "NULL"); if (end == NULL) { return(NULL); } /* Function defs are handled elsewhere */ if ((cs.Len() <= 1) || (end->type == CT_FUNC_DEF) || (end->type == CT_FUNC_PROTO) || (end->type == CT_FUNC_CLASS) || (end->type == CT_OPERATOR)) { return(skip_to_next_statement(end)); } /* ref_idx points to the alignable part of the var def */ ref_idx = cs.Len() - 1; /* Check for the '::' stuff: "char *Engine::name" */ if ((cs.Len() >= 3) && ((cs.Get(cs.Len() - 2)->m_pc->type == CT_MEMBER) || (cs.Get(cs.Len() - 2)->m_pc->type == CT_DC_MEMBER))) { idx = cs.Len() - 2; while (idx > 0) { tmp_pc = cs.Get(idx)->m_pc; if ((tmp_pc->type != CT_DC_MEMBER) && (tmp_pc->type != CT_MEMBER)) { break; } idx--; tmp_pc = cs.Get(idx)->m_pc; if ((tmp_pc->type != CT_WORD) && (tmp_pc->type != CT_TYPE)) { break; } make_type(tmp_pc); idx--; } ref_idx = idx + 1; } tmp_pc = cs.Get(ref_idx)->m_pc; LOG_FMT(LFVD, " ref_idx(%d) => %s\n", ref_idx, tmp_pc->str.c_str()); /* No type part found! */ if (ref_idx <= 0) { return(skip_to_next_statement(end)); } LOG_FMT(LFVD2, "%s:%d TYPE : ", __func__, start->orig_line); for (idx = 0; idx < cs.Len() - 1; idx++) { tmp_pc = cs.Get(idx)->m_pc; make_type(tmp_pc); tmp_pc->flags |= PCF_VAR_TYPE; LOG_FMT(LFVD2, " %s[%s]", tmp_pc->str.c_str(), get_token_name(tmp_pc->type)); } LOG_FMT(LFVD2, "\n"); /** * OK we have two or more items, mark types up to the end. */ mark_variable_definition(cs.Get(cs.Len() - 1)->m_pc); if (end->type == CT_COMMA) { return(chunk_get_next_ncnl(end)); } return(skip_to_next_statement(end)); } /** * Skips everything until a comma or semicolon at the same level. * Returns the semicolon, comma, or close brace/paren or NULL. */ static chunk_t *skip_expression(chunk_t *start) { chunk_t *pc = start; while ((pc != NULL) && (pc->level >= start->level)) { if ((pc->level == start->level) && (chunk_is_semicolon(pc) || (pc->type == CT_COMMA))) { return(pc); } pc = chunk_get_next_ncnl(pc); } return(pc); } /** * We are on the first word of a variable definition. * Mark all the variable names with PCF_VAR_1ST and PCF_VAR_DEF as appropriate. * Also mark any '*' encountered as a CT_PTR_TYPE. * Skip over []. Go until a ';' is hit. * * Example input: * int a = 3, b, c = 2; ## called with 'a' * foo_t f = {1, 2, 3}, g = {5, 6, 7}; ## called with 'f' * struct {...} *a, *b; ## called with 'a' or '*' * myclass a(4); */ static chunk_t *mark_variable_definition(chunk_t *start) { chunk_t *pc = start; int flags = PCF_VAR_1ST_DEF; if (start == NULL) { return(NULL); } LOG_FMT(LVARDEF, "%s: line %d, col %d '%s' type %s\n", __func__, pc->orig_line, pc->orig_col, pc->str.c_str(), get_token_name(pc->type)); pc = start; while ((pc != NULL) && !chunk_is_semicolon(pc) && (pc->level == start->level)) { if ((pc->type == CT_WORD) || (pc->type == CT_FUNC_CTOR_VAR)) { UINT64 flg = pc->flags; if ((pc->flags & PCF_IN_ENUM) == 0) { pc->flags |= flags; } flags &= ~PCF_VAR_1ST; LOG_FMT(LVARDEF, "%s:%d marked '%s'[%s] in col %d flags: %#"PRIx64" -> %#"PRIx64"\n", __func__, pc->orig_line, pc->str.c_str(), get_token_name(pc->type), pc->orig_col, flg, pc->flags); } else if (chunk_is_star(pc)) { pc->type = CT_PTR_TYPE; } else if (chunk_is_addr(pc)) { pc->type = CT_BYREF; } else if ((pc->type == CT_SQUARE_OPEN) || (pc->type == CT_ASSIGN)) { pc = skip_expression(pc); continue; } pc = chunk_get_next_ncnl(pc); } return(pc); } /** * Checks to see if a series of chunks could be a C++ parameter * FOO foo(5, &val); * * WORD means CT_WORD or CT_TYPE * * "WORD WORD" ==> true * "QUALIFIER ??" ==> true * "TYPE" ==> true * "WORD" ==> true * "WORD.WORD" ==> true * "WORD::WORD" ==> true * "WORD * WORD" ==> true * "WORD & WORD" ==> true * "NUMBER" ==> false * "STRING" ==> false * "OPEN PAREN" ==> false * * @param start the first chunk to look at * @param end the chunk after the last one to look at */ static bool can_be_full_param(chunk_t *start, chunk_t *end) { chunk_t *pc; chunk_t *last; int word_cnt = 0; int type_count = 0; bool ret; LOG_FMT(LFPARAM, "%s:", __func__); for (pc = start; pc != end; pc = chunk_get_next_ncnl(pc, CNAV_PREPROC)) { LOG_FMT(LFPARAM, " [%s]", pc->str.c_str()); if ((pc->type == CT_QUALIFIER) || (pc->type == CT_STRUCT) || (pc->type == CT_ENUM) || (pc->type == CT_UNION)) { LOG_FMT(LFPARAM, " <== %s!\n", get_token_name(pc->type)); return(true); } if ((pc->type == CT_WORD) || (pc->type == CT_TYPE)) { word_cnt++; if (pc->type == CT_TYPE) { type_count++; } } else if ((pc->type == CT_MEMBER) || (pc->type == CT_DC_MEMBER)) { if (word_cnt > 0) { word_cnt--; } } else if ((pc != start) && (chunk_is_star(pc) || chunk_is_addr(pc))) { /* chunk is OK */ } else if (pc->type == CT_ASSIGN) { /* chunk is OK (default values) */ break; } else if (pc->type == CT_ANGLE_OPEN) { LOG_FMT(LFPARAM, " <== template\n"); return(true); } else if (pc->type == CT_ELLIPSIS) { LOG_FMT(LFPARAM, " <== elipses\n"); return(true); } else if ((word_cnt == 1) && (pc->type == CT_PAREN_OPEN)) { /* Check for func proto param 'void (*name)' or 'void (*name)(params)' */ chunk_t *tmp1 = chunk_get_next_ncnl(pc, CNAV_PREPROC); chunk_t *tmp2 = chunk_get_next_ncnl(tmp1, CNAV_PREPROC); chunk_t *tmp3 = chunk_get_next_ncnl(tmp2, CNAV_PREPROC); if (!chunk_is_str(tmp3, ")", 1) || !chunk_is_str(tmp1, "*", 1) || (tmp2->type != CT_WORD)) { LOG_FMT(LFPARAM, " <== [%s] not fcn type!\n", get_token_name(pc->type)); return(false); } LOG_FMT(LFPARAM, " "); tmp1 = chunk_get_next_ncnl(tmp3, CNAV_PREPROC); tmp2 = chunk_get_next_ncnl(tmp1, CNAV_PREPROC); if (chunk_is_str(tmp1, "(", 1)) { tmp3 = chunk_skip_to_match(tmp1, CNAV_PREPROC); } pc = tmp3; } else if ((word_cnt == 1) && (pc->type == CT_TSQUARE)) { /* ignore it */ } else if ((word_cnt == 1) && (pc->type == CT_SQUARE_OPEN)) { /* skip over any array stuff */ pc = chunk_skip_to_match(pc, CNAV_PREPROC); } else { LOG_FMT(LFPARAM, " <== [%s] no way!\n", get_token_name(pc->type)); return(false); } } last = chunk_get_prev_ncnl(pc); if (chunk_is_star(last) || chunk_is_addr(last)) { LOG_FMT(LFPARAM, " <== [%s] sure!\n", get_token_name(pc->type)); return(true); } ret = ((word_cnt >= 2) || ((word_cnt == 1) && (type_count == 1))); LOG_FMT(LFPARAM, " <== [%s] %s!\n", get_token_name(pc->type), ret ? "Yup" : "Unlikely"); return(ret); } /** * We are on a function word. we need to: * - find out if this is a call or prototype or implementation * - mark return type * - mark parameter types * - mark brace pair * * REVISIT: * This whole function is a mess. * It needs to be reworked to eliminate duplicate logic and determine the * function type more directly. * 1. Skip to the close paren and see what is after. * a. semicolon - function call or function proto * b. open brace - function call (ie, list_for_each) or function def * c. open paren - function type or chained function call * d. qualifier - function def or proto, continue to semicolon or open brace * 2. Examine the 'parameters' to see if it can be a proto/def * 3. Examine what is before the function name to see if it is a proto or call * Constructor/destructor detection should have already been done when the * 'class' token was encountered (see mark_class_ctor). */ static void mark_function(chunk_t *pc) { chunk_t *prev; chunk_t *next; chunk_t *tmp; chunk_t *semi = NULL; chunk_t *paren_open; chunk_t *paren_close; chunk_t *pc_op = NULL; prev = chunk_get_prev_ncnlnp(pc); next = chunk_get_next_ncnlnp(pc); /* Find out what is before the operator */ if (pc->parent_type == CT_OPERATOR) { pc_op = chunk_get_prev_type(pc, CT_OPERATOR, pc->level); if ((pc_op != NULL) && (pc_op->flags & PCF_EXPR_START)) { pc->type = CT_FUNC_CALL; } if (cpd.lang_flags & LANG_CPP) { tmp = pc; while ((tmp = chunk_get_prev_ncnl(tmp)) != NULL) { if ((tmp->type == CT_BRACE_CLOSE) || (tmp->type == CT_SEMICOLON)) { break; } if (tmp->type == CT_ASSIGN) { pc->type = CT_FUNC_CALL; break; } if (tmp->type == CT_TEMPLATE) { pc->type = CT_FUNC_DEF; break; } if (tmp->type == CT_BRACE_OPEN) { if (tmp->parent_type == CT_FUNC_DEF) { pc->type = CT_FUNC_CALL; } if ((tmp->parent_type == CT_CLASS) || (tmp->parent_type == CT_STRUCT)) { pc->type = CT_FUNC_DEF; } break; } } if ((tmp != NULL) && (pc->type != CT_FUNC_CALL)) { /* Mark the return type */ while ((tmp = chunk_get_next_ncnl(tmp)) != pc) { make_type(tmp); } } } } if (chunk_is_star(next) || chunk_is_addr(next)) { next = chunk_get_next_ncnlnp(next); } LOG_FMT(LFCN, "%s: %d] %s[%s] - parent=%s level=%d/%d, next=%s[%s] - level=%d\n", __func__, pc->orig_line, pc->str.c_str(), get_token_name(pc->type), get_token_name(pc->parent_type), pc->level, pc->brace_level, next->str.c_str(), get_token_name(next->type), next->level); if (pc->flags & PCF_IN_CONST_ARGS) { pc->type = CT_FUNC_CTOR_VAR; LOG_FMT(LFCN, " 1) Marked [%s] as FUNC_CTOR_VAR on line %d col %d\n", pc->str.c_str(), pc->orig_line, pc->orig_col); next = skip_template_next(next); flag_parens(next, 0, CT_FPAREN_OPEN, pc->type, true); return; } /* Skip over any template and attribute madness */ next = skip_template_next(next); next = skip_attribute_next(next); /* Find the open and close paren */ paren_open = chunk_get_next_str(pc, "(", 1, pc->level); paren_close = chunk_get_next_str(paren_open, ")", 1, pc->level); if ((paren_open == NULL) || (paren_close == NULL)) { LOG_FMT(LFCN, "No parens found for [%s] on line %d col %d\n", pc->str.c_str(), pc->orig_line, pc->orig_col); return; } /** * This part detects either chained function calls or a function ptr definition. * MYTYPE (*func)(void); * mWriter( "class Clst_"c )( somestr.getText() )( " : Cluster {"c ).newline; * * For it to be a function variable def, there must be a '*' followed by a * single word. * * Otherwise, it must be chained function calls. */ tmp = chunk_get_next_ncnl(paren_close); if (chunk_is_str(tmp, "(", 1)) { chunk_t *tmp1, *tmp2, *tmp3; tmp1 = next; do { tmp1 = chunk_get_next_ncnl(tmp1); } while ((tmp1 != NULL) && ((tmp1->type == CT_WORD) || (tmp1->type == CT_DC_MEMBER))); tmp2 = chunk_get_next_ncnl(tmp1); if (chunk_is_str(tmp2, ")", 1)) { tmp3 = tmp2; tmp2 = NULL; } else { tmp3 = chunk_get_next_ncnl(tmp2); } if (chunk_is_str(tmp3, ")", 1) && chunk_is_star(tmp1) && ((tmp2 == NULL) || (tmp2->type == CT_WORD))) { if (tmp2 != NULL) { LOG_FMT(LFCN, "%s: [%d/%d] function variable [%s], changing [%s] into a type\n", __func__, pc->orig_line, pc->orig_col, tmp2->str.c_str(), pc->str.c_str()); } else { LOG_FMT(LFCN, "%s: [%d/%d] function type, changing [%s] into a type\n", __func__, pc->orig_line, pc->orig_col, pc->str.c_str()); } pc->type = CT_TYPE; tmp1->type = CT_PTR_TYPE; pc->flags &= ~PCF_VAR_1ST_DEF; if (tmp2 != NULL) { tmp2->flags |= PCF_VAR_1ST_DEF; } flag_parens(tmp, 0, CT_FPAREN_OPEN, CT_FUNC_PROTO, false); fix_fcn_def_params(tmp); return; } LOG_FMT(LFCN, "%s: chained function calls? [%d.%d] [%s]\n", __func__, pc->orig_line, pc->orig_col, pc->str.c_str()); } /* Assume it is a function call if not already labeled */ if (pc->type == CT_FUNCTION) { pc->type = (pc->parent_type == CT_OPERATOR) ? CT_FUNC_DEF : CT_FUNC_CALL; } /* Check for C++ function def */ if ((pc->type == CT_FUNC_CLASS) || ((prev != NULL) && ((prev->type == CT_DC_MEMBER) || (prev->type == CT_INV)))) { chunk_t *destr = NULL; if (prev->type == CT_INV) { /* TODO: do we care that this is the destructor? */ prev->type = CT_DESTRUCTOR; pc->type = CT_FUNC_CLASS; pc->parent_type = CT_DESTRUCTOR; destr = prev; prev = chunk_get_prev_ncnlnp(prev); } if ((prev != NULL) && (prev->type == CT_DC_MEMBER)) { prev = chunk_get_prev_ncnlnp(prev); // LOG_FMT(LSYS, "%s: prev1 = %s (%s)\n", __func__, // get_token_name(prev->type), prev->str.c_str()); prev = skip_template_prev(prev); prev = skip_attribute_prev(prev); // LOG_FMT(LSYS, "%s: prev2 = %s [%d](%s) pc = %s [%d](%s)\n", __func__, // get_token_name(prev->type), prev->len, prev->str.c_str(), // get_token_name(pc->type), pc->len, pc->str.c_str()); if ((prev != NULL) && ((prev->type == CT_WORD) || (prev->type == CT_TYPE))) { if (pc->str.equals(prev->str)) { pc->type = CT_FUNC_CLASS; LOG_FMT(LFCN, "FOUND %sSTRUCTOR for %s[%s]\n", (destr != NULL) ? "DE" : "CON", prev->str.c_str(), get_token_name(prev->type)); mark_cpp_constructor(pc); return; } else { /* Point to the item previous to the class name */ prev = chunk_get_prev_ncnlnp(prev); } } } } /* Determine if this is a function call or a function def/proto * We check for level==1 to allow the case that a function prototype is * wrapped in a macro: "MACRO(void foo(void));" */ if ((pc->type == CT_FUNC_CALL) && ((pc->level == pc->brace_level) || (pc->level == 1)) && ((pc->flags & PCF_IN_ARRAY_ASSIGN) == 0)) { bool isa_def = false; bool hit_star = false; LOG_FMT(LFCN, " Checking func call: prev=%s", (prev == NULL) ? "" : get_token_name(prev->type)); /** * REVISIT: * a function def can only occur at brace level, but not inside an * assignment, structure, enum, or union. * The close paren must be followed by an open brace, with an optional * qualifier (const) in between. * There can be all sorts of template crap and/or '[]' in the type. * This hack mostly checks that. * * Examples: * foo->bar(maid); -- fcn call * FOO * bar(); -- fcn proto or class variable * FOO foo(); -- fcn proto or class variable * FOO foo(1); -- class variable * a = FOO * bar(); -- fcn call * a.y = foo() * bar(); -- fcn call * static const char * const fizz(); -- fcn def */ while (prev != NULL) { if (prev->flags & PCF_IN_PREPROC) { prev = chunk_get_prev_ncnlnp(prev); continue; } /* Some code slips an attribute between the type and function */ if ((prev->type == CT_FPAREN_CLOSE) && (prev->parent_type == CT_ATTRIBUTE)) { prev = skip_attribute_prev(prev); continue; } /* skip const(TYPE) */ if ((prev->type == CT_PAREN_CLOSE) && (prev->parent_type == CT_D_CAST)) { LOG_FMT(LFCN, " --> For sure a prototype or definition\n"); isa_def = true; break; } /** Skip the word/type before the '.' or '::' */ if ((prev->type == CT_DC_MEMBER) || (prev->type == CT_MEMBER)) { prev = chunk_get_prev_ncnlnp(prev); if ((prev == NULL) || ((prev->type != CT_WORD) && (prev->type != CT_TYPE) && (prev->type != CT_THIS))) { LOG_FMT(LFCN, " --? Skipped MEMBER and landed on %s\n", (prev == NULL) ? "" : get_token_name(prev->type)); pc->type = CT_FUNC_CALL; isa_def = false; break; } LOG_FMT(LFCN, " ", prev->str.c_str()); prev = chunk_get_prev_ncnlnp(prev); continue; } /* If we are on a TYPE or WORD, then we must be on a proto or def */ if ((prev->type == CT_TYPE) || (prev->type == CT_WORD)) { if (!hit_star) { LOG_FMT(LFCN, " --> For sure a prototype or definition\n"); isa_def = true; break; } LOG_FMT(LFCN, " --> maybe a proto/def\n"); isa_def = true; } if (chunk_is_addr(prev) || chunk_is_star(prev)) { hit_star = true; } if ((prev->type != CT_OPERATOR) && (prev->type != CT_TSQUARE) && (prev->type != CT_ANGLE_CLOSE) && (prev->type != CT_QUALIFIER) && (prev->type != CT_TYPE) && (prev->type != CT_WORD) && !chunk_is_addr(prev) && !chunk_is_star(prev)) { LOG_FMT(LFCN, " --> Stopping on %s [%s]\n", prev->str.c_str(), get_token_name(prev->type)); break; } /* Skip over template and attribute stuff */ if (prev->type == CT_ANGLE_CLOSE) { prev = skip_template_prev(prev); } else { prev = chunk_get_prev_ncnlnp(prev); } } //LOG_FMT(LFCN, " -- stopped on %s [%s]\n", // prev->str.c_str(), get_token_name(prev->type)); if (isa_def && (prev != NULL) && ((chunk_is_paren_close(prev) && (prev->parent_type != CT_D_CAST)) || (prev->type == CT_ASSIGN) || (prev->type == CT_RETURN))) { LOG_FMT(LFCN, " -- overriding DEF due to %s [%s]\n", prev->str.c_str(), get_token_name(prev->type)); isa_def = false; } if (isa_def) { pc->type = CT_FUNC_DEF; LOG_FMT(LFCN, "%s: '%s' is FCN_DEF:", __func__, pc->str.c_str()); if (prev == NULL) { prev = chunk_get_head(); } for (tmp = prev; tmp != pc; tmp = chunk_get_next_ncnl(tmp)) { LOG_FMT(LFCN, " %s[%s]", tmp->str.c_str(), get_token_name(tmp->type)); make_type(tmp); } LOG_FMT(LFCN, "\n"); } } if (pc->type != CT_FUNC_DEF) { LOG_FMT(LFCN, " Detected %s '%s' on line %d col %d\n", get_token_name(pc->type), pc->str.c_str(), pc->orig_line, pc->orig_col); tmp = flag_parens(next, PCF_IN_FCN_CALL, CT_FPAREN_OPEN, CT_NONE, false); if ((tmp != NULL) && (tmp->type == CT_BRACE_OPEN)) { set_paren_parent(tmp, pc->type); } return; } /* We have a function definition or prototype * Look for a semicolon or a brace open after the close paren to figure * out whether this is a prototype or definition */ /* See if this is a prototype or implementation */ /* FIXME: this doesn't take the old K&R parameter definitions into account */ /* Scan tokens until we hit a brace open (def) or semicolon (proto) */ tmp = paren_close; while ((tmp = chunk_get_next_ncnl(tmp)) != NULL) { /* Only care about brace or semi on the same level */ if (tmp->level < pc->level) { /* No semicolon - guess that it is a prototype */ pc->type = CT_FUNC_PROTO; break; } else if (tmp->level == pc->level) { if (tmp->type == CT_BRACE_OPEN) { /* its a function def for sure */ break; } else if (chunk_is_semicolon(tmp)) { /* Set the parent for the semi for later */ semi = tmp; pc->type = CT_FUNC_PROTO; break; } else if (pc->type == CT_COMMA) { pc->type = CT_FUNC_CTOR_VAR; LOG_FMT(LFCN, " 2) Marked [%s] as FUNC_CTOR_VAR on line %d col %d\n", pc->str.c_str(), pc->orig_line, pc->orig_col); break; } else if (chunk_is_str(tmp, ":", 1)) { /* mark constuctor colon (?) */ tmp->type = CT_CLASS_COLON; } } } /** * C++ syntax is wacky. We need to check to see if a prototype is really a * variable definition with parameters passed into the constructor. * Unfortunately, the only mostly reliable way to do so is to guess that * it is a constructor variable if inside a function body and scan the * 'parameter list' for items that are not allowed in a prototype. * We search backwards and checking the parent of the containing open braces. * If the parent is a class or namespace, then it probably is a prototype. */ if ((cpd.lang_flags & LANG_CPP) && (pc->type == CT_FUNC_PROTO) && (pc->parent_type != CT_OPERATOR)) { LOG_FMT(LFPARAM, "%s :: checking '%s' for constructor variable %s %s\n", __func__, pc->str.c_str(), get_token_name(paren_open->type), get_token_name(paren_close->type)); /* Scan the parameters looking for: * - constant strings * - numbers * - non-type fields * - function calls */ chunk_t *ref = chunk_get_next_ncnl(paren_open); chunk_t *tmp2; bool is_param = true; tmp = ref; while (tmp != paren_close) { tmp2 = chunk_get_next_ncnl(tmp); if ((tmp->type == CT_COMMA) && (tmp->level == (paren_open->level + 1))) { if (!can_be_full_param(ref, tmp)) { is_param = false; break; } ref = tmp2; } tmp = tmp2; } if (is_param && (ref != tmp)) { if (!can_be_full_param(ref, tmp)) { is_param = false; } } if (!is_param) { pc->type = CT_FUNC_CTOR_VAR; LOG_FMT(LFCN, " 3) Marked [%s] as FUNC_CTOR_VAR on line %d col %d\n", pc->str.c_str(), pc->orig_line, pc->orig_col); } else if (pc->brace_level > 0) { chunk_t *br_open = chunk_get_prev_type(pc, CT_BRACE_OPEN, pc->brace_level - 1); if ((br_open != NULL) && (br_open->parent_type != CT_EXTERN) && (br_open->parent_type != CT_NAMESPACE)) { /* Do a check to see if the level is right */ prev = chunk_get_prev_ncnl(pc); if (!chunk_is_str(prev, "*", 1) && !chunk_is_str(prev, "&", 1)) { chunk_t *p_op = chunk_get_prev_type(pc, CT_BRACE_OPEN, pc->brace_level - 1); if ((p_op != NULL) && (p_op->parent_type != CT_CLASS) && (p_op->parent_type != CT_STRUCT) && (p_op->parent_type != CT_NAMESPACE)) { pc->type = CT_FUNC_CTOR_VAR; LOG_FMT(LFCN, " 4) Marked [%s] as FUNC_CTOR_VAR on line %d col %d\n", pc->str.c_str(), pc->orig_line, pc->orig_col); } } } } } if (semi != NULL) { semi->parent_type = pc->type; } flag_parens(paren_open, PCF_IN_FCN_DEF, CT_FPAREN_OPEN, pc->type, false); if (pc->type == CT_FUNC_CTOR_VAR) { pc->flags |= PCF_VAR_1ST_DEF; return; } if (next->type == CT_TSQUARE) { next = chunk_get_next_ncnl(next); } /* Mark parameters */ fix_fcn_def_params(next); /* Step backwards from pc and mark the parent of the return type */ LOG_FMT(LFCNR, "%s: (backwards) return type for '%s':", __func__, pc->str.c_str()); tmp = pc; while ((tmp = chunk_get_prev_ncnl(tmp)) != NULL) { if (!chunk_is_type(tmp) && (tmp->type != CT_OPERATOR) && (tmp->type != CT_WORD) && (tmp->type != CT_ADDR)) { break; } LOG_FMT(LFCNR, " [%s]", tmp->str.c_str()); tmp->parent_type = pc->type; make_type(tmp); } LOG_FMT(LFCNR, "\n"); /* Find the brace pair and set the parent */ if (pc->type == CT_FUNC_DEF) { bool on_first = true; tmp = chunk_get_next_ncnl(paren_close); while ((tmp != NULL) && (tmp->type != CT_BRACE_OPEN)) { //LOG_FMT(LSYS, "%s: set parent to FUNC_DEF on line %d: [%s]\n", __func__, tmp->orig_line, tmp->str.c_str()); tmp->parent_type = CT_FUNC_DEF; if (chunk_is_semicolon(tmp)) { on_first = true; } else { tmp->flags |= PCF_OLD_FCN_PARAMS; on_first = false; } tmp = chunk_get_next_ncnl(tmp); } if ((tmp != NULL) && (tmp->type == CT_BRACE_OPEN)) { tmp->parent_type = CT_FUNC_DEF; tmp = chunk_skip_to_match(tmp); if (tmp != NULL) { tmp->parent_type = CT_FUNC_DEF; } } } } static void mark_cpp_constructor(chunk_t *pc) { chunk_t *paren_open; chunk_t *tmp; chunk_t *after; bool is_destr = false; tmp = chunk_get_prev_ncnl(pc); if (tmp->type == CT_INV) { tmp->type = CT_DESTRUCTOR; pc->parent_type = CT_DESTRUCTOR; is_destr = true; } LOG_FMT(LFTOR, "FOUND %sSTRUCTOR for %s[%s] ", is_destr ? "DE" : "CON", pc->str.c_str(), get_token_name(pc->type)); paren_open = chunk_get_next_ncnl(pc); if (!chunk_is_str(paren_open, "(", 1)) { LOG_FMT(LWARN, "%s:%d Expected '(', got: [%s]\n", cpd.filename, paren_open->orig_line, paren_open->str.c_str()); return; } /* Mark parameters */ fix_fcn_def_params(paren_open); after = flag_parens(paren_open, PCF_IN_FCN_CALL, CT_FPAREN_OPEN, CT_FUNC_CLASS, false); LOG_FMT(LFTOR, "[%s]\n", after->str.c_str()); /* Scan until the brace open, mark everything */ tmp = paren_open; while ((tmp != NULL) && (tmp->type != CT_BRACE_OPEN) && !chunk_is_semicolon(tmp)) { tmp->flags |= PCF_IN_CONST_ARGS; tmp = chunk_get_next_ncnl(tmp); if (chunk_is_str(tmp, ":", 1) && (tmp->level == paren_open->level)) { tmp->type = CT_CLASS_COLON; } } if ((tmp != NULL) && (tmp->type == CT_BRACE_OPEN)) { set_paren_parent(tmp, CT_FUNC_CLASS); } } /** * We're on a 'class' or 'struct'. * Scan for CT_FUNCTION with a string that matches pclass->str */ static void mark_class_ctor(chunk_t *start) { chunk_t *next; chunk_t *pclass; pclass = chunk_get_next_ncnl(start, CNAV_PREPROC); if ((pclass == NULL) || ((pclass->type != CT_TYPE) && (pclass->type != CT_WORD))) { return; } next = chunk_get_next_ncnl(pclass, CNAV_PREPROC); while ((next != NULL) && ((next->type == CT_TYPE) || (next->type == CT_WORD) || (next->type == CT_DC_MEMBER))) { pclass = next; next = chunk_get_next_ncnl(next, CNAV_PREPROC); } chunk_t *pc = chunk_get_next_ncnl(pclass, CNAV_PREPROC); int level = pclass->brace_level + 1; if (pc == NULL) { LOG_FMT(LFTOR, "%s: Called on %s on line %d. Bailed on NULL\n", __func__, pclass->str.c_str(), pclass->orig_line); return; } LOG_FMT(LFTOR, "%s: Called on %s on line %d (next='%s')\n", __func__, pclass->str.c_str(), pclass->orig_line, pc->str.c_str()); pclass->parent_type = start->type; /* Find the open brace, abort on semicolon */ while ((pc != NULL) && (pc->type != CT_BRACE_OPEN)) { LOG_FMT(LFTOR, " [%s]", pc->str.c_str()); if (chunk_is_str(pc, ":", 1)) { pc->type = CT_CLASS_COLON; LOG_FMT(LFTOR, "%s: class colon on line %d\n", __func__, pc->orig_line); } if (chunk_is_semicolon(pc)) { LOG_FMT(LFTOR, "%s: bailed on semicolon on line %d\n", __func__, pc->orig_line); return; } pc = chunk_get_next_ncnl(pc, CNAV_PREPROC); } if (pc == NULL) { LOG_FMT(LFTOR, "%s: bailed on NULL\n", __func__); return; } set_paren_parent(pc, start->type); pc = chunk_get_next_ncnl(pc, CNAV_PREPROC); while (pc != NULL) { pc->flags |= PCF_IN_CLASS; if ((pc->brace_level > level) || ((pc->flags & PCF_IN_PREPROC) != 0)) { pc = chunk_get_next_ncnl(pc); continue; } if ((pc->type == CT_BRACE_CLOSE) && (pc->brace_level < level)) { LOG_FMT(LFTOR, "%s: %d] Hit brace close\n", __func__, pc->orig_line); pc = chunk_get_next_ncnl(pc, CNAV_PREPROC); if (pc && (pc->type == CT_SEMICOLON)) { pc->parent_type = start->type; } return; } next = chunk_get_next_ncnl(pc, CNAV_PREPROC); if ((next != NULL) && (next->len() == 1) && (next->str[0] == '(') && (pc->len() == pclass->len()) && (memcmp(pc->text(), pclass->text(), pc->len()) == 0)) { pc->type = CT_FUNC_CLASS; LOG_FMT(LFTOR, "%d] Marked CTor/DTor %s\n", pc->orig_line, pc->str.c_str()); mark_cpp_constructor(pc); } pc = next; } } /** * We're on a 'namespace' skip the word and then set the parent of the braces. */ static void mark_namespace(chunk_t *pns) { chunk_t *pc; chunk_t *br_close; pc = chunk_get_next_ncnl(pns); while (pc != NULL) { pc->parent_type = CT_NAMESPACE; if (pc->type != CT_BRACE_OPEN) { pc = chunk_get_next_ncnl(pc); continue; } if ((cpd.settings[UO_indent_namespace_limit].n > 0) && ((br_close = chunk_skip_to_match(pc)) != NULL)) { int diff = br_close->orig_line - pc->orig_line; if (diff > cpd.settings[UO_indent_namespace_limit].n) { pc->flags |= PCF_LONG_BLOCK; br_close->flags |= PCF_LONG_BLOCK; } } flag_parens(pc, PCF_IN_NAMESPACE, CT_NONE, CT_NAMESPACE, false); return; } } /** * Skips the D 'align()' statement and the colon, if present. * align(2) int foo; -- returns 'int' * align(4): -- returns 'int' * int bar; */ static chunk_t *skip_align(chunk_t *start) { chunk_t *pc = start; if (pc->type == CT_ALIGN) { pc = chunk_get_next_ncnl(pc); if (pc->type == CT_PAREN_OPEN) { pc = chunk_get_next_type(pc, CT_PAREN_CLOSE, pc->level); pc = chunk_get_next_ncnl(pc); if (pc->type == CT_COLON) { pc = chunk_get_next_ncnl(pc); } } } return(pc); } /** * Examines the stuff between braces { }. * There should only be variable definitions and methods. * Skip the methods, as they will get handled elsewhere. */ static void mark_struct_union_body(chunk_t *start) { chunk_t *pc = start; while ((pc != NULL) && (pc->level >= start->level) && !((pc->level == start->level) && (pc->type == CT_BRACE_CLOSE))) { // LOG_FMT(LSYS, "%s: %d:%d %s:%s\n", __func__, pc->orig_line, pc->orig_col, // pc->str.c_str(), get_token_name(pc->parent_type)); if ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_BRACE_CLOSE) || (pc->type == CT_SEMICOLON)) { pc = chunk_get_next_ncnl(pc); } if (pc->type == CT_ALIGN) { pc = skip_align(pc); // "align(x)" or "align(x):" } else { pc = fix_var_def(pc); } } } /** * Sets the parent for comments. */ void mark_comments(void) { chunk_t *cur; chunk_t *next; bool prev_nl = true; bool next_nl; cur = chunk_get_head(); while (cur != NULL) { next = chunk_get_next(cur); next_nl = (next == NULL) || chunk_is_newline(next); if (chunk_is_comment(cur)) { if (next_nl && prev_nl) { cur->parent_type = CT_COMMENT_WHOLE; } else if (next_nl) { cur->parent_type = CT_COMMENT_END; } else if (prev_nl) { cur->parent_type = CT_COMMENT_START; } else { cur->parent_type = CT_COMMENT_EMBED; } } prev_nl = chunk_is_newline(cur); cur = next; } } /** * Marks statement starts in a macro body. * REVISIT: this may already be done */ static void mark_define_expressions(void) { chunk_t *pc; chunk_t *prev; bool in_define = false; bool first = true; pc = chunk_get_head(); prev = pc; while (pc != NULL) { if (!in_define) { if ((pc->type == CT_PP_DEFINE) || (pc->type == CT_PP_IF) || (pc->type == CT_PP_ELSE)) { in_define = true; first = true; } } else { if (((pc->flags & PCF_IN_PREPROC) == 0) || (pc->type == CT_PREPROC)) { in_define = false; } else { if ((pc->type != CT_MACRO) && (first || (prev->type == CT_PAREN_OPEN) || (prev->type == CT_ARITH) || (prev->type == CT_ASSIGN) || (prev->type == CT_COMPARE) || (prev->type == CT_RETURN) || (prev->type == CT_GOTO) || (prev->type == CT_CONTINUE) || (prev->type == CT_PAREN_OPEN) || (prev->type == CT_FPAREN_OPEN) || (prev->type == CT_SPAREN_OPEN) || (prev->type == CT_BRACE_OPEN) || chunk_is_semicolon(prev) || (prev->type == CT_COMMA) || (prev->type == CT_COLON) || (prev->type == CT_QUESTION))) { pc->flags |= PCF_EXPR_START; first = false; } } } prev = pc; pc = chunk_get_next(pc); } } /** * We are on the 'template' C++ keyword. * What follows should be the following: * * template function_declaration; * template function_declaration; * template class class_declaration; * template class class_declaration; * * Change the 'class' inside the <> to CT_TYPE. * Set the parent to the class after the <> to CT_TEMPLATE. * Set the parent of the semicolon to CT_TEMPLATE. */ static void handle_template(chunk_t *pc) { chunk_t *tmp; int level; tmp = chunk_get_next_ncnl(pc); if (tmp->type != CT_ANGLE_OPEN) { return; } tmp->parent_type = CT_TEMPLATE; level = tmp->level; while ((tmp = chunk_get_next(tmp)) != NULL) { if ((tmp->type == CT_CLASS) || (tmp->type == CT_STRUCT)) { tmp->type = CT_TYPE; } else if ((tmp->type == CT_ANGLE_CLOSE) && (tmp->level == level)) { tmp->parent_type = CT_TEMPLATE; break; } } if (tmp != NULL) { tmp = chunk_get_next_ncnl(tmp); if ((tmp != NULL) && ((tmp->type == CT_CLASS) || (tmp->type == CT_STRUCT))) { tmp->parent_type = CT_TEMPLATE; /* REVISTI: This may be a bit risky - might need to track the { }; */ tmp = chunk_get_next_type(tmp, CT_SEMICOLON, tmp->level); if (tmp != NULL) { tmp->parent_type = CT_TEMPLATE; } } } } /** * We are on a word followed by a angle open which is part of a template. * If the angle close is followed by a open paren, then we are on a template * function def or a template function call: * Vector2(...) [: ...[, ...]] { ... } * Or we could be on a variable def if it's followed by a word: * Renderer rend; */ static void mark_template_func(chunk_t *pc, chunk_t *pc_next) { chunk_t *angle_close; chunk_t *after; /* We know angle_close must be there... */ angle_close = chunk_get_next_type(pc_next, CT_ANGLE_CLOSE, pc->level); after = chunk_get_next_ncnl(angle_close); if (after != NULL) { if (chunk_is_str(after, "(", 1)) { if (angle_close->flags & PCF_IN_FCN_CALL) { LOG_FMT(LTEMPFUNC, "%s: marking '%s' in line %d as a FUNC_CALL\n", __func__, pc->str.c_str(), pc->orig_line); pc->type = CT_FUNC_CALL; flag_parens(after, PCF_IN_FCN_CALL, CT_FPAREN_OPEN, CT_FUNC_CALL, false); } else { /* Might be a function def. Must check what is before the template: * Func call: * BTree.Insert(std::pair(*it, double(*it) + 1.0)); * a = Test(j); * std::pair(*it, double(*it) + 1.0)); */ LOG_FMT(LTEMPFUNC, "%s: marking '%s' in line %d as a FUNC_CALL\n", __func__, pc->str.c_str(), pc->orig_line); // its a function!!! pc->type = CT_FUNC_CALL; mark_function(pc); } } else if (after->type == CT_WORD) { // its a type! pc->type = CT_TYPE; pc->flags |= PCF_VAR_TYPE; after->flags |= PCF_VAR_DEF; } } } /** * Just mark every CT_WORD until a semicolon as CT_SQL_WORD. * Adjust the levels if pc is CT_SQL_BEGIN */ static void mark_exec_sql(chunk_t *pc) { chunk_t *tmp; /* Change CT_WORD to CT_SQL_WORD */ for (tmp = chunk_get_next(pc); tmp != NULL; tmp = chunk_get_next(tmp)) { tmp->parent_type = pc->type; if (tmp->type == CT_WORD) { tmp->type = CT_SQL_WORD; } if (tmp->type == CT_SEMICOLON) { break; } } if ((pc->type != CT_SQL_BEGIN) || (tmp == NULL) || (tmp->type != CT_SEMICOLON)) { return; } for (tmp = chunk_get_next(tmp); (tmp != NULL) && (tmp->type != CT_SQL_END); tmp = chunk_get_next(tmp)) { tmp->level++; } } /** * Skips over the rest of the template if ang_open is indeed a CT_ANGLE_OPEN. * Points to the chunk after the CT_ANGLE_CLOSE. * If the chunk isn't an CT_ANGLE_OPEN, then it is returned. */ chunk_t *skip_template_next(chunk_t *ang_open) { if ((ang_open != NULL) && (ang_open->type == CT_ANGLE_OPEN)) { chunk_t *pc; pc = chunk_get_next_type(ang_open, CT_ANGLE_CLOSE, ang_open->level); return(chunk_get_next_ncnl(pc)); } return(ang_open); } /** * Skips over the rest of the template if ang_close is indeed a CT_ANGLE_CLOSE. * Points to the chunk before the CT_ANGLE_OPEN * If the chunk isn't an CT_ANGLE_CLOSE, then it is returned. */ chunk_t *skip_template_prev(chunk_t *ang_close) { if ((ang_close != NULL) && (ang_close->type == CT_ANGLE_CLOSE)) { chunk_t *pc; pc = chunk_get_prev_type(ang_close, CT_ANGLE_OPEN, ang_close->level); return(chunk_get_prev_ncnl(pc)); } return(ang_close); } /** * If attr is CT_ATTRIBUTE, then skip it and the parens and return the chunk * after the CT_FPAREN_CLOSE. * If the chunk isn't an CT_ATTRIBUTE, then it is returned. */ chunk_t *skip_attribute_next(chunk_t *attr) { if ((attr != NULL) && (attr->type == CT_ATTRIBUTE)) { chunk_t *pc = chunk_get_next(attr); if ((pc != NULL) && (pc->type == CT_FPAREN_OPEN)) { pc = chunk_get_next_type(attr, CT_FPAREN_CLOSE, attr->level); return(chunk_get_next_ncnl(pc)); } return(pc); } return(attr); } /** * If fp_close is a CT_FPAREN_CLOSE with a parent of CT_ATTRIBUTE, then skip it * and the '__attribute__' thingy and return the chunk before CT_ATTRIBUTE. * Otherwise return fp_close. */ chunk_t *skip_attribute_prev(chunk_t *fp_close) { if ((fp_close != NULL) && (fp_close->type == CT_FPAREN_CLOSE) && (fp_close->parent_type == CT_ATTRIBUTE)) { chunk_t *pc; pc = chunk_get_prev_type(fp_close, CT_ATTRIBUTE, fp_close->level); return(chunk_get_prev_ncnl(pc)); } return(fp_close); } /** * Process an ObjC 'class' * pc is the chunk after '@implementation' or '@interface' or '@protocol'. * Change colons, etc. Processes stuff until '@end'. * Skips anything in braces. */ static void handle_oc_class(chunk_t *pc) { chunk_t *tmp; bool hit_scope = false; int do_pl = 1; LOG_FMT(LOCCLASS, "%s: start [%s] [%s] line %d\n", __func__, pc->str.c_str(), get_token_name(pc->parent_type), pc->orig_line); if (pc->parent_type == CT_OC_PROTOCOL) { tmp = chunk_get_next_ncnl(pc); if (chunk_is_semicolon(tmp)) { tmp->parent_type = pc->parent_type; LOG_FMT(LOCCLASS, "%s: bail on semicolon\n", __func__); return; } } tmp = pc; while ((tmp = chunk_get_next_nnl(tmp)) != NULL) { LOG_FMT(LOCCLASS, "%s: %d [%s]\n", __func__, tmp->orig_line, tmp->str.c_str()); if (tmp->type == CT_OC_END) { break; } if ((do_pl == 1) && chunk_is_str(tmp, "<", 1)) { tmp->type = CT_ANGLE_OPEN; tmp->parent_type = CT_OC_PROTO_LIST; do_pl = 2; } if ((do_pl == 2) && chunk_is_str(tmp, ">", 1)) { tmp->type = CT_ANGLE_CLOSE; tmp->parent_type = CT_OC_PROTO_LIST; do_pl = 0; } if (tmp->type == CT_BRACE_OPEN) { do_pl = 0; tmp->parent_type = CT_OC_CLASS; tmp = chunk_get_next_type(tmp, CT_BRACE_CLOSE, tmp->level); if (tmp != NULL) { tmp->parent_type = CT_OC_CLASS; } } else if (tmp->type == CT_COLON) { tmp->type = hit_scope ? CT_OC_COLON : CT_CLASS_COLON; tmp->parent_type = CT_OC_CLASS; } else if (chunk_is_str(tmp, "-", 1) || chunk_is_str(tmp, "+", 1)) { do_pl = 0; if (chunk_is_newline(chunk_get_prev(tmp))) { tmp->type = CT_OC_SCOPE; tmp->flags |= PCF_STMT_START; hit_scope = true; } } if (do_pl == 2) { tmp->parent_type = CT_OC_PROTO_LIST; } } if ((tmp != NULL) && (tmp->type == CT_BRACE_OPEN)) { tmp = chunk_get_next_type(tmp, CT_BRACE_CLOSE, tmp->level); if (tmp != NULL) { tmp->parent_type = CT_OC_CLASS; } } } /* Mark Objective-C blocks (aka lambdas or closures) * The syntax and usage is exactly like C function pointers * but instead of an asterisk they have a caret as pointer symbol. * Although it may look expensive this functions if only triggered * on appearance of an OC_BLOCK_CARET for LANG_OC. * repeat(10, ^{ putc('0'+d); }); * typedef void (^workBlk_t)(void); */ static void handle_oc_block(chunk_t *pc) { chunk_t *tmp = pc; chunk_t *prev = pc->prev; chunk_t *next = pc->next; if (!pc || !pc->prev || !pc->next) { return; /* let's be paranoid */ } if (pc->parent_type == CT_OC_BLOCK_TYPE) { /* mark block declaration, e.g.: return_t (^name)(args) */ prev->parent_type = pc->parent_type; prev->type = CT_PAREN_OPEN; /* reset FPAREN to PAREN */ tmp = chunk_get_next(pc); if (tmp != NULL) { if ((tmp->type != CT_PAREN_CLOSE) && (tmp->type != CT_FPAREN_CLOSE)) { tmp->type = CT_TYPE; tmp->flags |= PCF_STMT_START; tmp->parent_type = pc->parent_type; while ((tmp = chunk_get_next(tmp)) != NULL) { tmp->parent_type = pc->parent_type; if (!tmp->next) { break; } if (((tmp->type == CT_PAREN_CLOSE) || (tmp->type == CT_FPAREN_CLOSE)) && ((tmp->next->type == CT_PAREN_OPEN) || (tmp->next->type == CT_FPAREN_OPEN))) { tmp->type = CT_PAREN_CLOSE; tmp->next->parent_type = pc->parent_type; break; } } /* mark args in function def parens */ tmp = chunk_get_next(tmp); if (tmp != NULL) { tmp->parent_type = CT_OC_BLOCK_ARG; while ((tmp = chunk_get_next(tmp)) != NULL) { tmp->parent_type = CT_OC_BLOCK_ARG; if (!tmp->next) { break; } if (((tmp->next->type == CT_PAREN_CLOSE) || (tmp->next->type == CT_FPAREN_CLOSE)) && ((tmp->next->level + 1) == pc->level)) { tmp->parent_type = CT_OC_BLOCK_ARG; tmp->next->parent_type = CT_OC_BLOCK_ARG; break; } } } } else { tmp->type = CT_PAREN_CLOSE; tmp->parent_type = CT_OC_BLOCK_TYPE; } } } else { /* mark block literal which takes no args, e.g.: ^{...} */ if (next->type == CT_BRACE_OPEN) { tmp = chunk_get_next(pc); if (tmp != NULL) { /* set correct parent_type then skip over open brace */ tmp->parent_type = pc->parent_type; tmp = chunk_get_next(tmp); tmp->flags |= PCF_STMT_START | PCF_EXPR_START; tmp->parent_type = pc->parent_type; while ((tmp = chunk_get_next_nc(tmp)) != NULL) { tmp->parent_type = pc->parent_type; if ((tmp->type == CT_BRACE_CLOSE) && (tmp->brace_level == pc->brace_level)) { tmp->parent_type = pc->parent_type; break; } } } } else { /* mark block literal with args and optional return type, * e.g.: ... = ^ return_t (args){expr} ... * the 'return_t' is inferred from block content if left out */ tmp = chunk_get_next(pc); if (tmp != NULL) { if ((tmp->type == CT_PAREN_OPEN) || (tmp->type == CT_FPAREN_OPEN)) { tmp->parent_type = CT_OC_BLOCK_ARG; } else { pc->parent_type = CT_OC_BLOCK_EXPR; tmp->parent_type = CT_OC_BLOCK_EXPR; tmp->type = CT_TYPE; /* the first word is definately a type */ /* skip over return type until open paren */ while ((tmp = chunk_get_next(tmp)) != NULL) { tmp->parent_type = CT_OC_BLOCK_EXPR; if (((tmp->type == CT_PAREN_OPEN) || (tmp->type == CT_FPAREN_OPEN)) && (tmp->level == pc->level)) { tmp->parent_type = CT_OC_BLOCK_ARG; break; } } } /* handle args */ tmp = chunk_get_next(tmp); if (tmp != NULL) { tmp->parent_type = CT_OC_BLOCK_ARG; tmp->flags |= PCF_STMT_START; while ((tmp = chunk_get_next(tmp)) != NULL) { tmp->parent_type = CT_OC_BLOCK_ARG; if ((tmp->type == CT_PAREN_CLOSE) && (tmp->level == pc->level)) { break; } } /* mark open brace in expression part as OC_BLOCK, then * set parent_type to OC_BLOCK_EXPR so that the stuff inside * the braces can get handled below... */ /* handle brace part */ tmp = chunk_get_next(tmp); if (tmp != NULL) { tmp->parent_type = CT_OC_BLOCK_EXPR; while ((tmp = chunk_get_next(tmp)) != NULL) { tmp->parent_type = CT_OC_BLOCK_EXPR; if ((tmp->type == CT_BRACE_CLOSE) && (tmp->brace_level == 0)) { tmp->parent_type = CT_OC_BLOCK_EXPR; if (tmp->next && (tmp->next->type == CT_SEMICOLON)) { tmp->next->parent_type = CT_OC_BLOCK_EXPR; } break; } } } } } } } } /** * Process an ObjC message spec/dec * * Specs: * -(void) foo ARGS; * * Decl: * -(void) foo ARGS { } * * ARGS is ': (type) name [name]' * -(void) foo: (int) arg: { } */ static void handle_oc_message_decl(chunk_t *pc) { chunk_t *tmp; bool in_paren = false; int paren_cnt = 0; int arg_cnt = 0; c_token_t pt = CT_OC_MSG_SPEC; /* Figure out if this is a spec or decl */ tmp = pc; while ((tmp = chunk_get_next(tmp)) != NULL) { if ((tmp->type == CT_SEMICOLON) || (tmp->type == CT_BRACE_OPEN)) { pt = (tmp->type == CT_SEMICOLON) ? CT_OC_MSG_SPEC : CT_OC_MSG_DECL; break; } } if (tmp == NULL) { return; } pc->type = CT_OC_SCOPE; pc->parent_type = pt; /* Mark everything */ tmp = pc; while ((tmp = chunk_get_next(tmp)) != NULL) { if ((tmp->type == CT_SEMICOLON) || (tmp->type == CT_BRACE_OPEN)) { tmp->parent_type = pt; break; } /* Mark first parens as return type */ if ((arg_cnt == 0) && ((tmp->type == CT_PAREN_OPEN) || (tmp->type == CT_PAREN_CLOSE))) { tmp->parent_type = CT_OC_RTYPE; in_paren = (tmp->type == CT_PAREN_OPEN); if (!in_paren) { paren_cnt++; arg_cnt++; } } else if ((tmp->type == CT_PAREN_OPEN) || (tmp->type == CT_PAREN_CLOSE)) { tmp->parent_type = pt; in_paren = (tmp->type == CT_PAREN_OPEN); if (!in_paren) { paren_cnt++; } } else if (tmp->type == CT_WORD) { if (in_paren) { tmp->type = CT_TYPE; tmp->parent_type = pt; } else if (paren_cnt == 1) { tmp->type = pt; } else { tmp->flags |= PCF_VAR_DEF; } } else if (tmp->type == CT_COLON) { tmp->type = CT_OC_COLON; tmp->parent_type = pt; } } if ((tmp != NULL) && (tmp->type == CT_BRACE_OPEN)) { tmp = chunk_get_next_type(tmp, CT_BRACE_CLOSE, tmp->level); if (tmp != NULL) { tmp->parent_type = pt; } } } /** * Process an ObjC message send statement: * [ class func: val1 name2: val2 name3: val3] ; // named params * [ class func: val1 : val2 : val3] ; // unnamed params * * Just find the matching ']' and ';' and mark the colon. * * @param os points to the open square '[' */ static void handle_oc_message_send(chunk_t *os) { chunk_t *tmp; chunk_t *cs = chunk_get_next(os); while ((cs != NULL) && (cs->level > os->level)) { cs = chunk_get_next(cs); } if ((cs == NULL) || (cs->type != CT_SQUARE_CLOSE)) { return; } LOG_FMT(LOCMSG, "%s: line %d, col %d\n", __func__, os->orig_line, os->orig_col); tmp = chunk_get_next_ncnl(cs); if (chunk_is_semicolon(tmp)) { tmp->parent_type = CT_OC_MSG; } os->parent_type = CT_OC_MSG; os->flags |= PCF_IN_OC_MSG; cs->parent_type = CT_OC_MSG; cs->flags |= PCF_IN_OC_MSG; int cnt = 0; chunk_t *prev = NULL; for (tmp = chunk_get_next(os); tmp != cs; tmp = chunk_get_next(tmp)) { tmp->flags |= PCF_IN_OC_MSG; if (tmp->type == CT_COLON) { tmp->type = CT_OC_COLON; if ((prev != NULL) && ((prev->type == CT_WORD) || (prev->type == CT_TYPE))) { /* Might be a named param, check previous block */ chunk_t *pp = chunk_get_prev(prev); if ((pp != NULL) && (pp->type != CT_OC_COLON) && (pp->type != CT_ARITH)) { prev->type = CT_OC_MSG_NAME; tmp->parent_type = CT_OC_MSG_NAME; } } } if ((cnt <= 1) && ((tmp->type == CT_WORD) || (tmp->type == CT_TYPE))) { tmp->type = (cnt == 0) ? CT_OC_MSG_CLASS : CT_OC_MSG_FUNC; } prev = tmp; cnt++; } } /** * Process an C# [] thingy: * [assembly: xxx] * [AttributeUsage()] * [@X] * * Set the next chunk to a statement start after the close ']' * * @param os points to the open square '[' */ static void handle_cs_square_stmt(chunk_t *os) { chunk_t *tmp; chunk_t *cs = chunk_get_next(os); while ((cs != NULL) && (cs->level > os->level)) { cs = chunk_get_next(cs); } if ((cs == NULL) || (cs->type != CT_SQUARE_CLOSE)) { return; } os->parent_type = CT_CS_SQ_STMT; cs->parent_type = CT_CS_SQ_STMT; for (tmp = chunk_get_next(os); tmp != cs; tmp = chunk_get_next(tmp)) { tmp->parent_type = CT_CS_SQ_STMT; if (tmp->type == CT_COLON) { tmp->type = CT_CS_SQ_COLON; } } tmp = chunk_get_next_ncnl(cs); if (tmp != NULL) { tmp->flags |= PCF_STMT_START | PCF_EXPR_START; } } /** * We are on a brace open that is preceded by a word or square close. * Set the brace parent to CT_CS_PROPERTY and find the first item in the * property and set its parent, too. */ static void handle_cs_property(chunk_t *bro) { chunk_t *pc; bool did_prop = false; set_paren_parent(bro, CT_CS_PROPERTY); pc = bro; while ((pc = chunk_get_prev_ncnl(pc)) != NULL) { if (pc->level == bro->level) { if (!did_prop && ((pc->type == CT_WORD) || (pc->type == CT_THIS))) { pc->type = CT_CS_PROPERTY; did_prop = true; } else { pc->parent_type = CT_CS_PROPERTY; make_type(pc); } if (pc->flags & PCF_STMT_START) { break; } } } } /** * Remove 'return;' that appears as the last statement in a function */ void remove_extra_returns() { chunk_t *pc; chunk_t *semi; chunk_t *cl_br; pc = chunk_get_head(); while (pc != NULL) { if ((pc->type == CT_RETURN) && ((pc->flags & PCF_IN_PREPROC) == 0)) { semi = chunk_get_next_ncnl(pc); cl_br = chunk_get_next_ncnl(semi); if ((semi != NULL) && (semi->type == CT_SEMICOLON) && (cl_br != NULL) && (cl_br->type == CT_BRACE_CLOSE) && ((cl_br->parent_type == CT_FUNC_DEF) || (cl_br->parent_type == CT_FUNC_CLASS))) { LOG_FMT(LRMRETURN, "Removed 'return;' on line %d\n", pc->orig_line); chunk_del(pc); chunk_del(semi); pc = cl_br; } } pc = chunk_get_next(pc); } } /** * A func wrap chunk and what follows should be treated as a function name. * Create new text for the chunk and call it a CT_FUNCTION. * * A type wrap chunk and what follows should be treated as a simple type. * Create new text for the chunk and call it a CT_TYPE. */ static void handle_wrap(chunk_t *pc) { chunk_t *opp = chunk_get_next(pc); chunk_t *name = chunk_get_next(opp); chunk_t *clp = chunk_get_next(name); argval_t pav = (pc->type == CT_FUNC_WRAP) ? cpd.settings[UO_sp_func_call_paren].a : cpd.settings[UO_sp_cpp_cast_paren].a; argval_t av = (pc->type == CT_FUNC_WRAP) ? cpd.settings[UO_sp_inside_fparen].a : cpd.settings[UO_sp_inside_paren_cast].a; if ((clp != NULL) && (opp->type == CT_PAREN_OPEN) && ((name->type == CT_WORD) || (name->type == CT_TYPE)) && (clp->type == CT_PAREN_CLOSE)) { const char *psp = (pav & AV_ADD) ? " " : ""; const char *fsp = (av & AV_ADD) ? " " : ""; pc->str.append(psp); pc->str.append("("); pc->str.append(fsp); pc->str.append(name->str); pc->str.append(fsp); pc->str.append(")"); pc->type = (pc->type == CT_FUNC_WRAP) ? CT_FUNCTION : CT_TYPE; pc->orig_col_end = pc->orig_col + pc->len(); chunk_del(opp); chunk_del(name); chunk_del(clp); } } /** * Java assert statments are: "assert EXP1 [: EXP2] ;" * Mark the parent of the colon and semicolon */ static void handle_java_assert(chunk_t *pc) { bool did_colon = false; chunk_t *tmp = pc; while ((tmp = chunk_get_next(tmp)) != NULL) { if (tmp->level == pc->level) { if (!did_colon && (tmp->type == CT_COLON)) { did_colon = true; tmp->parent_type = pc->type; } if (tmp->type == CT_SEMICOLON) { tmp->parent_type = pc->type; break; } } } } uncrustify-0.59/src/unc_text.h0000644000175000017500000000757011640477125013414 00000000000000/** * @file unc_text.h * A simple class that handles the chunk text. * At the start of processing, the entire file is decoded into a vector of ints. * This class is intended to hold sections of that large vector. * * @author Ben Gardner * @license GPL v2+ */ #ifndef UNC_TEXT_H_INCLUDED #define UNC_TEXT_H_INCLUDED #include "base_types.h" #include #include #include using namespace std; class unc_text { public: typedef deque value_type; public: unc_text() : m_logok(false) { } ~unc_text() { } unc_text(const unc_text& ref) { set(ref); } unc_text(const unc_text& ref, int idx, int len = -1) { set(ref, idx, len); } unc_text(const char *ascii_text) { set(ascii_text); } unc_text(const string& ascii_text) { set(ascii_text); } unc_text(const value_type& data, int idx = 0, int len = -1) { set(data, idx, len); } void resize(size_t new_size); void clear(); /* grab the number of characters */ int size() const { return m_chars.size(); } void set(int ch); void set(const unc_text& ref); void set(const unc_text& ref, int idx, int len = -1); void set(const string& ascii_text); void set(const char *ascii_text); void set(const value_type& data, int idx = 0, int len = -1); unc_text& operator =(int ch) { set(ch); return(*this); } unc_text& operator =(const unc_text& ref) { set(ref); return(*this); } unc_text& operator =(const string& ascii_text) { set(ascii_text); return(*this); } unc_text& operator =(const char *ascii_text) { set(ascii_text); return(*this); } void append(int ch); void append(const unc_text& ref); void append(const string& ascii_text); void append(const char *ascii_text); void append(const value_type& data, int idx = 0, int len = -1); unc_text& operator +=(int ch) { append(ch); return(*this); } unc_text& operator +=(const unc_text& ref) { append(ref); return(*this); } unc_text& operator +=(const string& ascii_text) { append(ascii_text); return(*this); } unc_text& operator +=(const char *ascii_text) { append(ascii_text); return(*this); } /* get the UTF-8 string for logging */ const char *c_str(); operator const char *() { return c_str(); } static int compare(const unc_text& ref1, const unc_text& ref2, int len = 0); bool equals(const unc_text& ref) const; /* grab the data as a series of ints for outputting to a file */ value_type& get() { m_logok = false; return m_chars; } const value_type& get() const { return m_chars; } int operator[](int idx) const { return(((idx >= 0) && ((size_t)idx < m_chars.size())) ? m_chars[idx] : 0); } /* throws an exception if out of bounds */ int& at(int idx) { return m_chars.at(idx); } const int& at(int idx) const { return m_chars.at(idx); } const int& back() const { return m_chars.back(); } int& back() { return m_chars.back(); } void push_back(int ch) { append(ch); } void pop_back() { if (size() > 0) { m_chars.pop_back(); m_logok = false; } } void pop_front() { if (size() > 0) { m_chars.pop_front(); m_logok = false; } } bool startswith(const unc_text& text, int idx = 0) const; bool startswith(const char *text, int idx = 0) const; int find(const char *text, int idx = 0) const; protected: void update_logtext(); /* this contains the non-encoded 31-bit chars */ value_type m_chars; /* logging text, utf8 encoded - updated in c_str() */ vector m_logtext; bool m_logok; }; #endif /* UNC_TEXT_H_INCLUDED */ uncrustify-0.59/src/config.h.in0000644000175000017500000000475311642741011013423 00000000000000/* src/config.h.in. Generated from configure.in by autoheader. */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define to appropriate substitue if compiler doesnt have __func__ */ #undef __func__ /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif uncrustify-0.59/src/tokenize.cpp0000644000175000017500000010666711635773465013767 00000000000000/** * @file tokenize.cpp * This file breaks up the text stream into tokens or chunks. * * Each routine needs to set pc.len and pc.type. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "char_table.h" #include "prototypes.h" #include "chunk_list.h" #include #include #include #include #include "unc_ctype.h" struct tok_info { tok_info() : last_ch(0), idx(0), row(1), col(1) { } int last_ch; int idx; int row; int col; }; struct tok_ctx { tok_ctx(const deque& d) : data(d) { } /* save before trying to parse something that may fail */ void save() { save(s); } void save(tok_info& info) { info = c; } /* restore previous saved state */ void restore() { restore(s); } void restore(const tok_info& info) { c = info; } bool more() { return(c.idx < (int)data.size()); } int peek() { return(more() ? data[c.idx] : -1); } int peek(int idx) { idx += c.idx; return((idx < (int)data.size()) ? data[idx] : -1); } int get() { if (more()) { int ch = data[c.idx++]; switch (ch) { case '\t': c.col = calc_next_tab_column(c.col, cpd.settings[UO_input_tab_size].n); break; case '\n': if (c.last_ch != '\r') { c.row++; c.col = 1; } break; case '\r': c.row++; c.col = 1; break; default: c.col++; break; } c.last_ch = ch; return ch; } return -1; } bool expect(int ch) { if (peek() == ch) { get(); return true; } return false; } const deque& data; tok_info c; /* current */ tok_info s; /* saved */ }; static bool parse_string(tok_ctx& ctx, chunk_t& pc, int quote_idx, bool allow_escape); /** * Parses all legal D string constants. * * Quoted strings: * r"Wysiwyg" # WYSIWYG string * x"hexstring" # Hexadecimal array * `Wysiwyg` # WYSIWYG string * 'char' # single character * "reg_string" # regular string * * Non-quoted strings: * \x12 # 1-byte hex constant * \u1234 # 2-byte hex constant * \U12345678 # 4-byte hex constant * \123 # octal constant * \& # named entity * \n # single character * * @param pc The structure to update, str is an input. * @return Whether a string was parsed */ static bool d_parse_string(tok_ctx& ctx, chunk_t& pc) { int ch = ctx.peek(); if ((ch == '"') || (ch == '\'') || (ch == '`')) { return(parse_string(ctx, pc, 0, true)); } else if (ch == '\\') { ctx.save(); int cnt; pc.str.clear(); while (ctx.peek() == '\\') { pc.str.append(ctx.get()); /* Check for end of file */ switch (ctx.peek()) { case 'x': /* \x HexDigit HexDigit */ cnt = 3; while (cnt--) { pc.str.append(ctx.get()); } break; case 'u': /* \u HexDigit HexDigit HexDigit HexDigit */ cnt = 5; while (cnt--) { pc.str.append(ctx.get()); } break; case 'U': /* \U HexDigit (x8) */ cnt = 9; while (cnt--) { pc.str.append(ctx.get()); } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': /* handle up to 3 octal digits */ pc.str.append(ctx.get()); ch = ctx.peek(); if ((ch >= '0') && (ch <= '7')) { pc.str.append(ctx.get()); ch = ctx.peek(); if ((ch >= '0') && (ch <= '7')) { pc.str.append(ctx.get()); } } break; case '&': /* \& NamedCharacterEntity ; */ pc.str.append(ctx.get()); while (unc_isalpha(ctx.peek())) { pc.str.append(ctx.get()); } if (ctx.peek() == ';') { pc.str.append(ctx.get()); } break; default: /* Everything else is a single character */ pc.str.append(ctx.get()); break; } } if (pc.str.size() > 1) { pc.type = CT_STRING; return(true); } ctx.restore(); } else if (((ch == 'r') || (ch == 'x')) && (ctx.peek(1) == '"')) { return(parse_string(ctx, pc, 1, false)); } return(false); } // /** // * A string-in-string search. Like strstr() with a haystack length. // */ // static const char *str_search(const char *needle, const char *haystack, int haystack_len) // { // int needle_len = strlen(needle); // // while (haystack_len-- >= needle_len) // { // if (memcmp(needle, haystack, needle_len) == 0) // { // return(haystack); // } // haystack++; // } // return(NULL); // } /** * Figure of the length of the comment at text. * The next bit of text starts with a '/', so it might be a comment. * There are three types of comments: * - C comments that start with '/ *' and end with '* /' * - C++ comments that start with // * - D nestable comments '/+' '+/' * * @param pc The structure to update, str is an input. * @return Whether a comment was parsed */ static bool parse_comment(tok_ctx& ctx, chunk_t& pc) { int ch; bool is_d = (cpd.lang_flags & LANG_D) != 0; int d_level = 0; int bs_cnt; /* does this start with '/ /' or '/ *' or '/ +' (d) */ if ((ctx.peek() != '/') || ((ctx.peek(1) != '*') && (ctx.peek(1) != '/') && ((ctx.peek(1) != '+') || !is_d))) { return(false); } ctx.save(); /* account for opening two chars */ pc.str = ctx.get(); /* opening '/' */ ch = ctx.peek(); if (ch == '/') { pc.str.append(ctx.get()); /* store the '/' */ pc.type = CT_COMMENT_CPP; while (true) { bs_cnt = 0; while (ctx.more()) { ch = ctx.peek(); if ((ch == '\r') || (ch == '\n')) { break; } if (ch == '\\') { bs_cnt++; } else { bs_cnt = 0; } pc.str.append(ctx.get()); } /* If we hit an odd number of backslashes right before the newline, * then we keep going. */ if (((bs_cnt & 1) == 0) || !ctx.more()) { break; } if (ctx.peek() == '\r') { pc.str.append(ctx.get()); } if (ctx.peek() == '\n') { pc.str.append(ctx.get()); } pc.nl_count++; cpd.did_newline = true; } } else if (!ctx.more()) { /* unexpected end of file */ ctx.restore(); return(false); } else if (ch == '+') { pc.str.append(ctx.get()); /* store the '+' */ pc.type = CT_COMMENT; d_level++; while ((d_level > 0) && ctx.more()) { if ((ctx.peek() == '+') && (ctx.peek(1) == '/')) { pc.str.append(ctx.get()); /* store the '+' */ pc.str.append(ctx.get()); /* store the '/' */ d_level--; continue; } if ((ctx.peek() == '/') && (ctx.peek(1) == '+')) { pc.str.append(ctx.get()); /* store the '/' */ pc.str.append(ctx.get()); /* store the '+' */ d_level++; continue; } ch = ctx.get(); pc.str.append(ch); if ((ch == '\n') || (ch == '\r')) { pc.type = CT_COMMENT_MULTI; pc.nl_count++; if (ch == '\r') { if (ctx.peek(1) == '\n') { cpd.le_counts[LE_CRLF]++; pc.str.append(ctx.get()); /* store the '\n' */ } else { cpd.le_counts[LE_CR]++; } } else { cpd.le_counts[LE_LF]++; } } } } else /* must be '/ *' */ { pc.type = CT_COMMENT; while (ctx.more()) { if ((ctx.peek() == '*') && (ctx.peek(1) == '/')) { pc.str.append(ctx.get()); /* store the '*' */ pc.str.append(ctx.get()); /* store the '/' */ tok_info ss; ctx.save(ss); int oldsize = pc.str.size(); /* If there is another C comment right after this one, combine them */ while ((ctx.peek() == ' ') || (ctx.peek() == '\t')) { pc.str.append(ctx.get()); } if ((ctx.peek() != '/') || (ctx.peek(1) != '*')) { /* undo the attempt to join */ ctx.restore(ss); pc.str.resize(oldsize); break; } } ch = ctx.get(); pc.str.append(ch); if ((ch == '\n') || (ch == '\r')) { pc.type = CT_COMMENT_MULTI; pc.nl_count++; if (ch == '\r') { if (ctx.peek() == '\n') { cpd.le_counts[LE_CRLF]++; pc.str.append(ctx.get()); /* store the '\n' */ } else { cpd.le_counts[LE_CR]++; } } else { cpd.le_counts[LE_LF]++; } } } } if (cpd.unc_off) { if (pc.str.find(UNCRUSTIFY_ON_TEXT) >= 0) { LOG_FMT(LBCTRL, "Found '%s' on line %d\n", UNCRUSTIFY_ON_TEXT, pc.orig_line); cpd.unc_off = false; } } else { if (pc.str.find(UNCRUSTIFY_OFF_TEXT) >= 0) { LOG_FMT(LBCTRL, "Found '%s' on line %d\n", UNCRUSTIFY_OFF_TEXT, pc.orig_line); cpd.unc_off = true; } } return(true); } /** * Parse any attached suffix, which may be a user-defined literal suffix. * If for a string, explicitly exclude common format and scan specifiers, ie, * PRIx32 and SCNx64. */ static void parse_suffix(tok_ctx& ctx, chunk_t& pc, bool forstring = false) { if (CharTable::IsKw1(ctx.peek())) { int slen = 0; int oldsize = pc.str.size(); tok_info ss; ctx.save(ss); while (ctx.more() && CharTable::IsKw2(ctx.peek())) { slen++; pc.str.append(ctx.get()); } if (forstring && (slen >= 4) && (pc.str.startswith("PRI", oldsize) || pc.str.startswith("SCN", oldsize))) { ctx.restore(ss); pc.str.resize(oldsize); } } } static bool is_bin(int ch) { return((ch == '0') || (ch == '1')); } static bool is_bin_(int ch) { return(is_bin(ch) || (ch == '_')); } static bool is_oct(int ch) { return((ch >= '0') && (ch <= '7')); } static bool is_oct_(int ch) { return(is_oct(ch) || (ch == '_')); } static bool is_dec(int ch) { return((ch >= '0') && (ch <= '9')); } static bool is_dec_(int ch) { return(is_dec(ch) || (ch == '_')); } static bool is_hex(int ch) { return(((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'f')) || ((ch >= 'A') && (ch <= 'F'))); } static bool is_hex_(int ch) { return(is_hex(ch) || (ch == '_')); } /** * Count the number of characters in the number. * The next bit of text starts with a number (0-9 or '.'), so it is a number. * Count the number of characters in the number. * * This should cover all number formats for all languages. * Note that this is not a strict parser. It will happily parse numbers in * an invalid format. * * For example, only D allows underscores in the numbers, but they are * allowed in all formats. * * @param pc The structure to update, str is an input. * @return Whether a number was parsed */ static bool parse_number(tok_ctx& ctx, chunk_t& pc) { int tmp; bool is_float; bool did_hex = false; /* A number must start with a digit or a dot, followed by a digit */ if (!is_dec(ctx.peek()) && ((ctx.peek() != '.') || !is_dec(ctx.peek(1)))) { return(false); } is_float = (ctx.peek() == '.'); if (is_float && (ctx.peek(1) == '.')) { return(false); } /* Check for Hex, Octal, or Binary * Note that only D and Pawn support binary, but who cares? */ if (ctx.peek() == '0') { pc.str.append(ctx.get()); /* store the '0' */ switch (unc_toupper(ctx.peek())) { case 'X': /* hex */ did_hex = true; do { pc.str.append(ctx.get()); /* store the 'x' and then the rest */ } while (is_hex_(ctx.peek())); break; case 'B': /* binary */ do { pc.str.append(ctx.get()); /* store the 'b' and then the rest */ } while (is_bin_(ctx.peek())); break; case '0': /* octal or decimal */ case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': do { pc.str.append(ctx.get()); } while (is_oct_(ctx.peek())); break; default: /* either just 0 or 0.1 or 0UL, etc */ break; } } else { /* Regular int or float */ while (is_dec_(ctx.peek())) { pc.str.append(ctx.get()); } } /* Check if we stopped on a decimal point & make sure it isn't '..' */ if ((ctx.peek() == '.') && (ctx.peek(1) != '.')) { pc.str.append(ctx.get()); is_float = true; if (did_hex) { while (is_hex_(ctx.peek())) { pc.str.append(ctx.get()); } } else { while (is_dec_(ctx.peek())) { pc.str.append(ctx.get()); } } } /* Check exponent * Valid exponents per language (not that it matters): * C/C++/D/Java: eEpP * C#/Pawn: eE */ tmp = unc_toupper(ctx.peek()); if ((tmp == 'E') || (tmp == 'P')) { is_float = true; pc.str.append(ctx.get()); if ((ctx.peek() == '+') || (ctx.peek() == '-')) { pc.str.append(ctx.get()); } while (is_dec_(ctx.peek())) { pc.str.append(ctx.get()); } } /* Check the suffixes * Valid suffixes per language (not that it matters): * Integer Float * C/C++: uUlL64 lLfF * C#: uUlL fFdDMm * D: uUL ifFL * Java: lL fFdD * Pawn: (none) (none) * * Note that i, f, d, and m only appear in floats. */ while (1) { tmp = unc_toupper(ctx.peek()); if ((tmp == 'I') || (tmp == 'F') || (tmp == 'D') || (tmp == 'M')) { is_float = true; } else if ((tmp != 'L') && (tmp != 'U')) { break; } pc.str.append(ctx.get()); } /* skip the Microsoft-specific '64' suffix */ if ((ctx.peek() == '6') && (ctx.peek(1) == '4')) { pc.str.append(ctx.get()); pc.str.append(ctx.get()); } pc.type = is_float ? CT_NUMBER_FP : CT_NUMBER; /* If there is anything left, then we are probably dealing with garbage or * some sick macro junk. Eat it. */ parse_suffix(ctx, pc); return(true); } /** * Count the number of characters in a quoted string. * The next bit of text starts with a quote char " or ' or <. * Count the number of characters until the matching character. * * @param pc The structure to update, str is an input. * @return Whether a string was parsed */ static bool parse_string(tok_ctx& ctx, chunk_t& pc, int quote_idx, bool allow_escape) { bool escaped = 0; int end_ch; char escape_char = cpd.settings[UO_string_escape_char].n; char escape_char2 = cpd.settings[UO_string_escape_char2].n; pc.str.clear(); while (quote_idx-- > 0) { pc.str.append(ctx.get()); } pc.type = CT_STRING; end_ch = CharTable::Get(ctx.peek()) & 0xff; pc.str.append(ctx.get()); /* store the " */ while (ctx.more()) { int ch = ctx.get(); pc.str.append(ch); if (ch == '\n') { pc.nl_count++; pc.type = CT_STRING_MULTI; continue; } if ((ch == '\r') && (ctx.peek() != '\n')) { pc.str.append(ctx.get()); pc.nl_count++; pc.type = CT_STRING_MULTI; continue; } if (!escaped) { if (ch == escape_char) { escaped = (escape_char != 0); } else if ((ch == escape_char2) && (ctx.peek() == end_ch)) { escaped = allow_escape; } else if (ch == end_ch) { break; } } else { escaped = false; } } parse_suffix(ctx, pc, true); return(true); } /** * Literal string, ends with single " * Two "" don't end the string. * * @param pc The structure to update, str is an input. * @return Whether a string was parsed */ static bool parse_cs_string(tok_ctx& ctx, chunk_t& pc) { pc.str = ctx.get(); pc.str.append(ctx.get()); /* go until we hit a zero (end of file) or a single " */ while (ctx.more()) { int ch = ctx.get(); pc.str.append(ch); if (ch == '"') { if (ctx.peek() == '"') { pc.str.append(ctx.get()); } else { break; } } } pc.type = CT_STRING; return(true); } static bool tag_compare(const deque& d, int a_idx, int b_idx, int len) { if (a_idx != b_idx) { while (len-- > 0) { if (d[a_idx] != d[b_idx]) { return false; } } } return true; } /** * Parses a C++0x 'R' string. R"( xxx )" R"tag( )tag" u8R"(x)" uR"(x)" * Newlines may be in the string. */ static bool parse_cr_string(tok_ctx& ctx, chunk_t& pc, int q_idx) { int cnt; int tag_idx = ctx.c.idx + q_idx + 1; int tag_len = 0; ctx.save(); /* Copy the prefix + " to the string */ pc.str.clear(); cnt = q_idx + 1; while (cnt--) { pc.str.append(ctx.get()); } /* Add the tag and get the length of the tag */ while (ctx.more() && (ctx.peek() != '(')) { tag_len++; pc.str.append(ctx.get()); } if (ctx.peek() != '(') { ctx.restore(); return(false); } pc.type = CT_STRING; while (ctx.more()) { if ((ctx.peek() == ')') && (ctx.peek(tag_len + 1) == '"') && tag_compare(ctx.data, tag_idx, ctx.c.idx + 1, tag_len)) { cnt = tag_len + 2; /* for the )" */ while (cnt--) { pc.str.append(ctx.get()); } parse_suffix(ctx, pc); return(true); } if (ctx.peek() == '\n') { pc.str.append(ctx.get()); pc.nl_count++; pc.type = CT_STRING_MULTI; } else { pc.str.append(ctx.get()); } } ctx.restore(); return(false); } /** * Count the number of characters in a word. * The first character is already valid for a keyword * * @param pc The structure to update, str is an input. * @return Whether a word was parsed (always true) */ bool parse_word(tok_ctx& ctx, chunk_t& pc, bool skipcheck) { int ch; /* The first character is already valid */ pc.str.clear(); pc.str.append(ctx.get()); while (ctx.more() && CharTable::IsKw2(ctx.peek())) { ch = ctx.get(); pc.str.append(ch); /* HACK: Non-ASCII character are only allowed in identifiers */ if (ch > 0x7f) { skipcheck = true; } } pc.type = CT_WORD; if (skipcheck) { return(true); } /* Detect pre-processor functions now */ if ((cpd.in_preproc == CT_PP_DEFINE) && (cpd.preproc_ncnl_count == 1)) { if (ctx.peek() == '(') { pc.type = CT_MACRO_FUNC; } else { pc.type = CT_MACRO; } } else { /* Turn it into a keyword now */ pc.type = find_keyword_type(pc.str.c_str(), pc.str.size()); } return(true); } /** * Count the number of whitespace characters. * * @param pc The structure to update, str is an input. * @return Whether whitespace was parsed */ static bool parse_whitespace(tok_ctx& ctx, chunk_t& pc) { int nl_count = 0; int ch = -2; /* REVISIT: use a better whitespace detector? */ while (ctx.more() && unc_isspace(ctx.peek())) { ch = ctx.get(); /* throw away the whitespace char */ switch (ch) { case '\r': if (ctx.peek() == '\n') { /* CRLF ending */ ctx.get(); /* throw away \n */ cpd.le_counts[LE_CRLF]++; } else { /* CR ending */ cpd.le_counts[LE_CR]++; } nl_count++; break; case '\n': /* LF ending */ cpd.le_counts[LE_LF]++; nl_count++; break; case '\t': case ' ': default: break; } } if (ch != -2) { pc.str.clear(); pc.nl_count = nl_count; pc.type = nl_count ? CT_NEWLINE : CT_WHITESPACE; pc.after_tab = (ctx.c.last_ch == '\t'); return(true); } return(false); } /** * Called when we hit a backslash. * If there is nothing but whitespace until the newline, then this is a * backslash newline */ static bool parse_bs_newline(tok_ctx& ctx, chunk_t& pc) { ctx.save(); ctx.get(); /* skip the '\' */ int ch; while (ctx.more() && unc_isspace(ch = ctx.peek())) { ctx.get(); if ((ch == '\r') || (ch == '\n')) { if (ch == '\r') { ctx.expect('\n'); } pc.str = "\\"; pc.type = CT_NL_CONT; pc.nl_count = 1; return(true); } } ctx.restore(); return(false); } /** * Parses any number of tab or space chars followed by a newline. * Does not change pc.len if a newline isn't found. * This is not the same as parse_whitespace() because it only consumes until * a single newline is encountered. */ static bool parse_newline(tok_ctx& ctx) { ctx.save(); /* Eat whitespace */ while ((ctx.peek() == ' ') || (ctx.peek() == '\t')) { ctx.get(); } if ((ctx.peek() == '\r') || (ctx.peek() == '\n')) { if (ctx.peek() == '\n') { ctx.get(); } else /* it is '\r' */ { ctx.get(); if (ctx.peek() == '\n') { ctx.get(); } } return(true); } ctx.restore(); return(false); } static bool parse_ignored(tok_ctx& ctx, chunk_t& pc) { int nl_count = 0; /* Parse off newlines/blank lines */ while (parse_newline(ctx)) { nl_count++; } if (nl_count > 0) { pc.nl_count = nl_count; pc.type = CT_NEWLINE; return(true); } /* See if the INDENT-ON text is on this line */ ctx.save(); pc.str.clear(); while (ctx.more() && (ctx.peek() != '\r') && (ctx.peek() != '\n')) { pc.str.append(ctx.get()); } if (pc.str.size() == 0) { /* end of file? */ return(false); } /* Note that we aren't actually making sure this is in a comment, yet */ if (pc.str.find(UNCRUSTIFY_ON_TEXT) < 0) { pc.type = CT_IGNORED; return(true); } ctx.restore(); /* parse off whitespace leading to the comment */ if (parse_whitespace(ctx, pc)) { pc.type = CT_IGNORED; return(true); } /* Look for the ending comment and let it pass */ if (parse_comment(ctx, pc) && !cpd.unc_off) { return(true); } /* Reset the chunk & scan to until a newline */ pc.str.clear(); while (ctx.more() && (ctx.peek() != '\r') && (ctx.peek() != '\n')) { pc.str.append(ctx.get()); } if (pc.str.size() > 0) { pc.type = CT_IGNORED; return(true); } return(false); } /** * Skips the next bit of whatever and returns the type of block. * * pc.str is the input text. * pc.len in the output length. * pc.type is the output type * pc.column is output column * * @param pc The structure to update, str is an input. * @return true/false - whether anything was parsed */ static bool parse_next(tok_ctx& ctx, chunk_t& pc) { const chunk_tag_t *punc; int ch, ch1; if (!ctx.more()) { //fprintf(stderr, "All done!\n"); return(false); } /* Save off the current column */ pc.orig_line = ctx.c.row; pc.column = ctx.c.col; pc.orig_col = ctx.c.col; pc.type = CT_NONE; pc.nl_count = 0; pc.flags = 0; /* If it is turned off, we put everything except newlines into CT_UNKNOWN */ if (cpd.unc_off) { if (parse_ignored(ctx, pc)) { return(true); } } /** * Parse whitespace */ if (parse_whitespace(ctx, pc)) { return(true); } /** * Handle unknown/unhandled preprocessors */ if ((cpd.in_preproc > CT_PP_BODYCHUNK) && (cpd.in_preproc <= CT_PP_OTHER)) { pc.str.clear(); tok_info ss; ctx.save(ss); /* Chunk to a newline or comment */ pc.type = CT_PREPROC_BODY; int last = 0; while (ctx.more()) { int ch = ctx.peek(); if ((ch == '\n') || (ch == '\r')) { /* Back off if this is an escaped newline */ if (last == '\\') { ctx.restore(ss); pc.str.pop_back(); } break; } /* Quit on a C++ comment start */ if ((ch == '/') && (ctx.peek(1) == '/')) { break; } last = ch; ctx.save(ss); pc.str.append(ctx.get()); } if (pc.str.size() > 0) { return(true); } } /** * Detect backslash-newline */ if ((ctx.peek() == '\\') && parse_bs_newline(ctx, pc)) { return(true); } /** * Parse comments */ if (parse_comment(ctx, pc)) { return(true); } /* Check for C# literal strings, ie @"hello" and identifiers @for*/ if (((cpd.lang_flags & LANG_CS) != 0) && (ctx.peek() == '@')) { if (ctx.peek(1) == '"') { parse_cs_string(ctx, pc); return(true); } /* check for non-keyword identifiers such as @if @switch, etc */ if (CharTable::IsKw1(ctx.peek(1))) { parse_word(ctx, pc, true); return(true); } } /* Check for Obj-C NSString constants, ie @"hello" */ if (((cpd.lang_flags & LANG_OC) != 0) && (ctx.peek() == '@')) { if (ctx.peek(1) == '"') { parse_string(ctx, pc, 1, true); return(true); } } /* handle C++0x strings u8"x" u"x" U"x" R"x" u8R"XXX(I'm a "raw UTF-8" string.)XXX" */ ch = ctx.peek(); if (((cpd.lang_flags & LANG_CPP) != 0) && ((ch == 'u') || (ch == 'U') || (ch == 'R'))) { int idx = 0; bool is_real = false; if ((ch == 'u') && (ctx.peek(1) == '8')) { idx = 2; } else if (unc_tolower(ch) == 'u') { idx++; } if (ctx.peek(idx) == 'R') { idx++; is_real = true; } if (ctx.peek(idx) == '"') { if (is_real) { if (parse_cr_string(ctx, pc, idx)) { return(true); } } else { if (parse_string(ctx, pc, idx, true)) { parse_suffix(ctx, pc, true); return(true); } } } } /* PAWN specific stuff */ if ((cpd.lang_flags & LANG_PAWN) != 0) { /* Check for PAWN strings: \"hi" or !"hi" or !\"hi" or \!"hi" */ if ((ctx.peek() == '\\') || (ctx.peek() == '!')) { if (ctx.peek(1) == '"') { parse_string(ctx, pc, 1, (ctx.peek() == '!')); return(true); } else if (((ctx.peek(1) == '\\') || (ctx.peek(1) == '!')) && (ctx.peek(2) == '"')) { parse_string(ctx, pc, 2, false); return(true); } } } /** * Parse strings and character constants */ if (parse_number(ctx, pc)) { return(true); } if ((cpd.lang_flags & LANG_D) != 0) { /* D specific stuff */ if (d_parse_string(ctx, pc)) { return(true); } } else { /* Not D stuff */ /* Check for L'a', L"abc", 'a', "abc", strings */ ch = ctx.peek(); ch1 = ctx.peek(1); if ((((ch == 'L') || (ch == 'S')) && ((ch1 == '"') || (ch1 == '\''))) || (ch == '"') || (ch == '\'') || ((ch == '<') && (cpd.in_preproc == CT_PP_INCLUDE))) { parse_string(ctx, pc, unc_isalpha(ch) ? 1 : 0, true); return(true); } if ((ch == '<') && (cpd.in_preproc == CT_PP_DEFINE)) { if (chunk_get_tail()->type == CT_MACRO) { /* We have "#define XXX <", assume '<' starts an include string */ parse_string(ctx, pc, 0, false); return(true); } } } /* Check for pawn/ObjectiveC and normal identifiers */ if (CharTable::IsKw1(ctx.peek()) || ((ctx.peek() == '@') && CharTable::IsKw2(ctx.peek(1)))) { parse_word(ctx, pc, false); return(true); } /* see if we have a punctuator */ char punc_txt[4]; punc_txt[0] = ctx.peek(); punc_txt[1] = ctx.peek(1); punc_txt[2] = ctx.peek(2); punc_txt[3] = ctx.peek(3); if ((punc = find_punctuator(punc_txt, cpd.lang_flags)) != NULL) { int cnt = strlen(punc->tag); while (cnt--) { pc.str.append(ctx.get()); } pc.type = punc->type; pc.flags |= PCF_PUNCTUATOR; return(true); } /* throw away this character */ pc.type = CT_UNKNOWN; pc.str.append(ctx.get()); LOG_FMT(LWARN, "%s:%d Garbage in col %d: %x\n", cpd.filename, pc.orig_line, (int)ctx.c.col, pc.str[0]); cpd.error_count++; return(true); } /** * This function parses or tokenizes the whole buffer into a list. * It has to do some tricks to parse preprocessors. * * If output_text() were called immediately after, two things would happen: * - trailing whitespace are removed. * - leading space & tabs are converted to the appropriate format. * * All the tokens are inserted before ref. If ref is NULL, they are inserted * at the end of the list. Line numbers are relative to the start of the data. */ void tokenize(const deque& data, chunk_t *ref) { tok_ctx ctx(data); chunk_t chunk; chunk_t *pc = NULL; chunk_t *rprev = NULL; chunk_t *prev = NULL; struct parse_frame frm; bool last_was_tab = false; memset(&frm, 0, sizeof(frm)); while (ctx.more()) { chunk.reset(); if (!parse_next(ctx, chunk)) { LOG_FMT(LERR, "%s:%d Bailed before the end?\n", cpd.filename, ctx.c.row); cpd.error_count++; break; } /* Don't create an entry for whitespace */ if (chunk.type == CT_WHITESPACE) { last_was_tab = chunk.after_tab; continue; } if (chunk.type == CT_NEWLINE) { last_was_tab = chunk.after_tab; chunk.after_tab = false; chunk.str.clear(); } else if (chunk.type == CT_NL_CONT) { last_was_tab = chunk.after_tab; chunk.after_tab = false; chunk.str = "\\\n"; } else { chunk.after_tab = last_was_tab; last_was_tab = false; } /* Strip trailing whitespace (for CPP comments and PP blocks) */ while ((chunk.str.size() > 0) && ((chunk.str[chunk.str.size() - 1] == ' ') || (chunk.str[chunk.str.size() - 1] == '\t'))) { chunk.str.pop_back(); } /* Store off the end column */ chunk.orig_col_end = ctx.c.col; /* Add the chunk to the list */ rprev = pc; if (!chunk_is_newline(pc) && !chunk_is_comment(pc)) { prev = pc; } if (rprev != NULL) { pc->flags |= rprev->flags & PCF_COPY_FLAGS; /* a newline can't be in a preprocessor */ if (pc->type == CT_NEWLINE) { pc->flags &= ~PCF_IN_PREPROC; } } if (ref != NULL) { chunk.flags |= PCF_INSERTED; } else { chunk.flags &= ~PCF_INSERTED; } pc = chunk_add_before(&chunk, ref); /* A newline marks the end of a preprocessor */ if (pc->type == CT_NEWLINE) // || (pc->type == CT_COMMENT_MULTI)) { cpd.in_preproc = CT_NONE; cpd.preproc_ncnl_count = 0; } /* Special handling for preprocessor stuff */ if (cpd.in_preproc != CT_NONE) { pc->flags |= PCF_IN_PREPROC; /* Count words after the preprocessor */ if (!chunk_is_comment(pc) && !chunk_is_newline(pc)) { cpd.preproc_ncnl_count++; } /* Figure out the type of preprocessor for #include parsing */ if (cpd.in_preproc == CT_PREPROC) { if ((pc->type < CT_PP_DEFINE) || (pc->type > CT_PP_OTHER)) { pc->type = CT_PP_OTHER; } cpd.in_preproc = pc->type; } } else { /* Check for a preprocessor start */ if ((pc->type == CT_POUND) && ((rprev == NULL) || (rprev->type == CT_NEWLINE))) { pc->type = CT_PREPROC; pc->flags |= PCF_IN_PREPROC; cpd.in_preproc = CT_PREPROC; } } } /* Set the cpd.newline string for this file */ if ((cpd.settings[UO_newlines].le == LE_LF) || ((cpd.settings[UO_newlines].le == LE_AUTO) && (cpd.le_counts[LE_LF] >= cpd.le_counts[LE_CRLF]) && (cpd.le_counts[LE_LF] >= cpd.le_counts[LE_CR]))) { /* LF line ends */ cpd.newline = "\n"; LOG_FMT(LLINEENDS, "Using LF line endings\n"); } else if ((cpd.settings[UO_newlines].le == LE_CRLF) || ((cpd.settings[UO_newlines].le == LE_AUTO) && (cpd.le_counts[LE_CRLF] >= cpd.le_counts[LE_LF]) && (cpd.le_counts[LE_CRLF] >= cpd.le_counts[LE_CR]))) { /* CRLF line ends */ cpd.newline = "\r\n"; LOG_FMT(LLINEENDS, "Using CRLF line endings\n"); } else { /* CR line ends */ cpd.newline = "\r"; LOG_FMT(LLINEENDS, "Using CR line endings\n"); } } // /** // * A simplistic fixed-sized needle in the fixed-size haystack string search. // */ // int str_find(const char *needle, int needle_len, // const char *haystack, int haystack_len) // { // int idx; // // for (idx = 0; idx < (haystack_len - needle_len); idx++) // { // if (memcmp(needle, haystack + idx, needle_len) == 0) // { // return(idx); // } // } // return(-1); // } uncrustify-0.59/src/parens.cpp0000644000175000017500000001204711640477550013403 00000000000000/** * @file parens.cpp * Adds or removes parens. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" #include #include #include #include #include "unc_ctype.h" static void add_parens_between(chunk_t *first, chunk_t *last); static void check_bool_parens(chunk_t *popen, chunk_t *pclose, int nest); void do_parens(void) { chunk_t *pc; chunk_t *pclose; if (cpd.settings[UO_mod_full_paren_if_bool].b) { pc = chunk_get_head(); while ((pc = chunk_get_next_ncnl(pc)) != NULL) { if ((pc->type != CT_SPAREN_OPEN) || ((pc->parent_type != CT_IF) && (pc->parent_type != CT_ELSEIF) && (pc->parent_type != CT_SWITCH))) { continue; } /* Grab the close sparen */ pclose = chunk_get_next_type(pc, CT_SPAREN_CLOSE, pc->level, CNAV_PREPROC); if (pclose != NULL) { check_bool_parens(pc, pclose, 0); pc = pclose; } } } } /** * Add an open paren after first and add a close paren before the last */ static void add_parens_between(chunk_t *first, chunk_t *last) { chunk_t pc; chunk_t *first_n; chunk_t *last_p; chunk_t *tmp; LOG_FMT(LPARADD, "%s: line %d between %s [lvl=%d] and %s [lvl=%d]\n", __func__, first->orig_line, first->str.c_str(), first->level, last->str.c_str(), last->level); /* Don't do anything if we have a bad sequence, ie "&& )" */ first_n = chunk_get_next_ncnl(first); if (first_n == last) { return; } pc.type = CT_PAREN_OPEN; pc.str = "("; pc.flags = first_n->flags & PCF_COPY_FLAGS; pc.level = first_n->level; pc.pp_level = first_n->pp_level; pc.brace_level = first_n->brace_level; chunk_add_before(&pc, first_n); last_p = chunk_get_prev_ncnl(last, CNAV_PREPROC); pc.type = CT_PAREN_CLOSE; pc.str = ")"; pc.flags = last_p->flags & PCF_COPY_FLAGS; pc.level = last_p->level; pc.pp_level = last_p->pp_level; pc.brace_level = last_p->brace_level; chunk_add_after(&pc, last_p); for (tmp = first_n; tmp != last_p; tmp = chunk_get_next_ncnl(tmp)) { tmp->level++; } last_p->level++; } /** * Scans between two parens and adds additional parens if needed. * This function is recursive. If it hits another open paren, it'll call itself * with the new bounds. * * Adds optional parens in an IF or SWITCH conditional statement. * * This basically just checks for a CT_COMPARE that isn't surrounded by parens. * The edges for the compare are the open, close and any CT_BOOL tokens. * * This only handleds VERY simple patterns: * (!a && b) => (!a && b) -- no change * (a && b == 1) => (a && (b == 1)) * (a == 1 || b > 2) => ((a == 1) || (b > 2)) * * FIXME: we really should bail if we transition between a preprocessor and * a non-preprocessor */ static void check_bool_parens(chunk_t *popen, chunk_t *pclose, int nest) { chunk_t *pc; chunk_t *ref = popen; chunk_t *next; bool hit_compare = false; LOG_FMT(LPARADD, "%s(%d): popen on %d, col %d, pclose on %d, col %d, level=%d\n", __func__, nest, popen->orig_line, popen->orig_col, pclose->orig_line, pclose->orig_col, popen->level); pc = popen; while (((pc = chunk_get_next_ncnl(pc)) != NULL) && (pc != pclose)) { if (pc->flags & PCF_IN_PREPROC) { LOG_FMT(LPARADD2, " -- bail on PP %s [%s] at line %d col %d, level %d\n", get_token_name(pc->type), pc->str.c_str(), pc->orig_line, pc->orig_col, pc->level); return; } if ((pc->type == CT_BOOL) || (pc->type == CT_QUESTION) || (pc->type == CT_COND_COLON) || (pc->type == CT_COMMA)) { LOG_FMT(LPARADD2, " -- %s [%s] at line %d col %d, level %d\n", get_token_name(pc->type), pc->str.c_str(), pc->orig_line, pc->orig_col, pc->level); if (hit_compare) { hit_compare = false; add_parens_between(ref, pc); } ref = pc; } else if (pc->type == CT_COMPARE) { LOG_FMT(LPARADD2, " -- compare [%s] at line %d col %d, level %d\n", pc->str.c_str(), pc->orig_line, pc->orig_col, pc->level); hit_compare = true; } else if (chunk_is_paren_open(pc)) { next = chunk_skip_to_match(pc); if (next != NULL) { check_bool_parens(pc, next, nest + 1); pc = next; } } else if ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_SQUARE_OPEN) || (pc->type == CT_ANGLE_OPEN)) { /* Skip [], {}, and <> */ pc = chunk_skip_to_match(pc); } } if (hit_compare && (ref != popen)) { add_parens_between(ref, pclose); } } uncrustify-0.59/src/uncrustify_version.h0000644000175000017500000000054511642741035015532 00000000000000/** * @file uncrustify_version.h * Simply defines UNCRUSTIFY_VERSION. * I don't particularly like how autoconf and friends handle the version... * * @author Ben Gardner * @license GPL v2+ */ #ifndef UNCRUSTIFY_VERSION_H_INCLUDED #define UNCRUSTIFY_VERSION_H_INCLUDED #define UNCRUSTIFY_VERSION "0.59" #endif /* UNCRUSTIFY_VERSION_H_INCLUDED */ uncrustify-0.59/src/universalindentgui.cpp0000644000175000017500000002227111604503524016021 00000000000000/** * @file universalindentgui.cpp * Exports the config file for UniversalIndentGUI */ #include "prototypes.h" #include "uncrustify_version.h" #include "unc_ctype.h" #include void print_universal_indent_cfg(FILE *pfile) { const group_map_value *p_grp; const char *p_name; /* Dump the header and the categories */ fprintf(pfile, "[header]\n"); /* Add all the categories */ char ch = '='; int idx; fprintf(pfile, "categories"); for (idx = 0; idx < UG_group_count; idx++) { p_grp = get_group_name(idx); if (p_grp != NULL) { fprintf(pfile, "%c%s", ch, p_grp->short_desc); ch = '|'; } } fprintf(pfile, "\n"); fprintf(pfile, "cfgFileParameterEnding=cr\n" "configFilename=uncrustify.cfg\n"); /* Add all the recognized file extensions */ ch = '='; idx = 0; fprintf(pfile, "fileTypes"); while ((p_name = get_file_extension(idx)) != NULL) { fprintf(pfile, "%c*%s", ch, p_name); ch = '|'; } fprintf(pfile, "\n"); /* Add the rest of the constant file header */ fprintf(pfile, "indenterFileName=uncrustify\n" "indenterName=Uncrustify (C, C++, C#, ObjectiveC, D, Java, Pawn, VALA)\n" "inputFileName=indentinput\n" "inputFileParameter=\"-f \"\n" "manual=http://uncrustify.sourceforge.net/config.txt\n" "outputFileName=indentoutput\n" "outputFileParameter=\"-o \"\n" "stringparaminquotes=false\n" "parameterOrder=ipo\n" "showHelpParameter=-h\n" "stringparaminquotes=false\n" "useCfgFileParameter=\"-c \"\n" "version=%s\n", UNCRUSTIFY_VERSION); /* Now add each option */ for (idx = 0; idx < UG_group_count; idx++) { p_grp = get_group_name(idx); if (p_grp == NULL) { continue; } for (option_list_cit it = p_grp->options.begin(); it != p_grp->options.end(); it++) { const option_map_value *option = get_option_name(*it); // Create a better readable name from the options name // by replacing '_' by a space and use some upper case characters. char *optionNameReadable = new char[strlen(option->name) + 1]; strcpy(optionNameReadable, option->name); bool was_space = true; for (char *character = optionNameReadable; *character != 0; character++) { if (*character == '_') { *character = ' '; was_space = true; } else if (was_space) { *character = unc_toupper(*character); was_space = false; } } fprintf(pfile, "\n[%s]\n", optionNameReadable); fprintf(pfile, "Category=%d\n", idx); fprintf(pfile, "Description=\""); const char *tmp = option->short_desc; ch = 0; /* Output the decription which may contain forbidden chars */ while (*tmp != 0) { switch (*tmp) { case '<': fprintf(pfile, "<"); break; case '>': fprintf(pfile, ">"); break; case '&': fprintf(pfile, "&"); break; case '\n': fprintf(pfile, "
"); break; default: fputc(*tmp, pfile); } tmp++; } fprintf(pfile, "\"\n"); // Handle some options independent of their type and most by their type. switch (option->id) { // Indenting with tabs selector becomes a multiple selector and not only a number. Also its default enabled. case UO_indent_with_tabs: fprintf(pfile, "Enabled=true\n"); fprintf(pfile, "EditorType=multiple\n"); fprintf(pfile, "Choices=\"%s=0|%s=1|%s=2\"\n", option->name, option->name, option->name); fprintf(pfile, "ChoicesReadable=\"Spaces only|Indent with tabs, align with spaces|Indent and align with tabs\"\n"); fprintf(pfile, "ValueDefault=%d\n", cpd.settings[option->id].n); break; // All not specially handled options are created only dependent by their type. default: fprintf(pfile, "Enabled=false\n"); switch (option->type) { case AT_BOOL: // [align_keep_tabs] // Category=3 // Description=Whether to keep non-indenting tabs // Value=0 // ValueDefault=0 // EditorType=boolean // TrueFalse="align_keep_tabs=true|align_keep_tabs=false" fprintf(pfile, "EditorType=boolean\n"); fprintf(pfile, "TrueFalse=%s=true|%s=false\n", option->name, option->name); fprintf(pfile, "ValueDefault=%d\n", cpd.settings[option->id].n); break; case AT_IARF: fprintf(pfile, "EditorType=multiple\n"); fprintf(pfile, "Choices=\"%s=ignore|%s=add|%s=remove|%s=force\"\n", option->name, option->name, option->name, option->name); fprintf(pfile, "ChoicesReadable=\"Ignore %s|Add %s|Remove %s|Force %s\"\n", optionNameReadable, optionNameReadable, optionNameReadable, optionNameReadable); fprintf(pfile, "ValueDefault=%d\n", cpd.settings[option->id].n); // [nl_after_switch] // Category=4 // Description=Add or remove newline after 'switch' // Value=3 // ValueDefault=-1 // Enabled=true // EditorType=multiple // Choices="nl_after_switch=ignore|nl_after_switch=add|nl_after_switch=remove|nl_after_switch=force" break; case AT_NUM: // [align_assign_span] // CallName="align_assign_span=" // Category=3 // Description="The span for aligning on '=' in assignments (0=don't align)" // EditorType=numeric // Enabled=false // MaxVal=300 // MinVal=0 // Value=0 // ValueDefault=0 fprintf(pfile, "EditorType=numeric\n"); fprintf(pfile, "CallName=\"%s=\"\n", option->name); fprintf(pfile, "MinVal=%d\n", option->min_val); fprintf(pfile, "MaxVal=%d\n", option->max_val); fprintf(pfile, "ValueDefault=%d\n", cpd.settings[option->id].n); break; case AT_LINE: // [newlines] // Category=0 // Description=The type of line endings // Value=0 // ValueDefault=-1 // Enabled=true // EditorType=multiple // Choices="newlines=auto|newlines=lf|newlines=crlf|newlines=cr" fprintf(pfile, "EditorType=multiple\n"); fprintf(pfile, "Choices=\"%s=lf|%s=crlf|%s=cr|%s=auto\"\n", option->name, option->name, option->name, option->name); fprintf(pfile, "ChoicesReadable=\"Newlines Mac|Newlines Win|Newlines Unix|Newlines Auto\"\n"); fprintf(pfile, "ValueDefault=%d\n", cpd.settings[option->id].n); break; case AT_POS: // [pos_bool] // Category=5 // Description=The position of boolean operators in wrapped expressions // Enabled=false // Value=0 // ValueDefault=-1 // EditorType=multiple // Choices="pos_bool=ignore|pos_bool=lead|pos_bool=trail" fprintf(pfile, "EditorType=multiple\n"); fprintf(pfile, "Choices=\"%s=ignore|%s=lead|%s=lead_break|%s=lead_force|%s=trail|%s=trail_break|%s=trail_force\"\n", option->name, option->name, option->name, option->name, option->name, option->name, option->name); fprintf(pfile, "ChoicesReadable=\"Ignore %s|Lead %s|Lead Break %s|Lead Force %s|Trail %s|Trail Break %s|Trail Force %s\"\n", optionNameReadable, optionNameReadable, optionNameReadable, optionNameReadable, optionNameReadable, optionNameReadable, optionNameReadable); fprintf(pfile, "ValueDefault=%d\n", cpd.settings[option->id].n); break; case AT_STRING: { fprintf(pfile, "CallName=%s=\n", option->name); fprintf(pfile, "EditorType=string\n"); string val_string; const char *val_str; val_string = op_val_to_string(option->type, cpd.settings[option->id]); val_str = val_string.c_str(); fprintf(pfile, "ValueDefault=%s\n", val_str); } break; default: break; } } delete [] optionNameReadable; } } } uncrustify-0.59/src/log_levels.h0000644000175000017500000000757411640475722013723 00000000000000/** * @file log_levels.h * * Enum for log levels. * Use these for the log severities in LOG_FMT(), etc. * * @author Ben Gardner * @license GPL v2+ */ #ifndef LOG_LEVELS_H_INCLUDED #define LOG_LEVELS_H_INCLUDED enum { LSYS = 0, LERR = 1, LWARN = 2, LNOTE = 3, LINFO = 4, LDATA = 5, LFILELIST = 8, /* Files in the file list file */ LLINEENDS = 9, /* Show which line endings are used */ LCASTS = 10, /* align casts */ LALBR = 11, /* align braces */ LALTD = 12, /* Align Typedef */ LALPP = 13, /* align #define */ LALPROTO = 14, /* align prototype */ LALNLC = 15, /* align backslash-newline */ LALTC = 16, /* align trailing comments */ LALADD = 17, /* align add */ LALASS = 18, /* align assign */ LFVD = 19, /* fix_var_def */ LFVD2 = 20, /* fix_var_def-2 */ LINDENT = 21, /* indent_text */ LINDENT2 = 22, /* indent_text tab level */ LINDPSE = 23, /* indent_text stack */ LINDPC = 24, /* indent play-by-play */ LNEWLINE = 25, /* newlines */ LPF = 26, /* Parse Frame */ LSTMT = 27, /* Marking statements/expressions */ LTOK = 28, /* Tokenize */ LALRC = 29, /* align right comment */ LCMTIND = 30, /* Comment Indent */ LINDLINE = 31, /* indent line */ LSIB = 32, /* Scan IB */ LRETURN = 33, /* add/remove parens for return */ LBRDEL = 34, /* brace removal */ LFCN = 35, /* function detection */ LFCNP = 36, /* function parameters */ LPCU = 37, /* parse cleanup */ LDYNKW = 38, /* dynamic keywords */ LOUTIND = 39, /* output indent */ LBCSAFTER = 40, /* Brace cleanup stack - after each token */ LBCSPOP = 41, /* Brace cleanup stack - log pops */ LBCSPUSH = 42, /* Brace cleanup stack - log push */ LBCSSWAP = 43, /* Brace cleanup stack - log swaps */ LFTOR = 44, /* Class Ctor or Dtor */ LAS = 45, /* align_stack */ LPPIS = 46, /* Preprocessor Indent and Space */ LTYPEDEF = 47, /* Typedef and function types */ LVARDEF = 48, /* Variable def marking */ LDEFVAL = 49, /* define values */ LPVSEMI = 50, /* Pawn: virtual semicolons */ LPFUNC = 51, /* Pawn: function recognition */ LSPLIT = 52, /* Line splitting */ LFTYPE = 53, /* Function type detection */ LTEMPL = 54, /* Template detection */ LPARADD = 55, /* adding parens in if/while */ LPARADD2 = 56, /* adding parens in if/while - details */ LBLANKD = 57, /* blank line details */ LTEMPFUNC = 58, /* Template function detection */ LSCANSEMI = 59, /* scan semi colon removal */ LDELSEMI = 60, /* Removing semicolons */ LFPARAM = 61, /* Testing for a full parameter */ LNL1LINE = 62, /* NL check for 1 liners */ LPFCHK = 63, /* Parse Frame check fcn call */ LAVDB = 64, /* align var def braces */ LSORT = 65, /* Sorting */ LSPACE = 66, /* Space */ LALIGN = 67, /* align */ LALAGAIN = 68, /* align again */ LOPERATOR = 69, /* operator */ LASFCP = 70, /* Align Same Function Call Params */ LINDLINED = 71, /* indent line details */ LBCTRL = 72, /* beautifier control */ LRMRETURN = 73, /* remove 'return;' */ LPPIF = 74, /* #if/#else/#endif pair processing */ LMCB = 75, /* mod_case_brace */ LBRCH = 76, /* if brace chain */ LFCNR = 77, /* function return type */ LOCCLASS = 78, /* OC Class stuff */ LOCMSG = 79, /* OC Message stuff */ LBLANK = 80, /* Blank Lines */ LOBJCWORD = 81, /* Convert keyword to CT_WORD in certain circumstances */ LCHANGE = 82, /* something changed */ }; #endif /* LOG_LEVELS_H_INCLUDED */ uncrustify-0.59/src/md5.h0000644000175000017500000000125211506773274012244 00000000000000/** * @file md5.h * A simple class for MD5 calculation * * @author Ben Gardner * @license GPL v2+ */ #ifndef MD5_H_INCLUDED #define MD5_H_INCLUDED #include "base_types.h" class MD5 { public: MD5(); ~MD5() { } void Init(); void Update(const void *data, UINT32 len); void Final(UINT8 digest[16]); /* internal function */ static void Transform(UINT32 buf[4], UINT32 in_data[16]); static void Calc(const void *data, UINT32 length, UINT8 digest[16]); private: UINT32 m_buf[4]; UINT32 m_bits[2]; UINT8 m_in[64]; bool m_need_byteswap; bool m_big_endian; void reverse_u32(UINT8 *buf, int n_u32); }; #endif /* MD5_H_INCLUDED */ uncrustify-0.59/src/defines.cpp0000644000175000017500000000632011604475471013525 00000000000000/** * @file defines.cpp * Manages the table of defines for some future time when these will be used to * help decide whether a block of #if'd code should be formatted. * * !! This isn't used right now. !! * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "char_table.h" #include "args.h" #include #include #include #include #include "unc_ctype.h" #include "chunk_list.h" #include "prototypes.h" using namespace std; typedef map defmap; defmap defines; /** * Adds an entry to the define list * * @param tag The tag (string) must be zero terminated * @param value NULL or the value of the define */ void add_define(const char *tag, const char *value) { if ((tag == NULL) || (*tag == 0)) { return; } value = value ? value : ""; /* Try to update an existing entry first */ defmap::iterator it = defines.find(tag); if (it != defines.end()) { (*it).second = value; LOG_FMT(LDEFVAL, "%s: updated '%s' = '%s'\n", __func__, tag, value); return; } /* Insert a new entry */ defines.insert(defmap::value_type(tag, value)); LOG_FMT(LDEFVAL, "%s: added '%s' = '%s'\n", __func__, tag, value); } /** * Loads the defines from a file * * @param filename The path to the file to load * @return SUCCESS or FAILURE */ int load_define_file(const char *filename) { FILE *pf; char buf[160]; char *ptr; char *args[3]; int argc; int line_no = 0; pf = fopen(filename, "r"); if (pf == NULL) { LOG_FMT(LERR, "%s: fopen(%s) failed: %s (%d)\n", __func__, filename, strerror(errno), errno); cpd.error_count++; return(FAILURE); } while (fgets(buf, sizeof(buf), pf) != NULL) { line_no++; /* remove comments */ if ((ptr = strchr(buf, '#')) != NULL) { *ptr = 0; } argc = Args::SplitLine(buf, args, ARRAY_SIZE(args) - 1); args[argc] = 0; if (argc > 0) { if ((argc <= 2) && CharTable::IsKw1(*args[0])) { LOG_FMT(LDEFVAL, "%s: line %d - %s\n", filename, line_no, args[0]); add_define(args[0], args[1]); } else { LOG_FMT(LWARN, "%s: line %d invalid (starts with '%s')\n", filename, line_no, args[0]); cpd.error_count++; } } } fclose(pf); return(SUCCESS); } void output_defines(FILE *pfile) { if (defines.size() > 0) { fprintf(pfile, "-== User Defines ==-\n"); defmap::iterator it; for (it = defines.begin(); it != defines.end(); ++it) { if ((*it).second.size() > 0) { fprintf(pfile, "%s = %s\n", (*it).first.c_str(), (*it).second.c_str()); } else { fprintf(pfile, "%s\n", (*it).first.c_str()); } } } } void print_defines(FILE *pfile) { defmap::iterator it; for (it = defines.begin(); it != defines.end(); ++it) { fprintf(pfile, "define %*.s%s \"%s\"\n", cpd.max_option_name_len - 6, " ", (*it).first.c_str(), (*it).second.c_str()); } } void clear_defines(void) { defines.clear(); } uncrustify-0.59/src/braces.cpp0000644000175000017500000007026711630457175013362 00000000000000/** * @file braces.cpp * Adds or removes braces. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" #include #include #include #include #include "unc_ctype.h" static void convert_brace(chunk_t *br); static void convert_vbrace(chunk_t *br); static void convert_vbrace_to_brace(void); static void examine_braces(void); static void examine_brace(chunk_t *bopen); static void move_case_break(void); static void mod_case_brace(void); static void mod_full_brace_if_chain(void); static bool can_remove_braces(chunk_t *bopen); static bool should_add_braces(chunk_t *vbopen); void do_braces(void) { if (((cpd.settings[UO_mod_full_brace_if].a | cpd.settings[UO_mod_full_brace_do].a | cpd.settings[UO_mod_full_brace_for].a | cpd.settings[UO_mod_full_brace_using].a | cpd.settings[UO_mod_full_brace_while].a) & AV_REMOVE) != 0) { examine_braces(); } /* convert vbraces if needed */ if (((cpd.settings[UO_mod_full_brace_if].a | cpd.settings[UO_mod_full_brace_do].a | cpd.settings[UO_mod_full_brace_for].a | cpd.settings[UO_mod_full_brace_function].a | cpd.settings[UO_mod_full_brace_using].a | cpd.settings[UO_mod_full_brace_while].a) & AV_ADD) != 0) { convert_vbrace_to_brace(); } if (cpd.settings[UO_mod_full_brace_if_chain].b) { mod_full_brace_if_chain(); } /* Mark one-liners */ chunk_t *pc; chunk_t *br_open; chunk_t *tmp; c_token_t brc_type; pc = chunk_get_head(); while ((pc = chunk_get_next_ncnl(pc)) != NULL) { if ((pc->type != CT_BRACE_OPEN) && (pc->type != CT_VBRACE_OPEN)) { continue; } br_open = pc; brc_type = c_token_t(pc->type + 1); /* Detect empty bodies */ tmp = chunk_get_next_ncnl(pc); if ((tmp != NULL) && (tmp->type == brc_type)) { br_open->flags |= PCF_EMPTY_BODY; tmp->flags |= PCF_EMPTY_BODY; } /* Scan for the brace close or a newline */ tmp = br_open; while ((tmp = chunk_get_next_nc(tmp)) != NULL) { if (chunk_is_newline(tmp)) { break; } if ((tmp->type == brc_type) && (br_open->level == tmp->level)) { flag_series(br_open, tmp, PCF_ONE_LINER); break; } } } if (cpd.settings[UO_mod_case_brace].a != AV_IGNORE) { mod_case_brace(); } if (cpd.settings[UO_mod_move_case_break].b) { move_case_break(); } } /** * Go backwards to honor brace newline removal limits */ static void examine_braces(void) { chunk_t *pc; chunk_t *prev; pc = chunk_get_tail(); while (pc != NULL) { prev = chunk_get_prev_type(pc, CT_BRACE_OPEN, -1); if ((pc->type == CT_BRACE_OPEN) && ((pc->flags & PCF_IN_PREPROC) == 0)) { if ((((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE) || (pc->parent_type == CT_ELSEIF)) && ((cpd.settings[UO_mod_full_brace_if].a) == AV_REMOVE)) || ((pc->parent_type == CT_DO) && ((cpd.settings[UO_mod_full_brace_do].a) == AV_REMOVE)) || ((pc->parent_type == CT_FOR) && ((cpd.settings[UO_mod_full_brace_for].a) == AV_REMOVE)) || ((pc->parent_type == CT_USING_STMT) && ((cpd.settings[UO_mod_full_brace_using].a) == AV_REMOVE)) || ((pc->parent_type == CT_WHILE) && ((cpd.settings[UO_mod_full_brace_while].a) == AV_REMOVE))) { examine_brace(pc); } } pc = prev; } } /** * Checks to see if the virtual braces should be converted to real braces. * - over a certain length * * @param vbopen Virtual Brace Open chunk * @return true (convert to real braces) or false (leave alone) */ static bool should_add_braces(chunk_t *vbopen) { chunk_t *pc; int nl_max = cpd.settings[UO_mod_full_brace_nl].n; int nl_count = 0; if (nl_max == 0) { return(false); } LOG_FMT(LBRDEL, "%s: start on %d : ", __func__, vbopen->orig_line); for (pc = chunk_get_next_nc(vbopen, CNAV_PREPROC); (pc != NULL) && (pc->level > vbopen->level); pc = chunk_get_next_nc(pc, CNAV_PREPROC)) { if (chunk_is_newline(pc)) { nl_count += pc->nl_count; } } if ((pc != NULL) && (nl_count > nl_max) && (vbopen->pp_level == pc->pp_level)) { LOG_FMT(LBRDEL, " exceeded %d newlines\n", nl_max); return(true); } return(false); } /** * Checks to see if the braces can be removed. * - less than a certain length * - doesn't mess up if/else stuff */ static bool can_remove_braces(chunk_t *bopen) { chunk_t *pc; chunk_t *prev = NULL; int semi_count = 0; int level = bopen->level + 1; bool hit_semi = false; bool was_fcn = false; int nl_max = cpd.settings[UO_mod_full_brace_nl].n; int nl_count = 0; int if_count = 0; int br_count = 0; /* Cannot remove braces inside a preprocessor */ if (bopen->flags & PCF_IN_PREPROC) { return(false); } pc = chunk_get_next_ncnl(bopen, CNAV_PREPROC); if ((pc != NULL) && (pc->type == CT_BRACE_CLOSE)) { /* Can't remove empty statement */ return(false); } LOG_FMT(LBRDEL, "%s: start on %d : ", __func__, bopen->orig_line); pc = chunk_get_next_nc(bopen, CNAV_PREPROC); while ((pc != NULL) && (pc->level >= level)) { if (chunk_is_newline(pc)) { nl_count += pc->nl_count; if ((nl_max > 0) && (nl_count > nl_max)) { LOG_FMT(LBRDEL, " exceeded %d newlines\n", nl_max); return(false); } } else { if (pc->type == CT_BRACE_OPEN) { br_count++; } else if (pc->type == CT_BRACE_CLOSE) { br_count--; } else if ((pc->type == CT_IF) || (pc->type == CT_ELSEIF)) { if (br_count == 0) { if_count++; } } if (pc->level == level) { if ((semi_count > 0) && hit_semi) { /* should have bailed due to close brace level drop */ LOG_FMT(LBRDEL, " no close brace\n"); return(false); } LOG_FMT(LBRDEL, " [%s %d-%d]", pc->str.c_str(), pc->orig_line, semi_count); if (pc->type == CT_ELSE) { LOG_FMT(LBRDEL, " bailed on %s on line %d\n", pc->str.c_str(), pc->orig_line); return(false); } was_fcn = (prev != NULL) && (prev->type == CT_FPAREN_CLOSE); if (chunk_is_semicolon(pc) || (pc->type == CT_IF) || (pc->type == CT_ELSEIF) || (pc->type == CT_FOR) || (pc->type == CT_DO) || (pc->type == CT_WHILE) || (pc->type == CT_USING_STMT) || ((pc->type == CT_BRACE_OPEN) && was_fcn)) { hit_semi |= chunk_is_semicolon(pc); if (++semi_count > 1) { LOG_FMT(LBRDEL, " bailed on %d because of %s on line %d\n", bopen->orig_line, pc->str.c_str(), pc->orig_line); return(false); } } } } prev = pc; pc = chunk_get_next_nc(pc, CNAV_PREPROC); } if (pc == NULL) { LOG_FMT(LBRDEL, " NULL\n"); return(false); } if ((pc->type == CT_BRACE_CLOSE) && (pc->parent_type == CT_IF)) { chunk_t *next = chunk_get_next_ncnl(pc, CNAV_PREPROC); prev = chunk_get_prev_ncnl(pc, CNAV_PREPROC); if ((next != NULL) && (next->type == CT_ELSE) && ((prev->type == CT_BRACE_CLOSE) || (prev->type == CT_VBRACE_CLOSE)) && (prev->parent_type == CT_IF)) { LOG_FMT(LBRDEL, " - bailed on '%s'[%s] on line %d due to 'if' and 'else' sequence\n", get_token_name(pc->type), get_token_name(pc->parent_type), pc->orig_line); return(false); } } LOG_FMT(LBRDEL, " - end on '%s' on line %d. if_count=%d semi_count=%d\n", get_token_name(pc->type), pc->orig_line, if_count, semi_count); return((pc->type == CT_BRACE_CLOSE) && (pc->pp_level == bopen->pp_level)); } /** * Step forward and count the number of semi colons at the current level. * Abort if more than 1 or if we enter a preprocessor */ static void examine_brace(chunk_t *bopen) { chunk_t *pc; chunk_t *next; chunk_t *prev = NULL; int semi_count = 0; int level = bopen->level + 1; bool hit_semi = false; bool was_fcn = false; int nl_max = cpd.settings[UO_mod_full_brace_nl].n; int nl_count = 0; int if_count = 0; int br_count = 0; LOG_FMT(LBRDEL, "%s: start on %d : ", __func__, bopen->orig_line); pc = chunk_get_next_nc(bopen); while ((pc != NULL) && (pc->level >= level)) { if ((pc->flags & PCF_IN_PREPROC) != 0) { LOG_FMT(LBRDEL, " PREPROC\n"); return; } if (chunk_is_newline(pc)) { nl_count += pc->nl_count; if ((nl_max > 0) && (nl_count > nl_max)) { LOG_FMT(LBRDEL, " exceeded %d newlines\n", nl_max); return; } } else { if (pc->type == CT_BRACE_OPEN) { br_count++; } else if (pc->type == CT_BRACE_CLOSE) { br_count--; if (br_count == 0) { next = chunk_get_next_ncnl(pc, CNAV_PREPROC); if ((next == NULL) || (next->type != CT_BRACE_CLOSE)) { LOG_FMT(LBRDEL, " junk after close brace\n"); return; } } } else if ((pc->type == CT_IF) || (pc->type == CT_ELSEIF)) { if (br_count == 0) { if_count++; } } if (pc->level == level) { if ((semi_count > 0) && hit_semi) { /* should have bailed due to close brace level drop */ LOG_FMT(LBRDEL, " no close brace\n"); return; } LOG_FMT(LBRDEL, " [%s %d-%d]", pc->str.c_str(), pc->orig_line, semi_count); if (pc->type == CT_ELSE) { LOG_FMT(LBRDEL, " bailed on %s on line %d\n", pc->str.c_str(), pc->orig_line); return; } was_fcn = (prev != NULL) && (prev->type == CT_FPAREN_CLOSE); if (chunk_is_semicolon(pc) || (pc->type == CT_IF) || (pc->type == CT_ELSEIF) || (pc->type == CT_FOR) || (pc->type == CT_DO) || (pc->type == CT_WHILE) || (pc->type == CT_USING_STMT) || ((pc->type == CT_BRACE_OPEN) && was_fcn)) { hit_semi |= chunk_is_semicolon(pc); if (++semi_count > 1) { LOG_FMT(LBRDEL, " bailed on %d because of %s on line %d\n", bopen->orig_line, pc->str.c_str(), pc->orig_line); return; } } } } prev = pc; pc = chunk_get_next_nc(pc); } if (pc == NULL) { LOG_FMT(LBRDEL, " NULL\n"); return; } LOG_FMT(LBRDEL, " - end on '%s' on line %d. if_count=%d semi_count=%d\n", get_token_name(pc->type), pc->orig_line, if_count, semi_count); if (pc->type == CT_BRACE_CLOSE) { next = chunk_get_next_ncnl(pc); while ((next != NULL) && (next->type == CT_VBRACE_CLOSE)) { next = chunk_get_next_ncnl(next); } LOG_FMT(LBRDEL, " next is '%s'\n", get_token_name(next->type)); if ((if_count > 0) && ((next->type == CT_ELSE) || (next->type == CT_ELSEIF))) { LOG_FMT(LBRDEL, " bailed on because 'else' is next and %d ifs\n", if_count); return; } if (semi_count > 0) { if (bopen->parent_type == CT_ELSE) { next = chunk_get_next_ncnl(bopen); if (next->type == CT_IF) { prev = chunk_get_prev_ncnl(bopen); LOG_FMT(LBRDEL, " else-if removing braces on line %d and %d\n", bopen->orig_line, pc->orig_line); chunk_del(bopen); chunk_del(pc); newline_del_between(prev, next); if (cpd.settings[UO_nl_else_if].a & AV_ADD) { newline_add_between(prev, next); } return; } } /* we have a pair of braces with only 1 statement inside */ convert_brace(bopen); convert_brace(pc); LOG_FMT(LBRDEL, " removing braces on line %d and %d\n", bopen->orig_line, pc->orig_line); } else { LOG_FMT(LBRDEL, " empty statement\n"); } } else { LOG_FMT(LBRDEL, " not a close brace? - '%s'\n", pc->str.c_str()); } } /** * Converts a single brace into a virtual brace */ static void convert_brace(chunk_t *br) { chunk_t *tmp; if (br == NULL) { return; } else if (br->type == CT_BRACE_OPEN) { br->type = CT_VBRACE_OPEN; br->str.clear(); tmp = chunk_get_prev(br); } else if (br->type == CT_BRACE_CLOSE) { br->type = CT_VBRACE_CLOSE; br->str.clear(); tmp = chunk_get_next(br); } else { return; } if (chunk_is_newline(tmp)) { if (tmp->nl_count > 1) { tmp->nl_count--; } else { if (chunk_safe_to_del_nl(tmp)) { chunk_del(tmp); } } } } /** * Converts a single virtual brace into a brace */ static void convert_vbrace(chunk_t *vbr) { if (vbr == NULL) { return; } else if (vbr->type == CT_VBRACE_OPEN) { vbr->type = CT_BRACE_OPEN; vbr->str = "{"; /* If the next chunk is a preprocessor, then move the open brace after the * preprocessor. */ chunk_t *tmp = chunk_get_next(vbr); if ((tmp != NULL) && (tmp->type == CT_PREPROC)) { tmp = chunk_get_next(vbr, CNAV_PREPROC); chunk_move_after(vbr, tmp); newline_add_after(vbr); } } else if (vbr->type == CT_VBRACE_CLOSE) { vbr->type = CT_BRACE_CLOSE; vbr->str = "}"; /* If the next chunk is a comment, followed by a newline, then * move the brace after the newline and add another newline after * the close brace. */ chunk_t *tmp = chunk_get_next(vbr); if (chunk_is_comment(tmp)) { tmp = chunk_get_next(tmp); if (chunk_is_newline(tmp)) { chunk_move_after(vbr, tmp); newline_add_after(vbr); } } } } static void convert_vbrace_to_brace(void) { chunk_t *pc; chunk_t *tmp; chunk_t *vbc; bool in_preproc; /* Find every vbrace open */ for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnl(pc)) { if (pc->type != CT_VBRACE_OPEN) { continue; } in_preproc = (pc->flags & PCF_IN_PREPROC) != 0; if ((((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE) || (pc->parent_type == CT_ELSEIF)) && ((cpd.settings[UO_mod_full_brace_if].a & AV_ADD) != 0)) || ((pc->parent_type == CT_FOR) && ((cpd.settings[UO_mod_full_brace_for].a & AV_ADD) != 0)) || ((pc->parent_type == CT_DO) && ((cpd.settings[UO_mod_full_brace_do].a & AV_ADD) != 0)) || ((pc->parent_type == CT_WHILE) && ((cpd.settings[UO_mod_full_brace_while].a & AV_ADD) != 0)) || ((pc->parent_type == CT_USING_STMT) && ((cpd.settings[UO_mod_full_brace_using].a & AV_ADD) != 0)) || ((pc->parent_type == CT_FUNC_DEF) && ((cpd.settings[UO_mod_full_brace_function].a & AV_ADD) != 0))) { /* Find the matching vbrace close */ vbc = NULL; tmp = pc; while ((tmp = chunk_get_next(tmp)) != NULL) { if (in_preproc && ((tmp->flags & PCF_IN_PREPROC) == 0)) { /* Can't leave a preprocessor */ break; } if ((pc->brace_level == tmp->brace_level) && (tmp->type == CT_VBRACE_CLOSE) && (pc->parent_type == tmp->parent_type) && ((tmp->flags & PCF_IN_PREPROC) == (pc->flags & PCF_IN_PREPROC))) { vbc = tmp; break; } } if (vbc == NULL) { continue; } convert_vbrace(pc); convert_vbrace(vbc); } } } /** * Adds a comment after the ref chunk * Returns the added chunk or NULL */ chunk_t *insert_comment_after(chunk_t *ref, c_token_t cmt_type, const unc_text& cmt_text) { chunk_t new_cmt; new_cmt = *ref; new_cmt.prev = NULL; new_cmt.next = NULL; new_cmt.flags = (ref->flags & PCF_COPY_FLAGS); new_cmt.type = cmt_type; new_cmt.str.clear(); if (cmt_type == CT_COMMENT_CPP) { new_cmt.str.append("// "); new_cmt.str.append(cmt_text); } else { new_cmt.str.append("/* "); new_cmt.str.append(cmt_text); new_cmt.str.append(" */"); } /* TODO: expand comment type to cover other comment styles? */ new_cmt.column = ref->column + ref->len() + 1; new_cmt.orig_col = new_cmt.column; return(chunk_add_after(&new_cmt, ref)); } /* * See also it's preprocessor counterpart * add_long_preprocessor_conditional_block_comment * in defines.cpp */ void add_long_closebrace_comment(void) { chunk_t *pc; chunk_t *tmp; chunk_t *br_open; chunk_t *br_close; chunk_t *fcn_pc = NULL; chunk_t *sw_pc = NULL; int nl_count; pc = chunk_get_head(); while ((pc = chunk_get_next_ncnl(pc)) != NULL) { if ((pc->type == CT_FUNC_DEF) || (pc->type == CT_OC_MSG_DECL)) { fcn_pc = pc; } else if (pc->type == CT_SWITCH) { /* kinda pointless, since it always has the text "switch" */ sw_pc = pc; } if ((pc->type != CT_BRACE_OPEN) || ((pc->flags & PCF_IN_PREPROC) != 0)) { continue; } br_open = pc; nl_count = 0; tmp = pc; while ((tmp = chunk_get_next(tmp)) != NULL) { if (chunk_is_newline(tmp)) { nl_count += tmp->nl_count; } else if ((tmp->level == br_open->level) && (tmp->type == CT_BRACE_CLOSE)) { br_close = tmp; //LOG_FMT(LSYS, "found brace pair on lines %d and %d, nl_count=%d\n", // br_open->orig_line, br_close->orig_line, nl_count); /* Found the matching close brace - make sure a newline is next */ tmp = chunk_get_next(tmp); if ((tmp == NULL) || chunk_is_newline(tmp)) { int nl_min = 0; chunk_t *tag_pc = NULL; if (br_open->parent_type == CT_SWITCH) { nl_min = cpd.settings[UO_mod_add_long_switch_closebrace_comment].n; tag_pc = sw_pc; } else if ((br_open->parent_type == CT_FUNC_DEF) || (br_open->parent_type == CT_OC_MSG_DECL)) { nl_min = cpd.settings[UO_mod_add_long_function_closebrace_comment].n; tag_pc = fcn_pc; } if ((nl_min > 0) && (nl_count >= nl_min) && (tag_pc != NULL)) { /* determine the added comment style */ c_token_t style = (cpd.lang_flags & (LANG_CPP | LANG_CS)) ? CT_COMMENT_CPP : CT_COMMENT; /* Add a comment after the close brace */ insert_comment_after(br_close, style, tag_pc->str); } } break; } } } } static void move_case_break(void) { chunk_t *pc; chunk_t *prev = NULL; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnl(pc)) { if ((pc->type == CT_BREAK) && (prev != NULL) && (prev->type == CT_BRACE_CLOSE) && (prev->parent_type == CT_CASE)) { if (chunk_is_newline(chunk_get_prev(pc)) && chunk_is_newline(chunk_get_prev(prev))) { chunk_swap_lines(prev, pc); } } prev = pc; } } /** * Remove the case brace, if allowable. */ static chunk_t *mod_case_brace_remove(chunk_t *br_open) { chunk_t *pc; chunk_t *br_close; chunk_t *next = chunk_get_next_ncnl(br_open, CNAV_PREPROC); LOG_FMT(LMCB, "%s: line %d", __func__, br_open->orig_line); /* Find the matching brace close */ br_close = chunk_get_next_type(br_open, CT_BRACE_CLOSE, br_open->level, CNAV_PREPROC); if (br_close == NULL) { LOG_FMT(LMCB, " - no close\n"); return(next); } /* Make sure 'break', 'return', 'goto', 'case' or '}' is after the close brace */ pc = chunk_get_next_ncnl(br_close, CNAV_PREPROC); if ((pc == NULL) || ((pc->type != CT_BREAK) && (pc->type != CT_RETURN) && (pc->type != CT_CASE) && (pc->type != CT_GOTO) && (pc->type != CT_BRACE_CLOSE))) { LOG_FMT(LMCB, " - after '%s'\n", (pc == NULL) ? "" : get_token_name(pc->type)); return(next); } /* scan to make sure there are no definitions at brace level between braces */ for (pc = br_open; pc != br_close; pc = chunk_get_next_ncnl(pc, CNAV_PREPROC)) { if ((pc->level == (br_open->level + 1)) && (pc->flags & PCF_VAR_DEF)) { LOG_FMT(LMCB, " - vardef on line %d: '%s'\n", pc->orig_line, pc->str.c_str()); return(next); } } LOG_FMT(LMCB, " - removing braces on lines %d and %d\n", br_open->orig_line, br_close->orig_line); for (pc = br_open; pc != br_close; pc = chunk_get_next_ncnl(pc, CNAV_PREPROC)) { pc->brace_level--; pc->level--; } next = chunk_get_prev(br_open, CNAV_PREPROC); chunk_del(br_open); chunk_del(br_close); return(chunk_get_next(next, CNAV_PREPROC)); } /** * Add the case brace, if allowable. */ static chunk_t *mod_case_brace_add(chunk_t *cl_colon) { chunk_t *pc = cl_colon; chunk_t *last = NULL; chunk_t *next = chunk_get_next_ncnl(cl_colon, CNAV_PREPROC); chunk_t *br_open; chunk_t *br_close; chunk_t chunk; LOG_FMT(LMCB, "%s: line %d", __func__, pc->orig_line); while ((pc = chunk_get_next_ncnl(pc, CNAV_PREPROC)) != NULL) { if (pc->level < cl_colon->level) { LOG_FMT(LMCB, " - level drop\n"); return(next); } if ((pc->level == cl_colon->level) && ((pc->type == CT_CASE) || (pc->type == CT_BREAK))) { last = pc; //if (pc->type == CT_BREAK) //{ // /* Step past the semicolon */ // last = chunk_get_next_ncnl(chunk_get_next_ncnl(last)); //} break; } } if (last == NULL) { LOG_FMT(LMCB, " - NULL last\n"); return(next); } LOG_FMT(LMCB, " - adding before '%s' on line %d\n", last->str.c_str(), last->orig_line); chunk.type = CT_BRACE_OPEN; chunk.orig_line = cl_colon->orig_line; chunk.parent_type = CT_CASE; chunk.level = cl_colon->level; chunk.brace_level = cl_colon->brace_level; chunk.flags = pc->flags & PCF_COPY_FLAGS; chunk.str = "{"; br_open = chunk_add_after(&chunk, cl_colon); chunk.type = CT_BRACE_CLOSE; chunk.orig_line = last->orig_line; chunk.str = "}"; br_close = chunk_add_before(&chunk, last); newline_add_before(last); for (pc = chunk_get_next(br_open, CNAV_PREPROC); pc != br_close; pc = chunk_get_next(pc, CNAV_PREPROC)) { pc->level++; pc->brace_level++; } return(br_open); } static void mod_case_brace(void) { chunk_t *pc = chunk_get_head(); chunk_t *next; while (pc != NULL) { next = chunk_get_next_ncnl(pc, CNAV_PREPROC); if (next == NULL) { return; } if ((cpd.settings[UO_mod_case_brace].a == AV_REMOVE) && (pc->type == CT_BRACE_OPEN) && (pc->parent_type == CT_CASE)) { pc = mod_case_brace_remove(pc); } else if ((cpd.settings[UO_mod_case_brace].a & AV_ADD) && (pc->type == CT_CASE_COLON) && (next->type != CT_BRACE_OPEN) && (next->type != CT_BRACE_CLOSE) && (next->type != CT_CASE)) { pc = mod_case_brace_add(pc); } else { pc = chunk_get_next_ncnl(pc, CNAV_PREPROC); } } } /** * Traverse the if chain and see if all can be removed */ static void process_if_chain(chunk_t *br_start) { chunk_t *braces[256]; chunk_t *br_close; int br_cnt = 0; chunk_t *pc; bool must_have_braces = false; bool tmp; pc = br_start; LOG_FMT(LBRCH, "%s: if starts on line %d\n", __func__, br_start->orig_line); while (pc != NULL) { if (pc->type == CT_BRACE_OPEN) { tmp = can_remove_braces(pc); LOG_FMT(LBRCH, " [%d] line %d - can%s remove %s\n", br_cnt, pc->orig_line, tmp ? "" : "not", get_token_name(pc->type)); if (!tmp) { must_have_braces = true; } } else { tmp = should_add_braces(pc); if (tmp) { must_have_braces = true; } LOG_FMT(LBRCH, " [%d] line %d - %s %s\n", br_cnt, pc->orig_line, tmp ? "should add" : "ignore", get_token_name(pc->type)); } braces[br_cnt++] = pc; br_close = chunk_skip_to_match(pc, CNAV_PREPROC); if (br_close == NULL) { break; } braces[br_cnt++] = br_close; pc = chunk_get_next_ncnl(br_close, CNAV_PREPROC); if ((pc == NULL) || (pc->type != CT_ELSE)) { break; } pc = chunk_get_next_ncnl(pc, CNAV_PREPROC); if ((pc != NULL) && (pc->type == CT_ELSEIF)) { while ((pc != NULL) && (pc->type != CT_VBRACE_OPEN) && (pc->type != CT_BRACE_OPEN)) { pc = chunk_get_next_ncnl(pc, CNAV_PREPROC); } } if (pc == NULL) { break; } if ((pc->type != CT_BRACE_OPEN) && (pc->type != CT_VBRACE_OPEN)) { break; } } if (must_have_braces) { LOG_FMT(LBRCH, "%s: add braces on lines[%d]:", __func__, br_cnt); while (--br_cnt >= 0) { if ((braces[br_cnt]->type == CT_VBRACE_OPEN) || (braces[br_cnt]->type == CT_VBRACE_CLOSE)) { LOG_FMT(LBRCH, " %d", braces[br_cnt]->orig_line); convert_vbrace(braces[br_cnt]); } else { LOG_FMT(LBRCH, " {%d}", braces[br_cnt]->orig_line); } braces[br_cnt] = NULL; } LOG_FMT(LBRCH, "\n"); } else { LOG_FMT(LBRCH, "%s: remove braces on lines[%d]:", __func__, br_cnt); while (--br_cnt >= 0) { if ((braces[br_cnt]->type == CT_BRACE_OPEN) || (braces[br_cnt]->type == CT_BRACE_CLOSE)) { LOG_FMT(LBRCH, " {%d}", braces[br_cnt]->orig_line); convert_brace(braces[br_cnt]); } else { LOG_FMT(LBRCH, " %d", braces[br_cnt]->orig_line); } braces[br_cnt] = NULL; } LOG_FMT(LBRCH, "\n"); } } static void mod_full_brace_if_chain(void) { chunk_t *pc; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (((pc->type == CT_BRACE_OPEN) || (pc->type == CT_VBRACE_OPEN)) && (pc->parent_type == CT_IF)) { process_if_chain(pc); } } } uncrustify-0.59/src/backup.cpp0000644000175000017500000001025011630457175013352 00000000000000/** * @file backup.cpp * Make a backup of a source file * The current plans are to use two files. * * - A '.unc-backup~' file that contains the original contents * - A '.unc-backup-md5~' file that contains the MD5 over the last output * that uncrustify generated * * The logic goes like this: * 1. If there isn't a .backup-md5 or the md5 over the input file doesn't * match what is in .backup-md5, then copy the source file to .backup. * * 2. Create the output file. * * 3. Calculate the md5 over the output file. * Create the .backup-md5 file. * * This will let you run uncrustify multiple times over the same file without * losing the original file. If you edit the file, then a new backup is made. * * @author Ben Gardner * @license GPL v2+ */ #include "prototypes.h" #include "backup.h" #include "md5.h" #include "logger.h" #include #include #include "unc_ctype.h" #include /** * Check the backup-md5 file and copy the input file to a backup if needed. */ int backup_copy_file(const char *filename, const vector& data) { char newpath[1024]; char buffer[128]; char md5_str_in[33]; char md5_str[33]; UINT8 dig[16]; md5_str_in[0] = 0; MD5::Calc(&data[0], data.size(), dig); snprintf(md5_str, sizeof(md5_str), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", dig[0], dig[1], dig[2], dig[3], dig[4], dig[5], dig[6], dig[7], dig[8], dig[9], dig[10], dig[11], dig[12], dig[13], dig[14], dig[15]); /* Create the backup-md5 filename, open it and read the md5 */ snprintf(newpath, sizeof(newpath), "%s%s", filename, UNC_BACKUP_MD5_SUFFIX); FILE *thefile = fopen(newpath, "rb"); if (thefile != NULL) { if (fgets(buffer, sizeof(buffer), thefile) != NULL) { for (int i = 0; buffer[i] != 0; i++) { if (unc_isxdigit(buffer[i])) { md5_str_in[i] = unc_tolower(buffer[i]); } else { md5_str_in[i] = 0; break; } } } fclose(thefile); } /* if the MD5s match, then there is no need to back up the file */ if (memcmp(md5_str, md5_str_in, 32) == 0) { LOG_FMT(LNOTE, "%s: MD5 match for %s\n", __func__, filename); return(SUCCESS); } LOG_FMT(LNOTE, "%s: MD5 mismatch - backing up %s\n", __func__, filename); /* Create the backup file */ snprintf(newpath, sizeof(newpath), "%s%s", filename, UNC_BACKUP_SUFFIX); thefile = fopen(newpath, "wb"); if (thefile != NULL) { int retval = fwrite(&data[0], data.size(), 1, thefile); int my_errno = errno; fclose(thefile); if (retval == 1) { return(SUCCESS); } LOG_FMT(LERR, "fwrite(%s) failed: %s (%d)\n", newpath, strerror(my_errno), my_errno); } else { LOG_FMT(LERR, "fopen(%s) failed: %s (%d)\n", newpath, strerror(errno), errno); } return(FAILURE); } /** * This should be called after the file was written to disk. * It will be read back and an md5 will be calculated over it. */ void backup_create_md5_file(const char *filename) { UINT8 dig[16]; MD5 md5; FILE *thefile; UINT8 buf[4096]; INT32 len; char newpath[1024]; md5.Init(); thefile = fopen(filename, "rb"); if (thefile == NULL) { LOG_FMT(LERR, "%s: fopen(%s) failed: %s (%d)\n", __func__, filename, strerror(errno), errno); return; } while ((len = fread(buf, 1, sizeof(buf), thefile)) > 0) { md5.Update(buf, len); } fclose(thefile); md5.Final(dig); snprintf(newpath, sizeof(newpath), "%s%s", filename, UNC_BACKUP_MD5_SUFFIX); thefile = fopen(newpath, "wb"); if (thefile != NULL) { fprintf(thefile, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x %s\n", dig[0], dig[1], dig[2], dig[3], dig[4], dig[5], dig[6], dig[7], dig[8], dig[9], dig[10], dig[11], dig[12], dig[13], dig[14], dig[15], path_basename(filename)); fclose(thefile); } } uncrustify-0.59/src/chunk_list.h0000644000175000017500000001650211630457175013723 00000000000000/** * @file chunk_list.c * Manages and navigates the list of chunks. * * @author Ben Gardner * @license GPL v2+ */ #ifndef CHUNK_LIST_H_INCLUDED #define CHUNK_LIST_H_INCLUDED #include "uncrustify_types.h" #include "char_table.h" /** * Specifies how to handle proprocessors. * CNAV_ALL (default) * - return the true next/prev * * CNAV_PREPROC * - If not in a preprocessor, skip over any encountered preprocessor stuff * - If in a preprocessor, fail to leave (return NULL) */ enum chunk_nav_t { CNAV_ALL, CNAV_PREPROC, }; chunk_t *chunk_dup(const chunk_t *pc_in); chunk_t *chunk_add(const chunk_t *pc_in); chunk_t *chunk_add_after(const chunk_t *pc_in, chunk_t *ref); chunk_t *chunk_add_before(const chunk_t *pc_in, chunk_t *ref); void chunk_del(chunk_t *pc); void chunk_move_after(chunk_t *pc_in, chunk_t *ref); chunk_t *chunk_get_head(void); chunk_t *chunk_get_tail(void); chunk_t *chunk_get_next(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); void chunk_swap(chunk_t *pc1, chunk_t *pc2); void chunk_swap_lines(chunk_t *pc1, chunk_t *pc2); chunk_t *chunk_first_on_line(chunk_t *pc); chunk_t *chunk_get_next_nl(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_next_nc(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_next_nnl(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_next_ncnl(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_next_ncnlnp(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_next_nblank(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_nblank(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_nl(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_nc(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_nnl(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_ncnl(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_ncnlnp(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_next_type(chunk_t *cur, c_token_t type, int level, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_type(chunk_t *cur, c_token_t type, int level, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_next_str(chunk_t *cur, const char *str, int len, int level, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_str(chunk_t *cur, const char *str, int len, int level, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_next_nvb(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); chunk_t *chunk_get_prev_nvb(chunk_t *cur, chunk_nav_t nav = CNAV_ALL); /** * Skips to the closing match for the current paren/brace/square. * * @param cur The opening paren/brace/square * @return NULL or the matching paren/brace/square */ static_inline chunk_t *chunk_skip_to_match(chunk_t *cur, chunk_nav_t nav = CNAV_ALL) { if ((cur != NULL) && ((cur->type == CT_PAREN_OPEN) || (cur->type == CT_SPAREN_OPEN) || (cur->type == CT_FPAREN_OPEN) || (cur->type == CT_BRACE_OPEN) || (cur->type == CT_VBRACE_OPEN) || (cur->type == CT_SQUARE_OPEN))) { return(chunk_get_next_type(cur, (c_token_t)(cur->type + 1), cur->level, nav)); } return(cur); } static_inline bool chunk_is_comment(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_COMMENT) || (pc->type == CT_COMMENT_MULTI) || (pc->type == CT_COMMENT_CPP))); } static_inline bool chunk_is_single_line_comment(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_COMMENT) || (pc->type == CT_COMMENT_CPP))); } static_inline bool chunk_is_newline(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_NEWLINE) || (pc->type == CT_NL_CONT))); } static_inline bool chunk_is_semicolon(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_SEMICOLON) || (pc->type == CT_VSEMICOLON))); } static_inline bool chunk_is_blank(chunk_t *pc) { return((pc != NULL) && (pc->len() == 0)); } static_inline bool chunk_is_preproc(chunk_t *pc) { return((pc != NULL) && ((pc->flags & PCF_IN_PREPROC) != 0)); } static_inline bool chunk_is_type(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_TYPE) || (pc->type == CT_PTR_TYPE) || (pc->type == CT_BYREF) || (pc->type == CT_DC_MEMBER) || (pc->type == CT_QUALIFIER) || (pc->type == CT_STRUCT) || (pc->type == CT_ENUM) || (pc->type == CT_UNION))); } static_inline bool chunk_is_token(chunk_t *pc, c_token_t c_token) { return((pc != NULL) && (pc->type == c_token)); } static_inline bool chunk_is_str(chunk_t *pc, const char *str, int len) { return((pc != NULL) && (pc->len() == len) && (memcmp(pc->text(), str, len) == 0)); } static_inline bool chunk_is_str_case(chunk_t *pc, const char *str, int len) { return((pc != NULL) && (pc->len() == len) && (strncasecmp(pc->text(), str, len) == 0)); } static_inline bool chunk_is_word(chunk_t *pc) { return((pc != NULL) && (pc->len() >= 1) && CharTable::IsKw1(pc->str[0])); } static_inline bool chunk_is_star(chunk_t *pc) { return((pc != NULL) && (pc->len() == 1) && (pc->str[0] == '*') && (pc->type != CT_OPERATOR_VAL)); } static_inline bool chunk_is_addr(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_BYREF) || ((pc->len() == 1) && (pc->str[0] == '&') && (pc->type != CT_OPERATOR_VAL)))); } bool chunk_is_newline_between(chunk_t *start, chunk_t *end); static_inline bool chunk_is_closing_brace(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_BRACE_CLOSE) || (pc->type == CT_VBRACE_CLOSE))); } static_inline bool chunk_is_opening_brace(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_VBRACE_OPEN))); } static_inline bool chunk_is_vbrace(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_VBRACE_CLOSE) || (pc->type == CT_VBRACE_OPEN))); } static_inline bool chunk_is_paren_open(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_PAREN_OPEN) || (pc->type == CT_SPAREN_OPEN) || (pc->type == CT_FPAREN_OPEN))); } static_inline bool chunk_is_paren_close(chunk_t *pc) { return((pc != NULL) && ((pc->type == CT_PAREN_CLOSE) || (pc->type == CT_SPAREN_CLOSE) || (pc->type == CT_FPAREN_CLOSE))); } /** * Returns true if either chunk is null or both have the same preproc flags. * If this is true, you can remove a newline/nl_cont between the two. */ static_inline bool chunk_same_preproc(chunk_t *pc1, chunk_t *pc2) { return((pc1 == NULL) || (pc2 == NULL) || ((pc1->flags & PCF_IN_PREPROC) == (pc2->flags & PCF_IN_PREPROC))); } /** * Returns true if it is safe to delete the newline token. * The prev and next chunks must have the same PCF_IN_PREPROC flag AND * the newline can't be after a C++ comment. */ static_inline bool chunk_safe_to_del_nl(chunk_t *nl) { chunk_t *tmp = chunk_get_prev(nl); if ((tmp != NULL) && (tmp->type == CT_COMMENT_CPP)) { return(false); } return(chunk_same_preproc(chunk_get_prev(nl), chunk_get_next(nl))); } #endif /* CHUNK_LIST_H_INCLUDED */ uncrustify-0.59/src/newlines.cpp0000644000175000017500000023346611640475733013752 00000000000000/** * @file newlines.cpp * Adds or removes newlines. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" #include #include #include #include #include "unc_ctype.h" static void newlines_double_space_struct_enum_union(chunk_t *open_brace); static bool one_liner_nl_ok(chunk_t *pc); static void undo_one_liner(chunk_t *pc); static void nl_handle_define(chunk_t *pc); static void newline_iarf_pair(chunk_t *before, chunk_t *after, argval_t av); #define MARK_CHANGE() mark_change(__func__, __LINE__) static void mark_change(const char *func, int line) { cpd.changes++; if (cpd.pass_count == 0) { LOG_FMT(LCHANGE, "%s: change %d on %s:%d\n", __func__, cpd.changes, func, line); } } /** * Check to see if we are allowed to increase the newline count. * We can't increase the nl count: * - if nl_squeeze_ifdef and a preproc is after the newline. * - if eat_blanks_before_close_brace and the next is '}' * - if eat_blanks_after_open_brace and the prev is '{' */ static bool can_increase_nl(chunk_t *nl) { chunk_t *prev = chunk_get_prev_nc(nl); chunk_t *pcmt = chunk_get_prev(nl); chunk_t *next = chunk_get_next(nl); if (cpd.settings[UO_nl_squeeze_ifdef].b) { if (prev && (prev->type == CT_PREPROC) && (prev->parent_type == CT_PP_ENDIF)) { LOG_FMT(LBLANKD, "%s: nl_squeeze_ifdef %d\n", __func__, nl->orig_line); return(false); } } if (cpd.settings[UO_eat_blanks_before_close_brace].b) { if (next && (next->type == CT_BRACE_CLOSE)) { LOG_FMT(LBLANKD, "%s: eat_blanks_before_close_brace %d\n", __func__, nl->orig_line); return(false); } } if (cpd.settings[UO_eat_blanks_after_open_brace].b) { if (prev && (prev->type == CT_BRACE_OPEN)) { LOG_FMT(LBLANKD, "%s: eat_blanks_after_open_brace %d\n", __func__, nl->orig_line); return(false); } } if (!pcmt && (cpd.settings[UO_nl_start_of_file].a != AV_IGNORE)) { LOG_FMT(LBLANKD, "%s: no prev %d\n", __func__, nl->orig_line); return false; } if (!next && (cpd.settings[UO_nl_end_of_file].a != AV_IGNORE)) { LOG_FMT(LBLANKD, "%s: no next %d\n", __func__, nl->orig_line); return false; } return(true); } /** * Double the newline, if allowed. */ static void double_newline(chunk_t *nl) { chunk_t *prev = chunk_get_prev(nl); LOG_FMT(LNEWLINE, "%s: add newline after %s on line %d", __func__, prev->str.c_str(), prev->orig_line); if (!can_increase_nl(nl)) { LOG_FMT(LNEWLINE, " - denied\n"); return; } LOG_FMT(LNEWLINE, " - done\n"); if (nl->nl_count != 2) { nl->nl_count = 2; MARK_CHANGE(); } } /* * Basic approach: * 1. Find next open brace * 2. Find next close brace * 3. Determine why the braces are there * a. struct/union/enum "enum [name] {" * c. assignment "= {" * b. if/while/switch/for/etc ") {" * d. else "} else {" */ //#define DEBUG_NEWLINES static void setup_newline_add(chunk_t *prev, chunk_t *nl, chunk_t *next) { if (!prev || !nl || !next) { return; } undo_one_liner(prev); nl->orig_line = prev->orig_line; nl->nl_count = 1; nl->flags = (prev->flags & PCF_COPY_FLAGS) & ~PCF_IN_PREPROC; if ((prev->flags & PCF_IN_PREPROC) && (next->flags & PCF_IN_PREPROC)) { nl->flags |= PCF_IN_PREPROC; } if ((nl->flags & PCF_IN_PREPROC) != 0) { nl->type = CT_NL_CONT; nl->str = "\\\n"; } else { nl->type = CT_NEWLINE; nl->str = "\n"; } } /** * Add a newline before the chunk if there isn't already a newline present. * Virtual braces are skipped, as they do not contribute to the output. */ chunk_t *newline_add_before2(chunk_t *pc, const char *fcn, int line) { chunk_t nl; chunk_t *prev; prev = chunk_get_prev_nvb(pc); if (chunk_is_newline(prev)) { /* Already has a newline before this chunk */ return(prev); } LOG_FMT(LNEWLINE, "%s: '%s' on line %d (called from %s line %d)\n", __func__, pc->str.c_str(), pc->orig_line, fcn, line); setup_newline_add(prev, &nl, pc); MARK_CHANGE(); return(chunk_add_before(&nl, pc)); } /** * Add a newline after the chunk if there isn't already a newline present. * Virtual braces are skipped, as they do not contribute to the output. */ chunk_t *newline_add_after2(chunk_t *pc, const char *fcn, int line) { chunk_t nl; chunk_t *next; if (!pc) { return(NULL); } next = chunk_get_next_nvb(pc); if (chunk_is_newline(next)) { /* Already has a newline after this chunk */ return(next); } LOG_FMT(LNEWLINE, "%s: '%s' on line %d (called from %s line %d)\n", __func__, pc->str.c_str(), pc->orig_line, fcn, line); setup_newline_add(pc, &nl, next); MARK_CHANGE(); return(chunk_add_after(&nl, pc)); } #define newline_min_after(ref, cnt, flag) \ newline_min_after2(ref, cnt, flag, __func__, __LINE__) static void newline_min_after2(chunk_t *ref, INT32 count, UINT64 flag, const char *func, int line) { chunk_t *pc = ref; chunk_t *next; LOG_FMT(LNEWLINE, "%s: '%s' line %d - count=%d flg=0x%"PRIx64": caller=%s:%d\n", __func__, ref->str.c_str(), ref->orig_line, count, flag, func, line); do { pc = chunk_get_next(pc); } while ((pc != NULL) && !chunk_is_newline(pc)); //LOG_FMT(LNEWLINE, "%s: on %s, line %d, col %d\n", // __func__, get_token_name(pc->type), pc->orig_line, pc->orig_col); next = chunk_get_next(pc); if (chunk_is_comment(next) && (next->nl_count == 1) && chunk_is_comment(chunk_get_prev(pc))) { newline_min_after(next, count, flag); return; } else { pc->flags |= flag; if (chunk_is_newline(pc) && can_increase_nl(pc)) { if (pc->nl_count < count) { pc->nl_count = count; MARK_CHANGE(); } } } } /** * Add a newline between two tokens. * If there is already a newline between then, nothing is done. * Otherwise a newline is inserted. * * If end is CT_BRACE_OPEN and a comment and newline follow, then * the brace open is moved instead of inserting a newline. * * In this situation: * if (...) { //comment * * you get: * if (...) //comment * { */ chunk_t *newline_add_between2(chunk_t *start, chunk_t *end, const char *func, int line) { chunk_t *pc; if ((start == NULL) || (end == NULL)) { return(NULL); } LOG_FMT(LNEWLINE, "%s: '%s'[%s] line %d:%d and '%s' line %d:%d : caller=%s:%d\n", __func__, start->str.c_str(), get_token_name(start->type), start->orig_line, start->orig_col, end->str.c_str(), end->orig_line, end->orig_col, func, line); /* Back-up check for one-liners (should never be true!) */ if (!one_liner_nl_ok(start)) { return(NULL); } /* Scan for a line break */ for (pc = start; pc != end; pc = chunk_get_next(pc)) { if (chunk_is_newline(pc)) { return(pc); } } /* If the second one is a brace open, then check to see * if a comment + newline follows */ if (end->type == CT_BRACE_OPEN) { pc = chunk_get_next(end); if (chunk_is_comment(pc)) { pc = chunk_get_next(pc); if (chunk_is_newline(pc)) { /* Move the open brace to after the newline */ chunk_move_after(end, pc); return(pc); } } } return(newline_add_before(end)); } /** * Removes any CT_NEWLINE or CT_NL_CONT between start and end. * Start must be before end on the chunk list. * If the 'PCF_IN_PREPROC' status differs between two tags, we can't remove * the newline. * * @param start The starting chunk (cannot be a newline) * @param end The ending chunk (cannot be a newline) * @return true/false - removed something */ void newline_del_between2(chunk_t *start, chunk_t *end, const char *func, int line) { chunk_t *next; chunk_t *prev; chunk_t *pc = start; LOG_FMT(LNEWLINE, "%s: '%s' line %d:%d and '%s' line %d:%d : caller=%s:%d preproc=%d/%d\n", __func__, start->str.c_str(), start->orig_line, start->orig_col, end->str.c_str(), end->orig_line, end->orig_col, func, line, ((start->flags & PCF_IN_PREPROC) != 0), ((end->flags & PCF_IN_PREPROC) != 0)); /* Can't remove anything if the preproc status differs */ if (!chunk_same_preproc(start, end)) { return; } do { next = chunk_get_next(pc); if (chunk_is_newline(pc)) { prev = chunk_get_prev(pc); if ((!chunk_is_comment(prev) && !chunk_is_comment(next)) || chunk_is_newline(prev) || chunk_is_newline(next)) { if (chunk_safe_to_del_nl(pc)) { chunk_del(pc); MARK_CHANGE(); align_to_column(next, prev->column + space_col_align(prev, next)); } } else { if (pc->nl_count > 1) { pc->nl_count = 1; MARK_CHANGE(); } } } pc = next; } while (pc != end); if (chunk_is_str(end, "{", 1) && (chunk_is_str(start, ")", 1) || (start->type == CT_DO) || (start->type == CT_ELSE))) { if (chunk_get_prev_nl(end) != start) { chunk_move_after(end, start); } } } /** * Add or remove a newline between the closing paren and opening brace. * Also uncuddles anything on the closing brace. (may get fixed later) * * "if (...) { \n" or "if (...) \n { \n" * * For virtual braces, we can only add a newline after the vbrace open. * If we do so, also add a newline after the vbrace close. */ static bool newlines_if_for_while_switch(chunk_t *start, argval_t nl_opt) { chunk_t *pc; chunk_t *close_paren; chunk_t *brace_open; bool retval = false; if ((nl_opt == AV_IGNORE) || (((start->flags & PCF_IN_PREPROC) != 0) && !cpd.settings[UO_nl_define_macro].b)) { return false; } pc = chunk_get_next_ncnl(start); if ((pc != NULL) && (pc->type == CT_SPAREN_OPEN)) { close_paren = chunk_get_next_type(pc, CT_SPAREN_CLOSE, pc->level); brace_open = chunk_get_next_ncnl(close_paren); if ((brace_open != NULL) && ((brace_open->type == CT_BRACE_OPEN) || (brace_open->type == CT_VBRACE_OPEN)) && one_liner_nl_ok(brace_open)) { if (cpd.settings[UO_nl_multi_line_cond].b) { while ((pc = chunk_get_next(pc)) != close_paren) { if (chunk_is_newline(pc)) { nl_opt = AV_ADD; break; } } } if (brace_open->type == CT_VBRACE_OPEN) { /* Can only add - we don't want to create a one-line here */ if (nl_opt & AV_ADD) { newline_iarf_pair(close_paren, chunk_get_next_ncnl(brace_open), nl_opt); pc = chunk_get_next_type(brace_open, CT_VBRACE_CLOSE, brace_open->level); if (!chunk_is_newline(chunk_get_prev_nc(pc)) && !chunk_is_newline(chunk_get_next_nc(pc))) { newline_add_after(pc); retval = true; } } } else { newline_iarf_pair(close_paren, brace_open, nl_opt); newline_add_between(brace_open, chunk_get_next_ncnl(brace_open)); /* Make sure nothing is cuddled with the closing brace */ pc = chunk_get_next_type(brace_open, CT_BRACE_CLOSE, brace_open->level); newline_add_between(pc, chunk_get_next_nblank(pc)); retval = true; } } } return retval; } /** * Add or remove extra newline before the chunk. * Adds before comments * Doesn't do anything if open brace before it * "code\n\ncomment\nif (...)" or "code\ncomment\nif (...)" */ static void newlines_if_for_while_switch_pre_blank_lines(chunk_t *start, argval_t nl_opt) { chunk_t *pc; chunk_t *prev; chunk_t *next; chunk_t *last_nl = NULL; int level = start->level; bool do_add = nl_opt & AV_ADD; if ((nl_opt == AV_IGNORE) || (((start->flags & PCF_IN_PREPROC) != 0) && !cpd.settings[UO_nl_define_macro].b)) { return; } /* * look backwards until we find * open brace (don't add or remove) * 2 newlines in a row (don't add) * something else (don't remove) */ for (pc = chunk_get_prev(start); pc != NULL; pc = chunk_get_prev(pc)) { if (chunk_is_newline(pc)) { last_nl = pc; /* if we found 2 or more in a row */ if ((pc->nl_count > 1) || chunk_is_newline(chunk_get_prev_nvb(pc))) { /* need to remove */ if ((nl_opt & AV_REMOVE) && ((pc->flags & PCF_VAR_DEF) == 0)) { /* if we're also adding, take care of that here */ int nl_count = do_add ? 2 : 1; if (nl_count != pc->nl_count) { pc->nl_count = nl_count; MARK_CHANGE(); } /* can keep using pc because anything other than newline stops loop, and we delete if newline */ while (chunk_is_newline(prev = chunk_get_prev_nvb(pc))) { /* Make sure we don't combine a preproc and non-preproc */ if (!chunk_safe_to_del_nl(prev)) { break; } chunk_del(prev); MARK_CHANGE(); } } return; } } else if (chunk_is_opening_brace(pc) || (pc->level < level)) { return; } else if (chunk_is_comment(pc)) { /* vbrace close is ok because it won't go into output, so we should skip it */ last_nl = NULL; continue; } else { if (do_add) /* we found something previously besides a comment or a new line */ { /* if we have run across a newline */ if (last_nl != NULL) { if (last_nl->nl_count < 2) { double_newline(last_nl); } } else { /* we didn't run into a nl, so we need to add one */ if (((next = chunk_get_next(pc)) != NULL) && chunk_is_comment(next)) { pc = next; } if ((last_nl = newline_add_after(pc)) != NULL) { double_newline(last_nl); } } } return; } } } static chunk_t *get_closing_brace(chunk_t *start) { chunk_t *pc; int level = start->level; for (pc = start; (pc = chunk_get_next(pc)) != NULL; ) { if (((pc->type == CT_BRACE_CLOSE) || (pc->type == CT_VBRACE_CLOSE)) && (pc->level == level)) { return(pc); } /* for some reason, we can have newlines between if and opening brace that are lower level than either */ if (!chunk_is_newline(pc) && (pc->level < level)) { return(NULL); } } return(NULL); } /** * remove any consecutive newlines following this chunk * skip vbraces */ static void remove_next_newlines(chunk_t *start) { chunk_t *next; while ((next = chunk_get_next(start)) != NULL) { if (chunk_is_newline(next) && chunk_safe_to_del_nl(next)) { chunk_del(next); MARK_CHANGE(); } else if (chunk_is_vbrace(next)) { start = next; } else { break; } } } /** * Add or remove extra newline after end of the block started in chunk. * Doesn't do anything if close brace after it * Interesting issue is that at this point, nls can be before or after vbraces * VBraces will stay VBraces, conversion to real ones should have already happened * "if (...)\ncode\ncode" or "if (...)\ncode\n\ncode" */ static void newlines_if_for_while_switch_post_blank_lines(chunk_t *start, argval_t nl_opt) { chunk_t *pc; chunk_t *next; chunk_t *prev; bool have_pre_vbrace_nl = false; int nl_count; if ((nl_opt == AV_IGNORE) || (((start->flags & PCF_IN_PREPROC) != 0) && !cpd.settings[UO_nl_define_macro].b)) { return; } /* first find ending brace */ if ((pc = get_closing_brace(start)) == NULL) { return; } /* if we're dealing with an if, we actually want to add or remove blank lines after any elses */ if (start->type == CT_IF) { while (true) { next = chunk_get_next_ncnl(pc); if ((next != NULL) && ((next->type == CT_ELSE) || (next->type == CT_ELSEIF))) { /* point to the closing brace of the else */ if ((pc = get_closing_brace(next)) == NULL) { return; } } else { break; } } } /* if we're dealing with a do/while, we actually want to add or remove blank lines after while and its condition */ if (start->type == CT_DO) { /* point to the next semicolon */ if ((pc = chunk_get_next_type(pc, CT_SEMICOLON, start->level)) == NULL) { return; } } bool isVBrace = pc->type == CT_VBRACE_CLOSE; if ((prev = chunk_get_prev_nvb(pc)) == NULL) { return; } have_pre_vbrace_nl = isVBrace && chunk_is_newline(prev); if (nl_opt & AV_REMOVE) { /* if vbrace, have to check before and after */ /* if chunk before vbrace, remove any nls after vbrace */ if (have_pre_vbrace_nl) { if (prev->nl_count != 1) { prev->nl_count = 1; MARK_CHANGE(); } remove_next_newlines(pc); } else if (chunk_is_newline(next = chunk_get_next_nvb(pc))) /* otherwise just deal with nls after brace */ { if (next->nl_count != 1) { next->nl_count = 1; MARK_CHANGE(); } remove_next_newlines(next); } } /* may have a nl before and after vbrace */ /* don't do anything with it if the next non nl chunk is a closing brace */ if (nl_opt & AV_ADD) { if ((next = chunk_get_next_nnl(pc)) == NULL) { return; } if (next->type != CT_BRACE_CLOSE) { /* if vbrace, have to check before and after */ /* if chunk before vbrace, check its count */ nl_count = have_pre_vbrace_nl ? prev->nl_count : 0; if (chunk_is_newline(next = chunk_get_next_nvb(pc))) { nl_count += next->nl_count; } /* if we have no newlines, add one and make it double */ if (nl_count == 0) { if (((next = chunk_get_next(pc)) != NULL) && chunk_is_comment(next)) { pc = next; } if ((next = newline_add_after(pc)) == NULL) { return; } double_newline(next); } else if (nl_count == 1) /* if we don't have enough newlines */ { /* if we have one before vbrace, need to add one after */ if (have_pre_vbrace_nl) { next = newline_add_after(pc); } else { prev = chunk_get_prev_nnl(next); pc = chunk_get_next_nl(next); //LOG_FMT(LSYS, " -- pc1=%s [%s]\n", pc->str.c_str(), get_token_name(pc->type)); pc = chunk_get_next(pc); //LOG_FMT(LSYS, " -- pc2=%s [%s]\n", pc->str.c_str(), get_token_name(pc->type)); if ((pc != NULL) && (pc->type == CT_PREPROC) && (pc->parent_type == CT_PP_ENDIF) && cpd.settings[UO_nl_squeeze_ifdef].b) { LOG_FMT(LNEWLINE, "%s: cannot add newline after line %d due to nl_squeeze_ifdef\n", __func__, prev->orig_line); } else { /* make nl after double */ double_newline(next); } } } } } } /** * Adds or removes a newline between the keyword and the open brace. * If there is something after the '{' on the same line, then * the newline is removed unconditionally. * If there is a '=' between the keyword and '{', do nothing. * * "struct [name] {" or "struct [name] \n {" */ static void newlines_struct_enum_union(chunk_t *start, argval_t nl_opt, bool leave_trailing) { chunk_t *pc; chunk_t *next; if ((nl_opt == AV_IGNORE) || (((start->flags & PCF_IN_PREPROC) != 0) && !cpd.settings[UO_nl_define_macro].b)) { return; } /* step past any junk between the keyword and the open brace * Quit if we hit a semicolon or '=', which are not expected. */ int level = start->level; pc = start; while (((pc = chunk_get_next_ncnl(pc)) != NULL) && (pc->level >= level)) { if ((pc->level == level) && ((pc->type == CT_BRACE_OPEN) || chunk_is_semicolon(pc) || (pc->type == CT_ASSIGN))) { break; } start = pc; } /* If we hit a brace open, then we need to toy with the newlines */ if ((pc != NULL) && (pc->type == CT_BRACE_OPEN)) { /* Skip over embedded C comments */ next = chunk_get_next(pc); while ((next != NULL) && (next->type == CT_COMMENT)) { next = chunk_get_next(next); } if (leave_trailing && !chunk_is_comment(next) && !chunk_is_newline(next)) { nl_opt = AV_IGNORE; } newline_iarf_pair(start, pc, nl_opt); } } /** * Cuddles or un-cuddles a chunk with a previous close brace * * "} while" vs "} \n while" * "} else" vs "} \n else" * * @param start The chunk - should be CT_ELSE or CT_WHILE_OF_DO */ static void newlines_cuddle_uncuddle(chunk_t *start, argval_t nl_opt) { chunk_t *br_close; if (((start->flags & PCF_IN_PREPROC) != 0) && !cpd.settings[UO_nl_define_macro].b) { return; } br_close = chunk_get_prev_ncnl(start); if ((br_close != NULL) && (br_close->type == CT_BRACE_CLOSE)) { newline_iarf_pair(br_close, start, nl_opt); } } /** * Adds/removes a newline between else and '{'. * "else {" or "else \n {" */ static void newlines_do_else(chunk_t *start, argval_t nl_opt) { chunk_t *next; chunk_t *tmp; if ((nl_opt == AV_IGNORE) || (((start->flags & PCF_IN_PREPROC) != 0) && !cpd.settings[UO_nl_define_macro].b)) { return; } next = chunk_get_next_ncnl(start); if ((next != NULL) && ((next->type == CT_BRACE_OPEN) || (next->type == CT_VBRACE_OPEN))) { if (!one_liner_nl_ok(next)) { return; } if (next->type == CT_VBRACE_OPEN) { /* Can only add - we don't want to create a one-line here */ if (nl_opt & AV_ADD) { newline_iarf_pair(start, chunk_get_next_ncnl(next), nl_opt); tmp = chunk_get_next_type(next, CT_VBRACE_CLOSE, next->level); if (!chunk_is_newline(chunk_get_next_nc(tmp)) && !chunk_is_newline(chunk_get_prev_nc(tmp))) { newline_add_after(tmp); } } } else { newline_iarf_pair(start, next, nl_opt); if ((nl_opt & AV_ADD) != 0) { tmp = chunk_get_next_nc(next); if ((tmp != NULL) && !chunk_is_newline(tmp)) { newline_add_between(next, tmp); } } } } } /** * We are at the open brace for a function body. * put a newline after the block of variable definitions */ static void newline_fnc_var_def(chunk_t *br_open, int nl_count) { chunk_t *prev = NULL; chunk_t *next; chunk_t *pc; pc = chunk_get_next_ncnl(br_open); while (pc != NULL) { if (chunk_is_type(pc) || (pc->type == CT_QUALIFIER) || (pc->type == CT_DC_MEMBER)) { pc = chunk_get_next_ncnl(pc); continue; } if (((pc->type == CT_WORD) || (pc->type == CT_FUNC_CTOR_VAR)) && ((pc->flags & PCF_VAR_1ST) != 0)) { pc = chunk_get_next_type(pc, CT_SEMICOLON, pc->level); prev = pc; pc = chunk_get_next_ncnl(pc); continue; } break; } /* prev is either NULL or points to a semicolon */ if (prev != NULL) { next = chunk_get_next_ncnl(prev); if ((next != NULL) && (next->type != CT_BRACE_CLOSE)) { newline_min_after(prev, 1 + nl_count, PCF_VAR_DEF); } } } /** * Handles the brace_on_func_line setting and decides if the closing brace * of a pair should be right after a newline. * The only cases where the closing brace shouldn't be the first thing on a line * is where the opening brace has junk after it AND where a one-liner in a * class is supposed to be preserved. * * General rule for break before close brace: * If the brace is part of a function (call or definition) OR if the only * thing after the opening brace is comments, the there must be a newline * before the close brace. * * Example of no newline before close * struct mystring { int len; * char str[]; }; * while (*(++ptr) != 0) { } * * Examples of newline before close * void foo() { * } * */ static void newlines_brace_pair(chunk_t *br_open) { chunk_t *prev; chunk_t *next; chunk_t *pc; argval_t val = AV_IGNORE; bool nl_close_brace = false; if (((br_open->flags & PCF_IN_PREPROC) != 0) && !cpd.settings[UO_nl_define_macro].b) { return; } if (cpd.settings[UO_nl_collapse_empty_body].b) { next = chunk_get_next_nnl(br_open); if ((next != NULL) && (next->type == CT_BRACE_CLOSE)) { pc = chunk_get_next(br_open); while ((pc != NULL) && (pc->type != CT_BRACE_CLOSE)) { next = chunk_get_next(pc); if (pc->type == CT_NEWLINE) { if (chunk_safe_to_del_nl(pc)) { chunk_del(pc); MARK_CHANGE(); } } pc = next; } return; } } /* Make sure we don't break a one-liner */ if (!one_liner_nl_ok(br_open)) { return; } next = chunk_get_next_nc(br_open); /** Insert a newline between the '=' and open brace, if needed */ if (br_open->parent_type == CT_ASSIGN) { /* Only mess with it if the open brace is followed by a newline */ if (chunk_is_newline(next)) { prev = chunk_get_prev_ncnl(br_open); newline_iarf_pair(prev, br_open, cpd.settings[UO_nl_assign_brace].a); } } /* Eat any extra newlines after the brace open */ if (cpd.settings[UO_eat_blanks_after_open_brace].b) { if (chunk_is_newline(next)) { if (next->nl_count > 1) { next->nl_count = 1; MARK_CHANGE(); } } } /* Handle the cases where the brace is part of a function call or definition */ if ((br_open->parent_type == CT_FUNC_DEF) || (br_open->parent_type == CT_FUNC_CALL) || (br_open->parent_type == CT_FUNC_CALL_USER) || (br_open->parent_type == CT_FUNC_CLASS) || (br_open->parent_type == CT_OC_MSG_DECL) || (br_open->parent_type == CT_CS_PROPERTY)) { /* Need to force a newline before the close brace, if not in a class body */ if ((br_open->flags & PCF_IN_CLASS) == 0) { nl_close_brace = true; } /* handle newlines after the open brace */ pc = chunk_get_next_ncnl(br_open); newline_add_between(br_open, pc); val = (((br_open->parent_type == CT_FUNC_DEF) || (br_open->parent_type == CT_FUNC_CLASS) || (br_open->parent_type == CT_OC_MSG_DECL)) ? cpd.settings[UO_nl_fdef_brace].a : ((br_open->parent_type == CT_CS_PROPERTY) ? cpd.settings[UO_nl_property_brace].a : cpd.settings[UO_nl_fcall_brace].a)); if (val != AV_IGNORE) { /* Grab the chunk before the open brace */ prev = chunk_get_prev_ncnl(br_open); newline_iarf_pair(prev, br_open, val); } if (cpd.settings[UO_nl_func_var_def_blk].n > 0) { newline_fnc_var_def(br_open, cpd.settings[UO_nl_func_var_def_blk].n); } } /* Grab the matching brace close */ chunk_t *br_close; br_close = chunk_get_next_type(br_open, CT_BRACE_CLOSE, br_open->level); if (br_close == NULL) { return; } if (!nl_close_brace) { /** * If the open brace hits a CT_NEWLINE, CT_NL_CONT, CT_COMMENT_MULTI, or * CT_COMMENT_CPP without hitting anything other than CT_COMMENT, then * there should be a newline before the close brace. */ pc = chunk_get_next(br_open); while ((pc != NULL) && (pc->type == CT_COMMENT)) { pc = chunk_get_next(pc); } if (chunk_is_newline(pc) || chunk_is_comment(pc)) { nl_close_brace = true; } } prev = chunk_get_prev_nblank(br_close); if (nl_close_brace) { newline_add_between(prev, br_close); } else { newline_del_between(prev, br_close); } } /** * Put a empty line between the 'case' statement and the previous case colon * or semicolon. * Does not work with PAWN (?) */ static void newline_case(chunk_t *start) { chunk_t *pc; chunk_t *prev = start; // printf("%s case (%s) on line %d col %d\n", // __func__, c_chunk_names[start->type], // start->orig_line, start->orig_col); /* Scan backwards until a '{' or ';' or ':'. Abort if a multi-newline is found */ do { prev = chunk_get_prev_nc(prev); if ((prev != NULL) && chunk_is_newline(prev) && (prev->nl_count > 1)) { return; } } while ((prev != NULL) && (prev->type != CT_BRACE_OPEN) && (prev->type != CT_BRACE_CLOSE) && (prev->type != CT_SEMICOLON) && (prev->type != CT_CASE_COLON)); if (prev == NULL) { return; } pc = newline_add_between(prev, start); if (pc == NULL) { return; } /* Only add an extra line after a semicolon or brace close */ if ((prev->type == CT_SEMICOLON) || (prev->type == CT_BRACE_CLOSE)) { if (chunk_is_newline(pc) && (pc->nl_count < 2)) { double_newline(pc); } } } static void newline_case_colon(chunk_t *start) { chunk_t *pc = start; /* Scan forwards until a non-comment is found */ do { pc = chunk_get_next(pc); } while (chunk_is_comment(pc)); if ((pc != NULL) && !chunk_is_newline(pc)) { newline_add_before(pc); } } /** * Put a empty line after a return statement, unless it is followed by a * close brace. * * May not work with PAWN */ static void newline_return(chunk_t *start) { chunk_t *pc; chunk_t *semi; chunk_t *after; semi = chunk_get_next_type(start, CT_SEMICOLON, start->level); after = chunk_get_next_nblank(semi); /* If we hit a brace or an 'else', then a newline isn't needed */ if ((after == NULL) || (after->type == CT_BRACE_CLOSE) || (after->type == CT_ELSE)) { return; } for (pc = chunk_get_next(semi); pc != after; pc = chunk_get_next(pc)) { if (pc->type == CT_NEWLINE) { if (pc->nl_count < 2) { double_newline(pc); } return; } } } /** * Does the Ignore, Add, Remove, or Force thing between two chunks * * @param before The first chunk * @param after The second chunk * @param av The IARF value */ static void newline_iarf_pair(chunk_t *before, chunk_t *after, argval_t av) { if ((before != NULL) && (after != NULL)) { if ((av & AV_REMOVE) != 0) { newline_del_between(before, after); } if ((av & AV_ADD) != 0) { newline_add_between(before, after); } } } /** * Does a simple Ignore, Add, Remove, or Force after the given chunk * * @param pc The chunk * @param av The IARF value */ void newline_iarf(chunk_t *pc, argval_t av) { newline_iarf_pair(pc, chunk_get_next_nnl(pc), av); } /** * Formats a function declaration * Start points to the open paren */ static void newline_func_def(chunk_t *start) { chunk_t *pc; chunk_t *prev = NULL; chunk_t *tmp; argval_t atmp; bool is_def = (start->parent_type == CT_FUNC_DEF); atmp = cpd.settings[is_def ? UO_nl_func_def_paren : UO_nl_func_paren].a; if (atmp != AV_IGNORE) { prev = chunk_get_prev_ncnl(start); if (prev != NULL) { newline_iarf(prev, atmp); } } /* Handle break newlines type and function */ prev = chunk_get_prev_ncnl(start); /* Don't split up a function variable */ prev = ((prev != NULL) && (prev->type == CT_PAREN_CLOSE)) ? NULL : chunk_get_prev_ncnl(prev); if ((prev != NULL) && (prev->type != CT_PRIVATE_COLON)) { if (prev->type == CT_OPERATOR) { tmp = prev; prev = chunk_get_prev_ncnl(prev); } else { tmp = start; } if ((prev != NULL) && (prev->type == CT_DC_MEMBER)) { if (cpd.settings[UO_nl_func_scope_name].a != AV_IGNORE) { newline_iarf(prev, cpd.settings[UO_nl_func_scope_name].a); } } argval_t a = (tmp->parent_type == CT_FUNC_PROTO) ? cpd.settings[UO_nl_func_proto_type_name].a : cpd.settings[UO_nl_func_type_name].a; if ((tmp->flags & PCF_IN_CLASS) && (cpd.settings[UO_nl_func_type_name_class].a != AV_IGNORE)) { a = cpd.settings[UO_nl_func_type_name_class].a; } if (a != AV_IGNORE) { if ((prev != NULL) && (prev->type == CT_DESTRUCTOR)) { prev = chunk_get_prev_ncnl(prev); } /* If we are on a '::', step back two tokens * TODO: do we also need to check for '.' ? */ while ((prev != NULL) && (prev->type == CT_DC_MEMBER)) { prev = chunk_get_prev_ncnl(prev); prev = skip_template_prev(prev); prev = chunk_get_prev_ncnl(prev); } if ((prev != NULL) && (prev->type != CT_BRACE_CLOSE) && (prev->type != CT_BRACE_OPEN) && (prev->type != CT_SEMICOLON)) { newline_iarf(prev, a); } } } pc = chunk_get_next_ncnl(start); if (chunk_is_str(pc, ")", 1)) { atmp = cpd.settings[is_def ? UO_nl_func_def_empty : UO_nl_func_decl_empty].a; if (atmp != AV_IGNORE) { newline_iarf(start, atmp); } return; } /* Now scan for commas */ int comma_count = 0; for (pc = chunk_get_next_ncnl(start); (pc != NULL) && (pc->level > start->level); pc = chunk_get_next_ncnl(pc)) { prev = pc; if ((pc->type == CT_COMMA) && (pc->level == (start->level + 1))) { comma_count++; tmp = chunk_get_next(pc); if (chunk_is_comment(tmp)) { pc = tmp; } newline_iarf(pc, cpd.settings[(start->parent_type == CT_FUNC_DEF) ? UO_nl_func_def_args : UO_nl_func_decl_args].a); } } argval_t as = cpd.settings[is_def ? UO_nl_func_def_start : UO_nl_func_decl_start].a; argval_t ae = cpd.settings[is_def ? UO_nl_func_def_end : UO_nl_func_decl_end].a; if (comma_count == 0) { atmp = cpd.settings[is_def ? UO_nl_func_def_start_single : UO_nl_func_decl_start_single].a; if (atmp != AV_IGNORE) { as = atmp; } atmp = cpd.settings[is_def ? UO_nl_func_def_end_single : UO_nl_func_decl_end_single].a; if (atmp != AV_IGNORE) { ae = atmp; } } newline_iarf(start, as); /* and fix up the close paren */ if ((prev != NULL) && (pc != NULL) && (pc->type == CT_FPAREN_CLOSE)) { prev = chunk_get_prev_nnl(pc); if (prev->type != CT_FPAREN_OPEN) { newline_iarf(prev, ae); } } } /** * Checks to see if it is OK to add a newline around the chunk. * Don't want to break one-liners... */ static bool one_liner_nl_ok(chunk_t *pc) { LOG_FMT(LNL1LINE, "%s: check [%s] parent=[%s] flg=%" PRIx64 ", on line %d, col %d - ", __func__, get_token_name(pc->type), get_token_name(pc->parent_type), pc->flags, pc->orig_line, pc->orig_col); if (!(pc->flags & PCF_ONE_LINER)) { LOG_FMT(LNL1LINE, "true (not 1-liner)\n"); return(true); } /* Step back to find the opening brace */ chunk_t *br_open = pc; while (br_open && (br_open->flags & PCF_ONE_LINER) && !chunk_is_opening_brace(br_open) && !chunk_is_closing_brace(br_open)) { br_open = chunk_get_prev(br_open); } pc = br_open; if (pc && (pc->flags & PCF_ONE_LINER) && ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_BRACE_CLOSE) || (pc->type == CT_VBRACE_OPEN) || (pc->type == CT_VBRACE_CLOSE))) { if (cpd.settings[UO_nl_class_leave_one_liners].b && (pc->flags & PCF_IN_CLASS)) { LOG_FMT(LNL1LINE, "false (class)\n"); return(false); } if (cpd.settings[UO_nl_assign_leave_one_liners].b && (pc->parent_type == CT_ASSIGN)) { LOG_FMT(LNL1LINE, "false (assign)\n"); return(false); } if (cpd.settings[UO_nl_enum_leave_one_liners].b && (pc->parent_type == CT_ENUM)) { LOG_FMT(LNL1LINE, "false (enum)\n"); return(false); } if (cpd.settings[UO_nl_getset_leave_one_liners].b && (pc->parent_type == CT_GETSET)) { LOG_FMT(LNL1LINE, "false (get/set)\n"); return(false); } if (cpd.settings[UO_nl_func_leave_one_liners].b && ((pc->parent_type == CT_FUNC_DEF) || (pc->parent_type == CT_FUNC_CLASS))) { LOG_FMT(LNL1LINE, "false (func def)\n"); return(false); } if (cpd.settings[UO_nl_if_leave_one_liners].b && ((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE))) { LOG_FMT(LNL1LINE, "false (if/else)\n"); return(false); } } LOG_FMT(LNL1LINE, "true\n"); return(true); } static void undo_one_liner(chunk_t *pc) { chunk_t *tmp; if (pc && (pc->flags & PCF_ONE_LINER)) { LOG_FMT(LNL1LINE, "%s: [%s]", __func__, pc->text()); pc->flags &= ~PCF_ONE_LINER; /* scan backward */ tmp = pc; while ((tmp = chunk_get_prev(tmp)) != NULL) { if (!(tmp->flags & PCF_ONE_LINER)) { break; } LOG_FMT(LNL1LINE, " %s", tmp->text()); tmp->flags &= ~PCF_ONE_LINER; } /* scan forward */ tmp = pc; LOG_FMT(LNL1LINE, " -"); while ((tmp = chunk_get_next(tmp)) != NULL) { if (!(tmp->flags & PCF_ONE_LINER)) { break; } LOG_FMT(LNL1LINE, " %s", tmp->text()); tmp->flags &= ~PCF_ONE_LINER; } LOG_FMT(LNL1LINE, "\n"); } } static void nl_create_one_liner(chunk_t *vbrace_open) { chunk_t *tmp; chunk_t *first; /* See if we get a newline between the next text and the vbrace_close */ tmp = chunk_get_next_ncnl(vbrace_open); first = tmp; if (!first || (get_token_pattern_class(first->type) != PATCLS_NONE)) { return; } while ((tmp != NULL) && (tmp->type != CT_VBRACE_CLOSE)) { if (chunk_is_newline(tmp)) { return; } tmp = chunk_get_next(tmp); } if ((tmp != NULL) && (first != NULL)) { newline_del_between(vbrace_open, first); } } /** * Step through all chunks. */ void newlines_cleanup_braces(void) { chunk_t *pc; chunk_t *next; chunk_t *prev; chunk_t *tmp; argval_t arg; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnl(pc)) { if (pc->type == CT_IF) { newlines_if_for_while_switch(pc, cpd.settings[UO_nl_if_brace].a); } else if (pc->type == CT_ELSEIF) { arg = cpd.settings[UO_nl_elseif_brace].a; newlines_if_for_while_switch( pc, (arg != AV_IGNORE) ? arg : cpd.settings[UO_nl_if_brace].a); } else if (pc->type == CT_FOR) { newlines_if_for_while_switch(pc, cpd.settings[UO_nl_for_brace].a); } else if (pc->type == CT_CATCH) { newlines_cuddle_uncuddle(pc, cpd.settings[UO_nl_brace_catch].a); next = chunk_get_next_ncnl(pc); if ((next != NULL) && (next->type == CT_BRACE_OPEN)) { newlines_do_else(pc, cpd.settings[UO_nl_catch_brace].a); } else { newlines_if_for_while_switch(pc, cpd.settings[UO_nl_catch_brace].a); } } else if (pc->type == CT_WHILE) { newlines_if_for_while_switch(pc, cpd.settings[UO_nl_while_brace].a); } else if (pc->type == CT_USING_STMT) { newlines_if_for_while_switch(pc, cpd.settings[UO_nl_using_brace].a); } else if (pc->type == CT_SWITCH) { newlines_if_for_while_switch(pc, cpd.settings[UO_nl_switch_brace].a); } else if (pc->type == CT_DO) { newlines_do_else(pc, cpd.settings[UO_nl_do_brace].a); } else if (pc->type == CT_ELSE) { newlines_cuddle_uncuddle(pc, cpd.settings[UO_nl_brace_else].a); next = chunk_get_next_ncnl(pc); if ((next != NULL) && (next->type == CT_ELSEIF)) { newline_iarf_pair(pc, next, cpd.settings[UO_nl_else_if].a); } newlines_do_else(pc, cpd.settings[UO_nl_else_brace].a); } else if (pc->type == CT_TRY) { newlines_do_else(pc, cpd.settings[UO_nl_try_brace].a); } else if (pc->type == CT_GETSET) { newlines_do_else(pc, cpd.settings[UO_nl_getset_brace].a); } else if (pc->type == CT_FINALLY) { newlines_cuddle_uncuddle(pc, cpd.settings[UO_nl_brace_finally].a); newlines_do_else(pc, cpd.settings[UO_nl_finally_brace].a); } else if (pc->type == CT_WHILE_OF_DO) { newlines_cuddle_uncuddle(pc, cpd.settings[UO_nl_brace_while].a); } else if (pc->type == CT_BRACE_OPEN) { if (cpd.settings[UO_nl_brace_brace].a != AV_IGNORE) { next = chunk_get_next_nc(pc, CNAV_PREPROC); if ((next != NULL) && (next->type == CT_BRACE_OPEN)) { newline_iarf_pair(pc, next, cpd.settings[UO_nl_brace_brace].a); } } if (cpd.settings[UO_nl_ds_struct_enum_cmt].b && ((pc->parent_type == CT_ENUM) || (pc->parent_type == CT_STRUCT) || (pc->parent_type == CT_UNION))) { newlines_double_space_struct_enum_union(pc); } if ((pc->parent_type == CT_CLASS) && (pc->level == pc->brace_level)) { newlines_do_else(chunk_get_prev_nnl(pc), cpd.settings[UO_nl_class_brace].a); } next = chunk_get_next_nnl(pc); if (next == NULL) { // do nothing } else if (next->type == CT_BRACE_CLOSE) { //TODO: add an option to split open empty statements? { }; } else if (next->type == CT_BRACE_OPEN) { // already handled } else { next = chunk_get_next_ncnl(pc); // Handle nl_after_brace_open if ((pc->level == pc->brace_level) && cpd.settings[UO_nl_after_brace_open].b) { if (!one_liner_nl_ok(pc)) { /* no change - preserve one liner body */ } else if ((pc->flags & (PCF_IN_ARRAY_ASSIGN | PCF_IN_PREPROC)) != 0) { /* no change - don't break up array assignments or preprocessors */ } else { /* Step back from next to the first non-newline item */ tmp = chunk_get_prev(next); while (tmp != pc) { if (chunk_is_comment(tmp)) { if (!cpd.settings[UO_nl_after_brace_open_cmt].b && (tmp->type != CT_COMMENT_MULTI)) { break; } } tmp = chunk_get_prev(tmp); } /* Add the newline */ newline_iarf(tmp, AV_ADD); } } } newlines_brace_pair(pc); } else if (pc->type == CT_BRACE_CLOSE) { if (cpd.settings[UO_nl_brace_brace].a != AV_IGNORE) { next = chunk_get_next_nc(pc, CNAV_PREPROC); if ((next != NULL) && (next->type == CT_BRACE_CLOSE)) { newline_iarf_pair(pc, next, cpd.settings[UO_nl_brace_brace].a); } } if (cpd.settings[UO_eat_blanks_before_close_brace].b) { /* Limit the newlines before the close brace to 1 */ prev = chunk_get_prev(pc); if (chunk_is_newline(prev)) { if (prev->nl_count != 1) { prev->nl_count = 1; MARK_CHANGE(); } } } else if (cpd.settings[UO_nl_ds_struct_enum_close_brace].b && ((pc->parent_type == CT_ENUM) || (pc->parent_type == CT_STRUCT) || (pc->parent_type == CT_UNION))) { if ((pc->flags & PCF_ONE_LINER) == 0) { /* Make sure the } is preceded by two newlines */ prev = chunk_get_prev(pc); if (!chunk_is_newline(prev)) { prev = newline_add_before(pc); } if (prev->nl_count < 2) { double_newline(prev); } } } /* Force a newline after a function def */ if (cpd.settings[UO_nl_after_brace_close].b || (pc->parent_type == CT_FUNC_DEF) || (pc->parent_type == CT_OC_MSG_DECL)) { next = chunk_get_next(pc); if ((next != NULL) && (next->type != CT_SEMICOLON) && (next->type != CT_COMMA) && ((pc->flags & (PCF_IN_ARRAY_ASSIGN | PCF_IN_TYPEDEF)) == 0) && !chunk_is_newline(next) && !chunk_is_comment(next)) { newline_iarf(pc, AV_ADD); } } } else if (pc->type == CT_VBRACE_OPEN) { if (cpd.settings[UO_nl_after_vbrace_open].b || cpd.settings[UO_nl_after_vbrace_open_empty].b) { next = chunk_get_next(pc, CNAV_PREPROC); bool add_it; if (chunk_is_semicolon(next)) { add_it = cpd.settings[UO_nl_after_vbrace_open_empty].b; } else { add_it = (cpd.settings[UO_nl_after_vbrace_open].b && (next->type != CT_VBRACE_CLOSE) && !chunk_is_comment(next) && !chunk_is_newline(next)); } if (add_it) { newline_iarf(pc, AV_ADD); } } if ((((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSEIF) || (pc->parent_type == CT_ELSE)) && cpd.settings[UO_nl_create_if_one_liner].b) || ((pc->parent_type == CT_FOR) && cpd.settings[UO_nl_create_for_one_liner].b) || ((pc->parent_type == CT_WHILE) && cpd.settings[UO_nl_create_while_one_liner].b)) { nl_create_one_liner(pc); } } else if (pc->type == CT_VBRACE_CLOSE) { if (cpd.settings[UO_nl_after_vbrace_close].b) { if (!chunk_is_newline(chunk_get_next_nc(pc))) { newline_add_after(pc); } } } else if (pc->type == CT_STRUCT) { newlines_struct_enum_union(pc, cpd.settings[UO_nl_struct_brace].a, true); } else if (pc->type == CT_UNION) { newlines_struct_enum_union(pc, cpd.settings[UO_nl_union_brace].a, true); } else if (pc->type == CT_ENUM) { newlines_struct_enum_union(pc, cpd.settings[UO_nl_enum_brace].a, true); } else if (pc->type == CT_CASE) { /* Note: 'default' also maps to CT_CASE */ if (cpd.settings[UO_nl_before_case].b) { newline_case(pc); } } else if (pc->type == CT_THROW) { prev = chunk_get_prev(pc); if (prev && (prev->type == CT_PAREN_CLOSE)) { newline_iarf(chunk_get_prev_ncnl(pc), cpd.settings[UO_nl_before_throw].a); } } else if (pc->type == CT_CASE_COLON) { next = chunk_get_next_nnl(pc); if (next && (next->type == CT_BRACE_OPEN) && (cpd.settings[UO_nl_case_colon_brace].a != AV_IGNORE)) { newline_iarf(pc, cpd.settings[UO_nl_case_colon_brace].a); } else if (cpd.settings[UO_nl_after_case].b) { newline_case_colon(pc); } } else if (pc->type == CT_SPAREN_CLOSE) { next = chunk_get_next_ncnl(pc); if ((next != NULL) && (next->type == CT_BRACE_OPEN)) { /* TODO: * this could be used to control newlines between the * the if/while/for/switch close paren and the open brace, but * that is currently handled elsewhere. */ } } else if (pc->type == CT_RETURN) { if (cpd.settings[UO_nl_after_return].b) { newline_return(pc); } } else if (pc->type == CT_SEMICOLON) { if (((pc->flags & (PCF_IN_SPAREN | PCF_IN_PREPROC)) == 0) && cpd.settings[UO_nl_after_semicolon].b) { next = chunk_get_next(pc); while ((next != NULL) && (next->type == CT_VBRACE_CLOSE)) { next = chunk_get_next(next); } if ((next != NULL) && !chunk_is_comment(next) && !chunk_is_newline(next)) { if (one_liner_nl_ok(next)) { newline_iarf(pc, AV_ADD); } } } } else if (pc->type == CT_FPAREN_OPEN) { if (((pc->parent_type == CT_FUNC_DEF) || (pc->parent_type == CT_FUNC_PROTO) || (pc->parent_type == CT_FUNC_CLASS) || (pc->parent_type == CT_OPERATOR)) && ((cpd.settings[UO_nl_func_decl_start].a != AV_IGNORE) || (cpd.settings[UO_nl_func_def_start].a != AV_IGNORE) || (cpd.settings[UO_nl_func_decl_args].a != AV_IGNORE) || (cpd.settings[UO_nl_func_def_args].a != AV_IGNORE) || (cpd.settings[UO_nl_func_decl_end].a != AV_IGNORE) || (cpd.settings[UO_nl_func_def_end].a != AV_IGNORE) || (cpd.settings[UO_nl_func_decl_empty].a != AV_IGNORE) || (cpd.settings[UO_nl_func_def_empty].a != AV_IGNORE) || (cpd.settings[UO_nl_func_type_name].a != AV_IGNORE) || (cpd.settings[UO_nl_func_type_name_class].a != AV_IGNORE) || (cpd.settings[UO_nl_func_scope_name].a != AV_IGNORE) || (cpd.settings[UO_nl_func_proto_type_name].a != AV_IGNORE) || (cpd.settings[UO_nl_func_paren].a != AV_IGNORE) || (cpd.settings[UO_nl_func_def_paren].a != AV_IGNORE))) { newline_func_def(pc); } } else if (pc->type == CT_ANGLE_CLOSE) { if (pc->parent_type == CT_TEMPLATE) { next = chunk_get_next_ncnl(pc); if ((next != NULL) && (next->level == next->brace_level)) { tmp = chunk_get_prev_ncnl(chunk_get_prev_type(pc, CT_ANGLE_OPEN, pc->level)); if ((tmp != NULL) && (tmp->type == CT_TEMPLATE)) { newline_iarf(pc, cpd.settings[UO_nl_template_class].a); } } } } else if (pc->type == CT_NAMESPACE) { newlines_struct_enum_union(pc, cpd.settings[UO_nl_namespace_brace].a, false); } else if (pc->type == CT_SQUARE_OPEN) { if ((pc->parent_type == CT_ASSIGN) && ((pc->flags & PCF_ONE_LINER) == 0)) { tmp = chunk_get_prev_ncnl(pc); newline_iarf(tmp, cpd.settings[UO_nl_assign_square].a); argval_t arg = cpd.settings[UO_nl_after_square_assign].a; if (cpd.settings[UO_nl_assign_square].a & AV_ADD) { arg = AV_ADD; } newline_iarf(pc, arg); /* if there is a newline after the open, then force a newline * before the close */ tmp = chunk_get_next_nc(pc); if (chunk_is_newline(tmp)) { tmp = chunk_get_next_type(pc, CT_SQUARE_CLOSE, pc->level); if (tmp != NULL) { newline_add_before(tmp); } } } } else if (pc->type == CT_PRIVATE) { /** Make sure there is a newline before an access spec */ if (cpd.settings[UO_nl_before_access_spec].n > 0) { prev = chunk_get_prev(pc); if (!chunk_is_newline(prev)) { newline_add_before(pc); } } } else if (pc->type == CT_PRIVATE_COLON) { /** Make sure there is a newline after an access spec */ if (cpd.settings[UO_nl_after_access_spec].n > 0) { next = chunk_get_next(pc); if (!chunk_is_newline(next)) { newline_add_before(next); } } } else if (pc->type == CT_PP_DEFINE) { if (cpd.settings[UO_nl_multi_line_define].b) { nl_handle_define(pc); } } else { /* ignore it */ } } } /** * Find the next newline or nl_cont */ static void nl_handle_define(chunk_t *pc) { chunk_t *nl = pc; chunk_t *ref = NULL; while ((nl = chunk_get_next(nl)) != NULL) { if (nl->type == CT_NEWLINE) { return; } if ((nl->type == CT_MACRO) || ((nl->type == CT_FPAREN_CLOSE) && (nl->parent_type == CT_MACRO_FUNC))) { ref = nl; } if (nl->type == CT_NL_CONT) { if (ref != NULL) { newline_add_after(ref); } return; } } } void newline_after_multiline_comment(void) { chunk_t *pc; chunk_t *tmp; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type != CT_COMMENT_MULTI) { continue; } tmp = pc; while (((tmp = chunk_get_next(tmp)) != NULL) && !chunk_is_newline(tmp)) { if (!chunk_is_comment(tmp)) { newline_add_before(tmp); break; } } } } /** * Handle insertion/removal of blank lines before if/for/while/do */ void newlines_insert_blank_lines(void) { chunk_t *pc; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnl(pc)) { if (pc->type == CT_IF) { newlines_if_for_while_switch_pre_blank_lines(pc, cpd.settings[UO_nl_before_if].a); newlines_if_for_while_switch_post_blank_lines(pc, cpd.settings[UO_nl_after_if].a); } else if (pc->type == CT_FOR) { newlines_if_for_while_switch_pre_blank_lines(pc, cpd.settings[UO_nl_before_for].a); newlines_if_for_while_switch_post_blank_lines(pc, cpd.settings[UO_nl_after_for].a); } else if (pc->type == CT_WHILE) { newlines_if_for_while_switch_pre_blank_lines(pc, cpd.settings[UO_nl_before_while].a); newlines_if_for_while_switch_post_blank_lines(pc, cpd.settings[UO_nl_after_while].a); } else if (pc->type == CT_SWITCH) { newlines_if_for_while_switch_pre_blank_lines(pc, cpd.settings[UO_nl_before_switch].a); newlines_if_for_while_switch_post_blank_lines(pc, cpd.settings[UO_nl_after_switch].a); } else if (pc->type == CT_DO) { newlines_if_for_while_switch_pre_blank_lines(pc, cpd.settings[UO_nl_before_do].a); newlines_if_for_while_switch_post_blank_lines(pc, cpd.settings[UO_nl_after_do].a); } else { /* ignore it */ } } } void newlines_squeeze_ifdef(void) { chunk_t *pc; chunk_t *ppr; chunk_t *pnl; chunk_t *nnl; chunk_t *tmp1; chunk_t *tmp2; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnl(pc)) { if ((pc->type == CT_PREPROC) && (pc->level > 0)) { ppr = chunk_get_next(pc); if ((ppr->type == CT_PP_IF) || (ppr->type == CT_PP_ELSE) || (ppr->type == CT_PP_ENDIF)) { pnl = NULL; nnl = chunk_get_next_nl(ppr); if (ppr->type == CT_PP_ENDIF) { pnl = chunk_get_prev_nl(pc); } if (nnl != NULL) { if (pnl != NULL) { if (pnl->nl_count > 1) { //nnl->nl_count += pnl->nl_count - 1; pnl->nl_count = 1; MARK_CHANGE(); tmp1 = chunk_get_prev_nnl(pnl); tmp2 = chunk_get_prev_nnl(nnl); LOG_FMT(LNEWLINE, "%s: moved from after line %d to after %d\n", __func__, tmp1->orig_line, tmp2->orig_line); } } else { if (nnl->nl_count > 1) { tmp1 = chunk_get_prev_nnl(nnl); LOG_FMT(LNEWLINE, "%s: trimmed newlines after line %d from %d\n", __func__, tmp1->orig_line, nnl->nl_count); nnl->nl_count = 1; MARK_CHANGE(); } } } } } } } void newlines_eat_start_end(void) { chunk_t *pc; /* Process newlines at the start of the file */ if (((cpd.settings[UO_nl_start_of_file].a & AV_REMOVE) != 0) || (((cpd.settings[UO_nl_start_of_file].a & AV_ADD) != 0) && (cpd.settings[UO_nl_start_of_file_min].n > 0))) { pc = chunk_get_head(); if (pc != NULL) { if (pc->type == CT_NEWLINE) { if (cpd.settings[UO_nl_start_of_file].a == AV_REMOVE) { chunk_del(pc); MARK_CHANGE(); } else if ((cpd.settings[UO_nl_start_of_file].a == AV_FORCE) || (pc->nl_count < cpd.settings[UO_nl_start_of_file_min].n)) { pc->nl_count = cpd.settings[UO_nl_start_of_file_min].n; MARK_CHANGE(); } } else if (((cpd.settings[UO_nl_start_of_file].a & AV_ADD) != 0) && (cpd.settings[UO_nl_start_of_file_min].n > 0)) { chunk_t chunk; chunk.orig_line = pc->orig_line; chunk.type = CT_NEWLINE; chunk.nl_count = cpd.settings[UO_nl_start_of_file_min].n; chunk_add_before(&chunk, pc); MARK_CHANGE(); } } } /* Process newlines at the end of the file */ if (((cpd.settings[UO_nl_end_of_file].a & AV_REMOVE) != 0) || (((cpd.settings[UO_nl_end_of_file].a & AV_ADD) != 0) && (cpd.settings[UO_nl_end_of_file_min].n > 0))) { pc = chunk_get_tail(); if (pc != NULL) { if (pc->type == CT_NEWLINE) { if (cpd.settings[UO_nl_end_of_file].a == AV_REMOVE) { chunk_del(pc); MARK_CHANGE(); } else if ((cpd.settings[UO_nl_end_of_file].a == AV_FORCE) || (pc->nl_count < cpd.settings[UO_nl_end_of_file_min].n)) { if (pc->nl_count != cpd.settings[UO_nl_end_of_file_min].n) { pc->nl_count = cpd.settings[UO_nl_end_of_file_min].n; MARK_CHANGE(); } } } else if (((cpd.settings[UO_nl_end_of_file].a & AV_ADD) != 0) && (cpd.settings[UO_nl_end_of_file_min].n > 0)) { chunk_t chunk; chunk.orig_line = pc->orig_line; chunk.type = CT_NEWLINE; chunk.nl_count = cpd.settings[UO_nl_end_of_file_min].n; chunk_add(&chunk); MARK_CHANGE(); } } } } /** * Searches for a chunk of type chunk_type and moves them, if needed. * Will not move tokens that are on their own line or have other than * exactly 1 newline before (UO_pos_comma == TRAIL) or after (UO_pos_comma == LEAD). * We can't remove a newline if it is right before a preprocessor. */ void newlines_chunk_pos(c_token_t chunk_type, tokenpos_e mode) { chunk_t *pc; chunk_t *next; chunk_t *prev; int nl_flag; if ((mode & (TP_LEAD | TP_TRAIL)) == 0) { return; } for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnl(pc)) { if (pc->type == chunk_type) { prev = chunk_get_prev_nc(pc); next = chunk_get_next_nc(pc); nl_flag = ((chunk_is_newline(prev) ? 1 : 0) | (chunk_is_newline(next) ? 2 : 0)); if (((nl_flag == 0) && ((mode & (TP_FORCE | TP_BREAK)) == 0)) || ((nl_flag == 3) && ((mode & TP_FORCE) == 0))) { /* No newlines and not adding any or both and not forcing */ continue; } if (((mode & TP_LEAD) && (nl_flag == 1)) || ((mode & TP_TRAIL) && (nl_flag == 2))) { /* Already a newline before (lead) or after (trail) */ continue; } /* If there were no newlines, we need to add one */ if (nl_flag == 0) { if (mode & TP_LEAD) { newline_add_before(pc); } else { newline_add_after(pc); } continue; } /* If there were both newlines, we need to remove one */ if (nl_flag == 3) { if (mode & TP_LEAD) { remove_next_newlines(pc); } else { remove_next_newlines(chunk_get_prev_ncnl(pc)); } continue; } /* we need to move the newline */ if (mode & TP_LEAD) { chunk_t *next2 = chunk_get_next(next); if ((next2 != NULL) && ((next2->type == CT_PREPROC) || ((chunk_type == CT_ASSIGN) && (next2->type == CT_BRACE_OPEN)))) { continue; } if (next->nl_count == 1) { /* move the CT_BOOL to after the newline */ chunk_move_after(pc, next); } } else { if (prev->nl_count == 1) { /* Back up to the next non-comment item */ prev = chunk_get_prev_nc(prev); if ((prev != NULL) && !chunk_is_newline(prev) && !(prev->flags & PCF_IN_PREPROC)) { chunk_move_after(pc, prev); } } } } } } /** * Searches for CT_CLASS_COLON and moves them, if needed. * Also breaks up the args */ void newlines_class_colon_pos(void) { chunk_t *pc; chunk_t *next; chunk_t *prev; tokenpos_e mode = cpd.settings[UO_pos_class_colon].tp; chunk_t *ccolon = NULL; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnl(pc)) { if ((ccolon == NULL) && (pc->type != CT_CLASS_COLON)) { continue; } if (pc->type == CT_CLASS_COLON) { ccolon = pc; prev = chunk_get_prev_nc(pc); next = chunk_get_next_nc(pc); if (!chunk_is_newline(prev) && !chunk_is_newline(next) && ((cpd.settings[UO_nl_class_colon].a & AV_ADD) != 0)) { newline_add_after(pc); prev = chunk_get_prev_nc(pc); next = chunk_get_next_nc(pc); } if (cpd.settings[UO_nl_class_colon].a == AV_REMOVE) { if (chunk_is_newline(prev) && chunk_safe_to_del_nl(prev)) { chunk_del(prev); MARK_CHANGE(); prev = chunk_get_prev_nc(pc); } if (chunk_is_newline(next) && chunk_safe_to_del_nl(next)) { chunk_del(next); MARK_CHANGE(); next = chunk_get_next_nc(pc); } } if (mode & TP_TRAIL) { if (chunk_is_newline(prev) && (prev->nl_count == 1) && chunk_safe_to_del_nl(prev)) { chunk_swap(pc, prev); } } else if (mode & TP_LEAD) { if (chunk_is_newline(next) && (next->nl_count == 1) && chunk_safe_to_del_nl(next)) { chunk_swap(pc, next); } } } else { if ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_SEMICOLON)) { ccolon = NULL; continue; } if ((pc->type == CT_COMMA) && (pc->level == ccolon->level)) { if ((cpd.settings[UO_nl_class_init_args].a & AV_ADD) != 0) { if (cpd.settings[UO_pos_class_comma].tp & TP_TRAIL) { newline_add_after(pc); } else if (cpd.settings[UO_pos_class_comma].tp & TP_LEAD) { newline_add_before(pc); next = chunk_get_next_nc(pc); if (chunk_is_newline(next) && chunk_safe_to_del_nl(next)) { chunk_del(next); MARK_CHANGE(); } } } else if (cpd.settings[UO_nl_class_init_args].a == AV_REMOVE) { next = chunk_get_next(pc); if (chunk_is_newline(next) && chunk_safe_to_del_nl(next)) { chunk_del(next); MARK_CHANGE(); } } } } } } static void _blank_line_set(chunk_t *pc, const char *text, uncrustify_options uo) { if ((cpd.settings[uo].n > 0) && (pc->nl_count != cpd.settings[uo].n)) { LOG_FMT(LBLANKD, "do_blank_lines: %s set line %d\n", text + 3, pc->orig_line); pc->nl_count = cpd.settings[uo].n; MARK_CHANGE(); } } #define blank_line_set(pc, op) _blank_line_set(pc, # op, op) static void _blank_line_max(chunk_t *pc, const char *text, uncrustify_options uo) { if ((cpd.settings[uo].n > 0) && (pc->nl_count > cpd.settings[uo].n)) { LOG_FMT(LBLANKD, "do_blank_lines: %s max line %d\n", text + 3, pc->orig_line); pc->nl_count = cpd.settings[uo].n; MARK_CHANGE(); } } #define blank_line_max(pc, op) _blank_line_max(pc, # op, op) /** * Scans for newline tokens and changes the nl_count. * A newline token has a minimum nl_count of 1. * Note that a blank line is actually 2 newlines, unless the newline is the * first chunk. But we don't handle the first chunk. * So, most comparisons have +1 below. */ void do_blank_lines(void) { chunk_t *pc; chunk_t *next; chunk_t *prev; chunk_t *pcmt; int old_nl; /* Don't process the first token, as we don't care if it is a newline */ pc = chunk_get_head(); while ((pc = chunk_get_next(pc)) != NULL) { if (pc->type != CT_NEWLINE) { continue; } next = chunk_get_next(pc); prev = chunk_get_prev_nc(pc); pcmt = chunk_get_prev(pc); old_nl = pc->nl_count; if ((next != NULL) && (prev != NULL)) { LOG_FMT(LBLANK, "%s: line %d [%s] vs [%s] nl=%d\n", __func__, pc->orig_line, prev->str.c_str(), next->str.c_str(), pc->nl_count); } /* Limit consecutive newlines */ if ((cpd.settings[UO_nl_max].n > 0) && (pc->nl_count > (cpd.settings[UO_nl_max].n))) { blank_line_max(pc, UO_nl_max); } if (!can_increase_nl(pc)) { LOG_FMT(LBLANKD, "do_blank_lines: force to 1 line %d\n", pc->orig_line); if (pc->nl_count != 1) { pc->nl_count = 1; MARK_CHANGE(); } continue; } /** Control blanks before multi-line comments */ if ((cpd.settings[UO_nl_before_block_comment].n > pc->nl_count) && (next != NULL) && (next->type == CT_COMMENT_MULTI)) { /* Don't add blanks after a open brace */ if ((prev == NULL) || ((prev->type != CT_BRACE_OPEN) && (prev->type != CT_VBRACE_OPEN))) { blank_line_set(pc, UO_nl_before_block_comment); } } /** Control blanks before single line C comments */ if ((cpd.settings[UO_nl_before_c_comment].n > pc->nl_count) && (next != NULL) && (next->type == CT_COMMENT)) { /* Don't add blanks after a open brace or a comment */ if ((prev == NULL) || ((prev->type != CT_BRACE_OPEN) && (prev->type != CT_VBRACE_OPEN) && (pcmt->type != CT_COMMENT))) { blank_line_set(pc, UO_nl_before_c_comment); } } /** Control blanks before CPP comments */ if ((cpd.settings[UO_nl_before_cpp_comment].n > pc->nl_count) && (next != NULL) && (next->type == CT_COMMENT_CPP)) { /* Don't add blanks after a open brace */ if ((prev == NULL) || ((prev->type != CT_BRACE_OPEN) && (prev->type != CT_VBRACE_OPEN) && (pcmt->type != CT_COMMENT_CPP))) { blank_line_set(pc, UO_nl_before_cpp_comment); } } /** Control blanks before an access spec */ if ((cpd.settings[UO_nl_before_access_spec].n > 0) && (cpd.settings[UO_nl_before_access_spec].n != pc->nl_count) && (next != NULL) && (next->type == CT_PRIVATE)) { /* Don't add blanks after a open brace */ if ((prev == NULL) || ((prev->type != CT_BRACE_OPEN) && (prev->type != CT_VBRACE_OPEN))) { blank_line_set(pc, UO_nl_before_access_spec); } } /** Control blanks after an access spec */ if ((cpd.settings[UO_nl_after_access_spec].n > 0) && (cpd.settings[UO_nl_after_access_spec].n != pc->nl_count) && (prev != NULL) && (prev->type == CT_PRIVATE_COLON)) { blank_line_set(pc, UO_nl_after_access_spec); } /* Add blanks after function bodies */ if ((prev != NULL) && (prev->type == CT_BRACE_CLOSE) && ((prev->parent_type == CT_FUNC_DEF) || (prev->parent_type == CT_FUNC_CLASS) || (prev->parent_type == CT_OC_MSG_DECL) || (prev->parent_type == CT_ASSIGN))) { if (prev->flags & PCF_ONE_LINER) { if (cpd.settings[UO_nl_after_func_body_one_liner].n > pc->nl_count) { blank_line_set(pc, UO_nl_after_func_body_one_liner); } } else { if ((prev->flags & PCF_IN_CLASS) && (cpd.settings[UO_nl_after_func_body_class].n > 0)) { if (cpd.settings[UO_nl_after_func_body_class].n != pc->nl_count) { blank_line_set(pc, UO_nl_after_func_body_class); } } else if (cpd.settings[UO_nl_after_func_body].n > 0) { if (cpd.settings[UO_nl_after_func_body].n != pc->nl_count) { blank_line_set(pc, UO_nl_after_func_body); } } } } /* Add blanks after function prototypes */ if ((prev != NULL) && (prev->type == CT_SEMICOLON) && (prev->parent_type == CT_FUNC_PROTO)) { if (cpd.settings[UO_nl_after_func_proto].n > pc->nl_count) { pc->nl_count = cpd.settings[UO_nl_after_func_proto].n; MARK_CHANGE(); } if ((cpd.settings[UO_nl_after_func_proto_group].n > pc->nl_count) && (next != NULL) && (next->parent_type != CT_FUNC_PROTO)) { blank_line_set(pc, UO_nl_after_func_proto_group); } } /* Add blanks after struct/enum/union/class */ if ((prev != NULL) && ((prev->type == CT_SEMICOLON) || (prev->type == CT_BRACE_CLOSE)) && ((prev->parent_type == CT_STRUCT) || (prev->parent_type == CT_ENUM) || (prev->parent_type == CT_UNION) || (prev->parent_type == CT_CLASS))) { if (prev->parent_type == CT_CLASS) { if (cpd.settings[UO_nl_after_class].n > pc->nl_count) { blank_line_set(pc, UO_nl_after_class); } } else { if (cpd.settings[UO_nl_after_struct].n > pc->nl_count) { blank_line_set(pc, UO_nl_after_struct); } } } /* Change blanks between a function comment and body */ if ((cpd.settings[UO_nl_comment_func_def].n != 0) && (pcmt->type == CT_COMMENT_MULTI) && (pcmt->parent_type == CT_COMMENT_WHOLE) && (next != NULL) && (next->parent_type == CT_FUNC_DEF)) { if (cpd.settings[UO_nl_comment_func_def].n != pc->nl_count) { blank_line_set(pc, UO_nl_comment_func_def); } } /* Change blanks after a try-catch-finally block */ if ((cpd.settings[UO_nl_after_try_catch_finally].n != 0) && (cpd.settings[UO_nl_after_try_catch_finally].n != pc->nl_count) && (prev != NULL) && (next != NULL)) { if ((prev->type == CT_BRACE_CLOSE) && ((prev->parent_type == CT_CATCH) || (prev->parent_type == CT_FINALLY))) { if ((next->type != CT_BRACE_CLOSE) && (next->type != CT_CATCH) && (next->type != CT_FINALLY)) { blank_line_set(pc, UO_nl_after_try_catch_finally); } } } /* Change blanks after a try-catch-finally block */ if ((cpd.settings[UO_nl_between_get_set].n != 0) && (cpd.settings[UO_nl_between_get_set].n != pc->nl_count) && (prev != NULL) && (next != NULL)) { if ((prev->parent_type == CT_GETSET) && (next->type != CT_BRACE_CLOSE) && ((prev->type == CT_BRACE_CLOSE) || (prev->type == CT_SEMICOLON))) { blank_line_set(pc, UO_nl_between_get_set); } } /* Change blanks after a try-catch-finally block */ if ((cpd.settings[UO_nl_around_cs_property].n != 0) && (cpd.settings[UO_nl_around_cs_property].n != pc->nl_count) && (prev != NULL) && (next != NULL)) { if ((prev->type == CT_BRACE_CLOSE) && (prev->parent_type == CT_CS_PROPERTY) && (next->type != CT_BRACE_CLOSE)) { blank_line_set(pc, UO_nl_around_cs_property); } else if ((next->parent_type == CT_CS_PROPERTY) && (next->flags & PCF_STMT_START)) { blank_line_set(pc, UO_nl_around_cs_property); } } if (old_nl != pc->nl_count) { LOG_FMT(LBLANK, " -=> changed to %d\n", pc->nl_count); } } } void newlines_cleanup_dup(void) { chunk_t *pc; chunk_t *next; pc = chunk_get_head(); next = pc; while (pc != NULL) { next = chunk_get_next(next); if ((next != NULL) && (pc->type == CT_NEWLINE) && (next->type == CT_NEWLINE)) { next->nl_count = max(pc->nl_count, next->nl_count); chunk_del(pc); MARK_CHANGE(); } pc = next; } } /** * Make sure there is a blank line after a commented group of values */ static void newlines_double_space_struct_enum_union(chunk_t *open_brace) { chunk_t *pc = open_brace; chunk_t *prev; while (((pc = chunk_get_next_nc(pc)) != NULL) && (pc->level > open_brace->level)) { if ((pc->level != (open_brace->level + 1)) || (pc->type != CT_NEWLINE)) { continue; } /* If the newline is NOT after a comment or a brace open and * it is before a comment, then make sure that the newline is * at least doubled */ prev = chunk_get_prev(pc); if (!chunk_is_comment(prev) && (prev->type != CT_BRACE_OPEN) && chunk_is_comment(chunk_get_next(pc))) { if (pc->nl_count < 2) { double_newline(pc); } } } } uncrustify-0.59/src/detect.cpp0000644000175000017500000003660311630457175013367 00000000000000/** * @file detect.cpp * Scans the parsed file and tries to determine options. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "ChunkStack.h" #include "align_stack.h" #include "prototypes.h" #include #include #include #include #include "unc_ctype.h" class sp_votes { protected: int m_add; int m_remove; int m_force; argval_t *m_av; public: sp_votes(argval_t& av) { m_add = 0; m_remove = 0; m_force = 0; m_av = &av; } ~sp_votes(); void vote(chunk_t *first, chunk_t *second); }; void sp_votes::vote(chunk_t *first, chunk_t *second) { if ((first == NULL) || chunk_is_newline(first) || (second == NULL) || chunk_is_newline(second)) { return; } int col_dif = second->column - (first->column + first->len()); if (col_dif == 0) { m_remove++; } else if (col_dif == 1) { m_force++; } else { m_add++; } } /** * Figure out the result of the vote and maybe update *m_av */ sp_votes::~sp_votes() { /* no change if no items were added */ if ((m_remove == 0) && (m_add == 0) && (m_force == 0)) { return; } if (m_remove == 0) { *m_av = (m_force > m_add) ? AV_FORCE : AV_ADD; } else if ((m_force == 0) && (m_add == 0)) { *m_av = AV_REMOVE; } else { /* nothing conclusive. do not alter. */ } } #define SP_VOTE_VAR(x) sp_votes vote_ ## x(cpd.settings[UO_ ## x].a) /** * Detect spacing options */ static void detect_space_options() { SP_VOTE_VAR(sp_arith); SP_VOTE_VAR(sp_before_assign); SP_VOTE_VAR(sp_after_assign); SP_VOTE_VAR(sp_enum_before_assign); SP_VOTE_VAR(sp_enum_after_assign); SP_VOTE_VAR(sp_bool); SP_VOTE_VAR(sp_compare); SP_VOTE_VAR(sp_inside_paren); SP_VOTE_VAR(sp_paren_paren); SP_VOTE_VAR(sp_paren_brace); SP_VOTE_VAR(sp_before_ptr_star); SP_VOTE_VAR(sp_before_unnamed_ptr_star); SP_VOTE_VAR(sp_between_ptr_star); SP_VOTE_VAR(sp_after_ptr_star); SP_VOTE_VAR(sp_after_byref); SP_VOTE_VAR(sp_before_byref); SP_VOTE_VAR(sp_before_unnamed_byref); SP_VOTE_VAR(sp_after_type); SP_VOTE_VAR(sp_template_angle); SP_VOTE_VAR(sp_before_angle); SP_VOTE_VAR(sp_inside_angle); SP_VOTE_VAR(sp_after_angle); SP_VOTE_VAR(sp_angle_paren); SP_VOTE_VAR(sp_angle_word); SP_VOTE_VAR(sp_before_square); SP_VOTE_VAR(sp_before_squares); SP_VOTE_VAR(sp_inside_square); SP_VOTE_VAR(sp_before_sparen); SP_VOTE_VAR(sp_inside_sparen); SP_VOTE_VAR(sp_after_sparen); SP_VOTE_VAR(sp_sparen_brace); SP_VOTE_VAR(sp_special_semi); SP_VOTE_VAR(sp_before_semi); SP_VOTE_VAR(sp_before_semi_for); SP_VOTE_VAR(sp_before_semi_for_empty); SP_VOTE_VAR(sp_after_semi_for_empty); SP_VOTE_VAR(sp_after_comma); SP_VOTE_VAR(sp_before_comma); SP_VOTE_VAR(sp_after_class_colon); SP_VOTE_VAR(sp_before_class_colon); SP_VOTE_VAR(sp_inside_braces); SP_VOTE_VAR(sp_inside_braces_empty); SP_VOTE_VAR(sp_else_brace); SP_VOTE_VAR(sp_brace_else); SP_VOTE_VAR(sp_catch_brace); SP_VOTE_VAR(sp_brace_catch); SP_VOTE_VAR(sp_finally_brace); SP_VOTE_VAR(sp_brace_finally); SP_VOTE_VAR(sp_try_brace); SP_VOTE_VAR(sp_getset_brace); chunk_t *prev = chunk_get_head(); chunk_t *pc = chunk_get_next(prev); chunk_t *next; while (pc != NULL) { next = chunk_get_next(pc); if (next == NULL) { break; } if (pc->type == CT_ARITH) { vote_sp_arith.vote(pc, next); vote_sp_arith.vote(prev, pc); } if (pc->type == CT_ASSIGN) { if ((pc->flags & PCF_IN_ENUM) == 0) { vote_sp_before_assign.vote(prev, pc); vote_sp_after_assign.vote(pc, next); } else { vote_sp_enum_before_assign.vote(prev, pc); vote_sp_enum_after_assign.vote(pc, next); } } if (pc->type == CT_SQUARE_OPEN) { vote_sp_before_square.vote(prev, pc); vote_sp_inside_square.vote(pc, next); } if (pc->type == CT_SQUARE_CLOSE) { vote_sp_inside_square.vote(prev, pc); } if (pc->type == CT_TSQUARE) { vote_sp_before_squares.vote(prev, pc); } if (pc->type == CT_BOOL) { vote_sp_bool.vote(prev, pc); vote_sp_bool.vote(pc, next); } if (pc->type == CT_COMPARE) { vote_sp_compare.vote(prev, pc); vote_sp_compare.vote(pc, next); } if (pc->type == CT_PAREN_CLOSE) { vote_sp_inside_paren.vote(prev, pc); } if (pc->type == CT_PAREN_OPEN) { vote_sp_inside_paren.vote(pc, next); } if ((chunk_is_paren_open(pc) && chunk_is_paren_open(next)) || (chunk_is_paren_close(pc) && chunk_is_paren_close(next))) { vote_sp_paren_paren.vote(pc, next); } if (chunk_is_paren_close(pc) && (next->type == CT_BRACE_OPEN)) { vote_sp_paren_brace.vote(pc, next); } if (pc->type == CT_PTR_TYPE) { if (prev->type == CT_PTR_TYPE) { vote_sp_between_ptr_star.vote(prev, pc); } else if (next->type != CT_WORD) { vote_sp_before_unnamed_ptr_star.vote(prev, pc); } else { vote_sp_before_ptr_star.vote(prev, pc); } if (CharTable::IsKw1(next->str[0])) { vote_sp_after_ptr_star.vote(pc, next); } } if (pc->type == CT_BYREF) { if (next->type != CT_WORD) { vote_sp_before_unnamed_byref.vote(prev, pc); } else { vote_sp_before_byref.vote(prev, pc); } vote_sp_after_byref.vote(pc, next); } if ((pc->type != CT_PTR_TYPE) && ((prev->type == CT_QUALIFIER) || (prev->type == CT_TYPE))) { vote_sp_after_type.vote(prev, pc); } if (pc->type == CT_ANGLE_OPEN) { vote_sp_inside_angle.vote(pc, next); if (prev->type == CT_TEMPLATE) { vote_sp_template_angle.vote(prev, pc); } else { vote_sp_before_angle.vote(prev, pc); } } if (pc->type == CT_ANGLE_CLOSE) { vote_sp_inside_angle.vote(prev, pc); if (chunk_is_paren_open(next)) { vote_sp_angle_paren.vote(prev, pc); } else if ((next->type == CT_WORD) || CharTable::IsKw1(next->str[0])) { vote_sp_angle_word.vote(prev, pc); } else { vote_sp_after_angle.vote(pc, next); } } if (pc->type == CT_SPAREN_OPEN) { vote_sp_before_sparen.vote(prev, pc); vote_sp_inside_sparen.vote(pc, next); } if (pc->type == CT_SPAREN_CLOSE) { vote_sp_inside_sparen.vote(prev, pc); if (next->type == CT_BRACE_OPEN) { vote_sp_sparen_brace.vote(pc, next); } else { vote_sp_after_sparen.vote(pc, next); } } if (pc->type == CT_SEMICOLON) { if (pc->parent_type == CT_FOR) { if (prev->type == CT_SPAREN_OPEN) { /* emtpy, ie for (;;) */ vote_sp_before_semi_for_empty.vote(prev, pc); } else if (next->type == CT_SPAREN_CLOSE) { /* emtpy, ie for (;;) */ vote_sp_after_semi_for_empty.vote(pc, next); } else if (prev->type != CT_SEMICOLON) { vote_sp_before_semi_for.vote(prev, pc); } } else if (prev->type == CT_VBRACE_OPEN) { vote_sp_special_semi.vote(chunk_get_prev(prev), pc); } else { vote_sp_before_semi.vote(prev, pc); } } if (pc->type == CT_COMMA) { vote_sp_before_comma.vote(prev, pc); vote_sp_after_comma.vote(pc, next); } if (pc->type == CT_CLASS_COLON) { vote_sp_before_class_colon.vote(prev, pc); vote_sp_after_class_colon.vote(pc, next); } if (pc->type == CT_BRACE_OPEN) { if (prev->type == CT_ELSE) { vote_sp_else_brace.vote(prev, pc); } else if (prev->type == CT_CATCH) { vote_sp_catch_brace.vote(prev, pc); } else if (prev->type == CT_FINALLY) { vote_sp_catch_brace.vote(prev, pc); } else if (prev->type == CT_TRY) { vote_sp_catch_brace.vote(prev, pc); } else if (prev->type == CT_GETSET) { vote_sp_catch_brace.vote(prev, pc); } if (next->type == CT_BRACE_CLOSE) { vote_sp_inside_braces_empty.vote(pc, next); } else { vote_sp_inside_braces.vote(pc, next); } } if (pc->type == CT_BRACE_CLOSE) { vote_sp_inside_braces.vote(prev, pc); if (next->type == CT_ELSE) { vote_sp_brace_else.vote(pc, next); } else if (next->type == CT_CATCH) { vote_sp_brace_catch.vote(pc, next); } else if (next->type == CT_FINALLY) { vote_sp_brace_finally.vote(pc, next); } } prev = pc; pc = next; } } // unc_add_option("sp_after_operator", UO_sp_after_operator, AT_IARF, // "Add or remove space between 'operator' and operator sign"); // unc_add_option("sp_after_operator_sym", UO_sp_after_operator_sym, AT_IARF, // "Add or remove space between the operator symbol and the open paren, as in 'operator ++('"); // unc_add_option("sp_after_cast", UO_sp_after_cast, AT_IARF, // "Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'"); // unc_add_option("sp_inside_paren_cast", UO_sp_inside_paren_cast, AT_IARF, // "Add or remove spaces inside cast parens"); // unc_add_option("sp_sizeof_paren", UO_sp_sizeof_paren, AT_IARF, // "Add or remove space between 'sizeof' and '('"); // unc_add_option("sp_after_tag", UO_sp_after_tag, AT_IARF, // "Add or remove space after the tag keyword (Pawn)"); // unc_add_option("sp_inside_braces_enum", UO_sp_inside_braces_enum, AT_IARF, // "Add or remove space inside enum '{' and '}'"); // unc_add_option("sp_inside_braces_struct", UO_sp_inside_braces_struct, AT_IARF, // "Add or remove space inside struct/union '{' and '}'"); // unc_add_option("sp_type_func", UO_sp_type_func, AT_IARF, // "Add or remove space between return type and function name\n" // "A minimum of 1 is forced except for pointer return types."); // unc_add_option("sp_func_proto_paren", UO_sp_func_proto_paren, AT_IARF, // "Add or remove space between function name and '(' on function declaration"); // unc_add_option("sp_func_def_paren", UO_sp_func_def_paren, AT_IARF, // "Add or remove space between function name and '(' on function definition"); // unc_add_option("sp_inside_fparens", UO_sp_inside_fparens, AT_IARF, // "Add or remove space inside empty function '()'"); // unc_add_option("sp_inside_fparen", UO_sp_inside_fparen, AT_IARF, // "Add or remove space inside function '(' and ')'"); // unc_add_option("sp_square_fparen", UO_sp_square_fparen, AT_IARF, // "Add or remove space between ']' and '(' when part of a function call."); // unc_add_option("sp_fparen_brace", UO_sp_fparen_brace, AT_IARF, // "Add or remove space between ')' and '{' of function"); // unc_add_option("sp_func_call_paren", UO_sp_func_call_paren, AT_IARF, // "Add or remove space between function name and '(' on function calls"); // unc_add_option("sp_func_class_paren", UO_sp_func_class_paren, AT_IARF, // "Add or remove space between a constructor/destructor and the open paren"); // unc_add_option("sp_return_paren", UO_sp_return_paren, AT_IARF, // "Add or remove space between 'return' and '('"); // unc_add_option("sp_attribute_paren", UO_sp_attribute_paren, AT_IARF, // "Add or remove space between '__attribute__' and '('"); // unc_add_option("sp_defined_paren", UO_sp_defined_paren, AT_IARF, // "Add or remove space between 'defined' and '(' in '#if defined (FOO)'"); // unc_add_option("sp_macro", UO_sp_macro, AT_IARF, // "Add or remove space between macro and value"); // unc_add_option("sp_macro_func", UO_sp_macro_func, AT_IARF, // "Add or remove space between macro function ')' and value"); // unc_add_option("sp_before_dc", UO_sp_before_dc, AT_IARF, // "Add or remove space before the '::' operator"); // unc_add_option("sp_after_dc", UO_sp_after_dc, AT_IARF, // "Add or remove space after the '::' operator"); // unc_add_option("sp_d_array_colon", UO_sp_d_array_colon, AT_IARF, // "Add or remove around the D named array initializer ':' operator"); // unc_add_option("sp_not", UO_sp_not, AT_IARF, // "Add or remove space after the '!' (not) operator."); // unc_add_option("sp_inv", UO_sp_inv, AT_IARF, "Add or remove space after the '~' (invert) operator."); // unc_add_option("sp_addr", UO_sp_addr, AT_IARF, // "Add or remove space after the '&' (address-of) operator.\n" // "This does not affect the spacing after a '&' that is part of a type."); // unc_add_option("sp_member", UO_sp_member, AT_IARF, // "Add or remove space around the '.' or '->' operators\n"); // unc_add_option("sp_deref", UO_sp_deref, AT_IARF, // "Add or remove space after the '*' (dereference) operator.\n" // "This does not affect the spacing after a '*' that is part of a type."); // unc_add_option("sp_sign", UO_sp_sign, AT_IARF, // "Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'"); // unc_add_option("sp_incdec", UO_sp_incdec, AT_IARF, // "Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'"); // // unc_add_option("sp_before_nl_cont", UO_sp_before_nl_cont, AT_IARF, // "Add or remove space before a backslash-newline at the end of a line"); // // unc_add_option("sp_after_oc_scope", UO_sp_after_oc_scope, AT_IARF, // "Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;'"); // unc_add_option("sp_before_oc_colon", UO_sp_before_oc_colon, AT_IARF, // "Add or remove space after the colon in message specs\n" // "'-(int) f: (int) x;' vs '+(int) f : (int) x;'"); // unc_add_option("sp_after_oc_type", UO_sp_after_oc_type, AT_IARF, // "Add or remove space after the (type) in message specs\n" // "'-(int) f: (int) x;' vs '+(int)f : (int)x;'"); // // unc_add_option("sp_cond_colon", UO_sp_cond_colon, AT_IARF, // "Add or remove space around the ':' in 'b ? t : f'"); // unc_add_option("sp_cond_question", UO_sp_cond_question, AT_IARF, // "Add or remove space around the '?' in 'b ? t : f'"); /** * Call all the detect_xxxx() functions */ void detect_options() { detect_space_options(); } uncrustify-0.59/src/options.cpp0000644000175000017500000027314211632024563013604 00000000000000/** * @file options.cpp * Parses the options from the config file. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "args.h" #include "prototypes.h" #include "uncrustify_version.h" #include #ifdef HAVE_STRINGS_H #include /* strcasecmp() */ #endif #include #include #include #include "unc_ctype.h" static map option_name_map; static map group_map; static uncrustify_groups current_group; static void unc_add_option(const char *name, uncrustify_options id, argtype_e type, const char *short_desc = NULL, const char *long_desc = NULL, int min_val = 0, int max_val = 16); void unc_begin_group(uncrustify_groups id, const char *short_desc, const char *long_desc) { current_group = id; group_map_value value; value.id = id; value.short_desc = short_desc; value.long_desc = long_desc; group_map[id] = value; } void unc_add_option(const char *name, uncrustify_options id, argtype_e type, const char *short_desc, const char *long_desc, int min_val, int max_val) { group_map[current_group].options.push_back(id); option_map_value value; value.id = id; value.group_id = current_group; value.type = type; value.name = name; value.short_desc = short_desc; value.long_desc = long_desc; value.min_val = 0; /* Calculate the max/min values */ switch (type) { case AT_BOOL: value.max_val = 1; break; case AT_IARF: value.max_val = 3; break; case AT_NUM: value.min_val = min_val; value.max_val = max_val; break; case AT_LINE: value.max_val = 3; break; case AT_POS: value.max_val = 2; break; case AT_STRING: value.max_val = 0; break; default: fprintf(stderr, "FATAL: Illegal option type %d for '%s'\n", type, name); exit(EXIT_FAILURE); } option_name_map[name] = value; int name_len = strlen(name); if (name_len > cpd.max_option_name_len) { cpd.max_option_name_len = name_len; } } /* only compare alpha-numeric characters */ static bool match_text(const char *str1, const char *str2) { int matches = 0; while ((*str1 != 0) && (*str2 != 0)) { if (!unc_isalnum(*str1)) { str1++; continue; } if (!unc_isalnum(*str2)) { str2++; continue; } if (unc_tolower(*str1) != unc_tolower(*str2)) { return(false); } matches++; str1++; str2++; } return(matches && (*str1 == 0) && (*str2 == 0)); } const option_map_value *unc_find_option(const char *name) { if (option_name_map.find(name) == option_name_map.end()) { /* Try a more aggressive search */ for (option_name_map_it it = option_name_map.begin(); it != option_name_map.end(); it++) { if (match_text(it->second.name, name)) { return(&it->second); } } return(NULL); } return(&option_name_map[name]); } void register_options(void) { unc_begin_group(UG_general, "General options"); unc_add_option("newlines", UO_newlines, AT_LINE, "The type of line endings"); unc_add_option("input_tab_size", UO_input_tab_size, AT_NUM, "The original size of tabs in the input", "", 1, 32); unc_add_option("output_tab_size", UO_output_tab_size, AT_NUM, "The size of tabs in the output (only used if align_with_tabs=true)", "", 1, 32); unc_add_option("string_escape_char", UO_string_escape_char, AT_NUM, "The ASCII value of the string escape char, usually 92 (\\) or 94 (^). (Pawn)", "", 0, 255); unc_add_option("string_escape_char2", UO_string_escape_char2, AT_NUM, "Alternate string escape char for Pawn. Only works right before the quote char.", "", 0, 255); unc_add_option("tok_split_gte", UO_tok_split_gte, AT_BOOL, "Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'.\n" "If true (default), 'assert(x<0 && y>=3)' will be broken.\n" "Improvements to template detection may make this option obsolete."); unc_add_option("utf8_bom", UO_utf8_bom, AT_IARF, "Control what to do with the UTF-8 BOM (recommed 'remove')"); unc_add_option("utf8_byte", UO_utf8_byte, AT_BOOL, "If the file only contains chars between 128 and 255 and is not UTF-8, then output as UTF-8"); unc_add_option("utf8_force", UO_utf8_force, AT_BOOL, "Force the output encoding to UTF-8"); unc_begin_group(UG_space, "Spacing options"); unc_add_option("sp_arith", UO_sp_arith, AT_IARF, "Add or remove space around arithmetic operator '+', '-', '/', '*', etc"); unc_add_option("sp_assign", UO_sp_assign, AT_IARF, "Add or remove space around assignment operator '=', '+=', etc"); unc_add_option("sp_assign_default", UO_sp_assign_default, AT_IARF, "Add or remove space around assignment operator '=' in a prototype"); unc_add_option("sp_before_assign", UO_sp_before_assign, AT_IARF, "Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign."); unc_add_option("sp_after_assign", UO_sp_after_assign, AT_IARF, "Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign."); unc_add_option("sp_enum_assign", UO_sp_enum_assign, AT_IARF, "Add or remove space around assignment '=' in enum"); unc_add_option("sp_enum_before_assign", UO_sp_enum_before_assign, AT_IARF, "Add or remove space before assignment '=' in enum. Overrides sp_enum_assign."); unc_add_option("sp_enum_after_assign", UO_sp_enum_after_assign, AT_IARF, "Add or remove space after assignment '=' in enum. Overrides sp_enum_assign."); unc_add_option("sp_pp_concat", UO_sp_pp_concat, AT_IARF, "Add or remove space around preprocessor '##' concatenation operator. Default=Add"); unc_add_option("sp_pp_stringify", UO_sp_pp_stringify, AT_IARF, "Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add"); unc_add_option("sp_bool", UO_sp_bool, AT_IARF, "Add or remove space around boolean operators '&&' and '||'"); unc_add_option("sp_compare", UO_sp_compare, AT_IARF, "Add or remove space around compare operator '<', '>', '==', etc"); unc_add_option("sp_inside_paren", UO_sp_inside_paren, AT_IARF, "Add or remove space inside '(' and ')'"); unc_add_option("sp_paren_paren", UO_sp_paren_paren, AT_IARF, "Add or remove space between nested parens"); unc_add_option("sp_balance_nested_parens", UO_sp_balance_nested_parens, AT_BOOL, "Whether to balance spaces inside nested parens"); unc_add_option("sp_paren_brace", UO_sp_paren_brace, AT_IARF, "Add or remove space between ')' and '{'"); unc_add_option("sp_before_ptr_star", UO_sp_before_ptr_star, AT_IARF, "Add or remove space before pointer star '*'"); unc_add_option("sp_before_unnamed_ptr_star", UO_sp_before_unnamed_ptr_star, AT_IARF, "Add or remove space before pointer star '*' that isn't followed by a variable name\n" "If set to 'ignore', sp_before_ptr_star is used instead."); unc_add_option("sp_between_ptr_star", UO_sp_between_ptr_star, AT_IARF, "Add or remove space between pointer stars '*'"); unc_add_option("sp_after_ptr_star", UO_sp_after_ptr_star, AT_IARF, "Add or remove space after pointer star '*', if followed by a word."); unc_add_option("sp_after_ptr_star_func", UO_sp_after_ptr_star_func, AT_IARF, "Add or remove space after a pointer star '*', if followed by a func proto/def."); unc_add_option("sp_before_ptr_star_func", UO_sp_before_ptr_star_func, AT_IARF, "Add or remove space before a pointer star '*', if followed by a func proto/def."); unc_add_option("sp_before_byref", UO_sp_before_byref, AT_IARF, "Add or remove space before a reference sign '&'"); unc_add_option("sp_before_unnamed_byref", UO_sp_before_unnamed_byref, AT_IARF, "Add or remove space before a reference sign '&' that isn't followed by a variable name\n" "If set to 'ignore', sp_before_byref is used instead."); unc_add_option("sp_after_byref", UO_sp_after_byref, AT_IARF, "Add or remove space after reference sign '&', if followed by a word."); unc_add_option("sp_after_byref_func", UO_sp_after_byref_func, AT_IARF, "Add or remove space after a reference sign '&', if followed by a func proto/def."); unc_add_option("sp_before_byref_func", UO_sp_before_byref_func, AT_IARF, "Add or remove space before a reference sign '&', if followed by a func proto/def."); unc_add_option("sp_after_type", UO_sp_after_type, AT_IARF, "Add or remove space between type and word. Default=Force"); unc_add_option("sp_template_angle", UO_sp_template_angle, AT_IARF, "Add or remove space in 'template <' vs 'template<'.\n" "If set to ignore, sp_before_angle is used."); unc_add_option("sp_before_angle", UO_sp_before_angle, AT_IARF, "Add or remove space before '<>'"); unc_add_option("sp_inside_angle", UO_sp_inside_angle, AT_IARF, "Add or remove space inside '<' and '>'"); unc_add_option("sp_after_angle", UO_sp_after_angle, AT_IARF, "Add or remove space after '<>'"); unc_add_option("sp_angle_paren", UO_sp_angle_paren, AT_IARF, "Add or remove space between '<>' and '(' as found in 'new List();'"); unc_add_option("sp_angle_word", UO_sp_angle_word, AT_IARF, "Add or remove space between '<>' and a word as in 'List m;'"); unc_add_option("sp_angle_shift", UO_sp_angle_shift, AT_IARF, "Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add"); unc_add_option("sp_before_sparen", UO_sp_before_sparen, AT_IARF, "Add or remove space before '(' of 'if', 'for', 'switch', and 'while'"); unc_add_option("sp_inside_sparen", UO_sp_inside_sparen, AT_IARF, "Add or remove space inside if-condition '(' and ')'"); unc_add_option("sp_inside_sparen_close", UO_sp_inside_sparen_close, AT_IARF, "Add or remove space before if-condition ')'. Overrides sp_inside_sparen."); unc_add_option("sp_after_sparen", UO_sp_after_sparen, AT_IARF, "Add or remove space after ')' of 'if', 'for', 'switch', and 'while'"); unc_add_option("sp_sparen_brace", UO_sp_sparen_brace, AT_IARF, "Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while'"); unc_add_option("sp_invariant_paren", UO_sp_invariant_paren, AT_IARF, "Add or remove space between 'invariant' and '(' in the D language."); unc_add_option("sp_after_invariant_paren", UO_sp_after_invariant_paren, AT_IARF, "Add or remove space after the ')' in 'invariant (C) c' in the D language."); unc_add_option("sp_special_semi", UO_sp_special_semi, AT_IARF, "Add or remove space before empty statement ';' on 'if', 'for' and 'while'"); unc_add_option("sp_before_semi", UO_sp_before_semi, AT_IARF, "Add or remove space before ';'. Default=Remove"); unc_add_option("sp_before_semi_for", UO_sp_before_semi_for, AT_IARF, "Add or remove space before ';' in non-empty 'for' statements"); unc_add_option("sp_before_semi_for_empty", UO_sp_before_semi_for_empty, AT_IARF, "Add or remove space before a semicolon of an empty part of a for statement."); unc_add_option("sp_after_semi", UO_sp_after_semi, AT_IARF, "Add or remove space after ';', except when followed by a comment. Default=Add"); unc_add_option("sp_after_semi_for", UO_sp_after_semi_for, AT_IARF, "Add or remove space after ';' in non-empty 'for' statements. Default=Force"); unc_add_option("sp_after_semi_for_empty", UO_sp_after_semi_for_empty, AT_IARF, "Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; )."); unc_add_option("sp_before_square", UO_sp_before_square, AT_IARF, "Add or remove space before '[' (except '[]')"); unc_add_option("sp_before_squares", UO_sp_before_squares, AT_IARF, "Add or remove space before '[]'"); unc_add_option("sp_inside_square", UO_sp_inside_square, AT_IARF, "Add or remove space inside a non-empty '[' and ']'"); unc_add_option("sp_after_comma", UO_sp_after_comma, AT_IARF, "Add or remove space after ','"); unc_add_option("sp_before_comma", UO_sp_before_comma, AT_IARF, "Add or remove space before ','"); unc_add_option("sp_paren_comma", UO_sp_paren_comma, AT_IARF, "Add or remove space between an open paren and comma: '(,' vs '( ,'\n"); unc_add_option("sp_before_ellipsis", UO_sp_before_ellipsis, AT_IARF, "Add or remove space before the variadic '...' when preceded by a non-punctuator"); unc_add_option("sp_after_class_colon", UO_sp_after_class_colon, AT_IARF, "Add or remove space after class ':'"); unc_add_option("sp_before_class_colon", UO_sp_before_class_colon, AT_IARF, "Add or remove space before class ':'"); unc_add_option("sp_before_case_colon", UO_sp_before_case_colon, AT_IARF, "Add or remove space before case ':'. Default=Remove"); unc_add_option("sp_after_operator", UO_sp_after_operator, AT_IARF, "Add or remove space between 'operator' and operator sign"); unc_add_option("sp_after_operator_sym", UO_sp_after_operator_sym, AT_IARF, "Add or remove space between the operator symbol and the open paren, as in 'operator ++('"); unc_add_option("sp_after_cast", UO_sp_after_cast, AT_IARF, "Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'"); unc_add_option("sp_inside_paren_cast", UO_sp_inside_paren_cast, AT_IARF, "Add or remove spaces inside cast parens"); unc_add_option("sp_cpp_cast_paren", UO_sp_cpp_cast_paren, AT_IARF, "Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)'"); unc_add_option("sp_sizeof_paren", UO_sp_sizeof_paren, AT_IARF, "Add or remove space between 'sizeof' and '('"); unc_add_option("sp_after_tag", UO_sp_after_tag, AT_IARF, "Add or remove space after the tag keyword (Pawn)"); unc_add_option("sp_inside_braces_enum", UO_sp_inside_braces_enum, AT_IARF, "Add or remove space inside enum '{' and '}'"); unc_add_option("sp_inside_braces_struct", UO_sp_inside_braces_struct, AT_IARF, "Add or remove space inside struct/union '{' and '}'"); unc_add_option("sp_inside_braces", UO_sp_inside_braces, AT_IARF, "Add or remove space inside '{' and '}'"); unc_add_option("sp_inside_braces_empty", UO_sp_inside_braces_empty, AT_IARF, "Add or remove space inside '{}'"); unc_add_option("sp_type_func", UO_sp_type_func, AT_IARF, "Add or remove space between return type and function name\n" "A minimum of 1 is forced except for pointer return types."); unc_add_option("sp_func_proto_paren", UO_sp_func_proto_paren, AT_IARF, "Add or remove space between function name and '(' on function declaration"); unc_add_option("sp_func_def_paren", UO_sp_func_def_paren, AT_IARF, "Add or remove space between function name and '(' on function definition"); unc_add_option("sp_inside_fparens", UO_sp_inside_fparens, AT_IARF, "Add or remove space inside empty function '()'"); unc_add_option("sp_inside_fparen", UO_sp_inside_fparen, AT_IARF, "Add or remove space inside function '(' and ')'"); unc_add_option("sp_square_fparen", UO_sp_square_fparen, AT_IARF, "Add or remove space between ']' and '(' when part of a function call."); unc_add_option("sp_fparen_brace", UO_sp_fparen_brace, AT_IARF, "Add or remove space between ')' and '{' of function"); unc_add_option("sp_func_call_paren", UO_sp_func_call_paren, AT_IARF, "Add or remove space between function name and '(' on function calls"); unc_add_option("sp_func_call_paren_empty", UO_sp_func_call_paren_empty, AT_IARF, "Add or remove space between function name and '()' on function calls without parameters.\n" "If set to 'ignore' (the default), sp_func_call_paren is used."); unc_add_option("sp_func_call_user_paren", UO_sp_func_call_user_paren, AT_IARF, "Add or remove space between the user function name and '(' on function calls\n" "You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file."); unc_add_option("sp_func_class_paren", UO_sp_func_class_paren, AT_IARF, "Add or remove space between a constructor/destructor and the open paren"); unc_add_option("sp_return_paren", UO_sp_return_paren, AT_IARF, "Add or remove space between 'return' and '('"); unc_add_option("sp_attribute_paren", UO_sp_attribute_paren, AT_IARF, "Add or remove space between '__attribute__' and '('"); unc_add_option("sp_defined_paren", UO_sp_defined_paren, AT_IARF, "Add or remove space between 'defined' and '(' in '#if defined (FOO)'"); unc_add_option("sp_throw_paren", UO_sp_throw_paren, AT_IARF, "Add or remove space between 'throw' and '(' in 'throw (something)'"); unc_add_option("sp_catch_paren", UO_sp_catch_paren, AT_IARF, "Add or remove space between 'catch' and '(' in 'catch (something) { }'\n" "If set to ignore, sp_before_sparen is used."); unc_add_option("sp_version_paren", UO_sp_version_paren, AT_IARF, "Add or remove space between 'version' and '(' in 'version (something) { }' (D language)\n" "If set to ignore, sp_before_sparen is used."); unc_add_option("sp_scope_paren", UO_sp_scope_paren, AT_IARF, "Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language)\n" "If set to ignore, sp_before_sparen is used."); unc_add_option("sp_macro", UO_sp_macro, AT_IARF, "Add or remove space between macro and value"); unc_add_option("sp_macro_func", UO_sp_macro_func, AT_IARF, "Add or remove space between macro function ')' and value"); unc_add_option("sp_else_brace", UO_sp_else_brace, AT_IARF, "Add or remove space between 'else' and '{' if on the same line"); unc_add_option("sp_brace_else", UO_sp_brace_else, AT_IARF, "Add or remove space between '}' and 'else' if on the same line"); unc_add_option("sp_brace_typedef", UO_sp_brace_typedef, AT_IARF, "Add or remove space between '}' and the name of a typedef on the same line"); unc_add_option("sp_catch_brace", UO_sp_catch_brace, AT_IARF, "Add or remove space between 'catch' and '{' if on the same line"); unc_add_option("sp_brace_catch", UO_sp_brace_catch, AT_IARF, "Add or remove space between '}' and 'catch' if on the same line"); unc_add_option("sp_finally_brace", UO_sp_finally_brace, AT_IARF, "Add or remove space between 'finally' and '{' if on the same line"); unc_add_option("sp_brace_finally", UO_sp_brace_finally, AT_IARF, "Add or remove space between '}' and 'finally' if on the same line"); unc_add_option("sp_try_brace", UO_sp_try_brace, AT_IARF, "Add or remove space between 'try' and '{' if on the same line"); unc_add_option("sp_getset_brace", UO_sp_getset_brace, AT_IARF, "Add or remove space between get/set and '{' if on the same line"); unc_add_option("sp_before_dc", UO_sp_before_dc, AT_IARF, "Add or remove space before the '::' operator"); unc_add_option("sp_after_dc", UO_sp_after_dc, AT_IARF, "Add or remove space after the '::' operator"); unc_add_option("sp_d_array_colon", UO_sp_d_array_colon, AT_IARF, "Add or remove around the D named array initializer ':' operator"); unc_add_option("sp_not", UO_sp_not, AT_IARF, "Add or remove space after the '!' (not) operator. Default=Remove"); unc_add_option("sp_inv", UO_sp_inv, AT_IARF, "Add or remove space after the '~' (invert) operator. Default=Remove"); unc_add_option("sp_addr", UO_sp_addr, AT_IARF, "Add or remove space after the '&' (address-of) operator. Default=Remove\n" "This does not affect the spacing after a '&' that is part of a type."); unc_add_option("sp_member", UO_sp_member, AT_IARF, "Add or remove space around the '.' or '->' operators. Default=Remove"); unc_add_option("sp_deref", UO_sp_deref, AT_IARF, "Add or remove space after the '*' (dereference) operator. Default=Remove\n" "This does not affect the spacing after a '*' that is part of a type."); unc_add_option("sp_sign", UO_sp_sign, AT_IARF, "Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove"); unc_add_option("sp_incdec", UO_sp_incdec, AT_IARF, "Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove"); unc_add_option("sp_before_nl_cont", UO_sp_before_nl_cont, AT_IARF, "Add or remove space before a backslash-newline at the end of a line. Default=Add"); unc_add_option("sp_after_oc_scope", UO_sp_after_oc_scope, AT_IARF, "Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;'"); unc_add_option("sp_after_oc_colon", UO_sp_after_oc_colon, AT_IARF, "Add or remove space after the colon in message specs\n" "'-(int) f:(int) x;' vs '-(int) f: (int) x;'"); unc_add_option("sp_before_oc_colon", UO_sp_before_oc_colon, AT_IARF, "Add or remove space before the colon in message specs\n" "'-(int) f: (int) x;' vs '-(int) f : (int) x;'"); unc_add_option("sp_after_send_oc_colon", UO_sp_after_send_oc_colon, AT_IARF, "Add or remove space after the colon in message specs\n" "'[object setValue:1];' vs '[object setValue: 1];'"); unc_add_option("sp_before_send_oc_colon", UO_sp_before_send_oc_colon, AT_IARF, "Add or remove space before the colon in message specs\n" "'[object setValue:1];' vs '[object setValue :1];'"); unc_add_option("sp_after_oc_type", UO_sp_after_oc_type, AT_IARF, "Add or remove space after the (type) in message specs\n" "'-(int)f: (int) x;' vs '-(int)f: (int)x;'"); unc_add_option("sp_after_oc_return_type", UO_sp_after_oc_return_type, AT_IARF, "Add or remove space after the first (type) in message specs\n" "'-(int) f:(int)x;' vs '-(int)f:(int)x;'"); unc_add_option("sp_after_oc_at_sel", UO_sp_after_oc_at_sel, AT_IARF, "Add or remove space between '@selector' and '('\n" "'@selector(msgName)' vs '@selector (msgName)'\n" "Also applies to @protocol() constructs"); unc_add_option("sp_after_oc_at_sel_parens", UO_sp_after_oc_at_sel_parens, AT_IARF, "Add or remove space between '@selector(x)' and the following word\n" "'@selector(foo) a:' vs '@selector(foo)a:'"); unc_add_option("sp_inside_oc_at_sel_parens", UO_sp_inside_oc_at_sel_parens, AT_IARF, "Add or remove space inside '@selector' parens\n" "'@selector(foo)' vs '@selector( foo )'\n" "Also applies to @protocol() constructs"); unc_add_option("sp_before_oc_block_caret", UO_sp_before_oc_block_caret, AT_IARF, "Add or remove space before a block pointer caret\n" "'^int (int arg){...}' vs. ' ^int (int arg){...}'"); unc_add_option("sp_after_oc_block_caret", UO_sp_after_oc_block_caret, AT_IARF, "Add or remove space after a block pointer caret\n" "'^int (int arg){...}' vs. '^ int (int arg){...}'"); unc_add_option("sp_cond_colon", UO_sp_cond_colon, AT_IARF, "Add or remove space around the ':' in 'b ? t : f'"); unc_add_option("sp_cond_question", UO_sp_cond_question, AT_IARF, "Add or remove space around the '?' in 'b ? t : f'"); unc_add_option("sp_case_label", UO_sp_case_label, AT_IARF, "Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here."); unc_add_option("sp_range", UO_sp_range, AT_IARF, "Control the space around the D '..' operator."); unc_add_option("sp_cmt_cpp_start", UO_sp_cmt_cpp_start, AT_IARF, "Control the space after the opening of a C++ comment '// A' vs '//A'"); unc_add_option("sp_endif_cmt", UO_sp_endif_cmt, AT_IARF, "Controls the spaces between #else or #endif and a trailing comment"); unc_add_option("sp_after_new", UO_sp_after_new, AT_IARF, "Controls the spaces after 'new', 'delete', and 'delete[]'"); unc_add_option("sp_before_tr_emb_cmt", UO_sp_before_tr_emb_cmt, AT_IARF, "Controls the spaces before a trailing or embedded comment"); unc_add_option("sp_num_before_tr_emb_cmt", UO_sp_num_before_tr_emb_cmt, AT_NUM, "Number of spaces before a trailing or embedded comment"); unc_begin_group(UG_indent, "Indenting"); unc_add_option("indent_columns", UO_indent_columns, AT_NUM, "The number of columns to indent per level.\n" "Usually 2, 3, 4, or 8."); unc_add_option("indent_continue", UO_indent_continue, AT_NUM, "The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents.\n" "For FreeBSD, this is set to 4."); unc_add_option("indent_with_tabs", UO_indent_with_tabs, AT_NUM, "How to use tabs when indenting code\n" "0=spaces only\n" "1=indent with tabs to brace level, align with spaces\n" "2=indent and align with tabs, using spaces when not on a tabstop", "", 0, 2); unc_add_option("indent_cmt_with_tabs", UO_indent_cmt_with_tabs, AT_BOOL, "Comments that are not a brace level are indented with tabs on a tabstop.\n" "Requires indent_with_tabs=2. If false, will use spaces."); unc_add_option("indent_align_string", UO_indent_align_string, AT_BOOL, "Whether to indent strings broken by '\\' so that they line up"); unc_add_option("indent_xml_string", UO_indent_xml_string, AT_NUM, "The number of spaces to indent multi-line XML strings.\n" "Requires indent_align_string=True"); unc_add_option("indent_brace", UO_indent_brace, AT_NUM, "Spaces to indent '{' from level"); unc_add_option("indent_braces", UO_indent_braces, AT_BOOL, "Whether braces are indented to the body level"); unc_add_option("indent_braces_no_func", UO_indent_braces_no_func, AT_BOOL, "Disabled indenting function braces if indent_braces is true"); unc_add_option("indent_braces_no_class", UO_indent_braces_no_class, AT_BOOL, "Disabled indenting class braces if indent_braces is true"); unc_add_option("indent_braces_no_struct", UO_indent_braces_no_struct, AT_BOOL, "Disabled indenting struct braces if indent_braces is true"); unc_add_option("indent_brace_parent", UO_indent_brace_parent, AT_BOOL, "Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc."); unc_add_option("indent_namespace", UO_indent_namespace, AT_BOOL, "Whether the 'namespace' body is indented"); unc_add_option("indent_namespace_level", UO_indent_namespace_level, AT_NUM, "The number of spaces to indent a namespace block"); unc_add_option("indent_namespace_limit", UO_indent_namespace_limit, AT_NUM, "If the body of the namespace is longer than this number, it won't be indented.\n" "Requires indent_namespace=true. Default=0 (no limit)", NULL, 0, 255); unc_add_option("indent_extern", UO_indent_extern, AT_BOOL, "Whether the 'extern \"C\"' body is indented"); unc_add_option("indent_class", UO_indent_class, AT_BOOL, "Whether the 'class' body is indented"); unc_add_option("indent_class_colon", UO_indent_class_colon, AT_BOOL, "Whether to indent the stuff after a leading class colon"); unc_add_option("indent_ctor_init", UO_indent_ctor_init, AT_NUM, "Additional indenting for constructor initializer list"); unc_add_option("indent_else_if", UO_indent_else_if, AT_BOOL, "False=treat 'else\\nif' as 'else if' for indenting purposes\n" "True=indent the 'if' one level\n"); unc_add_option("indent_var_def_blk", UO_indent_var_def_blk, AT_NUM, "Amount to indent variable declarations after a open brace. neg=relative, pos=absolute"); unc_add_option("indent_var_def_cont", UO_indent_var_def_cont, AT_BOOL, "Indent continued variable declarations instead of aligning."); unc_add_option("indent_func_call_param", UO_indent_func_call_param, AT_BOOL, "True: indent continued function call parameters one indent level\n" "False: align parameters under the open paren"); unc_add_option("indent_func_def_param", UO_indent_func_def_param, AT_BOOL, "Same as indent_func_call_param, but for function defs"); unc_add_option("indent_func_proto_param", UO_indent_func_proto_param, AT_BOOL, "Same as indent_func_call_param, but for function protos"); unc_add_option("indent_func_class_param", UO_indent_func_class_param, AT_BOOL, "Same as indent_func_call_param, but for class declarations"); unc_add_option("indent_func_ctor_var_param", UO_indent_func_ctor_var_param, AT_BOOL, "Same as indent_func_call_param, but for class variable constructors"); unc_add_option("indent_template_param", UO_indent_template_param, AT_BOOL, "Same as indent_func_call_param, but for templates"); unc_add_option("indent_func_param_double", UO_indent_func_param_double, AT_BOOL, "Double the indent for indent_func_xxx_param options"); unc_add_option("indent_func_const", UO_indent_func_const, AT_NUM, "Indentation column for standalone 'const' function decl/proto qualifier"); unc_add_option("indent_func_throw", UO_indent_func_throw, AT_NUM, "Indentation column for standalone 'throw' function decl/proto qualifier"); unc_add_option("indent_member", UO_indent_member, AT_NUM, "The number of spaces to indent a continued '->' or '.'\n" "Usually set to 0, 1, or indent_columns."); unc_add_option("indent_sing_line_comments", UO_indent_sing_line_comments, AT_NUM, "Spaces to indent single line ('//') comments on lines before code"); unc_add_option("indent_relative_single_line_comments", UO_indent_relative_single_line_comments, AT_BOOL, "If set, will indent trailing single line ('//') comments relative\n" "to the code instead of trying to keep the same absolute column"); unc_add_option("indent_switch_case", UO_indent_switch_case, AT_NUM, "Spaces to indent 'case' from 'switch'\n" "Usually 0 or indent_columns."); unc_add_option("indent_case_shift", UO_indent_case_shift, AT_NUM, "Spaces to shift the 'case' line, without affecting any other lines\n" "Usually 0."); unc_add_option("indent_case_brace", UO_indent_case_brace, AT_NUM, "Spaces to indent '{' from 'case'.\n" "By default, the brace will appear under the 'c' in case.\n" "Usually set to 0 or indent_columns."); unc_add_option("indent_col1_comment", UO_indent_col1_comment, AT_BOOL, "Whether to indent comments found in first column"); unc_add_option("indent_label", UO_indent_label, AT_NUM, "How to indent goto labels\n" " >0 : absolute column where 1 is the leftmost column\n" " <=0 : subtract from brace indent", "", -16, 16); unc_add_option("indent_access_spec", UO_indent_access_spec, AT_NUM, "Same as indent_label, but for access specifiers that are followed by a colon", "", -16, 16); unc_add_option("indent_access_spec_body", UO_indent_access_spec_body, AT_BOOL, "Indent the code after an access specifier by one level.\n" "If set, this option forces 'indent_access_spec=0'"); unc_add_option("indent_paren_nl", UO_indent_paren_nl, AT_BOOL, "If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended)"); unc_add_option("indent_paren_close", UO_indent_paren_close, AT_NUM, "Controls the indent of a close paren after a newline.\n" "0: Indent to body level\n" "1: Align under the open paren\n" "2: Indent to the brace level"); unc_add_option("indent_comma_paren", UO_indent_comma_paren, AT_BOOL, "Controls the indent of a comma when inside a paren." "If TRUE, aligns under the open paren"); unc_add_option("indent_bool_paren", UO_indent_bool_paren, AT_BOOL, "Controls the indent of a BOOL operator when inside a paren." "If TRUE, aligns under the open paren"); unc_add_option("indent_first_bool_expr", UO_indent_first_bool_expr, AT_BOOL, "If 'indent_bool_paren' is true, controls the indent of the first expression. " "If TRUE, aligns the first expression to the following ones"); unc_add_option("indent_square_nl", UO_indent_square_nl, AT_BOOL, "If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended)"); unc_add_option("indent_preserve_sql", UO_indent_preserve_sql, AT_BOOL, "Don't change the relative indent of ESQL/C 'EXEC SQL' bodies"); unc_add_option("indent_align_assign", UO_indent_align_assign, AT_BOOL, "Align continued statements at the '='. Default=True\n" "If FALSE or the '=' is followed by a newline, the next line is indent one tab."); unc_begin_group(UG_newline, "Newline adding and removing options"); unc_add_option("nl_collapse_empty_body", UO_nl_collapse_empty_body, AT_BOOL, "Whether to collapse empty blocks between '{' and '}'"); unc_add_option("nl_assign_leave_one_liners", UO_nl_assign_leave_one_liners, AT_BOOL, "Don't split one-line braced assignments - 'foo_t f = { 1, 2 };'"); unc_add_option("nl_class_leave_one_liners", UO_nl_class_leave_one_liners, AT_BOOL, "Don't split one-line braced statements inside a class xx { } body"); unc_add_option("nl_enum_leave_one_liners", UO_nl_enum_leave_one_liners, AT_BOOL, "Don't split one-line enums: 'enum foo { BAR = 15 };'"); unc_add_option("nl_getset_leave_one_liners", UO_nl_getset_leave_one_liners, AT_BOOL, "Don't split one-line get or set functions"); unc_add_option("nl_func_leave_one_liners", UO_nl_func_leave_one_liners, AT_BOOL, "Don't split one-line function definitions - 'int foo() { return 0; }'"); unc_add_option("nl_if_leave_one_liners", UO_nl_if_leave_one_liners, AT_BOOL, "Don't split one-line if/else statements - 'if(a) b++;'"); unc_add_option("nl_start_of_file", UO_nl_start_of_file, AT_IARF, "Add or remove newlines at the start of the file"); unc_add_option("nl_start_of_file_min", UO_nl_start_of_file_min, AT_NUM, "The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force'"); unc_add_option("nl_end_of_file", UO_nl_end_of_file, AT_IARF, "Add or remove newline at the end of the file"); unc_add_option("nl_end_of_file_min", UO_nl_end_of_file_min, AT_NUM, "The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force')"); unc_add_option("nl_assign_brace", UO_nl_assign_brace, AT_IARF, "Add or remove newline between '=' and '{'"); unc_add_option("nl_assign_square", UO_nl_assign_square, AT_IARF, "Add or remove newline between '=' and '[' (D only)"); unc_add_option("nl_after_square_assign", UO_nl_after_square_assign, AT_IARF, "Add or remove newline after '= [' (D only). Will also affect the newline before the ']'"); unc_add_option("nl_func_var_def_blk", UO_nl_func_var_def_blk, AT_NUM, "The number of blank lines after a block of variable definitions at the top of a function body.\n" "0=no change (default)"); unc_add_option("nl_fcall_brace", UO_nl_fcall_brace, AT_IARF, "Add or remove newline between a function call's ')' and '{', as in:\n" "list_for_each(item, &list) { }"); unc_add_option("nl_enum_brace", UO_nl_enum_brace, AT_IARF, "Add or remove newline between 'enum' and '{'"); unc_add_option("nl_struct_brace", UO_nl_struct_brace, AT_IARF, "Add or remove newline between 'struct and '{'"); unc_add_option("nl_union_brace", UO_nl_union_brace, AT_IARF, "Add or remove newline between 'union' and '{'"); unc_add_option("nl_if_brace", UO_nl_if_brace, AT_IARF, "Add or remove newline between 'if' and '{'"); unc_add_option("nl_brace_else", UO_nl_brace_else, AT_IARF, "Add or remove newline between '}' and 'else'"); unc_add_option("nl_elseif_brace", UO_nl_elseif_brace, AT_IARF, "Add or remove newline between 'else if' and '{'\n" "If set to ignore, nl_if_brace is used instead"); unc_add_option("nl_else_brace", UO_nl_else_brace, AT_IARF, "Add or remove newline between 'else' and '{'"); unc_add_option("nl_else_if", UO_nl_else_if, AT_IARF, "Add or remove newline between 'else' and 'if'"); unc_add_option("nl_brace_finally", UO_nl_brace_finally, AT_IARF, "Add or remove newline between '}' and 'finally'"); unc_add_option("nl_finally_brace", UO_nl_finally_brace, AT_IARF, "Add or remove newline between 'finally' and '{'"); unc_add_option("nl_try_brace", UO_nl_try_brace, AT_IARF, "Add or remove newline between 'try' and '{'"); unc_add_option("nl_getset_brace", UO_nl_getset_brace, AT_IARF, "Add or remove newline between get/set and '{'"); unc_add_option("nl_for_brace", UO_nl_for_brace, AT_IARF, "Add or remove newline between 'for' and '{'"); unc_add_option("nl_catch_brace", UO_nl_catch_brace, AT_IARF, "Add or remove newline between 'catch' and '{'"); unc_add_option("nl_brace_catch", UO_nl_brace_catch, AT_IARF, "Add or remove newline between '}' and 'catch'"); unc_add_option("nl_while_brace", UO_nl_while_brace, AT_IARF, "Add or remove newline between 'while' and '{'"); unc_add_option("nl_using_brace", UO_nl_using_brace, AT_IARF, "Add or remove newline between 'using' and '{'"); unc_add_option("nl_brace_brace", UO_nl_brace_brace, AT_IARF, "Add or remove newline between two open or close braces.\n" "Due to general newline/brace handling, REMOVE may not work."); unc_add_option("nl_do_brace", UO_nl_do_brace, AT_IARF, "Add or remove newline between 'do' and '{'"); unc_add_option("nl_brace_while", UO_nl_brace_while, AT_IARF, "Add or remove newline between '}' and 'while' of 'do' statement"); unc_add_option("nl_switch_brace", UO_nl_switch_brace, AT_IARF, "Add or remove newline between 'switch' and '{'"); unc_add_option("nl_multi_line_cond", UO_nl_multi_line_cond, AT_BOOL, "Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc.\n" "Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace."); unc_add_option("nl_multi_line_define", UO_nl_multi_line_define, AT_BOOL, "Force a newline in a define after the macro name for multi-line defines."); unc_add_option("nl_before_case", UO_nl_before_case, AT_BOOL, "Whether to put a newline before 'case' statement"); unc_add_option("nl_before_throw", UO_nl_before_throw, AT_IARF, "Add or remove newline between ')' and 'throw'"); unc_add_option("nl_after_case", UO_nl_after_case, AT_BOOL, "Whether to put a newline after 'case' statement"); unc_add_option("nl_case_colon_brace", UO_nl_case_colon_brace, AT_IARF, "Add or remove a newline between a case ':' and '{'. Overrides nl_after_case."); unc_add_option("nl_namespace_brace", UO_nl_namespace_brace, AT_IARF, "Newline between namespace and {"); unc_add_option("nl_template_class", UO_nl_template_class, AT_IARF, "Add or remove newline between 'template<>' and whatever follows."); unc_add_option("nl_class_brace", UO_nl_class_brace, AT_IARF, "Add or remove newline between 'class' and '{'"); unc_add_option("nl_class_init_args", UO_nl_class_init_args, AT_IARF, "Add or remove newline after each ',' in the constructor member initialization"); unc_add_option("nl_func_type_name", UO_nl_func_type_name, AT_IARF, "Add or remove newline between return type and function name in a function definition"); unc_add_option("nl_func_type_name_class", UO_nl_func_type_name_class, AT_IARF, "Add or remove newline between return type and function name inside a class {}\n" "Uses nl_func_type_name or nl_func_proto_type_name if set to ignore."); unc_add_option("nl_func_scope_name", UO_nl_func_scope_name, AT_IARF, "Add or remove newline between function scope and name in a definition\n" "Controls the newline after '::' in 'void A::f() { }'"); unc_add_option("nl_func_proto_type_name", UO_nl_func_proto_type_name, AT_IARF, "Add or remove newline between return type and function name in a prototype"); unc_add_option("nl_func_paren", UO_nl_func_paren, AT_IARF, "Add or remove newline between a function name and the opening '('"); unc_add_option("nl_func_def_paren", UO_nl_func_def_paren, AT_IARF, "Add or remove newline between a function name and the opening '(' in the definition"); unc_add_option("nl_func_decl_start", UO_nl_func_decl_start, AT_IARF, "Add or remove newline after '(' in a function declaration"); unc_add_option("nl_func_def_start", UO_nl_func_def_start, AT_IARF, "Add or remove newline after '(' in a function definition"); unc_add_option("nl_func_decl_start_single", UO_nl_func_decl_start_single, AT_IARF, "Overrides nl_func_decl_start when there is only one parameter."); unc_add_option("nl_func_def_start_single", UO_nl_func_def_start_single, AT_IARF, "Overrides nl_func_def_start when there is only one parameter."); unc_add_option("nl_func_decl_args", UO_nl_func_decl_args, AT_IARF, "Add or remove newline after each ',' in a function declaration"); unc_add_option("nl_func_def_args", UO_nl_func_def_args, AT_IARF, "Add or remove newline after each ',' in a function definition"); unc_add_option("nl_func_decl_end", UO_nl_func_decl_end, AT_IARF, "Add or remove newline before the ')' in a function declaration"); unc_add_option("nl_func_def_end", UO_nl_func_def_end, AT_IARF, "Add or remove newline before the ')' in a function definition"); unc_add_option("nl_func_decl_end_single", UO_nl_func_decl_end_single, AT_IARF, "Overrides nl_func_decl_end when there is only one parameter."); unc_add_option("nl_func_def_end_single", UO_nl_func_def_end_single, AT_IARF, "Overrides nl_func_def_end when there is only one parameter."); unc_add_option("nl_func_decl_empty", UO_nl_func_decl_empty, AT_IARF, "Add or remove newline between '()' in a function declaration."); unc_add_option("nl_func_def_empty", UO_nl_func_def_empty, AT_IARF, "Add or remove newline between '()' in a function definition."); unc_add_option("nl_fdef_brace", UO_nl_fdef_brace, AT_IARF, "Add or remove newline between function signature and '{'"); unc_add_option("nl_after_return", UO_nl_after_return, AT_BOOL, "Whether to put a newline after 'return' statement"); unc_add_option("nl_return_expr", UO_nl_return_expr, AT_IARF, "Add or remove a newline between the return keyword and return expression."); unc_add_option("nl_after_semicolon", UO_nl_after_semicolon, AT_BOOL, "Whether to put a newline after semicolons, except in 'for' statements"); unc_add_option("nl_after_brace_open", UO_nl_after_brace_open, AT_BOOL, "Whether to put a newline after brace open.\n" "This also adds a newline before the matching brace close."); unc_add_option("nl_after_brace_open_cmt", UO_nl_after_brace_open_cmt, AT_BOOL, "If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is\n" "placed between the open brace and a trailing single-line comment."); unc_add_option("nl_after_vbrace_open", UO_nl_after_vbrace_open, AT_BOOL, "Whether to put a newline after a virtual brace open with a non-empty body.\n" "These occur in un-braced if/while/do/for statement bodies."); unc_add_option("nl_after_vbrace_open_empty", UO_nl_after_vbrace_open_empty, AT_BOOL, "Whether to put a newline after a virtual brace open with an empty body.\n" "These occur in un-braced if/while/do/for statement bodies."); unc_add_option("nl_after_brace_close", UO_nl_after_brace_close, AT_BOOL, "Whether to put a newline after a brace close.\n" "Does not apply if followed by a necessary ';'."); unc_add_option("nl_after_vbrace_close", UO_nl_after_vbrace_close, AT_BOOL, "Whether to put a newline after a virtual brace close.\n" "Would add a newline before return in: 'if (foo) a++; return;'"); unc_add_option("nl_define_macro", UO_nl_define_macro, AT_BOOL, "Whether to alter newlines in '#define' macros"); unc_add_option("nl_squeeze_ifdef", UO_nl_squeeze_ifdef, AT_BOOL, "Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'"); unc_add_option("nl_before_if", UO_nl_before_if, AT_IARF, "Add or remove blank line before 'if'"); unc_add_option("nl_after_if", UO_nl_after_if, AT_IARF, "Add or remove blank line after 'if' statement"); unc_add_option("nl_before_for", UO_nl_before_for, AT_IARF, "Add or remove blank line before 'for'"); unc_add_option("nl_after_for", UO_nl_after_for, AT_IARF, "Add or remove blank line after 'for' statement"); unc_add_option("nl_before_while", UO_nl_before_while, AT_IARF, "Add or remove blank line before 'while'"); unc_add_option("nl_after_while", UO_nl_after_while, AT_IARF, "Add or remove blank line after 'while' statement"); unc_add_option("nl_before_switch", UO_nl_before_switch, AT_IARF, "Add or remove blank line before 'switch'"); unc_add_option("nl_after_switch", UO_nl_after_switch, AT_IARF, "Add or remove blank line after 'switch' statement"); unc_add_option("nl_before_do", UO_nl_before_do, AT_IARF, "Add or remove blank line before 'do'"); unc_add_option("nl_after_do", UO_nl_after_do, AT_IARF, "Add or remove blank line after 'do/while' statement"); unc_add_option("nl_ds_struct_enum_cmt", UO_nl_ds_struct_enum_cmt, AT_BOOL, "Whether to double-space commented-entries in struct/enum"); unc_add_option("nl_ds_struct_enum_close_brace", UO_nl_ds_struct_enum_close_brace, AT_BOOL, "Whether to double-space before the close brace of a struct/union/enum\n" "(lower priority than 'eat_blanks_before_close_brace')"); unc_add_option("nl_class_colon", UO_nl_class_colon, AT_IARF, "Add or remove a newline around a class colon.\n" "Related to pos_class_colon, nl_class_init_args, and pos_comma."); unc_add_option("nl_create_if_one_liner", UO_nl_create_if_one_liner, AT_BOOL, "Change simple unbraced if statements into a one-liner\n" "'if(b)\\n i++;' => 'if(b) i++;'"); unc_add_option("nl_create_for_one_liner", UO_nl_create_for_one_liner, AT_BOOL, "Change simple unbraced for statements into a one-liner\n" "'for (i=0;i<5;i++)\\n foo(i);' => 'for (i=0;i<5;i++) foo(i);'"); unc_add_option("nl_create_while_one_liner", UO_nl_create_while_one_liner, AT_BOOL, "Change simple unbraced while statements into a one-liner\n" "'while (i<5)\\n foo(i++);' => 'while (i<5) foo(i++);'"); unc_begin_group(UG_blankline, "Blank line options", "Note that it takes 2 newlines to get a blank line"); unc_add_option("nl_max", UO_nl_max, AT_NUM, "The maximum consecutive newlines"); unc_add_option("nl_after_func_proto", UO_nl_after_func_proto, AT_NUM, "The number of newlines after a function prototype, if followed by another function prototype"); unc_add_option("nl_after_func_proto_group", UO_nl_after_func_proto_group, AT_NUM, "The number of newlines after a function prototype, if not followed by another function prototype"); unc_add_option("nl_after_func_body", UO_nl_after_func_body, AT_NUM, "The number of newlines after '}' of a multi-line function body"); unc_add_option("nl_after_func_body_class", UO_nl_after_func_body_class, AT_NUM, "The number of newlines after '}' of a multi-line function body in a class declaration"); unc_add_option("nl_after_func_body_one_liner", UO_nl_after_func_body_one_liner, AT_NUM, "The number of newlines after '}' of a single line function body"); unc_add_option("nl_before_block_comment", UO_nl_before_block_comment, AT_NUM, "The minimum number of newlines before a multi-line comment.\n" "Doesn't apply if after a brace open or another multi-line comment."); unc_add_option("nl_before_c_comment", UO_nl_before_c_comment, AT_NUM, "The minimum number of newlines before a single-line C comment.\n" "Doesn't apply if after a brace open or other single-line C comments."); unc_add_option("nl_before_cpp_comment", UO_nl_before_cpp_comment, AT_NUM, "The minimum number of newlines before a CPP comment.\n" "Doesn't apply if after a brace open or other CPP comments."); unc_add_option("nl_after_multiline_comment", UO_nl_after_multiline_comment, AT_BOOL, "Whether to force a newline after a multi-line comment."); unc_add_option("nl_after_struct", UO_nl_after_struct, AT_NUM, "The number of newlines after '}' or ';' of a struct/enum/union definition"); unc_add_option("nl_after_class", UO_nl_after_class, AT_NUM, "The number of newlines after '}' or ';' of a class definition"); unc_add_option("nl_before_access_spec", UO_nl_before_access_spec, AT_NUM, "The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.\n" "Will not change the newline count if after a brace open.\n" "0 = No change."); unc_add_option("nl_after_access_spec", UO_nl_after_access_spec, AT_NUM, "The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.\n" "0 = No change."); unc_add_option("nl_comment_func_def", UO_nl_comment_func_def, AT_NUM, "The number of newlines between a function def and the function comment.\n" "0 = No change."); unc_add_option("nl_after_try_catch_finally", UO_nl_after_try_catch_finally, AT_NUM, "The number of newlines after a try-catch-finally block that isn't followed by a brace close.\n" "0 = No change."); unc_add_option("nl_around_cs_property", UO_nl_around_cs_property, AT_NUM, "The number of newlines before and after a property, indexer or event decl.\n" "0 = No change."); unc_add_option("nl_between_get_set", UO_nl_between_get_set, AT_NUM, "The number of newlines between the get/set/add/remove handlers in C#.\n" "0 = No change."); unc_add_option("nl_property_brace", UO_nl_property_brace, AT_IARF, "Add or remove newline between C# property and the '{'"); unc_add_option("eat_blanks_after_open_brace", UO_eat_blanks_after_open_brace, AT_BOOL, "Whether to remove blank lines after '{'"); unc_add_option("eat_blanks_before_close_brace", UO_eat_blanks_before_close_brace, AT_BOOL, "Whether to remove blank lines before '}'"); unc_begin_group(UG_position, "Positioning options"); unc_add_option("pos_arith", UO_pos_arith, AT_POS, "The position of arithmetic operators in wrapped expressions"); unc_add_option("pos_assign", UO_pos_assign, AT_POS, "The position of assignment in wrapped expressions.\n" "Do not affect '=' followed by '{'"); unc_add_option("pos_bool", UO_pos_bool, AT_POS, "The position of boolean operators in wrapped expressions"); unc_add_option("pos_compare", UO_pos_compare, AT_POS, "The position of comparison operators in wrapped expressions"); unc_add_option("pos_conditional", UO_pos_conditional, AT_POS, "The position of conditional (b ? t : f) operators in wrapped expressions"); unc_add_option("pos_comma", UO_pos_comma, AT_POS, "The position of the comma in wrapped expressions"); unc_add_option("pos_class_comma", UO_pos_class_comma, AT_POS, "The position of the comma in the constructor initialization list"); unc_add_option("pos_class_colon", UO_pos_class_colon, AT_POS, "The position of colons between constructor and member initialization"); unc_begin_group(UG_linesplit, "Line Splitting options"); unc_add_option("code_width", UO_code_width, AT_NUM, "Try to limit code width to N number of columns", "", 16, 256); unc_add_option("ls_for_split_full", UO_ls_for_split_full, AT_BOOL, "Whether to fully split long 'for' statements at semi-colons"); unc_add_option("ls_func_split_full", UO_ls_func_split_full, AT_BOOL, "Whether to fully split long function protos/calls at commas"); unc_begin_group(UG_align, "Code alignment (not left column spaces/tabs)"); unc_add_option("align_keep_tabs", UO_align_keep_tabs, AT_BOOL, "Whether to keep non-indenting tabs"); unc_add_option("align_with_tabs", UO_align_with_tabs, AT_BOOL, "Whether to use tabs for aligning"); unc_add_option("align_on_tabstop", UO_align_on_tabstop, AT_BOOL, "Whether to bump out to the next tab when aligning"); unc_add_option("align_number_left", UO_align_number_left, AT_BOOL, "Whether to left-align numbers"); unc_add_option("align_func_params", UO_align_func_params, AT_BOOL, "Align variable definitions in prototypes and functions"); unc_add_option("align_same_func_call_params", UO_align_same_func_call_params, AT_BOOL, "Align parameters in single-line functions that have the same name.\n" "The function names must already be aligned with each other."); unc_add_option("align_var_def_span", UO_align_var_def_span, AT_NUM, "The span for aligning variable definitions (0=don't align)", "", 0, 5000); unc_add_option("align_var_def_star_style", UO_align_var_def_star_style, AT_NUM, "How to align the star in variable definitions.\n" " 0=Part of the type 'void * foo;'\n" " 1=Part of the variable 'void *foo;'\n" " 2=Dangling 'void *foo;'", "", 0, 2); unc_add_option("align_var_def_amp_style", UO_align_var_def_amp_style, AT_NUM, "How to align the '&' in variable definitions.\n" " 0=Part of the type\n" " 1=Part of the variable\n" " 2=Dangling", "", 0, 2); unc_add_option("align_var_def_thresh", UO_align_var_def_thresh, AT_NUM, "The threshold for aligning variable definitions (0=no limit)", "", 0, 5000); unc_add_option("align_var_def_gap", UO_align_var_def_gap, AT_NUM, "The gap for aligning variable definitions"); unc_add_option("align_var_def_colon", UO_align_var_def_colon, AT_BOOL, "Whether to align the colon in struct bit fields"); unc_add_option("align_var_def_attribute", UO_align_var_def_attribute, AT_BOOL, "Whether to align any attribute after the variable name"); unc_add_option("align_var_def_inline", UO_align_var_def_inline, AT_BOOL, "Whether to align inline struct/enum/union variable definitions"); unc_add_option("align_assign_span", UO_align_assign_span, AT_NUM, "The span for aligning on '=' in assignments (0=don't align)", "", 0, 5000); unc_add_option("align_assign_thresh", UO_align_assign_thresh, AT_NUM, "The threshold for aligning on '=' in assignments (0=no limit)", "", 0, 5000); unc_add_option("align_enum_equ_span", UO_align_enum_equ_span, AT_NUM, "The span for aligning on '=' in enums (0=don't align)", "", 0, 5000); unc_add_option("align_enum_equ_thresh", UO_align_enum_equ_thresh, AT_NUM, "The threshold for aligning on '=' in enums (0=no limit)", "", 0, 5000); unc_add_option("align_var_struct_span", UO_align_var_struct_span, AT_NUM, "The span for aligning struct/union (0=don't align)", "", 0, 5000); unc_add_option("align_var_struct_thresh", UO_align_var_struct_thresh, AT_NUM, "The threshold for aligning struct/union member definitions (0=no limit)", "", 0, 5000); unc_add_option("align_var_struct_gap", UO_align_var_struct_gap, AT_NUM, "The gap for aligning struct/union member definitions"); unc_add_option("align_struct_init_span", UO_align_struct_init_span, AT_NUM, "The span for aligning struct initializer values (0=don't align)", "", 0, 5000); unc_add_option("align_typedef_gap", UO_align_typedef_gap, AT_NUM, "The minimum space between the type and the synonym of a typedef"); unc_add_option("align_typedef_span", UO_align_typedef_span, AT_NUM, "The span for aligning single-line typedefs (0=don't align)"); unc_add_option("align_typedef_func", UO_align_typedef_func, AT_NUM, "How to align typedef'd functions with other typedefs\n" "0: Don't mix them at all\n" "1: align the open paren with the types\n" "2: align the function type name with the other type names"); unc_add_option("align_typedef_star_style", UO_align_typedef_star_style, AT_NUM, "Controls the positioning of the '*' in typedefs. Just try it.\n" "0: Align on typedef type, ignore '*'\n" "1: The '*' is part of type name: typedef int *pint;\n" "2: The '*' is part of the type, but dangling: typedef int *pint;", "", 0, 2); unc_add_option("align_typedef_amp_style", UO_align_typedef_amp_style, AT_NUM, "Controls the positioning of the '&' in typedefs. Just try it.\n" "0: Align on typedef type, ignore '&'\n" "1: The '&' is part of type name: typedef int &pint;\n" "2: The '&' is part of the type, but dangling: typedef int &pint;", "", 0, 2); unc_add_option("align_right_cmt_span", UO_align_right_cmt_span, AT_NUM, "The span for aligning comments that end lines (0=don't align)", "", 0, 5000); unc_add_option("align_right_cmt_mix", UO_align_right_cmt_mix, AT_BOOL, "If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment"); unc_add_option("align_right_cmt_gap", UO_align_right_cmt_gap, AT_NUM, "If a trailing comment is more than this number of columns away from the text it follows,\n" "it will qualify for being aligned. This has to be > 0 to do anything."); unc_add_option("align_right_cmt_at_col", UO_align_right_cmt_at_col, AT_NUM, "Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore)", "", 0, 200); unc_add_option("align_func_proto_span", UO_align_func_proto_span, AT_NUM, "The span for aligning function prototypes (0=don't align)", "", 0, 5000); unc_add_option("align_func_proto_gap", UO_align_func_proto_gap, AT_NUM, "Minimum gap between the return type and the function name."); unc_add_option("align_on_operator", UO_align_on_operator, AT_BOOL, "Align function protos on the 'operator' keyword instead of what follows"); unc_add_option("align_mix_var_proto", UO_align_mix_var_proto, AT_BOOL, "Whether to mix aligning prototype and variable declarations.\n" "If true, align_var_def_XXX options are used instead of align_func_proto_XXX options."); unc_add_option("align_single_line_func", UO_align_single_line_func, AT_BOOL, "Align single-line functions with function prototypes, uses align_func_proto_span"); unc_add_option("align_single_line_brace", UO_align_single_line_brace, AT_BOOL, "Aligning the open brace of single-line functions.\n" "Requires align_single_line_func=true, uses align_func_proto_span"); unc_add_option("align_single_line_brace_gap", UO_align_single_line_brace_gap, AT_NUM, "Gap for align_single_line_brace.\n"); unc_add_option("align_oc_msg_spec_span", UO_align_oc_msg_spec_span, AT_NUM, "The span for aligning ObjC msg spec (0=don't align)", "", 0, 5000); unc_add_option("align_nl_cont", UO_align_nl_cont, AT_BOOL, "Whether to align macros wrapped with a backslash and a newline.\n" "This will not work right if the macro contains a multi-line comment."); unc_add_option("align_pp_define_gap", UO_align_pp_define_gap, AT_NUM, "The minimum space between label and value of a preprocessor define"); unc_add_option("align_pp_define_span", UO_align_pp_define_span, AT_NUM, "The span for aligning on '#define' bodies (0=don't align)", "", 0, 5000); unc_add_option("align_left_shift", UO_align_left_shift, AT_BOOL, "Align lines that start with '<<' with previous '<<'. Default=true"); unc_add_option("align_oc_msg_colon_span", UO_align_oc_msg_colon_span, AT_NUM, "Span for aligning parameters in an Obj-C message call on the ':' (0=don't align)", 0, 5000); unc_add_option("align_oc_decl_colon", UO_align_oc_decl_colon, AT_BOOL, "Aligning parameters in an Obj-C '+' or '-' declaration on the ':'"); unc_begin_group(UG_comment, "Comment modifications"); unc_add_option("cmt_width", UO_cmt_width, AT_NUM, "Try to wrap comments at cmt_width columns", "", 16, 256); unc_add_option("cmt_reflow_mode", UO_cmt_reflow_mode, AT_NUM, "Set the comment reflow mode (default: 0)\n" "0: no reflowing (apart from the line wrapping due to cmt_width)\n" "1: no touching at all\n" "2: full reflow\n", "", 0, 2); unc_add_option("cmt_indent_multi", UO_cmt_indent_multi, AT_BOOL, "If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars.\n" "Default is true."); unc_add_option("cmt_c_group", UO_cmt_c_group, AT_BOOL, "Whether to group c-comments that look like they are in a block"); unc_add_option("cmt_c_nl_start", UO_cmt_c_nl_start, AT_BOOL, "Whether to put an empty '/*' on the first line of the combined c-comment"); unc_add_option("cmt_c_nl_end", UO_cmt_c_nl_end, AT_BOOL, "Whether to put a newline before the closing '*/' of the combined c-comment"); unc_add_option("cmt_cpp_group", UO_cmt_cpp_group, AT_BOOL, "Whether to group cpp-comments that look like they are in a block"); unc_add_option("cmt_cpp_nl_start", UO_cmt_cpp_nl_start, AT_BOOL, "Whether to put an empty '/*' on the first line of the combined cpp-comment"); unc_add_option("cmt_cpp_nl_end", UO_cmt_cpp_nl_end, AT_BOOL, "Whether to put a newline before the closing '*/' of the combined cpp-comment"); unc_add_option("cmt_cpp_to_c", UO_cmt_cpp_to_c, AT_BOOL, "Whether to change cpp-comments into c-comments"); unc_add_option("cmt_star_cont", UO_cmt_star_cont, AT_BOOL, "Whether to put a star on subsequent comment lines"); unc_add_option("cmt_sp_before_star_cont", UO_cmt_sp_before_star_cont, AT_NUM, "The number of spaces to insert at the start of subsequent comment lines"); unc_add_option("cmt_sp_after_star_cont", UO_cmt_sp_after_star_cont, AT_NUM, "The number of spaces to insert after the star on subsequent comment lines"); unc_add_option("cmt_multi_check_last", UO_cmt_multi_check_last, AT_BOOL, "For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of\n" "the comment are the same length. Default=True"); unc_add_option("cmt_insert_file_header", UO_cmt_insert_file_header, AT_STRING, "The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment.\n" "Will substitute $(filename) with the current file's name."); unc_add_option("cmt_insert_file_footer", UO_cmt_insert_file_footer, AT_STRING, "The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment.\n" "Will substitute $(filename) with the current file's name."); unc_add_option("cmt_insert_func_header", UO_cmt_insert_func_header, AT_STRING, "The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment.\n" "Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff.\n" "Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... }"); unc_add_option("cmt_insert_class_header", UO_cmt_insert_class_header, AT_STRING, "The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment.\n" "Will substitute $(class) with the class name."); unc_add_option("cmt_insert_oc_msg_header", UO_cmt_insert_oc_msg_header, AT_STRING, "The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment.\n" "Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff."); unc_add_option("cmt_insert_before_preproc", UO_cmt_insert_before_preproc, AT_BOOL, "If a preprocessor is encountered when stepping backwards from a function name, then\n" "this option decides whether the comment should be inserted.\n" "Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header."); unc_begin_group(UG_codemodify, "Code modifying options (non-whitespace)"); unc_add_option("mod_full_brace_do", UO_mod_full_brace_do, AT_IARF, "Add or remove braces on single-line 'do' statement"); unc_add_option("mod_full_brace_for", UO_mod_full_brace_for, AT_IARF, "Add or remove braces on single-line 'for' statement"); unc_add_option("mod_full_brace_function", UO_mod_full_brace_function, AT_IARF, "Add or remove braces on single-line function definitions. (Pawn)"); unc_add_option("mod_full_brace_if", UO_mod_full_brace_if, AT_IARF, "Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'."); unc_add_option("mod_full_brace_if_chain", UO_mod_full_brace_if_chain, AT_BOOL, "Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if.\n" "If any must be braced, they are all braced. If all can be unbraced, then the braces are removed."); unc_add_option("mod_full_brace_nl", UO_mod_full_brace_nl, AT_NUM, "Don't remove braces around statements that span N newlines", "", 0, 5000); unc_add_option("mod_full_brace_while", UO_mod_full_brace_while, AT_IARF, "Add or remove braces on single-line 'while' statement"); unc_add_option("mod_full_brace_using", UO_mod_full_brace_using, AT_IARF, "Add or remove braces on single-line 'using ()' statement"); unc_add_option("mod_paren_on_return", UO_mod_paren_on_return, AT_IARF, "Add or remove unnecessary paren on 'return' statement"); unc_add_option("mod_pawn_semicolon", UO_mod_pawn_semicolon, AT_BOOL, "Whether to change optional semicolons to real semicolons"); unc_add_option("mod_full_paren_if_bool", UO_mod_full_paren_if_bool, AT_BOOL, "Add parens on 'while' and 'if' statement around bools"); unc_add_option("mod_remove_extra_semicolon", UO_mod_remove_extra_semicolon, AT_BOOL, "Whether to remove superfluous semicolons"); unc_add_option("mod_add_long_function_closebrace_comment", UO_mod_add_long_function_closebrace_comment, AT_NUM, "If a function body exceeds the specified number of newlines and doesn't have a comment after\n" "the close brace, a comment will be added."); unc_add_option("mod_add_long_switch_closebrace_comment", UO_mod_add_long_switch_closebrace_comment, AT_NUM, "If a switch body exceeds the specified number of newlines and doesn't have a comment after\n" "the close brace, a comment will be added."); unc_add_option("mod_add_long_ifdef_endif_comment", UO_mod_add_long_ifdef_endif_comment, AT_NUM, "If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after\n" "the #endif, a comment will be added."); unc_add_option("mod_add_long_ifdef_else_comment", UO_mod_add_long_ifdef_else_comment, AT_NUM, "If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after\n" "the #else, a comment will be added."); unc_add_option("mod_sort_import", UO_mod_sort_import, AT_BOOL, "If TRUE, will sort consecutive single-line 'import' statements [Java, D]"); unc_add_option("mod_sort_using", UO_mod_sort_using, AT_BOOL, "If TRUE, will sort consecutive single-line 'using' statements [C#]"); unc_add_option("mod_sort_include", UO_mod_sort_include, AT_BOOL, "If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C]\n" "This is generally a bad idea, as it may break your code."); unc_add_option("mod_move_case_break", UO_mod_move_case_break, AT_BOOL, "If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace."); unc_add_option("mod_case_brace", UO_mod_case_brace, AT_IARF, "Will add or remove the braces around a fully braced case statement.\n" "Will only remove the braces if there are no variable declarations in the block."); unc_add_option("mod_remove_empty_return", UO_mod_remove_empty_return, AT_BOOL, "If TRUE, it will remove a void 'return;' that appears as the last statement in a function."); unc_begin_group(UG_preprocessor, "Preprocessor options"); unc_add_option("pp_indent", UO_pp_indent, AT_IARF, "Control indent of preprocessors inside #if blocks at brace level 0"); unc_add_option("pp_indent_at_level", UO_pp_indent_at_level, AT_BOOL, "Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false)"); unc_add_option("pp_indent_count", UO_pp_indent_count, AT_NUM, "If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1."); unc_add_option("pp_space", UO_pp_space, AT_IARF, "Add or remove space after # based on pp_level of #if blocks"); unc_add_option("pp_space_count", UO_pp_space_count, AT_NUM, "Sets the number of spaces added with pp_space"); unc_add_option("pp_indent_region", UO_pp_indent_region, AT_NUM, "The indent for #region and #endregion in C# and '#pragma region' in C/C++"); unc_add_option("pp_region_indent_code", UO_pp_region_indent_code, AT_BOOL, "Whether to indent the code between #region and #endregion"); unc_add_option("pp_indent_if", UO_pp_indent_if, AT_NUM, "If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level"); unc_add_option("pp_if_indent_code", UO_pp_if_indent_code, AT_BOOL, "Control whether to indent the code between #if, #else and #endif when not at file-level"); unc_add_option("pp_define_at_level", UO_pp_define_at_level, AT_BOOL, "Whether to indent '#define' at the brace level (true) or from column 1 (false)"); } const group_map_value *get_group_name(int ug) { for (group_map_it it = group_map.begin(); it != group_map.end(); it++) { if (it->second.id == ug) { return(&it->second); } } return(NULL); } const option_map_value *get_option_name(int uo) { for (option_name_map_it it = option_name_map.begin(); it != option_name_map.end(); it++) { if (it->second.id == uo) { return(&it->second); } } return(NULL); } /** * Convert the value string to the correct type in dest. */ static void convert_value(const option_map_value *entry, const char *val, op_val_t *dest) { const option_map_value *tmp; bool btrue; int mult; if (entry->type == AT_LINE) { if (strcasecmp(val, "CRLF") == 0) { dest->le = LE_CRLF; return; } if (strcasecmp(val, "LF") == 0) { dest->le = LE_LF; return; } if (strcasecmp(val, "CR") == 0) { dest->le = LE_CR; return; } if (strcasecmp(val, "AUTO") != 0) { LOG_FMT(LWARN, "%s:%d Expected AUTO, LF, CRLF, or CR for %s, got %s\n", cpd.filename, cpd.line_number, entry->name, val); cpd.error_count++; } dest->le = LE_AUTO; return; } if (entry->type == AT_POS) { if (strcasecmp(val, "LEAD") == 0) { dest->tp = TP_LEAD; return; } if (strcasecmp(val, "LEAD_BREAK") == 0) { dest->tp = TP_LEAD_BREAK; return; } if (strcasecmp(val, "LEAD_FORCE") == 0) { dest->tp = TP_LEAD_FORCE; return; } if (strcasecmp(val, "TRAIL") == 0) { dest->tp = TP_TRAIL; return; } if (strcasecmp(val, "TRAIL_BREAK") == 0) { dest->tp = TP_TRAIL_BREAK; return; } if (strcasecmp(val, "TRAIL_FORCE") == 0) { dest->tp = TP_TRAIL_FORCE; return; } if (strcasecmp(val, "IGNORE") != 0) { LOG_FMT(LWARN, "%s:%d Expected IGNORE, LEAD, LEAD_BREAK, LEAD_FORCE, " "TRAIL, TRAIL_BREAK, TRAIL_FORCE for %s, got %s\n", cpd.filename, cpd.line_number, entry->name, val); cpd.error_count++; } dest->tp = TP_IGNORE; return; } if (entry->type == AT_NUM) { if (unc_isdigit(*val) || (unc_isdigit(val[1]) && ((*val == '-') || (*val == '+')))) { dest->n = strtol(val, NULL, 0); return; } else { /* Try to see if it is a variable */ mult = 1; if (*val == '-') { mult = -1; val++; } if (((tmp = unc_find_option(val)) != NULL) && (tmp->type == entry->type)) { dest->n = cpd.settings[tmp->id].n * mult; return; } } LOG_FMT(LWARN, "%s:%d Expected a number for %s, got %s\n", cpd.filename, cpd.line_number, entry->name, val); cpd.error_count++; dest->n = 0; return; } if (entry->type == AT_BOOL) { if ((strcasecmp(val, "true") == 0) || (strcasecmp(val, "t") == 0) || (strcmp(val, "1") == 0)) { dest->b = true; return; } if ((strcasecmp(val, "false") == 0) || (strcasecmp(val, "f") == 0) || (strcmp(val, "0") == 0)) { dest->b = false; return; } btrue = true; if ((*val == '-') || (*val == '~')) { btrue = false; val++; } if (((tmp = unc_find_option(val)) != NULL) && (tmp->type == entry->type)) { dest->b = cpd.settings[tmp->id].b ? btrue : !btrue; return; } LOG_FMT(LWARN, "%s:%d Expected 'True' or 'False' for %s, got %s\n", cpd.filename, cpd.line_number, entry->name, val); cpd.error_count++; dest->b = false; return; } if (entry->type == AT_STRING) { dest->str = strdup(val); return; } /* Must be AT_IARF */ if ((strcasecmp(val, "add") == 0) || (strcasecmp(val, "a") == 0)) { dest->a = AV_ADD; return; } if ((strcasecmp(val, "remove") == 0) || (strcasecmp(val, "r") == 0)) { dest->a = AV_REMOVE; return; } if ((strcasecmp(val, "force") == 0) || (strcasecmp(val, "f") == 0)) { dest->a = AV_FORCE; return; } if ((strcasecmp(val, "ignore") == 0) || (strcasecmp(val, "i") == 0)) { dest->a = AV_IGNORE; return; } if (((tmp = unc_find_option(val)) != NULL) && (tmp->type == entry->type)) { dest->a = cpd.settings[tmp->id].a; return; } LOG_FMT(LWARN, "%s:%d Expected 'Add', 'Remove', 'Force', or 'Ignore' for %s, got %s\n", cpd.filename, cpd.line_number, entry->name, val); cpd.error_count++; dest->a = AV_IGNORE; } int set_option_value(const char *name, const char *value) { const option_map_value *entry; if ((entry = unc_find_option(name)) != NULL) { convert_value(entry, value, &cpd.settings[entry->id]); return(entry->id); } return(-1); } int load_option_file(const char *filename) { FILE *pfile; char buffer[256]; char *ptr; int id; char *args[32]; int argc; int idx; cpd.line_number = 0; #ifdef WIN32 /* "/dev/null" not understood by "fopen" in windoze */ if (strcasecmp(filename, "/dev/null") == 0) { return(0); } #endif pfile = fopen(filename, "r"); if (pfile == NULL) { LOG_FMT(LERR, "%s: fopen(%s) failed: %s (%d)\n", __func__, filename, strerror(errno), errno); cpd.error_count++; return(-1); } /* Read in the file line by line */ while (fgets(buffer, sizeof(buffer), pfile) != NULL) { cpd.line_number++; /* Chop off trailing comments */ if ((ptr = strchr(buffer, '#')) != NULL) { *ptr = 0; } /* Blow away the '=' to make things simple */ if ((ptr = strchr(buffer, '=')) != NULL) { *ptr = ' '; } /* Blow away all commas */ ptr = buffer; while ((ptr = strchr(ptr, ',')) != NULL) { *ptr = ' '; } /* Split the line */ argc = Args::SplitLine(buffer, args, ARRAY_SIZE(args) - 1); if (argc < 2) { if (argc > 0) { LOG_FMT(LWARN, "%s:%d Wrong number of arguments: %s...\n", filename, cpd.line_number, buffer); cpd.error_count++; } continue; } args[argc] = NULL; if (strcasecmp(args[0], "type") == 0) { for (idx = 1; idx < argc; idx++) { add_keyword(args[idx], CT_TYPE); } } else if (strcasecmp(args[0], "define") == 0) { add_define(args[1], args[2]); } else if (strcasecmp(args[0], "macro-open") == 0) { add_keyword(args[1], CT_MACRO_OPEN); } else if (strcasecmp(args[0], "macro-close") == 0) { add_keyword(args[1], CT_MACRO_CLOSE); } else if (strcasecmp(args[0], "macro-else") == 0) { add_keyword(args[1], CT_MACRO_ELSE); } else if (strcasecmp(args[0], "set") == 0) { if (argc < 3) { LOG_FMT(LWARN, "%s:%d 'set' requires at least three arguments\n", filename, cpd.line_number); } else { c_token_t id = find_token_name(args[1]); if (id != CT_NONE) { LOG_FMT(LNOTE, "%s:%d set '%s':", filename, cpd.line_number, args[1]); for (idx = 2; idx < argc; idx++) { LOG_FMT(LNOTE, " '%s'", args[idx]); add_keyword(args[idx], id); } LOG_FMT(LNOTE, "\n"); } else { LOG_FMT(LWARN, "%s:%d unknown type '%s':", filename, cpd.line_number, args[1]); } } } else { /* must be a regular option = value */ if ((id = set_option_value(args[0], args[1])) < 0) { LOG_FMT(LWARN, "%s:%d Unknown symbol '%s'\n", filename, cpd.line_number, args[0]); cpd.error_count++; } } } fclose(pfile); return(0); } int save_option_file(FILE *pfile, bool withDoc) { string val_string; const char *val_str; int val_len; int name_len; int idx; fprintf(pfile, "# Uncrustify %s\n", UNCRUSTIFY_VERSION); /* Print the options by group */ for (group_map_it jt = group_map.begin(); jt != group_map.end(); jt++) { if (withDoc) { fputs("\n#\n", pfile); fprintf(pfile, "# %s\n", jt->second.short_desc); fputs("#\n\n", pfile); } bool first = true; for (option_list_it it = jt->second.options.begin(); it != jt->second.options.end(); it++) { const option_map_value *option = get_option_name(*it); if (withDoc && (option->short_desc != NULL) && (*option->short_desc != 0)) { fprintf(pfile, "%s# ", first ? "" : "\n"); for (idx = 0; option->short_desc[idx] != 0; idx++) { fputc(option->short_desc[idx], pfile); if ((option->short_desc[idx] == '\n') && (option->short_desc[idx + 1] != 0)) { fputs("# ", pfile); } } if (option->short_desc[idx - 1] != '\n') { fputc('\n', pfile); } } first = false; val_string = op_val_to_string(option->type, cpd.settings[option->id]); val_str = val_string.c_str(); val_len = strlen(val_str); name_len = strlen(option->name); fprintf(pfile, "%s %*.s= ", option->name, cpd.max_option_name_len - name_len, " "); if (option->type == AT_STRING) { fprintf(pfile, "\"%s\"", val_str); } else { fprintf(pfile, "%s", val_str); } if (withDoc) { fprintf(pfile, "%*.s # %s", 8 - val_len, " ", argtype_to_string(option->type).c_str()); } fputs("\n", pfile); } } if (withDoc) { fprintf(pfile, "\n" "# You can force a token to be a type with the 'type' option.\n" "# Example:\n" "# type myfoo1 myfoo2\n" "#\n" "# You can create custom macro-based indentation using macro-open,\n" "# macro-else and macro-close.\n" "# Example:\n" "# macro-open BEGIN_TEMPLATE_MESSAGE_MAP\n" "# macro-open BEGIN_MESSAGE_MAP\n" "# macro-close END_MESSAGE_MAP\n" "#\n" "# You can assign any keyword to any type with the set option.\n" "# set func_call_user _ N_\n" "#\n" "# The full syntax description of all custom definition config entries\n" "# is shown below:\n" "#\n" "# define custom tokens as:\n" "# - embed whitespace in token using '\' escape character, or\n" "# put token in quotes\n" "# - these: ' \" and ` are recognized as quote delimiters\n" "#\n" "# type token1 token2 token3 ...\n" "# ^ optionally specify multiple tokens on a single line\n" "# define def_token output_token\n" "# ^ output_token is optional, then NULL is assumed\n" "# macro-open token\n" "# macro-close token\n" "# macro-else token\n" "# set id token1 token2 ...\n" "# ^ optionally specify multiple tokens on a single line\n" "# ^ id is one of the names in token_enum.h sans the CT_ prefix,\n" "# e.g. PP_PRAGMA\n" "#\n" "# all tokens are separated by any mix of ',' commas, '=' equal signs\n" "# and whitespace (space, tab)\n" "#\n" ); } /* Print custom keywords */ print_keywords(pfile); /* Print custom defines */ print_defines(pfile); fclose(pfile); return(0); } void print_options(FILE *pfile, bool verbose) { int max_width = 0; int cur_width; const char *text; const char *names[] = { "{ False, True }", "{ Ignore, Add, Remove, Force }", "Number", "{ Auto, LF, CR, CRLF }", "{ Ignore, Lead, Trail }", "String", }; option_name_map_it it; /* Find the max width of the names */ for (it = option_name_map.begin(); it != option_name_map.end(); it++) { cur_width = strlen(it->second.name); if (cur_width > max_width) { max_width = cur_width; } } max_width++; fprintf(pfile, "# Uncrustify %s\n", UNCRUSTIFY_VERSION); /* Print the all out */ for (group_map_it jt = group_map.begin(); jt != group_map.end(); jt++) { fprintf(pfile, "#\n# %s\n#\n\n", jt->second.short_desc); for (option_list_it it = jt->second.options.begin(); it != jt->second.options.end(); it++) { const option_map_value *option = get_option_name(*it); cur_width = strlen(option->name); fprintf(pfile, "%s%*c%s\n", option->name, max_width - cur_width, ' ', names[option->type]); text = option->short_desc; if (text != NULL) { fputs(" ", pfile); while (*text != 0) { fputc(*text, pfile); if (*text == '\n') { fputs(" ", pfile); } text++; } } fputs("\n\n", pfile); } } } /** * Sets non-zero settings defaults * * TODO: select from various sets? - i.e., K&R, GNU, Linux, Ben */ void set_option_defaults(void) { cpd.settings[UO_newlines].le = LE_AUTO; cpd.settings[UO_input_tab_size].n = 8; cpd.settings[UO_output_tab_size].n = 8; cpd.settings[UO_indent_columns].n = 8; cpd.settings[UO_indent_with_tabs].n = 1; cpd.settings[UO_indent_label].n = 1; cpd.settings[UO_indent_access_spec].n = 1; cpd.settings[UO_sp_before_comma].a = AV_REMOVE; cpd.settings[UO_sp_paren_comma].a = AV_FORCE; cpd.settings[UO_string_escape_char].n = '\\'; cpd.settings[UO_sp_not].a = AV_REMOVE; cpd.settings[UO_sp_inv].a = AV_REMOVE; cpd.settings[UO_sp_addr].a = AV_REMOVE; cpd.settings[UO_sp_deref].a = AV_REMOVE; cpd.settings[UO_sp_member].a = AV_REMOVE; cpd.settings[UO_sp_sign].a = AV_REMOVE; cpd.settings[UO_sp_incdec].a = AV_REMOVE; cpd.settings[UO_sp_after_type].a = AV_FORCE; cpd.settings[UO_sp_before_nl_cont].a = AV_ADD; cpd.settings[UO_sp_before_case_colon].a = AV_REMOVE; cpd.settings[UO_sp_before_semi].a = AV_REMOVE; cpd.settings[UO_sp_after_semi].a = AV_ADD; cpd.settings[UO_sp_after_semi_for].a = AV_FORCE; cpd.settings[UO_cmt_indent_multi].b = true; cpd.settings[UO_cmt_multi_check_last].b = true; cpd.settings[UO_pp_indent_count].n = 1; cpd.settings[UO_align_left_shift].b = true; cpd.settings[UO_indent_align_assign].b = true; cpd.settings[UO_sp_pp_concat].a = AV_ADD; cpd.settings[UO_sp_pp_stringify].a = AV_ADD; cpd.settings[UO_sp_angle_shift].a = AV_ADD; } string argtype_to_string(argtype_e argtype) { switch (argtype) { case AT_BOOL: return("false/true"); case AT_IARF: return("ignore/add/remove/force"); case AT_NUM: return("number"); case AT_LINE: return("auto/lf/crlf/cr"); case AT_POS: return("ignore/lead/lead_break/lead_force/trail/trail_break/trail_force"); case AT_STRING: return("string"); default: LOG_FMT(LWARN, "Unknown argtype '%d'\n", argtype); return(""); } } string bool_to_string(bool val) { if (val) { return("true"); } else { return("false"); } } string argval_to_string(argval_t argval) { switch (argval) { case AV_IGNORE: return("ignore"); case AV_ADD: return("add"); case AV_REMOVE: return("remove"); case AV_FORCE: return("force"); default: LOG_FMT(LWARN, "Unknown argval '%d'\n", argval); return(""); } } string number_to_string(int number) { char buffer[12]; // 11 + 1 sprintf(buffer, "%d", number); /*NOTE: this creates a std:string class from the char array. * It isn't returning a pointer to stack memory. */ return(buffer); } string lineends_to_string(lineends_e linends) { switch (linends) { case LE_LF: return("lf"); case LE_CRLF: return("crlf"); case LE_CR: return("cr"); case LE_AUTO: return("auto"); default: LOG_FMT(LWARN, "Unknown lineends '%d'\n", linends); return(""); } } string tokenpos_to_string(tokenpos_e tokenpos) { switch (tokenpos) { case TP_IGNORE: return("ignore"); case TP_LEAD: return("lead"); case TP_LEAD_BREAK: return("lead_break"); case TP_LEAD_FORCE: return("lead_force"); case TP_TRAIL: return("trail"); case TP_TRAIL_BREAK: return("trail_break"); case TP_TRAIL_FORCE: return("trail_force"); default: LOG_FMT(LWARN, "Unknown tokenpos '%d'\n", tokenpos); return(""); } } string op_val_to_string(argtype_e argtype, op_val_t op_val) { switch (argtype) { case AT_BOOL: return(bool_to_string(op_val.b)); case AT_IARF: return(argval_to_string(op_val.a)); case AT_NUM: return(number_to_string(op_val.n)); case AT_LINE: return(lineends_to_string(op_val.le)); case AT_POS: return(tokenpos_to_string(op_val.tp)); case AT_STRING: return(op_val.str != NULL ? op_val.str : ""); default: LOG_FMT(LWARN, "Unknown argtype '%d'\n", argtype); return(""); } } uncrustify-0.59/src/Makefile.in0000644000175000017500000010673711642741011013452 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = uncrustify$(EXEEXT) subdir = src DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/uncrustify_version.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = uncrustify_version.h CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_uncrustify_OBJECTS = uncrustify-uncrustify.$(OBJEXT) \ uncrustify-chunk_list.$(OBJEXT) uncrustify-indent.$(OBJEXT) \ uncrustify-align.$(OBJEXT) uncrustify-combine.$(OBJEXT) \ uncrustify-tokenize.$(OBJEXT) \ uncrustify-tokenize_cleanup.$(OBJEXT) \ uncrustify-space.$(OBJEXT) uncrustify-newlines.$(OBJEXT) \ uncrustify-output.$(OBJEXT) uncrustify-args.$(OBJEXT) \ uncrustify-options.$(OBJEXT) uncrustify-keywords.$(OBJEXT) \ uncrustify-punctuators.$(OBJEXT) \ uncrustify-parse_frame.$(OBJEXT) uncrustify-logmask.$(OBJEXT) \ uncrustify-logger.$(OBJEXT) uncrustify-ChunkStack.$(OBJEXT) \ uncrustify-braces.$(OBJEXT) uncrustify-brace_cleanup.$(OBJEXT) \ uncrustify-align_stack.$(OBJEXT) uncrustify-defines.$(OBJEXT) \ uncrustify-width.$(OBJEXT) uncrustify-lang_pawn.$(OBJEXT) \ uncrustify-md5.$(OBJEXT) uncrustify-backup.$(OBJEXT) \ uncrustify-parens.$(OBJEXT) \ uncrustify-universalindentgui.$(OBJEXT) \ uncrustify-semicolons.$(OBJEXT) uncrustify-sorting.$(OBJEXT) \ uncrustify-detect.$(OBJEXT) uncrustify-unicode.$(OBJEXT) \ uncrustify-unc_text.$(OBJEXT) uncrustify_OBJECTS = $(am_uncrustify_OBJECTS) uncrustify_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = am__depfiles_maybe = AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) AM_V_CXX = $(am__v_CXX_$(V)) am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) am__v_CXX_0 = @echo " CXX " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_CXXLD = $(am__v_CXXLD_$(V)) am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) am__v_CXXLD_0 = @echo " CXXLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(uncrustify_SOURCES) DIST_SOURCES = $(uncrustify_SOURCES) HEADERS = $(noinst_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign no-dependencies DISTCLEANFILES = CLEANFILES = *.o *~ *.bak MAINTAINERCLEANFILES = Makefile.in BUILT_SOURCES = token_names.h uncrustify_SOURCES = uncrustify.cpp chunk_list.cpp indent.cpp align.cpp combine.cpp \ tokenize.cpp tokenize_cleanup.cpp space.cpp newlines.cpp output.cpp \ args.cpp options.cpp keywords.cpp punctuators.cpp parse_frame.cpp \ logmask.cpp logger.cpp ChunkStack.cpp braces.cpp brace_cleanup.cpp \ align_stack.cpp defines.cpp width.cpp lang_pawn.cpp md5.cpp \ backup.cpp parens.cpp universalindentgui.cpp semicolons.cpp \ sorting.cpp detect.cpp unicode.cpp unc_text.cpp noinst_HEADERS = chunk_list.h options.h char_table.h chunk_list.h \ uncrustify_types.h prototypes.h logmask.h logger.h \ ChunkStack.h args.h token_names.h token_enum.h ListManager.h md5.h \ align_stack.h backup.h base_types.h log_levels.h \ punctuators.h \ uncrustify_version.h \ unc_ctype.h unc_text.h uncrustify_CPPFLAGS = -Wall all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .cpp .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status src/config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 uncrustify_version.h: $(top_builddir)/config.status $(srcdir)/uncrustify_version.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) uncrustify$(EXEEXT): $(uncrustify_OBJECTS) $(uncrustify_DEPENDENCIES) @rm -f uncrustify$(EXEEXT) $(AM_V_CXXLD)$(CXXLINK) $(uncrustify_OBJECTS) $(uncrustify_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c .cpp.o: $(AM_V_CXX) @AM_BACKSLASH@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: $(AM_V_CXX) @AM_BACKSLASH@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` uncrustify-uncrustify.o: uncrustify.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-uncrustify.o `test -f 'uncrustify.cpp' || echo '$(srcdir)/'`uncrustify.cpp uncrustify-uncrustify.obj: uncrustify.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-uncrustify.obj `if test -f 'uncrustify.cpp'; then $(CYGPATH_W) 'uncrustify.cpp'; else $(CYGPATH_W) '$(srcdir)/uncrustify.cpp'; fi` uncrustify-chunk_list.o: chunk_list.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-chunk_list.o `test -f 'chunk_list.cpp' || echo '$(srcdir)/'`chunk_list.cpp uncrustify-chunk_list.obj: chunk_list.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-chunk_list.obj `if test -f 'chunk_list.cpp'; then $(CYGPATH_W) 'chunk_list.cpp'; else $(CYGPATH_W) '$(srcdir)/chunk_list.cpp'; fi` uncrustify-indent.o: indent.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-indent.o `test -f 'indent.cpp' || echo '$(srcdir)/'`indent.cpp uncrustify-indent.obj: indent.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-indent.obj `if test -f 'indent.cpp'; then $(CYGPATH_W) 'indent.cpp'; else $(CYGPATH_W) '$(srcdir)/indent.cpp'; fi` uncrustify-align.o: align.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-align.o `test -f 'align.cpp' || echo '$(srcdir)/'`align.cpp uncrustify-align.obj: align.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-align.obj `if test -f 'align.cpp'; then $(CYGPATH_W) 'align.cpp'; else $(CYGPATH_W) '$(srcdir)/align.cpp'; fi` uncrustify-combine.o: combine.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-combine.o `test -f 'combine.cpp' || echo '$(srcdir)/'`combine.cpp uncrustify-combine.obj: combine.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-combine.obj `if test -f 'combine.cpp'; then $(CYGPATH_W) 'combine.cpp'; else $(CYGPATH_W) '$(srcdir)/combine.cpp'; fi` uncrustify-tokenize.o: tokenize.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-tokenize.o `test -f 'tokenize.cpp' || echo '$(srcdir)/'`tokenize.cpp uncrustify-tokenize.obj: tokenize.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-tokenize.obj `if test -f 'tokenize.cpp'; then $(CYGPATH_W) 'tokenize.cpp'; else $(CYGPATH_W) '$(srcdir)/tokenize.cpp'; fi` uncrustify-tokenize_cleanup.o: tokenize_cleanup.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-tokenize_cleanup.o `test -f 'tokenize_cleanup.cpp' || echo '$(srcdir)/'`tokenize_cleanup.cpp uncrustify-tokenize_cleanup.obj: tokenize_cleanup.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-tokenize_cleanup.obj `if test -f 'tokenize_cleanup.cpp'; then $(CYGPATH_W) 'tokenize_cleanup.cpp'; else $(CYGPATH_W) '$(srcdir)/tokenize_cleanup.cpp'; fi` uncrustify-space.o: space.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-space.o `test -f 'space.cpp' || echo '$(srcdir)/'`space.cpp uncrustify-space.obj: space.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-space.obj `if test -f 'space.cpp'; then $(CYGPATH_W) 'space.cpp'; else $(CYGPATH_W) '$(srcdir)/space.cpp'; fi` uncrustify-newlines.o: newlines.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-newlines.o `test -f 'newlines.cpp' || echo '$(srcdir)/'`newlines.cpp uncrustify-newlines.obj: newlines.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-newlines.obj `if test -f 'newlines.cpp'; then $(CYGPATH_W) 'newlines.cpp'; else $(CYGPATH_W) '$(srcdir)/newlines.cpp'; fi` uncrustify-output.o: output.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-output.o `test -f 'output.cpp' || echo '$(srcdir)/'`output.cpp uncrustify-output.obj: output.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-output.obj `if test -f 'output.cpp'; then $(CYGPATH_W) 'output.cpp'; else $(CYGPATH_W) '$(srcdir)/output.cpp'; fi` uncrustify-args.o: args.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-args.o `test -f 'args.cpp' || echo '$(srcdir)/'`args.cpp uncrustify-args.obj: args.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-args.obj `if test -f 'args.cpp'; then $(CYGPATH_W) 'args.cpp'; else $(CYGPATH_W) '$(srcdir)/args.cpp'; fi` uncrustify-options.o: options.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-options.o `test -f 'options.cpp' || echo '$(srcdir)/'`options.cpp uncrustify-options.obj: options.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-options.obj `if test -f 'options.cpp'; then $(CYGPATH_W) 'options.cpp'; else $(CYGPATH_W) '$(srcdir)/options.cpp'; fi` uncrustify-keywords.o: keywords.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-keywords.o `test -f 'keywords.cpp' || echo '$(srcdir)/'`keywords.cpp uncrustify-keywords.obj: keywords.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-keywords.obj `if test -f 'keywords.cpp'; then $(CYGPATH_W) 'keywords.cpp'; else $(CYGPATH_W) '$(srcdir)/keywords.cpp'; fi` uncrustify-punctuators.o: punctuators.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-punctuators.o `test -f 'punctuators.cpp' || echo '$(srcdir)/'`punctuators.cpp uncrustify-punctuators.obj: punctuators.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-punctuators.obj `if test -f 'punctuators.cpp'; then $(CYGPATH_W) 'punctuators.cpp'; else $(CYGPATH_W) '$(srcdir)/punctuators.cpp'; fi` uncrustify-parse_frame.o: parse_frame.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-parse_frame.o `test -f 'parse_frame.cpp' || echo '$(srcdir)/'`parse_frame.cpp uncrustify-parse_frame.obj: parse_frame.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-parse_frame.obj `if test -f 'parse_frame.cpp'; then $(CYGPATH_W) 'parse_frame.cpp'; else $(CYGPATH_W) '$(srcdir)/parse_frame.cpp'; fi` uncrustify-logmask.o: logmask.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-logmask.o `test -f 'logmask.cpp' || echo '$(srcdir)/'`logmask.cpp uncrustify-logmask.obj: logmask.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-logmask.obj `if test -f 'logmask.cpp'; then $(CYGPATH_W) 'logmask.cpp'; else $(CYGPATH_W) '$(srcdir)/logmask.cpp'; fi` uncrustify-logger.o: logger.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-logger.o `test -f 'logger.cpp' || echo '$(srcdir)/'`logger.cpp uncrustify-logger.obj: logger.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-logger.obj `if test -f 'logger.cpp'; then $(CYGPATH_W) 'logger.cpp'; else $(CYGPATH_W) '$(srcdir)/logger.cpp'; fi` uncrustify-ChunkStack.o: ChunkStack.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-ChunkStack.o `test -f 'ChunkStack.cpp' || echo '$(srcdir)/'`ChunkStack.cpp uncrustify-ChunkStack.obj: ChunkStack.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-ChunkStack.obj `if test -f 'ChunkStack.cpp'; then $(CYGPATH_W) 'ChunkStack.cpp'; else $(CYGPATH_W) '$(srcdir)/ChunkStack.cpp'; fi` uncrustify-braces.o: braces.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-braces.o `test -f 'braces.cpp' || echo '$(srcdir)/'`braces.cpp uncrustify-braces.obj: braces.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-braces.obj `if test -f 'braces.cpp'; then $(CYGPATH_W) 'braces.cpp'; else $(CYGPATH_W) '$(srcdir)/braces.cpp'; fi` uncrustify-brace_cleanup.o: brace_cleanup.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-brace_cleanup.o `test -f 'brace_cleanup.cpp' || echo '$(srcdir)/'`brace_cleanup.cpp uncrustify-brace_cleanup.obj: brace_cleanup.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-brace_cleanup.obj `if test -f 'brace_cleanup.cpp'; then $(CYGPATH_W) 'brace_cleanup.cpp'; else $(CYGPATH_W) '$(srcdir)/brace_cleanup.cpp'; fi` uncrustify-align_stack.o: align_stack.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-align_stack.o `test -f 'align_stack.cpp' || echo '$(srcdir)/'`align_stack.cpp uncrustify-align_stack.obj: align_stack.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-align_stack.obj `if test -f 'align_stack.cpp'; then $(CYGPATH_W) 'align_stack.cpp'; else $(CYGPATH_W) '$(srcdir)/align_stack.cpp'; fi` uncrustify-defines.o: defines.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-defines.o `test -f 'defines.cpp' || echo '$(srcdir)/'`defines.cpp uncrustify-defines.obj: defines.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-defines.obj `if test -f 'defines.cpp'; then $(CYGPATH_W) 'defines.cpp'; else $(CYGPATH_W) '$(srcdir)/defines.cpp'; fi` uncrustify-width.o: width.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-width.o `test -f 'width.cpp' || echo '$(srcdir)/'`width.cpp uncrustify-width.obj: width.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-width.obj `if test -f 'width.cpp'; then $(CYGPATH_W) 'width.cpp'; else $(CYGPATH_W) '$(srcdir)/width.cpp'; fi` uncrustify-lang_pawn.o: lang_pawn.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-lang_pawn.o `test -f 'lang_pawn.cpp' || echo '$(srcdir)/'`lang_pawn.cpp uncrustify-lang_pawn.obj: lang_pawn.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-lang_pawn.obj `if test -f 'lang_pawn.cpp'; then $(CYGPATH_W) 'lang_pawn.cpp'; else $(CYGPATH_W) '$(srcdir)/lang_pawn.cpp'; fi` uncrustify-md5.o: md5.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-md5.o `test -f 'md5.cpp' || echo '$(srcdir)/'`md5.cpp uncrustify-md5.obj: md5.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-md5.obj `if test -f 'md5.cpp'; then $(CYGPATH_W) 'md5.cpp'; else $(CYGPATH_W) '$(srcdir)/md5.cpp'; fi` uncrustify-backup.o: backup.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-backup.o `test -f 'backup.cpp' || echo '$(srcdir)/'`backup.cpp uncrustify-backup.obj: backup.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-backup.obj `if test -f 'backup.cpp'; then $(CYGPATH_W) 'backup.cpp'; else $(CYGPATH_W) '$(srcdir)/backup.cpp'; fi` uncrustify-parens.o: parens.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-parens.o `test -f 'parens.cpp' || echo '$(srcdir)/'`parens.cpp uncrustify-parens.obj: parens.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-parens.obj `if test -f 'parens.cpp'; then $(CYGPATH_W) 'parens.cpp'; else $(CYGPATH_W) '$(srcdir)/parens.cpp'; fi` uncrustify-universalindentgui.o: universalindentgui.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-universalindentgui.o `test -f 'universalindentgui.cpp' || echo '$(srcdir)/'`universalindentgui.cpp uncrustify-universalindentgui.obj: universalindentgui.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-universalindentgui.obj `if test -f 'universalindentgui.cpp'; then $(CYGPATH_W) 'universalindentgui.cpp'; else $(CYGPATH_W) '$(srcdir)/universalindentgui.cpp'; fi` uncrustify-semicolons.o: semicolons.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-semicolons.o `test -f 'semicolons.cpp' || echo '$(srcdir)/'`semicolons.cpp uncrustify-semicolons.obj: semicolons.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-semicolons.obj `if test -f 'semicolons.cpp'; then $(CYGPATH_W) 'semicolons.cpp'; else $(CYGPATH_W) '$(srcdir)/semicolons.cpp'; fi` uncrustify-sorting.o: sorting.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-sorting.o `test -f 'sorting.cpp' || echo '$(srcdir)/'`sorting.cpp uncrustify-sorting.obj: sorting.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-sorting.obj `if test -f 'sorting.cpp'; then $(CYGPATH_W) 'sorting.cpp'; else $(CYGPATH_W) '$(srcdir)/sorting.cpp'; fi` uncrustify-detect.o: detect.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-detect.o `test -f 'detect.cpp' || echo '$(srcdir)/'`detect.cpp uncrustify-detect.obj: detect.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-detect.obj `if test -f 'detect.cpp'; then $(CYGPATH_W) 'detect.cpp'; else $(CYGPATH_W) '$(srcdir)/detect.cpp'; fi` uncrustify-unicode.o: unicode.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-unicode.o `test -f 'unicode.cpp' || echo '$(srcdir)/'`unicode.cpp uncrustify-unicode.obj: unicode.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-unicode.obj `if test -f 'unicode.cpp'; then $(CYGPATH_W) 'unicode.cpp'; else $(CYGPATH_W) '$(srcdir)/unicode.cpp'; fi` uncrustify-unc_text.o: unc_text.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-unc_text.o `test -f 'unc_text.cpp' || echo '$(srcdir)/'`unc_text.cpp uncrustify-unc_text.obj: unc_text.cpp $(AM_V_CXX) @AM_BACKSLASH@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(uncrustify_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o uncrustify-unc_text.obj `if test -f 'unc_text.cpp'; then $(CYGPATH_W) 'unc_text.cpp'; else $(CYGPATH_W) '$(srcdir)/unc_text.cpp'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(PROGRAMS) $(HEADERS) config.h installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-hdr distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-binPROGRAMS token_names.h: token_enum.h ../make_token_names.sh @echo "Rebuilding token_names.h" @sh ../make_token_names.sh # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: uncrustify-0.59/src/punctuators.cpp0000644000175000017500000001635211506773274014510 00000000000000/** * @file punctuators.cpp * Manages the table of punctutators. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include /** * * The file "punctuators.h" was generated by punc.py from this file. * If you change one of the below symbol tables, re-run punc.py. * $ python scripts/punc.py > src/punctuators.h * */ /* 4-char symbols */ static const chunk_tag_t symbols4[] = { { "!<>=", CT_COMPARE, LANG_D }, { ">>>=", CT_ASSIGN, LANG_D | LANG_JAVA | LANG_PAWN }, }; /* 3-char symbols */ static const chunk_tag_t symbols3[] = { { "!<=", CT_COMPARE, LANG_D }, { "!<>", CT_COMPARE, LANG_D }, { "!==", CT_COMPARE, LANG_D }, { "!>=", CT_COMPARE, LANG_D }, { "->*", CT_MEMBER, LANG_C | LANG_CPP | LANG_D }, { "...", CT_ELLIPSIS, LANG_C | LANG_CPP | LANG_D | LANG_PAWN }, { "<<=", CT_ASSIGN, LANG_ALL }, { "<>=", CT_COMPARE, LANG_D }, { "===", CT_COMPARE, LANG_D }, { ">>=", CT_ASSIGN, LANG_ALL }, { ">>>", CT_ARITH, LANG_D | LANG_JAVA | LANG_PAWN }, }; /* 2-char symbols */ static const chunk_tag_t symbols2[] = { { "!<", CT_COMPARE, LANG_D }, { "!=", CT_COMPARE, LANG_ALL }, { "!>", CT_COMPARE, LANG_D }, { "!~", CT_COMPARE, LANG_D }, { "##", CT_PP, LANG_C | LANG_CPP | LANG_OC }, { "#@", CT_POUND, LANG_C | LANG_CPP | LANG_OC }, /* MS extension */ { "%=", CT_ASSIGN, LANG_ALL }, { "&&", CT_BOOL, LANG_ALL }, { "&=", CT_ASSIGN, LANG_ALL }, { "*=", CT_ASSIGN, LANG_ALL }, { "++", CT_INCDEC_AFTER, LANG_ALL }, { "+=", CT_ASSIGN, LANG_ALL }, { "--", CT_INCDEC_AFTER, LANG_ALL }, { "-=", CT_ASSIGN, LANG_ALL }, { "->", CT_MEMBER, LANG_C | LANG_CPP | LANG_CS | LANG_OC | LANG_D }, { ".*", CT_MEMBER, LANG_C | LANG_CPP | LANG_D }, { "..", CT_RANGE, LANG_D }, { "/=", CT_ASSIGN, LANG_ALL }, { "::", CT_DC_MEMBER, LANG_C | LANG_CPP | LANG_CS | LANG_D }, { "<<", CT_ARITH, LANG_ALL }, { "<=", CT_COMPARE, LANG_ALL }, { "<>", CT_COMPARE, LANG_D }, { "==", CT_COMPARE, LANG_ALL }, { ">=", CT_COMPARE, LANG_ALL }, { ">>", CT_ARITH, LANG_ALL & ~LANG_CS }, { "[]", CT_TSQUARE, LANG_ALL }, { "^=", CT_ASSIGN, LANG_ALL }, { "|=", CT_ASSIGN, LANG_ALL }, { "||", CT_BOOL, LANG_ALL }, { "~=", CT_COMPARE, LANG_D }, { "~~", CT_COMPARE, LANG_D }, { "=>", CT_LAMBDA, LANG_VALA | LANG_CS }, { "??", CT_COMPARE, LANG_CS }, }; /* 1-char symbols */ static const chunk_tag_t symbols1[] = { { "!", CT_NOT, LANG_ALL }, { "#", CT_POUND, LANG_C | LANG_CPP | LANG_CS | LANG_D | LANG_OC | LANG_PAWN }, { "$", CT_COMPARE, LANG_D }, { "%", CT_ARITH, LANG_ALL }, { "&", CT_AMP, LANG_ALL }, { "(", CT_PAREN_OPEN, LANG_ALL }, { ")", CT_PAREN_CLOSE, LANG_ALL }, { "*", CT_STAR, LANG_ALL }, { "+", CT_PLUS, LANG_ALL }, { ",", CT_COMMA, LANG_ALL }, { "-", CT_MINUS, LANG_ALL }, { ".", CT_DOT, LANG_ALL }, { "/", CT_ARITH, LANG_ALL }, { ":", CT_COLON, LANG_ALL }, { ";", CT_SEMICOLON, LANG_ALL }, { "<", CT_ANGLE_OPEN, LANG_ALL }, { "=", CT_ASSIGN, LANG_ALL }, { ">", CT_ANGLE_CLOSE, LANG_ALL }, { "?", CT_QUESTION, LANG_ALL }, { "[", CT_SQUARE_OPEN, LANG_ALL }, { "]", CT_SQUARE_CLOSE, LANG_ALL }, { "^", CT_ARITH, LANG_ALL }, { "{", CT_BRACE_OPEN, LANG_ALL }, { "|", CT_ARITH, LANG_ALL }, { "}", CT_BRACE_CLOSE, LANG_ALL }, { "~", CT_INV, LANG_ALL }, }; #include "punctuators.h" const chunk_tag_t *find_punctuator(const char *str, int lang_flags) { const chunk_tag_t *p_match = NULL; const lookup_entry_t *p_tab = punc_table; int ch_idx = 0; /*REVISIT: it might be faster to do a bsearch() on the first char. * the rest of the group have at most 5 entries, so it wouldn't help */ while (ch_idx < 4) { if (p_tab->ch == str[ch_idx]) { /* Match */ if ((p_tab->tag != NULL) && ((p_tab->tag->lang_flags & lang_flags) != 0)) { p_match = p_tab->tag; } if (p_tab->next_idx == 0) { /* This is the end of the chain */ break; } p_tab = &punc_table[p_tab->next_idx]; ch_idx++; } else if (p_tab->left_in_group == 0) { /* The last entry in this group didn't match */ break; } else { p_tab++; } } return(p_match); } uncrustify-0.59/src/keywords.cpp0000644000175000017500000010420411630457175013757 00000000000000/** * @file keywords.cpp * Manages the table of keywords. * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "prototypes.h" #include "char_table.h" #include "args.h" #include #include #include #include #include "unc_ctype.h" using namespace std; /* Dynamic keyword map */ typedef map dkwmap; static dkwmap dkwm; /** * interesting static keywords - keep sorted. * Table should include the Name, Type, and Language flags. */ static const chunk_tag_t keywords[] = { { "@catch", CT_CATCH, LANG_OC | LANG_CPP | LANG_C }, { "@dynamic", CT_OC_DYNAMIC, LANG_OC | LANG_CPP | LANG_C }, { "@end", CT_OC_END, LANG_OC | LANG_CPP | LANG_C }, { "@finally", CT_TRY, LANG_OC | LANG_CPP | LANG_C }, { "@implementation", CT_OC_IMPL, LANG_OC | LANG_CPP | LANG_C }, { "@interface", CT_OC_INTF, LANG_OC | LANG_CPP | LANG_C }, { "@private", CT_PRIVATE, LANG_OC | LANG_CPP | LANG_C }, { "@property", CT_OC_PROPERTY, LANG_OC | LANG_CPP | LANG_C }, { "@protocol", CT_OC_PROTOCOL, LANG_OC | LANG_CPP | LANG_C }, { "@selector", CT_OC_SEL, LANG_OC | LANG_CPP | LANG_C }, { "@synthesize", CT_OC_DYNAMIC, LANG_OC | LANG_CPP | LANG_C }, { "@try", CT_TRY, LANG_OC | LANG_CPP | LANG_C }, { "_Bool", CT_TYPE, LANG_CPP }, { "_Complex", CT_TYPE, LANG_CPP }, { "_Imaginary", CT_TYPE, LANG_CPP }, { "__attribute__", CT_ATTRIBUTE, LANG_C | LANG_CPP }, { "__const__", CT_QUALIFIER, LANG_C | LANG_CPP }, { "__inline__", CT_QUALIFIER, LANG_C | LANG_CPP }, { "__restrict", CT_QUALIFIER, LANG_C | LANG_CPP }, { "__signed__", CT_TYPE, LANG_C | LANG_CPP }, { "__traits", CT_QUALIFIER, LANG_D }, { "__typeof__", CT_SIZEOF, LANG_C | LANG_CPP }, { "__volatile__", CT_QUALIFIER, LANG_C | LANG_CPP }, { "abstract", CT_QUALIFIER, LANG_CS | LANG_D | LANG_JAVA | LANG_VALA | LANG_ECMA }, { "add", CT_GETSET, LANG_CS }, { "alias", CT_QUALIFIER, LANG_D }, { "align", CT_ALIGN, LANG_D }, { "alignof", CT_SIZEOF, LANG_C | LANG_CPP }, { "and", CT_SBOOL, LANG_C | LANG_CPP | FLAG_PP }, { "and_eq", CT_SASSIGN, LANG_C | LANG_CPP }, { "as", CT_AS, LANG_CS }, { "asm", CT_ASM, LANG_C | LANG_CPP | LANG_D }, { "assert", CT_ASSERT, LANG_JAVA }, { "assert", CT_FUNCTION, LANG_D | LANG_PAWN }, // PAWN { "assert", CT_PP_ASSERT, LANG_PAWN | FLAG_PP }, // PAWN { "auto", CT_QUALIFIER, LANG_C | LANG_CPP | LANG_D }, { "base", CT_BASE, LANG_CS | LANG_VALA }, { "bit", CT_TYPE, LANG_D }, { "bitand", CT_ARITH, LANG_C | LANG_CPP }, { "bitor", CT_ARITH, LANG_C | LANG_CPP }, { "body", CT_BODY, LANG_D }, { "bool", CT_TYPE, LANG_CPP | LANG_CS | LANG_VALA }, { "boolean", CT_TYPE, LANG_JAVA | LANG_ECMA }, { "break", CT_BREAK, LANG_ALL }, // PAWN { "byte", CT_TYPE, LANG_CS | LANG_D | LANG_JAVA | LANG_ECMA }, { "callback", CT_QUALIFIER, LANG_VALA }, { "case", CT_CASE, LANG_ALL }, // PAWN { "cast", CT_D_CAST, LANG_D }, { "catch", CT_CATCH, LANG_CPP | LANG_CS | LANG_D | LANG_JAVA | LANG_ECMA }, { "cdouble", CT_TYPE, LANG_D }, { "cent", CT_TYPE, LANG_D }, { "cfloat", CT_TYPE, LANG_D }, { "char", CT_CHAR, LANG_PAWN }, // PAWN { "char", CT_TYPE, LANG_ALLC }, { "checked", CT_QUALIFIER, LANG_CS }, { "class", CT_CLASS, LANG_CPP | LANG_CS | LANG_D | LANG_JAVA | LANG_VALA | LANG_ECMA }, { "compl", CT_ARITH, LANG_C | LANG_CPP }, { "const", CT_QUALIFIER, LANG_ALL }, // PAWN { "const_cast", CT_TYPE_CAST, LANG_CPP }, { "constexpr", CT_QUALIFIER, LANG_CPP }, { "construct", CT_CONSTRUCT, LANG_VALA }, { "continue", CT_CONTINUE, LANG_ALL }, // PAWN { "creal", CT_TYPE, LANG_D }, { "dchar", CT_TYPE, LANG_D }, { "debug", CT_DEBUG, LANG_D }, { "debugger", CT_DEBUGGER, LANG_ECMA }, { "default", CT_DEFAULT, LANG_ALL }, // PAWN { "define", CT_PP_DEFINE, LANG_ALL | FLAG_PP }, // PAWN { "defined", CT_DEFINED, LANG_PAWN }, // PAWN { "defined", CT_PP_DEFINED, LANG_ALLC | FLAG_PP }, { "delegate", CT_DELEGATE, LANG_CS | LANG_D }, { "delete", CT_DELETE, LANG_CPP | LANG_D | LANG_ECMA }, { "deprecated", CT_QUALIFIER, LANG_D }, { "do", CT_DO, LANG_ALL }, // PAWN { "double", CT_TYPE, LANG_ALLC }, { "dynamic_cast", CT_TYPE_CAST, LANG_CPP }, { "elif", CT_PP_ELSE, LANG_ALLC | FLAG_PP }, { "else", CT_ELSE, LANG_ALL }, // PAWN { "else", CT_PP_ELSE, LANG_ALL | FLAG_PP }, // PAWN { "elseif", CT_PP_ELSE, LANG_PAWN | FLAG_PP }, // PAWN { "emit", CT_PP_EMIT, LANG_PAWN | FLAG_PP }, // PAWN { "endif", CT_PP_ENDIF, LANG_ALL | FLAG_PP }, // PAWN { "endinput", CT_PP_ENDINPUT, LANG_PAWN | FLAG_PP }, // PAWN { "endregion", CT_PP_ENDREGION, LANG_ALL | FLAG_PP }, { "endscript", CT_PP_ENDINPUT, LANG_PAWN | FLAG_PP }, // PAWN { "enum", CT_ENUM, LANG_ALL }, // PAWN { "error", CT_PP_ERROR, LANG_PAWN | FLAG_PP }, // PAWN { "event", CT_TYPE, LANG_CS }, { "exit", CT_FUNCTION, LANG_PAWN }, // PAWN { "explicit", CT_TYPE, LANG_C | LANG_CPP | LANG_CS }, { "export", CT_EXPORT, LANG_C | LANG_CPP | LANG_D | LANG_ECMA }, { "extends", CT_QUALIFIER, LANG_JAVA | LANG_ECMA }, { "extern", CT_EXTERN, LANG_C | LANG_CPP | LANG_CS | LANG_D | LANG_VALA }, { "false", CT_WORD, LANG_CPP | LANG_CS | LANG_D | LANG_JAVA | LANG_VALA }, { "file", CT_PP_FILE, LANG_PAWN | FLAG_PP }, // PAWN { "final", CT_QUALIFIER, LANG_D | LANG_ECMA }, { "finally", CT_FINALLY, LANG_D | LANG_CS | LANG_ECMA }, { "flags", CT_TYPE, LANG_VALA }, { "float", CT_TYPE, LANG_ALLC }, { "for", CT_FOR, LANG_ALL }, // PAWN { "foreach", CT_FOR, LANG_CS | LANG_D | LANG_VALA }, { "foreach_reverse", CT_FOR, LANG_D }, { "forward", CT_FORWARD, LANG_PAWN }, // PAWN { "friend", CT_FRIEND, LANG_CPP }, { "function", CT_FUNCTION, LANG_D | LANG_ECMA }, { "get", CT_GETSET, LANG_CS | LANG_VALA }, { "goto", CT_GOTO, LANG_ALL }, // PAWN { "idouble", CT_TYPE, LANG_D }, { "if", CT_IF, LANG_ALL }, // PAWN { "if", CT_PP_IF, LANG_ALL | FLAG_PP }, // PAWN { "ifdef", CT_PP_IF, LANG_ALLC | FLAG_PP }, { "ifloat", CT_TYPE, LANG_D }, { "ifndef", CT_PP_IF, LANG_ALLC | FLAG_PP }, { "implements", CT_QUALIFIER, LANG_JAVA | LANG_ECMA }, { "implicit", CT_QUALIFIER, LANG_CS }, { "import", CT_IMPORT, LANG_D | LANG_JAVA | LANG_ECMA }, // fudged to get indenting { "import", CT_PP_INCLUDE, LANG_OC | FLAG_PP }, // ObjectiveC version of include { "in", CT_IN, LANG_D | LANG_CS | LANG_VALA | LANG_ECMA }, { "include", CT_PP_INCLUDE, LANG_C | LANG_CPP | LANG_PAWN | FLAG_PP }, // PAWN { "inline", CT_QUALIFIER, LANG_C | LANG_CPP }, { "inout", CT_QUALIFIER, LANG_D }, { "instanceof", CT_SIZEOF, LANG_JAVA | LANG_ECMA }, { "int", CT_TYPE, LANG_ALLC }, { "interface", CT_CLASS, LANG_CS | LANG_D | LANG_JAVA | LANG_VALA | LANG_ECMA }, { "internal", CT_QUALIFIER, LANG_CS }, { "invariant", CT_INVARIANT, LANG_D }, { "ireal", CT_TYPE, LANG_D }, { "is", CT_SCOMPARE, LANG_D | LANG_CS | LANG_VALA }, { "lazy", CT_LAZY, LANG_D }, { "line", CT_PP_LINE, LANG_PAWN | FLAG_PP }, // PAWN { "lock", CT_LOCK, LANG_CS | LANG_VALA }, { "long", CT_TYPE, LANG_ALLC }, { "macro", CT_D_MACRO, LANG_D }, { "mixin", CT_CLASS, LANG_D }, // may need special handling { "module", CT_D_MODULE, LANG_D }, { "mutable", CT_QUALIFIER, LANG_C | LANG_CPP }, { "namespace", CT_NAMESPACE, LANG_C | LANG_CPP | LANG_CS | LANG_VALA }, { "native", CT_NATIVE, LANG_PAWN }, // PAWN { "native", CT_QUALIFIER, LANG_JAVA | LANG_ECMA }, { "new", CT_NEW, LANG_CPP | LANG_CS | LANG_D | LANG_JAVA | LANG_PAWN | LANG_VALA | LANG_ECMA }, // PAWN { "not", CT_SARITH, LANG_C | LANG_CPP }, { "not_eq", CT_SCOMPARE, LANG_C | LANG_CPP }, { "null", CT_TYPE, LANG_CS | LANG_D | LANG_JAVA | LANG_VALA }, { "object", CT_TYPE, LANG_CS }, { "operator", CT_OPERATOR, LANG_CPP | LANG_CS | LANG_PAWN }, // PAWN { "or", CT_SBOOL, LANG_C | LANG_CPP | FLAG_PP }, { "or_eq", CT_SASSIGN, LANG_C | LANG_CPP }, { "out", CT_QUALIFIER, LANG_CS | LANG_D | LANG_VALA }, { "override", CT_QUALIFIER, LANG_CS | LANG_D | LANG_VALA }, { "package", CT_NAMESPACE, LANG_D | LANG_JAVA | LANG_ECMA }, { "params", CT_TYPE, LANG_CS }, { "pragma", CT_PP_PRAGMA, LANG_ALL | FLAG_PP }, // PAWN { "private", CT_PRIVATE, LANG_ALLC }, // not C { "protected", CT_PRIVATE, LANG_ALLC }, // not C { "public", CT_PRIVATE, LANG_ALL }, // PAWN // not C { "readonly", CT_QUALIFIER, LANG_CS }, { "real", CT_TYPE, LANG_D }, { "ref", CT_QUALIFIER, LANG_CS | LANG_VALA }, { "region", CT_PP_REGION, LANG_ALL | FLAG_PP }, { "register", CT_QUALIFIER, LANG_C | LANG_CPP }, { "reinterpret_cast", CT_TYPE_CAST, LANG_C | LANG_CPP }, { "remove", CT_GETSET, LANG_CS }, { "restrict", CT_QUALIFIER, LANG_C | LANG_CPP }, { "return", CT_RETURN, LANG_ALL }, // PAWN { "sbyte", CT_TYPE, LANG_CS }, { "scope", CT_D_SCOPE, LANG_D }, { "sealed", CT_QUALIFIER, LANG_CS }, { "section", CT_PP_SECTION, LANG_PAWN | FLAG_PP }, // PAWN { "set", CT_GETSET, LANG_CS | LANG_VALA }, { "short", CT_TYPE, LANG_ALLC }, { "signal", CT_PRIVATE, LANG_VALA }, { "signals", CT_PRIVATE, LANG_CPP }, { "signed", CT_TYPE, LANG_C | LANG_CPP }, { "sizeof", CT_SIZEOF, LANG_C | LANG_CPP | LANG_CS | LANG_PAWN }, // PAWN { "sleep", CT_FUNCTION, LANG_C | LANG_CPP | LANG_CS | LANG_PAWN }, // PAWN { "stackalloc", CT_NEW, LANG_CS }, { "state", CT_STATE, LANG_PAWN }, // PAWN { "static", CT_QUALIFIER, LANG_ALL }, // PAWN { "static_cast", CT_TYPE_CAST, LANG_CPP }, { "stock", CT_STOCK, LANG_PAWN }, // PAWN { "strictfp", CT_QUALIFIER, LANG_JAVA }, { "string", CT_TYPE, LANG_CS }, { "struct", CT_STRUCT, LANG_C | LANG_CPP | LANG_CS | LANG_D | LANG_VALA }, { "super", CT_SUPER, LANG_D | LANG_JAVA | LANG_ECMA }, { "switch", CT_SWITCH, LANG_ALL }, // PAWN { "synchronized", CT_QUALIFIER, LANG_D | LANG_JAVA | LANG_ECMA }, { "tagof", CT_TAGOF, LANG_PAWN }, // PAWN { "template", CT_TEMPLATE, LANG_CPP | LANG_D }, { "this", CT_THIS, LANG_CPP | LANG_CS | LANG_D | LANG_JAVA | LANG_VALA | LANG_ECMA }, { "throw", CT_THROW, LANG_CPP | LANG_CS | LANG_D | LANG_JAVA | LANG_ECMA }, { "throws", CT_QUALIFIER, LANG_JAVA | LANG_ECMA }, { "transient", CT_QUALIFIER, LANG_JAVA | LANG_ECMA }, { "true", CT_WORD, LANG_CPP | LANG_CS | LANG_D | LANG_JAVA | LANG_VALA }, { "try", CT_TRY, LANG_CPP | LANG_CS | LANG_D | LANG_JAVA | LANG_ECMA }, { "tryinclude", CT_PP_INCLUDE, LANG_PAWN | FLAG_PP }, // PAWN { "typedef", CT_TYPEDEF, LANG_C | LANG_CPP | LANG_D }, { "typeid", CT_SIZEOF, LANG_C | LANG_CPP | LANG_D }, { "typename", CT_TYPENAME, LANG_CPP }, { "typeof", CT_SIZEOF, LANG_C | LANG_CPP | LANG_CS | LANG_D | LANG_VALA | LANG_ECMA }, { "ubyte", CT_TYPE, LANG_D }, { "ucent", CT_TYPE, LANG_D }, { "uint", CT_TYPE, LANG_CS | LANG_D }, { "ulong", CT_TYPE, LANG_CS | LANG_D }, { "unchecked", CT_QUALIFIER, LANG_CS }, { "undef", CT_PP_UNDEF, LANG_ALL | FLAG_PP }, // PAWN { "union", CT_UNION, LANG_C | LANG_CPP | LANG_D }, { "unittest", CT_UNITTEST, LANG_D }, { "unsafe", CT_UNSAFE, LANG_CS }, { "unsigned", CT_TYPE, LANG_C | LANG_CPP }, { "ushort", CT_TYPE, LANG_CS | LANG_D }, { "using", CT_USING, LANG_CPP | LANG_CS | LANG_VALA }, { "var", CT_TYPE, LANG_VALA | LANG_ECMA }, { "version", CT_D_VERSION, LANG_D }, { "virtual", CT_QUALIFIER, LANG_CPP | LANG_CS | LANG_VALA }, { "void", CT_TYPE, LANG_ALLC }, { "volatile", CT_QUALIFIER, LANG_C | LANG_CPP | LANG_CS | LANG_JAVA | LANG_ECMA }, { "volatile", CT_VOLATILE, LANG_D }, { "wchar", CT_TYPE, LANG_D }, { "wchar_t", CT_TYPE, LANG_C | LANG_CPP }, { "weak", CT_QUALIFIER, LANG_VALA }, { "while", CT_WHILE, LANG_ALL }, // PAWN { "with", CT_D_WITH, LANG_D | LANG_ECMA }, { "xor", CT_SARITH, LANG_C | LANG_CPP }, { "xor_eq", CT_SASSIGN, LANG_C | LANG_CPP }, }; void init_keywords() { } /** * Compares two chunk_tag_t entries using strcmp on the strings * * @param p1 The 'left' entry * @param p2 The 'right' entry */ static int kw_compare(const void *p1, const void *p2) { const chunk_tag_t *t1 = (const chunk_tag_t *)p1; const chunk_tag_t *t2 = (const chunk_tag_t *)p2; return(strcmp(t1->tag, t2->tag)); } bool keywords_are_sorted(void) { int idx; bool retval = true; for (idx = 1; idx < (int)ARRAY_SIZE(keywords); idx++) { if (kw_compare(&keywords[idx - 1], &keywords[idx]) > 0) { LOG_FMT(LERR, "%s: bad sort order at idx %d, words '%s' and '%s'\n", __func__, idx - 1, keywords[idx - 1].tag, keywords[idx].tag); retval = false; } } return(retval); } /** * Adds a keyword to the list of dynamic keywords * * @param tag The tag (string) must be zero terminated * @param type The type, usually CT_TYPE */ void add_keyword(const char *tag, c_token_t type) { string ss = tag; /* See if the keyword has already been added */ dkwmap::iterator it = dkwm.find(ss); if (it != dkwm.end()) { LOG_FMT(LDYNKW, "%s: changed '%s' to %d\n", __func__, tag, type); (*it).second = type; return; } /* Insert the keyword */ dkwm.insert(dkwmap::value_type(ss, type)); LOG_FMT(LDYNKW, "%s: added '%s' as %d\n", __func__, tag, type); } /** * Backs up to the first string match in keywords. */ static const chunk_tag_t *kw_static_first(const chunk_tag_t *tag) { const chunk_tag_t *prev = tag - 1; while ((prev >= &keywords[0]) && (strcmp(prev->tag, tag->tag) == 0)) { tag = prev; prev--; } //fprintf(stderr, "first:%s -", tag->tag); return(tag); } static const chunk_tag_t *kw_static_match(const chunk_tag_t *tag) { bool in_pp = ((cpd.in_preproc != CT_NONE) && (cpd.in_preproc != CT_PP_DEFINE)); bool pp_iter; const chunk_tag_t *iter; for (iter = kw_static_first(tag); iter < &keywords[ARRAY_SIZE(keywords)]; iter++) { //fprintf(stderr, " check:%s", iter->tag); pp_iter = (iter->lang_flags & FLAG_PP) != 0; if ((strcmp(iter->tag, tag->tag) == 0) && ((cpd.lang_flags & iter->lang_flags) != 0) && (in_pp == pp_iter)) { //fprintf(stderr, " match:%s", iter->tag); return(iter); } } return(NULL); } /** * Search first the dynamic and then the static table for a matching keyword * * @param word Pointer to the text -- NOT zero terminated * @param len The length of the text * @return CT_WORD (no match) or the keyword token */ c_token_t find_keyword_type(const char *word, int len) { string ss(word, len); chunk_tag_t key; const chunk_tag_t *p_ret; if (len <= 0) { return(CT_NONE); } /* check the dynamic word list first */ dkwmap::iterator it = dkwm.find(ss); if (it != dkwm.end()) { return((*it).second); } key.tag = ss.c_str(); /* check the static word list */ p_ret = (const chunk_tag_t *)bsearch(&key, keywords, ARRAY_SIZE(keywords), sizeof(keywords[0]), kw_compare); if (p_ret != NULL) { p_ret = kw_static_match(p_ret); } return((p_ret != NULL) ? p_ret->type : CT_WORD); } /** * Loads the dynamic keywords from a file * * @param filename The path to the file to load * @return SUCCESS or FAILURE */ int load_keyword_file(const char *filename) { FILE *pf; char buf[256]; char *ptr; char *args[3]; int argc; int line_no = 0; pf = fopen(filename, "r"); if (pf == NULL) { LOG_FMT(LERR, "%s: fopen(%s) failed: %s (%d)\n", __func__, filename, strerror(errno), errno); cpd.error_count++; return(FAILURE); } while (fgets(buf, sizeof(buf), pf) != NULL) { line_no++; /* remove comments */ if ((ptr = strchr(buf, '#')) != NULL) { *ptr = 0; } argc = Args::SplitLine(buf, args, ARRAY_SIZE(args) - 1); args[argc] = 0; if (argc > 0) { if ((argc == 1) && CharTable::IsKw1(*args[0])) { add_keyword(args[0], CT_TYPE); } else { LOG_FMT(LWARN, "%s:%d Invalid line (starts with '%s')\n", filename, line_no, args[0]); cpd.error_count++; } } } fclose(pf); return(SUCCESS); } void output_types(FILE *pfile) { if (dkwm.size() > 0) { fprintf(pfile, "-== User Types ==-\n"); for (dkwmap::iterator it = dkwm.begin(); it != dkwm.end(); ++it) { fprintf(pfile, "%s\n", (*it).first.c_str()); } } } void print_keywords(FILE *pfile) { for (dkwmap::iterator it = dkwm.begin(); it != dkwm.end(); ++it) { c_token_t tt = (*it).second; if (tt == CT_TYPE) { fprintf(pfile, "type %*.s%s\n", cpd.max_option_name_len - 4, " ", (*it).first.c_str()); } else if (tt == CT_MACRO_OPEN) { fprintf(pfile, "macro-open %*.s%s\n", cpd.max_option_name_len - 11, " ", (*it).first.c_str()); } else if (tt == CT_MACRO_CLOSE) { fprintf(pfile, "macro-close %*.s%s\n", cpd.max_option_name_len - 12, " ", (*it).first.c_str()); } else if (tt == CT_MACRO_ELSE) { fprintf(pfile, "macro-else %*.s%s\n", cpd.max_option_name_len - 11, " ", (*it).first.c_str()); } else { const char *tn = get_token_name(tt); fprintf(pfile, "set %s %*.s%s\n", tn, int(cpd.max_option_name_len - (4 + strlen(tn))), " ", (*it).first.c_str()); } } } void clear_keyword_file(void) { dkwm.clear(); } /** * Returns the pattern that the keyword needs based on the token */ pattern_class get_token_pattern_class(c_token_t tok) { switch (tok) { case CT_IF: case CT_ELSEIF: case CT_SWITCH: case CT_FOR: case CT_WHILE: case CT_USING_STMT: case CT_LOCK: case CT_D_WITH: case CT_D_VERSION_IF: case CT_D_SCOPE_IF: return(PATCLS_PBRACED); case CT_ELSE: return(PATCLS_ELSE); case CT_DO: case CT_TRY: case CT_FINALLY: case CT_BODY: case CT_UNITTEST: case CT_UNSAFE: case CT_VOLATILE: case CT_GETSET: return(PATCLS_BRACED); case CT_CATCH: case CT_D_VERSION: case CT_DEBUG: return(PATCLS_OPBRACED); case CT_NAMESPACE: return(PATCLS_VBRACED); case CT_WHILE_OF_DO: return(PATCLS_PAREN); case CT_INVARIANT: return(PATCLS_OPPAREN); default: return(PATCLS_NONE); } } uncrustify-0.59/src/Makefile.am0000644000175000017500000000213511642740722013434 00000000000000AUTOMAKE_OPTIONS = foreign no-dependencies DISTCLEANFILES = CLEANFILES = *.o *~ *.bak MAINTAINERCLEANFILES = Makefile.in bin_PROGRAMS = uncrustify BUILT_SOURCES = token_names.h uncrustify_SOURCES = uncrustify.cpp chunk_list.cpp indent.cpp align.cpp combine.cpp \ tokenize.cpp tokenize_cleanup.cpp space.cpp newlines.cpp output.cpp \ args.cpp options.cpp keywords.cpp punctuators.cpp parse_frame.cpp \ logmask.cpp logger.cpp ChunkStack.cpp braces.cpp brace_cleanup.cpp \ align_stack.cpp defines.cpp width.cpp lang_pawn.cpp md5.cpp \ backup.cpp parens.cpp universalindentgui.cpp semicolons.cpp \ sorting.cpp detect.cpp unicode.cpp unc_text.cpp noinst_HEADERS = chunk_list.h options.h char_table.h chunk_list.h \ uncrustify_types.h prototypes.h logmask.h logger.h \ ChunkStack.h args.h token_names.h token_enum.h ListManager.h md5.h \ align_stack.h backup.h base_types.h log_levels.h \ punctuators.h \ uncrustify_version.h \ unc_ctype.h unc_text.h token_names.h: token_enum.h ../make_token_names.sh @echo "Rebuilding token_names.h" @sh ../make_token_names.sh uncrustify_CPPFLAGS = -Wall uncrustify-0.59/src/unc_text.cpp0000644000175000017500000001177311630457175013751 00000000000000/** * @file unc_text.cpp * A simple class that handles the chunk text. * * @author Ben Gardner * @license GPL v2+ */ #include "unc_text.h" #include "prototypes.h" /* encode_utf8() */ static void fix_len_idx(int size, int& idx, int& len) { if (len < 0) { len = size; } if (len > 0) { if (idx < 0) { idx += size; if (idx < 0) { idx = 0; len = 0; return; } } if (idx >= size) { len = 0; } else { int left = size - idx; if (len > left) { len = left; } } } } void unc_text::update_logtext() { if (!m_logok) { /* make a pessimistic guess at the size */ m_logtext.clear(); m_logtext.reserve(m_chars.size() * 3); for (value_type::iterator it = m_chars.begin(); it != m_chars.end(); ++it) { encode_utf8(*it, m_logtext); } m_logtext.push_back(0); m_logok = true; } } int unc_text::compare(const unc_text& ref1, const unc_text& ref2, int len) { int idx, len1, len2; len1 = ref1.size(); len2 = ref2.size(); if (len > 0) { for (idx = 0; (idx < len1) && (idx < len2) && (idx < len); idx++) { if (ref1.m_chars[idx] != ref2.m_chars[idx]) { return(ref1.m_chars[idx] - ref2.m_chars[idx]); } } if (idx == len) { return 0; } return(len1 - len2); } for (idx = 0; (idx < len1) && (idx < len2); idx++) { if (ref1.m_chars[idx] != ref2.m_chars[idx]) { return(ref1.m_chars[idx] - ref2.m_chars[idx]); } } return (len1 - len2); } bool unc_text::equals(const unc_text& ref) const { int len = size(); if (ref.size() != len) { return false; } for (int idx = 0; idx < len; idx++) { if (m_chars[idx] != ref.m_chars[idx]) { return false; } } return true; } const char *unc_text::c_str() { update_logtext(); return (const char *)&m_logtext[0]; } void unc_text::set(int ch) { m_chars.clear(); m_chars.push_back(ch); m_logok = false; } void unc_text::set(const unc_text& ref) { m_chars = ref.m_chars; m_logok = false; } void unc_text::set(const unc_text& ref, int idx, int len) { int size = ref.size(); fix_len_idx(size, idx, len); m_logok = false; if ((idx == 0) && (len == size)) { m_chars = ref.m_chars; } else { m_chars.resize(len); int di = 0; while (len-- > 0) { m_chars[di++] = ref.m_chars[idx++]; } } } void unc_text::set(const string& ascii_text) { int len = ascii_text.size(); m_chars.resize(len); for (int idx = 0; idx < len; idx++) { m_chars[idx] = ascii_text[idx]; } m_logok = false; } void unc_text::set(const char *ascii_text) { int len = strlen(ascii_text); m_chars.resize(len); for (int idx = 0; idx < len; idx++) { m_chars[idx] = *ascii_text++; } m_logok = false; } void unc_text::set(const value_type& data, int idx, int len) { fix_len_idx(data.size(), idx, len); m_chars.resize(len); int di = 0; while (len-- > 0) { m_chars[di++] = data[idx++]; } m_logok = false; } void unc_text::resize(size_t new_size) { if (size() != (int)new_size) { m_chars.resize(new_size); m_logok = false; } } void unc_text::clear() { m_chars.clear(); m_logok = false; } void unc_text::append(int ch) { m_chars.push_back(ch); m_logok = false; } void unc_text::append(const unc_text& ref) { m_chars.insert(m_chars.end(), ref.m_chars.begin(), ref.m_chars.end()); m_logok = false; } void unc_text::append(const string& ascii_text) { unc_text tmp(ascii_text); append(tmp); } void unc_text::append(const char *ascii_text) { unc_text tmp(ascii_text); append(tmp); } void unc_text::append(const value_type& data, int idx, int len) { unc_text tmp(data, idx, len); append(tmp); } bool unc_text::startswith(const char *text, int idx) const { bool match = false; while ((idx < size()) && *text) { if (*text != m_chars[idx]) { return false; } idx++; text++; match = true; } return(match && (*text == 0)); } bool unc_text::startswith(const unc_text& text, int idx) const { bool match = false; int si = 0; while ((idx < size()) && (si < text.size())) { if (text.m_chars[si] != m_chars[idx]) { return false; } idx++; si++; match = true; } return(match && (si == text.size())); } int unc_text::find(const char *text, int sidx) const { int len = strlen(text); int midx = size() - len; int idx, ii; for (idx = sidx; idx < midx; idx++) { bool match = true; for (ii = 0; ii < len; ii++) { if (m_chars[idx + ii] != text[ii]) { match = false; break; } } if (match) { return idx; } } return -1; } uncrustify-0.59/src/lang_pawn.cpp0000644000175000017500000003224111630457175014057 00000000000000/** * @file lang_pawn.cpp * Special functions for pawn stuff * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "ChunkStack.h" #include "prototypes.h" static chunk_t *pawn_process_line(chunk_t *start); static chunk_t *pawn_mark_function0(chunk_t *start, chunk_t *fcn); static chunk_t *pawn_process_variable(chunk_t *start); static chunk_t *pawn_process_func_def(chunk_t *pc); chunk_t *pawn_add_vsemi_after(chunk_t *pc) { if ((pc->type == CT_VSEMICOLON) || (pc->type == CT_SEMICOLON)) { return(pc); } chunk_t *next = chunk_get_next_nc(pc); if ((next != NULL) && ((next->type == CT_VSEMICOLON) || (next->type == CT_SEMICOLON))) { return(pc); } chunk_t chunk; chunk = *pc; chunk.type = CT_VSEMICOLON; chunk.str = cpd.settings[UO_mod_pawn_semicolon].b ? ";" : ""; chunk.column += pc->len(); chunk.parent_type = CT_NONE; LOG_FMT(LPVSEMI, "%s: Added VSEMI on line %d, prev='%s' [%s]\n", __func__, pc->orig_line, pc->str.c_str(), get_token_name(pc->type)); return(chunk_add_after(&chunk, pc)); } /** * Turns certain virtual semicolons invisible. * - after a close brace with a parent of switch, case, else, if */ void pawn_scrub_vsemi(void) { if (!cpd.settings[UO_mod_pawn_semicolon].b) { return; } chunk_t *pc; chunk_t *prev; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type != CT_VSEMICOLON) { continue; } prev = chunk_get_prev_ncnl(pc); if ((prev != NULL) && (prev->type == CT_BRACE_CLOSE)) { if ((prev->parent_type == CT_IF) || (prev->parent_type == CT_ELSE) || (prev->parent_type == CT_SWITCH) || (prev->parent_type == CT_CASE) || (prev->parent_type == CT_WHILE_OF_DO)) { pc->str.clear(); } } } } /** * Checks to see if a token continues a statement to the next line. * We need to check for 'open' braces/paren/etc because the level doesn't * change until the token after the open. */ static bool pawn_continued(chunk_t *pc, int br_level) { if (pc == NULL) { return(false); } if ((pc->level > br_level) || (pc->type == CT_ARITH) || (pc->type == CT_QUESTION) || (pc->type == CT_BOOL) || (pc->type == CT_ASSIGN) || (pc->type == CT_COMMA) || (pc->type == CT_COMPARE) || (pc->type == CT_IF) || (pc->type == CT_ELSE) || (pc->type == CT_DO) || (pc->type == CT_SWITCH) || (pc->type == CT_WHILE) || (pc->type == CT_BRACE_OPEN) || (pc->type == CT_VBRACE_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE) || (pc->parent_type == CT_ELSEIF) || (pc->parent_type == CT_DO) || (pc->parent_type == CT_FOR) || (pc->parent_type == CT_SWITCH) || (pc->parent_type == CT_WHILE) || (pc->parent_type == CT_FUNC_DEF) || (pc->parent_type == CT_ENUM) || ((pc->flags & (PCF_IN_ENUM | PCF_IN_STRUCT)) != 0) || chunk_is_str(pc, ":", 1) || chunk_is_str(pc, "+", 1) || chunk_is_str(pc, "-", 1)) { return(true); } return(false); } /** * Does a scan of level 0 BEFORE stuff in combine.cpp is called. * At this point, VSemis have been added only in VBraces. * Otherwise, all level info is correct, except for unbraced functions. * * We are looking for unbraced functions. */ void pawn_prescan(void) { /* Start at the beginning and step through the entire file, and clean up * any questionable stuff */ chunk_t *pc; bool did_nl = true; pc = chunk_get_head(); while (pc != NULL) { if (did_nl && (pc->type != CT_PREPROC) && !chunk_is_newline(pc) && (pc->level == 0)) { /* pc now points to the start of a line */ pc = pawn_process_line(pc); } /* note that continued lines are ignored */ if (pc != NULL) { did_nl = (pc->type == CT_NEWLINE); } pc = chunk_get_next_nc(pc); } } /** * Functions prototypes and definitions can only appear in level 0. * * Function prototypes start with "native", "forward", or are just a function * with a trailing semicolon instead of a open brace (or something else) * * somefunc(params) <-- def * stock somefunc(params) <-- def * somefunc(params); <-- proto * forward somefunc(params) <-- proto * native somefunc[rect](params) <-- proto * * Functions start with 'stock', 'static', 'public', or '@' (on level 0) * * Variable definitions start with 'stock', 'static', 'new', or 'public'. */ static chunk_t *pawn_process_line(chunk_t *start) { chunk_t *pc; chunk_t *fcn = NULL; //LOG_FMT(LSYS, "%s: %d - %s\n", __func__, // start->orig_line, start->str.c_str()); if ((start->type == CT_NEW) || chunk_is_str(start, "const", 5)) { return(pawn_process_variable(start)); } /* if a open paren is found before an assign, then this is a function */ if (start->type == CT_WORD) { fcn = start; } pc = start; while (((pc = chunk_get_next_nc(pc)) != NULL) && !chunk_is_str(pc, "(", 1) && (pc->type != CT_ASSIGN) && (pc->type != CT_NEWLINE)) { if ((pc->level == 0) && ((pc->type == CT_FUNCTION) || (pc->type == CT_WORD) || (pc->type == CT_OPERATOR_VAL))) { fcn = pc; } } if (pc != NULL) { if (pc->type == CT_ASSIGN) { return(pawn_process_variable(pc)); } } if (fcn != NULL) { //LOG_FMT(LSYS, "FUNCTION: %s\n", fcn->str.c_str()); return(pawn_mark_function0(start, fcn)); } if (start->type == CT_ENUM) { pc = chunk_get_next_type(start, CT_BRACE_CLOSE, start->level); return(pc); } //LOG_FMT(LSYS, "%s: Don't understand line %d, starting with '%s' [%s]\n", // __func__, start->orig_line, start->str.c_str(), get_token_name(start->type)); return(start); } /** * follows a variable definition at level 0 until the end. * Adds a semicolon at the end, if needed. */ static chunk_t *pawn_process_variable(chunk_t *start) { chunk_t *prev = NULL; chunk_t *pc = start; while ((pc = chunk_get_next_nc(pc)) != NULL) { if ((pc->type == CT_NEWLINE) && !pawn_continued(prev, start->level)) { if ((prev->type != CT_VSEMICOLON) && (prev->type != CT_SEMICOLON)) { pawn_add_vsemi_after(prev); } break; } prev = pc; } return(pc); } void pawn_add_virtual_semicolons(void) { chunk_t *prev; chunk_t *pc; /** Add Pawn virtual semicolons */ prev = NULL; if ((cpd.lang_flags & LANG_PAWN) != 0) { pc = chunk_get_head(); while ((pc = chunk_get_next(pc)) != NULL) { if (!chunk_is_comment(pc) && !chunk_is_newline(pc) && (pc->type != CT_VBRACE_CLOSE) && (pc->type != CT_VBRACE_OPEN)) { prev = pc; } if ((prev == NULL) || ((pc->type != CT_NEWLINE) && (pc->type != CT_BRACE_CLOSE) && (pc->type != CT_VBRACE_CLOSE))) { continue; } /* we just hit a newline and we have a previous token */ if (((prev->flags & PCF_IN_PREPROC) == 0) && ((prev->flags & (PCF_IN_ENUM | PCF_IN_STRUCT)) == 0) && (prev->type != CT_VSEMICOLON) && (prev->type != CT_SEMICOLON) && !pawn_continued(prev, prev->brace_level)) { pawn_add_vsemi_after(prev); prev = NULL; } } } } /** * We are on a level 0 function proto of def */ static chunk_t *pawn_mark_function0(chunk_t *start, chunk_t *fcn) { chunk_t *last; /* handle prototypes */ if (start == fcn) { last = chunk_get_next_type(fcn, CT_PAREN_CLOSE, fcn->level); last = chunk_get_next(last); if ((last != NULL) && (last->type == CT_SEMICOLON)) { LOG_FMT(LPFUNC, "%s: %d] '%s' proto due to semicolon\n", __func__, fcn->orig_line, fcn->str.c_str()); fcn->type = CT_FUNC_PROTO; return(last); } } else { if ((start->type == CT_FORWARD) || (start->type == CT_NATIVE)) { LOG_FMT(LPFUNC, "%s: %d] '%s' [%s] proto due to %s\n", __func__, fcn->orig_line, fcn->str.c_str(), get_token_name(fcn->type), get_token_name(start->type)); fcn->type = CT_FUNC_PROTO; return(chunk_get_next_nc(fcn)); } } /* Not a prototype, so it must be a function def */ return(pawn_process_func_def(fcn)); } static chunk_t *pawn_process_func_def(chunk_t *pc) { /* We are on a function definition */ chunk_t *clp; chunk_t *last; chunk_t *next; pc->type = CT_FUNC_DEF; /* If we don't have a brace open right after the close fparen, then * we need to add virtual braces around the function body. */ clp = chunk_get_next_str(pc, ")", 1, 0); last = chunk_get_next_ncnl(clp); if (last != NULL) { LOG_FMT(LPFUNC, "%s: %d] last is '%s' [%s]\n", __func__, last->orig_line, last->str.c_str(), get_token_name(last->type)); } /* See if there is a state clause after the function */ if ((last != NULL) && chunk_is_str(last, "<", 1)) { LOG_FMT(LPFUNC, "%s: %d] '%s' has state angle open %s\n", __func__, pc->orig_line, pc->str.c_str(), get_token_name(last->type)); last->type = CT_ANGLE_OPEN; last->parent_type = CT_FUNC_DEF; while (((last = chunk_get_next(last)) != NULL) && !chunk_is_str(last, ">", 1)) { } if (last != NULL) { LOG_FMT(LPFUNC, "%s: %d] '%s' has state angle close %s\n", __func__, pc->orig_line, pc->str.c_str(), get_token_name(last->type)); last->type = CT_ANGLE_CLOSE; last->parent_type = CT_FUNC_DEF; } last = chunk_get_next_ncnl(last); } if (last == NULL) { return(last); } if (last->type == CT_BRACE_OPEN) { last->parent_type = CT_FUNC_DEF; last = chunk_get_next_type(last, CT_BRACE_CLOSE, last->level); if (last != NULL) { last->parent_type = CT_FUNC_DEF; } } else { LOG_FMT(LPFUNC, "%s: %d] '%s' fdef: expected brace open: %s\n", __func__, pc->orig_line, pc->str.c_str(), get_token_name(last->type)); chunk_t chunk; chunk = *last; chunk.str.clear(); chunk.type = CT_VBRACE_OPEN; chunk.parent_type = CT_FUNC_DEF; chunk_t *prev = chunk_add_before(&chunk, last); last = prev; /* find the next newline at level 0 */ prev = chunk_get_next_ncnl(prev); do { LOG_FMT(LPFUNC, "%s:%d] check %s, level %d\n", __func__, prev->orig_line, get_token_name(prev->type), prev->level); if ((prev->type == CT_NEWLINE) && (prev->level == 0)) { next = chunk_get_next_ncnl(prev); if ((next != NULL) && (next->type != CT_ELSE) && (next->type != CT_WHILE_OF_DO)) { break; } } prev->level++; prev->brace_level++; last = prev; } while ((prev = chunk_get_next(prev)) != NULL); if (last != NULL) { LOG_FMT(LPFUNC, "%s:%d] ended on %s, level %d\n", __func__, last->orig_line, get_token_name(last->type), last->level); } chunk = *last; chunk.str.clear(); chunk.column += last->len(); chunk.type = CT_VBRACE_CLOSE; chunk.level = 0; chunk.brace_level = 0; chunk.parent_type = CT_FUNC_DEF; last = chunk_add_after(&chunk, last); } return(last); } /** * We are in a virtual brace and hit a newline. * If this should end the vbrace, then insert a VSEMICOLON and return that. * * @param pc The newline (CT_NEWLINE) * @return Either the newline or the newly inserted virtual semicolon */ chunk_t *pawn_check_vsemicolon(chunk_t *pc) { chunk_t *vb_open; chunk_t *prev; /* Grab the open VBrace */ vb_open = chunk_get_prev_type(pc, CT_VBRACE_OPEN, -1); /** * Grab the item before the newline * Don't do anything if: * - the only thing previous is the V-Brace open * - in a preprocessor * - level > (vb_open->level + 1) -- ie, in () or [] * - it is something that needs a continuation * + arith, assign, bool, comma, compare */ prev = chunk_get_prev_ncnl(pc); if ((prev == NULL) || (prev == vb_open) || ((prev->flags & PCF_IN_PREPROC) != 0) || pawn_continued(prev, vb_open->level + 1)) { if (prev != NULL) { LOG_FMT(LPVSEMI, "%s: no VSEMI on line %d, prev='%s' [%s]\n", __func__, prev->orig_line, prev->str.c_str(), get_token_name(prev->type)); } return(pc); } return(pawn_add_vsemi_after(prev)); } uncrustify-0.59/src/align_stack.h0000644000175000017500000000251411506773274014040 00000000000000/** * @file align_stack.h * Manages a align stack, which is just a pair of chunk stacks with a few * fancy functions. * * @author Ben Gardner * @license GPL v2+ */ #include "ChunkStack.h" class AlignStack { public: enum StarStyle { SS_IGNORE, // don't look for prev stars SS_INCLUDE, // include prev * before add SS_DANGLE // include prev * after add }; ChunkStack m_aligned; /* contains the token that is aligned */ ChunkStack m_skipped; /* contains the tokens sent to Add() */ int m_max_col; int m_min_col; int m_span; int m_thresh; int m_seqnum; int m_nl_seqnum; int m_gap; bool m_right_align; StarStyle m_star_style; StarStyle m_amp_style; AlignStack() : m_max_col(0), m_min_col(0), m_span(0), m_thresh(0), m_seqnum(0), m_nl_seqnum(0), m_gap(0), m_right_align(false), m_star_style(SS_IGNORE), m_amp_style(SS_IGNORE), m_last_added(0) { } ~AlignStack() { } void Start(int span, int threshold = 0); void Add(chunk_t *pc, int seqnum = 0); void NewLines(int cnt); void Flush(); void Reset(); void End(); protected: int m_last_added; /* 0=none, 1=aligned, 2=skipped */ void ReAddSkipped(); ChunkStack m_scratch; /* used in ReAddSkipped() */ }; uncrustify-0.59/src/tokenize_cleanup.cpp0000644000175000017500000007170211631560313015443 00000000000000/** * @file tokenize_cleanup.cpp * Looks at simple sequences to refine the chunk types. * Examples: * - change '[' + ']' into '[]'/ * - detect "version = 10;" vs "version (xxx) {" * * @author Ben Gardner * @license GPL v2+ */ #include "uncrustify_types.h" #include "prototypes.h" #include "chunk_list.h" #include "char_table.h" #include "unc_ctype.h" #include static void check_template(chunk_t *start); /** * Convert '>' + '>' into '>>' * If we only have a single '>', then change it to CT_COMPARE. */ static chunk_t *handle_double_angle_close(chunk_t *pc) { chunk_t *next = chunk_get_next(pc); if (next != NULL) { if ((pc->type == CT_ANGLE_CLOSE) && (next->type == CT_ANGLE_CLOSE) && (pc->parent_type == CT_NONE) && (memcmp(pc->str, ">>", 2) == 0) && (next->parent_type == CT_NONE)) { pc->str.append('>'); pc->type = CT_ARITH; pc->orig_col_end = next->orig_col_end; chunk_t *tmp = chunk_get_next_ncnl(next); chunk_del(next); next = tmp; } else { pc->type = CT_COMPARE; } } return(next); } static void split_off_angle_close(chunk_t *pc) { chunk_t nc; nc = *pc; const chunk_tag_t *ct; ct = find_punctuator(pc->text() + 1, cpd.lang_flags); if (ct == NULL) { return; } pc->str.resize(1); pc->orig_col_end = pc->orig_col + 1; pc->type = CT_ANGLE_CLOSE; nc.type = ct->type; nc.str.pop_front(); nc.orig_col++; nc.column++; chunk_add_after(&nc, pc); } void tokenize_cleanup(void) { chunk_t *pc = chunk_get_head(); chunk_t *prev = NULL; chunk_t *next; chunk_t *tmp; chunk_t *tmp2; bool in_type_cast = false; /* Since [] is expected to be TSQUARE for the 'operator', we need to make * this change in the first pass. */ for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next_ncnl(pc)) { if (pc->type == CT_SQUARE_OPEN) { next = chunk_get_next_ncnl(pc); if (chunk_is_token(next, CT_SQUARE_CLOSE)) { /* Change '[' + ']' into '[]' */ pc->type = CT_TSQUARE; pc->str = "[]"; chunk_del(next); pc->orig_col_end += 1; } } if ((pc->type == CT_SEMICOLON) && (pc->flags & PCF_IN_PREPROC) && !chunk_get_next_ncnl(pc, CNAV_PREPROC)) { LOG_FMT(LWARN, "%s:%d Detected a macro that ends with a semicolon. Expect failures if used.\n", cpd.filename, pc->orig_line); } } /* We can handle everything else in the second pass */ pc = chunk_get_head(); next = chunk_get_next_ncnl(pc); while ((pc != NULL) && (next != NULL)) { if ((pc->type == CT_DOT) && ((cpd.lang_flags & LANG_ALLC) != 0)) { pc->type = CT_MEMBER; } /* Determine the version stuff (D only) */ if (pc->type == CT_D_VERSION) { if (next->type == CT_PAREN_OPEN) { pc->type = CT_D_VERSION_IF; } else { if (next->type != CT_ASSIGN) { LOG_FMT(LERR, "%s:%d %s: version: Unexpected token %s\n", cpd.filename, pc->orig_line, __func__, get_token_name(next->type)); cpd.error_count++; } pc->type = CT_WORD; } } /* Determine the scope stuff (D only) */ if (pc->type == CT_D_SCOPE) { if (next->type == CT_PAREN_OPEN) { pc->type = CT_D_SCOPE_IF; } else { pc->type = CT_TYPE; } } /** * Change CT_BASE before CT_PAREN_OPEN to CT_WORD. * public myclass() : base() { * } */ if ((pc->type == CT_BASE) && (next->type == CT_PAREN_OPEN)) { pc->type = CT_WORD; } /** * Change CT_WORD after CT_ENUM, CT_UNION, or CT_STRUCT to CT_TYPE * Change CT_WORD before CT_WORD to CT_TYPE */ if (next->type == CT_WORD) { if ((pc->type == CT_ENUM) || (pc->type == CT_UNION) || (pc->type == CT_STRUCT)) { next->type = CT_TYPE; } if (pc->type == CT_WORD) { pc->type = CT_TYPE; } } /* change extern to qualifier if extern isn't followed by a string or * an open paren */ if (pc->type == CT_EXTERN) { if (next->type == CT_STRING) { /* Probably 'extern "C"' */ } else if (next->type == CT_PAREN_OPEN) { /* Probably 'extern (C)' */ } else { /* Something else followed by a open brace */ tmp = chunk_get_next_ncnl(next); if ((tmp != NULL) || (tmp->type != CT_BRACE_OPEN)) { pc->type = CT_QUALIFIER; } } } /** * Change CT_STAR to CT_PTR_TYPE if preceded by CT_TYPE, * CT_QUALIFIER, or CT_PTR_TYPE. */ if ((next->type == CT_STAR) && ((pc->type == CT_TYPE) || (pc->type == CT_QUALIFIER) || (pc->type == CT_PTR_TYPE))) { next->type = CT_PTR_TYPE; } if ((pc->type == CT_TYPE_CAST) && (next->type == CT_ANGLE_OPEN)) { next->parent_type = CT_TYPE_CAST; in_type_cast = true; } /** * Change angle open/close to CT_COMPARE, if not a template thingy */ if ((pc->type == CT_ANGLE_OPEN) && (pc->parent_type != CT_TYPE_CAST)) { check_template(pc); } if ((pc->type == CT_ANGLE_CLOSE) && (pc->parent_type != CT_TEMPLATE)) { if (in_type_cast) { in_type_cast = false; pc->parent_type = CT_TYPE_CAST; } else { next = handle_double_angle_close(pc); } } if ((cpd.lang_flags & LANG_D) != 0) { /* Check for the D string concat symbol '~' */ if ((pc->type == CT_INV) && ((prev->type == CT_STRING) || (prev->type == CT_WORD) || (next->type == CT_STRING))) { pc->type = CT_CONCAT; } /* Check for the D template symbol '!' (word + '!' + word or '(') */ if ((pc->type == CT_NOT) && (prev->type == CT_WORD) && ((next->type == CT_PAREN_OPEN) || (next->type == CT_WORD) || (next->type == CT_TYPE))) { pc->type = CT_D_TEMPLATE; } /* handle "version(unittest) { }" vs "unittest { }" */ if ((pc->type == CT_UNITTEST) && (prev->type == CT_PAREN_OPEN)) { pc->type = CT_WORD; } } if ((cpd.lang_flags & LANG_CPP) != 0) { /* Change Word before '::' into a type */ if ((pc->type == CT_WORD) && (next->type == CT_DC_MEMBER)) { pc->type = CT_TYPE; } } /* Change get/set to CT_WORD if not followed by a brace open */ if ((pc->type == CT_GETSET) && (next->type != CT_BRACE_OPEN)) { if ((next->type == CT_SEMICOLON) && ((prev->type == CT_BRACE_CLOSE) || (prev->type == CT_BRACE_OPEN) || (prev->type == CT_SEMICOLON))) { pc->type = CT_GETSET_EMPTY; next->parent_type = CT_GETSET; } else { pc->type = CT_WORD; } } /* Change item after operator (>=, ==, etc) to a CT_OPERATOR_VAL * Usually the next item is part of the operator. * In a few cases the next few tokens are part of it: * operator + - common case * operator >> - need to combine '>' and '>' * operator () * operator [] - already converted to TSQUARE * operator new [] * operator delete [] * operator const char * * operator const B& * operator std::allocator * * In all cases except the last, this will put the entire operator value * in one chunk. */ if (pc->type == CT_OPERATOR) { tmp2 = chunk_get_next(next); /* Handle special case of () operator -- [] already handled */ if (next->type == CT_PAREN_OPEN) { tmp = chunk_get_next(next); if ((tmp != NULL) && (tmp->type == CT_PAREN_CLOSE)) { next->str = "()"; next->type = CT_OPERATOR_VAL; chunk_del(tmp); next->orig_col_end += 1; } } else if ((next->type == CT_ANGLE_CLOSE) && tmp2 && (tmp2->type == CT_ANGLE_CLOSE) && (tmp2->orig_col == next->orig_col_end)) { next->str.append('>'); next->orig_col_end++; next->type = CT_OPERATOR_VAL; chunk_del(tmp2); } else if (next->flags & PCF_PUNCTUATOR) { next->type = CT_OPERATOR_VAL; } else { next->type = CT_TYPE; /* Replace next with a collection of all tokens that are part of * the type. */ tmp2 = next; while ((tmp = chunk_get_next(tmp2)) != NULL) { if ((tmp->type != CT_WORD) && (tmp->type != CT_TYPE) && (tmp->type != CT_QUALIFIER) && (tmp->type != CT_STAR) && (tmp->type != CT_AMP) && (tmp->type != CT_TSQUARE)) { break; } /* Change tmp into a type so that space_needed() works right */ make_type(tmp); int num_sp = space_needed(tmp2, tmp); while (num_sp-- > 0) { next->str.append(" "); } next->str.append(tmp->str); tmp2 = tmp; } while ((tmp2 = chunk_get_next(next)) != tmp) { chunk_del(tmp2); } next->type = CT_OPERATOR_VAL; next->orig_col_end = next->orig_col + next->len(); } next->parent_type = CT_OPERATOR; LOG_FMT(LOPERATOR, "%s: %d:%d operator '%s'\n", __func__, pc->orig_line, pc->orig_col, next->str.c_str()); } /* Change private, public, protected into either a qualifier or label */ if (pc->type == CT_PRIVATE) { /* Handle Qt slots - maybe should just check for a CT_WORD? */ if (chunk_is_str(next, "slots", 5) || chunk_is_str(next, "Q_SLOTS", 7)) { tmp = chunk_get_next(next); if ((tmp != NULL) && (tmp->type == CT_COLON)) { next = tmp; } } if (next->type == CT_COLON) { next->type = CT_PRIVATE_COLON; if ((tmp = chunk_get_next_ncnl(next)) != NULL) { tmp->flags |= PCF_STMT_START | PCF_EXPR_START; } } else { pc->type = (chunk_is_str(pc, "signals", 7) || chunk_is_str(pc, "Q_SIGNALS", 9)) ? CT_WORD : CT_QUALIFIER; } } /* Look for 'EXEC' 'SQL' */ if (chunk_is_str(pc, "EXEC", 4) && chunk_is_str(next, "SQL", 3)) { tmp = chunk_get_prev(pc); if (chunk_is_newline(tmp)) { tmp = chunk_get_next(next); if (chunk_is_str_case(tmp, "BEGIN", 5)) { pc->type = CT_SQL_BEGIN; } else if (chunk_is_str_case(tmp, "END", 3)) { pc->type = CT_SQL_END; } else { pc->type = CT_SQL_EXEC; } /* Change words into CT_SQL_WORD until CT_SEMICOLON */ while (tmp != NULL) { if (tmp->type == CT_SEMICOLON) { break; } if ((tmp->len() > 0) && isalpha(*tmp->str)) { tmp->type = CT_SQL_WORD; } tmp = chunk_get_next_ncnl(tmp); } } } /* handle MS abomination 'for each' */ if ((pc->type == CT_FOR) && chunk_is_str(next, "each", 4) && (next == chunk_get_next(pc))) { /* merge the two with a space between */ pc->str.append(' '); pc->str += next->str; pc->orig_col_end = next->orig_col_end; chunk_del(next); next = chunk_get_next_ncnl(pc); /* label the 'in' */ if (next && (next->type == CT_PAREN_OPEN)) { tmp = chunk_get_next_ncnl(next); while (tmp && (tmp->type != CT_PAREN_CLOSE)) { if (chunk_is_str(tmp, "in", 2)) { tmp->type = CT_IN; break; } tmp = chunk_get_next_ncnl(tmp); } } } /* ObjectiveC allows keywords to be used as identifiers in some situations * This is a dirty hack to allow some of the more common situations. */ if (cpd.lang_flags & LANG_OC) { if (((pc->type == CT_IF) || (pc->type == CT_FOR) || (pc->type == CT_WHILE)) && !chunk_is_token(next, CT_PAREN_OPEN)) { pc->type = CT_WORD; } if ((pc->type == CT_DO) && (chunk_is_token(prev, CT_MINUS) || chunk_is_token(next, CT_SQUARE_CLOSE))) { pc->type = CT_WORD; } } /* Another hack to clean up more keyword abuse */ if ((pc->type == CT_CLASS) && (chunk_is_token(prev, CT_DOT) || chunk_is_token(next, CT_DOT))) { pc->type = CT_WORD; } /* Detect Objective C class name */ if ((pc->type == CT_OC_IMPL) || (pc->type == CT_OC_INTF) || (pc->type == CT_OC_PROTOCOL)) { if (next->type != CT_PAREN_OPEN) { next->type = CT_OC_CLASS; } next->parent_type = pc->type; tmp = chunk_get_next_ncnl(next); if (tmp != NULL) { tmp->flags |= PCF_STMT_START | PCF_EXPR_START; } tmp = chunk_get_next_type(pc, CT_OC_END, pc->level); if (tmp != NULL) { tmp->parent_type = pc->type; } } if (pc->type == CT_OC_INTF) { tmp = chunk_get_next_ncnl(pc, CNAV_PREPROC); while ((tmp != NULL) && (tmp->type != CT_OC_END)) { if (get_token_pattern_class(tmp->type) != PATCLS_NONE) { LOG_FMT(LOBJCWORD, "@interface %d:%d change '%s' (%s) to CT_WORD\n", pc->orig_line, pc->orig_col, tmp->str.c_str(), get_token_name(tmp->type)); tmp->type = CT_WORD; } tmp = chunk_get_next_ncnl(tmp, CNAV_PREPROC); } } /* Detect Objective-C categories and class extensions */ /* @interface ClassName (CategoryName) */ /* @implementation ClassName (CategoryName) */ /* @interface ClassName () */ /* @implementation ClassName () */ if (((pc->parent_type == CT_OC_IMPL) || (pc->parent_type == CT_OC_INTF) || (pc->type == CT_OC_CLASS)) && (next->type == CT_PAREN_OPEN)) { next->parent_type = pc->parent_type; tmp = chunk_get_next(next); if ((tmp != NULL) && (tmp->next != NULL)) { if (tmp->type == CT_PAREN_CLOSE) { //tmp->type = CT_OC_CLASS_EXT; tmp->parent_type = pc->parent_type; } else { tmp->type = CT_OC_CATEGORY; tmp->parent_type = pc->parent_type; } } tmp = chunk_get_next_type(pc, CT_PAREN_CLOSE, pc->level); if (tmp != NULL) { tmp->parent_type = pc->parent_type; } } /** * Objective C @dynamic and @synthesize * @dynamic xxx, yyy; * @synthesize xxx, yyy; * Just find the semicolon and mark it. */ if (pc->type == CT_OC_DYNAMIC) { tmp = chunk_get_next_type(pc, CT_SEMICOLON, pc->level); if (tmp != NULL) { tmp->parent_type = pc->type; } } /* Detect Objective C @property * @property NSString *stringProperty; * @property(nonatomic, retain) NSMutableDictionary *shareWith; */ if (pc->type == CT_OC_PROPERTY) { if (next->type != CT_PAREN_OPEN) { next->flags |= PCF_STMT_START | PCF_EXPR_START; } else { next->parent_type = pc->type; tmp = chunk_get_next_type(pc, CT_PAREN_CLOSE, pc->level); if (tmp != NULL) { tmp->parent_type = pc->type; tmp = chunk_get_next_ncnl(tmp); if (tmp != NULL) { tmp->flags |= PCF_STMT_START | PCF_EXPR_START; tmp = chunk_get_next_type(tmp, CT_SEMICOLON, pc->level); if (tmp != NULL) { tmp->parent_type = pc->type; } } } } } /* Detect Objective C @selector * @selector(msgNameWithNoArg) * @selector(msgNameWith1Arg:) * @selector(msgNameWith2Args:arg2Name:) */ if ((pc->type == CT_OC_SEL) && (next->type == CT_PAREN_OPEN)) { next->parent_type = pc->type; tmp = chunk_get_next(next); if (tmp != NULL) { tmp->type = CT_OC_SEL_NAME; tmp->parent_type = pc->type; while ((tmp = chunk_get_next_ncnl(tmp)) != NULL) { if (tmp->type == CT_PAREN_CLOSE) { tmp->parent_type = CT_OC_SEL; break; } tmp->type = CT_OC_SEL_NAME; tmp->parent_type = pc->type; } } } /* Mark Objective-C blocks (aka lambdas or closures) * The syntax and usage is exactly like C function pointers with two exceptions: * Instead of an asterisk they have a caret as pointer symbol. * In method declarations which take a block as parameter, there can be anonymous blocks, e.g.: (^) * 1. block literal: ^{ ... }; * 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name can be optional if found as param in a method declaration. * 3. block expression: ^ return_t (int arg) { ... }; NB: return_t is optional * * See http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Blocks for more info... */ if ((cpd.lang_flags & LANG_OC) && (pc->type == CT_ARITH) && (chunk_is_str(pc, "^", 1)) && (prev->type != CT_NUMBER) && (prev->type != CT_NUMBER_FP)) { /* mark objc blocks caret so that we can process it later*/ pc->type = CT_OC_BLOCK_CARET; if (prev->type == CT_PAREN_OPEN) { /* block declaration */ pc->parent_type = CT_OC_BLOCK_TYPE; } else if ((next->type == CT_PAREN_OPEN) || (next->type == CT_BRACE_OPEN)) { /* block expression without return type */ /* block literal */ pc->parent_type = CT_OC_BLOCK_EXPR; } else { /* block expression with return type (seldomly used) */ if (prev->type == CT_ASSIGN) { /* shortcut to spare the peeking below * the XOR operator wouldn't be used directly * after an assign all by itself */ pc->parent_type = CT_OC_BLOCK_EXPR; } else { /* this ones tricky because we don't know how many * stars the return type has - if there even is one */ tmp = pc; while ((tmp = chunk_get_next(tmp)) != NULL) { /* we just peek ahead and see if the line contains * an open brace somewhere. * FIXME: this check needs to be more thorough. */ if (tmp->type == CT_BRACE_OPEN) { pc->parent_type = CT_OC_BLOCK_EXPR; break; } } } } } /* Handle special preprocessor junk */ if (pc->type == CT_PREPROC) { pc->parent_type = next->type; } /* Detect "pragma region" and "pragma endregion" */ if ((pc->type == CT_PP_PRAGMA) && (next->type == CT_PREPROC_BODY)) { if ((memcmp(next->str, "region", 6) == 0) || (memcmp(next->str, "endregion", 9) == 0)) { pc->type = (*next->str == 'r') ? CT_PP_REGION : CT_PP_ENDREGION; prev->parent_type = pc->type; } } /* Check for C# nullable types '?' is in next */ if ((cpd.lang_flags & LANG_CS) && (next->type == CT_QUESTION) && (next->orig_col == (pc->orig_col + pc->len()))) { tmp = chunk_get_next_ncnl(next); if (tmp != NULL) { bool doit = ((tmp->type == CT_PAREN_CLOSE) || (tmp->type == CT_ANGLE_CLOSE)); if (tmp->type == CT_WORD) { tmp2 = chunk_get_next_ncnl(tmp); if ((tmp2 != NULL) && ((tmp2->type == CT_SEMICOLON) || (tmp2->type == CT_ASSIGN) || (tmp2->type == CT_COMMA))) { doit = true; } } if (doit) { pc->str += next->str; chunk_del(next); next = tmp; } } } /* Change 'default(' into a sizeof-like statement */ if ((cpd.lang_flags & LANG_CS) && (pc->type == CT_DEFAULT) && (next->type == CT_PAREN_OPEN)) { pc->type = CT_SIZEOF; } if ((pc->type == CT_UNSAFE) && (next->type != CT_BRACE_OPEN)) { pc->type = CT_QUALIFIER; } if ((pc->type == CT_USING) && (next->type == CT_PAREN_OPEN)) { pc->type = CT_USING_STMT; } /* Add minimal support for C++0x rvalue references */ if ((pc->type == CT_BOOL) && chunk_is_str(pc, "&&", 2)) { if (prev->type == CT_TYPE) { pc->type = CT_BYREF; } } /* HACK: treat try followed by a colon as a qualifier to handle this: * A::A(int) try : B() { } catch (...) { } */ if ((pc->type == CT_TRY) && chunk_is_str(pc, "try", 3) && (next != NULL) && (next->type == CT_COLON)) { pc->type = CT_QUALIFIER; } /* TODO: determine other stuff here */ prev = pc; pc = next; next = chunk_get_next_ncnl(pc); } } /** * If there is nothing but CT_WORD and CT_MEMBER, then it's probably a * template thingy. Otherwise, it's likely a comparison. */ static void check_template(chunk_t *start) { chunk_t *pc; chunk_t *end; chunk_t *prev; chunk_t *next; bool in_if = false; LOG_FMT(LTEMPL, "%s: Line %d, col %d:", __func__, start->orig_line, start->orig_col); prev = chunk_get_prev_ncnl(start, CNAV_PREPROC); if (prev == NULL) { return; } if (prev->type == CT_TEMPLATE) { LOG_FMT(LTEMPL, " CT_TEMPLATE:"); /* We have: "template< ... >", which is a template declaration */ int level = 1; for (pc = chunk_get_next_ncnl(start, CNAV_PREPROC); pc != NULL; pc = chunk_get_next_ncnl(pc, CNAV_PREPROC)) { LOG_FMT(LTEMPL, " [%s,%d]", get_token_name(pc->type), level); if ((pc->str[0] == '>') && (pc->len() > 1)) { LOG_FMT(LTEMPL, " {split '%s' at %d:%d}", pc->str.c_str(), pc->orig_line, pc->orig_col); split_off_angle_close(pc); } if (chunk_is_str(pc, "<", 1)) { level++; } else if (chunk_is_str(pc, ">", 1)) { level--; if (level == 0) { break; } } } end = pc; } else { /* We may have something like "a< ... >", which is a template where * '...' may consist of anything except braces {}, a semicolon, and * unbalanced parens. * if we are inside an 'if' statement and hit a CT_BOOL, then it isn't a * template. */ /* A template requires a word/type right before the open angle */ if ((prev->type != CT_WORD) && (prev->type != CT_TYPE) && (prev->type != CT_OPERATOR_VAL) && (prev->parent_type != CT_OPERATOR)) { LOG_FMT(LTEMPL, " - after %s + ( - Not a template\n", get_token_name(prev->type)); start->type = CT_COMPARE; return; } LOG_FMT(LTEMPL, " - prev %s -", get_token_name(prev->type)); /* Scan back and make sure we aren't inside square parens */ pc = start; while ((pc = chunk_get_prev_ncnl(pc, CNAV_PREPROC)) != NULL) { if ((pc->type == CT_SEMICOLON) || (pc->type == CT_BRACE_OPEN) || (pc->type == CT_BRACE_CLOSE) || (pc->type == CT_SQUARE_CLOSE)) { break; } if ((pc->type == CT_IF) || (pc->type == CT_RETURN)) { in_if = true; break; } if (pc->type == CT_SQUARE_OPEN) { LOG_FMT(LTEMPL, " - Not a template: after a square open\n"); start->type = CT_COMPARE; return; } } /* Scan forward to the angle close * If we have a comparison in there, then it can't be a template. */ c_token_t tokens[1024]; int num_tokens = 1; tokens[0] = CT_ANGLE_OPEN; for (pc = chunk_get_next_ncnl(start, CNAV_PREPROC); pc != NULL; pc = chunk_get_next_ncnl(pc, CNAV_PREPROC)) { LOG_FMT(LTEMPL, " [%s,%d]", get_token_name(pc->type), num_tokens); if ((tokens[num_tokens - 1] == CT_ANGLE_OPEN) && (pc->str[0] == '>') && (pc->len() > 1) && (cpd.settings[UO_tok_split_gte].b || chunk_is_str(pc, ">>", 2))) { LOG_FMT(LTEMPL, " {split '%s' at %d:%d}", pc->str.c_str(), pc->orig_line, pc->orig_col); split_off_angle_close(pc); } if (chunk_is_str(pc, "<", 1)) { tokens[num_tokens++] = CT_ANGLE_OPEN; } else if (chunk_is_str(pc, ">", 1)) { if ((num_tokens > 0) && (tokens[num_tokens - 1] == CT_PAREN_OPEN)) { handle_double_angle_close(pc); } else if (--num_tokens <= 0) { break; } else if (tokens[num_tokens] != CT_ANGLE_OPEN) { /* unbalanced parens */ break; } } else if (in_if && ((pc->type == CT_BOOL) || (pc->type == CT_COMPARE))) { break; } else if ((pc->type == CT_BRACE_OPEN) || (pc->type == CT_BRACE_CLOSE) || (pc->type == CT_SEMICOLON)) { break; } else if (pc->type == CT_PAREN_OPEN) { if (num_tokens >= (int)(ARRAY_SIZE(tokens) - 1)) { break; } tokens[num_tokens++] = pc->type; } else if (pc->type == CT_PAREN_CLOSE) { num_tokens--; if (tokens[num_tokens] != (pc->type - 1)) { /* unbalanced parens */ break; } } } end = pc; } if ((end != NULL) && (end->type == CT_ANGLE_CLOSE)) { pc = chunk_get_next_ncnl(end, CNAV_PREPROC); if ((pc != NULL) && (pc->type != CT_NUMBER)) { LOG_FMT(LTEMPL, " - Template Detected\n"); start->parent_type = CT_TEMPLATE; pc = start; while (pc != end) { next = chunk_get_next_ncnl(pc, CNAV_PREPROC); pc->flags |= PCF_IN_TEMPLATE; if (next->type != CT_PAREN_OPEN) { make_type(pc); } pc = next; } end->parent_type = CT_TEMPLATE; end->flags |= PCF_IN_TEMPLATE; return; } } LOG_FMT(LTEMPL, " - Not a template: end = %s\n", (end != NULL) ? get_token_name(end->type) : ""); start->type = CT_COMPARE; } uncrustify-0.59/src/options.h0000644000175000017500000007136211632023165013246 00000000000000/** * @file options.h * Enum and settings for all the options. * * @author Ben Gardner * @license GPL v2+ */ #ifndef OPTIONS_H_INCLUDED #define OPTIONS_H_INCLUDED #include #include #include enum argtype_e { AT_BOOL, /**< true / false */ AT_IARF, /**< Ignore / Add / Remove / Force */ AT_NUM, /**< Number */ AT_LINE, /**< Line Endings */ AT_POS, /**< start/end or Trail/Lead */ AT_STRING, /**< string value */ }; /** Arg values - these are bit fields*/ enum argval_t { AV_IGNORE = 0, AV_ADD = 1, AV_REMOVE = 2, AV_FORCE = 3, /**< remove + add */ }; /** Line endings */ enum lineends_e { LE_LF, /* "\n" */ LE_CRLF, /* "\r\n" */ LE_CR, /* "\r" */ LE_AUTO, /* keep last */ }; /** Token position - these are bit fields */ enum tokenpos_e { TP_IGNORE = 0, /* don't change it */ TP_BREAK = 1, /* add a newline before or after the if not present */ TP_FORCE = 2, /* force a newline on one side and not the other */ TP_LEAD = 4, /* at the start of a line or leading if wrapped line */ TP_LEAD_BREAK = (TP_LEAD | TP_BREAK), TP_LEAD_FORCE = (TP_LEAD | TP_FORCE), TP_TRAIL = 8, /* at the end of a line or trailing if wrapped line */ TP_TRAIL_BREAK = (TP_TRAIL | TP_BREAK), TP_TRAIL_FORCE = (TP_TRAIL | TP_FORCE), }; union op_val_t { argval_t a; int n; bool b; lineends_e le; tokenpos_e tp; const char *str; }; /** Groups for options */ enum uncrustify_groups { UG_general, UG_indent, UG_space, UG_align, UG_newline, UG_position, UG_linesplit, UG_blankline, UG_codemodify, UG_comment, UG_preprocessor, UG_group_count }; /** * Keep this grouped by functionality */ enum uncrustify_options { UO_newlines, // Set to AUTO, LF, CRLF, or CR /* * Basic Indenting stuff */ //UO_indent, //TODO: 0=don't change indentation, 1=change indentation UO_tok_split_gte, // allow split of '>>=' in template detection UO_utf8_byte, UO_utf8_force, UO_utf8_bom, UO_input_tab_size, // tab size on input file: usually 8 UO_output_tab_size, // tab size for output: usually 8 UO_indent_columns, // ie 3 or 8 UO_indent_continue, UO_indent_with_tabs, // 1=only to the 'level' indent, 2=use tabs for indenting UO_indent_cmt_with_tabs, //UO_indent_brace_struct, //TODO: spaces to indent brace after struct/enum/union def //UO_indent_paren, //TODO: indent for open paren on next line (1) UO_indent_paren_nl, // indent-align under paren for open followed by nl UO_indent_square_nl, // indent-align under square for open followed by nl UO_indent_paren_close, // indent of close paren after a newline UO_indent_comma_paren, // indent of comma if inside a paren UO_indent_bool_paren, // indent of bool if inside a paren UO_indent_first_bool_expr, // if UO_indent_bool_paren == true, aligns the first expression to the following ones UO_pp_indent, // indent preproc 1 space per level (add/ignore/remove) UO_pp_indent_at_level, // indent #if, #else, #endif at brace level UO_pp_indent_count, UO_pp_define_at_level, // indent #define at brace level UO_pp_space, // spaces between # and word (add/ignore/remove) UO_pp_space_count, // the number of spaces for add/force UO_pp_indent_region, // indent of #region and #endregion, see indent_label UO_pp_region_indent_code, // whether to indent the code inside region stuff UO_pp_indent_if, UO_pp_if_indent_code, UO_indent_switch_case, // spaces to indent case from switch UO_indent_case_shift, // spaces to shift the line with the 'case' UO_indent_case_brace, // spaces to indent '{' from case (usually 0 or indent_columns) UO_indent_brace, // spaces to indent '{' from level (usually 0) UO_indent_braces, // whether to indent the braces or not UO_indent_braces_no_func, // whether to not indent the function braces (depends on UO_indent_braces) UO_indent_braces_no_class, // whether to not indent the class braces (depends on UO_indent_braces) UO_indent_braces_no_struct, // whether to not indent the struct braces (depends on UO_indent_braces) UO_indent_brace_parent, // indent the braces based on the parent size (if=3, for=4, etc) UO_indent_label, // 0=left >0=col from left, <0=sub from brace indent UO_indent_access_spec, // same as indent_label, but for "private:", "public:" UO_indent_access_spec_body, // indent private/public/protected inside a class (overrides indent_access_spec) UO_indent_align_string, // True/False - indent align broken strings UO_indent_xml_string, // Number amount to indent XML strings UO_indent_col1_comment, // indent comments in column 1 UO_indent_func_call_param, // indent continued function calls to indent_columns UO_indent_func_proto_param, // same, but for function protos UO_indent_func_def_param, // same, but for function defs UO_indent_func_class_param, // same, but for classes UO_indent_func_ctor_var_param, UO_indent_template_param, UO_indent_func_param_double, // double the tab indent for UO_indent_func_const, // indentation for standalone "const" qualifier UO_indent_func_throw, // indentation for standalone "throw" qualifier UO_indent_namespace, // indent stuff inside namespace braces UO_indent_namespace_level, // level to indent namespace blocks UO_indent_namespace_limit, // no indent if namespace is longer than this UO_indent_extern, UO_indent_class, // indent stuff inside class braces UO_indent_class_colon, // indent stuff after a class colon UO_indent_ctor_init, // additional indenting for ctor initializer lists UO_indent_member, // indent lines broken at a member '.' or '->' UO_indent_sing_line_comments, // indent single line ('//') comments on lines before code UO_indent_relative_single_line_comments, // indent single line ('//') comments after code UO_indent_preserve_sql, // preserve indent of EXEC SQL statement body UO_indent_align_assign, UO_indent_else_if, UO_indent_var_def_blk, // indent a variable def block that appears at the top UO_indent_var_def_cont, /* * Misc inter-element spacing */ UO_sp_paren_brace, // space between ')' and '{' UO_sp_fparen_brace, // space between ')' and '{' of function UO_sp_sparen_brace, // space between ')' and '{' of if, while, etc UO_sp_after_cast, // space after C & D cast - "(int) a" vs "(int)a" UO_sp_inside_paren_cast, // spaces inside the parens of a cast UO_sp_cpp_cast_paren, UO_sp_before_byref, // space before '&' of 'fcn(int& idx)' UO_sp_before_unnamed_byref, UO_sp_after_byref, // space after a '&' as in 'int& var' UO_sp_after_type, // space between type and word UO_sp_inside_fparen, // space inside 'foo( xxx )' vs 'foo(xxx)' UO_sp_inside_fparens, // space inside 'foo( )' vs 'foo()' UO_sp_inside_paren, // space inside '+ ( xxx )' vs '+ (xxx)' UO_sp_inside_square, // space inside 'byte[ 5 ]' vs 'byte[5]' UO_sp_inside_sparen, // space inside 'if( xxx )' vs 'if(xxx)' UO_sp_inside_sparen_close, UO_sp_inside_angle, // space inside '<>', as in '' UO_sp_before_sparen, // space before '(' of 'if/for/while/switch' UO_sp_after_sparen, /* space after ')' of 'if/for/while/switch' * the do-while does not get set here */ UO_sp_after_invariant_paren, UO_sp_invariant_paren, UO_sp_template_angle, UO_sp_before_angle, // space before '<>', as in '' UO_sp_after_angle, // space after '<>', as in '' UO_sp_angle_paren, // space between '<>' and '(' in "a = new List();" UO_sp_angle_word, // space between '<>' and a word in "List a;" UO_sp_angle_shift, // '> >' vs '>>' UO_sp_before_square, // space before single '[' UO_sp_before_squares, // space before '[]', as in 'byte []' UO_sp_paren_paren, // space between nested parens - '( (' vs '((' UO_sp_balance_nested_parens, // balance spaces inside nested parens UO_sp_return_paren, // space between 'return' and '(' UO_sp_sizeof_paren, // space between 'sizeof' and '(' UO_sp_after_comma, // space after ',' UO_sp_before_comma, // space before ',' UO_sp_paren_comma, UO_sp_before_ellipsis, // space before '...' UO_sp_arith, // space around + - / * etc UO_sp_bool, // space around || && UO_sp_pp_concat, // space around ## UO_sp_pp_stringify, // space around # UO_sp_compare, // space around < > ==, etc UO_sp_assign, // space around =, +=, etc UO_sp_assign_default, // space around '=' in prototype UO_sp_before_assign, // space before =, +=, etc UO_sp_after_assign, // space after =, +=, etc UO_sp_enum_assign, // space around = in enum UO_sp_enum_before_assign, // space before = in enum UO_sp_enum_after_assign, // space after = in enum UO_sp_after_class_colon, // space after class ':' UO_sp_before_class_colon, // space before class ':' UO_sp_before_case_colon, UO_sp_func_def_paren, // space between 'func' and '(' - "foo (" vs "foo(" UO_sp_func_call_paren, // space between 'func' and '(' - "foo (" vs "foo(" UO_sp_func_call_paren_empty, UO_sp_func_call_user_paren, UO_sp_func_proto_paren, // space between 'func' and '(' - "foo (" vs "foo(" UO_sp_func_class_paren, // space between ctor/dtor and '(' UO_sp_attribute_paren, // space between '__attribute__' and '(' UO_sp_defined_paren, UO_sp_throw_paren, UO_sp_catch_paren, UO_sp_version_paren, UO_sp_scope_paren, UO_sp_type_func, // space between return type and 'func' // a minimum of 1 is forced except for '*' UO_sp_before_ptr_star, // space before a '*' that is part of a type UO_sp_before_unnamed_ptr_star, UO_sp_after_ptr_star, // space after a '*' that is part of a type UO_sp_after_ptr_star_func, // space between a '*' and a function proto/def UO_sp_before_ptr_star_func, UO_sp_after_byref_func, UO_sp_before_byref_func, UO_sp_between_ptr_star, // space between two '*' that are part of a type UO_sp_special_semi, /* space empty stmt ';' on while, if, for * example "while (*p++ = ' ') ;" */ UO_sp_before_semi, // space before all ';' UO_sp_before_semi_for, // space before the two ';' in a for() - non-empty UO_sp_before_semi_for_empty, // space before ';' in empty for statement UO_sp_after_semi, UO_sp_after_semi_for, UO_sp_after_semi_for_empty, // space after final ';' in empty for statement UO_sp_inside_braces, // space inside '{' and '}' - "{ 1, 2, 3 }" UO_sp_inside_braces_empty, // space inside '{' and '}' - "{ }" UO_sp_inside_braces_enum, // space inside enum '{' and '}' - "{ a, b, c }" UO_sp_inside_braces_struct, // space inside struct/union '{' and '}' UO_sp_macro, // space between macro and value, ie '#define a 6' UO_sp_macro_func, // space between macro and value, ie '#define a 6' UO_sp_square_fparen, // weird pawn stuff: native yark[rect](a[rect]) UO_sp_after_tag, // pawn: space after a tag colon UO_sp_after_operator, // space after operator when followed by a punctuator UO_sp_after_operator_sym, // space after operator when followed by a punctuator UO_sp_else_brace, UO_sp_brace_else, UO_sp_brace_typedef, UO_sp_catch_brace, UO_sp_brace_catch, UO_sp_finally_brace, UO_sp_brace_finally, UO_sp_try_brace, UO_sp_getset_brace, UO_sp_before_dc, UO_sp_after_dc, UO_sp_d_array_colon, UO_sp_not, UO_sp_inv, UO_sp_addr, UO_sp_deref, UO_sp_member, UO_sp_sign, UO_sp_incdec, UO_sp_before_nl_cont, UO_sp_after_oc_scope, UO_sp_before_oc_colon, UO_sp_after_oc_colon, UO_sp_before_send_oc_colon, UO_sp_after_send_oc_colon, UO_sp_after_oc_type, UO_sp_after_oc_return_type, UO_sp_after_oc_at_sel, UO_sp_after_oc_at_sel_parens, UO_sp_inside_oc_at_sel_parens, UO_sp_before_oc_block_caret, UO_sp_after_oc_block_caret, UO_sp_cond_colon, UO_sp_cond_question, UO_sp_case_label, UO_sp_range, UO_sp_cmt_cpp_start, UO_sp_endif_cmt, UO_sp_after_new, UO_sp_before_tr_emb_cmt, // treatment of spaces before comments following code UO_sp_num_before_tr_emb_cmt, // number of spaces before comments following code /* * Line splitting options (for long lines) */ UO_code_width, // ie 80 columns UO_ls_for_split_full, // try to split long 'for' statements at semi-colons UO_ls_func_split_full, // try to split long func proto/def at comma //UO_ls_before_bool_op, //TODO: break line before of after boolean op //UO_ls_before_paren, //TODO: break before open paren //UO_ls_after_arith, //TODO: break after arith op '+', etc //UO_ls_honor_newlines, //TODO: don't remove newlines on split lines /* * code alignment (not left column spaces/tabs) */ UO_align_with_tabs, // use tabs for aligning (0/1) UO_align_keep_tabs, // keep non-indenting tabs UO_align_on_tabstop, // always align on tabstops UO_align_nl_cont, // align the back-slash \n combo (macros) UO_align_enum_equ_span, // align the '=' in enums UO_align_enum_equ_thresh, // threshold for aligning on '=' in enums. 0=no limit UO_align_assign_span, // align on '='. 0=don't align UO_align_assign_thresh, // threshold for aligning on '='. 0=no limit UO_align_right_cmt_span, // align comment that end lines. 0=don't align UO_align_right_cmt_mix, // mix comments after '}' and preproc with others UO_align_right_cmt_gap, UO_align_right_cmt_at_col, // align comment that end lines at or beyond column N; 'pulls in' comments as a bonus side effect UO_align_func_params, // align prototype variable defs on variable UO_align_same_func_call_params, UO_align_var_def_span, // align variable defs on variable (span for regular stuff) UO_align_var_def_thresh, // align variable defs threshold UO_align_var_def_gap, // align variable defs gap UO_align_var_def_colon_gap, // align variable defs gap for bit colons UO_align_var_def_inline, // also align inline struct/enum/union var defs UO_align_var_def_star_style, // see UO_align_typedef_star_style UO_align_var_def_amp_style, // see UO_align_typedef_star_style UO_align_var_def_colon, // align the colon in struct bit fields UO_align_var_def_attribute, UO_align_var_struct_span, // span for struct/union (0=don't align) UO_align_var_struct_thresh, // threshold for struct/union, 0=no limit UO_align_var_struct_gap, // gap for struct/union UO_align_pp_define_span, // align bodies in #define statements //UO_align_pp_define_col_min, //TODO: min column for a #define value //UO_align_pp_define_col_max, //TODO: max column for a #define value UO_align_pp_define_gap, // min space between define label and value "#define a <---> 16" //UO_align_enum_col_min, //TODO: the min column for enum '=' alignment //UO_align_enum_col_max, //TODO: the max column for enum '=' alignment UO_align_struct_init_span, // align structure initializer values UO_align_func_proto_span, // align function prototypes UO_align_func_proto_gap, // align function prototypes UO_align_on_operator, UO_align_mix_var_proto, // mix function prototypes and variable decl UO_align_single_line_func, // mix single line function with prototypes UO_align_single_line_brace, // align the open brace of single line functions UO_align_single_line_brace_gap, // gap for align_single_line_brace UO_align_oc_msg_spec_span, // align ObjC msg spec UO_align_number_left, // left-align numbers (not fully supported, yet) UO_align_typedef_span, // align single-line typedefs UO_align_typedef_gap, // minimum spacing UO_align_typedef_func, // how to align func type with types UO_align_typedef_star_style, // Start aligning style // 0: '*' not part of type // 1: '*' part of the type - no space // 2: '*' part of type, dangling UO_align_typedef_amp_style, // align_typedef_star_style for ref '&' stuff //UO_align_struct_array_brace, // TODO: align array of structure initializers UO_align_left_shift, // UO_align_oc_msg_colon, UO_align_oc_msg_colon_span, UO_align_oc_decl_colon, /* * Newline adding and removing options */ UO_nl_fdef_brace, // "int foo() {" vs "int foo()\n{" UO_nl_func_paren, // newline between function and open paren UO_nl_func_def_paren, UO_nl_func_decl_start, // newline after the '(' in a function decl UO_nl_func_def_start, // newline after the '(' in a function def UO_nl_func_decl_start_single, UO_nl_func_def_start_single, UO_nl_func_decl_args, // newline after each ',' in a function decl UO_nl_func_def_args, UO_nl_func_decl_end, // newline before the ')' in a function decl UO_nl_func_def_end, // newline before the ')' in a function decl UO_nl_func_decl_end_single, UO_nl_func_def_end_single, UO_nl_func_decl_empty, // as above, but for empty parens '()' UO_nl_func_def_empty, // as above, but for empty parens '()' UO_nl_func_type_name, // newline between return type and func name in def UO_nl_func_type_name_class, // newline between return type and func name in class UO_nl_func_scope_name, UO_nl_func_proto_type_name, // nl_func_type_name, but for prottypes UO_nl_func_var_def_blk, // newline after a block of variable defs UO_nl_before_case, // newline before 'case' statement UO_nl_before_throw, UO_nl_after_return, /* newline after return statement */ UO_nl_return_expr, UO_nl_after_case, /* disallow nested "case 1: a=3;" */ UO_nl_after_semicolon, // disallow multiple statements on a line "a=1;b=4;" UO_nl_after_brace_open, // force a newline after a brace open UO_nl_after_brace_open_cmt, // put the newline before the comment UO_nl_after_vbrace_open, // force a newline after a virtual brace open UO_nl_after_vbrace_open_empty, // force a newline after a virtual brace open UO_nl_after_brace_close, // force a newline after a brace close UO_nl_after_vbrace_close, // force a newline after a virtual brace close UO_nl_fcall_brace, /* newline between function call and open brace */ UO_nl_squeeze_ifdef, /* no blanks after #ifxx, #elxx, or before #endif */ UO_nl_enum_brace, /* nl between enum and brace */ UO_nl_struct_brace, /* nl between struct and brace */ UO_nl_union_brace, /* nl between union and brace */ UO_nl_assign_brace, /* nl between '=' and brace */ UO_nl_assign_square, /* nl between '=' and '[' */ UO_nl_after_square_assign, /* nl after '= [' */ UO_nl_class_brace, /* nl between class name and brace */ UO_nl_namespace_brace, /* nl between namespace name and brace */ UO_nl_brace_brace, /* nl between '{{' or '}}' */ UO_nl_do_brace, /* nl between do and { */ UO_nl_if_brace, /* nl between if and { */ UO_nl_for_brace, /* nl between for and { */ UO_nl_else_if, UO_nl_else_brace, /* nl between else and { */ UO_nl_finally_brace, /* nl between finally and { */ UO_nl_brace_finally, /* nl between } and finally */ UO_nl_try_brace, /* nl between try and { */ UO_nl_getset_brace, /* nl between get/set and { */ UO_nl_catch_brace, /* nl between catch and { */ UO_nl_brace_catch, /* nl between } and catch */ UO_nl_while_brace, /* nl between while and { */ UO_nl_using_brace, UO_nl_switch_brace, /* nl between switch and { */ UO_nl_brace_else, // nl between } and else UO_nl_brace_while, // nl between } and while of do stmt UO_nl_multi_line_cond, /* nl between ) and { when cond spans >=2 lines */ UO_nl_elseif_brace, // nl between close paren and open brace in 'else if () {' UO_nl_multi_line_define, // nl after define XXX for multi-line define UO_nl_before_if, // nl before if UO_nl_after_if, // nl after if/else UO_nl_before_for, // nl before for UO_nl_after_for, // nl after for close UO_nl_before_while, // nl before while UO_nl_after_while, // nl after while close UO_nl_before_switch, // nl before switch UO_nl_after_switch, // nl after switch close UO_nl_before_do, // nl before do UO_nl_after_do, // nl after while of do UO_nl_ds_struct_enum_cmt, // nl between commented-elements of struct/enum UO_nl_ds_struct_enum_close_brace, // force nl before } of struct/union/enum UO_nl_define_macro, // alter newlines in #define macros UO_nl_start_of_file, // alter newlines at the start of file UO_nl_start_of_file_min, // min number of newlines at the start of the file UO_nl_end_of_file, // alter newlines at the end of file UO_nl_end_of_file_min, // min number of newlines at the end of the file UO_nl_class_colon, // nl before/after class colon (tied to UO_pos_class_colon) UO_nl_class_init_args, // newline after comma in class init args UO_nl_collapse_empty_body, // change { \n } into {} UO_nl_class_leave_one_liners, // leave one-line function bodies in "class xx { here }" UO_nl_assign_leave_one_liners, // leave one-line assign bodies in "foo_t f = { a, b, c };" UO_nl_enum_leave_one_liners, // leave one-line enum bodies in "enum FOO { BAR = 5 };" UO_nl_getset_leave_one_liners, // leave one-line get/set bodies UO_nl_func_leave_one_liners, // leave one-line function def bodies UO_nl_if_leave_one_liners, UO_nl_case_colon_brace, UO_nl_template_class, // newline between '>' and class in "template class" UO_nl_create_if_one_liner, UO_nl_create_for_one_liner, UO_nl_create_while_one_liner, UO_pos_arith, // position of trailing/leading arithmetic ops UO_pos_assign, // position of trailing/leading = UO_pos_bool, // position of trailing/leading &&/|| UO_pos_compare, // position of trailing/leading <=/>, etc UO_pos_conditional, // position of trailing/leading (b ? t : f) UO_pos_comma, // position of comma in functions UO_pos_class_comma, // position of comma in constructor init list UO_pos_class_colon, // position of trailing/leading class colon /* * Blank line options */ UO_nl_before_block_comment, // before a block comment (stand-alone comment-multi), except after brace open UO_nl_before_cpp_comment, UO_nl_before_c_comment, UO_nl_after_multiline_comment, // NL after multiline comment UO_nl_after_func_body, // after the closing brace of a function body UO_nl_after_func_body_class, UO_nl_after_func_body_one_liner, // after the closing brace of a single line function body UO_nl_after_func_proto, // after each prototype UO_nl_after_func_proto_group, // after a block of prototypes //UO_nl_after_var_def_group, // after a group of variable defs at top of proc //UO_nl_after_ifdef, // after #if or #ifdef - but not if covers whole file UO_nl_after_struct, UO_nl_after_class, UO_nl_max, // maximum consecutive newlines (3 = 2 blank lines) UO_nl_before_access_spec, // number of newlines before "private:", "public:" (0=no change) UO_nl_after_access_spec, // number of newlines after "private:", "public:" (0=no change) UO_nl_comment_func_def, UO_nl_after_try_catch_finally, UO_nl_between_get_set, UO_nl_around_cs_property, UO_nl_property_brace, UO_eat_blanks_after_open_brace, // remove blank lines after { UO_eat_blanks_before_close_brace, // remove blank lines before } /* * code modifying options (non-whitespace) */ UO_mod_paren_on_return, // add or remove paren on return UO_mod_full_brace_nl, // max number of newlines to span w/o braces UO_mod_full_brace_if, // add or remove braces on if UO_mod_full_brace_if_chain, UO_mod_full_brace_for, // add or remove braces on for UO_mod_full_brace_do, // add or remove braces on do UO_mod_full_brace_while, // add or remove braces on while UO_mod_full_brace_using, // add or remove braces on using UO_mod_pawn_semicolon, // add optional semicolons UO_mod_full_brace_function, // add optional braces on Pawn functions UO_mod_full_paren_if_bool, UO_mod_remove_extra_semicolon, // remove extra semicolons UO_mod_add_long_function_closebrace_comment, UO_mod_add_long_switch_closebrace_comment, UO_mod_add_long_ifdef_else_comment, UO_mod_add_long_ifdef_endif_comment, UO_mod_sort_import, UO_mod_sort_using, UO_mod_sort_include, UO_mod_move_case_break, UO_mod_case_brace, UO_mod_remove_empty_return, /* * Comment modifications */ UO_cmt_width, // column to wrap comments UO_cmt_reflow_mode, // comment reflow style UO_cmt_indent_multi, // change left indent of multiline comments UO_cmt_star_cont, // put a star on subsequent comment lines UO_cmt_sp_before_star_cont, // # of spaces for subsequent comment lines (before possible star) UO_cmt_sp_after_star_cont, // # of spaces for subsequent comment lines (after star) UO_cmt_cpp_to_c, // convert CPP comments to C comments UO_cmt_cpp_group, // if UO_cmt_cpp_to_c, try to group in one big C comment UO_cmt_c_group, // try to group neighboring C comments UO_cmt_c_nl_start, // put a blank /* at the start of a combined group UO_cmt_c_nl_end, // put a nl before the */ in a combined group UO_cmt_cpp_nl_start, // put a blank /* at the start of a converted group UO_cmt_cpp_nl_end, // put a nl before the */ in a converted group UO_cmt_multi_check_last, UO_cmt_insert_file_header, UO_cmt_insert_file_footer, UO_cmt_insert_func_header, UO_cmt_insert_class_header, UO_cmt_insert_oc_msg_header, UO_cmt_insert_before_preproc, UO_string_escape_char, // the string escape char to use UO_string_escape_char2, // the string escape char to use /* This is used to get the enumeration count */ UO_option_count }; struct group_map_value { uncrustify_groups id; const char *short_desc; const char *long_desc; list options; }; struct option_map_value { uncrustify_options id; uncrustify_groups group_id; argtype_e type; int min_val; int max_val; const char *name; const char *short_desc; const char *long_desc; }; typedef map::iterator option_name_map_it; typedef map::iterator group_map_it; typedef list::iterator option_list_it; typedef list::const_iterator option_list_cit; #endif /* OPTIONS_H_INCLUDED */ uncrustify-0.59/src/ChunkStack.cpp0000644000175000017500000000357111603715001014134 00000000000000/** * @file ChunkStack.cpp * Manages a chunk stack * * @author Ben Gardner * @license GPL v2+ */ #include "ChunkStack.h" #include #include void ChunkStack::Set(const ChunkStack& cs) { m_cse.resize(cs.m_cse.size()); for (int idx = 0; idx < (int)m_cse.size(); idx++) { m_cse[idx].m_pc = cs.m_cse[idx].m_pc; m_cse[idx].m_seqnum = cs.m_cse[idx].m_seqnum; } m_seqnum = cs.m_seqnum; } const ChunkStack::Entry *ChunkStack::Top() const { if (m_cse.size() > 0) { return(&m_cse[m_cse.size() - 1]); } return(NULL); } const ChunkStack::Entry *ChunkStack::Get(int idx) const { if ((idx >= 0) && (idx < (int)m_cse.size())) { return(&m_cse[idx]); } return(NULL); } chunk_t *ChunkStack::GetChunk(int idx) const { if ((idx >= 0) && (idx < (int)m_cse.size())) { return(m_cse[idx].m_pc); } return(NULL); } chunk_t *ChunkStack::Pop() { chunk_t *pc = NULL; if (m_cse.size() > 0) { pc = m_cse[m_cse.size() - 1].m_pc; m_cse.pop_back(); } return(pc); } void ChunkStack::Push(chunk_t *pc, int seqnum) { m_cse.push_back(Entry(seqnum, pc)); if (m_seqnum < seqnum) { m_seqnum = seqnum; } } /** * Mark an entry to be removed by Collapse() * * @param idx The item to remove */ void ChunkStack::Zap(int idx) { if ((idx >= 0) && (idx < (int)m_cse.size())) { m_cse[idx].m_pc = NULL; } } /** * Compresses down the stack by removing dead entries */ void ChunkStack::Collapse() { int wr_idx = 0; int rd_idx; for (rd_idx = 0; rd_idx < (int)m_cse.size(); rd_idx++) { if (m_cse[rd_idx].m_pc != NULL) { if (rd_idx != wr_idx) { m_cse[wr_idx].m_pc = m_cse[rd_idx].m_pc; m_cse[wr_idx].m_seqnum = m_cse[rd_idx].m_seqnum; } wr_idx++; } } m_cse.resize(wr_idx); } uncrustify-0.59/src/uncrustify_version.h.in0000644000175000017500000000056211506773274016147 00000000000000/** * @file uncrustify_version.h * Simply defines UNCRUSTIFY_VERSION. * I don't particularly like how autoconf and friends handle the version... * * @author Ben Gardner * @license GPL v2+ */ #ifndef UNCRUSTIFY_VERSION_H_INCLUDED #define UNCRUSTIFY_VERSION_H_INCLUDED #define UNCRUSTIFY_VERSION "@PACKAGE_VERSION@" #endif /* UNCRUSTIFY_VERSION_H_INCLUDED */ uncrustify-0.59/src/backup.h0000644000175000017500000000311711630457175013023 00000000000000/** * @file backup.h * Handles backing up file data. * * It works like this: * * 1. Read in the file data * * 2. Call backup_copy_file() to create a backup of the input, if needed * * 3. Do the uncrustify magic and write the output file * * 4. Call backup_create_md5_file() * * This will let you run uncrustify multiple times over the same file without * losing the original file. If you edit the file, then a new backup is made. * * @author Ben Gardner * @license GPL v2+ */ #ifndef BACKUP_H_INCLUDED #define BACKUP_H_INCLUDED #define UNC_BACKUP_SUFFIX ".unc-backup~" #define UNC_BACKUP_MD5_SUFFIX ".unc-backup.md5~" /** * If there isn't a FILENAME+UNC_BACKUP_MD5_SUFFIX or the md5 over the data * doesn't match what is in FILENAME+UNC_BACKUP_MD5_SUFFIX, then write the * data to FILENAME+UNC_BACKUP_SUFFIX. * * Note that if this fails, we shouldn't overwrite to original file with the * output. * * @param filename The file that was read (full path) * @param file_data The file data * @param file_len The file length * @return SUCCESS or FAILURE */ int backup_copy_file(const char *filename, const vector& data); /** * This calculates the MD5 over the file and writes the MD5 to * FILENAME+UNC_BACKUP_MD5_SUFFIX.* * This should be called after the file was written to disk. * We really don't care if it fails, as the MD5 just prevents us from backing * up a file that uncrustify created. * * @param filename The file that was written (full path) */ void backup_create_md5_file(const char *filename); #endif /* BACKUP_H_INCLUDED */ uncrustify-0.59/src/args.cpp0000644000175000017500000001221511506773274013047 00000000000000/** * @file args.cpp * Parses command line arguments. * * @author Ben Gardner * @license GPL v2+ */ #include "args.h" #include #include "unc_ctype.h" /** * Store the values and allocate enough memory for the 'used' flags. * * @param argc The argc that was passed to main() * @param argv The argv that was passed to main() */ Args::Args(int argc, char **argv) { m_count = argc; m_values = argv; int len = (argc >> 3) + 1; m_used = new UINT8[len]; if (m_used != NULL) { memset(m_used, 0, len); } } Args::~Args() { if (m_used != NULL) { delete[] m_used; m_used = NULL; } m_count = 0; } /** * Check for an exact match * * @param token The token string to match * @return true/false -- Whether the argument was present */ bool Args::Present(const char *token) { int idx; if (token != NULL) { for (idx = 0; idx < m_count; idx++) { if (strcmp(token, m_values[idx]) == 0) { SetUsed(idx); return(true); } } } return(false); } /** * Just call arg_params() with an index of 0. * * @param token The token string to match * @return NULL or the pointer to the string */ const char *Args::Param(const char *token) { int idx = 0; return(Params(token, idx)); } /** * Scan for a match * * @param token The token string to match * @return NULL or the pointer to the string */ const char *Args::Params(const char *token, int& index) { int idx; int token_len; int arg_len; if (token == NULL) { return(NULL); } token_len = (int)strlen(token); for (idx = index; idx < m_count; idx++) { arg_len = (int)strlen(m_values[idx]); if ((arg_len >= token_len) && (memcmp(token, m_values[idx], token_len) == 0)) { SetUsed(idx); if (arg_len > token_len) { if (m_values[idx][token_len] == '=') { token_len++; } index = idx + 1; return(&m_values[idx][token_len]); } idx++; index = idx + 1; if (idx < m_count) { SetUsed(idx); return(m_values[idx]); } return(""); } } return(NULL); } /** * Gets whether an argument has been used, by index. * * @param idx The index of the argument */ bool Args::GetUsed(int idx) { if ((m_used != NULL) && (idx >= 0) && (idx < m_count)) { return((m_used[idx >> 3] & (1 << (idx & 0x07))) != 0); } return(false); } /** * Marks an argument as being used. * * @param idx The index of the argument */ void Args::SetUsed(int idx) { if ((m_used != NULL) && (idx >= 0) && (idx < m_count)) { m_used[idx >> 3] |= (1 << (idx & 0x07)); } } /** * This function retrieves all unused parameters. * You must set the index before the first call. * Set the index to 1 to skip argv[0]. * * @param idx Pointer to the index * @return NULL (done) or the pointer to the string */ const char *Args::Unused(int& index) { int idx; if (m_used == NULL) { return(NULL); } for (idx = index; idx < m_count; idx++) { if (!GetUsed(idx)) { index = idx + 1; return(m_values[idx]); } } index = m_count; return(NULL); } /** * Takes text and splits it into arguments. * args is an array of char * pointers that will get populated. * num_args is the maximum number of args split off. * If there are more than num_args, the remaining text is ignored. * Note that text is modified (zeroes are inserted) * * @param text The text to split (modified) * @param args The char * array to populate * @param num_args The number of items in args * @return The number of arguments parsed (always <= num_args) */ int Args::SplitLine(char *text, char *args[], int num_args) { char cur_quote = 0; bool in_backslash = false; bool in_arg = false; int argc = 0; char *dest = text; while ((*text != 0) && (argc <= num_args)) { /* Detect the start of an arg */ if (!in_arg && !unc_isspace(*text)) { in_arg = true; args[argc] = dest; argc++; } if (in_arg) { if (in_backslash) { in_backslash = false; *dest = *text; dest++; } else if (*text == '\\') { in_backslash = true; } else if (*text == cur_quote) { cur_quote = 0; } else if ((*text == '\'') || (*text == '"') || (*text == '`')) { cur_quote = *text; } else if (cur_quote != 0) { *dest = *text; dest++; } else if (unc_isspace(*text)) { *dest = 0; dest++; in_arg = false; if (argc == num_args) { break; } } else { *dest = *text; dest++; } } text++; } *dest = 0; return(argc); } uncrustify-0.59/src/logger.h0000644000175000017500000000715611614421167013036 00000000000000/** * @file logger.h * * Functions to do logging. * The macros check whether the logsev is active before evaluating the * parameters. Use them instead of the functions. * * If a log statement ends in a newline, the current log is ended. * When the log severity changes, an implicit newline is inserted. * * @author Ben Gardner * @license GPL v2+ */ #ifndef LOGGER_H_INCLUDED #define LOGGER_H_INCLUDED #include "logmask.h" #include /* strlen() */ #include /* FILE */ /** * Initializes the log subsystem - call this first. * This function sets the log stream and enables the top 3 sevs (0-2). * * @param log_file NULL for stderr or the FILE stream for logs. */ void log_init(FILE *log_file); /** * Show or hide the severity prefix "<1>" * * @param true=show false=hide */ void log_show_sev(bool show); /** * Returns whether a log severity is active. * * @param sev The severity * @return true/false */ bool log_sev_on(log_sev_t sev); /** * Sets a log sev on or off * * @param sev The severity * @return true/false */ void log_set_sev(log_sev_t sev, bool value); /** * Sets the log mask * * @param mask The mask to copy */ void log_set_mask(const log_mask_t& mask); /** * Gets the log mask * * @param mask Where to copy the mask */ void log_get_mask(log_mask_t& mask); /** * Logs a string of known length * * @param sev The severity * @param str The pointer to the string * @param len The length of the string from strlen(str) */ void log_str(log_sev_t sev, const char *str, int len); #define LOG_STR(sev, str, len) \ do { if (log_sev_on(sev)) { log_str(sev, str, len); } } while (0) #define LOG_STRING(sev, str) \ do { if (log_sev_on(sev)) { log_str(sev, str, strlen(str)); } } while (0) /** * Logs a formatted string -- similiar to printf() * * @param sev The severity * @param fmt The format string * @param ... Additional arguments */ void log_fmt(log_sev_t sev, const char *fmt, ...) __attribute__((format(printf, 2, 3))); #ifdef NO_MACRO_VARARG #define LOG_FMT log_fmt #else #define LOG_FMT(sev, args...) \ do { if (log_sev_on(sev)) { log_fmt(sev, ## args); } } while (0) #endif /** * Dumps hex characters inline, no newlines inserted * * @param sev The severity * @param data The data to log * @param len The number of bytes to log */ void log_hex(log_sev_t sev, const void *vdata, int len); #define LOG_HEX(sev, ptr, len) \ do { if (log_sev_on(sev)) { log_hex(sev, ptr, len); } } while (0) /** * Logs a block of data in a pretty hex format * Numbers on the left, characters on the right, just like I like it. * * "nnn | XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX | ................" * 0 ^6 54^ ^56 72^ * * nnn is the line number or index/16 * * @param sev The severity * @param data The data to log * @param len The number of bytes to log */ void log_hex_blk(log_sev_t sev, const void *data, int len); #define LOG_HEX_BLK(sev, ptr, len) \ do { if (log_sev_on(sev)) { log_hex_blk(sev, ptr, len); } } while (0) /** * Returns the HEX digit for a low nibble in a number * * @param nibble The nibble * @return '0', '1', '2', '3', '4', '5', '6', '7', * '8', '9', 'a', 'b', 'c', 'd', 'e', or 'f' */ static_inline char to_hex_char(int nibble) { const char *hex_string = "0123456789abcdef"; return(hex_string[nibble & 0x0F]); } #endif /* LOGGER_H_INCLUDED */ uncrustify-0.59/src/punctuators.h0000644000175000017500000000715711506773274014160 00000000000000/** * @file punctuators.h * Automatically generated */ static const lookup_entry_t punc_table[] = { { '!', 25, 26, &symbols1[0] }, // 0: '!' { '#', 24, 35, &symbols1[1] }, // 1: '#' { '$', 23, 0, &symbols1[2] }, // 2: '$' { '%', 22, 37, &symbols1[3] }, // 3: '%' { '&', 21, 38, &symbols1[4] }, // 4: '&' { '(', 20, 0, &symbols1[5] }, // 5: '(' { ')', 19, 0, &symbols1[6] }, // 6: ')' { '*', 18, 40, &symbols1[7] }, // 7: '*' { '+', 17, 41, &symbols1[8] }, // 8: '+' { ',', 16, 0, &symbols1[9] }, // 9: ',' { '-', 15, 43, &symbols1[10] }, // 10: '-' { '.', 14, 47, &symbols1[11] }, // 11: '.' { '/', 13, 50, &symbols1[12] }, // 12: '/' { ':', 12, 51, &symbols1[13] }, // 13: ':' { ';', 11, 0, &symbols1[14] }, // 14: ';' { '<', 10, 52, &symbols1[15] }, // 15: '<' { '=', 9, 57, &symbols1[16] }, // 16: '=' { '>', 8, 60, &symbols1[17] }, // 17: '>' { '?', 7, 65, &symbols1[18] }, // 18: '?' { '[', 6, 66, &symbols1[19] }, // 19: '[' { ']', 5, 0, &symbols1[20] }, // 20: ']' { '^', 4, 67, &symbols1[21] }, // 21: '^' { '{', 3, 0, &symbols1[22] }, // 22: '{' { '|', 2, 68, &symbols1[23] }, // 23: '|' { '}', 1, 0, &symbols1[24] }, // 24: '}' { '~', 0, 70, &symbols1[25] }, // 25: '~' { '<', 3, 30, &symbols2[0] }, // 26: '!<' { '=', 2, 33, &symbols2[1] }, // 27: '!=' { '>', 1, 34, &symbols2[2] }, // 28: '!>' { '~', 0, 0, &symbols2[3] }, // 29: '!~' { '=', 1, 0, &symbols3[0] }, // 30: '!<=' { '>', 0, 32, &symbols3[1] }, // 31: '!<>' { '=', 0, 0, &symbols4[0] }, // 32: '!<>=' { '=', 0, 0, &symbols3[2] }, // 33: '!==' { '=', 0, 0, &symbols3[3] }, // 34: '!>=' { '#', 1, 0, &symbols2[4] }, // 35: '##' { '@', 0, 0, &symbols2[5] }, // 36: '#@' { '=', 0, 0, &symbols2[6] }, // 37: '%=' { '&', 1, 0, &symbols2[7] }, // 38: '&&' { '=', 0, 0, &symbols2[8] }, // 39: '&=' { '=', 0, 0, &symbols2[9] }, // 40: '*=' { '+', 1, 0, &symbols2[10] }, // 41: '++' { '=', 0, 0, &symbols2[11] }, // 42: '+=' { '-', 2, 0, &symbols2[12] }, // 43: '--' { '=', 1, 0, &symbols2[13] }, // 44: '-=' { '>', 0, 46, &symbols2[14] }, // 45: '->' { '*', 0, 0, &symbols3[4] }, // 46: '->*' { '*', 1, 0, &symbols2[15] }, // 47: '.*' { '.', 0, 49, &symbols2[16] }, // 48: '..' { '.', 0, 0, &symbols3[5] }, // 49: '...' { '=', 0, 0, &symbols2[17] }, // 50: '/=' { ':', 0, 0, &symbols2[18] }, // 51: '::' { '<', 2, 55, &symbols2[19] }, // 52: '<<' { '=', 1, 0, &symbols2[20] }, // 53: '<=' { '>', 0, 56, &symbols2[21] }, // 54: '<>' { '=', 0, 0, &symbols3[6] }, // 55: '<<=' { '=', 0, 0, &symbols3[7] }, // 56: '<>=' { '=', 1, 59, &symbols2[22] }, // 57: '==' { '>', 0, 0, &symbols2[31] }, // 58: '=>' { '=', 0, 0, &symbols3[8] }, // 59: '===' { '=', 1, 0, &symbols2[23] }, // 60: '>=' { '>', 0, 62, &symbols2[24] }, // 61: '>>' { '=', 1, 0, &symbols3[9] }, // 62: '>>=' { '>', 0, 64, &symbols3[10] }, // 63: '>>>' { '=', 0, 0, &symbols4[1] }, // 64: '>>>=' { '?', 0, 0, &symbols2[32] }, // 65: '??' { ']', 0, 0, &symbols2[25] }, // 66: '[]' { '=', 0, 0, &symbols2[26] }, // 67: '^=' { '=', 1, 0, &symbols2[27] }, // 68: '|=' { '|', 0, 0, &symbols2[28] }, // 69: '||' { '=', 1, 0, &symbols2[29] }, // 70: '~=' { '~', 0, 0, &symbols2[30] }, // 71: '~~' }; uncrustify-0.59/man/0000755000175000017500000000000011642741502011440 500000000000000uncrustify-0.59/man/uncrustify.1.in0000644000175000017500000001024011506773274014271 00000000000000.TH UNCRUSTIFY "1" "Oct 2009" "uncrustify @PACKAGE_VERSION@" "User Commands" .SH NAME uncrustify \- C, C++, C#, D, Java and Pawn source code beautifier .SH SYNOPSIS .B uncrustify \fR[\fIOPTIONS\fR] [\fIFILES\fR] .SH DESCRIPTION If no input files are specified, the input is read from stdin. .br If reading from stdin, you should specify the language using \-l. If \-F is used or files are specified on the command line, the output filename is \fIPFX\fR + "/" + filename + \fISFX\fR. .br Unless, of course, the options \fB\-\-replace\fR or \fB\-\-no\-backup\fR are used. When reading from stdin or doing a single file via the '\-f' option, the output is dumped to stdout, unless redirected with \-o FILE. Errors are always dumped to stderr .SH OPTIONS .SS "Basic Options:" .TP \fB\-c\fI CFG Use the config file \fICFG\fR. .br If not specified, uncrustify will use \fB$UNCRUSTIFY_CONFIG\fR or \fB$HOME\\.uncrustify.cfg\fR. .TP \fB\-f\fI FILE Process the single file \fIFILE\fR, sending output to stdout or the file specified with \fB\-o\fR. .TP \fB\-o\fI FILE Redirect output to \fIFILE\fR. .br Use with \fB\-f\fR, \fB\-\-update\-config\fR, \fB\-\-update\-config\-with\-doc\fR, \fB\-\-universalindent\fR. .TP \fB\-F\fI FILE Read files to process from \fIFILE\fR, one filename per line. .br You can create this file using something like \'\fBfind . \-name "*.c" > list.txt\fR\'. .br This cannot be combined with \fB\-f\fR. .TP \fB\-\-prefix\fI PFX Prepend \fIPFX\fR to the output filename path. .br This cannot be combined with \fB\-f\fR, \fB\-\-replace\fR, or \fB\-\-no\-backup\fR. .TP \fB\-\-suffix\fI SFX Append \fISFX\fR to the output filename. .br The default is '.uncrustify' if neither \fISFX\fR or \fIPFX\fR are specified. .br This cannot be combined with \fB\-f\fR, \fB\-\-replace\fR, or \fB\-\-no\-backup\fR. .TP \fB\-\-frag\fI Assume the input is a code fragment and the first line is properly indented. .TP \fB\-\-replace\fR Replace source files (creates a backup). .br This cannot be combined with \fB\-f\fR, \fB\-\-prefix\fR, or \fB\-\-suffix\fR. .TP \fB\-\-no\-backup\fR Replace files, no backup. Useful if files are under source control .br This cannot be combined with \fB\-f\fR, \fB\-\-prefix\fR, or \fB\-\-suffix\fR. .TP \fB\-\-mtime\fR Preserve mtime on replaced files. .TP \fB\-l\fR Language override: C, CPP, D, CS, JAVA, PAWN, VALA, OC, OC+ .TP \fB\-t\fR Load a file with types (usually not needed) .TP \fB\-q\fR Quiet mode \- no output on stderr (\fB\-L\fR will override) .SS "Config/Help Options:" .TP \fB\-h\fR \-? \fB\-\-help\fR \fB\-\-usage\fR Print this message and exit .TP \fB\-\-version\fR Print the version and exit .TP \fB\-\-show\-config\fR Print out option documentation and exit .TP \fB\-\-update\-config\fR Output a new config file. .TP \fB\-\-update\-config\-with\-doc\fR Output a new config file with embedded usage comments. .TP \fB\-\-universalindent\fR Output a config file for Universal Indent GUI. .TP \fB\-\-detect\fR Detects the config from a source file. Use with '\-f FILE'. Detection is currently fairly limited. .SS "Debug Options:" .TP \fB\-p\fI FILE Dump debug info to a file .TP \fB\-L\fI SEV Set the log severity (see log_levels.h) .TP \fB\-s\fR Show the log severity in the logs .TP \fB\-\-decode\fI FLAG Print \fIFLAG\fR as text and exit .SH EXAMPLES .TP Read a D file from stdin, output to stdout. cat foo.d | uncrustify \-q \-c my.cfg \-l d .TP Process a file, output to stdout. uncrustify \-c my.cfg \-d foo.d .TP Process a source tree, output to a different tree. find src \-name "*.[ch]" > files.txt .br uncrustify \-c my.cfg \-F files.txt \-\-prefix out .TP Process a source tree in\(hyplace. uncrustify \-c my.cfg \-\-no\-backup $(find src \-name "*.[ch]") .SH NOTES Use comments containing ' *INDENT\-OFF*' and ' *INDENT\-ON*' to disable processing of parts of the source file. .SH AUTHOR Written by Ben Gardner .SH REPORTING BUGS Use the issue tracker at .SH COPYRIGHT Copyright (C) 2006\(hy2009 Ben Gardner .SH LICENSE GNU GPL version 2 or later This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. uncrustify-0.59/man/Makefile.in0000644000175000017500000004713411642741011013431 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/uncrustify.1.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = uncrustify.1 CONFIG_CLEAN_VPATH_FILES = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man_MANS = uncrustify.1 uncrustify_man_mans = uncrustify.1 EXTRA_DIST = $(uncrustify_man_mans) all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): uncrustify.1: $(top_builddir)/config.status $(srcdir)/uncrustify.1.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-man1: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile $(MANS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-man install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-man1 install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic ctags \ ctags-recursive distclean distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-man uninstall-man1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: uncrustify-0.59/man/Makefile.am0000644000175000017500000000015511506773274013427 00000000000000SUBDIRS = man_MANS = uncrustify.1 uncrustify_man_mans = uncrustify.1 EXTRA_DIST = $(uncrustify_man_mans) uncrustify-0.59/man/uncrustify.10000644000175000017500000001022311642741035013654 00000000000000.TH UNCRUSTIFY "1" "Oct 2009" "uncrustify 0.59" "User Commands" .SH NAME uncrustify \- C, C++, C#, D, Java and Pawn source code beautifier .SH SYNOPSIS .B uncrustify \fR[\fIOPTIONS\fR] [\fIFILES\fR] .SH DESCRIPTION If no input files are specified, the input is read from stdin. .br If reading from stdin, you should specify the language using \-l. If \-F is used or files are specified on the command line, the output filename is \fIPFX\fR + "/" + filename + \fISFX\fR. .br Unless, of course, the options \fB\-\-replace\fR or \fB\-\-no\-backup\fR are used. When reading from stdin or doing a single file via the '\-f' option, the output is dumped to stdout, unless redirected with \-o FILE. Errors are always dumped to stderr .SH OPTIONS .SS "Basic Options:" .TP \fB\-c\fI CFG Use the config file \fICFG\fR. .br If not specified, uncrustify will use \fB$UNCRUSTIFY_CONFIG\fR or \fB$HOME\\.uncrustify.cfg\fR. .TP \fB\-f\fI FILE Process the single file \fIFILE\fR, sending output to stdout or the file specified with \fB\-o\fR. .TP \fB\-o\fI FILE Redirect output to \fIFILE\fR. .br Use with \fB\-f\fR, \fB\-\-update\-config\fR, \fB\-\-update\-config\-with\-doc\fR, \fB\-\-universalindent\fR. .TP \fB\-F\fI FILE Read files to process from \fIFILE\fR, one filename per line. .br You can create this file using something like \'\fBfind . \-name "*.c" > list.txt\fR\'. .br This cannot be combined with \fB\-f\fR. .TP \fB\-\-prefix\fI PFX Prepend \fIPFX\fR to the output filename path. .br This cannot be combined with \fB\-f\fR, \fB\-\-replace\fR, or \fB\-\-no\-backup\fR. .TP \fB\-\-suffix\fI SFX Append \fISFX\fR to the output filename. .br The default is '.uncrustify' if neither \fISFX\fR or \fIPFX\fR are specified. .br This cannot be combined with \fB\-f\fR, \fB\-\-replace\fR, or \fB\-\-no\-backup\fR. .TP \fB\-\-frag\fI Assume the input is a code fragment and the first line is properly indented. .TP \fB\-\-replace\fR Replace source files (creates a backup). .br This cannot be combined with \fB\-f\fR, \fB\-\-prefix\fR, or \fB\-\-suffix\fR. .TP \fB\-\-no\-backup\fR Replace files, no backup. Useful if files are under source control .br This cannot be combined with \fB\-f\fR, \fB\-\-prefix\fR, or \fB\-\-suffix\fR. .TP \fB\-\-mtime\fR Preserve mtime on replaced files. .TP \fB\-l\fR Language override: C, CPP, D, CS, JAVA, PAWN, VALA, OC, OC+ .TP \fB\-t\fR Load a file with types (usually not needed) .TP \fB\-q\fR Quiet mode \- no output on stderr (\fB\-L\fR will override) .SS "Config/Help Options:" .TP \fB\-h\fR \-? \fB\-\-help\fR \fB\-\-usage\fR Print this message and exit .TP \fB\-\-version\fR Print the version and exit .TP \fB\-\-show\-config\fR Print out option documentation and exit .TP \fB\-\-update\-config\fR Output a new config file. .TP \fB\-\-update\-config\-with\-doc\fR Output a new config file with embedded usage comments. .TP \fB\-\-universalindent\fR Output a config file for Universal Indent GUI. .TP \fB\-\-detect\fR Detects the config from a source file. Use with '\-f FILE'. Detection is currently fairly limited. .SS "Debug Options:" .TP \fB\-p\fI FILE Dump debug info to a file .TP \fB\-L\fI SEV Set the log severity (see log_levels.h) .TP \fB\-s\fR Show the log severity in the logs .TP \fB\-\-decode\fI FLAG Print \fIFLAG\fR as text and exit .SH EXAMPLES .TP Read a D file from stdin, output to stdout. cat foo.d | uncrustify \-q \-c my.cfg \-l d .TP Process a file, output to stdout. uncrustify \-c my.cfg \-d foo.d .TP Process a source tree, output to a different tree. find src \-name "*.[ch]" > files.txt .br uncrustify \-c my.cfg \-F files.txt \-\-prefix out .TP Process a source tree in\(hyplace. uncrustify \-c my.cfg \-\-no\-backup $(find src \-name "*.[ch]") .SH NOTES Use comments containing ' *INDENT\-OFF*' and ' *INDENT\-ON*' to disable processing of parts of the source file. .SH AUTHOR Written by Ben Gardner .SH REPORTING BUGS Use the issue tracker at .SH COPYRIGHT Copyright (C) 2006\(hy2009 Ben Gardner .SH LICENSE GNU GPL version 2 or later This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. uncrustify-0.59/run_tests.sh0000755000175000017500000000006211506773274013202 00000000000000#! /bin/sh cd tests ./run_tests.py $@ exit $? uncrustify-0.59/etc/0000755000175000017500000000000011642741501011437 500000000000000uncrustify-0.59/etc/d.cfg0000644000175000017500000000550711574765245012311 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" # nl_func_var_def_blk = 1 # nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = add # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 align_struct_init_span = 3 align_var_struct_span = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 # cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/etc/linux.cfg0000644000175000017500000000673311574765254013227 00000000000000# # uncrustify config file for the linux kernel # indent_with_tabs = 2 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_label = 1 # pos: absolute col, neg: relative column # # inter-symbol newlines # nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_brace_while = remove # "} while" vs "} \n while" - cuddle while nl_brace_else = remove # "} else" vs "} \n else" - cuddle else sp_brace_else = force sp_else_brace = force nl_func_var_def_blk = 1 nl_fcall_brace = remove # "list_for_each() {" vs "list_for_each()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE; # nl_before_case = 1 # # Source code modifications # mod_paren_on_return = remove # "return 1;" vs "return (1);" #mod_full_brace_if = remove # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_if_chain = true mod_full_brace_for = remove # "for () a--;" vs "for () { a--; }" mod_full_brace_do = remove # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = remove # "while (a) a--;" vs "while (a) { a--; }" mod_full_brace_nl = 3 # don't remove if more than 3 newlines # # inter-character spacing options # sp_return_paren = force # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" # # Aligning stuff # align_with_tabs = TRUE # use tabs to align align_on_tabstop = TRUE # align on tabstops # align_keep_tabs = true align_enum_equ_span = 4 # '=' in enum definition # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE # align_var_def_star = FALSE # align_var_def_colon = TRUE # align_assign_span = 1 align_struct_init_span = 3 # align stuff in a structure init '= { }' align_right_cmt_span = 3 # align_pp_define_span = 8; # align_pp_define_gap = 4; cmt_star_cont = true # indent_brace = 0 nl_func_paren = remove nl_func_decl_start = remove nl_func_decl_empty = remove nl_func_decl_args = remove nl_func_decl_end = remove sp_inside_paren = remove sp_inside_square = remove sp_inside_paren_cast = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_paren_paren = remove sp_before_ptr_star = force sp_after_ptr_star = remove sp_between_ptr_star = remove align_func_params = true align_var_struct_span = 6 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true pp_indent = remove nl_start_of_file = remove nl_end_of_file = force nl_end_of_file_min = 1 nl_comment_func_def = 1 uncrustify-0.59/etc/ben.cfg0000644000175000017500000014764411627324673012636 00000000000000# Uncrustify 0.53 # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 3 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 3 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 3 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = force # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':' sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '-(int) f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = remove # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 16 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = force # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = force # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = force # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = force # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 3 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body_class = 2 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 1 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = remove # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/etc/defaults.cfg0000644000175000017500000017535411642735377013704 00000000000000# Uncrustify 0.59 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. # If true (default), 'assert(x<0 && y>=3)' will be broken. # Improvements to template detection may make this option obsolete. tok_split_gte = false # false/true # Control what to do with the UTF-8 BOM (recommed 'remove') utf8_bom = ignore # ignore/add/remove/force # If the file only contains chars between 128 and 255 and is not UTF-8, then output as UTF-8 utf8_byte = false # false/true # Force the output encoding to UTF-8 utf8_force = false # false/true # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 8 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop indent_with_tabs = 1 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = false # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # Additional indenting for constructor initializer list indent_ctor_init = 0 # number # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype sp_assign_default = ignore # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = ignore # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = ignore # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = ignore # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = ignore # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = ignore # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = ignore # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = ignore # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = ignore # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = add # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside a non-empty '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = ignore # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = ignore # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = ignore # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = ignore # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = ignore # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '(' in 'catch (something) { }' # If set to ignore, sp_before_sparen is used. sp_catch_paren = ignore # ignore/add/remove/force # Add or remove space between 'version' and '(' in 'version (something) { }' (D language) # If set to ignore, sp_before_sparen is used. sp_version_paren = ignore # ignore/add/remove/force # Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language) # If set to ignore, sp_before_sparen is used. sp_scope_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = ignore # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = ignore # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName)' vs '@selector (msgName)' # Also applies to @protocol() constructs sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space between '@selector(x)' and the following word # '@selector(foo) a:' vs '@selector(foo)a:' sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space inside '@selector' parens # '@selector(foo)' vs '@selector( foo )' # Also applies to @protocol() constructs sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space before a block pointer caret # '^int (int arg){...}' vs. ' ^int (int arg){...}' sp_before_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space after a block pointer caret # '^int (int arg){...}' vs. '^ int (int arg){...}' sp_after_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # Controls the spaces after 'new', 'delete', and 'delete[]' sp_after_new = ignore # ignore/add/remove/force # Controls the spaces before a trailing or embedded comment sp_before_tr_emb_cmt = ignore # ignore/add/remove/force # Number of spaces before a trailing or embedded comment sp_num_before_tr_emb_cmt = 0 # number # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) align_oc_msg_colon_span = 0 # number # Aligning parameters in an Obj-C '+' or '-' declaration on the ':' align_oc_decl_colon = false # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = false # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = ignore # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 0 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of blank lines after a block of variable definitions at the top of a function body. # 0=no change (default) nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = ignore # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = ignore # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = ignore # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = ignore # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = ignore # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = ignore # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = ignore # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = ignore # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = ignore # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Add or remove a newline between a case ':' and '{'. Overrides nl_after_case. nl_case_colon_brace = ignore # ignore/add/remove/force # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition nl_func_def_paren = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = ignore # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = ignore # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = ignore # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = ignore # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = ignore # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = false # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a multi-line function body in a class declaration nl_after_func_body_class = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines after '}' or ';' of a struct/enum/union definition nl_after_struct = 0 # number # The number of newlines after '}' or ';' of a class definition nl_after_class = 0 # number # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Add or remove newline between C# property and the '{' nl_property_brace = ignore # ignore/add/remove/force # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = ignore # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = ignore # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment. # Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. cmt_insert_oc_msg_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/etc/linux-indent.cfg0000644000175000017500000000531011574765253014473 00000000000000# # uncrustify config file for the linux kernel # indent_with_tabs = 2 # 1=indent to level only, 2=indent with tabs align_with_tabs = TRUE # use tabs to align align_on_tabstop = TRUE # align on tabstops input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column # # inter-symbol newlines # nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_brace_while = remove # "} while" vs "} \n while" - cuddle while nl_brace_else = remove # "} else" vs "} \n else" - cuddle else nl_func_var_def_blk = 1 nl_fcall_brace = remove # "list_for_each() {" vs "list_for_each()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE; # nl_before_case = 1 # # Source code modifications # # mod_paren_on_return = remove # "return 1;" vs "return (1);" # mod_full_brace_if = remove # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = remove # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = remove # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = remove # "while (a) a--;" vs "while (a) { a--; }" # # inter-character spacing options # # sp_return_paren = force # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = add # "{ 1 }" vs "{1}" sp_inside_braces_struct = add # "{ 1 }" vs "{1}" sp_inside_braces_enum = add # "{ 1 }" vs "{1}" sp_assign = add sp_arith = add sp_bool = add sp_compare = add sp_assign = add sp_after_comma = add sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" # # Aligning stuff # align_enum_equ_span = 4 # '=' in enum definition # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE # align_var_def_star = FALSE # align_var_def_colon = TRUE # align_assign_span = 1 align_struct_init_span = 3 # align stuff in a structure init '= { }' align_right_cmt_span = 3 # align_pp_define_span = 8; # align_pp_define_gap = 4; # cmt_star_cont = FALSE # indent_brace = 0 uncrustify-0.59/etc/xsupplicant.cfg0000644000175000017500000000557011574765260014435 00000000000000# # GNU-like format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 2 # new tab size indent_columns = 2 # should usually match output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 2 nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE # mod_paren_on_return = ignore # "return 1;" vs "return (1);" # mod_full_brace_if = ignore # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = ignore # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = ignore # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = ignore # "while (a) a--;" vs "while (a) { a--; }" sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" # align_with_tabs = FALSE # use tabs to align # align_on_tabstop = FALSE # align on tabstops # align_enum_equ_span = 4 # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE # align_var_def_star = TRUE # align_var_def_colon = TRUE # align_assign_span = 1 # align_struct_init_span = 3 # align_var_struct_span = 3 # align_right_cmt_span = 3 # align_pp_define_span = 3 # align_pp_define_gap = 4 # align_number_left = TRUE # align_typedef_span = 5 # align_typedef_gap = 3 # cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/etc/mono.cfg0000644000175000017500000000574411574765256013043 00000000000000# # Mono library format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column # indent_align_string = False # align broken strings # indent_brace = 0 indent_func_call_param = true # use indent tabstop nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = remove # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove sp_before_square = add #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = force # "int foo (){" vs "int foo(){" sp_func_call_paren = force # "foo (" vs "foo(" sp_func_proto_paren = force # "int foo ();" vs "int foo();" # align_with_tabs = FALSE # use tabs to align # align_on_tabstop = FALSE # align on tabstops # align_enum_equ_span = 4 # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE # align_var_def_star = TRUE # align_var_def_colon = TRUE # align_assign_span = 1 # align_struct_init_span = 3 # align_var_struct_span = 3 # align_right_cmt_span = 3 # align_pp_define_span = 3 # align_pp_define_gap = 4 # align_number_left = TRUE # align_typedef_span = 5 # align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/etc/gnu-indent.cfg0000644000175000017500000000552511574765247014140 00000000000000# # GNU format (sorta) # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = 2 # indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 2 nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE # mod_paren_on_return = ignore # "return 1;" vs "return (1);" # mod_full_brace_if = ignore # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = ignore # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = ignore # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = ignore # "while (a) a--;" vs "while (a) { a--; }" sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" # align_with_tabs = FALSE # use tabs to align # align_on_tabstop = FALSE # align on tabstops # align_enum_equ_span = 4 # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE # align_var_def_star = TRUE # align_var_def_colon = TRUE # align_assign_span = 1 # align_struct_init_span = 3 # align_var_struct_span = 3 # align_right_cmt_span = 3 # align_pp_define_span = 3 # align_pp_define_gap = 4 # align_number_left = TRUE # align_typedef_span = 5 # align_typedef_gap = 3 # cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/etc/kr-indent.cfg0000644000175000017500000000571211574765250013753 00000000000000# # K&R (sort-of) # indent_with_tabs = 2 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column # indent_align_string = False # align broken strings # indent_brace = 0 nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" # nl_func_var_def_blk = 1 # nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE nl_brace_while = remove nl_brace_else = remove nl_squeeze_ifdef = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove # "( 1 )" vs "(1)" sp_inside_fparen = remove # "( 1 )" vs "(1)" - functions sp_inside_sparen = remove # "( 1 )" vs "(1)" - if/for/etc # sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" # align_with_tabs = FALSE # use tabs to align # align_on_tabstop = FALSE # align on tabstops # align_enum_equ_span = 4 # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE # align_var_def_star = TRUE # align_var_def_colon = TRUE # align_assign_span = 1 # align_struct_init_span = 3 # align_var_struct_span = 3 # align_right_cmt_span = 3 # align_pp_define_span = 3 # align_pp_define_gap = 4 # align_number_left = TRUE # align_typedef_span = 5 # align_typedef_gap = 3 # cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/tests/0000755000175000017500000000000011642741501012026 500000000000000uncrustify-0.59/tests/run_tests.py0000755000175000017500000001266511574764501014374 00000000000000#! /usr/bin/env python # # Scans the .test files on the command line and parses each, running # the tests listed. Results are printed out. # # This could all be done with bash, but I wanted to use python. =) # Anyway, this was all done while waiting in the Denver airport. # import sys import os import string import filecmp # OK, so I just had way too much fun with the colors.. if os.name == "nt": # windoze doesn't support ansi sequences NORMAL = "" BOLD = "" UNDERSCORE = "" REVERSE = "" else: NORMAL = "\033[0m" BOLD = "\033[1m" UNDERSCORE = "\033[1m" REVERSE = "\033[7m" FG_BLACK = "\033[30m" FG_RED = "\033[31m" FG_GREEN = "\033[32m" FG_YELLOW = "\033[33m" FG_BLUE = "\033[34m" FG_MAGNETA = "\033[35m" FG_CYAN = "\033[36m" FG_WHITE = "\033[37m" FGB_BLACK = "\033[90m" FGB_RED = "\033[91m" FGB_GREEN = "\033[92m" FGB_YELLOW = "\033[93m" FGB_BLUE = "\033[94m" FGB_MAGNETA = "\033[95m" FGB_CYAN = "\033[96m" FGB_WHITE = "\033[97m" BG_BLACK = "\033[40m" BG_RED = "\033[41m" BG_GREEN = "\033[42m" BG_YELLOW = "\033[43m" BG_BLUE = "\033[44m" BG_MAGNETA = "\033[45m" BG_CYAN = "\033[46m" BG_WHITE = "\033[47m" BGB_BLACK = "\033[100m" BGB_RED = "\033[101m" BGB_GREEN = "\033[102m" BGB_YELLOW = "\033[103m" BGB_BLUE = "\033[104m" BGB_MAGNETA = "\033[105m" BGB_CYAN = "\033[106m" BGB_WHITE = "\033[107m" # after all that, I chose c if os.name == "nt": # windoze doesn't support ansi sequences FAIL_COLOR = "" PASS_COLOR = "" MISMATCH_COLOR = "" UNSTABLE_COLOR = "" else: FAIL_COLOR = UNDERSCORE PASS_COLOR = FG_GREEN MISMATCH_COLOR = FG_RED #REVERSE UNSTABLE_COLOR = FGB_CYAN # log_levels: # bit 0: show a diff on unstable or failures # bit 1: show passes # bit 2: show commands log_level = 0 def usage_exit(): print "Usage: \n" + sys.argv[0] + " testfile" sys.exit() def run_tests(test_name, config_name, input_name, lang): expected_name = os.path.join(os.path.dirname(input_name), test_name + '-' + os.path.basename(input_name)) # print "Test: ", test_name # print "Config:", config_name # print "Input: ", input_name # print 'Output:', expected_name if not config_name.startswith(os.sep): config_name = os.path.join('config', config_name) resultname = os.path.join('results', expected_name) outputname = os.path.join('output', expected_name) try: os.makedirs(os.path.dirname(resultname)) except: pass cmd = "%s/uncrustify -q -c %s -f input/%s %s > %s" % (os.path.abspath('../src'), config_name, input_name, lang, resultname) if log_level & 2: print "RUN: " + cmd a = os.system(cmd) if a != 0: print FAIL_COLOR + "FAILED: " + NORMAL + test_name return -1 try: if not filecmp.cmp(resultname, outputname): print MISMATCH_COLOR + "MISMATCH: " + NORMAL + test_name if log_level & 1: cmd = "diff -u %s %s" % (outputname, resultname) os.system(cmd) return -1 except: print MISMATCH_COLOR + "MISSING: " + NORMAL + test_name return -1 # The file in results matches the file in output. # Re-run with the output file as the input to check stability. cmd = "%s/uncrustify -q -c %s -f %s %s > %s" % (os.path.abspath('../src'), config_name, outputname, lang, resultname) if log_level & 2: print "RUN: " + cmd a = os.system(cmd) if a != 0: print FAIL_COLOR + "FAILED2: " + NORMAL + test_name return -1 try: if not filecmp.cmp(resultname, outputname): print UNSTABLE_COLOR + "UNSTABLE: " + NORMAL + test_name if log_level & 1: cmd = "diff -u %s %s" % (outputname, resultname) os.system(cmd) return -2 except: # impossible print UNSTABLE_COLOR + "MISSING: " + NORMAL + test_name return -1 if log_level & 4: print PASS_COLOR + "PASSED: " + NORMAL + test_name return 0 def process_test_file(filename): fd = open(filename, "r") if fd == None: print "Unable to open " + filename return None print "Processing " + filename pass_count = 0 fail_count = 0 unst_count = 0 for line in fd: line = string.rstrip(string.lstrip(line)) parts = string.split(line) if (len(parts) < 3) or (parts[0][0] == '#'): continue lang = "" if len(parts) > 3: lang = "-l " + parts[3] rt = run_tests(parts[0], parts[1], parts[2], lang) if rt < 0: if rt == -1: fail_count += 1 else: unst_count += 1 else: pass_count += 1 return [pass_count, fail_count, unst_count] # # entry point # if __name__ == '__main__': args = [] the_tests = [] for arg in sys.argv[1:]: if arg.startswith('-'): for cc in arg[1:]: if cc == 'd': # show diff on failure log_level |= 1 elif cc == 'c': # show commands log_level |= 2 elif cc == 'p': # show passes log_level |= 4 else: sys.exit('Unknown option "%s"' % (cc)) else: args.append(arg) if len(args) == 0: the_tests += "c-sharp c cpp d java pawn objective-c vala ecma".split() else: the_tests += args #print args print "Tests: " + str(the_tests) pass_count = 0 fail_count = 0 unst_count = 0 for item in the_tests: passfail = process_test_file(item + '.test') if passfail != None: pass_count += passfail[0] fail_count += passfail[1] unst_count += passfail[2] print "Passed %d / %d tests" % (pass_count, pass_count + fail_count) if fail_count > 0: print BOLD + "Failed %d test(s)" % (fail_count) + NORMAL sys.exit(1) else: txt = BOLD + "All tests passed" + NORMAL if unst_count > 0: txt += ", but some files were unstable" print txt sys.exit(0) uncrustify-0.59/tests/config/0000755000175000017500000000000011631561151013272 500000000000000uncrustify-0.59/tests/config/indent_func_call_param.cfg0000644000175000017500000000031011506773274020350 00000000000000indent_func_call_param = true indent_func_def_param = false indent_func_proto_param = false indent_columns = 3 indent_with_tabs = 1 output_tab_size = indent_columns nl_func_type_name = force uncrustify-0.59/tests/config/nl-comment.cfg0000644000175000017500000000660111574765451015766 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_access_spec = 2 indent_align_string = False # align broken strings indent_brace = 0 indent_member = indent_columns nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_try_brace = add # "for () {" vs "for () \n {" nl_catch_brace = add # "for () {" vs "for () \n {" nl_finally_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_func_params = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 # align_assign_thresh = 8 align_struct_init_span = 3 align_var_struct_span = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE # indent_namespace = FALSE indent_class = TRUE nl_before_c_comment = 3 nl_before_block_comment = 3 nl_before_cpp_comment = 4 uncrustify-0.59/tests/config/template4.cfg0000644000175000017500000000003511506773274015604 00000000000000sp_func_call_paren = remove uncrustify-0.59/tests/config/file-header.h0000644000175000017500000000006711506773274015547 00000000000000/** * @file $(filename) * Description * * $Id$ */ uncrustify-0.59/tests/config/nSolve.cfg0000644000175000017500000017231111553715216015154 00000000000000# Uncrustify 0.49 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 4 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 4 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 4 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop indent_with_tabs = 0 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = false # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 1 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 4 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 1 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype sp_assign_default = ignore # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = ignore # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = ignore # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = ignore # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = ignore # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = force # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = ignore # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = ignore # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = ignore # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = ignore # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = add # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = ignore # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = ignore # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = ignore # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = ignore # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = ignore # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = ignore # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName)' vs '@selector (msgName)' # Also applies to @protocol() constructs sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space between '@selector(x)' and the following word # '@selector(foo) a:' vs '@selector(foo)a:' sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space inside '@selector' parens # '@selector(foo)' vs '@selector( foo )' # Also applies to @protocol() constructs sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space before a block pointer caret # '^int (int arg){...}' vs. ' ^int (int arg){...}' sp_before_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space after a block pointer caret # '^int (int arg){...}' vs. '^ int (int arg){...}' sp_after_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = force # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = force # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 1 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = true # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) align_oc_msg_colon_span = 0 # number # Aligning parameters in an Obj-C '+' or '-' declaration on the ':' align_oc_decl_colon = false # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = false # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = true # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = true # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = true # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = ignore # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 0 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of blank lines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = ignore # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = ignore # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = ignore # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = ignore # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = ignore # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = ignore # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = ignore # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = ignore # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = ignore # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition nl_func_def_paren = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = ignore # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = ignore # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = ignore # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = ignore # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = ignore # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = false # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = ignore # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = ignore # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/tests/config/align-3.cfg0000644000175000017500000000602411574765271015146 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_func_params = TRUE align_var_def_span = 1 align_var_def_thresh = 16 align_var_def_inline = TRUE align_var_def_star_style = 2 align_var_def_colon = TRUE align_assign_span = 2 align_assign_thresh = 3 align_struct_init_span = 3 align_var_struct_span = 1 align_var_struct_thresh = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/tests/config/align_typedef_func-2.cfg0000644000175000017500000000024611506773274017675 00000000000000 align_typedef_func = 2 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 2 sp_after_ptr_star = remove uncrustify-0.59/tests/config/align_typedef_func-0.cfg0000644000175000017500000000021211506773274017664 00000000000000 align_typedef_func = 0 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 uncrustify-0.59/tests/config/region-2.cfg0000644000175000017500000000021711506773274015331 00000000000000# out-dented region preprocs indent_columns = 4 pp_region_indent_code = false pp_indent_region = -4 indent_class = true uncrustify-0.59/tests/config/del_semicolon.cfg0000644000175000017500000000020211506773274016515 00000000000000# # $Id: 1liner-split.cfg 803 2007-07-25 00:36:25Z bengardner $ # mod_remove_extra_semicolon = true sp_after_semi_for = remove uncrustify-0.59/tests/config/pos_conditional-sol.cfg0000644000175000017500000000006011506773274017662 00000000000000pos_conditional = lead sp_cond_question = force uncrustify-0.59/tests/config/sp_after_oc_return_type_remove.cfg0000644000175000017500000000031311506773274022205 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_return_type = removeuncrustify-0.59/tests/config/function_header.txt0000644000175000017500000000052011506773274017121 00000000000000/*********************************************************************************** * $(function) *******************************************************************************//** * * * * $(javaparam) * **********************************************************************************/ uncrustify-0.59/tests/config/sp_after_oc_at_sel_force.cfg0000644000175000017500000000041311506773274020676 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_at_sel = force sp_after_oc_at_sel_parens = force sp_inside_square = remove uncrustify-0.59/tests/config/sp_after_oc_block_caret_remove.cfg0000644000175000017500000000030711506773274022100 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_block_caret = removeuncrustify-0.59/tests/config/d.cfg~0000644000175000017500000000655711506773274014345 00000000000000# # My favorite format # # $Id: d.cfg 1492 2009-02-27 03:25:26Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_case_brace = indent_columns indent_class = true nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE nl_after_brace_open = TRUE nl_after_vbrace_open = false nl_after_vbrace_close = TRUE #nl_func_leave_one_liners = FALSE #nl_class_leave_one_liners = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_square = remove sp_before_squares = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove sp_range = force align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 align_struct_init_span = 3 align_var_struct_span = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 align_typedef_star_style = 1 # cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE indent_paren_nl = TRUE uncrustify-0.59/tests/config/op-space-remove.cfg0000644000175000017500000000042511574765451016715 00000000000000# # Removes a space after an operator # indent_columns = 3 sp_before_byref = remove sp_after_byref = force indent_class = True sp_func_def_paren = remove sp_func_proto_paren = remove sp_after_operator = remove sp_after_operator_sym = remove align_right_cmt_span = 2 uncrustify-0.59/tests/config/bool-pos-eol-force.cfg~0000644000175000017500000000064111506773274017511 00000000000000# # moves boolean ops to the end of line # # $Id: bool-pos-eol.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = trail_force pos_comma = Trail pos_class_comma = trail sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/nl_create_one_liner.cfg0000644000175000017500000000022211506773274017671 00000000000000 indent_columns = 3 indent_func_call_param = true nl_create_if_one_liner = true nl_create_for_one_liner = true nl_create_while_one_liner = true uncrustify-0.59/tests/config/align_right_cmt_gap-2.cfg0000644000175000017500000000020111506773274020020 00000000000000indent_columns = 3 indent_with_tabs = 0 align_right_cmt_span = 8 align_right_cmt_mix = false align_right_cmt_gap = 3 uncrustify-0.59/tests/config/add_long_closebrace_comment_1.cfg0000644000175000017500000000013311506773274021577 00000000000000mod_add_long_switch_closebrace_comment = 8 mod_add_long_function_closebrace_comment = 8 uncrustify-0.59/tests/config/cast-sp-a.cfg0000644000175000017500000001605611506773274015507 00000000000000newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 indent_columns = 3 indent_with_tabs = 0 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_class = true indent_class_colon = false indent_func_call_param = false indent_member = 3 indent_sing_line_comments = 0 indent_switch_case = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_paren_nl = false indent_square_nl = false sp_arith = force sp_assign = force sp_bool = force sp_compare = force sp_inside_paren = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = remove sp_after_byref = ignore sp_before_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_before_sparen = force sp_inside_sparen = remove sp_after_sparen = force sp_sparen_brace = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_after_operator = ignore sp_after_cast = remove sp_inside_paren_cast = force sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_angle = remove sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = remove sp_func_class_paren = ignore sp_return_paren = remove sp_macro = ignore sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_thresh = 0 align_var_def_colon = true align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 align_right_cmt_span = 3 align_func_proto_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 code_width = 0 nl_collapse_empty_body = false nl_class_leave_one_liners = true nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_before_case = true nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_after_semicolon = false nl_after_brace_open = false nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false pos_bool = ignore pos_class_colon = ignore ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 pp_indent = ignore pp_space = ignore uncrustify-0.59/tests/config/nl_ds_struct_enum-2.cfg0000644000175000017500000000026011506773274017573 00000000000000# # Double-space commented struct/enum/union blocks # Add an extra newline before the close brace # nl_ds_struct_enum_cmt = true nl_ds_struct_enum_close_brace = true uncrustify-0.59/tests/config/pos_conditional-eol.cfg0000644000175000017500000000006111506773274017645 00000000000000pos_conditional = trail sp_cond_question = force uncrustify-0.59/tests/config/type_wrap.cfg0000644000175000017500000000014411506773274015720 00000000000000 set TYPE_WRAP STACK_OF sp_before_ptr_star = force sp_after_ptr_star = remove sp_assign = force uncrustify-0.59/tests/config/avalon2.cfg0000644000175000017500000002163211506773274015255 00000000000000# Sets the line endings for the output file newlines = AUTO # AUTO/LF/CRLF/CR # The original tab space value. # Used to determine what was already aligned. (TODO) input_tab_size = 2 # number # Size of tabs in the output. # Only important if indent_with_tabs=2. output_tab_size = 2 # number # The number of columns to indent. # Usually 2, 3, 4, or 8. indent_columns = 2 # number # How to use tabs when indenting code. # 0 = Use spaces only # 1 = Use tabs to the brace-level indent (very portable) # 2 = Use tabs whenever possible indent_with_tabs = 0 # number # If an open paren is followed by a newline, indent the next line # so that it lines up after the open paren. # Not recommended. indent_paren_nl = false # bool # Changes the space between # and, say, define. pp_space = ignore # IARF # Changes the indent of preprocessors. pp_indent = ignore # IARF # Spaces to indent case from switch (usually 0 or indent_columns). indent_switch_case = 2 # number * REVISIT: make TRUE/FALSE? * # Spaces to indent '{' from level (usually 0). For GNU style, set to 2. indent_brace = 0 # number # Whether braces are indented to the body level or not. indent_braces = false # bool indent_class = false indent_namespace = false # How to indent goto labels. # > 0 : Absolute column (1=leftmost column) # <= 0 : Subtract from brace indent indent_label = -2 # number # Whether to indent broken strings so that they line up. indent_align_string = false # bool # Whether to indent comments found in column 1. indent_col1_comment = false # bool # If true, indent continued function call parameters one indent level. indent_func_call_param = false # bool # # Spacing Options # # Space between ')' and '{' sp_paren_brace = force # IARF # Space after cast - "(int) a" vs "(int)a" sp_after_cast = remove # IARF # Space before & in function definition param: sp_before_byref = remove # IARF # Space inside 'foo( xxx )' vs 'foo(xxx)' sp_inside_fparen = remove # IARF # space inside '+ ( xxx )' vs '+ (xxx)' sp_inside_paren = remove # IARF # space inside 'byte[ 5 ]' vs 'byte[5]' sp_inside_square = remove # IARF # Space inside 'if( xxx )' vs 'if(xxx)' sp_inside_sparen = remove # IARF # Space inside '<>' sp_inside_angle = remove # IARF # Space before '(' of 'if/for/while/switch'. sp_before_sparen = force # IARF # Space after ')' of 'if/for/while/switch' sp_after_sparen = force # IARF # Space before '<>' sp_before_angle = remove # IARF # Space after '<>' sp_after_angle = remove # IARF sp_angle_paren = remove # IARF sp_angle_word = force # IARF # space before all '[', except '[]' sp_before_square = force # IARF # space before '[]' sp_before_squares = remove # IARF # space between nested parens - '( (' vs '((' sp_paren_paren = remove # IARF # space between 'return' and '(' sp_return_paren = force # IARF # space between 'sizeof' and '(' sp_sizeof_paren = remove # IARF # space after ',' sp_after_comma = force # IARF # space around + - / * etc sp_arith = force # IARF # space around || && sp_bool = force # IARF # space around < > ==, etc sp_compare = force # IARF # space around =, +=, etc sp_assign = force # IARF # space between 'func' and '(' - "foo (" vs "foo(" sp_func_def_paren = remove # IARF # space between 'func' and '(' - "foo (" vs "foo(" sp_func_call_paren = remove # IARF # space between 'func' and '(' - "foo (" vs "foo(" sp_func_proto_paren = remove # IARF # Space between return type and 'func' #sp_type_func = force # IARF # Space empty stmt ';' on while, if, for sp_special_semi = force # IARF # Space before all ';' sp_before_semi = remove # IARF # Space inside '{' and '}' - "{ 1, 2, 3 }" sp_inside_braces = remove # IARF # Space inside enum '{' and '}' - "{ a, b, c }" sp_inside_braces_enum = remove # IARF # Space inside struct/union '{' and '}' sp_inside_braces_struct = remove # IARF # # Code alignment (not left column spaces/tabs) # # Use tabs for aligning. align_with_tabs = false # bool # Keep non-indenting tabs. align_keep_tabs = false # bool # When aligning, bump out to the next tabstop. align_on_tabstop = false # bool # Align the back-slash \n combo (macros) align_nl_cont = true # bool # Align the '=' in enums align_enum_equ_span = 0 # bool # The span for aligning on '=' in assignments. 0=don't align align_assign_span = 0 # number # Span for aligning comments that end lines. 0=don't align align_right_cmt_span = 0 # number # Span for aligning variable definitions align_var_def_span = 0 # number # Whether to align inline struct/enum/union var defs align_var_def_inline = 0 # bool # Whether the star is part of the variable name or not. align_var_def_star_style = 2 # bool # Align the colon in struct bit fields align_var_def_colon = false # bool # Span for struct/union (0=don't align) align_var_struct_span = 0 # number # align bodies in #define statements align_pp_define_span = 0 # number # Min space between define label and value "#define a <---> 16" align_pp_define_gap = 1 # number # Align structure initializer values align_struct_init_span = 0 # number # Align function prototypes align_func_proto_span = 0 # number # left-align numbers #align_number_left: bool * a little buggy * # align single-line typedefs #align_typedef_span: number # minimum spacing #align_typedef_gap: number # Start aligning style # 0: '*' not part of type # 1: '*' part of the type - no space # 2: '*' part of type, dangling align_typedef_star_style = 0 # number # # Newline adding and removing options # # "int foo() {" vs "int foo()\n{" nl_fdef_brace = force # IARF # Newline after '(' in a function decl nl_func_decl_start = remove # IARF # Newline after each ',' in a function decl nl_func_decl_args = remove # IARF # Newline before the ')' in a function decl nl_func_decl_end = remove # IARF # Newline between return type and func name in def nl_func_type_name = remove # IARF # Newline after a block of variable defs nl_func_var_def_blk = 0 # number # newline before 'case' statement nl_before_case = false # bool # newline after return statement nl_after_return = true # bool # Disallow nested "case 1: a=3;" nl_after_case = true # bool # newline between function call and open brace nl_fcall_brace = remove # IARF # No blanks after #ifxx, #elxx, or before #endif nl_squeeze_ifdef = false # bool # nl between enum and brace nl_enum_brace = remove # IARF # nl between struct and brace nl_struct_brace = remove # IARF # nl between union and brace nl_union_brace = remove # IARF # nl between = and { nl_assign_brace = remove # IARF # nl between do and { nl_do_brace = remove # IARF # nl between if and { nl_if_brace = remove # IARF # nl between for and { nl_for_brace = remove # IARF # nl between else and { nl_else_brace = remove # IARF # nl between while and { nl_while_brace = remove # IARF # nl between switch and { nl_switch_brace = remove # IARF # nl between } and else nl_brace_else = remove # IARF # nl between } and while of do stmt nl_brace_while = remove # IARF # Alter newlines in #define macros nl_define_macro = false # bool # Add or remove newlines at the start of the file nl_start_of_file = remove # IARF # Number of newlines at the start of the file. Only used if nl_start_of_file is Add or Force #nl_start_of_file_min: number # Add or remove newlines at the end of the file nl_end_of_file = force # IARF # Number of newlines at the end of the file. Only used if nl_end_of_file is Add or Force nl_end_of_file_min = 1 # number # -1: boolean ops are at the end of the line # 0: do not move boolean ops (default) # 1: boolean ops are at the start of the line pos_bool = Trail # position (Trail, None, Lead) sp_before_byref = remove sp_before_ptr_star = remove # # Blank line options # Note that it takes 2 newlines to get a blank line. # # Minimum number of newlines before a multi-line comment. nl_before_block_comment = 2 # number # Newlines after the closing brace of a function body nl_after_func_body = 2 # number # Newlines after a single function prototype. nl_after_func_proto = 1 # number # Newlines after a prototype, if not followed by another prototype. nl_after_func_proto_group = 2 # number # The maximum consecutive newlines. nl_max = 4 # number # Remove blank lines after { eat_blanks_after_open_brace = true # bool # Remove blank lines before } eat_blanks_before_close_brace = true # bool # # code modifying options (non-whitespace) # # Add or remove unecessary paren on return. mod_paren_on_return = remove # IARF # add or remove braces on single-statement if mod_full_brace_if = add # IARF # add or remove braces on single-statement for mod_full_brace_for = add # IARF # add or remove braces on single-statement do mod_full_brace_do = add # IARF # add or remove braces on single-statement while mod_full_brace_while = add # IARF # don't remove braces around statements that span X newlines #mod_full_brace_nl: number # # Comment modifications # # Put a star on subsequent comment lines #cmt_star_cont: bool uncrustify-0.59/tests/config/indent_namespace-t.cfg0000644000175000017500000000016411506773274017446 00000000000000# # $Id: nl_namespace-r.cfg 803 2007-07-25 00:36:25Z bengardner $ indent_class = True indent_namespace = True uncrustify-0.59/tests/config/star_pos-2.cfg0000644000175000017500000000102311506773274015674 00000000000000# # Places the byref as follows: "int &foo" # # $Id: byref-left.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_columns = 3 align_typedef_span = 2 align_typedef_gap = 3 align_typedef_star_style = 2 align_typedef_amp_style = 2 align_var_def_span = 2 align_var_def_star_style = 2 align_var_def_amp_style = 2 align_var_struct_span = 2 align_func_proto_span = 2 sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = force sp_after_byref = remove uncrustify-0.59/tests/config/sp_after_oc_return_type_force.cfg0000644000175000017500000000031211506773274022005 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_return_type = forceuncrustify-0.59/tests/config/align_attr.cfg0000644000175000017500000000013311506773274016030 00000000000000align_var_def_span=2 set attribute _PREPROCESSOR_SOMETHING align_var_def_attribute = true uncrustify-0.59/tests/config/d-tst2.cfg0000644000175000017500000000644611574765451015041 00000000000000# # My favorite format # newlines = LF # AUTO (default), DOS, MAC, or UNIX indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 1 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_func_call_param = TRUE nl_start_of_file = remove # nl_start_of_file_min = 0 nl_end_of_file = force nl_end_of_file_min = 1 nl_assign_brace = remove # "= {" vs "= \n {" nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = remove # "foo() {" vs "foo()\n{" nl_fdef_brace = remove # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE nl_after_case = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_func_class_paren = remove sp_before_angle = force sp_after_angle = force sp_inside_angle = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 align_struct_init_span = 3 align_var_struct_span = 99 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE # indent_square_nl = false uncrustify-0.59/tests/config/func-header.h0000644000175000017500000000007411506773274015561 00000000000000/** * $(function) * TODO: DESCRIPTION * $(javaparam) */ uncrustify-0.59/tests/config/return-1.cfg0000644000175000017500000000026211506773274015364 00000000000000 indent_columns = 4 indent_with_tabs = 0 nl_after_return = true mod_paren_on_return = add nl_return_expr = remove sp_before_semi = remove sp_inside_paren = remove uncrustify-0.59/tests/config/sef.cfg0000644000175000017500000002234311506773274014470 00000000000000newlines = crlf input_tab_size = 4 output_tab_size = 4 string_escape_char = 92 string_escape_char2 = 0 indent_columns = 4 indent_with_tabs = 2 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = true indent_class = false indent_class_colon = false indent_func_call_param = false indent_func_class_param = true indent_func_ctor_var_param = true indent_func_param_double = true indent_member = 0 indent_sing_line_comments = 0 indent_switch_case = 4 indent_case_shift = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 1 indent_access_spec = 1 indent_paren_nl = false indent_paren_close = 0 indent_comma_paren = false indent_bool_paren = false indent_square_nl = false indent_preserve_sql = false sp_arith = force sp_assign = force sp_bool = force sp_compare = add sp_inside_paren = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = force sp_before_ptr_star = remove sp_between_ptr_star = ignore sp_after_ptr_star = add sp_before_byref = remove sp_after_byref = ignore sp_before_angle = ignore sp_after_angle = ignore sp_angle_paren = ignore sp_angle_word = ignore sp_before_sparen = force sp_inside_sparen = remove sp_after_sparen = force sp_sparen_brace = force sp_special_semi = ignore sp_before_semi = ignore sp_before_semi_for = ignore sp_before_semi_for_empty = ignore sp_after_semi_for_empty = ignore sp_before_square = remove sp_before_squares = ignore sp_inside_square = ignore sp_after_comma = add sp_before_comma = remove sp_after_operator = ignore sp_after_cast = ignore sp_inside_paren_cast = ignore sp_sizeof_paren = ignore sp_after_tag = ignore sp_inside_braces_enum = ignore sp_inside_braces_struct = ignore sp_inside_braces = ignore sp_inside_angle = ignore sp_type_func = remove sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = remove sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = add sp_func_call_paren = remove sp_func_class_paren = remove sp_return_paren = ignore sp_attribute_paren = ignore sp_macro = ignore sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore sp_before_dc = ignore sp_after_dc = remove sp_d_array_colon = ignore sp_not = remove sp_inv = remove sp_addr = remove sp_deref = remove align_keep_tabs = false align_with_tabs = true align_on_tabstop = true align_number_left = false align_func_params = false align_var_def_span = 0 align_var_def_star_style = 0 align_var_def_amp_style = 0 align_var_def_thresh = 0 align_var_def_colon = false align_var_def_inline = false align_assign_span = 0 align_assign_thresh = 0 align_enum_equ_span = 0 align_enum_equ_thresh = 0 align_var_struct_span = 0 align_var_struct_thresh = 0 align_struct_init_span = 0 align_typedef_gap = 0 align_typedef_span = 0 align_typedef_func = 0 align_typedef_star_style = 0 align_typedef_amp_style = 0 align_right_cmt_span = 0 align_func_proto_span = 0 align_nl_cont = false align_pp_define_gap = 0 align_pp_define_span = 0 nl_collapse_empty_body = false nl_assign_leave_one_liners = false nl_class_leave_one_liners = false nl_enum_leave_one_liners = false nl_getset_leave_one_liners = false nl_func_leave_one_liners = true nl_if_leave_one_liners = false nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = ignore nl_assign_square = ignore nl_after_square_assign = ignore nl_func_var_def_blk = 0 nl_fcall_brace = ignore nl_enum_brace = ignore nl_struct_brace = ignore nl_union_brace = ignore nl_if_brace = remove nl_brace_else = add nl_elseif_brace = remove nl_else_brace = remove nl_brace_finally = ignore nl_finally_brace = ignore nl_try_brace = ignore nl_getset_brace = ignore nl_for_brace = remove nl_catch_brace = ignore nl_brace_catch = ignore nl_while_brace = remove nl_do_brace = remove nl_brace_while = add nl_switch_brace = remove nl_multi_line_cond = false nl_before_case = false nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = force nl_func_type_name = remove nl_func_paren = remove nl_func_decl_start = remove nl_func_decl_args = remove nl_func_decl_end = remove nl_fdef_brace = ignore nl_after_return = false nl_after_semicolon = true nl_after_brace_open = true nl_after_brace_open_cmt = false nl_after_vbrace_open = false nl_define_macro = false nl_squeeze_ifdef = false nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false nl_ds_struct_enum_close_brace = false nl_class_colon = add nl_create_if_one_liner = false nl_create_for_one_liner = false nl_create_while_one_liner = false pos_bool = lead pos_comma = trail pos_class_comma = trail pos_class_colon = lead code_width = 80 ls_for_split_full = true ls_func_split_full = true nl_max = 3 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 3 nl_after_func_body_one_liner = 2 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 nl_after_multiline_comment = false nl_before_access_spec = 1 nl_after_access_spec = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = ignore mod_pawn_semicolon = false mod_full_paren_if_bool = false mod_remove_extra_semicolon = false cmt_width = 80 cmt_c_group = false cmt_c_nl_start = false cmt_c_nl_end = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = false cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 cmt_insert_file_header = "" cmt_insert_func_header = "" cmt_insert_class_header = "" pp_indent = ignore pp_indent_at_level = false pp_space = ignore pp_space_count = 0 pp_indent_region = 0 pp_region_indent_code = false pp_indent_if = 0 pp_if_indent_code = false pp_define_at_level = false uncrustify-0.59/tests/config/nl_func_type_name_class.cfg0000644000175000017500000000027711506773274020567 00000000000000 sp_cmt_cpp_start = add # align_var_def_span = 16 align_func_proto_span =16 align_on_operator =true nl_func_type_name = force nl_func_type_name_class = remove nl_func_proto_type_name = force uncrustify-0.59/tests/config/align_fcall-2.cfg0000644000175000017500000000012511506773274016277 00000000000000 align_same_func_call_params = true sp_after_comma = force align_number_left = true uncrustify-0.59/tests/config/1liner-no-split.cfg0000644000175000017500000004523411506773274016654 00000000000000# # My favorite format ("--update-config-with-doc") # # $Id: 1liner-split.cfg 803 2007-07-25 00:36:25Z bengardner $ # # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\). (Pawn) string_escape_char = 92 # number # # Indenting # # The number of columns to indent per level (usually 2, 3, 4, or 8) indent_columns = 3 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to indent_columns. indent_member = 3 # number # Spaces to indent 'case' from 'switch' indent_switch_case = 0 # number # Spaces to indent '{' from 'case' indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels (>0=absolute column where 1 is the leftmost column, <=0=subtract from brace indent) indent_label = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = force # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name (a minimum of 1 is forced except for pointer return types) sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = force # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = force # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true align_func_params = true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # Whether the pointer star is part of the variable name or not align_var_def_star_style = 1 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 12 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type: typedef int * pint; align_typedef_star_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = true # false/true nl_assign_leave_one_liners = true nl_enum_leave_one_liners = true nl_func_leave_one_liners = true nl_if_leave_one_liners = true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between function call and '(' nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of the function body nl_after_func_body = 2 # number # The minimum number of newlines before a multi-line comment (doesn't apply if after a brace open) nl_before_block_comment = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = ignore # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = ignore # ignore/add/remove/force nl_getset_brace = force mod_full_paren_if_bool = true sp_before_semi_for_empty = force uncrustify-0.59/tests/config/cast-types.txt0000644000175000017500000000056411506773274016070 00000000000000# # a simple list of stuff that should be detected as a CT_TYPE # this usually isn't necessary because types are detected from the context. # # In the future, I may allow arbitrary CT_xxx stuff to be specified, as # well as a language # INT8 UINT8 INT16 UINT16 INT32 UINT32 INT64 UINT64 FLOAT CHAR DOUBLE TRUE FALSE BOOL FILE DIR # this is for the type-cast.c test bat uncrustify-0.59/tests/config/func_wrap1.cfg0000644000175000017500000000005611506773274015755 00000000000000set func_wrap FSUB sp_inside_fparen = ignore uncrustify-0.59/tests/config/bool-pos-eol-break.cfg0000644000175000017500000000065511506773274017306 00000000000000# # moves boolean ops to the end of line # # $Id: bool-pos-eol.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = trail_break pos_comma = Trail_break pos_class_comma = trail_break sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/pascal_ptr.cfg0000644000175000017500000000030511574765451016040 00000000000000# # My favorite format # indent_with_tabs = 0 input_tab_size = 8 indent_columns = 4 sp_arith = force sp_after_ptr_star = force sp_before_ptr_star = remove sp_between_ptr_star = remove uncrustify-0.59/tests/config/amxmodx.cfg0000644000175000017500000002402111574765273015370 00000000000000# # AMX Mod X style for Pawn (or as close as possible) # ####################### # Basic Indenting Stuff # (a/i/r) comment notation for add/ignore/remove which is the actual setting input_tab_size = 4 # tab size on input file: usually 8 output_tab_size = 4 # tab size for output: usually 8 indent_columns = 4 # ie 3 or 8 indent_with_tabs = 2 # 1=only to the 'level' indent, 2=use tab indenting #indent_paren_nl = 1 # indent-align under paren for open followed by nl pp_indent = remove # indent preproc 1 space per level (a/i/r) pp_space = remove # spaces between # and word (add/ignore/remove) indent_switch_case = 2 # spaces to indent case from switch #indent_case_brace = 0 # spaces to indent '{' from case # (usually 0 or indent_columns) #indent_brace = 0 # spaces to indent '{' from level (usually 0) indent_braces = 0 # whether to indent the braces or not #indent_label = 0 # 0=left >0=col from left (absolute column), # <0=sub from brace indent (relative column) indent_align_string = false # True/False - indent align broken strings indent_col1_comment = true # indent comments in column 1 indent_func_call_param = true # indent continued function calls to indent_columns otherwise index_columns + spaces to align with open paren. indent_namespace = true # indent stuff inside namespace braces indent_class = true # indent stuff inside class braces ############################ # Misc Inter-element Spacing # Force,Ignore,Add,Remove # ignored by nl_*_brace = true sp_paren_brace = force # space between ')' and '{' sp_fparen_brace = force # space between ')' and '{' of function sp_sparen_brace = force # space between ')' and '{' of if, while, etc sp_after_cast = force # space after cast - "(int) a" vs "(int)a" sp_before_byref = force # space before '&' of 'fcn(int& idx)' sp_inside_fparen = remove # space inside 'foo( xxx )' vs 'foo(xxx)' sp_inside_fparens = remove # space inside 'foo( )' vs 'foo()' sp_inside_paren = remove # space inside '+ ( xxx )' vs '+ (xxx)' sp_inside_square = remove # space inside 'byte[ 5 ]' vs 'byte[5]' sp_inside_sparen = remove # space inside 'if( xxx )' vs 'if(xxx)' sp_inside_angle = ignore # space inside '<>', as in '' sp_before_sparen = force # space before '(' of 'if/for/while/switch' sp_after_sparen = force # space after ')' of 'if/for/while/switch' # the do-while does not get set here sp_before_angle = ignore # space before '<>', as in '' sp_after_angle = ignore # space after '<>', as in '' sp_before_square = ignore # space before single '[' sp_before_squares = remove # space before '[]', as in 'byte []' sp_paren_paren = remove # space between nested parens - '( (' vs '((' sp_return_paren = remove # space between 'return' and '(' sp_sizeof_paren = remove # space between 'sizeof' and '(' sp_after_comma = force # space after ',' sp_arith = force # space around + - / * etc sp_bool = force # space around || && sp_compare = force # space around < > ==, etc sp_assign = force # space around =, +=, etc sp_func_def_paren = remove # space between 'func' and '(' - "foo (" vs "foo(" sp_func_call_paren = remove # space between 'func' and '(' - "foo (" vs "foo(" sp_func_proto_paren = remove # space between 'func' and '(' - "foo (" vs "foo(" sp_func_class_paren = remove # space between ctor/dtor and '(' #sp_type_func = 1 # space between return type and 'func' # a minimum of 1 is forced except for '*' sp_special_semi = remove # space empty stmt ';' on while, if, for # example "while (*p++ = ' ') ;" sp_before_semi = remove # space before all ';' sp_after_semi = force sp_inside_braces = remove # space inside '{' and '}' - "{ 1, 2, 3 }" sp_inside_braces_enum = remove # space inside enum '{' and '}' - "{ a, b, c }" sp_inside_braces_struct = remove # space inside struct/union '{' and '}' sp_macro = force # space between macro and value, ie '#define a 6' sp_macro_func = force # space between macro and value, ie '#define a 6' sp_square_fparen = ignore # weird pawn stuff: native yark[rect](a[rect]) sp_after_tag = remove # pawn: space after a tag colon ################################ # Code Alignment # (not left column spaces/tabs) align_with_tabs = true # use tabs for aligning (0/1) align_keep_tabs = false # keep non-indenting tabs align_on_tabstop = true # always align on tabstops align_nl_cont = false # align the back-slash \n combo (macros) align_enum_equ_span = 1 # align the '=' in enums align_assign_span = 1 # align on '='. 0=don't align align_assign_thresh = 0 # threshold for aligning on '='. 0=no limit align_right_cmt_span = 8 # align comment that end lines. 0=don't align align_var_def_span = 1 # align variable defs on variable (span for regular stuff) align_var_def_thresh = 0 # align variable defs threshold align_var_def_inline = true # also align inline struct/enum/union var defs align_var_def_star_style = 1 # the star is part of the variable name align_var_def_colon = false # align the colon in struct bit fields align_var_struct_span = 1 # span for struct/union (0=don't align) align_pp_define_span = 1 # align bodies in #define statements align_pp_define_gap = 1 # min space between define label and value "#define a <---> 16" align_struct_init_span = 1 # align structure initializer values align_func_proto_span = 1 # align function prototypes align_number_left = false # left-align numbers (not fully supported, yet) align_typedef_span = 1 # align single-line typedefs align_typedef_gap = 1 # minimum spacing align_typedef_star_style = 1 # Start aligning style # 0: '*' not part of type # 1: '*' part of the type - no space # 2: '*' part of type, dangling ##################################### # Newline Adding and Removing Options # Add/Remove/Ignore nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_func_decl_start = ignore # newline after the '(' in a function decl nl_func_decl_args = ignore # newline after each ',' in a function decl nl_func_decl_end = ignore # newline before the ')' in a function decl nl_func_type_name = ignore # newline between return type and func name in def nl_func_var_def_blk = 0 # newline after a block of variable defs nl_before_case = true # newline before 'case' statement nl_after_return = false # newline after return statement nl_after_case = true # disallow nested "case 1: a=3;" nl_fcall_brace = add # newline between function call and open brace nl_squeeze_ifdef = false # no blanks after #ifxx, #elxx, or before #endif TRUE/F nl_enum_brace = ignore # nl between enum and brace nl_struct_brace = ignore # nl between struct and brace nl_union_brace = ignore # nl between union and brace nl_assign_brace = ignore # nl between '=' and brace nl_class_brace = ignore # nl between class name and brace nl_namespace_brace = ignore # nl between namespace name and brace nl_do_brace = add # nl between do and { nl_if_brace = add # nl between if and { nl_for_brace = add # nl between for and { nl_else_brace = add # nl between else and { nl_while_brace = add # nl between while and { nl_switch_brace = add # nl between switch and { nl_brace_else = add # nl between } and else nl_brace_while = add # nl between } and while of do stmt nl_elseif_brace = add # nl between close paren and open brace in 'else if () {' nl_define_macro = 0 # alter newlines in #define macros nl_start_of_file = ignore # alter newlines at the start of file nl_start_of_file_min = 0 # min number of newlines at the start of the file nl_end_of_file = ignore # alter newlines at the end of file nl_end_of_file_min = 0 # min number of newlines at the end of the file pos_bool = lead # end=move &&/|| to EOL ignore=gnore, start=move to SOL ##################### # Blank Line Options nl_before_block_comment = 2 # before a block comment (stand-alone # comment-multi), except after brace open nl_after_func_body = 2 # after the closing brace of a function body nl_after_func_proto = 2 # after each prototype nl_after_func_proto_group = 2 # after a block of prototypes nl_max = 2 # maximum consecutive newlines (3=2 lines) eat_blanks_after_open_brace = true # remove blank lines after { eat_blanks_before_close_brace = true # remove blank lines before } ######################## # Code Modifying Options # (non-whitespace) mod_paren_on_return = remove # add or remove paren on return mod_full_brace_nl = 1 # max number of newlines to span w/o braces mod_full_brace_if = add # add or remove braces on if mod_full_brace_for = add # add or remove braces on for mod_full_brace_do = add # add or remove braces on do mod_full_brace_while = add # add or remove braces on while mod_pawn_semicolon = True # add optional semicolons mod_full_brace_function = add # add optional braces on Pawn functions ####################### # Comment Modifications cmt_star_cont = false # put a star on subsequent comment lines cmt_cpp_to_c = false # convert CPP comments to C comments cmt_cpp_group = false # if UO_cmt_cpp_to_c, try to group in one big C comment cmt_cpp_nl_start = false # put a blank /* at the start of a converted group cmt_cpp_nl_end = false # put a nl before the */ in a converted group string_escape_char=94 string_escape_char2=92 uncrustify-0.59/tests/config/mod-paren.cfg0000644000175000017500000004464711574765451015613 00000000000000# # My favorite format ("--update-config-with-doc") # # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\). (Pawn) string_escape_char = 92 # number # # Indenting # # The number of columns to indent per level (usually 2, 3, 4, or 8) indent_columns = 3 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to indent_columns. indent_member = 3 # number # Spaces to indent 'case' from 'switch' indent_switch_case = 0 # number # Spaces to indent '{' from 'case' indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels (>0=absolute column where 1 is the leftmost column, <=0=subtract from brace indent) indent_label = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = force # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name (a minimum of 1 is forced except for pointer return types) sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true align_func_params = true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # Whether the pointer star is part of the variable name or not align_var_def_star_style = 1 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 12 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type: typedef int * pint; align_typedef_star_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = true # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between function call and '(' nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of the function body nl_after_func_body = 2 # number # The minimum number of newlines before a multi-line comment (doesn't apply if after a brace open) nl_before_block_comment = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = ignore # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = ignore # ignore/add/remove/force nl_getset_brace = force mod_full_paren_if_bool = true uncrustify-0.59/tests/config/pp-indent-1.cfg0000644000175000017500000000021611574765451015745 00000000000000# # Remove all PP spacing and indent # pp_indent = remove pp_space = remove # Gives the format # |#ifdef SOMETHING # |#define X # |#endif uncrustify-0.59/tests/config/byref-right.cfg0000644000175000017500000000021511574765321016126 00000000000000# # Places the byref as follows: "int& foo" # indent_columns = 3 sp_before_byref = remove sp_after_byref = force indent_class = True uncrustify-0.59/tests/config/empty.cfg0000644000175000017500000000003711506773274015045 00000000000000# this is an empty config file uncrustify-0.59/tests/config/indent_paren_close-0.cfg0000644000175000017500000000017211506773274017677 00000000000000 indent_with_tabs = 1 input_tab_size = 8 output_tab_size = 8 indent_columns = output_tab_size indent_paren_close = 0 uncrustify-0.59/tests/config/const_throw.cfg0000644000175000017500000000052511506773274016262 00000000000000# Indentation column for standalone 'const' function decl/proto qualifier # e.g., int GetFoo(void)\n const\n { return (m_Foo); } indent_func_const = 69 # number # Indentation column for standalone 'throw' function decl/proto qualifier # e.g., int GetFoo(void)\n throw (std::bad_alloc)\n { return (m_Foo); } indent_func_throw = 41 # number uncrustify-0.59/tests/config/pawn.cfg0000644000175000017500000000157511574765451014667 00000000000000# # junk # indent_with_tabs = 0 input_tab_size = 4 #output_tab_size = 4 indent_columns = 4 align_pp_define_span = 1 align_pp_define_gap = 3 align_right_cmt_span = 2 nl_if_brace = remove nl_elseif_brace = remove nl_else_brace = remove nl_brace_else = remove nl_fdef_brace = force sp_arith = force sp_macro = force sp_macro_func = force sp_sparen_brace = force sp_after_sparen = add sp_fparen_brace = force sp_square_fparen = remove sp_inside_braces = add sp_after_tag = remove sp_else_brace = force sp_brace_else = force sp_paren_brace = force cmt_star_cont = true #cmt_cpp_to_c = true #cmt_cpp_group = true #cmt_cpp_nl_start = true #cmt_cpp_nl_end = true mod_full_brace_if = add mod_full_brace_for = add mod_full_brace_do = add mod_full_brace_while = add mod_full_brace_function = add # note: for normal usage, this option is 'bad' mod_pawn_semicolon = true uncrustify-0.59/tests/config/bool-pos-eol-break.cfg~0000644000175000017500000000064111506773274017477 00000000000000# # moves boolean ops to the end of line # # $Id: bool-pos-eol.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = trail_break pos_comma = Trail pos_class_comma = trail sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/cmt_indent-2.cfg0000644000175000017500000000021411506773274016167 00000000000000indent_with_tabs = 2 indent_columns = 2 indent_namespace = true indent_class = true nl_collapse_empty_body = true cmt_indent_multi = false uncrustify-0.59/tests/config/wessex.cfg0000644000175000017500000006070511506773274015235 00000000000000 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 4 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 4 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 4 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 4 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = true # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 4 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = force # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = force # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = remove # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = remove # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = force # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = force # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = remove # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = remove # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = remove # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = remove # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = force # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = remove # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = remove # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = remove # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = remove # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = force # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = force # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 4 # number # How to align the star in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_star_style = 1 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 4 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 4 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 4 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 4 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 4 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 4 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 4 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 4 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 1 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 4 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 4 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 4 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 120 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't touch one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = force # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between function call and '(' nl_fcall_brace = remove # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = force # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = force # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = force # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = force # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = force # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = force # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = force # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = force # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = force # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = force # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = force # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = force # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = force # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = force # ignore/add/remove/force # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = force # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = force # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = force # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = force # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = force # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = force # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = force # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = remove # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = force # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = remove # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = force # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = remove # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = force # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = remove # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = force # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = remove # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = trail # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = lead # ignore/lead/trail # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = true # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = true # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 2 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 1 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 2 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 2 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 2 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = add # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = remove # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = remove # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = remove # ignore/add/remove/force # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP macro-open BEGIN_TEMPLATE_MESSAGE_MAP macro-open BEGIN_MESSAGE_MAP macro-close END_MESSAGE_MAP uncrustify-0.59/tests/config/sp_after_oc_at_sel_remove.cfg0000644000175000017500000000041111506773274021073 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_at_sel = remove sp_after_oc_at_sel_parens = remove sp_inside_square = remove uncrustify-0.59/tests/config/pp_if_indent-1.cfg0000644000175000017500000000022311506773274016500 00000000000000# indented region code pp_indent = add indent_columns = 4 pp_if_indent_code = true pp_indent_if = 0 pp_indent_at_level = true uncrustify-0.59/tests/config/star_pos-0.cfg0000644000175000017500000000102311506773274015672 00000000000000# # Places the byref as follows: "int &foo" # # $Id: byref-left.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_columns = 3 align_typedef_span = 2 align_typedef_gap = 3 align_typedef_star_style = 0 align_typedef_amp_style = 0 align_var_def_span = 2 align_var_def_star_style = 0 align_var_def_amp_style = 0 align_var_struct_span = 2 align_func_proto_span = 2 sp_before_ptr_star = remove sp_between_ptr_star = remove sp_after_ptr_star = force sp_before_byref = remove sp_after_byref = force uncrustify-0.59/tests/config/region-3.cfg0000644000175000017500000000021511506773274015330 00000000000000# Abs column region preproc indent_columns = 4 pp_region_indent_code = false pp_indent_region = 2 indent_class = true uncrustify-0.59/tests/config/sort_imports.cfg0000644000175000017500000000010711506773274016451 00000000000000 mod_sort_import = true mod_sort_include = true mod_sort_using = true uncrustify-0.59/tests/config/mod-paren2.cfg0000644000175000017500000004474411506773274015670 00000000000000# # My favorite format ("--update-config-with-doc") # # $Id: mod-paren.cfg 803 2007-07-25 00:36:25Z bengardner $ # # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\). (Pawn) string_escape_char = 92 # number # # Indenting # # The number of columns to indent per level (usually 2, 3, 4, or 8) indent_columns = 3 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to indent_columns. indent_member = 3 # number # Spaces to indent 'case' from 'switch' indent_switch_case = 0 # number # Spaces to indent '{' from 'case' indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels (>0=absolute column where 1 is the leftmost column, <=0=subtract from brace indent) indent_label = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = force # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name (a minimum of 1 is forced except for pointer return types) sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true align_func_params = true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # Whether the pointer star is part of the variable name or not align_var_def_star_style = 1 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 12 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type: typedef int * pint; align_typedef_star_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = true # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between function call and '(' nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of the function body nl_after_func_body = 2 # number # The minimum number of newlines before a multi-line comment (doesn't apply if after a brace open) nl_before_block_comment = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = remove # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = ignore # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = ignore # ignore/add/remove/force nl_getset_brace = force mod_full_paren_if_bool = true uncrustify-0.59/tests/config/oc_sel_1.cfg0000644000175000017500000000004211506773274015367 00000000000000sp_after_oc_at_sel_parens = force uncrustify-0.59/tests/config/d.cfg0000644000175000017500000000634711574765451014147 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_case_brace = indent_columns indent_class = true nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE nl_after_brace_open = TRUE #nl_func_leave_one_liners = FALSE #nl_class_leave_one_liners = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_square = remove sp_before_squares = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove sp_range = force align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 align_struct_init_span = 3 align_var_struct_span = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 align_typedef_star_style = 1 # cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE indent_paren_nl = TRUE uncrustify-0.59/tests/config/pp-space.cfg0000644000175000017500000000017411506773274015421 00000000000000indent_columns = 4 indent_with_tabs = 1 output_tab_size = 4 pp_indent = add pp_indent_count = 4 pp_indent_at_level = false uncrustify-0.59/tests/config/cmt_multi-2.cfg0000644000175000017500000000006211506773274016041 00000000000000indent_columns = 4 cmt_multi_check_last = true uncrustify-0.59/tests/config/brace-allman.cfg0000644000175000017500000000157311574765302016231 00000000000000# # Allman style # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size # brace settings nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_brace_while = remove nl_brace_else = add uncrustify-0.59/tests/config/nl_template_class-force.cfg0000644000175000017500000000072011574765451020476 00000000000000# # Forces a newline between template '>' and class # indent_columns = 3 sp_before_byref = remove sp_after_byref = force indent_class = True sp_func_def_paren = remove sp_func_proto_paren = remove sp_after_operator = force sp_after_angle = force sp_angle_word = force sp_angle_paren = remove sp_arith = force sp_compare = force nl_template_class = force sp_inside_braces = force sp_inside_braces_struct = force tok_split_gte = true uncrustify-0.59/tests/config/d3.cfg0000644000175000017500000000615411506773274014223 00000000000000# # $Id: d.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_case_brace = indent_columns nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_square = remove sp_before_squares = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 align_struct_init_span = 3 align_var_struct_span = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 align_typedef_star_style = 1 # cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE indent_paren_nl = TRUE nl_assign_square = remove uncrustify-0.59/tests/config/align_right_cmt_gap-1.cfg0000644000175000017500000000020111506773274020017 00000000000000indent_columns = 3 indent_with_tabs = 0 align_right_cmt_span = 8 align_right_cmt_mix = false align_right_cmt_gap = 0 uncrustify-0.59/tests/config/sp_cmt_cpp_start_force.cfg0000644000175000017500000000003311506773274020425 00000000000000 sp_cmt_cpp_start = force uncrustify-0.59/tests/config/pp_if_indent-0.cfg0000644000175000017500000000022511506773274016501 00000000000000# default region indent pp_indent = add indent_columns = 4 pp_if_indent_code = false pp_indent_if = 0 pp_indent_at_level = true uncrustify-0.59/tests/config/sp_before_oc_block_caret_remove.cfg0000644000175000017500000000031311506773274022236 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_before_oc_block_caret = removeuncrustify-0.59/tests/config/nl_func_decl_2.cfg0000644000175000017500000000064211506773274016545 00000000000000 nl_func_paren = force nl_func_decl_empty = force nl_func_decl_start = force nl_func_decl_args = force nl_func_decl_end = force nl_func_def_paren = remove nl_func_def_empty = remove nl_func_def_start = remove nl_func_def_args = remove nl_func_def_end = remove # a few more options to make the output pretty sp_after_comma = force sp_inside_paren = force sp_inside_fparen = force align_func_params = true uncrustify-0.59/tests/config/pp_define_at_level-1.cfg0000644000175000017500000000015411506773274017651 00000000000000pp_define_at_level = true indent_class = true indent_columns = 4 indent_with_tabs = 0 output_tab_size = 8 uncrustify-0.59/tests/config/cast-type.cfg0000644000175000017500000001616111506773274015625 00000000000000newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 indent_columns = 3 indent_with_tabs = 0 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_class = true indent_class_colon = false indent_func_call_param = false indent_member = 3 indent_sing_line_comments = 0 indent_switch_case = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_paren_nl = false indent_square_nl = false sp_arith = force sp_assign = force sp_bool = force sp_compare = force sp_inside_paren = remove sp_inside_paren_cast = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = remove sp_after_byref = ignore sp_before_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_before_sparen = force sp_inside_sparen = remove sp_after_sparen = force sp_sparen_brace = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_after_operator = ignore sp_after_cast = remove sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_angle = remove sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = remove sp_func_class_paren = ignore sp_return_paren = remove sp_macro = ignore sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_thresh = 0 align_var_def_colon = true align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 align_right_cmt_span = 3 align_func_proto_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 code_width = 0 nl_collapse_empty_body = false nl_class_leave_one_liners = true nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_before_case = true nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_after_semicolon = false nl_after_brace_open = false nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false pos_bool = ignore pos_class_colon = ignore ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 pp_indent = ignore pp_space = ignore type UINT UInt UInt32 UInt16 Uint UINT8 UINT16 UINT32 uint32_t uncrustify-0.59/tests/config/avalon.cfg0000644000175000017500000002144611506773274015176 00000000000000# Sets the line endings for the output file newlines = AUTO # AUTO/LF/CRLF/CR # The original tab space value. # Used to determine what was already aligned. (TODO) input_tab_size = 2 # number # Size of tabs in the output. # Only important if indent_with_tabs=2. output_tab_size = 2 # number # The number of columns to indent. # Usually 2, 3, 4, or 8. indent_columns = 2 # number # How to use tabs when indenting code. # 0 = Use spaces only # 1 = Use tabs to the brace-level indent (very portable) # 2 = Use tabs whenever possible indent_with_tabs = 0 # number # If an open paren is followed by a newline, indent the next line # so that it lines up after the open paren. # Not recommended. indent_paren_nl = false # bool # Changes the space between # and, say, define. pp_space = ignore # IARF # Changes the indent of preprocessors. pp_indent = ignore # IARF # Spaces to indent case from switch (usually 0 or indent_columns). indent_switch_case = 2 # number * REVISIT: make TRUE/FALSE? * # Spaces to indent '{' from level (usually 0). For GNU style, set to 2. indent_brace = 0 # number # Whether braces are indented to the body level or not. indent_braces = false # bool indent_class = false indent_namespace = false # How to indent goto labels. # > 0 : Absolute column (1=leftmost column) # <= 0 : Subtract from brace indent indent_label = -2 # number # Whether to indent broken strings so that they line up. indent_align_string = false # bool # Whether to indent comments found in column 1. indent_col1_comment = false # bool # If true, indent continued function call parameters one indent level. indent_func_call_param = false # bool # # Spacing Options # # Space between ')' and '{' sp_paren_brace = force # IARF # Space after cast - "(int) a" vs "(int)a" sp_after_cast = remove # IARF # Space before & in function definition param: sp_before_byref = remove # IARF # Space inside 'foo( xxx )' vs 'foo(xxx)' sp_inside_fparen = remove # IARF # space inside '+ ( xxx )' vs '+ (xxx)' sp_inside_paren = remove # IARF # space inside 'byte[ 5 ]' vs 'byte[5]' sp_inside_square = remove # IARF # Space inside 'if( xxx )' vs 'if(xxx)' sp_inside_sparen = remove # IARF # Space inside '<>' sp_inside_angle = remove # IARF # Space before '(' of 'if/for/while/switch'. sp_before_sparen = force # IARF # Space after ')' of 'if/for/while/switch' sp_after_sparen = force # IARF # Space before '<>' sp_before_angle = remove # IARF # Space after '<>' sp_after_angle = remove # IARF # space before all '[', except '[]' sp_before_square = force # IARF # space before '[]' sp_before_squares = remove # IARF # space between nested parens - '( (' vs '((' sp_paren_paren = remove # IARF # space between 'return' and '(' sp_return_paren = force # IARF # space between 'sizeof' and '(' sp_sizeof_paren = remove # IARF # space after ',' sp_after_comma = force # IARF # space around + - / * etc sp_arith = force # IARF # space around || && sp_bool = force # IARF # space around < > ==, etc sp_compare = force # IARF # space around =, +=, etc sp_assign = force # IARF # space between 'func' and '(' - "foo (" vs "foo(" sp_func_def_paren = remove # IARF # space between 'func' and '(' - "foo (" vs "foo(" sp_func_call_paren = remove # IARF # space between 'func' and '(' - "foo (" vs "foo(" sp_func_proto_paren = remove # IARF # Space between return type and 'func' #sp_type_func = force # IARF # Space empty stmt ';' on while, if, for sp_special_semi = force # IARF # Space before all ';' sp_before_semi = remove # IARF # Space inside '{' and '}' - "{ 1, 2, 3 }" sp_inside_braces = remove # IARF # Space inside enum '{' and '}' - "{ a, b, c }" sp_inside_braces_enum = remove # IARF # Space inside struct/union '{' and '}' sp_inside_braces_struct = remove # IARF # # Code alignment (not left column spaces/tabs) # # Use tabs for aligning. align_with_tabs = false # bool # Keep non-indenting tabs. align_keep_tabs = false # bool # When aligning, bump out to the next tabstop. align_on_tabstop = false # bool # Align the back-slash \n combo (macros) align_nl_cont = true # bool # Align the '=' in enums align_enum_equ_span = 0 # bool # The span for aligning on '=' in assignments. 0=don't align align_assign_span = 0 # number # Span for aligning comments that end lines. 0=don't align align_right_cmt_span = 0 # number # Span for aligning variable definitions align_var_def_span = 0 # number # Whether to align inline struct/enum/union var defs align_var_def_inline = 0 # bool # Whether the star is part of the variable name or not. align_var_def_star_style = 2 # bool # Align the colon in struct bit fields align_var_def_colon = false # bool # Span for struct/union (0=don't align) align_var_struct_span = 0 # number # align bodies in #define statements align_pp_define_span = 0 # number # Min space between define label and value "#define a <---> 16" align_pp_define_gap = 1 # number # Align structure initializer values align_struct_init_span = 0 # number # Align function prototypes align_func_proto_span = 0 # number # left-align numbers #align_number_left: bool * a little buggy * # align single-line typedefs #align_typedef_span: number # minimum spacing #align_typedef_gap: number # Start aligning style # 0: '*' not part of type # 1: '*' part of the type - no space # 2: '*' part of type, dangling align_typedef_star_style = 0 # number # # Newline adding and removing options # # "int foo() {" vs "int foo()\n{" nl_fdef_brace = force # IARF # Newline after '(' in a function decl nl_func_decl_start = remove # IARF # Newline after each ',' in a function decl nl_func_decl_args = remove # IARF # Newline before the ')' in a function decl nl_func_decl_end = remove # IARF # Newline between return type and func name in def nl_func_type_name = remove # IARF # Newline after a block of variable defs nl_func_var_def_blk = 0 # number # newline before 'case' statement nl_before_case = false # bool # newline after return statement nl_after_return = true # bool # Disallow nested "case 1: a=3;" nl_after_case = true # bool # newline between function call and open brace nl_fcall_brace = remove # IARF # No blanks after #ifxx, #elxx, or before #endif nl_squeeze_ifdef = false # bool # nl between enum and brace nl_enum_brace = remove # IARF # nl between struct and brace nl_struct_brace = remove # IARF # nl between union and brace nl_union_brace = remove # IARF # nl between = and { nl_assign_brace = remove # IARF # nl between do and { nl_do_brace = remove # IARF # nl between if and { nl_if_brace = remove # IARF # nl between for and { nl_for_brace = remove # IARF # nl between else and { nl_else_brace = remove # IARF # nl between while and { nl_while_brace = remove # IARF # nl between switch and { nl_switch_brace = remove # IARF # nl between } and else nl_brace_else = remove # IARF # nl between } and while of do stmt nl_brace_while = remove # IARF # Alter newlines in #define macros nl_define_macro = false # bool # Add or remove newlines at the start of the file nl_start_of_file = remove # IARF # Number of newlines at the start of the file. Only used if nl_start_of_file is Add or Force #nl_start_of_file_min: number # Add or remove newlines at the end of the file nl_end_of_file = force # IARF # Number of newlines at the end of the file. Only used if nl_end_of_file is Add or Force nl_end_of_file_min = 1 # number # -1: boolean ops are at the end of the line # 0: do not move boolean ops (default) # 1: boolean ops are at the start of the line pos_bool = Trail # position (Trail, None, Lead) # # Blank line options # Note that it takes 2 newlines to get a blank line. # # Minimum number of newlines before a multi-line comment. nl_before_block_comment = 2 # number # Newlines after the closing brace of a function body nl_after_func_body = 2 # number # Newlines after a single function prototype. nl_after_func_proto = 1 # number # Newlines after a prototype, if not followed by another prototype. nl_after_func_proto_group = 2 # number # The maximum consecutive newlines. nl_max = 4 # number # Remove blank lines after { eat_blanks_after_open_brace = true # bool # Remove blank lines before } eat_blanks_before_close_brace = true # bool # # code modifying options (non-whitespace) # # Add or remove unecessary paren on return. mod_paren_on_return = remove # IARF # add or remove braces on single-statement if mod_full_brace_if = add # IARF # add or remove braces on single-statement for mod_full_brace_for = add # IARF # add or remove braces on single-statement do mod_full_brace_do = add # IARF # add or remove braces on single-statement while mod_full_brace_while = add # IARF # don't remove braces around statements that span X newlines #mod_full_brace_nl: number # # Comment modifications # # Put a star on subsequent comment lines #cmt_star_cont: bool uncrustify-0.59/tests/config/indent_paren_close-2.cfg0000644000175000017500000000017211506773274017701 00000000000000 indent_with_tabs = 1 input_tab_size = 8 output_tab_size = 8 indent_columns = output_tab_size indent_paren_close = 2 uncrustify-0.59/tests/config/sp_before_tr_emb_cmt-f.cfg0000644000175000017500000015747711631560313020301 00000000000000 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. # If true (default), 'assert(x<0 && y>=3)' will be broken. # Improvements to template detection may make this option obsolete. tok_split_gte = false # false/true # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 2 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop indent_with_tabs = 0 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = true # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = true # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = true # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = true # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = true # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = true # false/true # Same as indent_func_call_param, but for templates indent_template_param = true # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = true # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 2 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = true # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 2 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 2 # number # Whether to indent comments found in first column indent_col1_comment = true # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 2 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 2 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype sp_assign_default = remove # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = force # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = add # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = add # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = remove # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = add # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = add # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = add # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = add # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = remove # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = force # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = force # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = force # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = add # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = ignore # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add space before trailing comment, e.g., do_something(); // trailing comment sp_before_tr_emb_cmt = force # Number of spaces before trailing comment, e.g., do_something(); // trailing comment sp_num_before_tr_emb_cmt = 2 # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = add # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = add # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = remove # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = ignore # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = force # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = add # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '(' in 'catch (something) { }' # If set to ignore, sp_before_sparen is used. sp_catch_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = add # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = add # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = add # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = add # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = add # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = add # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = add # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = add # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = true # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = true # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = remove # ignore/add/remove/force # The number of blank lines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = remove # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = remove # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = remove # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = remove # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = remove # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = remove # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = remove # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = remove # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = true # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = remove # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = force # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = remove # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = add # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = remove # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition nl_func_def_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = add # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = add # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = remove # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = add # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = add # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = remove # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = remove # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = remove # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = remove # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = remove # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = remove # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = true # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = true # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_class_comma = trail_force # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_class_colon = lead # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 120 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = true # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = true # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 3 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 2 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 2 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 2 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 2 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 1 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = ignore # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = true # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = true # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = remove # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/tests/config/file_footer.txt0000644000175000017500000000005411506773274016263 00000000000000/** * CVS History: * $Log $ * */ uncrustify-0.59/tests/config/indent-1.cfg0000644000175000017500000000060611574765451015333 00000000000000# indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 4 # original tab size output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_member = indent_columns indent_switch_case = indent_columns uncrustify-0.59/tests/config/nl_ds_struct_enum-1.cfg0000644000175000017500000000020311506773274017567 00000000000000# # Double-space commented struct/enum/union blocks # nl_ds_struct_enum_cmt = true nl_ds_struct_enum_close_brace = false uncrustify-0.59/tests/config/d_sp_paren.cfg0000644000175000017500000000022411507441006016001 00000000000000 #sp_catch_paren = force sp_catch_paren = remove sp_throw_paren = remove sp_version_paren = remove sp_scope_paren = remove sp_before_sparen = force uncrustify-0.59/tests/config/ptr_star-2.cfg0000644000175000017500000000035211506773274015704 00000000000000sp_after_ptr_star = remove sp_after_ptr_star_func = remove sp_before_ptr_star = force sp_between_ptr_star = remove sp_before_unnamed_ptr_star = ignore sp_before_byref = force sp_after_byref = remove sp_before_unnamed_byref = ignore uncrustify-0.59/tests/config/indent_namespace-f.cfg0000644000175000017500000000016511506773274017431 00000000000000# # $Id: nl_namespace-r.cfg 803 2007-07-25 00:36:25Z bengardner $ indent_class = True indent_namespace = False uncrustify-0.59/tests/config/region-1.cfg0000644000175000017500000000020711506773274015327 00000000000000# indented region code indent_columns = 4 pp_region_indent_code = true pp_indent_region = 0 indent_class = true uncrustify-0.59/tests/config/al.cfg0000644000175000017500000011363211506773274014311 00000000000000# # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 4 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 4 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 4 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = false # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 4 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 4 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 4 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 4 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 1 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = ignore # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = force # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = true # false/true # Add or remove space between ')' and '{' sp_paren_brace = remove # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = force # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = remove # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = force # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = remove # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = force # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = remove # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = remove # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = force # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = force # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = force # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = remove # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = remove # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = force # ignore/add/remove/force # Add or remove space after cast sp_after_cast = force # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = remove # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = remove # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = force # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = force # ignore/add/remove/force # Add or remove space between macro and value sp_macro = force # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = force # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f: (int) x;' vs '+(int) f : (int) x;' sp_before_oc_colon = force # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '+(int)f : (int)x;' sp_after_oc_type = force # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 20 # number # How to align the star in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 30 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 10 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 12 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 30 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 30 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 8 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 4 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 2 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 2 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # The span for aligning function prototypes (0=don't align) align_func_proto_span = 3 # number # The span for aligning function prototypes (0=don't align) align_oc_msg_spec_span = 3 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 2 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 50 # number # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = false # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = force # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = force # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = add # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add or remove newline when condition spans two or more lines nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { nl_namespace_brace = add # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = true # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = true # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove newline before 'if' nl_before_if = add # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = add # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = add # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = add # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = add # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = add # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = add # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = add # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = add # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = add # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = true # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = true # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = trail # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 80 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = true # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = true # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 3 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 1 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 3 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 5 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 5 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 1 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 1 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 1 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = true # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = add # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 1 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = remove # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 1 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 10 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # # Comment modifications # # Try to wrap comments at cmt_witdth columns cmt_width = 80 # number # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = true # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 1 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP uncrustify-0.59/tests/config/nl_class-a.cfg0000644000175000017500000000010511574765451015722 00000000000000# nl_class_brace = Add indent_class = True indent_namespace = True uncrustify-0.59/tests/config/align_typedef_func-1.cfg0000644000175000017500000000021211506773274017665 00000000000000 align_typedef_func = 1 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 uncrustify-0.59/tests/config/nl_brace_test.cfg0000644000175000017500000013735411506773274016530 00000000000000# Uncrustify 0.50+svn # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 2 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = false # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = true # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = ignore # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = add # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = add # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = remove # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = add # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = add # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = ignore # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = add # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = remove # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = ignore # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':' sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = ignore # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = add # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = add # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = add # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = add # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = add # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = ignore # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = add # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = add # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = add # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = add # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = add # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = add # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = add # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = add # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = add # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = add # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '-(int) f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 2 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 1 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 1 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 1 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 1 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 1 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 1 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 2 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 1 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = true # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 1 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 1 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = false # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = add # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = force # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = add # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = add # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = add # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = add # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = add # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = ignore # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add or remove newline when condition spans two or more lines nl_multi_line_cond = true # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = force # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = force # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = force # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 96 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = true # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = add # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = true # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = true # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = true # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = true # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = true # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = true # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ uncrustify-0.59/tests/config/cast-sp-r.cfg0000644000175000017500000001605711506773274015531 00000000000000newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 indent_columns = 3 indent_with_tabs = 0 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_class = true indent_class_colon = false indent_func_call_param = false indent_member = 3 indent_sing_line_comments = 0 indent_switch_case = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_paren_nl = false indent_square_nl = false sp_arith = force sp_assign = force sp_bool = force sp_compare = force sp_inside_paren = remove sp_inside_paren_cast = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = remove sp_after_byref = ignore sp_before_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_before_sparen = force sp_inside_sparen = remove sp_after_sparen = force sp_sparen_brace = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_after_operator = ignore sp_after_cast = remove sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_angle = remove sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = remove sp_func_class_paren = ignore sp_return_paren = remove sp_macro = ignore sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_thresh = 0 align_var_def_colon = true align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 align_right_cmt_span = 3 align_func_proto_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 code_width = 0 nl_collapse_empty_body = false nl_class_leave_one_liners = true nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_before_case = true nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_after_semicolon = false nl_after_brace_open = false nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false pos_bool = ignore pos_class_colon = ignore ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 pp_indent = ignore pp_space = ignore uncrustify-0.59/tests/config/pp_if_indent-3.cfg0000644000175000017500000000023111506773274016501 00000000000000# Abs column region preproc pp_indent = add indent_columns = 4 pp_if_indent_code = true pp_indent_if = 0 pp_indent_at_level = false uncrustify-0.59/tests/config/class-header.h0000644000175000017500000000006111506773274015727 00000000000000/** * CLASS: $(class) * TODO: DESCRIPTION */ uncrustify-0.59/tests/config/align-2.cfg0000644000175000017500000000602411574765270015144 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_func_params = TRUE align_var_def_span = 2 align_var_def_thresh = 16 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 2 align_assign_thresh = 3 align_struct_init_span = 3 align_var_struct_span = 3 align_var_struct_thresh = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/tests/config/tcf.cfg0000644000175000017500000000015211506773274014461 00000000000000nl_finally_brace = force nl_after_try_catch_finally = 3 nl_between_get_set = 2 nl_around_cs_property = 2 uncrustify-0.59/tests/config/add_comment.cfg0000644000175000017500000000013211506773274016155 00000000000000cmt_insert_func_header = "./uncommented_func_header.h" # string uncrustify-0.59/tests/config/region-0.cfg0000644000175000017500000000021111506773274015321 00000000000000# default region indent indent_columns = 4 pp_region_indent_code = false pp_indent_region = 0 indent_class = true uncrustify-0.59/tests/config/nl_func_type_name_force.cfg0000644000175000017500000000023711506773274020554 00000000000000 sp_cmt_cpp_start = add # align_var_def_span = 16 align_func_proto_span =16 align_on_operator =true nl_func_type_name = force nl_func_proto_type_name = force uncrustify-0.59/tests/config/endif.cfg0000644000175000017500000000372211506773274015000 00000000000000indent_func_def_param=true indent_paren_nl=true nl_after_brace_open=true nl_after_return=true nl_after_semicolon=true nl_after_vbrace_open=true nl_assign_leave_one_liners=true nl_before_case=true nl_collapse_empty_body=true pp_define_at_level=true pp_if_indent_code=true pp_indent_at_level=true pp_region_indent_code=true indent_columns=3 indent_with_tabs=0 nl_end_of_file_min=1 nl_func_var_def_blk=1 pp_indent_region=3 pp_space_count=3 mod_full_brace_while=add mod_paren_on_return=force nl_after_do=force nl_after_for=force nl_after_if=force nl_after_switch=force nl_after_while=force nl_before_do=force nl_before_for=force nl_before_if=force nl_before_switch=force nl_before_while=force nl_brace_else=force nl_brace_while=force nl_class_brace=force nl_else_brace=force nl_elseif_brace=force nl_end_of_file=force nl_fcall_brace=force nl_fdef_brace=force nl_for_brace=force nl_func_decl_args=force nl_func_decl_end=add nl_func_decl_start=force nl_func_paren=force nl_func_proto_type_name=remove nl_func_type_name=remove nl_if_brace=force nl_while_brace=add pos_class_comma=trail pos_comma=trail pp_indent=force sp_after_cast=remove sp_after_comma=force sp_after_oc_type=remove sp_after_ptr_star=add sp_after_sparen=force sp_arith=force sp_assign=force sp_before_comma=remove sp_before_ptr_star=remove sp_before_semi=remove sp_before_semi_for=remove sp_before_semi_for_empty=remove sp_before_sparen=remove sp_before_square=remove sp_before_squares=remove sp_bool=force sp_brace_else=force sp_compare=force sp_deref=remove sp_fparen_brace=force sp_func_call_paren=remove sp_func_def_paren=remove sp_func_proto_paren=remove sp_incdec=remove sp_inside_braces=force sp_inside_fparen=remove sp_inside_fparens=remove sp_inside_paren=remove sp_inside_paren_cast=remove sp_inside_sparen=remove sp_macro=force sp_macro_func=force sp_member=remove sp_not=remove sp_paren_paren=remove sp_return_paren=force sp_type_func=force uncrustify-0.59/tests/config/pos_compare-eol.cfg0000644000175000017500000000004711506773274016774 00000000000000pos_compare = trail sp_compare = force uncrustify-0.59/tests/config/cmt_indent-3.cfg0000644000175000017500000000024011506773274016167 00000000000000indent_with_tabs = 2 indent_columns = 2 indent_namespace = true indent_class = true nl_collapse_empty_body = true cmt_indent_multi = true cmt_star_cont = true uncrustify-0.59/tests/config/delete.cfg0000644000175000017500000000004511506773274015150 00000000000000indent_columns = 2 sp_arith = force uncrustify-0.59/tests/config/file_header.txt0000644000175000017500000000076611506773274016227 00000000000000/*******************************************************************************//** * * @file $(filename) * * * ***********************************************************************************/ uncrustify-0.59/tests/config/indent_var_def.cfg0000644000175000017500000013545211506773274016670 00000000000000# Uncrustify 0.50+svn # $Id: ben.cfg 1421 2008-11-14 00:56:36Z bengardner $ # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 3 # number indent_var_def_blk = -indent_columns # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 3 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = force # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '-(int) f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = remove # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 16 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = force # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = force # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = force # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = force # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add or remove newline when condition spans two or more lines nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 3 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 1 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = force # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ uncrustify-0.59/tests/config/sp_cmt_cpp_start_remove.cfg0000644000175000017500000000003411506773274020625 00000000000000 sp_cmt_cpp_start = remove uncrustify-0.59/tests/config/nl_after_func_body-2.cfg0000644000175000017500000000044011574765451017671 00000000000000# indent_class = true nl_fdef_brace = remove nl_class_leave_one_liners = true nl_after_func_body = 4 nl_after_func_body_one_liner = 2 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true sp_fparen_brace = force uncrustify-0.59/tests/config/cgal.cfg0000644000175000017500000001704611506773274014625 00000000000000newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 indent_columns = 3 indent_with_tabs = 0 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_class = true indent_class_colon = false indent_func_call_param = false indent_member = 3 indent_sing_line_comments = 0 indent_switch_case = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_paren_nl = false indent_square_nl = false sp_arith = force sp_assign = force sp_bool = force sp_compare = force sp_inside_paren = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = remove sp_after_byref = ignore sp_before_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_before_sparen = force sp_inside_sparen = force sp_inside_sparen_close = remove sp_after_sparen = force sp_sparen_brace = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_after_operator = ignore sp_after_cast = remove sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_angle = remove sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = remove sp_func_class_paren = ignore sp_return_paren = remove sp_macro = ignore sp_before_semi_for_empty = force sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_thresh = 0 align_var_def_colon = true align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 align_right_cmt_span = 3 align_func_proto_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 code_width = 0 nl_collapse_empty_body = false nl_class_leave_one_liners = true nl_assign_leave_one_liners = true nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_before_case = true nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_after_semicolon = true nl_after_brace_open = true nl_after_vbrace_open = true nl_after_access_spec = 1 nl_assign_leave_one_liners = true nl_class_leave_one_liners = true nl_enum_leave_one_liners = true nl_getset_leave_one_liners = true nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false pos_bool = ignore pos_class_colon = ignore ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 pp_indent = remove pp_space = remove sp_after_dc = remove sp_before_dc = remove sp_attribute_paren = remove sp_defined_paren = force mod_add_long_function_closebrace_comment = 40 mod_add_long_switch_closebrace_comment = 40 sp_brace_typedef = force uncrustify-0.59/tests/config/indent_func_proto_param.cfg0000644000175000017500000000025511506773274020610 00000000000000indent_func_call_param = false indent_func_def_param = false indent_func_proto_param = true indent_columns = 3 indent_with_tabs = 1 output_tab_size = indent_columns uncrustify-0.59/tests/config/kw_subst3.cfg0000644000175000017500000011776211506773274015651 00000000000000# Uncrustify 0.46 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 4 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 4 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 4 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = false # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 4 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = add # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = add # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = add # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = add # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = ignore # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = ignore # ignore/add/remove/force # Add or remove space between type and word sp_after_type = force # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = add # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = add # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space after cast sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = add # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = ignore # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = ignore # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f: (int) x;' vs '+(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '+(int)f : (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 10 # number # How to align the star in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 1 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 10 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 4 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 10 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = false # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = add # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = ignore # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add or remove newline when condition spans two or more lines nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = true # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 4 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 4 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 4 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 50 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 50 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Whether to mess with the indent of multi-line comments cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 1 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "file_header.txt" # string cmt_insert_file_footer = "file_footer.txt" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "function_header.txt" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = true # false/true # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = true # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = true # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP uncrustify-0.59/tests/config/sp_after_oc_at_sel_add.cfg0000644000175000017500000000040311506773274020327 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_at_sel = add sp_after_oc_at_sel_parens = add sp_inside_square = remove uncrustify-0.59/tests/config/objc_complex_method.cfg0000644000175000017500000001164411506773274017721 00000000000000# # uncrustify config file for objective-c and objective-c++ # # $Id: objc.cfg 488 2009-10-08 12:44:38Z andreberg $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_assign = FALSE # # Indenting # # indent_brace = 0 indent_switch_case = indent_columns # # Inter-symbol newlines # nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_brace_while = remove # "} while" vs "} \n while" - cuddle while nl_brace_else = remove # "} else" vs "} \n else" - cuddle else nl_func_var_def_blk = 1 nl_fcall_brace = remove # "list_for_each() {" vs "list_for_each()\n{" nl_fdef_brace = remove # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE; # nl_before_case = 1 # # Source code modifications # mod_paren_on_return = ignore # "return 1;" vs "return (1);" mod_full_brace_if = ignore # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = ignore # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = remove # "while (a) a--;" vs "while (a) { a--; }" mod_full_brace_nl = 3 # don't remove if more than 3 newlines mod_add_long_ifdef_endif_comment = 20 mod_add_long_ifdef_else_comment = mod_add_long_ifdef_else_comment mod_add_long_switch_closebrace_comment = mod_add_long_ifdef_else_comment mod_add_long_function_closebrace_comment = mod_add_long_ifdef_else_comment # # Inter-character spacing options # # sp_return_paren = force # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = add # "{ 1 }" vs "{1}" sp_inside_braces_struct = add # "{ 1 }" vs "{1}" sp_inside_braces_enum = add # "{ 1 }" vs "{1}" sp_inside_fparen = remove # "func( param )" vs "func(param)" sp_paren_brace = force sp_assign = add sp_arith = add sp_bool = add sp_compare = add sp_assign = add sp_after_comma = add sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_before_ptr_star = force sp_after_ptr_star = force sp_before_unnamed_ptr_star = ignore sp_between_ptr_star = remove sp_after_ptr_star_func = force sp_before_ptr_star_func = force sp_cmt_cpp_start = add sp_cond_question = force sp_cond_colon = force sp_else_brace = force sp_brace_else = force sp_after_class_colon = force sp_before_class_colon = force sp_before_case_colon = remove # Objective-C specifics sp_before_oc_colon = remove sp_after_oc_colon = remove sp_after_oc_scope = force sp_after_oc_type = remove sp_after_oc_return_type = force sp_before_send_oc_colon = remove sp_after_send_oc_colon = remove sp_after_oc_at_sel = remove # # Aligning stuff # align_with_tabs = False # use tabs to align align_on_tabstop = False # align on tabstops # align_keep_tabs = True align_enum_equ_span = 4 # '=' in enum definition # align_nl_cont = True # align_var_def_span = 2 # align_var_def_inline = True # align_var_def_star = False # align_var_def_colon = True # align_assign_span = 1 align_struct_init_span = 4 # align stuff in a structure init '= { }' align_right_cmt_span = 8 align_right_cmt_gap = 8 align_pp_define_span = 8 #align_pp_define_gap = 8 # Objective-C specifics align_oc_msg_colon_span = 1 # align parameters in an Obj-C message on the ':' but stop after this many lines (0=don't align) align_oc_msg_spec_span = 0 # the span for aligning ObjC msg spec (0=don't align) # # Line Splitting options # # ls_func_split_full = True # Whether to fully split long function protos/calls at commas # # Comment modifications # cmt_star_cont = True # Whether to put a star on subsequent comment lines uncrustify-0.59/tests/config/cpp_to_c-3.cfg0000644000175000017500000000043111574765451015636 00000000000000# # CPP to C comment conversion # indent_with_tabs = 0 input_tab_size = 4 indent_columns = 4 cmt_star_cont = true cmt_cpp_to_c = true cmt_cpp_group = true cmt_cpp_nl_start = true cmt_cpp_nl_end = true align_right_cmt_span = 2 nl_after_multiline_comment = true uncrustify-0.59/tests/config/sp_throw_paren-r.cfg0000644000175000017500000000003211506773274017173 00000000000000 sp_throw_paren = remove uncrustify-0.59/tests/config/preproc-cleanup.cfg0000644000175000017500000000735511574765451017023 00000000000000# # Clean up preprocessor output, ie from "gcc -E" # nl_after_semicolon = True nl_after_brace_open = True newlines = LF # AUTO (default), CRLF, CR, or LF indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size # indent_label = 0 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_class = true indent_member = indent_columns nl_start_of_file = remove # nl_start_of_file_min = 0 nl_end_of_file = force nl_end_of_file_min = 1 nl_max = 4 nl_before_block_comment = 2 nl_after_func_body = 2 nl_after_func_proto_group = 2 nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_after_case = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE pos_bool = Trail # BOOL ops on trailing end eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_func_class_paren = remove sp_before_angle = force sp_after_angle = force sp_inside_angle = remove sp_sparen_brace = add sp_fparen_brace = add sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 16 align_nl_cont = TRUE align_var_def_span = 1 align_var_def_thresh = 12 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 align_assign_thresh = 12 align_struct_init_span = 3 align_var_struct_span = 99 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE sp_attribute_paren = remove pp_indent = remove pp_space = remove uncrustify-0.59/tests/config/func-def-1.cfg0000644000175000017500000000151611574765451015542 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size nl_func_decl_start = Add # newline after the '(' in a function decl nl_func_decl_args = Add # newline after each ',' in a function decl nl_func_decl_end = Add # newline before the ')' in a function decl nl_func_def_start = Add # newline after the '(' in a function decl nl_func_def_args = Add # newline after each ',' in a function def nl_func_def_end = Add # newline before the ')' in a function decl nl_func_type_name = Add # newline between return type and function def nl_func_proto_type_name = Add # newline between return type and function proto sp_after_ptr_star = remove sp_before_ptr_star = force uncrustify-0.59/tests/config/width.cfg0000644000175000017500000000101011574765451015021 00000000000000# # width stuff # indent_with_tabs = 0 input_tab_size = 8 indent_columns = 4 nl_if_brace = remove nl_elseif_brace = remove nl_else_brace = remove nl_brace_else = remove nl_fdef_brace = force sp_arith = force sp_macro = force sp_macro_func = force sp_sparen_brace = add sp_after_sparen = add sp_fparen_brace = force sp_square_fparen = remove sp_inside_braces = add sp_after_tag = remove code_width = 60 sp_after_ptr_star = remove sp_before_ptr_star = force ls_for_split_full = false ls_func_split_full = true uncrustify-0.59/tests/config/func-def-2.cfg0000644000175000017500000000120011574765451015531 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size nl_func_decl_start = Ignore # newline after the '(' in a function decl nl_func_decl_args = Ignore # newline after each ',' in a function decl nl_func_decl_end = Remove # newline before the ')' in a function decl nl_func_type_name = Add # newline between return type and function def nl_func_proto_type_name = Remove # newline between return type and function proto sp_after_ptr_star = remove sp_before_ptr_star = force uncrustify-0.59/tests/config/indent.cfg0000644000175000017500000000052011506773274015165 00000000000000# # Indents the code and aligns trailing comments # indent_with_tabs = 0 # 0=spaces, 1=tabs, 2=indent to level only input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column align_right_cmt_span = 3 # within x lines uncrustify-0.59/tests/config/clark.cfg0000644000175000017500000004467211506773274015020 00000000000000 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 2 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 2 # number # The ascii value of the string escape char, usually 92 (\). (Pawn) string_escape_char = 92 # number # # Indenting # # The number of columns to indent per level (usually 2, 3, 4, or 8) indent_columns = 2 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = true # false/true # Whether the 'namespace' body is indented indent_namespace = true # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to indent_columns. indent_member = 2 # number # indent single line ('//') comments on lines before code indent_sing_line_comments = 2 # number # Spaces to indent 'case' from 'switch' indent_switch_case = 2 # number # Spaces to indent '{' from 'case' indent_case_brace = 2 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels (>0=absolute column where 1 is the leftmost column, <=0=subtract from brace indent) indent_label = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = add # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = add # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = add # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = add # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = add # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space after cast sp_after_cast = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = ignore # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name (a minimum of 1 is forced except for pointer return types) sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = ignore # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = ignore # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # Whether the pointer star is part of the variable name or not align_var_def_star_style = 2 # false/true # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type: typedef int * pint; align_typedef_star_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = ignore # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 0 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between function call and '(' nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = ignore # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = add # ignore/add/remove/force nl_before_if = force # ignore/add/remove/force nl_after_if = force # ignore/add/remove/force nl_before_for = force # ignore/add/remove/force nl_after_for = force # ignore/add/remove/force nl_before_while = force # ignore/add/remove/force nl_after_while = force # ignore/add/remove/force nl_before_switch = force # ignore/add/remove/force nl_after_switch = force # ignore/add/remove/force nl_before_do = force # ignore/add/remove/force nl_after_do = force # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = add # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { nl_namespace_brace = add # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = add # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of the function body nl_after_func_body = 2 # number # The minimum number of newlines before a multi-line comment (doesn't apply if after a brace open) nl_before_block_comment = 1 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = remove # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = remove # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = remove # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 3 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = remove # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = remove # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = ignore # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = ignore # ignore/add/remove/force uncrustify-0.59/tests/config/cpp_to_c-1.cfg0000644000175000017500000000041511574765451015636 00000000000000# # CPP to C comment conversion # indent_with_tabs = 0 input_tab_size = 4 indent_columns = 4 cmt_star_cont = true cmt_cpp_to_c = true # cmt_cpp_group = true # cmt_cpp_nl_start = true # cmt_cpp_nl_end = true align_right_cmt_span = 2 code_width = 80 uncrustify-0.59/tests/config/kw_subst.cfg0000644000175000017500000000026411506773274015552 00000000000000 cmt_insert_file_header = file-header.h cmt_insert_func_header = func-header.h cmt_insert_class_header = class-header.h cmt_insert_before_preproc = true indent_namespace = true uncrustify-0.59/tests/config/nl_try-a.cfg0000644000175000017500000000014411574765451015436 00000000000000# nl_catch_brace = force nl_try_brace = force nl_brace_catch = force nl_after_vbrace_open = true uncrustify-0.59/tests/config/func-def-3.cfg0000644000175000017500000000126611574765451015546 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size # everything on one line (TODO: line length checks) nl_func_decl_start = Remove # newline after the '(' in a function decl nl_func_decl_args = Remove # newline after each ',' in a function decl nl_func_decl_end = Remove # newline before the ')' in a function decl nl_func_type_name = Remove # newline between return type and function def nl_func_proto_type_name = Remove # newline between return type and function proto sp_after_ptr_star = remove sp_before_ptr_star = force uncrustify-0.59/tests/config/custom_types_ssl.cfg0000644000175000017500000001103311506773274017324 00000000000000# patch 20090404-xxx needed to cope with such custom types as these: input_tab_size = 8 output_tab_size = 4 indent_with_tabs = 1 indent_columns = 4 align_func_params = true indent_func_call_param = true indent_func_def_param = true indent_func_proto_param = true sp_arith = add sp_assign = add # Add or remove space around preprocessor '##' concatenation operator sp_pp_concat = remove # Add or remove space after preprocessor '#' stringify operator sp_pp_stringify = remove # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = true # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 1 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number sp_bool = add sp_compare = add # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = remove # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = add # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = add # Add or remove space between function name and '(' on function definition sp_func_def_paren = add # Add or remove space inside function '(' and ')' sp_inside_fparen = add # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 3 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 5 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 2 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 5 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = true # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = true # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = true # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true set type_wrap STACK_OF LHASH_OF uncrustify-0.59/tests/config/nl_template_class-remove.cfg0000644000175000017500000000072211574765451020677 00000000000000# # Removes newlines between template '>' and class # indent_columns = 3 sp_before_byref = remove sp_after_byref = force indent_class = True sp_func_def_paren = remove sp_func_proto_paren = remove sp_after_operator = force sp_after_angle = force sp_angle_word = force sp_angle_paren = remove sp_arith = force sp_compare = force nl_template_class = remove sp_inside_braces = force sp_inside_braces_struct = force tok_split_gte = true uncrustify-0.59/tests/config/return-4.cfg0000644000175000017500000000026311506773274015370 00000000000000 indent_columns = 4 indent_with_tabs = 0 nl_after_return = true mod_paren_on_return = force nl_return_expr = force sp_before_semi = remove sp_inside_paren = remove uncrustify-0.59/tests/config/sp_after_oc_block_caret_add.cfg0000644000175000017500000000030411506773274021330 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_block_caret = adduncrustify-0.59/tests/config/custom-open.cfg0000644000175000017500000000076611574765451016174 00000000000000# indent_columns = 4 output_tab_size = indent_columns indent_with_tabs = 1 # Spaces to indent 'case' from 'switch' indent_switch_case = indent_columns # number # Spaces to indent '{' from 'case' indent_case_brace = 0 # indent_columns # number align_assign_span = 1 align_assign_thresh = 16 macro-open MACRO_BEGIN_STUFF macro-else MACRO_ELSE_STUFF macro-close MACRO_END_STUFF macro-open MACRO2_BEGIN_STUFF macro-else MACRO2_ELSE_STUFF macro-close MACRO2_END_STUFF type foorbar_t define MYDEFINE 1 uncrustify-0.59/tests/config/bool-pos-eol-force.cfg0000644000175000017500000000065511506773274017320 00000000000000# # moves boolean ops to the end of line # # $Id: bool-pos-eol.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = trail_force pos_comma = Trail_force pos_class_comma = trail_force sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/newline_after_endif.cfg0000644000175000017500000000751311506773274017704 00000000000000align_func_params=true align_keep_tabs=false align_nl_cont=false align_number_left=false align_on_tabstop=false align_right_cmt_mix=false align_var_def_colon=false align_var_def_inline=false align_with_tabs=false cmt_c_group=false cmt_c_nl_end=false cmt_c_nl_start=false cmt_cpp_group=false cmt_cpp_nl_end=false cmt_cpp_nl_start=false cmt_cpp_to_c=false cmt_star_cont=false eat_blanks_after_open_brace=false eat_blanks_before_close_brace=false indent_align_string=false indent_bool_paren=false indent_brace_parent=false indent_braces=false indent_braces_no_func=false indent_class=false indent_class_colon=false indent_col1_comment=false indent_comma_paren=false indent_func_call_param=false indent_func_class_param=false indent_func_ctor_var_param=false indent_func_def_param=true indent_func_param_double=false indent_func_proto_param=false indent_namespace=false indent_paren_nl=true indent_preserve_sql=false indent_square_nl=false ls_for_split_full=false ls_func_split_full=false mod_full_paren_if_bool=false mod_pawn_semicolon=false mod_remove_extra_semicolon=true mod_sort_import=false mod_sort_include=false mod_sort_using=false nl_after_brace_open=true nl_after_brace_open_cmt=false nl_after_case=false nl_after_multiline_comment=false nl_after_return=true nl_after_semicolon=true nl_after_vbrace_open=true nl_assign_leave_one_liners=true nl_before_case=true nl_class_leave_one_liners=false nl_collapse_empty_body=true nl_create_for_one_liner=false nl_create_if_one_liner=false nl_create_while_one_liner=false nl_define_macro=false nl_ds_struct_enum_close_brace=false nl_ds_struct_enum_cmt=false nl_enum_leave_one_liners=false nl_func_leave_one_liners=false nl_getset_leave_one_liners=false nl_if_leave_one_liners=false nl_multi_line_cond=false nl_squeeze_ifdef=true pp_define_at_level=true pp_if_indent_code=true pp_indent_at_level=true pp_region_indent_code=true sp_balance_nested_parens=false align_assign_span=0 align_right_cmt_span=3 align_var_def_span=1 align_var_def_star_style=0 cmt_width=108 code_width=108 indent_case_brace=0 indent_case_shift=0 indent_columns=3 indent_switch_case=3 indent_with_tabs=0 input_tab_size=3 mod_add_long_function_closebrace_comment=1 mod_add_long_switch_closebrace_comment=16 nl_end_of_file_min=2 nl_func_var_def_blk=1 pp_indent_region=3 pp_space_count=3 mod_paren_on_return=force nl_after_do=force nl_after_for=force nl_after_if=force nl_after_switch=force nl_after_while=force nl_before_do=force nl_before_for=force nl_before_if=force nl_before_switch=force nl_before_while=force nl_brace_else=force nl_brace_while=force nl_class_brace=force nl_else_brace=force nl_elseif_brace=force nl_end_of_file=force nl_fcall_brace=force nl_fdef_brace=force nl_for_brace=force nl_func_decl_args=force nl_func_decl_end=add nl_func_decl_start=force nl_func_paren=force nl_func_proto_type_name=remove nl_func_type_name=remove nl_if_brace=force nl_while_brace=add pos_class_comma=trail pos_comma=trail pp_indent=force sp_after_cast=remove sp_after_comma=force sp_after_oc_type=remove sp_after_ptr_star=add sp_after_sparen=force sp_arith=force sp_assign=force sp_before_comma=remove sp_before_ptr_star=remove sp_before_semi=remove sp_before_semi_for=remove sp_before_semi_for_empty=remove sp_before_sparen=remove sp_before_square=remove sp_before_squares=remove sp_bool=force sp_brace_else=force sp_compare=force sp_deref=remove sp_fparen_brace=force sp_func_call_paren=remove sp_func_def_paren=remove sp_func_proto_paren=remove sp_incdec=remove sp_inside_braces=force sp_inside_fparen=remove sp_inside_fparens=remove sp_inside_paren=remove sp_inside_paren_cast=remove sp_inside_sparen=remove sp_macro=force sp_macro_func=force sp_member=remove sp_not=remove sp_paren_paren=remove sp_return_paren=force sp_type_func=force uncrustify-0.59/tests/config/1liner-split.cfg0000644000175000017500000004515611574765262016250 00000000000000# # My favorite format ("--update-config-with-doc") # # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\). (Pawn) string_escape_char = 92 # number # # Indenting # # The number of columns to indent per level (usually 2, 3, 4, or 8) indent_columns = 3 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to indent_columns. indent_member = 3 # number # Spaces to indent 'case' from 'switch' indent_switch_case = 0 # number # Spaces to indent '{' from 'case' indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels (>0=absolute column where 1 is the leftmost column, <=0=subtract from brace indent) indent_label = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = force # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name (a minimum of 1 is forced except for pointer return types) sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true align_func_params = true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # Whether the pointer star is part of the variable name or not align_var_def_star_style = 1 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 12 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type: typedef int * pint; align_typedef_star_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = true # false/true nl_assign_leave_one_liners = false nl_enum_leave_one_liners = false nl_func_leave_one_liners = false # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between function call and '(' nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true nl_after_vbrace_open = true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of the function body nl_after_func_body = 2 # number # The minimum number of newlines before a multi-line comment (doesn't apply if after a brace open) nl_before_block_comment = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement #mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement # mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) # mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement # mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines # mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement # mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement # mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons # mod_pawn_semicolon = false # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = ignore # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = ignore # ignore/add/remove/force nl_getset_brace = force mod_full_paren_if_bool = true sp_before_semi_for_empty = force uncrustify-0.59/tests/config/cond-1.cfg0000644000175000017500000000011111506773274014761 00000000000000 indent_columns = 3 sp_cond_colon = force sp_cond_question = force uncrustify-0.59/tests/config/mod_move_case_brace.cfg0000644000175000017500000014373011506773274017653 00000000000000# Uncrustify 0.52+svn mod_case_brace = add # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 3 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 3 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 3 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = force # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':' sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '-(int) f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = remove # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 16 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = force # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = force # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = force # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = force # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 3 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 1 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = true # false/true # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ uncrustify-0.59/tests/config/custom-open2.cfg0000644000175000017500000000076611574765451016256 00000000000000# indent_columns = 4 output_tab_size = indent_columns indent_with_tabs = 0 # Spaces to indent 'case' from 'switch' indent_switch_case = indent_columns # number # Spaces to indent '{' from 'case' indent_case_brace = 0 # indent_columns # number align_assign_span = 1 align_assign_thresh = 16 macro-open MACRO_BEGIN_STUFF macro-else MACRO_ELSE_STUFF macro-close MACRO_END_STUFF macro-open MACRO2_BEGIN_STUFF macro-else MACRO2_ELSE_STUFF macro-close MACRO2_END_STUFF type foorbar_t define MYDEFINE 1 uncrustify-0.59/tests/config/nl_assign2.cfg0000644000175000017500000000017411506773274015750 00000000000000 indent_with_tabs=0 indent_columns=4 code_width=60 pos_assign = trail pos_arith = trail sp_arith = force sp_assign = force uncrustify-0.59/tests/config/sp_after_cast.cfg0000644000175000017500000001605611506773274016534 00000000000000newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 indent_columns = 3 indent_with_tabs = 0 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_class = true indent_class_colon = false indent_func_call_param = false indent_member = 3 indent_sing_line_comments = 0 indent_switch_case = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_paren_nl = false indent_square_nl = false sp_arith = force sp_assign = force sp_bool = force sp_compare = force sp_inside_paren = remove sp_inside_paren_cast = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = remove sp_after_byref = ignore sp_before_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_before_sparen = force sp_inside_sparen = remove sp_after_sparen = force sp_sparen_brace = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_after_operator = ignore sp_after_cast = force sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_angle = remove sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = remove sp_func_class_paren = ignore sp_return_paren = remove sp_macro = ignore sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_thresh = 0 align_var_def_colon = true align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 align_right_cmt_span = 3 align_func_proto_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 code_width = 0 nl_collapse_empty_body = false nl_class_leave_one_liners = true nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_before_case = true nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_after_semicolon = false nl_after_brace_open = false nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false pos_bool = ignore pos_class_colon = ignore ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 pp_indent = ignore pp_space = ignore uncrustify-0.59/tests/config/nl_assign1.cfg0000644000175000017500000000017211506773274015745 00000000000000 indent_with_tabs=0 indent_columns=4 code_width=60 pos_assign = lead pos_arith = lead sp_arith = force sp_assign = force uncrustify-0.59/tests/config/brace-remove-2.cfg0000644000175000017500000000073711506773274016424 00000000000000# # Removes all unecessary braces unless the body spans more than 2 lines # mod_paren_on_return = remove # "return 1;" vs "return (1);" mod_full_brace_if = remove # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = remove # "for () a--;" vs "for () { a--; }" mod_full_brace_do = remove # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = remove # "while (a) a--;" vs "while (a) { a--; }" mod_full_brace_nl = 2 # don't remove if more than 3 newlines uncrustify-0.59/tests/config/nl_access_spec.cfg0000644000175000017500000000025311506773274016653 00000000000000nl_before_access_spec = 3 nl_after_access_spec = 2 indent_access_spec = 2 indent_class = true nl_after_brace_open = true nl_after_semicolon = true nl_class_brace = force uncrustify-0.59/tests/config/class-colon-pos-eol.cfg0000644000175000017500000000051411574765332017501 00000000000000# # moves class colon ops to the end of line # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_class_colon = Trail indent_class_colon = True sp_after_dc = remove sp_before_dc = remove uncrustify-0.59/tests/config/pawn-escape.cfg0000644000175000017500000000162711574765451016123 00000000000000# # junk # indent_with_tabs = 0 input_tab_size = 4 #output_tab_size = 4 indent_columns = 4 align_pp_define_span = 1 align_pp_define_gap = 3 align_right_cmt_span = 2 nl_if_brace = remove nl_elseif_brace = remove nl_else_brace = remove nl_brace_else = remove nl_fdef_brace = force sp_arith = force sp_macro = force sp_macro_func = force sp_sparen_brace = add sp_after_sparen = add sp_fparen_brace = force sp_square_fparen = remove sp_inside_braces = add sp_after_tag = remove cmt_star_cont = true #cmt_cpp_to_c = true #cmt_cpp_group = true #cmt_cpp_nl_start = true #cmt_cpp_nl_end = true mod_full_brace_if = add mod_full_brace_for = add mod_full_brace_do = add mod_full_brace_while = add mod_full_brace_function = add # note: for normal usage, this option is 'bad' mod_pawn_semicolon = true # '^' - didn't want to make another option type string_escape_char = 94 string_escape_char = 94 uncrustify-0.59/tests/config/brace-banner.cfg0000644000175000017500000000226111574765304016227 00000000000000# # Banner style # indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 2 # new tab size indent_columns = output_tab_size indent_braces = TRUE indent_braces_no_func = TRUE # brace settings nl_assign_brace = remove # "= {" vs "= \n {" nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_fcall_brace = remove # "foo() {" vs "foo()\n{" nl_fdef_brace = remove # "int foo() {" vs "int foo()\n{" nl_brace_while = add nl_brace_else = add # spaces around braces sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_assign = add sp_fparen_brace = add eat_blanks_after_open_brace = True sp_else_brace = force uncrustify-0.59/tests/config/sp_cmt_cpp_start_add.cfg0000644000175000017500000000003111506773274020055 00000000000000 sp_cmt_cpp_start = add uncrustify-0.59/tests/config/sp_func_call_empty.cfg0000644000175000017500000001724711506773274017570 00000000000000newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 indent_columns = 3 indent_with_tabs = 0 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_class = true indent_class_colon = false indent_func_call_param = false indent_member = 3 indent_sing_line_comments = 0 indent_switch_case = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_paren_nl = false indent_square_nl = false sp_arith = force sp_assign = force sp_assign_default = remove sp_bool = force sp_compare = force sp_inside_paren = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = remove sp_after_byref = ignore sp_before_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_before_sparen = force sp_inside_sparen = remove sp_after_sparen = force sp_sparen_brace = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_after_operator = ignore sp_after_cast = remove sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_angle = remove sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = force sp_func_call_paren_empty = remove sp_func_class_paren = ignore sp_return_paren = remove sp_macro = ignore sp_before_semi_for_empty = force sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_thresh = 0 align_var_def_colon = true align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 align_right_cmt_span = 3 align_func_proto_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 code_width = 0 nl_collapse_empty_body = false nl_class_leave_one_liners = true nl_assign_leave_one_liners = true nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_before_case = true nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_after_semicolon = true nl_after_brace_open = true nl_after_vbrace_open = true nl_after_access_spec = 1 nl_assign_leave_one_liners = true nl_class_leave_one_liners = true nl_enum_leave_one_liners = true nl_getset_leave_one_liners = true nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false pos_bool = ignore pos_class_colon = ignore ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 pp_indent = remove pp_space = remove sp_after_dc = remove sp_before_dc = remove sp_attribute_paren = remove sp_defined_paren = force mod_add_long_function_closebrace_comment = 40 mod_add_long_switch_closebrace_comment = 40 mod_remove_extra_semicolon = TRUE sp_brace_typedef = force nl_after_brace_close = TRUE sp_before_ellipsis = remove uncrustify-0.59/tests/config/ben.cfg0000644000175000017500000001722611534525750014456 00000000000000newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 indent_columns = 3 indent_with_tabs = 0 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_class = true indent_class_colon = false indent_func_call_param = false indent_member = 3 indent_sing_line_comments = 0 indent_switch_case = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_paren_nl = false indent_square_nl = false sp_arith = force sp_assign = force sp_assign_default = remove sp_bool = force sp_compare = force sp_inside_paren = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = remove sp_after_byref = ignore sp_before_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_before_sparen = force sp_inside_sparen = remove sp_after_sparen = force sp_sparen_brace = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_after_operator = ignore sp_after_cast = remove sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_angle = remove sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = remove sp_func_class_paren = ignore sp_return_paren = remove sp_macro = ignore sp_before_semi_for_empty = force sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_thresh = 0 align_var_def_colon = true align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 align_right_cmt_span = 3 align_func_proto_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 code_width = 0 nl_collapse_empty_body = false nl_class_leave_one_liners = true nl_assign_leave_one_liners = true nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_before_case = true nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_after_semicolon = true nl_after_brace_open = true nl_after_vbrace_open = true nl_after_access_spec = 1 nl_assign_leave_one_liners = true nl_class_leave_one_liners = true nl_enum_leave_one_liners = true nl_getset_leave_one_liners = true nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false pos_bool = ignore pos_class_colon = ignore ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 pp_indent = remove pp_space = remove sp_after_dc = remove sp_before_dc = remove sp_attribute_paren = remove sp_defined_paren = force mod_add_long_function_closebrace_comment = 40 mod_add_long_switch_closebrace_comment = 40 mod_remove_extra_semicolon = TRUE sp_brace_typedef = force nl_after_brace_close = TRUE sp_before_ellipsis = remove tok_split_gte = true uncrustify-0.59/tests/config/func_param.cfg0000644000175000017500000000017111511366042016004 00000000000000sp_arith = add sp_after_ptr_star = remove sp_func_proto_paren = remove sp_inside_fparen = remove sp_paren_paren = remove uncrustify-0.59/tests/config/nl_func_decl_1.cfg0000644000175000017500000000061011506773274016537 00000000000000nl_func_paren = remove nl_func_decl_empty = remove nl_func_decl_start = remove nl_func_decl_args = remove nl_func_decl_end = remove nl_func_def_paren = force nl_func_def_empty = force nl_func_def_start = force nl_func_def_args = force nl_func_def_end = force # a few more options to make the output pretty sp_after_comma = force sp_inside_paren = force sp_inside_fparen = force uncrustify-0.59/tests/config/cs_generics.cfg0000644000175000017500000000021611506773274016172 00000000000000sp_before_angle = remove sp_inside_angle = remove sp_angle_paren = remove sp_compare = force sp_sizeof_paren = remove sp_angle_shift = remove uncrustify-0.59/tests/config/bool-pos-sol-force.cfg~0000644000175000017500000000063611506773274017533 00000000000000# # moves boolean ops to the end of line # # $Id: bool-pos-sol.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = Lead_force pos_comma = Lead pos_class_comma = Lead sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/template_sp-remove.cfg0000644000175000017500000000100011574765451017511 00000000000000# # remove spaces around template defs # indent_columns = 3 sp_before_byref = remove sp_after_byref = force indent_class = True sp_func_def_paren = remove sp_func_proto_paren = remove sp_func_call_paren = remove sp_after_operator = remove sp_before_angle = remove sp_inside_angle = remove sp_after_angle = remove sp_angle_word = remove sp_angle_paren = remove sp_arith = force sp_compare = force sp_inside_braces = force sp_inside_braces_struct = force tok_split_gte = true uncrustify-0.59/tests/config/bool-pos-sol-force.cfg0000644000175000017500000000065211506773274017333 00000000000000# # moves boolean ops to the end of line # # $Id: bool-pos-sol.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = Lead_force pos_comma = Lead_force pos_class_comma = Lead_force sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/bool-pos-sol.cfg0000644000175000017500000000053011574765300016226 00000000000000# # moves boolean ops to the end of line # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = Lead pos_comma = Lead pos_class_comma = Lead sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/pos_compare-sol.cfg0000644000175000017500000000004611506773274017011 00000000000000pos_compare = lead sp_compare = force uncrustify-0.59/tests/config/align-1.cfg0000644000175000017500000000602611574765264015150 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_func_params = FALSE align_var_def_span = 2 align_var_def_thresh = 16 align_var_def_inline = TRUE align_var_def_star_style = 0 align_var_def_colon = TRUE align_assign_span = 2 align_assign_thresh = 3 align_struct_init_span = 3 align_var_struct_span = 3 align_var_struct_thresh = 16 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/tests/config/cpp_to_c-2.cfg0000644000175000017500000000037211574765451015641 00000000000000# # CPP to C comment conversion # indent_with_tabs = 0 input_tab_size = 4 indent_columns = 4 cmt_star_cont = true cmt_cpp_to_c = true cmt_cpp_group = true # cmt_cpp_nl_start = true # cmt_cpp_nl_end = true align_right_cmt_span = 2 uncrustify-0.59/tests/config/avalon4.cfg0000644000175000017500000006103611506773274015261 00000000000000 # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 2 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 2 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 2 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = true # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 2 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = force # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = force # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = force # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = remove # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = force # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = force # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = force # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = remove # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = remove # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = remove # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = remove # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = remove # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = remove # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = force # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = force # ignore/add/remove/force # Add or remove space between macro and value sp_macro = force # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = force # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = force # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = force # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = force # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = force # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = force # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = force # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = force # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_star_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 1 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = true # false/true # Don't touch one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = remove # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between function call and '(' nl_fcall_brace = remove # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = remove # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = remove # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = remove # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = remove # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = remove # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = remove # ignore/add/remove/force # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = remove # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = force # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = force # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = force # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = remove # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = force # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = true # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = trail # ignore/lead/trail pos_class_comma = trail # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = lead # ignore/lead/trail # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 3 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 1 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 2 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 1 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = remove # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = true # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = remove # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = remove # ignore/add/remove/force # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP sp_after_dc = remove sp_before_dc = remove uncrustify-0.59/tests/config/case-2.cfg0000644000175000017500000000066011574765325014766 00000000000000# # My favorite format # indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_switch_case = indent_columns indent_case_brace = 0 nl_before_case = True # blank line before case except after { nl_after_case = True # disallow case X: a++; break; mod_move_case_break = True uncrustify-0.59/tests/config/sp_after_oc_return_type_add.cfg0000644000175000017500000000031011506773274021435 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_return_type = adduncrustify-0.59/tests/config/ger.cfg0000644000175000017500000004163511506773274014475 00000000000000# Uncrustify 0.52+svn newlines = auto input_tab_size = 8 output_tab_size = 4 string_escape_char = 92 string_escape_char2 = 0 indent_columns = 4 indent_with_tabs = 1 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_extern = false indent_class = true indent_class_colon = false indent_else_if = true indent_var_def_blk = 0 indent_func_call_param = true indent_func_def_param = true indent_func_proto_param = true indent_func_class_param = true indent_func_ctor_var_param = true indent_template_param = true indent_func_param_double = true indent_func_const = 0 indent_func_throw = 0 indent_member = 0 indent_sing_line_comments = 0 indent_relative_single_line_comments = false indent_switch_case = 0 indent_case_shift = 0 indent_case_brace = 4 indent_col1_comment = false indent_label = 1 indent_access_spec = 1 indent_access_spec_body = false indent_paren_nl = false indent_paren_close = 1 indent_comma_paren = false indent_bool_paren = false indent_square_nl = false indent_preserve_sql = false indent_align_assign = true sp_arith = add sp_assign = add sp_before_assign = ignore sp_after_assign = ignore sp_enum_assign = add sp_enum_before_assign = ignore sp_enum_after_assign = ignore sp_pp_concat = remove sp_pp_stringify = remove sp_bool = add sp_compare = add sp_inside_paren = ignore sp_paren_paren = ignore sp_balance_nested_parens = false sp_paren_brace = add sp_before_ptr_star = add sp_before_unnamed_ptr_star = ignore sp_between_ptr_star = remove sp_after_ptr_star = remove sp_after_ptr_star_func = remove sp_before_ptr_star_func = add sp_before_byref = remove sp_before_unnamed_byref = ignore sp_after_byref = remove sp_after_byref_func = remove sp_before_byref_func = add sp_after_type = add sp_template_angle = remove sp_before_angle = remove sp_inside_angle = remove sp_after_angle = ignore sp_angle_paren = remove sp_angle_word = add sp_before_sparen = add sp_inside_sparen = remove sp_inside_sparen_close = ignore sp_after_sparen = add sp_sparen_brace = add sp_invariant_paren = remove sp_after_invariant_paren = add sp_special_semi = add sp_before_semi = remove sp_before_semi_for = remove sp_before_semi_for_empty = remove sp_after_semi_for_empty = remove sp_before_square = remove sp_before_squares = remove sp_inside_square = remove sp_after_comma = add sp_before_comma = remove sp_after_class_colon = remove sp_before_class_colon = remove sp_before_case_colon = remove sp_after_operator = add sp_after_operator_sym = remove sp_after_cast = remove sp_inside_paren_cast = remove sp_cpp_cast_paren = remove sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = add sp_inside_braces_struct = add sp_inside_braces = add sp_inside_braces_empty = remove sp_type_func = remove sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = remove sp_inside_fparen = remove sp_square_fparen = remove sp_fparen_brace = add sp_func_call_paren = remove sp_func_call_user_paren = remove sp_func_class_paren = remove sp_return_paren = add sp_attribute_paren = remove sp_defined_paren = remove sp_throw_paren = remove sp_macro = add sp_macro_func = add sp_else_brace = add sp_brace_else = add sp_brace_typedef = add sp_catch_brace = add sp_brace_catch = add sp_finally_brace = add sp_brace_finally = add sp_try_brace = add sp_getset_brace = add sp_before_dc = remove sp_after_dc = remove sp_d_array_colon = ignore sp_not = remove sp_inv = remove sp_addr = remove sp_member = remove sp_deref = remove sp_sign = remove sp_incdec = remove sp_before_nl_cont = add sp_after_oc_scope = remove sp_after_oc_colon = add sp_before_oc_colon = add sp_after_send_oc_colon = add sp_before_send_oc_colon = remove sp_after_oc_type = add sp_cond_colon = add sp_cond_question = add sp_case_label = ignore sp_range = ignore sp_cmt_cpp_start = add align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = false align_func_params = false align_same_func_call_params = false align_var_def_span = 3 align_var_def_star_style = 0 align_var_def_amp_style = 0 align_var_def_thresh = 5 align_var_def_gap = 0 align_var_def_colon = true align_var_def_attribute = false align_var_def_inline = true align_assign_span = 0 align_assign_thresh = 0 align_enum_equ_span = 3 align_enum_equ_thresh = 5 align_var_struct_span = 2 align_var_struct_thresh = 5 align_var_struct_gap = 0 align_struct_init_span = 3 align_typedef_gap = 0 align_typedef_span = 0 align_typedef_func = 0 align_typedef_star_style = 0 align_typedef_amp_style = 0 align_right_cmt_span = 4 align_right_cmt_mix = true # note the use of -5 here (-1 would probably have worked as well) to force # comments which are stuck to the previous token (gap=0) into alignment with the # others. Not the major feature, but a nice find. (min_val/max_val in # options.cpp isn't validated against, it seems; well, I don't mind! :-) ) align_right_cmt_gap = -5 align_right_cmt_at_col = 1 align_func_proto_span = 0 align_func_proto_gap = 0 align_on_operator = true align_mix_var_proto = false align_single_line_func = false align_single_line_brace = false align_single_line_brace_gap = 0 align_oc_msg_spec_span = 0 align_nl_cont = false align_pp_define_gap = 0 align_pp_define_span = 0 align_left_shift = true nl_collapse_empty_body = true nl_assign_leave_one_liners = true nl_class_leave_one_liners = true nl_enum_leave_one_liners = true nl_getset_leave_one_liners = true nl_func_leave_one_liners = true nl_if_leave_one_liners = false nl_start_of_file = remove nl_start_of_file_min = 0 nl_end_of_file = add nl_end_of_file_min = 2 nl_assign_brace = ignore nl_assign_square = ignore nl_after_square_assign = ignore nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = add nl_else_brace = add nl_else_if = remove nl_brace_finally = add nl_finally_brace = add nl_try_brace = add nl_getset_brace = add nl_for_brace = add nl_catch_brace = add nl_brace_catch = add nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_multi_line_cond = true nl_multi_line_define = true nl_before_case = true nl_before_throw = add nl_after_case = true nl_namespace_brace = add nl_template_class = ignore nl_class_brace = add nl_class_init_args = ignore nl_func_type_name = remove nl_func_scope_name = remove nl_func_proto_type_name = remove nl_func_paren = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_return_expr = remove nl_after_semicolon = true nl_after_brace_open = true nl_after_brace_open_cmt = true nl_after_vbrace_open = true nl_after_brace_close = false nl_define_macro = false nl_squeeze_ifdef = false nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = true nl_ds_struct_enum_close_brace = false nl_class_colon = remove nl_create_if_one_liner = false nl_create_for_one_liner = false nl_create_while_one_liner = false pos_arith = ignore pos_assign = ignore pos_bool = ignore pos_comma = ignore pos_class_comma = ignore pos_class_colon = ignore code_width = 200 ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 2 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 nl_after_multiline_comment = false nl_before_access_spec = 1 nl_after_access_spec = 0 nl_comment_func_def = 0 nl_after_try_catch_finally = 0 nl_around_cs_property = 0 nl_between_get_set = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = ignore mod_full_brace_for = ignore mod_full_brace_function = ignore mod_full_brace_if = ignore mod_full_brace_nl = 1 mod_full_brace_while = ignore mod_paren_on_return = remove mod_pawn_semicolon = false mod_full_paren_if_bool = false mod_remove_extra_semicolon = false mod_add_long_function_closebrace_comment = 1000 mod_add_long_switch_closebrace_comment = 500 mod_add_long_ifdef_endif_comment = 1 mod_add_long_ifdef_else_comment = 1 mod_sort_import = true mod_sort_using = true mod_sort_include = false mod_move_case_break = false mod_remove_empty_return = true cmt_width = 0 cmt_indent_multi = true cmt_c_group = false cmt_c_nl_start = true cmt_c_nl_end = true cmt_cpp_group = true cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 cmt_multi_check_last = true cmt_insert_file_header = "" cmt_insert_file_footer = "" cmt_insert_func_header = "" cmt_insert_class_header = "" cmt_insert_before_preproc = false pp_indent = ignore pp_indent_at_level = false pp_indent_count = 1 pp_space = ignore pp_space_count = 1 pp_indent_region = 0 pp_region_indent_code = false pp_indent_if = 0 pp_if_indent_code = false pp_define_at_level = false type BIO set type_wrap LHASH_OF STACK_OF set FUNCTION TYPEDEF_D2I_OF type stname type type uncrustify-0.59/tests/config/func-header2.h0000644000175000017500000000013111506773274015635 00000000000000/** * CLASS: $(fclass) * METHOD: $(function) * TODO: DESCRIPTION * $(javaparam) */ uncrustify-0.59/tests/config/nl_after_func_body.cfg0000644000175000017500000000033011574765451017530 00000000000000# indent_class = true nl_fdef_brace = remove nl_after_func_body = 4 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true sp_fparen_brace = force uncrustify-0.59/tests/config/bool-pos-sol-break.cfg0000644000175000017500000000065211506773274017321 00000000000000# # moves boolean ops to the end of line # # $Id: bool-pos-sol.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = Lead_break pos_comma = Lead_break pos_class_comma = Lead_break sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/nl_namespace-a.cfg0000644000175000017500000000011111574765451016546 00000000000000# nl_namespace_brace = Add indent_class = True indent_namespace = True uncrustify-0.59/tests/config/indent_paren_close-1.cfg0000644000175000017500000000044111506773274017677 00000000000000 indent_with_tabs = 1 input_tab_size = 8 output_tab_size = 8 indent_columns = output_tab_size indent_paren_close = 1 indent_comma_paren = true indent_bool_paren = true sp_after_comma = force sp_inside_fparen = force sp_inside_sparen = force sp_inside_paren = force pos_comma = lead uncrustify-0.59/tests/config/mono.cfg0000644000175000017500000000577211574765451014675 00000000000000# # Mono library format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_label = 1 # pos: absolute col, neg: relative column # indent_align_string = False # align broken strings # brace_indent = 0 indent_func_call_param = true # use indent tabstop indent_class = true nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = remove # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove sp_before_square = add #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = force # "int foo (){" vs "int foo(){" sp_func_call_paren = force # "foo (" vs "foo(" sp_func_proto_paren = force # "int foo ();" vs "int foo();" # align_with_tabs = FALSE # use tabs to align # align_on_tabstop = FALSE # align on tabstops # align_enum_equ_span = 4 # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE align_var_def_star_style = 1 # align_var_def_colon = TRUE # align_assign_span = 1 # align_struct_init_span = 3 # align_var_struct_span = 3 # align_right_cmt_span = 3 # align_pp_define_span = 3 # align_pp_define_gap = 4 # align_number_left = TRUE # align_typedef_span = 5 # align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE uncrustify-0.59/tests/config/sp_before_oc_block_caret_force.cfg0000644000175000017500000000031211506773274022036 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_before_oc_block_caret = forceuncrustify-0.59/tests/config/sp_before_after_oc_block_caret_remove.cfg0000644000175000017500000000035611506773274023426 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_before_oc_block_caret = remove sp_after_oc_block_caret = removeuncrustify-0.59/tests/config/d3a.cfg0000644000175000017500000000634611506773274014367 00000000000000# # $Id: d.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_case_brace = indent_columns nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_square = remove sp_before_squares = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 align_struct_init_span = 3 align_var_struct_span = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 align_typedef_star_style = 1 # cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE indent_paren_nl = TRUE nl_assign_square = force sp_inside_square = force sp_d_array_colon = remove align_var_def_span = 2 align_var_def_colon = true uncrustify-0.59/tests/config/ben2.cfg0000644000175000017500000004622011630510470014522 00000000000000# Uncrustify 0.58 newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 string_escape_char2 = 0 tok_split_gte = true utf8_byte = true indent_columns = 3 indent_continue = 0 indent_with_tabs = 0 indent_cmt_with_tabs = false indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_braces_no_class = false indent_braces_no_struct = false indent_brace_parent = false indent_namespace = false indent_namespace_level = 0 indent_namespace_limit = 0 indent_extern = false indent_class = true indent_class_colon = false indent_else_if = false indent_var_def_blk = 0 indent_var_def_cont = false indent_func_call_param = false indent_func_def_param = false indent_func_proto_param = false indent_func_class_param = false indent_func_ctor_var_param = false indent_template_param = false indent_func_param_double = false indent_func_const = 0 indent_func_throw = 0 indent_member = 3 indent_sing_line_comments = 0 indent_relative_single_line_comments = false indent_switch_case = 0 indent_case_shift = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_access_spec_body = false indent_paren_nl = false indent_paren_close = 0 indent_comma_paren = false indent_bool_paren = false indent_first_bool_expr = false indent_square_nl = false indent_preserve_sql = false indent_align_assign = true sp_arith = force sp_assign = force sp_assign_default = remove sp_before_assign = ignore sp_after_assign = ignore sp_enum_assign = ignore sp_enum_before_assign = ignore sp_enum_after_assign = ignore sp_pp_concat = add sp_pp_stringify = add sp_bool = force sp_compare = force sp_inside_paren = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_before_unnamed_ptr_star = ignore sp_between_ptr_star = remove sp_after_ptr_star = remove sp_after_ptr_star_func = ignore sp_before_ptr_star_func = ignore sp_before_byref = remove sp_before_unnamed_byref = ignore sp_after_byref = ignore sp_after_byref_func = ignore sp_before_byref_func = ignore sp_after_type = force sp_template_angle = ignore sp_before_angle = remove sp_inside_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_angle_shift = add sp_before_sparen = force sp_inside_sparen = remove sp_inside_sparen_close = ignore sp_after_sparen = force sp_sparen_brace = ignore sp_invariant_paren = ignore sp_after_invariant_paren = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_semi_for_empty = force sp_after_semi = add sp_after_semi_for = force sp_after_semi_for_empty = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_paren_comma = force sp_before_ellipsis = remove sp_after_class_colon = ignore sp_before_class_colon = ignore sp_before_case_colon = remove sp_after_operator = ignore sp_after_operator_sym = ignore sp_after_cast = remove sp_inside_paren_cast = ignore sp_cpp_cast_paren = ignore sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_braces_empty = ignore sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = remove sp_func_call_paren_empty = ignore sp_func_call_user_paren = ignore sp_func_class_paren = ignore sp_return_paren = remove sp_attribute_paren = remove sp_defined_paren = force sp_throw_paren = ignore sp_catch_paren = ignore sp_version_paren = ignore sp_scope_paren = ignore sp_macro = ignore sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_brace_typedef = force sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore sp_before_dc = remove sp_after_dc = remove sp_d_array_colon = ignore sp_not = remove sp_inv = remove sp_addr = remove sp_member = remove sp_deref = remove sp_sign = remove sp_incdec = remove sp_before_nl_cont = add sp_after_oc_scope = ignore sp_after_oc_colon = ignore sp_before_oc_colon = ignore sp_after_send_oc_colon = ignore sp_before_send_oc_colon = ignore sp_after_oc_type = ignore sp_after_oc_return_type = ignore sp_after_oc_at_sel = ignore sp_after_oc_at_sel_parens = ignore sp_inside_oc_at_sel_parens = ignore sp_before_oc_block_caret = ignore sp_after_oc_block_caret = ignore sp_cond_colon = ignore sp_cond_question = ignore sp_case_label = ignore sp_range = ignore sp_cmt_cpp_start = ignore sp_endif_cmt = ignore sp_after_new = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_same_func_call_params = false align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_amp_style = 0 align_var_def_thresh = 0 align_var_def_gap = 0 align_var_def_colon = true align_var_def_attribute = false align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_var_struct_thresh = 0 align_var_struct_gap = 0 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_func = 0 align_typedef_star_style = 0 align_typedef_amp_style = 0 align_right_cmt_span = 3 align_right_cmt_mix = false align_right_cmt_gap = 0 align_right_cmt_at_col = 0 align_func_proto_span = 0 align_func_proto_gap = 0 align_on_operator = false align_mix_var_proto = false align_single_line_func = false align_single_line_brace = false align_single_line_brace_gap = 0 align_oc_msg_spec_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 align_left_shift = true align_oc_msg_colon_span = 0 align_oc_decl_colon = false nl_collapse_empty_body = false nl_assign_leave_one_liners = true nl_class_leave_one_liners = true nl_enum_leave_one_liners = true nl_getset_leave_one_liners = true nl_func_leave_one_liners = false nl_if_leave_one_liners = false nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_assign_square = ignore nl_after_square_assign = ignore nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_else_if = ignore nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_using_brace = ignore nl_brace_brace = ignore nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_multi_line_cond = false nl_multi_line_define = false nl_before_case = true nl_before_throw = ignore nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_type_name_class = ignore nl_func_scope_name = ignore nl_func_proto_type_name = ignore nl_func_paren = ignore nl_func_def_paren = ignore nl_func_decl_start = ignore nl_func_def_start = ignore nl_func_decl_start_single = ignore nl_func_def_start_single = ignore nl_func_decl_args = ignore nl_func_def_args = ignore nl_func_decl_end = ignore nl_func_def_end = ignore nl_func_decl_end_single = ignore nl_func_def_end_single = ignore nl_func_decl_empty = ignore nl_func_def_empty = ignore nl_fdef_brace = add nl_after_return = true nl_return_expr = ignore nl_after_semicolon = true nl_after_brace_open = true nl_after_brace_open_cmt = false nl_after_vbrace_open = true nl_after_vbrace_open_empty = false nl_after_brace_close = true nl_after_vbrace_close = false nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false nl_ds_struct_enum_close_brace = false nl_class_colon = ignore nl_create_if_one_liner = false nl_create_for_one_liner = false nl_create_while_one_liner = false pos_arith = ignore pos_assign = ignore pos_bool = ignore pos_compare = ignore pos_conditional = ignore pos_comma = ignore pos_class_comma = ignore pos_class_colon = ignore code_width = 0 ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_class = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 nl_after_multiline_comment = false nl_after_struct = 0 nl_after_class = 0 nl_before_access_spec = 0 nl_after_access_spec = 1 nl_comment_func_def = 0 nl_after_try_catch_finally = 0 nl_around_cs_property = 0 nl_between_get_set = 0 nl_property_brace = ignore eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_if_chain = false mod_full_brace_nl = 0 mod_full_brace_while = add mod_full_brace_using = ignore mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false mod_remove_extra_semicolon = true mod_add_long_function_closebrace_comment = 40 mod_add_long_switch_closebrace_comment = 40 mod_add_long_ifdef_endif_comment = 0 mod_add_long_ifdef_else_comment = 0 mod_sort_import = false mod_sort_using = false mod_sort_include = false mod_move_case_break = false mod_case_brace = ignore mod_remove_empty_return = false cmt_width = 0 cmt_reflow_mode = 0 cmt_indent_multi = true cmt_c_group = false cmt_c_nl_start = false cmt_c_nl_end = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 cmt_multi_check_last = true cmt_insert_file_header = "" cmt_insert_file_footer = "" cmt_insert_func_header = "" cmt_insert_class_header = "" cmt_insert_oc_msg_header = "" cmt_insert_before_preproc = false pp_indent = remove pp_indent_at_level = false pp_indent_count = 1 pp_space = remove pp_space_count = 0 pp_indent_region = 0 pp_region_indent_code = false pp_indent_if = 0 pp_if_indent_code = false pp_define_at_level = false uncrustify-0.59/tests/config/nl_func_type_name_remove.cfg0000644000175000017500000000024111506773274020746 00000000000000 sp_cmt_cpp_start = add # align_var_def_span = 16 align_func_proto_span =16 align_on_operator =true nl_func_type_name = remove nl_func_proto_type_name = remove uncrustify-0.59/tests/config/avalon3.cfg0000644000175000017500000004452211506773274015261 00000000000000 # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 2 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 2 # number # The ascii value of the string escape char, usually 92 (\). (Pawn) string_escape_char = 92 # number # # Indenting # # The number of columns to indent per level (usually 2, 3, 4, or 8) indent_columns = 2 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = true # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to indent_columns. indent_member = 0 # number # Spaces to indent 'case' from 'switch' indent_switch_case = 2 # number # Spaces to indent '{' from 'case' indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels (>0=absolute column where 1 is the leftmost column, <=0=subtract from brace indent) indent_label = -2 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Add or remove space between ')' and '{' sp_paren_brace = force # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = force # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = force # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = remove # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = force # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = force # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = remove # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = remove # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = remove # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = remove # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = remove # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force sp_angle_word = force sp_angle_paren = remove # Add or remove space between return type and function name (a minimum of 1 is forced except for pointer return types) sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = force # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = force # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = force # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = force # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # Whether the pointer star is part of the variable name or not align_var_def_star_style = 2 # false/true # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type: typedef int * pint; align_typedef_star_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 1 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = true # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 2 # number # Add or remove newline between '=' and '{' nl_assign_brace = remove # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between function call and '(' nl_fcall_brace = remove # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = remove # ignore/add/remove/force # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = remove # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = force # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = force # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = force # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = remove # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = force # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = lead # ignore/lead/trail # # Blank line options # # The maximum consecutive newlines nl_max = 3 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 1 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of the function body nl_after_func_body = 2 # number # The minimum number of newlines before a multi-line comment (doesn't apply if after a brace open) nl_before_block_comment = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = ignore # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = remove # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = true # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = ignore # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = ignore # ignore/add/remove/force uncrustify-0.59/tests/config/mod_case_brace_add.cfg0000644000175000017500000014373011506773274017435 00000000000000# Uncrustify 0.52+svn mod_case_brace = add # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 3 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 3 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 3 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = force # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':' sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '-(int) f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = remove # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 16 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = force # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = force # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = force # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = force # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 3 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 1 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ uncrustify-0.59/tests/config/indent_func_param.cfg0000644000175000017500000000025311506773274017363 00000000000000indent_func_call_param = true indent_func_def_param = true indent_func_proto_param = true indent_columns = 3 indent_with_tabs = 1 output_tab_size = indent_columns uncrustify-0.59/tests/config/brace-gnu.cfg0000644000175000017500000000225511574765306015560 00000000000000# # GNU style # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 2 # new tab size indent_columns = 2 # indent extra 2 spaces per brace pair indent_brace = 2 # brace placement # nl_assign_brace = add # "= {" vs "= \n {" # nl_enum_brace = add # "enum {" vs "enum \n {" # nl_union_brace = add # "union {" vs "union \n {" # nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_brace_while = add nl_brace_else = add # spaces around braces sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_assign = add sp_else_brace = force # nl_squeeze_ifdef = TRUE # nl_func_var_def_blk = 1 # nl_before_case = 1 # nl_after_return = TRUE uncrustify-0.59/tests/config/nl_namespace-r.cfg0000644000175000017500000000011411574765451016572 00000000000000# nl_namespace_brace = Remove indent_class = True indent_namespace = True uncrustify-0.59/tests/config/sp_after_oc_block_caret_force.cfg0000644000175000017500000000030611506773274021700 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_after_oc_block_caret = forceuncrustify-0.59/tests/config/if_chain.cfg0000644000175000017500000000661411506773274015456 00000000000000# # uncrustify config file for the linux kernel # # $Id: linux.cfg 488 2006-09-09 12:44:38Z bengardner $ # indent_with_tabs = 2 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column # # inter-symbol newlines # nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_brace_while = remove # "} while" vs "} \n while" - cuddle while nl_brace_else = remove # "} else" vs "} \n else" - cuddle else sp_brace_else = force sp_else_brace = force nl_func_var_def_blk = 1 nl_fcall_brace = remove # "list_for_each() {" vs "list_for_each()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE; # nl_before_case = 1 # # Source code modifications # mod_paren_on_return = remove # "return 1;" vs "return (1);" #mod_full_brace_if = remove # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_if_chain = true mod_full_brace_for = remove # "for () a--;" vs "for () { a--; }" mod_full_brace_do = remove # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = remove # "while (a) a--;" vs "while (a) { a--; }" mod_full_brace_nl = 3 # don't remove if more than 3 newlines # # inter-character spacing options # # sp_return_paren = force # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_assign = add sp_arith = add sp_bool = add sp_compare = add sp_assign = add sp_after_comma = add sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" # # Aligning stuff # align_with_tabs = TRUE # use tabs to align align_on_tabstop = TRUE # align on tabstops # align_keep_tabs = true align_enum_equ_span = 4 # '=' in enum definition # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE # align_var_def_star = FALSE # align_var_def_colon = TRUE # align_assign_span = 1 align_struct_init_span = 3 # align stuff in a structure init '= { }' align_right_cmt_span = 3 # align_pp_define_span = 8; # align_pp_define_gap = 4; cmt_star_cont = true # indent_brace = 0 mod_add_long_ifdef_endif_comment = 1 mod_add_long_ifdef_else_comment = 1 nl_func_paren = remove nl_func_decl_start = remove nl_func_decl_empty = remove nl_func_decl_args = remove nl_func_decl_end = remove sp_inside_paren = remove sp_inside_paren_cast = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_paren_paren = remove sp_after_comma = force sp_before_ptr_star = force sp_after_ptr_star = remove sp_between_ptr_star = remove align_func_params = true align_var_struct_span = 6 uncrustify-0.59/tests/config/else-if-2.cfg0000644000175000017500000000012311506773274015366 00000000000000indent_with_tabs = 2 indent_columns = 2 nl_else_if = remove indent_else_if = true uncrustify-0.59/tests/config/cond-2.cfg0000644000175000017500000000010511506773274014765 00000000000000 indent_columns = 3 sp_cond_colon = add sp_cond_question = add uncrustify-0.59/tests/config/brace-remove-all.cfg0000644000175000017500000000061611506773274017027 00000000000000# # Removes all unecessary braces # mod_paren_on_return = remove # "return 1;" vs "return (1);" mod_full_brace_if = remove # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = remove # "for () a--;" vs "for () { a--; }" mod_full_brace_do = remove # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = remove # "while (a) a--;" vs "while (a) { a--; }" nl_else_if = remove uncrustify-0.59/tests/config/case-3.cfg0000644000175000017500000000062611574765327014773 00000000000000# # My favorite format # indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_switch_case = indent_columns indent_case_brace = -indent_columns nl_before_case = True # blank line before case except after { nl_after_case = True # disallow case X: a++; break; uncrustify-0.59/tests/config/sp_before_oc_block_caret_add.cfg0000644000175000017500000000031011506773274021466 00000000000000indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs output_tab_size = 4 # new tab size indent_columns = output_tab_size sp_before_oc_block_caret = adduncrustify-0.59/tests/config/class-colon-pos-sol.cfg0000644000175000017500000000051311574765451017520 00000000000000# # moves class colon ops to the end of line # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_class_colon = Lead indent_class_colon = True sp_after_dc = remove sp_before_dc = remove uncrustify-0.59/tests/config/pp-indent-2.cfg0000644000175000017500000000024011574765451015743 00000000000000# # Remove all PP spacing and indent # pp_indent = remove pp_space = add pp_space_count = 2 # Gives the format # |#ifdef SOMETHING # |# define X # |#endif uncrustify-0.59/tests/config/multi.cfg0000644000175000017500000000003311506773274015035 00000000000000 cmt_indent_multi = false uncrustify-0.59/tests/config/class-colon-pos-sol-add.cfg0000644000175000017500000000070311574765334020247 00000000000000# # moves class colon ops to the end of line # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_class_colon = Lead pos_comma = Trail pos_class_comma = trail indent_class_colon = True nl_class_init_args = Add nl_class_colon = Add sp_inside_fparen = force sp_after_dc = remove sp_before_dc = remove uncrustify-0.59/tests/config/var_def_gap.cfg0000644000175000017500000000055111506773274016145 00000000000000 align_var_def_span = 3 align_var_def_gap = 5 align_var_def_star_style = 2 align_var_def_amp_style = 2 sp_after_ptr_star = remove sp_between_ptr_star = remove sp_before_ptr_star = force sp_after_byref = force sp_before_byref = remove # align_pp_define_span = 3 # align_pp_define_gap = 3 align_number_left = true align_assign_span = 1 align_typedef_span = 2 uncrustify-0.59/tests/config/nepenthes.cfg0000644000175000017500000015450511506773274015712 00000000000000# Uncrustify 0.54 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 4 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 4 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 4 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 2 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = false # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = ignore # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = ignore # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = ignore # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = ignore # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = ignore # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = ignore # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = ignore # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = ignore # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = remove # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = remove # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = add # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = remove # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space before the variadic '...' sp_before_ellipsis = add # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = remove # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = remove # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = remove # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = remove # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = ignore # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = ignore # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = remove # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = remove # ignore/add/remove/force # Add or remove space between macro and value sp_macro = add # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = add # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = remove # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = ignore # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = ignore # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName).' vs '@selector (msgName)' sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = true # false/true # Whether to use tabs for aligning align_with_tabs = true # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = false # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = add # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 0 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = add # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = add # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = add # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = add # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = add # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = remove # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = remove # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/trail # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = ignore # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = ignore # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/tests/config/brace-kr.cfg0000644000175000017500000000226211574765310015374 00000000000000# # K&R style # indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size # brace placement nl_assign_brace = remove # "= {" vs "= \n {" nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_brace_while = remove nl_brace_else = remove # spaces around braces sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_assign = add sp_else_brace = force # nl_squeeze_ifdef = TRUE # nl_func_var_def_blk = 1 # nl_before_case = 1 # nl_after_return = TRUE sp_brace_else = force uncrustify-0.59/tests/config/op-space-force.cfg0000644000175000017500000000042311574765451016514 00000000000000# # Forces a space after an operator # indent_columns = 3 sp_before_byref = remove sp_after_byref = force indent_class = True sp_func_def_paren = remove sp_func_proto_paren = remove sp_after_operator = force sp_after_operator_sym = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/cmt_multi-1.cfg0000644000175000017500000000006311506773274016041 00000000000000indent_columns = 4 cmt_multi_check_last = false uncrustify-0.59/tests/config/return-2.cfg0000644000175000017500000000026511506773274015370 00000000000000 indent_columns = 4 indent_with_tabs = 0 nl_after_return = true mod_paren_on_return = remove nl_return_expr = remove sp_before_semi = remove sp_inside_paren = remove uncrustify-0.59/tests/config/func_call_user.cfg0000644000175000017500000011400011506773274016667 00000000000000# # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 4 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 4 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 4 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = false # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 4 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 4 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 4 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 4 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 1 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = ignore # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = force # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = true # false/true # Add or remove space between ')' and '{' sp_paren_brace = remove # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = force # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = remove # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = force # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = remove # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = force # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = remove # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = remove # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = force # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = force # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = force # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = remove # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = remove # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = force # ignore/add/remove/force # Add or remove space after cast sp_after_cast = force # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = remove # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = remove # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = force # ignore/add/remove/force sp_func_call_user_paren = remove # ignore/add/remove/force set func_call_user _ N_ # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = force # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = force # ignore/add/remove/force # Add or remove space between macro and value sp_macro = force # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = force # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f: (int) x;' vs '+(int) f : (int) x;' sp_before_oc_colon = force # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '+(int)f : (int)x;' sp_after_oc_type = force # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 20 # number # How to align the star in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 30 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 10 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 12 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 30 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 30 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 8 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 4 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 2 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 2 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # The span for aligning function prototypes (0=don't align) align_func_proto_span = 3 # number # The span for aligning function prototypes (0=don't align) align_oc_msg_spec_span = 3 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 2 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 50 # number # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = false # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = force # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = force # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = add # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = add # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = add # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = add # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add or remove newline when condition spans two or more lines nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { nl_namespace_brace = add # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = true # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = true # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove newline before 'if' nl_before_if = add # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = add # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = add # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = add # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = add # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = add # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = add # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = add # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = add # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = add # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = true # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = true # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = trail # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 80 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = true # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = true # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 3 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 1 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 3 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 5 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 5 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 1 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 1 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 1 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = true # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = add # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 1 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = remove # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 1 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 10 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # # Comment modifications # # Try to wrap comments at cmt_witdth columns cmt_width = 80 # number # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = true # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 1 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP uncrustify-0.59/tests/config/nl_func_scope_name.cfg0000644000175000017500000000017611506773274017530 00000000000000 sp_cmt_cpp_start = add # align_var_def_span = 16 align_func_proto_span =16 align_on_operator =true nl_func_scope_name = add uncrustify-0.59/tests/config/else-if-1.cfg0000644000175000017500000000012411506773274015366 00000000000000indent_with_tabs = 2 indent_columns = 2 nl_else_if = remove indent_else_if = false uncrustify-0.59/tests/config/func_wrap2.cfg0000644000175000017500000000005511506773274015755 00000000000000set func_wrap FSUB sp_inside_fparen = force uncrustify-0.59/tests/config/blc-1.cfg0000644000175000017500000000061011574765275014611 00000000000000# # Blank Line Count test 1 # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size nl_max = 4 nl_before_block_comment = 2 nl_after_func_body = 2 nl_after_func_proto_group = 2 nl_start_of_file = Remove nl_end_of_file = Force nl_end_of_file_min = 1 uncrustify-0.59/tests/config/nl_endif.cfg0000644000175000017500000000751311506773274015473 00000000000000align_func_params=true align_keep_tabs=false align_nl_cont=false align_number_left=false align_on_tabstop=false align_right_cmt_mix=false align_var_def_colon=false align_var_def_inline=false align_with_tabs=false cmt_c_group=false cmt_c_nl_end=false cmt_c_nl_start=false cmt_cpp_group=false cmt_cpp_nl_end=false cmt_cpp_nl_start=false cmt_cpp_to_c=false cmt_star_cont=false eat_blanks_after_open_brace=false eat_blanks_before_close_brace=false indent_align_string=false indent_bool_paren=false indent_brace_parent=false indent_braces=false indent_braces_no_func=false indent_class=false indent_class_colon=false indent_col1_comment=false indent_comma_paren=false indent_func_call_param=false indent_func_class_param=false indent_func_ctor_var_param=false indent_func_def_param=true indent_func_param_double=false indent_func_proto_param=false indent_namespace=false indent_paren_nl=true indent_preserve_sql=false indent_square_nl=false ls_for_split_full=false ls_func_split_full=false mod_full_paren_if_bool=false mod_pawn_semicolon=false mod_remove_extra_semicolon=true mod_sort_import=false mod_sort_include=false mod_sort_using=false nl_after_brace_open=true nl_after_brace_open_cmt=false nl_after_case=false nl_after_multiline_comment=false nl_after_return=true nl_after_semicolon=true nl_after_vbrace_open=true nl_assign_leave_one_liners=true nl_before_case=true nl_class_leave_one_liners=false nl_collapse_empty_body=true nl_create_for_one_liner=false nl_create_if_one_liner=false nl_create_while_one_liner=false nl_define_macro=false nl_ds_struct_enum_close_brace=false nl_ds_struct_enum_cmt=false nl_enum_leave_one_liners=false nl_func_leave_one_liners=false nl_getset_leave_one_liners=false nl_if_leave_one_liners=false nl_multi_line_cond=false nl_squeeze_ifdef=true pp_define_at_level=true pp_if_indent_code=true pp_indent_at_level=true pp_region_indent_code=true sp_balance_nested_parens=false align_assign_span=0 align_right_cmt_span=3 align_var_def_span=1 align_var_def_star_style=0 cmt_width=108 code_width=108 indent_case_brace=0 indent_case_shift=0 indent_columns=3 indent_switch_case=3 indent_with_tabs=0 input_tab_size=3 mod_add_long_function_closebrace_comment=1 mod_add_long_switch_closebrace_comment=16 nl_end_of_file_min=2 nl_func_var_def_blk=1 pp_indent_region=3 pp_space_count=3 mod_paren_on_return=force nl_after_do=force nl_after_for=force nl_after_if=force nl_after_switch=force nl_after_while=force nl_before_do=force nl_before_for=force nl_before_if=force nl_before_switch=force nl_before_while=force nl_brace_else=force nl_brace_while=force nl_class_brace=force nl_else_brace=force nl_elseif_brace=force nl_end_of_file=force nl_fcall_brace=force nl_fdef_brace=force nl_for_brace=force nl_func_decl_args=force nl_func_decl_end=add nl_func_decl_start=force nl_func_paren=force nl_func_proto_type_name=remove nl_func_type_name=remove nl_if_brace=force nl_while_brace=add pos_class_comma=trail pos_comma=trail pp_indent=force sp_after_cast=remove sp_after_comma=force sp_after_oc_type=remove sp_after_ptr_star=add sp_after_sparen=force sp_arith=force sp_assign=force sp_before_comma=remove sp_before_ptr_star=remove sp_before_semi=remove sp_before_semi_for=remove sp_before_semi_for_empty=remove sp_before_sparen=remove sp_before_square=remove sp_before_squares=remove sp_bool=force sp_brace_else=force sp_compare=force sp_deref=remove sp_fparen_brace=force sp_func_call_paren=remove sp_func_def_paren=remove sp_func_proto_paren=remove sp_incdec=remove sp_inside_braces=force sp_inside_fparen=remove sp_inside_fparens=remove sp_inside_paren=remove sp_inside_paren_cast=remove sp_inside_sparen=remove sp_macro=force sp_macro_func=force sp_member=remove sp_not=remove sp_paren_paren=remove sp_return_paren=force sp_type_func=force uncrustify-0.59/tests/config/brace-kr-br.cfg0000644000175000017500000000255111506773274016001 00000000000000# # K&R style # # $Id: brace-kr.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size # brace placement nl_assign_brace = remove # "= {" vs "= \n {" nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_brace_while = remove nl_brace_else = remove # spaces around braces sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_assign = add sp_else_brace = force # nl_squeeze_ifdef = TRUE # nl_func_var_def_blk = 1 # nl_before_case = 1 # nl_after_return = TRUE nl_after_brace_open = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_if = add uncrustify-0.59/tests/config/freebsd.cfg0000644000175000017500000015637311506773274015340 00000000000000# Uncrustify 0.54 # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 8 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 4 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 2 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = force # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = add # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = force # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName).' vs '@selector (msgName)' sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space before a block pointer caret # '^int (int arg){...}' vs. ' ^int (int arg){...}' sp_before_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space after a block pointer caret # '^int (int arg){...}' vs. '^ int (int arg){...}' sp_after_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = remove # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 16 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) align_oc_msg_colon_span = 0 # number # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = remove # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = force # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = trail # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/trail # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 3 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 1 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = remove # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/tests/config/width-3.cfg0000644000175000017500000000110211506773274015160 00000000000000# # width stuff # # $Id: width-3.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 input_tab_size = 8 indent_columns = 4 nl_if_brace = remove nl_elseif_brace = remove nl_else_brace = remove nl_brace_else = remove nl_fdef_brace = force sp_arith = force sp_macro = force sp_macro_func = force sp_sparen_brace = add sp_after_sparen = add sp_fparen_brace = force sp_square_fparen = remove sp_inside_braces = add sp_after_tag = remove code_width = 80 sp_after_ptr_star = remove sp_before_ptr_star = force ls_for_split_full = true ls_func_split_full = true uncrustify-0.59/tests/config/xml-str.cfg0000644000175000017500000000624511574765451015327 00000000000000# # My favorite format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_access_spec = 2 indent_align_string = True # align broken strings indent_xml_string = 2 # align broken strings indent_brace = 0 indent_member = indent_columns nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 # align_assign_thresh = 8 align_struct_init_span = 3 align_var_struct_span = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE # indent_namespace = FALSE indent_class = TRUE uncrustify-0.59/tests/config/align_fcall.cfg0000644000175000017500000000007411506773274016143 00000000000000 align_same_func_call_params = true sp_after_comma = force uncrustify-0.59/tests/config/cmt_indent-1.cfg0000644000175000017500000000016311506773274016171 00000000000000indent_with_tabs = 2 indent_columns = 2 indent_namespace = true indent_class = true nl_collapse_empty_body = true uncrustify-0.59/tests/config/pp_if_indent-2.cfg0000644000175000017500000000023311506773274016502 00000000000000# out-dented region preprocs pp_indent = add indent_columns = 4 pp_if_indent_code = false pp_indent_if = -4 pp_indent_at_level = true uncrustify-0.59/tests/config/nl_brace_brace-a.cfg0000644000175000017500000000002711506773274017025 00000000000000 nl_brace_brace = add uncrustify-0.59/tests/config/bool-pos-sol-break.cfg~0000644000175000017500000000063611506773274017521 00000000000000# # moves boolean ops to the end of line # # $Id: bool-pos-sol.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = Lead_break pos_comma = Lead pos_class_comma = Lead sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/class-nl_func-add.cfg0000644000175000017500000000070311574765451017167 00000000000000# # moves class colon ops to the end of line # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_class_colon = Trail pos_comma = Trail pos_class_comma = trail indent_class_colon = True nl_class_init_args = Add nl_class_colon = Add nl_fdef_brace = force sp_after_dc = remove sp_before_dc = remove uncrustify-0.59/tests/config/sp-for-semi.cfg0000644000175000017500000000017211506773274016050 00000000000000 sp_before_semi = remove sp_before_semi_for = remove sp_before_semi_for_empty = force sp_after_semi_for_empty = ignore uncrustify-0.59/tests/config/ptr_star-1.cfg0000644000175000017500000000035111506773274015702 00000000000000sp_after_ptr_star = force sp_after_ptr_star_func = force sp_before_ptr_star = remove sp_between_ptr_star = remove sp_before_unnamed_ptr_star = remove sp_before_byref = remove sp_after_byref = force sp_before_unnamed_byref = remove uncrustify-0.59/tests/config/comment-align.cfg0000644000175000017500000000010611506773274016436 00000000000000indent_columns = 4 sp_inside_braces = force align_right_cmt_span = 6 uncrustify-0.59/tests/config/byref-left.cfg0000644000175000017500000000021511574765320015742 00000000000000# # Places the byref as follows: "int &foo" # indent_columns = 3 sp_before_byref = force sp_after_byref = remove indent_class = True uncrustify-0.59/tests/config/rdan.cfg0000644000175000017500000015663511506773274014653 00000000000000# Uncrustify 0.54 # # Informations # "Ignore" means do not change it. # "Add" in the context of spaces means make sure there is at least 1. # "Add" elsewhere means make sure one is present. # "Remove" mean remove the space/brace/newline/etc. # "Force" in the context of spaces means ensure that there is exactly 1. # "Force" in other contexts means the same as "add". # # Rmk: spaces = space + nl # # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = output_tab_size # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = indent_columns # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = indent_columns # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 1 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = true # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = true # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = force # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = ignore # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Default=Add sp_pp_stringify = ignore # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = remove # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = remove # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = remove # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = remove # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = remove # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = force # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = remove # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = remove # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space before the variadic '...' sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = remove # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = remove # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = remove # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = remove # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = remove # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = remove # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = remove # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = force # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName).' vs '@selector (msgName)' sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = force # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = force # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = force # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 2 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 2 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # !!!! 1 si possible de supprimer lignes vides dans enum # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 1 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 1 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 1 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 2 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 2 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = code_width # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 1 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # !!!! analyser options ayant un impact sur le format des macros # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 1 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = false # false/true # Align parameters in an Obj-C message on the ':' align_oc_decl_colon = false # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = force # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of blank lines after a block of variable definitions nl_func_var_def_blk = 2 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = force # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = force # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = force # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = force # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = force # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = force # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = force # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = remove # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = force # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = force # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = force # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = force # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = force # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = force # ignore/add/remove/force # !!!!!! ??? # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = remove # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = lead # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = trail # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = lead_force # ignore/lead/trail # The position of comparison operators in wrapped expressions pos_compare = lead # ignore/lead/trail # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = lead_force # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = trail # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 80 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = true # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = true # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 2 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 2 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 2 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # !!!! risque car modif code # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = remove # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = code_width # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = add # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = true # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = remove # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = true # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/tests/config/template_sp-force.cfg0000644000175000017500000000104411574765451017322 00000000000000# # Forces a newline between template '>' and class # indent_columns = 3 sp_before_byref = remove sp_after_byref = force indent_class = True sp_func_def_paren = remove sp_func_proto_paren = remove sp_after_operator = force sp_before_angle = force sp_inside_angle = force sp_after_angle = force sp_angle_word = force sp_angle_paren = force sp_arith = force sp_compare = remove # just to show a difference sp_template_angle = remove sp_inside_braces = force sp_inside_braces_struct = force tok_split_gte = true uncrustify-0.59/tests/config/pp_ret.cfg0000644000175000017500000006721711506773274015215 00000000000000 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 4 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = true # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = false # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = -4 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = add # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = add # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = add # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = add # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = add # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = remove # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = add # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = add # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = remove # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = remove # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = remove # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = ignore # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = ignore # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't touch one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't touch one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = true # false/true # Don't touch one-line get or set functions nl_getset_leave_one_liners = true # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = ignore # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = ignore # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = ignore # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = add # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = add # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = add # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = add # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = add # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add or remove newline when condition spans two or more lines nl_multi_line_cond = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Newline between namespace and { nl_namespace_brace = add # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = add # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 2 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = ignore # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = ignore # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = ignore # ignore/add/remove/force # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP uncrustify-0.59/tests/config/cmt_nl_end.cfg0000644000175000017500000000020311506773274016004 00000000000000indent_columns=3 indent_with_tabs=0 input_tab_size=3 nl_end_of_file_min=1 nl_after_if=force # X+1 nl_before_if=force # x+y uncrustify-0.59/tests/config/cmt_right.cfg0000644000175000017500000000005411506773274015666 00000000000000indent_columns = 4 align_right_cmt_span = 5 uncrustify-0.59/tests/config/sp_before_ellipsis-f.cfg0000644000175000017500000000020111506773274017773 00000000000000 sp_before_ellipsis = force sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_after_comma = force uncrustify-0.59/tests/config/sim.cfg0000644000175000017500000006137111574765451014512 00000000000000# # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 2 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 2 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 2 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # Whether to indent continued function call parameters one indent level (true) or aligns instead of indent (false) indent_func_call_param = true # false/true # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 2 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = -2 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = force # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*' sp_after_ptr_star = force # ignore/add/remove/force # Add or remove space before reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space after reference sign '&' sp_after_byref = force # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = remove # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = force # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = force # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = remove # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = remove # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = remove # ignore/add/remove/force # Add or remove space after cast sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = remove # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = remove # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = force # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = force # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = force # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_star_style = 2 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Whether to align macros wrapped with a backslash and a newline align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 1 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # # Newline adding and removing options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = true # false/true # Don't touch one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't touch one-line function bodies inside a class xx { } body nl_class_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = remove # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between function call and '(' nl_fcall_brace = remove # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = remove # ignore/add/remove/force # Add or remove newline when condition spans two or more lines nl_multi_line_cond = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = remove # ignore/add/remove/force # Add or remove newline between 'template<>' and 'class' nl_template_class = force # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = force # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = force # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = remove # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = force # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open nl_after_brace_open = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Add or remove a newline around a class colon. Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = force # ignore/add/remove/force # # Positioning options # # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = trail # ignore/lead/trail pos_class_comma = trail # The position of colons between constructor and member initialization pos_class_colon = trail # ignore/lead/trail # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 3 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 1 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 2 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement mod_full_brace_if = ignore # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = remove # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = true # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # # Comment modifications # # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # # Preprocessor options # # Add or remove indent of preprocessor directives pp_indent = ignore # ignore/add/remove/force # Add or remove space between # and, say, define pp_space = ignore # ignore/add/remove/force # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP uncrustify-0.59/tests/config/indent_func_def_param.cfg0000644000175000017500000000031611506773274020201 00000000000000indent_func_call_param = false indent_func_def_param = true indent_func_proto_param = false indent_columns = 3 indent_with_tabs = 1 output_tab_size = indent_columns nl_func_proto_type_name = force uncrustify-0.59/tests/config/d2.cfg0000644000175000017500000000706411574765451014226 00000000000000# # My favorite format # newlines = auto # AUTO (default), DOS, MAC, or UNIX indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 4 # new tab size indent_columns = output_tab_size indent_label = 1 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_case_brace = indent_columns indent_class = true nl_start_of_file = remove # nl_start_of_file_min = 0 nl_end_of_file = force nl_end_of_file_min = 1 nl_assign_brace = remove # "= {" vs "= \n {" nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = remove # "foo() {" vs "foo()\n{" nl_fdef_brace = remove # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE nl_after_brace_open = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_func_class_paren = remove sp_before_angle = force sp_after_angle = force sp_inside_angle = remove sp_else_brace = force sp_paren_brace = force sp_fparen_brace = force sp_range = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 align_struct_init_span = 3 align_var_struct_span = 99 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE nl_assign_square = remove sp_inside_square = remove sp_d_array_colon = force nl_after_square_assign = force uncrustify-0.59/tests/config/misc6.cfg0000644000175000017500000000011411506773274014724 00000000000000sp_after_angle = remove sp_before_ptr_star = force sp_before_byref = force uncrustify-0.59/tests/config/nl_semicolon.cfg0000644000175000017500000000637411574765451016405 00000000000000# nl_after_semicolon = True nl_after_brace_open = True indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_label = 2 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_member = indent_columns nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_before_semi_for = remove sp_after_semi_for = force sp_before_semi_for_empty = remove sp_after_semi_for_empty = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 2 align_var_def_inline = TRUE align_var_def_star_style = 1 align_var_def_colon = TRUE align_assign_span = 1 # align_assign_thresh = 8 align_struct_init_span = 3 align_var_struct_span = 3 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE # indent_namespace = FALSE indent_class = TRUE uncrustify-0.59/tests/config/class-colon-pos-eol-add.cfg0000644000175000017500000000065211574765330020230 00000000000000# # moves class colon ops to the end of line # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_class_colon = Trail pos_comma = Trail pos_class_comma = trail indent_class_colon = True nl_class_init_args = Add nl_class_colon = Add sp_after_dc = remove sp_before_dc = remove uncrustify-0.59/tests/config/indent_ctor_init.cfg0000644000175000017500000015725411631561151017244 00000000000000# Uncrustify 0.58 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. # If true (default), 'assert(x<0 && y>=3)' will be broken. # Improvements to template detection may make this option obsolete. tok_split_gte = false # false/true # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 2 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop indent_with_tabs = 0 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = true # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = true # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = true # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = true # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = true # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = true # false/true # Additional amount to indent ctor initializer list indent_ctor_init = 2 # Same as indent_func_call_param, but for templates indent_template_param = true # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = true # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 2 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = true # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 2 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 2 # number # Whether to indent comments found in first column indent_col1_comment = true # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 2 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 2 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype sp_assign_default = remove # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = force # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = add # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = add # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = remove # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = add # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = add # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = add # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = add # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = remove # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = force # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = force # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = force # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = add # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = ignore # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = add # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = add # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = remove # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = ignore # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = force # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = add # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '(' in 'catch (something) { }' # If set to ignore, sp_before_sparen is used. sp_catch_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = add # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = add # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = add # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = add # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = add # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = add # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = add # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = add # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = true # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = true # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = remove # ignore/add/remove/force # The number of blank lines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = remove # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = remove # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = remove # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = remove # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = remove # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = remove # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = remove # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = remove # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = true # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = remove # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = force # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = remove # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = add # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = remove # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition nl_func_def_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = add # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = add # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = remove # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = add # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = add # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = remove # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = remove # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = remove # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = remove # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = remove # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = remove # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = true # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = true # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_class_comma = trail_force # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_class_colon = lead # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 120 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = true # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = true # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 3 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 2 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 2 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 2 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 2 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 1 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = ignore # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = true # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = true # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = remove # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/tests/config/nl_class-r.cfg0000644000175000017500000000011011574765451015737 00000000000000# nl_class_brace = Remove indent_class = True indent_namespace = True uncrustify-0.59/tests/config/kw_subst2.cfg0000644000175000017500000000017211506773274015632 00000000000000 cmt_insert_file_header = file-header.h cmt_insert_func_header = func-header2.h cmt_insert_class_header = class-header.h uncrustify-0.59/tests/config/return-3.cfg0000644000175000017500000000026411506773274015370 00000000000000 indent_columns = 4 indent_with_tabs = 0 nl_after_return = true mod_paren_on_return = remove nl_return_expr = force sp_before_semi = remove sp_inside_paren = remove uncrustify-0.59/tests/config/mod_case_brace_rm.cfg0000644000175000017500000014373311506773274017326 00000000000000# Uncrustify 0.52+svn mod_case_brace = remove # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 3 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 3 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 3 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = force # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':' sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '-(int) f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = remove # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 16 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = force # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = force # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = force # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = force # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 3 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 1 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ uncrustify-0.59/tests/config/sp_throw_paren-f.cfg0000644000175000017500000000003111506773274017156 00000000000000 sp_throw_paren = force uncrustify-0.59/tests/config/empty_body.cfg0000644000175000017500000000031611574765451016065 00000000000000# indent_with_tabs = 0 input_tab_size = 8 indent_columns = 4 sp_arith = force sp_after_ptr_star = force sp_before_ptr_star = remove sp_between_ptr_star = remove nl_collapse_empty_body = True uncrustify-0.59/tests/config/getset.cfg0000644000175000017500000000606011574765451015207 00000000000000# # Mono library format # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_label = 1 # pos: absolute col, neg: relative column # indent_align_string = False # align broken strings # brace_indent = 0 indent_func_call_param = true # use indent tabstop nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = remove # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE # mod_paren_on_return = add # "return 1;" vs "return (1);" # mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" # mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" # mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" # mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove sp_before_square = add #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = force # "int foo (){" vs "int foo(){" sp_func_call_paren = force # "foo (" vs "foo(" sp_func_proto_paren = force # "int foo ();" vs "int foo();" # align_with_tabs = FALSE # use tabs to align # align_on_tabstop = FALSE # align on tabstops # align_enum_equ_span = 4 # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE align_var_def_star_style = 1 # align_var_def_colon = TRUE # align_assign_span = 1 # align_struct_init_span = 3 # align_var_struct_span = 3 # align_right_cmt_span = 3 # align_pp_define_span = 3 # align_pp_define_gap = 4 # align_number_left = TRUE # align_typedef_span = 5 # align_typedef_gap = 3 cmt_star_cont = TRUE eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE nl_getset_brace = force sp_getset_brace = force nl_after_brace_open = true uncrustify-0.59/tests/config/align_left_shift.cfg0000644000175000017500000000003111506773274017202 00000000000000align_left_shift = true uncrustify-0.59/tests/config/case-1.cfg0000644000175000017500000000057311574765323014766 00000000000000# # My favorite format # indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size indent_switch_case = 0 indent_case_brace = 0 nl_before_case = True # blank line before case except after { nl_after_case = True # disallow case X: a++; break; uncrustify-0.59/tests/config/brace-ws.cfg0000644000175000017500000000162411574765312015414 00000000000000# # Whitesmith style # indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_braces = TRUE # brace settings nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_brace_while = add nl_brace_else = add uncrustify-0.59/tests/config/ptr_star-3.cfg0000644000175000017500000000035011506773274015703 00000000000000sp_after_ptr_star = remove sp_after_ptr_star_func = force sp_before_ptr_star = force sp_between_ptr_star = remove sp_before_unnamed_ptr_star = remove sp_before_byref = remove sp_after_byref = force sp_before_unnamed_byref = force uncrustify-0.59/tests/config/brace-ws2.cfg0000644000175000017500000000166211574765314015502 00000000000000# # Whitesmith style # indent_with_tabs = 1 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_braces = TRUE indent_braces_no_func = TRUE # brace settings nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_brace_while = add nl_brace_else = add uncrustify-0.59/tests/config/sp_before_tr_emb_cmt-a.cfg0000644000175000017500000015747511631560313020272 00000000000000 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. # If true (default), 'assert(x<0 && y>=3)' will be broken. # Improvements to template detection may make this option obsolete. tok_split_gte = false # false/true # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 2 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop indent_with_tabs = 0 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = true # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = true # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = true # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = true # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = true # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = true # false/true # Same as indent_func_call_param, but for templates indent_template_param = true # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = true # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 2 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = true # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 2 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 2 # number # Whether to indent comments found in first column indent_col1_comment = true # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 2 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 2 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype sp_assign_default = remove # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = force # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = add # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = add # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = remove # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = remove # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = add # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = add # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = add # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = add # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = remove # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = force # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = force # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = add # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = force # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = add # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = ignore # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add space before trailing comment, e.g., do_something(); // trailing comment sp_before_tr_emb_cmt = add # Number of spaces before trailing comment, e.g., do_something(); // trailing comment sp_num_before_tr_emb_cmt = 2 # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = add # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = add # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = add # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = remove # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = remove # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = remove # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = ignore # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = remove # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = remove # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = force # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = add # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '(' in 'catch (something) { }' # If set to ignore, sp_before_sparen is used. sp_catch_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = add # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = add # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = add # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = add # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = add # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = add # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = add # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = add # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = add # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = true # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = true # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = remove # ignore/add/remove/force # The number of blank lines after a block of variable definitions nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = remove # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = remove # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = remove # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = remove # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = remove # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = remove # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = remove # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = remove # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = remove # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = remove # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = remove # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = remove # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = remove # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = remove # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = remove # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = remove # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = true # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = remove # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = force # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = remove # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = add # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = remove # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = remove # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition nl_func_def_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = add # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = add # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = remove # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = remove # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = add # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = add # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = remove # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = remove # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = remove # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = remove # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = remove # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = remove # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = remove # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = true # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = true # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = true # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = true # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = trail # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_class_comma = trail_force # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_class_colon = lead # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 120 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = true # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = true # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 3 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 2 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 2 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 2 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 2 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 1 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 2 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = ignore # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = true # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = true # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = remove # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = remove # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/tests/config/width-2.cfg0000644000175000017500000000117411574765451015173 00000000000000# # width stuff # indent_with_tabs = 0 input_tab_size = 8 indent_columns = 4 nl_if_brace = remove nl_elseif_brace = remove nl_else_brace = remove nl_brace_else = remove nl_fdef_brace = force sp_arith = force sp_macro = force sp_macro_func = force sp_sparen_brace = add sp_after_sparen = add sp_fparen_brace = force sp_square_fparen = remove sp_inside_braces = add sp_after_tag = remove code_width = 60 cmt_width = 60 cmt_cpp_to_c = true cmt_cpp_group = true cmt_c_group = true cmt_c_nl_end = true cmt_star_cont = true sp_after_ptr_star = remove sp_before_ptr_star = force ls_for_split_full = true ls_func_split_full = false uncrustify-0.59/tests/config/indent_var_def_cont.cfg0000644000175000017500000000003411506773274017676 00000000000000indent_var_def_cont = true uncrustify-0.59/tests/config/class-nl_func-del.cfg0000644000175000017500000000073611574765451017211 00000000000000# # moves class colon ops to the end of line # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_class_colon = Trail pos_comma = Trail pos_class_comma = trail indent_class_colon = True nl_class_init_args = Add nl_class_colon = Add nl_fdef_brace = remove sp_fparen_brace = force sp_after_dc = remove sp_before_dc = remove uncrustify-0.59/tests/config/indent_var_def.cfg~0000644000175000017500000013550511506773274017065 00000000000000# Uncrustify 0.50+svn # $Id: ben.cfg 1421 2008-11-14 00:56:36Z bengardner $ # # General options # # The type of line endings newlines = lf # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 3 # number # The ascii value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 3 # number indent_var_def_blk = -indent_columns indent_var_dev_cont = true # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs, align with spaces # 2=indent and align with tabs indent_with_tabs = 0 # number # Whether to indent strings broken by '\' so that they line up indent_align_string = true # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Indent based on the size of the brace parent, ie 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = true # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = true # false/true # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 3 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = force # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = force # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = force # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = force # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = remove # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = remove # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = force # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = remove # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = remove # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = remove # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = force # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = remove # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = remove # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = force # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = force # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = remove # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = force # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = add # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';' sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statment. sp_before_semi_for_empty = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statment: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside '[' and ']' sp_inside_square = remove # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = force # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, ie 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = remove # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, ie 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = remove # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = force # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = force # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = force # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = force # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = remove # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = remove # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = remove # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = add # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = remove # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = remove # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = remove # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = force # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = remove # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = remove # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7' sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;' sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int) f: (int) x;' vs '-(int) f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = remove # ignore/add/remove/force # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for alinging align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = true # false/true # Align variable definitions in prototypes and functions align_func_params = true # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 1 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 1 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 16 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = true # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = true # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 1 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 12 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 16 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 99 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 3 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 3 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 5 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typdef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typdef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 3 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. align_right_cmt_gap = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = true # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 4 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 3 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = true # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = true # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = remove # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = force # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 1 # number # Add or remove newline between '=' and '{' nl_assign_brace = add # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of newlines after a block of variable definitions nl_func_var_def_blk = 1 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = add # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = force # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = force # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = force # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = add # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = add # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = force # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = add # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = add # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = add # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = remove # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = add # ignore/add/remove/force # Add or remove newline when condition spans two or more lines nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = true # false/true # Whether to put a newline before 'case' statement nl_before_case = true # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = true # false/true # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = remove # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = add # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = true # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = true # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = true # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = true # false/true # Add or remove newline before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove newline after 'if' nl_after_if = ignore # ignore/add/remove/force # Add or remove newline before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove newline after 'for' nl_after_for = ignore # ignore/add/remove/force # Add or remove newline before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove newline after 'while' nl_after_while = ignore # ignore/add/remove/force # Add or remove newline before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove newline after 'switch' nl_after_switch = ignore # ignore/add/remove/force # Add or remove newline before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove newline after 'do' nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/trail # The position of assignment in wrapped expressions pos_assign = ignore # ignore/lead/trail # The position of boolean operators in wrapped expressions pos_bool = trail # ignore/lead/trail # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/trail # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/trail # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/trail # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 4 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 2 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 3 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 2 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a mulit-line comment. nl_after_multiline_comment = false # false/true # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 1 # number # Whether to remove blank lines after '{' eat_blanks_after_open_brace = true # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = true # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = add # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = add # ignore/add/remove/force # Add or remove braces on single-line function defintions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = add # ignore/add/remove/force # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = add # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = add # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = true # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = true # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = true # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # If false, disable all multi-line comment changes, including cmt_width and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = true # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitue $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceeded with a C/C++ comment. # Will substitue $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceeded with a C/C++ comment. # Will substitue $(class) with the class name. cmt_insert_class_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = force # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ uncrustify-0.59/tests/config/oc-split.cfg0000644000175000017500000000003511506773274015437 00000000000000align_oc_msg_colon_span = 1 uncrustify-0.59/tests/config/pp-indent-3.cfg0000644000175000017500000000021411574765451015745 00000000000000# # Remove all PP spacing and indent # pp_indent = add pp_space = remove # Gives the format # |#ifdef SOMETHING # | #define X # |#endif uncrustify-0.59/tests/config/bool-pos-eol.cfg0000644000175000017500000000053311574765276016227 00000000000000# # moves boolean ops to the end of line # indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size pos_bool = Trail pos_comma = Trail pos_class_comma = trail sp_after_comma = force align_right_cmt_span = 2 uncrustify-0.59/tests/config/cu.cfg0000644000175000017500000000727011506773274014324 00000000000000# # minuses: # do not place NL after if () # # bad split if(long-condition) to multiple lines # # # input_tab_size = 2 # original tab size indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs indent_columns = 2 indent_align_string = true indent_braces = false indent_namespace = true indent_class = true indent_class_colon = true indent_func_call_param = true indent_func_def_param = true indent_func_proto_param = true indent_func_class_param = true indent_func_ctor_var_param = true indent_template_param = true indent_member = 0 indent_switch_case = 2 indent_access_spec = -2 indent_paren_nl = false indent_paren_close = 1 indent_comma_paren = true ## ## inter-character spacing options ## sp_arith = add sp_assign = add sp_enum_assign = add sp_bool = add sp_compare = add sp_inside_paren = remove sp_balance_nested_parens = false sp_before_ptr_star = remove sp_before_unnamed_ptr_star = remove sp_between_ptr_star = remove sp_after_ptr_star = add sp_before_byref = remove sp_before_unnamed_byref = ignore sp_after_byref = add sp_after_type = add sp_template_angle = remove sp_before_angle = remove sp_inside_angle = remove sp_after_angle = remove sp_angle_paren = remove sp_angle_word = add sp_before_sparen = add sp_inside_sparen = remove sp_after_sparen = remove sp_before_square = remove sp_before_squares = remove sp_inside_square = remove sp_after_comma = add sp_before_comma = remove sp_after_class_colon = add sp_before_class_colon = add sp_after_operator = remove sp_after_operator_sym = remove sp_after_cast = add sp_inside_paren_cast = remove sp_sizeof_paren = remove sp_inside_braces_enum = remove sp_inside_braces_struct = remove sp_inside_braces = remove sp_inside_braces_empty = add sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = remove sp_inside_fparen = remove sp_square_fparen = remove sp_func_call_paren = remove sp_func_class_paren = remove sp_return_paren = add sp_attribute_paren = add sp_defined_paren = add sp_before_dc = remove sp_after_dc = remove sp_not = remove sp_inv = remove sp_addr = remove sp_member = remove sp_deref = remove sp_sign = remove sp_incdec = remove ## ## Aligning stuff ## align_with_tabs = false align_on_tabstop = true align_keep_tabs = true align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true #align_same_func_call_params = true align_var_def_span = 0 #align_var_def_star_style = 0 #align_var_def_amp_style = 0 # # New Line # nl_collapse_empty_body = false nl_func_leave_one_liners = false nl_if_leave_one_liners = false nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = add nl_else_brace = add nl_else_if = add nl_try_brace = add nl_for_brace = add nl_catch_brace = add nl_brace_catch = add nl_while_brace = add nl_do_brace = add nl_brace_while = add nl_switch_brace = add #nl_multi_line_cond = true nl_before_case = true nl_before_throw = add nl_after_case = true nl_namespace_brace = add nl_template_class = add nl_class_brace = add nl_class_init_args = ignore nl_func_type_name = add nl_func_proto_type_name = add nl_func_paren = remove #nl_func_decl_start nl_fdef_brace = add nl_after_semicolon = true nl_after_vbrace_open = true nl_create_if_one_liner = false nl_create_for_one_liner = false nl_create_while_one_liner = false nl_after_access_spec = 1 # # # code_width = 78 ls_for_split_full = true ls_func_split_full = true nl_after_access_spec = 1 eat_blanks_after_open_brace = true # # Code modifying options (non-whitespace) # mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = add mod_full_brace_if = add mod_full_brace_while = add mod_paren_on_return = remove mod_remove_extra_semicolon = true uncrustify-0.59/tests/config/sp_before_ellipsis-r.cfg0000644000175000017500000000017711506773274020023 00000000000000 sp_before_ellipsis = remove sp_inside_paren = force sp_inside_fparen = force sp_inside_sparen = force sp_after_comma = force uncrustify-0.59/tests/config/indent_braces_no.cfg0000644000175000017500000000743211506773274017211 00000000000000indent_align_string=false indent_braces=true indent_braces_no_func=true indent_braces_no_class=true indent_braces_no_struct=true indent_brace_parent=false indent_namespace=false indent_extern=false indent_class=true indent_class_colon=false indent_else_if=false indent_func_call_param=false indent_func_def_param=false indent_func_proto_param=false indent_func_class_param=false indent_func_ctor_var_param=false indent_template_param=false indent_func_param_double=false indent_relative_single_line_comments=false indent_col1_comment=false indent_access_spec_body=false indent_paren_nl=false indent_comma_paren=false indent_bool_paren=false indent_square_nl=false indent_preserve_sql=false indent_align_assign=true sp_balance_nested_parens=false align_keep_tabs=false align_with_tabs=false align_on_tabstop=false align_number_left=false align_func_params=false align_same_func_call_params=false align_var_def_colon=false align_var_def_attribute=false align_var_def_inline=false align_right_cmt_mix=false align_on_operator=false align_mix_var_proto=false align_single_line_func=true align_single_line_brace=true align_nl_cont=false align_left_shift=true nl_collapse_empty_body=false nl_assign_leave_one_liners=true nl_class_leave_one_liners=true nl_enum_leave_one_liners=false nl_getset_leave_one_liners=false nl_func_leave_one_liners=true nl_if_leave_one_liners=true nl_multi_line_cond=false nl_multi_line_define=false nl_before_case=false nl_after_case=false nl_after_return=false nl_after_semicolon=false nl_after_brace_open=false nl_after_brace_open_cmt=false nl_after_vbrace_open=false nl_after_brace_close=false nl_define_macro=false nl_squeeze_ifdef=false nl_ds_struct_enum_cmt=false nl_ds_struct_enum_close_brace=false nl_create_if_one_liner=true nl_create_for_one_liner=false nl_create_while_one_liner=false ls_for_split_full=true ls_func_split_full=true nl_after_multiline_comment=false eat_blanks_after_open_brace=false eat_blanks_before_close_brace=false mod_pawn_semicolon=false mod_full_paren_if_bool=false mod_remove_extra_semicolon=true mod_sort_import=false mod_sort_using=false mod_sort_include=false mod_move_case_break=false mod_remove_empty_return=false cmt_indent_multi=false cmt_c_group=false cmt_c_nl_start=false cmt_c_nl_end=false cmt_cpp_group=false cmt_cpp_nl_start=false cmt_cpp_nl_end=false cmt_cpp_to_c=false cmt_star_cont=false cmt_multi_check_last=true cmt_insert_before_preproc=false pp_indent_at_level=false pp_region_indent_code=false pp_if_indent_code=false pp_define_at_level=false indent_columns=2 align_var_def_span=1 align_typedef_span=1 align_single_line_brace_gap=1 nl_end_of_file_min=1 code_width=120 nl_max=2 indent_with_tabs=0 sp_arith=add sp_assign=add sp_enum_assign=add sp_bool=add sp_compare=add sp_inside_paren=remove sp_paren_paren=remove sp_before_byref=remove sp_after_byref=add sp_template_angle=ignore sp_inside_angle=remove sp_angle_paren=ignore sp_angle_word=add sp_before_sparen=add sp_inside_sparen=remove sp_inside_sparen_close=remove sp_before_semi=remove sp_before_semi_for=remove sp_before_square=remove sp_before_squares=remove sp_inside_square=remove sp_after_comma=add sp_before_comma=remove sp_after_class_colon=add sp_before_class_colon=add sp_after_operator=add sp_after_cast=add sp_inside_paren_cast=remove sp_cpp_cast_paren=remove sp_sizeof_paren=remove sp_inside_braces_empty=remove sp_func_proto_paren=remove sp_func_def_paren=remove sp_inside_fparens=remove sp_inside_fparen=remove sp_return_paren=add sp_before_dc=remove sp_after_dc=remove sp_member=remove sp_sign=remove nl_start_of_file=remove nl_end_of_file=force nl_fcall_brace=add nl_if_brace=add nl_brace_else=add nl_elseif_brace=add nl_else_brace=add nl_try_brace=add nl_for_brace=add nl_catch_brace=add nl_brace_catch=add nl_while_brace=add nl_do_brace=add nl_brace_while=add nl_switch_brace=add nl_before_throw=add nl_fdef_brace=add uncrustify-0.59/tests/config/star_pos-1.cfg0000644000175000017500000000106611506773274015702 00000000000000# # Places the byref as follows: "int &foo" # # $Id: byref-left.cfg 803 2007-07-25 00:36:25Z bengardner $ # indent_columns = 3 align_typedef_span = 2 align_typedef_gap = 3 align_typedef_star_style = 1 align_typedef_amp_style = 1 align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_amp_style = 1 align_var_struct_span = 2 align_func_proto_span = 2 sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = force sp_after_byref = remove uncrustify-0.59/tests/config/byref-center.cfg0000644000175000017500000000021511574765316016275 00000000000000# # Places the byref as follows: "int & foo" # indent_columns = 3 sp_before_byref = force sp_after_byref = force indent_class = True uncrustify-0.59/tests/config/long_namespace.cfg0000644000175000017500000000007311506773274016662 00000000000000indent_namespace = true indent_namespace_limit = 6 uncrustify-0.59/tests/config/obj-c.cfg0000644000175000017500000001734411630461250014674 00000000000000newlines = auto input_tab_size = 8 output_tab_size = 3 string_escape_char = 92 indent_columns = 3 indent_with_tabs = 0 indent_align_string = false indent_xml_string = 0 indent_brace = 0 indent_braces = false indent_braces_no_func = false indent_brace_parent = false indent_namespace = false indent_class = true indent_class_colon = false indent_func_call_param = false indent_member = 3 indent_sing_line_comments = 0 indent_switch_case = 0 indent_case_brace = 0 indent_col1_comment = false indent_label = 2 indent_access_spec = 2 indent_paren_nl = false indent_square_nl = false sp_arith = force sp_assign = force sp_bool = force sp_compare = force sp_inside_paren = remove sp_paren_paren = remove sp_balance_nested_parens = false sp_paren_brace = ignore sp_before_ptr_star = force sp_between_ptr_star = remove sp_after_ptr_star = remove sp_before_byref = remove sp_after_byref = ignore sp_before_angle = remove sp_after_angle = force sp_angle_paren = remove sp_angle_word = force sp_before_sparen = force sp_inside_sparen = remove sp_after_sparen = force sp_sparen_brace = ignore sp_special_semi = ignore sp_before_semi = remove sp_before_semi_for = ignore sp_before_square = ignore sp_before_squares = ignore sp_inside_square = remove sp_after_comma = force sp_before_comma = remove sp_after_operator = ignore sp_after_cast = remove sp_sizeof_paren = remove sp_after_tag = ignore sp_inside_braces_enum = force sp_inside_braces_struct = force sp_inside_braces = force sp_inside_angle = remove sp_type_func = ignore sp_func_proto_paren = remove sp_func_def_paren = remove sp_inside_fparens = ignore sp_inside_fparen = remove sp_square_fparen = ignore sp_fparen_brace = ignore sp_func_call_paren = remove sp_func_class_paren = ignore sp_return_paren = remove sp_macro = ignore sp_before_semi_for_empty = force sp_before_oc_colon = remove sp_after_oc_colon = force sp_after_oc_scope = remove sp_after_oc_type = force align_oc_msg_colon_span = 1 # align parameters in an Obj-C message on the ':' but stop after this many lines (0=don't align) align_oc_msg_spec_span = 2 # the span for aligning ObjC msg spec (0=don't align) sp_macro_func = ignore sp_else_brace = ignore sp_brace_else = ignore sp_catch_brace = ignore sp_brace_catch = ignore sp_finally_brace = ignore sp_brace_finally = ignore sp_try_brace = ignore sp_getset_brace = ignore align_keep_tabs = false align_with_tabs = false align_on_tabstop = false align_number_left = true align_func_params = true align_var_def_span = 2 align_var_def_star_style = 1 align_var_def_thresh = 0 align_var_def_colon = true align_var_def_inline = true align_assign_span = 1 align_assign_thresh = 0 align_enum_equ_span = 4 align_enum_equ_thresh = 0 align_var_struct_span = 3 align_struct_init_span = 3 align_typedef_gap = 3 align_typedef_span = 5 align_typedef_star_style = 0 align_right_cmt_span = 3 align_func_proto_span = 0 align_nl_cont = true align_pp_define_gap = 4 align_pp_define_span = 3 code_width = 0 nl_collapse_empty_body = false nl_class_leave_one_liners = true nl_assign_leave_one_liners = true nl_start_of_file = ignore nl_start_of_file_min = 0 nl_end_of_file = ignore nl_end_of_file_min = 0 nl_assign_brace = add nl_func_var_def_blk = 1 nl_fcall_brace = add nl_enum_brace = add nl_struct_brace = add nl_union_brace = add nl_if_brace = add nl_brace_else = add nl_elseif_brace = ignore nl_else_brace = add nl_brace_finally = ignore nl_finally_brace = add nl_try_brace = add nl_getset_brace = ignore nl_for_brace = add nl_catch_brace = add nl_brace_catch = ignore nl_while_brace = add nl_do_brace = add nl_brace_while = remove nl_switch_brace = add nl_before_case = true nl_after_case = false nl_namespace_brace = ignore nl_template_class = ignore nl_class_brace = ignore nl_class_init_args = ignore nl_func_type_name = ignore nl_func_decl_start = ignore nl_func_decl_args = ignore nl_func_decl_end = ignore nl_fdef_brace = add nl_after_return = true nl_after_semicolon = true nl_after_brace_open = true nl_after_vbrace_open = true nl_after_access_spec = 1 nl_assign_leave_one_liners = true nl_class_leave_one_liners = true nl_enum_leave_one_liners = true nl_getset_leave_one_liners = true nl_define_macro = false nl_squeeze_ifdef = true nl_before_if = ignore nl_after_if = ignore nl_before_for = ignore nl_after_for = ignore nl_before_while = ignore nl_after_while = ignore nl_before_switch = ignore nl_after_switch = ignore nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false pos_bool = ignore pos_class_colon = ignore ls_for_split_full = false ls_func_split_full = false nl_max = 0 nl_after_func_proto = 0 nl_after_func_proto_group = 0 nl_after_func_body = 0 nl_after_func_body_one_liner = 0 nl_before_block_comment = 0 nl_before_c_comment = 0 nl_before_cpp_comment = 0 eat_blanks_after_open_brace = true eat_blanks_before_close_brace = true mod_full_brace_do = add mod_full_brace_for = add mod_full_brace_function = ignore mod_full_brace_if = add mod_full_brace_nl = 0 mod_full_brace_while = add mod_paren_on_return = add mod_pawn_semicolon = false mod_full_paren_if_bool = false cmt_cpp_group = false cmt_cpp_nl_start = false cmt_cpp_nl_end = false cmt_cpp_to_c = false cmt_star_cont = true cmt_sp_before_star_cont = 0 cmt_sp_after_star_cont = 0 pp_indent = remove pp_space = remove sp_after_dc = remove sp_before_dc = remove sp_attribute_paren = remove sp_after_send_oc_colon = force uncrustify-0.59/tests/ecma.test0000644000175000017500000000022311574756661013572 00000000000000# # Test cases specifically for the ECMA language. # # Range: 90000 - 99999 # test.name config.file input.file 90000 ben.cfg ecma/example-1.es uncrustify-0.59/tests/c.test0000644000175000017500000002152311632275646013107 00000000000000# # Test cases specifically for the C language. # # Range: 00000 - 09999 # test.name config.file input.file # little general tests 00000 indent.cfg c/comment-indent.c 00001 cpp_to_c-1.cfg c/comment-indent.c 00002 cpp_to_c-2.cfg c/comment-indent.c 00003 cpp_to_c-3.cfg c/comment-indent.c 00004 indent-1.cfg c/switch.c 00005 ben.cfg c/cmt-align.c 00006 indent.cfg c/comment-convert.c 00007 cpp_to_c-1.cfg c/comment-convert.c 00008 cpp_to_c-2.cfg c/comment-convert.c 00009 cpp_to_c-3.cfg c/comment-convert.c # brace styles 00010 ben.cfg c/braces.c 00011 brace-allman.cfg c/braces.c 00012 brace-banner.cfg c/braces.c 00013 brace-gnu.cfg c/braces.c 00014 brace-kr.cfg c/braces.c 00015 brace-ws.cfg c/braces.c 00016 brace-ws2.cfg c/braces.c 00020 ben.cfg c/define-if-indent.c 00050 brace-remove-2.cfg c/brace-remove.c 00051 brace-remove-all.cfg c/brace-remove.c 00052 brace-remove-all.cfg c/brace-remove2.c 00053 nl_brace_test.cfg c/brace.c 00054 if_chain.cfg c/if_chain.c 00055 cgal.cfg c/braces-2.c 00060 ben.cfg c/braces-2.c 00061 ben.cfg c/braces-3.c 00062 ben.cfg c/braces-4.c 00065 ben.cfg c/braces-5.c 00066 ben.cfg c/vb-while.c 00067 ben.cfg c/vb-do.c 00068 ben.cfg c/bsnl.c 00069 ben.cfg c/vb-pp.c 00070 ben.cfg c/return-multi.c 00071 ben.cfg c/include_define.h 00072 star_pos-0.cfg c/align-proto.c 00073 ben.cfg c/nl_proto_endif.c 00081 else-if-1.cfg c/else-if.c 00082 else-if-2.cfg c/else-if.c 00091 cond-1.cfg c/cond.c 00092 cond-2.cfg c/cond.c 00101 ben.cfg c/bugs-1.c 00102 ben.cfg c/bugs-2.c 00103 ben.cfg c/bugs-3.c 00104 ben.cfg c/bugs-4.c 00105 ben.cfg c/bugs-5.c 00106 ben.cfg c/bugs-6.c 00107 ben.cfg c/bugs-7.c 00108 ben.cfg c/bugs-8.c 00110 ben.cfg c/misc.c 00111 brace-kr-br.cfg c/misc.c 00120 sp_cmt_cpp_start_remove.cfg c/sp_cmt_cpp_start.c 00121 sp_cmt_cpp_start_add.cfg c/sp_cmt_cpp_start.c 00122 sp_cmt_cpp_start_force.cfg c/sp_cmt_cpp_start.c 00130 ben.cfg c/minus-minus.c 00135 nepenthes.cfg c/br_cmt.c 00140 ben.cfg c/global-vars.c 00141 ben.cfg c/deref.c 00142 ben.cfg c/type-cast.c 00143 ben.cfg c/t3.in.c 00144 ben.cfg c/align-proto-vars.c # casts 00150 ben.cfg c/casts.c 00151 cast-sp-r.cfg c/casts.c 00152 cast-sp-a.cfg c/casts.c 00153 cast-type.cfg c/casts.c 00154 sp_after_cast.cfg c/casts.c 00155 ben.cfg c/cast_brace.c # fcn indents 00160 indent_func_param.cfg c/fcn_indent.c 00161 indent_func_call_param.cfg c/fcn_indent.c 00162 indent_func_def_param.cfg c/fcn_indent.c 00163 indent_func_proto_param.cfg c/fcn_indent.c 00170 empty.cfg c/beautifier-off.c # switch & case stuff 00201 case-1.cfg c/case.c 00202 case-2.cfg c/case.c 00203 case-3.cfg c/case.c # structure initializers 00301 ben.cfg c/align-struct-init.c 00302 ben.cfg c/one-liner-init.c 00303 1liner-split.cfg c/one-liner-init.c 00304 1liner-no-split.cfg c/one-liner-init.c 00310 empty.cfg c/sp_embed_comment.c 00320 rdan.cfg c/indent_first_bool_expr.c # aligning tresholds 00401 align-1.cfg c/align-equ.c 00402 align-1.cfg c/align-var.c 00403 align-2.cfg c/align-var.c 00404 align-3.cfg c/align-var.c 00405 align-3.cfg c/bits.c 00411 ben.cfg c/align-typedef.c 00412 align_typedef_func-0.cfg c/align-typedef.c 00413 align_typedef_func-1.cfg c/align-typedef.c 00414 align_typedef_func-2.cfg c/align-typedef.c 00421 nl_ds_struct_enum-1.cfg c/nl_ds_struct_enum.c 00422 nl_ds_struct_enum-2.cfg c/nl_ds_struct_enum.c 00430 indent_paren_close-0.cfg c/paren-indent.c 00431 indent_paren_close-1.cfg c/paren-indent.c 00432 indent_paren_close-2.cfg c/paren-indent.c # boolean and comma positioning 00501 bool-pos-eol.cfg c/bool-pos.c 00502 bool-pos-sol.cfg c/bool-pos.c 00503 pos_compare-sol.cfg c/pos_compare.c 00504 pos_compare-eol.cfg c/pos_compare.c 00505 pos_conditional-sol.cfg c/pos_conditional.c 00506 pos_conditional-eol.cfg c/pos_conditional.c 00510 bool-pos-eol-break.cfg c/bool-pos.c 00511 bool-pos-sol-break.cfg c/bool-pos.c 00512 bool-pos-eol-force.cfg c/bool-pos.c 00513 bool-pos-sol-force.cfg c/bool-pos.c 00600 indent.cfg c/dos.c 00601 indent.cfg c/mac.c 00611 pp-indent-1.cfg c/pp-space.c 00612 pp-indent-2.cfg c/pp-space.c 00613 pp-indent-3.cfg c/pp-space.c 00614 pp-space.cfg c/pp-space.c 00615 pp-indent-2.cfg c/pp-nest.c 00620 ben.cfg c/indent-assign.c 00621 nl_endif.cfg c/nl_endif.c 00631 nl_assign1.cfg c/nl_assign.c 00632 nl_assign2.cfg c/nl_assign.c # function def newlines 00701 func-def-1.cfg c/function-def.c 00702 func-def-2.cfg c/function-def.c 00703 func-def-3.cfg c/function-def.c 00710 add_long_closebrace_comment_1.cfg c/add_long_comment.c # nl_after_semicolon and nl_after_open_brace 00721 nl_semicolon.cfg c/nl-semicolon.c # function types 00801 ben.cfg c/fcn_type.c 00802 ben.cfg c/funcfunc.c # code width 00901 width.cfg c/code_width.c 00902 width-2.cfg c/code_width.c 00903 width-3.cfg c/code_width.c # pascal ptr_type 00910 pascal_ptr.cfg c/pascal_ptr.c 00911 empty_body.cfg c/pascal_ptr.c 01000 mod-paren.cfg c/mod-paren.c 01001 nl-comment.cfg c/nl-comment.c 01002 mod-paren2.cfg c/mod-paren.c 01005 mod_case_brace_add.cfg c/mod_case_brace.c 01006 mod_case_brace_rm.cfg c/mod_case_brace.c 01007 mod_move_case_brace.cfg c/mod_case_brace.c 01011 del_semicolon.cfg c/semicolons.c 01012 ben.cfg c/semicolons.c 01015 empty.cfg c/paren_indent.c 01016 align_attr.cfg c/align_attr.c 01020 kw_subst.cfg c/kw_subst.c 01021 kw_subst3.cfg c/hello.c 01022 kw_subst3.cfg c/kw_subst.c 01030 multi.cfg c/multi.h 01035 func_wrap1.cfg c/func_wrap.c 01036 func_wrap2.cfg c/func_wrap.c 01037 type_wrap.cfg c/type_wrap.c 01040 newline_after_endif.cfg c/newline_after_endif.c 01050 func_call_user.cfg c/func_call_user.c # big general tests 02000 ben.cfg c/i2c-core.c 02001 preproc-cleanup.cfg c/directfb.h 02002 ben2.cfg c/i2c-core.c # clark's style - blank lines before and after flow control, indented comments 02100 clark.cfg c/i2c-core.c 02101 clark.cfg c/comment-indent.c 02102 clark.cfg c/indent.cpp 02103 clark.cfg c/output.cpp 02200 xml-str.cfg c/xml.c 02201 xml-str.cfg c/align-string.c 02300 ben.cfg c/preproc-if.c 02301 d.cfg c/preproc-if.c 02302 cpp_to_c-1.cfg c/nl-cont.c 02303 cpp_to_c-1.cfg c/nl-cont2.c 02310 ben.cfg c/empty-for.c 02311 ben.cfg c/pragma.c 02315 pp_ret.cfg c/pp_ret.c 02320 nl_create_one_liner.cfg c/nl_create_one_liner.c 02325 sort_imports.cfg c/sort_include.c # some embedded sql stuff 02400 ben.cfg sql/mysql.sqc 02401 ben.cfg sql/sta-select.sqc 02410 pp_if_indent-0.cfg c/ifdef-indent.c 02411 pp_if_indent-1.cfg c/ifdef-indent.c 02412 pp_if_indent-2.cfg c/ifdef-indent.c 02413 pp_if_indent-3.cfg c/ifdef-indent.c 02415 endif.cfg c/endif.c 02416 cmt_nl_end.cfg c/cmt_nl_end.c 02421 cmt_multi-1.cfg c/cmt_multi.c 02422 cmt_multi-2.cfg c/cmt_multi.c 02431 align_right_cmt_gap-1.cfg c/cmt_right_align.c 02432 align_right_cmt_gap-2.cfg c/cmt_right_align.c 02451 return-1.cfg c/nl_return_expr.c 02452 return-2.cfg c/nl_return_expr.c 02453 return-3.cfg c/nl_return_expr.c 02454 return-4.cfg c/nl_return_expr.c 02460 freebsd.cfg c/freebsd.c 02501 ger.cfg c/custom_types_ssl.c 02502 custom_types_ssl.cfg c/custom_types_ssl.c 02503 ger.cfg c/pp_concat_asn1.h uncrustify-0.59/tests/d.test0000644000175000017500000000222011574756661013107 00000000000000# # Test cases specifically for the D language. # # Range: 40000 - 49999 # test.name config.file input.file output.file 40000 d.cfg d/HashMap.d 40001 d.cfg d/imports.d 40002 d.cfg d/volatile.d 40003 d.cfg d/volatile-1.d 40004 d.cfg d/volatile-2.d 40005 d.cfg d/volatile-3.d 40006 d.cfg d/Lexer.d 40007 d2.cfg d/Lexer.d 40010 d.cfg d/template.d 40020 d.cfg d/funcfunc.d 40021 d.cfg d/tst01.d 40022 d-tst2.cfg d/tst02.d 40023 d.cfg d/bug-indent.d 40024 d3.cfg d/tst03.d 40025 d3a.cfg d/tst03.d 40030 d.cfg d/delegate.d 40035 d.cfg d/enum.d 40040 sort_imports.cfg d/sort_import.d 40050 d.cfg d/strings.d 40051 d.cfg d/numbers.d 40052 d2.cfg d/numbers.d 40060 d.cfg d/casts.d 40061 d.cfg d/const.d 40070 d_sp_paren.cfg d/d_sp_paren.d uncrustify-0.59/tests/objective-c.test0000644000175000017500000000400311574756661015057 00000000000000# # Test cases specifically for the Objective C language. # # Range: 50000 - 59999 # test.name config.file input.file # The .h file needs a language override 50001 obj-c.cfg oc/Fraction.h OC 50002 obj-c.cfg oc/Fraction.m OC 50003 obj-c.cfg oc/main.m 50004 obj-c.cfg oc/string.m 50005 obj-c.cfg oc/Declarations.h OC 50006 obj-c.cfg oc/exceptions.m 50007 obj-c.cfg oc/misc.m 50008 obj-c.cfg oc/protocol.m 50010 sp_after_oc_return_type_add.cfg oc/return_type.m 50011 sp_after_oc_return_type_force.cfg oc/return_type.m 50012 sp_after_oc_return_type_remove.cfg oc/return_type.m 50020 sp_after_oc_at_sel_add.cfg oc/selector.m 50021 sp_after_oc_at_sel_force.cfg oc/selector.m 50022 sp_after_oc_at_sel_remove.cfg oc/selector.m 50030 sort_imports.cfg oc/sort_import.m 50040 objc_complex_method.cfg oc/complex_method.m 50050 objc_complex_method.cfg oc/real_world_file.m 50060 oc-split.cfg oc/oc-split.m 50070 sp_before_oc_block_caret_add.cfg oc/blocks.m 50071 sp_before_oc_block_caret_force.cfg oc/blocks.m 50072 sp_before_oc_block_caret_remove.cfg oc/blocks.m 50073 sp_after_oc_block_caret_add.cfg oc/blocks.m 50074 sp_after_oc_block_caret_force.cfg oc/blocks.m 50075 sp_after_oc_block_caret_remove.cfg oc/blocks.m 50076 sp_before_after_oc_block_caret_remove.cfg oc/blocks.m 50077 sp_before_oc_block_caret_add.cfg oc/more_blocks.m 50078 sp_before_oc_block_caret_force.cfg oc/more_blocks.m 50079 sp_before_oc_block_caret_remove.cfg oc/more_blocks.m 50080 sp_after_oc_block_caret_add.cfg oc/more_blocks.m 50081 sp_after_oc_block_caret_force.cfg oc/more_blocks.m 50082 sp_after_oc_block_caret_remove.cfg oc/more_blocks.m 50083 sp_before_after_oc_block_caret_remove.cfg oc/more_blocks.m 50090 obj-c.cfg oc/kw.m uncrustify-0.59/tests/java.test0000644000175000017500000000024211574757101013575 00000000000000# # Test cases specifically for the Java language. # # Range: 80000 - 89999 # test.name config.file input.file 80000 ben.cfg java/assert.java uncrustify-0.59/tests/fixtest.sh0000755000175000017500000000206111506773274014005 00000000000000#! /bin/sh # $Id: difftest.sh 798 2007-07-24 16:01:09Z bengardner $ # # Copies the files for a test from results/ to output/ # if [ -z "$1" ] ; then fn=$(basename $0) echo "Usage: $fn TEST [...]" echo echo " TEST : the test number pattern, may contain wildcards" echo " You can put multiple test numbers on the command line" echo echo "The script will find all matching tests in the results folder and copy them" echo "into the output folder." echo echo "Examples:" echo "$fn 30014 # copy test 30014" echo "$fn 30014 00110 # copy tests 30014 and 00110" echo "$fn '*' # copy all tests" exit 1 fi while [ -n "$1" ] ; do # Use '*' as the pattern if one wasn't defined patt=$1 path="results" # Find the tests that match, remove the .svn folders files=$(find $path -name "$patt-*" -type f | sed "/\.svn/d") did1='' for t in $files ; do other=$(echo $t | sed "s/^results/output/") echo "cp $t $other" cp $t $other done shift 1 done uncrustify-0.59/tests/pawn.test0000644000175000017500000000105211574756661013633 00000000000000# # Test cases specifically for the Pawn language. # # Range: 60000 - 69999 # test.name config.file input.file 60000 pawn.cfg pawn/functions.pawn 60001 pawn.cfg pawn/comment.p 60002 pawn.cfg pawn/traffic.p 60003 pawn.cfg pawn/tags.pawn 60004 pawn.cfg pawn/enum.pawn 60005 pawn.cfg pawn/unbraced.p 60010 pawn-escape.cfg pawn/str-escape.p 60020 pawn-escape.cfg pawn/switch-vsemi.sma 60030 amxmodx.cfg pawn/crusty_ex-1.sma uncrustify-0.59/tests/cpp.test0000644000175000017500000001646511631561151013444 00000000000000# # Test cases specifically for the C++ language. # # Range: 30000 - 39999 # test.name config.file input.file 30000 ben.cfg cpp/cout.cpp #30001 ben.cfg cpp/alt_tokens.cpp 30002 ben.cfg cpp/constructor.cpp 30003 ben.cfg cpp/strings.cpp 30010 ben.cfg cpp/class.h 30011 ben.cfg cpp/misc.cpp 30012 avalon2.cfg cpp/misc2.cpp 30013 sim.cfg cpp/sim.h 30014 ben.cfg cpp/ctor-var.cpp 30015 ben.cfg cpp/exception.cpp 30016 custom-open.cfg cpp/custom-open.cpp 30017 custom-open2.cfg cpp/custom-open.cpp 30018 ben.cfg cpp/class-addr.h 30019 ben.cfg cpp/wacky-template.cpp 30020 ben.cfg cpp/bool.cpp 30021 ben.cfg cpp/byref.cpp 30022 ben.cfg cpp/extern_c.h 30023 ben.cfg cpp/templates.cpp 30024 class-nl_func-add.cfg cpp/class-init.cpp 30025 class-nl_func-del.cfg cpp/class-init.cpp 30026 byref-left.cfg cpp/byref.cpp 30027 byref-right.cfg cpp/byref.cpp 30028 byref-center.cfg cpp/byref.cpp 30029 ben.cfg cpp/init_align.h 30030 avalon.cfg cpp/Timestamp.h 30031 avalon.cfg cpp/operator.cpp 30032 op-space-force.cfg cpp/operator.cpp 30033 op-space-remove.cfg cpp/operator.cpp 30034 op-space-force.cfg cpp/operator_proto.cpp 30035 op-space-remove.cfg cpp/operator_proto.cpp 30040 nl_class-r.cfg cpp/nl-class.h 30041 nl_class-a.cfg cpp/nl-class.h 30045 nl_func_decl_1.cfg cpp/nl_func_decl.cpp 30046 nl_func_decl_2.cfg cpp/nl_func_decl.cpp 30050 nl_namespace-r.cfg cpp/nl-namespace.h 30051 nl_namespace-a.cfg cpp/nl-namespace.h 30052 nl_try-a.cfg cpp/try-catch-nl.cpp 30055 nl_after_func_body.cfg cpp/nl_func.cpp 30056 nl_after_func_body-2.cfg cpp/nl_func.cpp # Class colon positioning 30061 class-colon-pos-eol.cfg cpp/class-init.cpp 30062 class-colon-pos-sol.cfg cpp/class-init.cpp 30063 class-colon-pos-eol-add.cfg cpp/class-init.cpp 30064 class-colon-pos-sol-add.cfg cpp/class-init.cpp 30065 class-colon-pos-sol.cfg cpp/Example.h 30070 nl_func_scope_name.cfg cpp/nl_func_scope_name.cpp 30075 empty.cfg cpp/goto.cpp 30080 nl_brace_brace-a.cfg cpp/nl_brace_brace.cpp 30085 nSolve.cfg cpp/align_class.cpp 30100 nl_template_class-force.cfg cpp/templates.cpp 30101 nl_template_class-remove.cfg cpp/templates.cpp 30102 template_sp-force.cfg cpp/templates.cpp 30103 template_sp-remove.cfg cpp/templates.cpp 30104 avalon3.cfg cpp/templ_class.h 30105 avalon4.cfg cpp/av.h 30106 nl_template_class-force.cfg cpp/templates2.cpp 30107 nl_template_class-remove.cfg cpp/templates2.cpp 30108 nl_template_class-remove.cfg cpp/templates3.cpp 30109 template4.cfg cpp/templates4.cpp 30201 cmt_indent-1.cfg cpp/cmt_indent.cpp 30202 cmt_indent-2.cfg cpp/cmt_indent.cpp 30203 cmt_indent-3.cfg cpp/cmt_indent.cpp 30204 comment-align.cfg cpp/comment-align.cpp 30205 cmt_right.cfg cpp/cmt_right.cpp 30250 align_fcall.cfg cpp/align_fcall.cpp 30251 align_fcall-2.cfg cpp/align_fcall.cpp 30253 align_left_shift.cfg cpp/align_left_shift.cpp 30255 ben.cfg cpp/align_constr.cpp 30260 var_def_gap.cfg cpp/var_def_gap.cpp 30270 const_throw.cfg cpp/const_throw.cpp 30271 sp_throw_paren-r.cfg cpp/sp_throw_paren.cpp 30272 sp_throw_paren-f.cfg cpp/sp_throw_paren.cpp # function def newlines 30701 func-def-1.cfg cpp/function-def.cpp 30702 func-def-2.cfg cpp/function-def.cpp 30703 func-def-3.cfg cpp/function-def.cpp 30705 func_param.cfg cpp/func_param.cpp 30711 del_semicolon.cfg cpp/semicolons.cpp 30720 wessex.cfg cpp/custom-open-2.cpp 30730 ben.cfg cpp/qt-1.cpp 30731 nl_access_spec.cfg cpp/qt-1.cpp 30740 sef.cfg cpp/sef.cpp 30741 al.cfg cpp/al.cpp 30742 delete.cfg cpp/delete.cpp 30800 star_pos-0.cfg cpp/align-star-amp-pos.cpp 30801 star_pos-1.cfg cpp/align-star-amp-pos.cpp 30802 star_pos-2.cfg cpp/align-star-amp-pos.cpp 30805 ptr_star-1.cfg cpp/ptr-star.cpp 30806 ptr_star-2.cfg cpp/ptr-star.cpp 30807 ptr_star-3.cfg cpp/ptr-star.cpp 30810 ben.cfg cpp/ptr-star.cpp 30811 avalon4.cfg cpp/misc3.cpp 30812 ben.cfg cpp/misc4.cpp 30813 ben.cfg cpp/misc5.cpp 30814 misc6.cfg cpp/misc6.cpp 30815 width-2.cfg cpp/cmt-reflow.cpp 30816 cu.cfg cpp/for_long.cpp 30817 ben.cfg cpp/cmt-cpp-cont.cpp 30820 pp_define_at_level-1.cfg cpp/pp-define-indent.cpp 30830 kw_subst2.cfg cpp/kw_subst.cpp 30831 kw_subst.cfg cpp/kw_subst2.cpp 30840 nl_func_type_name_remove.cfg cpp/nl_func_type_name.cpp 30841 nl_func_type_name_force.cfg cpp/nl_func_type_name.cpp 30842 nl_func_type_name_class.cfg cpp/nl_func_type_name.cpp 30845 ben.cfg cpp/deref.cpp 30900 region-0.cfg cpp/region.cpp 30901 region-1.cfg cpp/region.cpp 30902 region-2.cfg cpp/region.cpp 30903 region-3.cfg cpp/region.cpp 30910 indent_namespace-t.cfg cpp/indent_namespace.h 30911 indent_namespace-f.cfg cpp/indent_namespace.h 30912 long_namespace.cfg cpp/long_namespace.cpp 30920 ben.cfg cpp/indent-off.cpp 30921 ben.cfg cpp/variadic-template.h 30922 sp_before_ellipsis-f.cfg cpp/variadic-template.h 30923 sp_before_ellipsis-f.cfg cpp/sp_before_ellipsis.cpp 30924 sp_before_ellipsis-r.cfg cpp/sp_before_ellipsis.cpp 30925 sp_func_call_empty.cfg cpp/function-def.cpp 30930 indent_var_def.cfg cpp/indent_var_def.cpp 30931 indent_var_def_cont.cfg cpp/indent_var_def_cont.cpp 30932 empty.cfg cpp/indent_var_def_cont.cpp 30935 ben.cfg cpp/indent-misc.cpp 30936 indent_braces_no.cfg cpp/indent_braces_no.h 30940 mod_case_brace_rm.cfg cpp/case-brace-remove.cpp 30950 sp_before_tr_emb_cmt-f.cfg cpp/sp_before_tr_emb_cmt_input.cpp 30951 sp_before_tr_emb_cmt-a.cfg cpp/sp_before_tr_emb_cmt_input.cpp 30955 indent_ctor_init.cfg cpp/indent_ctor_init.cpp uncrustify-0.59/tests/difftest.sh0000755000175000017500000000264611574765451014143 00000000000000#! /bin/sh # Shows the difference for a failed test # if [ -n "$1" ] ; then case "$1" in -h|--help|--usage) fn=$(basename $0) echo "Usage: $fn [TEST [LANG]]" echo echo " TEST : the test number pattern, may contain wildcards" echo " LANG : the language folder name: c, cpp, cs, d, java, oc, pawn, sql" echo echo "The script will find all matching tests in the output folder and diff them against the same" echo "file in the results folder. The language is only required if the same test number is used" echo "for multiple languages and you only want to see one of them." echo echo "Examples:" echo "$fn # show all test failures" echo "$fn 30014 # show test failure 30014" echo "$fn '*' cpp # show all CPP test failure" exit 1 ;; esac fi # Use '*' as the pattern if one wasn't defined patt=$1 if [ -z "$patt" ] ; then patt="*" fi path="output" if [ -n "$2" ] ; then path="$path/$2" fi # Find the tests that match, remove the .svn folders files=$(find $path -name "$patt-*" -type f | sed "/\.svn/d") did1='' for t in $files ; do other=$(echo $t | sed "s/^output/results/") diff -u $t $other if [ "$?" = "1" ] ; then did1='yup' fi done if [ -z "$did1" ] ; then echo "No differences" fi uncrustify-0.59/tests/vala.test0000644000175000017500000000032111574756661013607 00000000000000# # Test cases specifically for the Vala language. # # Range: 70000 - 79999 # test.name config.file input.file 70000 ben.cfg vala/list.vala 70001 ben.cfg vala/advanced.vala uncrustify-0.59/tests/c-sharp.test0000644000175000017500000000172011630510133014174 00000000000000# # Test cases specifically for the C# language. # # Range: 10000 - 19999 # test.name config.file input.file 10000 mono.cfg cs/simple.cs 10001 getset.cfg cs/getset.cs 10002 ben.cfg cs/simple.cs 10003 ben.cfg cs/region.cs 10010 ben.cfg cs/var-member.cs 10011 ben.cfg cs/strings.cs 10020 region-0.cfg cs/region.cs 10021 region-1.cfg cs/region.cs 10022 region-2.cfg cs/region.cs 10023 region-3.cfg cs/region.cs 10030 sort_imports.cfg cs/sort_using.cs 10040 tcf.cfg cs/tcf.cs 10041 tcf.cfg cs/gs.cs 10050 cs_generics.cfg cs/generics.cs 10060 ben.cfg cs/unsafe.cs 10070 ben.cfg cs/utf16le.cs 10071 ben.cfg cs/utf16be.cs 10072 ben.cfg cs/utf16le_no_bom.cs 10073 ben.cfg cs/utf16be_no_bom.cs uncrustify-0.59/tests/input/0000755000175000017500000000000011574757101013174 500000000000000uncrustify-0.59/tests/input/cs/0000755000175000017500000000000011630506404013570 500000000000000uncrustify-0.59/tests/input/cs/unsafe.cs0000644000175000017500000000014411506773274015334 00000000000000public class Class1 { public unsafe bool GetValue () { return true; } } uncrustify-0.59/tests/input/cs/getset.cs0000644000175000017500000000014311506773274015345 00000000000000public bool Enabled { get { return enabled; } } public bool Enabled { get { return enabled; } } uncrustify-0.59/tests/input/cs/tcf.cs0000644000175000017500000000023411506773274014627 00000000000000void foo() { try { ; } catch (Exception e) { ; } finally { ; } bar(); try { ; } catch (Exception e) { ; } catch (Exception e) { ; } finally { ; } bar(); } uncrustify-0.59/tests/input/cs/utf16be_no_bom.cs0000644000175000017500000000030611630506404016643 00000000000000public bool Enabled { get { return enabled; } } public bool Enabled { get { return enabled; } } uncrustify-0.59/tests/input/cs/simple.cs0000644000175000017500000000276411506773274015356 00000000000000class X : Y { bool Method (int argument_1, int argument_2) { #region something int foo = 0; #endregion if (argument_1 == argument_2) throw new Exception (Locale.GetText ("They are equal!")); if (argument_1 < argument_2) { if (argument_1 * 3 > 4) return true; else return false; } // // This sample helps keep your sanity while using 8-spaces for tabs // VeryLongIdentifierWhichTakesManyArguments ( Argument1, Argument2, Argument3, NestedCallHere ( MoreNested)); } bool MyProperty { get { return x; } set { x = value; } } void AnotherMethod () { Logger log = new Logger(); log.foo.bar = 5; log.narf.sweat = "cat"; if ((a + 5) != 4) { } while (blah) { if (a) continue; b++; } } } object lockA; object lockB; void Foo () { lock (lockA) { lock (lockB) { } } } void Bar () { lock (lockB) { lock (lockA) { } } } // class library class Blah { Hashtable ht; void Foo (int zzz, Entry blah) { lock (ht) { ht.Add (zzz, blah); } } void Bar () { lock (ht) { foreach (Entry e in ht) EachBar (e); } } virtual void EachBar (Entry e) { } } // User class MyBlah { byte[] box = new byte[6]; box[2] = 56; void DoStuff () { lock (this) { int i = GetNumber (); Entry e = GetEntry (); Foo (i, e); } } override void EachBar (Entry e) { lock (this) { DoSomething (e); } } } uncrustify-0.59/tests/input/cs/utf16le.cs0000644000175000017500000000031011630457175015331 00000000000000public bool Enabled { get { return enabled; } } public bool Enabled { get { return enabled; } } uncrustify-0.59/tests/input/cs/gs.cs0000644000175000017500000000030611506773274014464 00000000000000private string s = ""; public int Amount { get { ; } set { ; } } public EventHandler MyCustomEventHandler { add { ; } remove { ; } } public this[string index] { get; set; } private string s2 = ""; uncrustify-0.59/tests/input/cs/utf16le_no_bom.cs0000644000175000017500000000030611630506372016661 00000000000000public bool Enabled { get { return enabled; } } public bool Enabled { get { return enabled; } } uncrustify-0.59/tests/input/cs/utf16be.cs0000644000175000017500000000031011630457175015317 00000000000000public bool Enabled { get { return enabled; } } public bool Enabled { get { return enabled; } } uncrustify-0.59/tests/input/cs/var-member.cs0000644000175000017500000000134311506773274016112 00000000000000namespace Foo.Man.Chu { /// /// Summary description for MainForm. /// public class MainForm : System.Windows.Forms.Form { #region Initialize the private properties private System.Windows.Forms.MenuItem File; private System.Windows.Forms.MenuItem Exit; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private Properties Prop; private About Abt; public MainForm mainform; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.Timer timer1; private System.ComponentModel.IContainer components; protected string strTitle; #endregion } } uncrustify-0.59/tests/input/cs/region.cs0000644000175000017500000000034111506773274015335 00000000000000class X : Y { int foo1; #region something int foo2 = 2; #endregion int foo() { #region something else int foo3 = 3; #region nested int foo4 = 0; #endregion int foo5 = 0; #endregion } } uncrustify-0.59/tests/input/cs/generics.cs0000644000175000017500000000020111506773274015644 00000000000000 int foo() { a.b(); a.b>(); a.b < c, d > (); a.b < c, e < d > > (); a.b < c, e < d > > (); return default (T); } uncrustify-0.59/tests/input/cs/strings.cs0000644000175000017500000000021411506773274015542 00000000000000void foo() { string s1 = L"C:\\foo\\bar"; string s2 = S"C:\\foo\\bar"; string s3 = "This is a \"test\""; string s4 = "C:\\"; } uncrustify-0.59/tests/input/cs/sort_using.cs0000644000175000017500000000042411506773274016250 00000000000000// should be ddd, eee, fff using b.ddd; using b.fff; using b.eee; // should be aaa, ccc using ccc; using aaa; // should be just bbb using bbb; // should not change these, as it can't handle multi-line imports using mango.ccc; using mango.bbb, mango.aaa; void foo(); uncrustify-0.59/tests/input/oc/0000755000175000017500000000000011516452404013567 500000000000000uncrustify-0.59/tests/input/oc/Fraction.h0000644000175000017500000000041011507676756015442 00000000000000#import @interface Fraction: NSObject { int numerator; int denominator; } -(void) print; -(void) setNumerator: (int) d; -(void) setDenominator: (int) d; -(int) numerator; -(int) denominator; -(void) setNumDen :(int)n:(int)d; @end uncrustify-0.59/tests/input/oc/Declarations.h0000644000175000017500000000052111506773274016300 00000000000000 @interface EmptyClass : NSObject -(void)aMessage:(id)arg; @end @interface EmptyClass : NSObject {} -(void)aMessage:(id)arg; @end @interface NSObject (ObjectAdditions) -(void)aMessage:(id)arg; @end @protocol TestProtocol -(void)aMessage:(id)arg; @end @interface TestClass : NSObject { } -(void)aMessage:(id)arg; @end uncrustify-0.59/tests/input/oc/oc-split.m0000644000175000017500000000056411506773274015436 00000000000000[self findstart:&startBarcode end:&endBarcode forLine:greenScalePixels derivative:greenDerivative centerAt:xAxisCenterPoint min:&minValue max:&maxValue]; [self findstart:&startBarcode end:&endBarcode forLine:greenScalePixels derivative:greenDerivative centerAt:xAxisCenterPoint min:&minValue max:&maxValue]; uncrustify-0.59/tests/input/oc/kw.m0000644000175000017500000000063011516452404014305 00000000000000#include #include @protocol Job - do; @end @interface MyJob: Object - do; @end @implementation MyJob - do { printf("Doing Job\n"); return self; } @end @interface JobExecutor: Object - doWith: (id) job for: (int) count; @end @implementation JobExecutor - doWith: (id) job for: (int) count { for (int i = 0; i < count; ++i) { [job do]; } return self; } @end uncrustify-0.59/tests/input/oc/misc.m0000644000175000017500000000136611506773274014640 00000000000000- (id)init { GLfloat wc[3][3] = {{ 0.6, 0.6, 0.0 }, { 1.0, 0.7, 0.1 }, { 0.5, 0.7, 0.2 },}; GLfloat cc[3][3] = {{ 0.0, 0.0, 0.6 }, { 0.3, 0.1, 0.5 }, { 0.0, 0.0, 0.5 },}; GLfloat sc[3] = {0.75, 0.75, 0.75}; return [self initWithWarmColors:(float *)&wc coolColors:(float *)&cc surfaceColor:sc enableTexturing:NO enableSpecular:YES enableQuakeDisruptor:NO]; [NSException raise:NSInternalInconsistency format:@"An internal inconsistency was raised"]; for (i = 0; i <[a count]; i++) { [thePerson setAmount:(1.5 * 17)forKey:@"overtime"]; [screen showtext : x : y : @"Message"]; } } *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:[NSDictionary dictionaryWithObject:@"Some Description" forKey:NSLocalizedDescriptionKey]]; uncrustify-0.59/tests/input/oc/real_world_file.m0000644000175000017500000002150111506773274017027 00000000000000/* File: ATColorTableController.m Abstract: A controller used by the ATImageTextCell to edit the color property. It is implemented in an abstract enough way to be used by a class other than the cell. Version: 1.0 Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ("Apple") in consideration of your agreement to the following terms, and your use, installation, modification or redistribution of this Apple software constitutes acceptance of these terms. If you do not agree with these terms, please do not use, install, modify or redistribute this Apple software. In consideration of your agreement to abide by the following terms, and subject to these terms, Apple grants you a personal, non-exclusive license, under Apple's copyrights in this original Apple software (the "Apple Software"), to use, reproduce, modify and redistribute the Apple Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied, are granted by Apple herein, including but not limited to any patent rights that may be infringed by your derivative works or by other works in which the Apple Software may be incorporated. The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright (C) 2009 Apple Inc. All Rights Reserved. */ #import "ATColorTableController.h" #import "ATPopupWindow.h" @implementation ATColorTableController + (ATColorTableController *)sharedColorTableController { static ATColorTableController *gSharedColorTableController = nil; if (gSharedColorTableController == nil) { gSharedColorTableController = [[[self class] alloc] initWithNibName:@"ColorTable" bundle:[NSBundle bundleForClass:[self class]]]; } return gSharedColorTableController; } @synthesize delegate = _delegate; @dynamic selectedColor, selectedColorName; - (void)dealloc { [_colorList release]; [_colorNames release]; [_window release]; [super dealloc]; } - (void)loadView { [super loadView]; _colorList = [[NSColorList colorListNamed:@"Crayons"] retain]; _colorNames = [[_colorList allKeys] retain]; [_tableColorList setIntercellSpacing:NSMakeSize(3, 3)]; [_tableColorList setTarget:self]; [_tableColorList setAction:@selector(_tableViewAction:)]; } - (NSColor *)selectedColor { NSString *name = [self selectedColorName]; if (name != nil) { return [_colorList colorWithKey:name]; } else { return nil; } } - (NSString *)selectedColorName { if ([_tableColorList selectedRow] != -1) { return [_colorNames objectAtIndex:[_tableColorList selectedRow]]; } else { return nil; } } - (void)_selectColor:(NSColor *)color { // Search for that color in our list NSInteger row = 0; for (NSString *name in _colorNames) { NSColor *colorInList = [_colorList colorWithKey:name]; if ([color isEqual:colorInList]) { break; } row++; } _updatingSelection = YES; if (row != -1) { [_tableColorList scrollRowToVisible:row]; [_tableColorList selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; } else { [_tableColorList scrollRowToVisible:0]; [_tableColorList selectRowIndexes:[NSIndexSet indexSet] byExtendingSelection:NO]; } _updatingSelection = NO; } - (void)_createWindowIfNeeded { if (_window == nil) { NSRect viewFrame = self.view.frame; // Create and setup our window _window = [[ATPopupWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; [_window setReleasedWhenClosed:NO]; [_window setLevel:NSPopUpMenuWindowLevel]; [_window setHasShadow:YES]; [[_window contentView] addSubview:self.view]; [_window makeFirstResponder:_tableColorList]; // Make the window have a clear color and be non-opaque for our pop-up animation [_window setBackgroundColor:[NSColor clearColor]]; [_window setOpaque:NO]; } } - (void)_windowClosed:(NSNotification *)note { if (_eventMonitor) { [NSEvent removeMonitor:_eventMonitor]; _eventMonitor = nil; } [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_window]; [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidResignActiveNotification object:nil]; } - (void)_closeAndSendAction:(BOOL)sendAction { [_window close]; if (sendAction) { if ([self.delegate respondsToSelector:@selector(colorTableController:didChooseColor:named:)]) { [self.delegate colorTableController:self didChooseColor:self.selectedColor named:self.selectedColorName]; } } else { if ([self.delegate respondsToSelector:@selector(didCancelColorTableController:)]) { [self.delegate didCancelColorTableController:self]; } } } - (void)_windowShouldClose:(NSNotification *)note { [self _closeAndSendAction:NO]; } - (void)editColor:(NSColor *)color locatedAtScreenRect:(NSRect)rect { [self _createWindowIfNeeded]; [self _selectColor:color]; NSPoint origin = rect.origin; NSRect windowFrame = [_window frame]; // The origin is the lower left; subtract the window's height origin.y -= NSHeight(windowFrame); // Center the popup window under the rect origin.y += floor(NSHeight(rect) / 3.0); origin.x -= floor(NSWidth(windowFrame) / 2.0); origin.x += floor(NSWidth(rect) / 2.0); [_window setFrameOrigin:origin]; [_window popup]; // Add some watches on the window and application [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowClosed:) name:NSWindowWillCloseNotification object:_window]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowShouldClose:) name:NSApplicationDidResignActiveNotification object:nil]; // Start watching events to figure out when to close the window NSAssert(_eventMonitor == nil, @"_eventMonitor should not be created yet"); _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSLeftMouseDownMask | NSRightMouseDownMask | NSOtherMouseDownMask | NSKeyDownMask handler: ^(NSEvent *incomingEvent) { NSEvent *result = incomingEvent; NSWindow *targetWindowForEvent = [incomingEvent window]; if (targetWindowForEvent != _window) { [self _closeAndSendAction:NO]; } else if ([incomingEvent type] == NSKeyDown) { if ([incomingEvent keyCode] == 53) { // Escape [self _closeAndSendAction:NO]; result = nil; // Don't process the event } else if ([incomingEvent keyCode] == 36) { // Enter [self _closeAndSendAction:YES]; result = nil; } } return result; }]; } - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { return _colorNames.count; } - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { return [_colorNames objectAtIndex:row]; } - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { NSColor *color = [_colorList colorWithKey:[_colorNames objectAtIndex:row]]; [cell setColor:color]; } - (void)_tableViewAction:(id)sender { [self _closeAndSendAction:YES]; } @end uncrustify-0.59/tests/input/oc/Fraction.m0000644000175000017500000000052311506773274015444 00000000000000#import "Fraction.h" #import @implementation Fraction -(void) print { printf( "%i/%i", numerator, denominator ); } -(void) setNumerator: (int) n { numerator = n; } -(void) setDenominator: (int) d { denominator = d; } -(int) denominator { return denominator; } -(int) numerator { return numerator; } @end uncrustify-0.59/tests/input/oc/selector.m0000644000175000017500000000032711506773274015521 00000000000000@selector(methodNameWithArg:); @selector (methodNameNoArg); @selector (methodNameArg1:arg2: ); NSArray *sortedTZs = [ [ NSTimeZone knownTimeZoneNames ] sortedArrayUsingSelector : @selector ( compare: ) ]; uncrustify-0.59/tests/input/oc/sort_import.m0000644000175000017500000000023511506773274016260 00000000000000// should be ddd, eee, fff #import "ddd" #import "fff" #import "eee" // should be aaa, ccc #import "ccc" #import "aaa" // should be just bbb #import "bbb" uncrustify-0.59/tests/input/oc/more_blocks.m0000644000175000017500000000245311506773274016202 00000000000000int (^myBlock)(int) = ^(int num) { return num * multiplier; }; int d = i % 10; repeat(10, ^{ putc('0'+d); }); void (^block)(void); typedef void (^vstr_t)(char *); typedef void (^workBlk_t)(void); void AllLinesInFile(char *f, vstr_t block) { FILE *fp = fopen(f, "r"); if (!fp) return; char line[1024]; while (fgets(line, 1024, fp)) block(line); fclose(fp); } @implementation NSArray (WWDC) - (NSArray *)map:(id (^)(id))xform { id result = [NSMutableArray array]; for (id elem in self) [result addObject:xform(elem)]; return result; } - (NSArray *)collect:(BOOL ( ^ )(id))predicate { id result = [NSMutableArray array]; for (id elem in self) if (predicate(elem)) [result addObject:elem]; return result; } // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL (id item) { return [item length] > 20; }]; // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL* (id item) { return [item length] > 20; }]; @end // 1. block literal: ^{ ... }; // 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional // 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optionaluncrustify-0.59/tests/input/oc/complex_method.m0000644000175000017500000000271511506773274016713 00000000000000// Turn the document contents into a single savable lump of data - (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError { #pragma unused(typeName) // Produce the data lump: NSData * retval = [NSKeyedArchiver archivedDataWithRootObject:model]; // If the lump is nil something went wrong // fill out the error object to explain what wrent wrong if ( outError != NULL ) { // The sender wanted an error reported. If there // was a problem, fill in an NSError object if (retval == nil) { // The error object should include an (unhelpful) // explanation of what happened NSDictionary * userInfoDict = [NSDictionary dictionaryWithObjectsAndKeys: @"Internal error formatting data", NSLocalizedDescriptionKey, @"Archiving of data failed. Probably a bug.", NSLocalizedFailureReasonErrorKey, @"There's nothing you can do.", NSLocalizedRecoverySuggestionErrorKey, nil]; *outError = [NSError errorWithDomain:LinearInternalErrorDomain code:linErrCantFormatDocumentData userInfo:userInfoDict]; } else { // No problem. Don't supply an error object. *outError = nil; } } return retval; } uncrustify-0.59/tests/input/oc/protocol.m0000644000175000017500000000074111506773274015542 00000000000000 NSAssert( [self.delegate conformsToProtocol: @protocol( UISearchBarDelegate )], @"Some Error." ); Protocol *counter = @protocol(ReferenceCounting); @protocol ReferenceCounting - setRefCount:(int)count; - (int)refCount; - incrementCount; - decrementCount; @end @interface Formatter : NSObject < Formatting, Prettifying > @end if ( [receiver conformsTo:@protocol(ReferenceCounting)] ) [receiver incrementCount]; @protocol B; @protocol A - Foo:(id )anObject; @end uncrustify-0.59/tests/input/oc/blocks.m0000644000175000017500000000040011506773274015146 00000000000000int* ( ^ blkReturningPointer)(int) = ^ int* (int a) { return a + 1; }; void (^ blk2)(int *) = ^(int *b) { *b = 1; }; int (^oneFrom)(int) = ^ (int anInt) { return anInt - 1; }; // this should not be flagged as OC_BLOCK_CARET int x = 12 ^ 23;uncrustify-0.59/tests/input/oc/main.m0000644000175000017500000000060211506773274014621 00000000000000#import #import "Fraction.h" int main( int argc, const char *argv[] ) { // create a new instance Fraction *frac = [[Fraction alloc] init]; // set the values [frac setNumerator: 1]; [frac setDenominator: 3]; // print it printf( "The fraction is: " ); [frac print]; printf( "\n" ); // free memory [frac release]; return 0; } uncrustify-0.59/tests/input/oc/string.m0000644000175000017500000000042711506773274015210 00000000000000 - (void)moreScannedData:(Image*)img from:(int)start to:(int)stop; -(void)moreScannedData : (Image*)img from : (int)start to : (int)stop; public bool Enabled { NSString* whatever = @"some lovely text, the fox and co"; a = (enderedImage->h - toplines - bottomlines); } uncrustify-0.59/tests/input/oc/return_type.m0000644000175000017500000000107611506773274016263 00000000000000#import #import @interface Fraction : NSObject { int numerator; int denominator; } -(void) print; -(void)setNumerator:(int)d; -(void)setDenominator:(int)d; -(int) numerator; -(int)denominator; -(void) setNumDen:(int)n:(int)d; @end @implementation Fraction -(void)print { printf("%i/%i", numerator, denominator); } -(void) setNumerator:(int)n { numerator = n; } -(void) setDenominator:(int)d { denominator = d; } -(int) denominator { return(denominator); } -(int) numerator { return(numerator); } @end uncrustify-0.59/tests/input/oc/exceptions.m0000644000175000017500000000040011506773274016052 00000000000000 int main( int argc, const char *argv[] ) { @try { [NSException raise:NSInternalInconsistency format:@"An internal inconsistency was raised"]; } @catch (NSException *e) { NSLog(@"Catch"); } @finally { NSLog(@"Finally"); } return 0; } uncrustify-0.59/tests/input/sql/0000755000175000017500000000000011506773274013777 500000000000000uncrustify-0.59/tests/input/sql/mysql.sqc0000644000175000017500000000165111506773274015577 00000000000000#include #include /*----------------------------------------------------------------*/ EXEC SQL INCLUDE SQLCA; short sqlcode; EXEC SQL BEGIN DECLARE SECTION; int host_a; double host_b; char host_c; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE csr1 CURSOR FOR SELECT a, b, c FROM table1 WHERE x = :hostvar1; /*----------------------------------------------------------------*/ void main (void) { hostvar1 = 42; EXEC SQL OPEN csr1; if (sqlcode < 0) exit(0); while (rc >= 0 && rc != 100) { EXEC SQL FETCH csr1 INTO :host_a, :host_b, :host_c; printf("Fetch %d, %lf, %s\n", host_a, host_b, host_c); } EXEC SQL CLOSE csr1; } void foo(void) { strcpy(demoquery1,"some SQL statement"); EXEC SQL prepare demo3id from :demoquery1; /* a comment */ EXEC SQL declare demo3cursor cursor for demo3id; } uncrustify-0.59/tests/input/sql/sta-select.sqc0000644000175000017500000000436311506773274016501 00000000000000/******************************************************* ** ** A sample program that demonstrates the use of Static embedded SQL. ** Before compiling this program, be sure you have created a table ** called video and inserted some tuples in it. ** ********************************************************/ #include /* sqlca: is the sql communications area. All error codes are returned from db2 in that structure which is filled each time an interaction with db2 takes place. */ EXEC SQL INCLUDE SQLCA; /* SQL communication area structure */ EXEC SQL BEGIN DECLARE SECTION; /* declare host variables */ char db_name[8]; /* database name */ char video_title[30]; /* title of the video */ short video_id; /* serial number */ char director[20]; /* director name */ EXEC SQL END DECLARE SECTION; /* These lines are redundant here because the default action is to continue. They just show the kind of errors that could arise and one way to control them. */ EXEC SQL WHENEVER SQLWARNING CONTINUE; /* sqlca.sqlcode > 0 */ EXEC SQL WHENEVER SQLERROR CONTINUE; /* sqlca.sqlcode < 0 */ EXEC SQL WHENEVER NOT FOUND CONTINUE; /* sqlca.sqlcode = 100 */ /* sqlca.sqlcode = 0 (no error) */ void main() { strcpy(db_name, "csc343h"); /* C variables are preceded by a colon when they are passed to DB2 */ EXEC SQL CONNECT TO :db_name; if (sqlca.sqlcode != 0) { printf("Connect failed!: reason %ld\n", sqlca.sqlcode); exit(1); } /* cursor delcaration. Have to declare a cursor each time you want tuples back from db2 */ EXEC SQL DECLARE c1 CURSOR FOR SELECT video_title FROM video; /* you have to open the cursor in order to get tuples back */ EXEC SQL OPEN c1; do { /* fetch tuples from the cursor. This will execute the statement the cursor implements and will return the results */ EXEC SQL FETCH c1 into :video_title; if (SQLCODE != 0) break; /* SQLCODE refers to sqlca.sqlcode */ /* host variables should have ':' prefix when they are used in DB2 commands */ printf("%s\n",video_title); } while (1); EXEC SQL CLOSE c1; EXEC SQL CONNECT RESET; } uncrustify-0.59/tests/input/java/0000755000175000017500000000000011574757101014115 500000000000000uncrustify-0.59/tests/input/java/assert.java0000644000175000017500000000037011574757101016201 00000000000000public class JavaClass { public static void main(String[] args) { /* assert EXPRESSION1 ; */ assert ( a != null ) && ( b != null ); /* assert EXPRESSION1 : EXPRESSION2 ; */ assert ( a != null ) && ( b != null ) : "Message"; } } uncrustify-0.59/tests/input/vala/0000755000175000017500000000000011506773274014123 500000000000000uncrustify-0.59/tests/input/vala/list.vala0000644000175000017500000000064311506773274015666 00000000000000 using GLib; public class GListTest : Object { public GListTest { } static int main (string[] args) { List list; list.append("TestString1"); list.append("myTest"); message ("list.length()=%d", list.length()); for ( int i = 0; i < list.length(); i++) { string list2 = list.nth_data(i); message ("%s", list2); } } } uncrustify-0.59/tests/input/vala/advanced.vala0000644000175000017500000000127211506773274016457 00000000000000/* Advanced Vala Sample Code */ using GLib; public class Sample : Object { public string name { get; set; } public signal void foo (); public Sample (construct string! name) { } public void run () { foo += s => { stdout.printf ("Lambda expression %s!\n", name); }; /* Calling lambda expression */ foo (); } static int main (string[] args) { foreach (string arg in args) { var sample = new Sample (arg); sample.run (); /* Object will automatically be freed * at the end of the block */ } return 0; } } uncrustify-0.59/tests/input/align_fcall.cpp0000644000175000017500000000012111506773274016051 00000000000000void foo() { abc(1,2,3); abc(10,20,30); abc(100,200,300); bat(1000,2000,3000); } uncrustify-0.59/tests/input/c/0000755000175000017500000000000011632275567013424 500000000000000uncrustify-0.59/tests/input/c/fcn_type.c0000644000175000017500000000146111506773274015317 00000000000000typedef void (*my_fcn_ptr)(char *, int); typedef const char *(my_fcn_ptr)(char *, int); typedef int (my_fcn_ptr)(char *, int); typedef struct foo *(my_fcn_ptr)(char *, int); typedef enum foo *(*my_fcn_ptr)(char *, int); typedef const struct foo *(*my_fcn_ptr)(char *, int); typedef BOOL (my_fcn_ptr)(char *, int); typedef INT32 (*my_fcn_ptr)(char *, int); typedef int INT32; typedef struct foo { int a; } fooey; typedef struct { int a; } queso; struct myfoo { INT32 age; const struct foo *(*my_fcn_ptr)(char *, int); const CHAR *name; MYTYPE (*foo)(int, char); void *user; void (*foo)(int, char); }; SMU foo(void) { a = 4; return SMUIFY(a); } typedef struct { void (*newObject)(const object_info * info, const IObject * *interface, struct object_h* instance); } IObjectFactory; uncrustify-0.59/tests/input/c/endif.c0000644000175000017500000000044711506773274014600 00000000000000int do_this ( int x, int y ) { x++; #ifdef ABC #ifdef DEF x += y; #endif #endif a++; #ifdef ABC b++; #ifdef DEF c++; #ifdef HIJ d++; #endif e++; #endif f++; #endif g++; return (x) } uncrustify-0.59/tests/input/c/align-equ.c0000644000175000017500000000044511506773274015373 00000000000000 // note - set threshold to three void foo(void) { a = 1; bb = 2; ccc = 3; dddd = 4; eeeee = 5; ffffff = 6; a = 1; eeeeee = 5; fffffff = 6; a = 1; eeeee = 5; ccc = 3; ffffff = 6; a = 1; iiiiiiiiiiiiieeeee = 5; ccc = 3; ffffff = 6; } uncrustify-0.59/tests/input/c/newline_after_endif.c0000644000175000017500000000112111506773274017470 00000000000000int main ( ) { #ifdef useJPLvelocity for(i = 0; i < x; i++) y++; #endif return (0); } /* main */ int main ( ) { if(y < 3) y++; #ifdef ABC if(y < 3) y++ // comment #endif if(y < 3) y++; y++; return (0); } /* main */ int main ( ) { #ifdef ABC if(j < y) { if(j < x) { j++; #ifdef XYZ if(j < x) j++; #endif } } #endif return (0); } /* main */ uncrustify-0.59/tests/input/c/return-multi.c0000644000175000017500000000157111506773274016161 00000000000000 static inline long get_tv32(struct timeval *o, struct timeval32 __user *i) { return !access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec)); } static inline long get_tv32(struct timeval *o, struct timeval32 __user *i) { return (!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec))); } const char * dcrp_license_feature(int32_t idx) { #define FEATURESTR(f) \ case DCRMIB_LICENSE_##f: \ return DCRP_LICENSE_FEATURE_##f##_STR switch(idx) { DCRP_LICENSE_FOREACH_FEATURES(FEATURESTR); } return ""; } static int isValidLicenseType(int32_t idx) { #define CHECKFEATURE(f) \ case DCRMIB_LICENSE_##f: \ return 1 switch(idx) { DCRP_LICENSE_FOREACH_FEATURES(CHECKFEATURE); } return n * foo(5); } uncrustify-0.59/tests/input/c/pp-space.c0000644000175000017500000000073311506773274015221 00000000000000/** * Some file header comment thingy. */ #ifndef SOME_H_INCLUDED #define SOME_H_INCLUDED #include "Somefile.h" #define SOMEMACRO (1+4) #ifdef WIN32 #include "windows_compat.h" #else /* not WIN32 */ #if defined HAVE_STDINT_H #include #elif defined HAVE_INTTYPES_H #include #define YOUR_OS_SUCKS #else #error "Don't know where int8_t is defined" #endif typedef uint32_t UINT32; #endif /* ifdef WIN32 */ #endif /* SOME_H_INCLUDED */ uncrustify-0.59/tests/input/c/nl_proto_endif.c0000644000175000017500000000026611506773274016513 00000000000000 #include static void status_cb(status_t *status); static int add_conn(const char *path); #ifdef USE_FOO_CMD static void foo_cmd(void *user, const info_t *info); #endif uncrustify-0.59/tests/input/c/one-liner-init.c0000644000175000017500000000042211506773274016335 00000000000000 enum boo { FOO = 1 }; void foo(void) { char str[123] = { 0 }; enum hoo { NOO = 1 }; strcat(str, "foo"); } void f(){if(bar())baz(1);else baz(2);} int foo() { return 0; } void foo(int a, int b) { if (a == b) { a++; } else { b++; } if (a == b) a++; else b++; } uncrustify-0.59/tests/input/c/cond.c0000644000175000017500000000017411506773274014433 00000000000000 int foo1(bool b, int tv, int fv) { return b ? tv : fv; } int foo2(bool b, int tv, int fv) { return b?tv:fv; } uncrustify-0.59/tests/input/c/code_width.c0000644000175000017500000000304411506773274015620 00000000000000 static int short_function_name(struct device *dev, struct device_driver *drv); /* Assuming a 60-column limit */ static int short_function_name(struct device *dev, struct device_driver *drv) { this->translateLabels(labelID, completedLabelID, selectedLabelID, text, selectedText, completedText, fontId, selectedFontId, completedFontId); call_some_really_long_function.of_some_sort(some_long_parameter1, some_long_parameter2); abc = call_some_other_really_long_function.of_some_sort(some_long_parameter1, some_long_parameter2); abc.def.ghi = call_some_other_really_long_function.of_some_sort(some_long_parameter1, some_long_parameter2); abcdefghijklmnopqrstuvwxyz = abc + def + ghi + jkl + mno + prq + stu+ vwx + yz; return 1; } static void some_really_long_function_name(struct device *dev, struct device_driver *drv) { if ((some_variable_name && somefunction(param1, param2, param3))) { asdfghjk = asdfasdfasd.aasdfasd + (asdfasd.asdas * 1234.65); } for (struct something_really_really_excessive *a_long_ptr_name = get_first_item(); a_long_ptr_name != NULL; a_long_ptr_name = get_next_item(a_long_ptr_name)) { } for (a = get_first(); a != NULL; a = get_next(a)) { } for (a_ptr = get_first(); a_ptr != NULL; a_ptr = get_next(a)) { } register_clcmd( "examine", "do_examine", -1, "-Allows a player to examine the health and armor of a teammate" ); register_clcmd( "/examine", "do_examine", -1, "-Allows a player to examine the health and armor of a teammate" ); } uncrustify-0.59/tests/input/c/bugs-8.c0000644000175000017500000000011711506773274014612 00000000000000 void foo(void) { p[0].x = x + (rx * cos(rs)); p[0].y = y - (ry * sin(rs)); } uncrustify-0.59/tests/input/c/cmt_nl_end.c0000644000175000017500000000022111506773274015603 00000000000000int do_this ( int x, int y ) { x += y; // x = x + y if(x == 3) x++; // x plus 1 return (x) } uncrustify-0.59/tests/input/c/preproc-if.c0000644000175000017500000000037611506773274015562 00000000000000 int main() { int a; #ifndef SOMEDEF int b; #endif /* SOMEDEF */ if (a) { } #ifndef SOMEDEF else if (b) { } #endif /* SOMEDEF */ /* same thing w/o preprocs for reference */ if (a) { } else if (b) { } #ifdef FOO do { Foo(); } #endif while(Loop--); } uncrustify-0.59/tests/input/c/ifdef-indent.c0000644000175000017500000000054311506773274016044 00000000000000#ifdef foo #include #else #include #endif int show_interrupts(struct seq_file *p, void *v) { #ifndef CONFIG_SMP a++; #else for (b = 0; b < 9; b++) if (b & 1) k++; #endif if (v) { bar(v); #if DEBUG == 1 printf("yup\n"); #endif } } void foo() { int i=0; #if DEBUG == 1 i--; #endif i++; } uncrustify-0.59/tests/input/c/bugs-2.c0000644000175000017500000000044611506773275014612 00000000000000static void tcps_proc_server_msg(void *p_user, const ptc_msg_info_t *p_info) { if (z) { if (a) /* comment */ { a++; } /* comment */ else if (b) { b++; } /* Comment */ else { c++; } } } uncrustify-0.59/tests/input/c/freebsd.c0000644000175000017500000000676411506773275015136 00000000000000/* Make the structure name match the typedef. */ typedef struct bar { int level; } BAR; typedef int foo; /* This is foo. */ typedef const long baz; /* This is baz. */ static char *function(int _arg, const char *_arg2, struct foo *_arg3, struct bar *_arg4); static void usage(void); /* * All major routines should have a comment briefly describing what * they do. The comment before the "main" routine should describe * what the program does. */ int main(int argc, char *argv[]) { char *ep; long num; int ch; while ((ch = getopt(argc, argv, "abNn:")) != -1) switch (ch) { /* Indent the switch. */ case 'a': /* Don't indent the case. */ aflag = 1; /* Indent case body one tab. */ /* FALLTHROUGH */ case 'b': bflag = 1; break; case 'N': Nflag = 1; break; case 'n': num = strtol(optarg, &ep, 10); if (num <= 0 || *ep != '\0') { warnx("illegal number, -n argument -- %s", optarg); usage(); } break; case '?': default: usage(); /* NOTREACHED */ } argc -= optind; argv += optind; for (p = buf; *p != '\0'; ++p) ; /* nothing */ for (;;) stmt; for (;;) { zed = a + really + long + statement + that + needs + two + lines + gets + indented + four + spaces + on + the + second + and + subsequent + lines; } for (;;) { if (cond) stmt; } if (val != NULL) val = realloc(val, newsize); fcn_call(with, a, really, long, list, of, parameters, that, spans, two, lines); for (; cnt < 15; cnt++) { stmt1; stmt2; } almod = (chunk_is_single_line_comment(pc) && cpd.settings[UO_indent_relative_single_line_comments].b) ? ALMODE_KEEP_REL : ALMODE_KEEP_ABS; /* Indentation is an 8 character tab. Second level indents are four spaces. * If you have to wrap a long statement, put the operator at the end of the * line. */ while (cnt < 20 && this_variable_name_is_too_long && ep != NULL) zappy = a + really + long + statement + that + needs + two + lines + gets + indented + four + spaces + on + the + second + and + subsequent + lines; // Do not add whitespace at the end of a line, and only use tabs followed by // spaces to form the indentation. Do not use more spaces than a tab will // produce and do not use spaces in front of tabs. // // Closing and opening braces go on the same line as the else. Braces that // are not necessary may be left out. if (test) stmt; else if (bar) { stmt; stmt; } else stmt; // No spaces after function names. Commas have a space after them. No spa- // ces after `(' or `[' or preceding `]' or `)' characters. error = function(a1, a2); if (error != 0) exit(error); // Unary operators do not require spaces, binary operators do. Do not use // parentheses unless they are required for precedence or unless the state- // ment is confusing without them. Remember that other people may confuse // easier than you. Do YOU understand the following? a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1; k = !(l & FLAGS); // Exits should be 0 on success, or 1 on failure. exit(0); /* * Avoid obvious comments such as * "Exit 0 on success." */ } static char * function(a1, a2, fl, a4) int a1, a2; /* Declare ints, too, don't default them. */ float fl; /* Beware double vs. float prototype differences. */ int a4; /* List in order declared. */ { } uncrustify-0.59/tests/input/c/switch-case.c0000644000175000017500000000563411506773275015731 00000000000000 asmlinkage unsigned long osf_setsysinfo(unsigned long op, void __user *buffer, unsigned long nbytes, int __user *start, void __user *arg) { switch (op) { case SSI_IEEE_FP_CONTROL: { unsigned long swcr, fpcr; unsigned int *state; /* * Alpha Architecture Handbook 4.7.7.3: * To be fully IEEE compiant, we must track the current IEEE * exception state in software, because spurrious bits can be * set in the trap shadow of a software-complete insn. */ if (get_user(swcr, (unsigned long __user *)buffer)) return -EFAULT; state = ¤t_thread_info()->ieee_state; /* Update softare trap enable bits. */ *state = (*state & ~IEEE_SW_MASK) | (swcr & IEEE_SW_MASK); /* Update the real fpcr. */ fpcr = rdfpcr() & FPCR_DYN_MASK; fpcr |= ieee_swcr_to_fpcr(swcr); wrfpcr(fpcr); return 0; } case SSI_IEEE_RAISE_EXCEPTION: { unsigned long exc, swcr, fpcr, fex; unsigned int *state; if (get_user(exc, (unsigned long __user *)buffer)) return -EFAULT; state = ¤t_thread_info()->ieee_state; exc &= IEEE_STATUS_MASK; /* Update softare trap enable bits. */ swcr = (*state & IEEE_SW_MASK) | exc; *state |= exc; /* Update the real fpcr. */ fpcr = rdfpcr(); fpcr |= ieee_swcr_to_fpcr(swcr); wrfpcr(fpcr); /* If any exceptions set by this call, and are unmasked, send a signal. Old exceptions are not signaled. */ fex = (exc >> IEEE_STATUS_TO_EXCSUM_SHIFT) & swcr; if (fex) { siginfo_t info; int si_code = 0; if (fex & IEEE_TRAP_ENABLE_DNO) si_code = FPE_FLTUND; if (fex & IEEE_TRAP_ENABLE_INE) si_code = FPE_FLTRES; if (fex & IEEE_TRAP_ENABLE_UNF) si_code = FPE_FLTUND; if (fex & IEEE_TRAP_ENABLE_OVF) si_code = FPE_FLTOVF; if (fex & IEEE_TRAP_ENABLE_DZE) si_code = FPE_FLTDIV; if (fex & IEEE_TRAP_ENABLE_INV) si_code = FPE_FLTINV; info.si_signo = SIGFPE; info.si_errno = 0; info.si_code = si_code; info.si_addr = NULL; /* FIXME */ send_sig_info(SIGFPE, &info, current); } return 0; } case SSI_IEEE_STATE_AT_SIGNAL: case SSI_IEEE_IGNORE_STATE_AT_SIGNAL: /* * Not sure anybody will ever use this weird stuff. These * ops can be used (under OSF/1) to set the fpcr that should * be used when a signal handler starts executing. */ break; case SSI_NVPAIRS: { unsigned long v, w, i; unsigned int old, new; for (i = 0; i < nbytes; ++i) { if (get_user(v, 2*i + (unsigned int __user *)buffer)) return -EFAULT; if (get_user(w, 2*i + 1 + (unsigned int __user *)buffer)) return -EFAULT; switch (v) { case SSIN_UACPROC: again: old = current_thread_info()->flags; new = old & ~(UAC_BITMASK << UAC_SHIFT); new = new | (w & UAC_BITMASK) << UAC_SHIFT; if (cmpxchg(¤t_thread_info()->flags, old, new) != old) goto again; break; default: return -EOPNOTSUPP; } } return 0; } default: break; } return -EOPNOTSUPP; } uncrustify-0.59/tests/input/c/braces-4.c0000644000175000017500000000026511506773275015112 00000000000000int foo(int bar) { #ifndef CONFIG_1 bar -= 3; #else for (j = 0; j < NR_CPUS; j++) if (cpu_online(j)) bar++; #endif return 0; } uncrustify-0.59/tests/input/c/align-typedef.c0000644000175000017500000000056011506773275016240 00000000000000 typedef int MY_INT; typedef int * MY_INTP; typedef int(*foo_t)(void *bar); typedef int(*somefunc_t)(void *barstool); typedef int int8_t __attribute__((__mode__(__QI__))); typedef int uint8_t; typedef struct _IDirectFBSurface IDirectFBSurface; typedef struct _IDirectFBPalette IDirectFBPalette; typedef struct timezone *__restrict __timezone_ptr_t; uncrustify-0.59/tests/input/c/pos_compare.c0000644000175000017500000000025511506773275016020 00000000000000void foo(void) { if ((a_really_long_number > another_really_long_number) || (some_really_long_bool != another_really_long_bool)) { foo2(); } } uncrustify-0.59/tests/input/c/cmt_multi.c0000644000175000017500000000123311506773275015503 00000000000000/************************************************ * This is a multiline comment. * The first and last lines are the same length ************************************************/ /**************************************************************************** A multi-line comment that is broken in two parts. *//** Second part ****************************************************************************/ /**************************************************************************** A multi-line comment that is broken in two parts. */ /** Second part ****************************************************************************/ uncrustify-0.59/tests/input/c/comment-indent.c0000644000175000017500000000111511506773275016426 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 // second comment return(res); } // col1 comment in level 0 // and another void foo() { if( bar ) { foo(); } /*else if( bar2 ) { foo2(); } */else if( bar3 ) { foo3(); } } uncrustify-0.59/tests/input/c/fcn_indent.c0000644000175000017500000000072611506773275015623 00000000000000int this_is_a_function_proto(int a, char * b); int this_is_a_function_def(int a, char * b) { this_is_a_function_call(a, b); a = another_function_call(a, b); } typedef short (*hello1)(char coolParam, ushort *, unsigned int anotherone); short (*hello2)(char coolParam, ulong *, uchar, unsigned int anotherone); short hello3 (char coolParam, ushort *, unsigned int anotherone); uncrustify-0.59/tests/input/c/xml.c0000644000175000017500000000016711506773275014313 00000000000000void foo(void) { const char *a= "" "" "" "" ""; } uncrustify-0.59/tests/input/c/indent_first_bool_expr.c0000644000175000017500000000073611506773275020256 00000000000000void test(void) { b1=a&b||c==d; b2=(a&b)||c==d; b3=(a&b||c==d); if (a==3 && b==2 & c || d && r){} if (/*test*/a||b){} if (/*test*/a||/*truc*/b){} if (a/*test*/||b){} if (a||/*test*/b){} a=3; if ((aaaaaaaaaaaaaaa == sqddqsqsdqsdqsd) && (dfdssdfsdfsdfsdfs || (qsdfsdfsdfqsdfqsdfqsdsd == fsdqfsdfsdfsdf))) { a++;} while ((aaaaaaaaaaaaaaa == sqddqsqsdqsdqsd) && (dfdssdfsdfsdfsdfs || (qsdfsdfsdfqsdfqsdfqsdsd == fsdqfsdfsdfsdf))) { a++;} } uncrustify-0.59/tests/input/c/cast_brace.c0000644000175000017500000000014511632275567015576 00000000000000// void disappearing_semicolon(void) { r = (recordtypecast){a, b, c}; //<-- p = Table_put(t,a,&r); } uncrustify-0.59/tests/input/c/nl-semicolon.c0000644000175000017500000000035111506773275016105 00000000000000void foo(void) { a = 5; b = 3; j = 6; for (a = 0; a < j; a++) { b *= (a + b); } } struct somestruct { int a; char b; foo c; bar *d; }; struct foo { int a; char *b }; void f() { for (;;) nothing(); foobar(); } ; uncrustify-0.59/tests/input/c/bugs-6.c0000644000175000017500000000055511506773275014617 00000000000000/*=-------------------------------------------------------------------------=*\ * | FUNCTION NAME: mult2 | | DESCRIPTION: | Multiplies a number by two. | | INPUTS/OUTPUTS: | val - the number to double | | RETURNS: | val * 2 * \*=-------------------------------------------------------------------------=*/ int mult2(int val) { return val * 2; } uncrustify-0.59/tests/input/c/paren-indent.c0000644000175000017500000000146111506773275016075 00000000000000static void *foo(int param1, char *param2 ); static void *foo ( int param1, char *param2 ) { for ( int i = 0; i< 10; i++ ) { bar( arg1, arg2 ); if ( ( abc < bcd ) &&( 123 < abc ) ) { none(arg1, arg2, arg3 ); } } } void CWarningAnalyzer::SetEffect(int FilterNumber ,bool Exclude , int Red , int Green , int Blue , bool Italic , bool Bold , bool Underlined ) { /* TODO */ } uncrustify-0.59/tests/input/c/mod-paren.c0000644000175000017500000000160111506773275015367 00000000000000 int foo(int a, int b) { if ( ! (a || b) ) { return (1); } return 0; } void fooo() { if(enabled) value = 1; if(enabled && value==100) { } if(value==100) { } if(value==100 && i<15 || enabled) { } if(!failed && (value==100 && i<15) || enabled) { } } void foo3() { if (strcmp(a, b) == 0 && total < 5) { add_item(a); } if (glob_add_path(gd, gd->dir, NULL, (flags & GLOB_MARK) && S_ISDIR(gd->st.st_mode)) != 0) { bar(); } return ; } int foo1(void) { FOO_ERROR("connect: can only connected from state CLOSED", pcb->state == CLOSED, return ERR_ISCONN); return ERR_OK; } int foo2(void) { return (-1); } void foo(void) { if (!value #ifdef OPTION || value == SOMECONST #endif /* comment */ ) { } } void foo3(void) { if (*p == '-' && p[1] != ']' ? *text <= *++p && *text >= last : *text == *p) { matched = TRUE; } } uncrustify-0.59/tests/input/c/vb-while.c0000644000175000017500000000117511506773275015230 00000000000000unsigned long xdl_adler32(unsigned long adler, unsigned char const *buf, unsigned int len) { int k; unsigned long s1 = adler & 0xffff; unsigned long s2 = (adler >> 16) & 0xffff; if (!buf) return 1; while (len > 0) { k = len < NMAX ? len :NMAX; len -= k; while (k >= 16) { DO16(buf); buf += 16; k -= 16; } if (k != 0) do { s1 += *buf++; s2 += s1; } while (--k); s1 %= BASE; s2 %= BASE; } return(s2 << 16) | s1; } void f(){ while(1) if(2) 3; else 4; } uncrustify-0.59/tests/input/c/indent.cpp0000644000175000017500000007575711506773275015355 00000000000000/** * @file indent.cpp * Does all the indenting stuff. * * $Id: indent.cpp 548 2006-10-21 02:31:55Z bengardner $ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" #include #include #include #include #include /** * General indenting approach: * Indenting levels are put into a stack. * * The stack entries contain: * - opening type * - brace column * - continuation column * * Items that start a new stack item: * - preprocessor (new parse frame) * - Brace Open (Virtual brace also) * - Paren, Square, Angle open * - Assignments * - C++ '<<' operator (ie, cout << "blah") * - case * - class colon * - return * - types * - any other continued statement * * Note that the column of items marked 'PCF_WAS_ALIGNED' is not changed. * * For an open brace: * - indent increases by indent_columns * - if part of if/else/do/while/switch/etc, an extra indent may be applied * - if in a paren, then cont-col is set to column + 1, ie "({ some code })" * * Open paren/square/angle: * cont-col is set to the column of the item after the open paren, unless * followed by a newline, then it is set to (brace-col + indent_columns). * Examples: * a_really_long_funcion_name( * param1, param2); * a_really_long_funcion_name(param1, * param2); * * Assignments: * Assignments are continued aligned with the first item after the assignment, * unless the assign is followed by a newline. * Examples: * some.variable = asdf + asdf + * asdf; * some.variable = * asdf + asdf + asdf; * * C++ << operator: * Handled the same as assignment. * Examples: * cout << "this is test number: " * << test_number; * * case: * Started with case or default. * Terminated with close brace at level or another case or default. * Special indenting according to various rules. * - indent of case label * - indent of case body * - how to handle optional braces * Examples: * { * case x: { * a++; * break; * } * case y: * b--; * break; * default: * c++; * break; * } * * Class colon: * Indent continuation by indent_columns: * class my_class : * baseclass1, * baseclass2 * { * * Return: same as assignemts * If the return statement is not fully paren'd, then the indent continues at * the column of the item after the return. If it is paren'd, then the paren * rules apply. * return somevalue + * othervalue; * * Type: pretty much the same as assignments * Examples: * int foo, * bar, * baz; * * Any other continued item: * There shouldn't be anything not covered by the above cases, but any other * continued item is indented by indent_columns: * Example: * somereallycrazylongname.with[lotsoflongstuff]. * thatreallyannoysme.whenIhavetomaintain[thecode] = 3; */ static void indent_comment(chunk_t *pc, int col); void indent_to_column(chunk_t *pc, int column) { if (column < pc->column) { column = pc->column; } reindent_line(pc, column); } /** * Changes the initial indent for a line to the given column * * @param pc The chunk at the start of the line * @param column The desired column */ void reindent_line(chunk_t *pc, int column) { int col_delta; int min_col; LOG_FMT(LINDLINE, "%s: %d] col %d on %.*s [%s] => %d\n", __func__, pc->orig_line, pc->column, pc->len, pc->str, get_token_name(pc->type), column); if (column == pc->column) { return; } col_delta = column - pc->column; pc->column = column; min_col = pc->column; do { min_col += pc->len; pc = chunk_get_next(pc); if (pc != NULL) { if (chunk_is_comment(pc)) { pc->column = pc->orig_col; if (pc->column < min_col) { pc->column = min_col + 1; } LOG_FMT(LINDLINE, "%s: set comment on line %d to col %d (orig %d)\n", __func__, pc->orig_line, pc->column, pc->orig_col); } else { pc->column += col_delta; if (pc->column < min_col) { pc->column = min_col; } } } } while ((pc != NULL) && (pc->nl_count == 0)); } /** * Starts a new entry * * @param frm The parse frame * @param pc The chunk causing the push */ static void indent_pse_push(struct parse_frame& frm, chunk_t *pc) { static int ref = 0; /* check the stack depth */ if (frm.pse_tos < (int)ARRAY_SIZE(frm.pse)) { /* Bump up the index and initialize it */ frm.pse_tos++; memset(&frm.pse[frm.pse_tos], 0, sizeof(frm.pse[frm.pse_tos])); LOG_FMT(LINDPSE, "%4d] OPEN [%d,%s] level=%d\n", pc->orig_line, frm.pse_tos, get_token_name(pc->type), pc->level); frm.pse[frm.pse_tos].type = pc->type; frm.pse[frm.pse_tos].level = pc->level; frm.pse[frm.pse_tos].open_line = pc->orig_line; frm.pse[frm.pse_tos].ref = ++ref; frm.pse[frm.pse_tos].in_preproc = (pc->flags & PCF_IN_PREPROC) != 0; } } /** * Removes the top entry * * @param frm The parse frame * @param pc The chunk causing the push */ static void indent_pse_pop(struct parse_frame& frm, chunk_t *pc) { /* Bump up the index and initialize it */ if (frm.pse_tos > 0) { if (pc != NULL) { LOG_FMT(LINDPSE, "%4d] CLOSE [%d,%s] on %s, started on line %d, level=%d/%d\n", pc->orig_line, frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), get_token_name(pc->type), frm.pse[frm.pse_tos].open_line, frm.pse[frm.pse_tos].level, pc->level); } else { LOG_FMT(LINDPSE, " EOF] CLOSE [%d,%s], started on line %d\n", frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), frm.pse[frm.pse_tos].open_line); } frm.pse_tos--; } } static int token_indent(c_token_t type) { switch (type) { case CT_IF: case CT_DO: return(3); case CT_FOR: case CT_ELSE: // wacky, but that's what is wanted return(4); case CT_WHILE: return(6); case CT_SWITCH: return(7); case CT_ELSEIF: return(8); default: return(0); //cpd.settings[UO_indent_braces].n; } } /** * Change the top-level indentation only by changing the column member in * the chunk structures. * The level indicator must already be set. */ void indent_text(void) { chunk_t *pc; chunk_t *next; chunk_t *prev = NULL; bool did_newline = true; int idx; int vardefcol = 0; int indent_size = cpd.settings[UO_indent_columns].n; int tmp; struct parse_frame frm; bool in_preproc = false, was_preproc = false; int indent_column; int cout_col = 0; // for aligning << stuff int cout_level = 0; // for aligning << stuff int parent_token_indent = 0; memset(&frm, 0, sizeof(frm)); /* dummy top-level entry */ frm.pse[0].indent = 1; frm.pse[0].indent_tmp = 1; frm.pse[0].type = CT_EOF; pc = chunk_get_head(); while (pc != NULL) { /* Handle proprocessor transitions */ was_preproc = in_preproc; in_preproc = (pc->flags & PCF_IN_PREPROC) != 0; if (cpd.settings[UO_indent_brace_parent].b) { parent_token_indent = token_indent(pc->parent_type); } /* Clean up after a #define */ if (!in_preproc) { while ((frm.pse_tos > 0) && frm.pse[frm.pse_tos].in_preproc) { indent_pse_pop(frm, pc); } } else { pf_check(&frm, pc); if (!was_preproc) { /* Transition into a preproc by creating a dummy indent */ frm.level++; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = 1 + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; } } if ((cout_col > 0) && (chunk_is_semicolon(pc) || (pc->level < cout_level))) { cout_col = 0; cout_level = 0; } /** * Handle non-brace closures */ int old_pse_tos; do { old_pse_tos = frm.pse_tos; /* End anything that drops a level * REVISIT: not sure about the preproc check */ if (!chunk_is_newline(pc) && !chunk_is_comment(pc) && ((pc->flags & PCF_IN_PREPROC) == 0) && (frm.pse[frm.pse_tos].level > pc->level)) { indent_pse_pop(frm, pc); } if (frm.pse[frm.pse_tos].level == pc->level) { /* process virtual braces closes (no text output) */ if ((pc->type == CT_VBRACE_CLOSE) && (frm.pse[frm.pse_tos].type == CT_VBRACE_OPEN)) { indent_pse_pop(frm, pc); frm.level--; pc = chunk_get_next(pc); } /* End any assign operations with a semicolon on the same level */ if ((frm.pse[frm.pse_tos].type == CT_ASSIGN) && (chunk_is_semicolon(pc) || (pc->type == CT_COMMA) || (pc->type == CT_BRACE_OPEN))) { indent_pse_pop(frm, pc); } /* End any CPP class colon crap */ if ((frm.pse[frm.pse_tos].type == CT_CLASS_COLON) && ((pc->type == CT_BRACE_OPEN) || chunk_is_semicolon(pc))) { indent_pse_pop(frm, pc); } /* a case is ended with another case or a close brace */ if ((frm.pse[frm.pse_tos].type == CT_CASE) && ((pc->type == CT_BRACE_CLOSE) || (pc->type == CT_CASE))) { indent_pse_pop(frm, pc); } /* a return is ended with a semicolon */ if ((frm.pse[frm.pse_tos].type == CT_RETURN) && chunk_is_semicolon(pc)) { indent_pse_pop(frm, pc); } /* Close out parens and squares */ if ((frm.pse[frm.pse_tos].type == (pc->type - 1)) && ((pc->type == CT_PAREN_CLOSE) || (pc->type == CT_SPAREN_CLOSE) || (pc->type == CT_FPAREN_CLOSE) || (pc->type == CT_SQUARE_CLOSE) || (pc->type == CT_ANGLE_CLOSE))) { indent_pse_pop(frm, pc); frm.paren_count--; } } } while (old_pse_tos > frm.pse_tos); /* Grab a copy of the current indent */ indent_column = frm.pse[frm.pse_tos].indent_tmp; if (!chunk_is_newline(pc) && !chunk_is_comment(pc)) { LOG_FMT(LINDPC, " -=[ %.*s ]=- top=%d %s %d/%d\n", pc->len, pc->str, frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), frm.pse[frm.pse_tos].indent_tmp, frm.pse[frm.pse_tos].indent); } /** * Handle stuff that can affect the current indent: * - brace close * - vbrace open * - brace open * - case (immediate) * - labels (immediate) * - class colons (immediate) * * And some stuff that can't * - open paren * - open square * - assignment * - return */ if (pc->type == CT_BRACE_CLOSE) { if (frm.pse[frm.pse_tos].type == CT_BRACE_OPEN) { indent_pse_pop(frm, pc); frm.level--; /* Update the indent_column if needed */ if (!cpd.settings[UO_indent_braces].b && (parent_token_indent == 0)) { indent_column = frm.pse[frm.pse_tos].indent_tmp; } if ((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE) || (pc->parent_type == CT_ELSEIF) || (pc->parent_type == CT_DO) || (pc->parent_type == CT_WHILE) || (pc->parent_type == CT_SWITCH) || (pc->parent_type == CT_FOR)) { indent_column += cpd.settings[UO_indent_brace].n; } } } else if (pc->type == CT_VBRACE_OPEN) { frm.level++; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; /* Always indent on virtual braces */ indent_column = frm.pse[frm.pse_tos].indent_tmp; } else if (pc->type == CT_BRACE_OPEN) { frm.level++; indent_pse_push(frm, pc); if (frm.paren_count != 0) { /* We are inside ({ ... }) -- indent one tab from the paren */ frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; } else { /* Use the prev indent level + indent_size. */ frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; /* If this brace is part of a statement, bump it out by indent_brace */ if ((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE) || (pc->parent_type == CT_ELSEIF) || (pc->parent_type == CT_DO) || (pc->parent_type == CT_WHILE) || (pc->parent_type == CT_SWITCH) || (pc->parent_type == CT_FOR)) { if (parent_token_indent != 0) { frm.pse[frm.pse_tos].indent += parent_token_indent - indent_size; } else { frm.pse[frm.pse_tos].indent += cpd.settings[UO_indent_brace].n; indent_column += cpd.settings[UO_indent_brace].n; } } else if (pc->parent_type == CT_CASE) { /* The indent_case_brace setting affects the parent CT_CASE */ frm.pse[frm.pse_tos].indent_tmp += cpd.settings[UO_indent_case_brace].n; frm.pse[frm.pse_tos].indent += cpd.settings[UO_indent_case_brace].n; } else if ((pc->parent_type == CT_CLASS) && !cpd.settings[UO_indent_class].b) { frm.pse[frm.pse_tos].indent -= indent_size; } else if ((pc->parent_type == CT_NAMESPACE) && !cpd.settings[UO_indent_namespace].b) { frm.pse[frm.pse_tos].indent -= indent_size; } } if ((pc->flags & PCF_DONT_INDENT) != 0) { frm.pse[frm.pse_tos].indent = pc->column; indent_column = pc->column; } else { /** * If there isn't a newline between the open brace and the next * item, just indent to wherever the next token is. * This covers this sort of stuff: * { a++; * b--; }; */ next = chunk_get_next_ncnl(pc); if (!chunk_is_newline_between(pc, next)) { frm.pse[frm.pse_tos].indent = next->column; } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].open_line = pc->orig_line; /* Update the indent_column if needed */ if (cpd.settings[UO_indent_braces].n || (parent_token_indent != 0)) { indent_column = frm.pse[frm.pse_tos].indent_tmp; } } } else if (pc->type == CT_CASE) { /* Start a case - indent UO_indent_switch_case from the switch level */ tmp = frm.pse[frm.pse_tos].indent + cpd.settings[UO_indent_switch_case].n; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = tmp; frm.pse[frm.pse_tos].indent_tmp = tmp - indent_size; /* Always set on case statements */ indent_column = frm.pse[frm.pse_tos].indent_tmp; } else if (pc->type == CT_LABEL) { /* Labels get sent to the left or backed up */ if (cpd.settings[UO_indent_label].n > 0) { indent_column = cpd.settings[UO_indent_label].n; } else { indent_column = frm.pse[frm.pse_tos].indent + cpd.settings[UO_indent_label].n; } } else if (pc->type == CT_CLASS_COLON) { /* just indent one level */ indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; indent_column = frm.pse[frm.pse_tos].indent_tmp; if (cpd.settings[UO_indent_class_colon].b) { prev = chunk_get_prev(pc); if (chunk_is_newline(prev)) { frm.pse[frm.pse_tos].indent += 2; /* don't change indent of current line */ } } } else if ((pc->type == CT_PAREN_OPEN) || (pc->type == CT_SPAREN_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->type == CT_SQUARE_OPEN) || (pc->type == CT_ANGLE_OPEN)) { /* Open parens and squares - never update indent_column */ indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = pc->column + pc->len; if (cpd.settings[UO_indent_func_call_param].b && (pc->type == CT_FPAREN_OPEN) && (pc->parent_type == CT_FUNC_CALL)) { frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; } if ((chunk_is_str(pc, "(", 1) && !cpd.settings[UO_indent_paren_nl].b) || (chunk_is_str(pc, "[", 1) && !cpd.settings[UO_indent_square_nl].b)) { next = chunk_get_next_nc(pc); if (chunk_is_newline(next)) { int sub = 1; if (frm.pse[frm.pse_tos - 1].type == CT_ASSIGN) { sub = 2; } frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - sub].indent + indent_size; } } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.paren_count++; } else if (pc->type == CT_ASSIGN) { /** * if there is a newline after the '=', just indent one level, * otherwise align on the '='. * Never update indent_column. */ next = chunk_get_next(pc); if (next != NULL) { indent_pse_push(frm, pc); if (chunk_is_newline(next)) { frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; } else { frm.pse[frm.pse_tos].indent = pc->column + pc->len + 1; } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; } } else if (pc->type == CT_RETURN) { /* don't count returns inside a () or [] */ if (pc->level == pc->brace_level) { indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + pc->len + 1; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos - 1].indent; } } else if (chunk_is_str(pc, "<<", 2)) { if (cout_col == 0) { cout_col = pc->column; cout_level = pc->level; } } else { /* anything else? */ } /** * Indent the line if needed */ if (did_newline && !chunk_is_newline(pc) && (pc->len != 0)) { /** * Check for special continuations. * Note that some of these could be done as a stack item like * everything else */ prev = chunk_get_prev_ncnl(pc); if ((pc->type == CT_MEMBER) || (pc->type == CT_DC_MEMBER) || ((prev != NULL) && ((prev->type == CT_MEMBER) || (prev->type == CT_DC_MEMBER)))) { tmp = cpd.settings[UO_indent_member].n + indent_column; LOG_FMT(LINDENT, "%s: %d] member => %d\n", __func__, pc->orig_line, tmp); reindent_line(pc, tmp); } else if (chunk_is_str(pc, "<<", 2) && (cout_col > 0)) { LOG_FMT(LINDENT, "%s: %d] cout_col => %d\n", __func__, pc->orig_line, cout_col); reindent_line(pc, cout_col); } else if ((vardefcol > 0) && (pc->type == CT_WORD) && ((pc->flags & PCF_VAR_DEF) != 0) && (prev != NULL) && (prev->type == CT_COMMA)) { LOG_FMT(LINDENT, "%s: %d] Vardefcol => %d\n", __func__, pc->orig_line, vardefcol); reindent_line(pc, vardefcol); } else if ((pc->type == CT_STRING) && (prev->type == CT_STRING) && cpd.settings[UO_indent_align_string].b) { LOG_FMT(LINDENT, "%s: %d] String => %d\n", __func__, pc->orig_line, prev->column); reindent_line(pc, prev->column); } else if (chunk_is_comment(pc)) { LOG_FMT(LINDENT, "%s: %d] comment => %d\n", __func__, pc->orig_line, frm.pse[frm.pse_tos].indent_tmp); indent_comment(pc, frm.pse[frm.pse_tos].indent_tmp); } else if (pc->type == CT_PREPROC) { /* Preprocs are always in column 1. See indent_preproc() */ if (pc->column != 1) { reindent_line(pc, 1); } } else { if (pc->column != indent_column) { LOG_FMT(LINDENT, "%s: %d] indent => %d [%.*s]\n", __func__, pc->orig_line, indent_column, pc->len, pc->str); reindent_line(pc, indent_column); } } did_newline = false; } /** * Handle variable definition continuation indenting */ if ((pc->type == CT_WORD) && ((pc->flags & PCF_IN_FCN_DEF) == 0) && ((pc->flags & PCF_VAR_1ST_DEF) == PCF_VAR_1ST_DEF)) { vardefcol = pc->column; } if (chunk_is_semicolon(pc) || ((pc->type == CT_BRACE_OPEN) && (pc->parent_type == CT_FUNCTION))) { vardefcol = 0; } /* if we hit a newline, reset indent_tmp */ if (chunk_is_newline(pc) || (pc->type == CT_COMMENT_MULTI) || (pc->type == CT_COMMENT_CPP)) { frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; /** * Handle the case of a multi-line #define w/o anything on the * first line (indent_tmp will be 1 or 0) */ if ((pc->type == CT_NL_CONT) && (frm.pse[frm.pse_tos].indent_tmp <= indent_size)) { frm.pse[frm.pse_tos].indent_tmp = indent_size + 1; } /* Get ready to indent the next item */ did_newline = true; } if (!chunk_is_comment(pc) && !chunk_is_newline(pc)) { prev = pc; } pc = chunk_get_next(pc); } /* Throw out any stuff inside a preprocessor - no need to warn */ while ((frm.pse_tos > 0) && frm.pse[frm.pse_tos].in_preproc) { indent_pse_pop(frm, pc); } for (idx = 1; idx <= frm.pse_tos; idx++) { LOG_FMT(LWARN, "%s:%d Unmatched %s\n", cpd.filename, frm.pse[idx].open_line, get_token_name(frm.pse[idx].type)); cpd.error_count++; } } /** * returns true if forward scan reveals only single newlines or comments * stops when hits code * false if next thing hit is a closing brace, also if 2 newlines in a row */ static bool single_line_comment_indent_rule_applies(chunk_t *start) { chunk_t *pc = start; int nl_count = 0; if (!chunk_is_single_line_comment(pc)) { return(false); } /* scan forward, if only single newlines and comments before next line of code, we want to apply */ while ((pc = chunk_get_next(pc)) != NULL) { if (chunk_is_newline(pc)) { if (nl_count > 0 || pc->nl_count > 1) { return(false); } nl_count++; } else { nl_count = 0; if (!chunk_is_single_line_comment(pc)) { /* here we check for things to run into that we wouldn't want to indent the comment for */ /* for example, non-single line comment, closing brace */ if (chunk_is_comment(pc) || chunk_is_closing_brace(pc)) { return(false); } return(true); } } } return(false); } /** * REVISIT: This needs to be re-checked, maybe cleaned up * * Indents comments in a (hopefully) smart manner. * * There are two type of comments that get indented: * - stand alone (ie, no tokens on the line before the comment) * - trailing comments (last token on the line apart from a linefeed) * + note that a stand-alone comment is a special case of a trailing * * The stand alone comments will get indented in one of three ways: * - column 1: * + There is an empty line before the comment AND the indent level is 0 * + The comment was originally in column 1 * * - Same column as trailing comment on previous line (ie, aligned) * + if originally within TBD (3) columns of the previous comment * * - syntax indent level * + doesn't fit in the previous categories * * Options modify this behavior: * - keep original column (don't move the comment, if possible) * - keep relative column (move out the same amount as first item on line) * - fix trailing comment in column TBD * * @param pc The comment, which is the first item on a line * @param col The column if this is to be put at indent level */ static void indent_comment(chunk_t *pc, int col) { chunk_t *nl; chunk_t *prev; LOG_FMT(LCMTIND, "%s: line %d, col %d, level %d: ", __func__, pc->orig_line, pc->orig_col, pc->level); /* force column 1 comment to column 1 if not changing them */ if ((pc->orig_col == 1) && !cpd.settings[UO_indent_col1_comment].b) { LOG_FMT(LCMTIND, "rule 1 - keep in col 1\n"); pc->column = 1; return; } nl = chunk_get_prev(pc); /* outside of any expression or statement? */ if (pc->level == 0) { if ((nl != NULL) && (nl->nl_count > 1)) { LOG_FMT(LCMTIND, "rule 2 - level 0, nl before\n"); pc->column = 1; return; } } prev = chunk_get_prev(nl); if (chunk_is_comment(prev) && (nl->nl_count == 1)) { int coldiff = prev->orig_col - pc->orig_col; if ((coldiff <= 3) && (coldiff >= -3)) { pc->column = prev->column; LOG_FMT(LCMTIND, "rule 3 - prev comment, coldiff = %d, now in %d\n", coldiff, pc->column); return; } } /* check if special single line comment rule applies */ if (cpd.settings[UO_indent_sing_line_comments].n > 0 && single_line_comment_indent_rule_applies(pc)) { pc->column = col + cpd.settings[UO_indent_sing_line_comments].n; LOG_FMT(LCMTIND, "rule 4 - single line comment indent, now in %d\n", pc->column); return; } LOG_FMT(LCMTIND, "rule 5 - fall-through, stay in %d\n", col); pc->column = col; } /** * Put spaces on either side of the preproc (#) symbol. * This is done by pointing pc->str into pp_str and adjusting the * length. */ void indent_preproc(void) { chunk_t *pc; chunk_t *next; int pp_level; int pp_level_sub = 0; int tmp; /* Define a string of 16 spaces + # + 16 spaces */ static const char *pp_str = " # "; static const char *alt_str = " %: "; /* Scan to see if the whole file is covered by one #ifdef */ int stage = 0; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (chunk_is_comment(pc) || chunk_is_newline(pc)) { continue; } if (stage == 0) { /* Check the first PP, make sure it is an #if type */ if (pc->type != CT_PREPROC) { break; } next = chunk_get_next(pc); if ((next == NULL) || (next->type != CT_PP_IF)) { break; } stage = 1; } else if (stage == 1) { /* Scan until a PP at level 0 is found - the close to the #if */ if ((pc->type == CT_PREPROC) && (pc->pp_level == 0)) { stage = 2; } continue; } else if (stage == 2) { /* We should only see the rest of the preprocessor */ if ((pc->type == CT_PREPROC) || ((pc->flags & PCF_IN_PREPROC) == 0)) { stage = 0; break; } } } if (stage == 2) { LOG_FMT(LINFO, "The whole file is covered by a #IF\n"); pp_level_sub = 1; } for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type != CT_PREPROC) { continue; } if (pc->column != 1) { /* Don't handle preprocessors that aren't in column 1 */ LOG_FMT(LINFO, "%s: Line %d doesn't start in column 1 (%d)\n", __func__, pc->orig_line, pc->column); continue; } /* point into pp_str */ if (pc->len == 2) { /* alternate token crap */ pc->str = &alt_str[16]; } else { pc->str = &pp_str[16]; } pp_level = pc->pp_level - pp_level_sub; if (pp_level < 0) { pp_level = 0; } else if (pp_level > 16) { pp_level = 16; } /* Note that the indent is removed by default */ if ((cpd.settings[UO_pp_indent].a & AV_ADD) != 0) { /* Need to add some spaces */ pc->str -= pp_level; pc->len += pp_level; } else if (cpd.settings[UO_pp_indent].a == AV_IGNORE) { tmp = (pc->orig_col <= 16) ? pc->orig_col - 1 : 16; pc->str -= tmp; pc->len += tmp; } /* Add spacing by adjusting the length */ if ((cpd.settings[UO_pp_space].a & AV_ADD) != 0) { pc->len += pp_level; } next = chunk_get_next(pc); if (next != NULL) { reindent_line(next, pc->len + 1); } LOG_FMT(LPPIS, "%s: Indent line %d to %d (len %d, next->col %d)\n", __func__, pc->orig_line, pp_level, pc->len, next->column); } } uncrustify-0.59/tests/input/c/align-proto-vars.c0000644000175000017500000000031011506773275016705 00000000000000int doStuff(int i, float f ); int doStuff(int i, float f ); MACRO_MODIFIER int doStuff(int i, float f ); typedef void (*my_callback)(int id, void *context); uncrustify-0.59/tests/input/c/deref.c0000644000175000017500000000047111506773275014576 00000000000000void foo(int *pA, int *pB) { *pB = some.arr[*pA]; foo(sizeof bar / sizeof * bar, baz); } #define MEM_READ_BYTE(phwi, addr, data) \ * data = * ((PUCHAR)((phwi)->m_pVirtualMemory + addr)) #define MEM_WRITE_BYTE(phwi, addr, data) \ * ((PUCHAR)((phwi)->m_pVirtualMemory + addr)) = (UCHAR)(data) uncrustify-0.59/tests/input/c/func_call_user.c0000644000175000017500000000014511506773275016473 00000000000000int func(n) { int a = foo (); char *a = _("some text"); char *str = N_("other text"); } uncrustify-0.59/tests/input/c/freebsd1.c0000644000175000017500000000051111506773275015177 00000000000000void foo (void) { int a1, a2; /* Declare ints, too, don't default them. */ float fl; /* Beware double vs. float prototype differences. */ int a4; /* List in order declared. * seconds line */ if (foo) bar(); } uncrustify-0.59/tests/input/c/nl-comment.c0000644000175000017500000000110411506773275015554 00000000000000namespace foo { /** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines /* multi-line comment */ idx = 50; /* single line comment */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; // some comment // almost continued, but a NL in between i++; // col1 comment in level 1 // second comment return(res); } // col1 comment in level 0 // and another } uncrustify-0.59/tests/input/c/vb-pp.c0000644000175000017500000000037411506773275014537 00000000000000 void f() { if(0) #pragma omp atomic i++; } void f() { if(0) #if foo i++; #else i+=2; #endif } void f() { while(108) { if(42) #pragma omp critical { } if(23) #pragma omp critical ++i; while (16) { } int i = 15; if(8) #pragma omp atomic i += 4; } } uncrustify-0.59/tests/input/c/directfb.h0000644000175000017500000024217511506773275015311 00000000000000# 1 "/usr/include/directfb/directfb.h" # 1 "" # 1 "" # 1 "/usr/include/directfb/directfb.h" # 31 "/usr/include/directfb/directfb.h" # 1 "/usr/include/directfb/dfb_types.h" 1 # 1 "/usr/include/sys/types.h" 1 3 4 # 27 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/features.h" 1 3 4 # 308 "/usr/include/features.h" 3 4 # 1 "/usr/include/sys/cdefs.h" 1 3 4 # 309 "/usr/include/features.h" 2 3 4 # 331 "/usr/include/features.h" 3 4 # 1 "/usr/include/gnu/stubs.h" 1 3 4 # 332 "/usr/include/features.h" 2 3 4 # 28 "/usr/include/sys/types.h" 2 3 4 # 1 "/usr/include/bits/types.h" 1 3 4 # 28 "/usr/include/bits/types.h" 3 4 # 1 "/usr/include/bits/wordsize.h" 1 3 4 # 29 "/usr/include/bits/types.h" 2 3 4 # 1 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/stddef.h" 1 3 4 # 214 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/stddef.h" 3 4 typedef unsigned int size_t; # 32 "/usr/include/bits/types.h" 2 3 4 typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; __extension__ typedef long long int __quad_t; __extension__ typedef unsigned long long int __u_quad_t; # 129 "/usr/include/bits/types.h" 3 4 # 1 "/usr/include/bits/typesizes.h" 1 3 4 # 130 "/usr/include/bits/types.h" 2 3 4 __extension__ typedef __u_quad_t __dev_t; __extension__ typedef unsigned int __uid_t; __extension__ typedef unsigned int __gid_t; __extension__ typedef unsigned long int __ino_t; __extension__ typedef __u_quad_t __ino64_t; __extension__ typedef unsigned int __mode_t; __extension__ typedef unsigned int __nlink_t; __extension__ typedef long int __off_t; __extension__ typedef __quad_t __off64_t; __extension__ typedef int __pid_t; __extension__ typedef struct { int __val[2]; } __fsid_t; __extension__ typedef long int __clock_t; __extension__ typedef unsigned long int __rlim_t; __extension__ typedef __u_quad_t __rlim64_t; __extension__ typedef unsigned int __id_t; __extension__ typedef long int __time_t; __extension__ typedef unsigned int __useconds_t; __extension__ typedef long int __suseconds_t; __extension__ typedef int __daddr_t; __extension__ typedef long int __swblk_t; __extension__ typedef int __key_t; __extension__ typedef int __clockid_t; __extension__ typedef int __timer_t; __extension__ typedef long int __blksize_t; __extension__ typedef long int __blkcnt_t; __extension__ typedef __quad_t __blkcnt64_t; __extension__ typedef unsigned long int __fsblkcnt_t; __extension__ typedef __u_quad_t __fsblkcnt64_t; __extension__ typedef unsigned long int __fsfilcnt_t; __extension__ typedef __u_quad_t __fsfilcnt64_t; __extension__ typedef int __ssize_t; typedef __off64_t __loff_t; typedef __quad_t *__qaddr_t; typedef char *__caddr_t; __extension__ typedef int __intptr_t; __extension__ typedef unsigned int __socklen_t; # 32 "/usr/include/sys/types.h" 2 3 4 typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; typedef __loff_t loff_t; typedef __ino_t ino_t; # 62 "/usr/include/sys/types.h" 3 4 typedef __dev_t dev_t; typedef __gid_t gid_t; typedef __mode_t mode_t; typedef __nlink_t nlink_t; typedef __uid_t uid_t; typedef __off_t off_t; # 100 "/usr/include/sys/types.h" 3 4 typedef __pid_t pid_t; typedef __id_t id_t; typedef __ssize_t ssize_t; typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; typedef __key_t key_t; # 133 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/time.h" 1 3 4 # 74 "/usr/include/time.h" 3 4 typedef __time_t time_t; # 92 "/usr/include/time.h" 3 4 typedef __clockid_t clockid_t; # 104 "/usr/include/time.h" 3 4 typedef __timer_t timer_t; # 134 "/usr/include/sys/types.h" 2 3 4 # 147 "/usr/include/sys/types.h" 3 4 # 1 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/stddef.h" 1 3 4 # 148 "/usr/include/sys/types.h" 2 3 4 typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; # 191 "/usr/include/sys/types.h" 3 4 typedef int int8_t __attribute__ ((__mode__ (__QI__))); typedef int int16_t __attribute__ ((__mode__ (__HI__))); typedef int int32_t __attribute__ ((__mode__ (__SI__))); typedef int int64_t __attribute__ ((__mode__ (__DI__))); typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__))); typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__))); typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__))); typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__))); typedef int register_t __attribute__ ((__mode__ (__word__))); # 213 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/endian.h" 1 3 4 # 37 "/usr/include/endian.h" 3 4 # 1 "/usr/include/bits/endian.h" 1 3 4 # 38 "/usr/include/endian.h" 2 3 4 # 214 "/usr/include/sys/types.h" 2 3 4 # 1 "/usr/include/sys/select.h" 1 3 4 # 31 "/usr/include/sys/select.h" 3 4 # 1 "/usr/include/bits/select.h" 1 3 4 # 32 "/usr/include/sys/select.h" 2 3 4 # 1 "/usr/include/bits/sigset.h" 1 3 4 # 23 "/usr/include/bits/sigset.h" 3 4 typedef int __sig_atomic_t; typedef struct { unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; } __sigset_t; # 35 "/usr/include/sys/select.h" 2 3 4 typedef __sigset_t sigset_t; # 1 "/usr/include/time.h" 1 3 4 # 118 "/usr/include/time.h" 3 4 struct timespec { __time_t tv_sec; long int tv_nsec; }; # 45 "/usr/include/sys/select.h" 2 3 4 # 1 "/usr/include/bits/time.h" 1 3 4 # 69 "/usr/include/bits/time.h" 3 4 struct timeval { __time_t tv_sec; __suseconds_t tv_usec; }; # 47 "/usr/include/sys/select.h" 2 3 4 typedef __suseconds_t suseconds_t; typedef long int __fd_mask; # 67 "/usr/include/sys/select.h" 3 4 typedef struct { __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))]; } fd_set; typedef __fd_mask fd_mask; # 99 "/usr/include/sys/select.h" 3 4 # 109 "/usr/include/sys/select.h" 3 4 extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); # 128 "/usr/include/sys/select.h" 3 4 # 217 "/usr/include/sys/types.h" 2 3 4 # 1 "/usr/include/sys/sysmacros.h" 1 3 4 # 29 "/usr/include/sys/sysmacros.h" 3 4 __extension__ extern __inline unsigned int gnu_dev_major (unsigned long long int __dev) __attribute__ ((__nothrow__)); __extension__ extern __inline unsigned int gnu_dev_minor (unsigned long long int __dev) __attribute__ ((__nothrow__)); __extension__ extern __inline unsigned long long int gnu_dev_makedev (unsigned int __major, unsigned int __minor) __attribute__ ((__nothrow__)); __extension__ extern __inline unsigned int __attribute__ ((__nothrow__)) gnu_dev_major (unsigned long long int __dev) { return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff); } __extension__ extern __inline unsigned int __attribute__ ((__nothrow__)) gnu_dev_minor (unsigned long long int __dev) { return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff); } __extension__ extern __inline unsigned long long int __attribute__ ((__nothrow__)) gnu_dev_makedev (unsigned int __major, unsigned int __minor) { return ((__minor & 0xff) | ((__major & 0xfff) << 8) | (((unsigned long long int) (__minor & ~0xff)) << 12) | (((unsigned long long int) (__major & ~0xfff)) << 32)); } # 220 "/usr/include/sys/types.h" 2 3 4 # 231 "/usr/include/sys/types.h" 3 4 typedef __blkcnt_t blkcnt_t; typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; # 266 "/usr/include/sys/types.h" 3 4 # 1 "/usr/include/bits/pthreadtypes.h" 1 3 4 # 23 "/usr/include/bits/pthreadtypes.h" 3 4 # 1 "/usr/include/bits/sched.h" 1 3 4 # 83 "/usr/include/bits/sched.h" 3 4 struct __sched_param { int __sched_priority; }; # 24 "/usr/include/bits/pthreadtypes.h" 2 3 4 typedef int __atomic_lock_t; struct _pthread_fastlock { long int __status; __atomic_lock_t __spinlock; }; typedef struct _pthread_descr_struct *_pthread_descr; typedef struct __pthread_attr_s { int __detachstate; int __schedpolicy; struct __sched_param __schedparam; int __inheritsched; int __scope; size_t __guardsize; int __stackaddr_set; void *__stackaddr; size_t __stacksize; } pthread_attr_t; __extension__ typedef long long __pthread_cond_align_t; typedef struct { struct _pthread_fastlock __c_lock; _pthread_descr __c_waiting; char __padding[48 - sizeof (struct _pthread_fastlock) - sizeof (_pthread_descr) - sizeof (__pthread_cond_align_t)]; __pthread_cond_align_t __align; } pthread_cond_t; typedef struct { int __dummy; } pthread_condattr_t; typedef unsigned int pthread_key_t; typedef struct { int __m_reserved; int __m_count; _pthread_descr __m_owner; int __m_kind; struct _pthread_fastlock __m_lock; } pthread_mutex_t; typedef struct { int __mutexkind; } pthread_mutexattr_t; typedef int pthread_once_t; # 152 "/usr/include/bits/pthreadtypes.h" 3 4 typedef unsigned long int pthread_t; # 267 "/usr/include/sys/types.h" 2 3 4 # 5 "/usr/include/directfb/dfb_types.h" 2 # 1 "/usr/include/linux/types.h" 1 3 4 # 1 "/usr/include/linux/posix_types.h" 1 3 4 # 1 "/usr/include/linux/stddef.h" 1 3 4 # 5 "/usr/include/linux/posix_types.h" 2 3 4 # 36 "/usr/include/linux/posix_types.h" 3 4 typedef struct { unsigned long fds_bits [(1024/(8 * sizeof(unsigned long)))]; } __kernel_fd_set; typedef void (*__kernel_sighandler_t)(int); typedef int __kernel_key_t; typedef int __kernel_mqd_t; # 1 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/asm/posix_types.h" 1 3 4 # 14 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/asm/posix_types.h" 3 4 # 1 "/usr/include/asm/posix_types.h" 1 3 4 # 11 "/usr/include/asm/posix_types.h" 3 4 # 1 "/usr/include/asm-i386/posix_types.h" 1 3 4 # 10 "/usr/include/asm-i386/posix_types.h" 3 4 typedef unsigned long __kernel_ino_t; typedef unsigned short __kernel_mode_t; typedef unsigned short __kernel_nlink_t; typedef long __kernel_off_t; typedef int __kernel_pid_t; typedef unsigned short __kernel_ipc_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; typedef unsigned short __kernel_old_dev_t; typedef long long __kernel_loff_t; typedef struct { int __val[2]; } __kernel_fsid_t; # 12 "/usr/include/asm/posix_types.h" 2 3 4 # 15 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/asm/posix_types.h" 2 3 4 # 48 "/usr/include/linux/posix_types.h" 2 3 4 # 6 "/usr/include/linux/types.h" 2 3 4 # 1 "/usr/include/asm/types.h" 1 3 4 # 11 "/usr/include/asm/types.h" 3 4 # 1 "/usr/include/asm-i386/types.h" 1 3 4 typedef unsigned short umode_t; typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; typedef __signed__ long long __s64; typedef unsigned long long __u64; # 12 "/usr/include/asm/types.h" 2 3 4 # 7 "/usr/include/linux/types.h" 2 3 4 # 133 "/usr/include/linux/types.h" 3 4 typedef __u16 __le16; typedef __u16 __be16; typedef __u32 __le32; typedef __u32 __be32; typedef __u64 __le64; typedef __u64 __be64; # 6 "/usr/include/directfb/dfb_types.h" 2 # 32 "/usr/include/directfb/directfb.h" 2 # 1 "/usr/include/sys/time.h" 1 3 4 # 26 "/usr/include/sys/time.h" 3 4 # 1 "/usr/include/time.h" 1 3 4 # 27 "/usr/include/sys/time.h" 2 3 4 # 1 "/usr/include/bits/time.h" 1 3 4 # 29 "/usr/include/sys/time.h" 2 3 4 # 38 "/usr/include/sys/time.h" 3 4 # 56 "/usr/include/sys/time.h" 3 4 struct timezone { int tz_minuteswest; int tz_dsttime; }; typedef struct timezone *__restrict __timezone_ptr_t; # 72 "/usr/include/sys/time.h" 3 4 extern int gettimeofday (struct timeval *__restrict __tv, __timezone_ptr_t __tz) __attribute__ ((__nothrow__)); extern int settimeofday (__const struct timeval *__tv, __const struct timezone *__tz) __attribute__ ((__nothrow__)); extern int adjtime (__const struct timeval *__delta, struct timeval *__olddelta) __attribute__ ((__nothrow__)); enum __itimer_which { ITIMER_REAL = 0, ITIMER_VIRTUAL = 1, ITIMER_PROF = 2 }; struct itimerval { struct timeval it_interval; struct timeval it_value; }; typedef int __itimer_which_t; extern int getitimer (__itimer_which_t __which, struct itimerval *__value) __attribute__ ((__nothrow__)); extern int setitimer (__itimer_which_t __which, __const struct itimerval *__restrict __new, struct itimerval *__restrict __old) __attribute__ ((__nothrow__)); extern int utimes (__const char *__file, __const struct timeval __tvp[2]) __attribute__ ((__nothrow__)); extern int lutimes (__const char *__file, __const struct timeval __tvp[2]) __attribute__ ((__nothrow__)); extern int futimes (int __fd, __const struct timeval __tvp[2]) __attribute__ ((__nothrow__)); # 181 "/usr/include/sys/time.h" 3 4 # 33 "/usr/include/directfb/directfb.h" 2 # 1 "/usr/include/directfb/directfb_keyboard.h" 1 # 40 "/usr/include/directfb/directfb_keyboard.h" typedef enum { DIKT_UNICODE = 0x0000, DIKT_SPECIAL = 0xF000, DIKT_FUNCTION = 0xF100, DIKT_MODIFIER = 0xF200, DIKT_LOCK = 0xF300, DIKT_DEAD = 0xF400, DIKT_CUSTOM = 0xF500, DIKT_IDENTIFIER = 0xF600 } DFBInputDeviceKeyType; # 71 "/usr/include/directfb/directfb_keyboard.h" typedef enum { DIMKI_SHIFT, DIMKI_CONTROL, DIMKI_ALT, DIMKI_ALTGR, DIMKI_META, DIMKI_SUPER, DIMKI_HYPER, DIMKI_FIRST = DIMKI_SHIFT, DIMKI_LAST = DIMKI_HYPER } DFBInputDeviceModifierKeyIdentifier; typedef enum { DIKI_UNKNOWN = ((DIKT_IDENTIFIER) | (0)), DIKI_A, DIKI_B, DIKI_C, DIKI_D, DIKI_E, DIKI_F, DIKI_G, DIKI_H, DIKI_I, DIKI_J, DIKI_K, DIKI_L, DIKI_M, DIKI_N, DIKI_O, DIKI_P, DIKI_Q, DIKI_R, DIKI_S, DIKI_T, DIKI_U, DIKI_V, DIKI_W, DIKI_X, DIKI_Y, DIKI_Z, DIKI_0, DIKI_1, DIKI_2, DIKI_3, DIKI_4, DIKI_5, DIKI_6, DIKI_7, DIKI_8, DIKI_9, DIKI_F1, DIKI_F2, DIKI_F3, DIKI_F4, DIKI_F5, DIKI_F6, DIKI_F7, DIKI_F8, DIKI_F9, DIKI_F10, DIKI_F11, DIKI_F12, DIKI_SHIFT_L, DIKI_SHIFT_R, DIKI_CONTROL_L, DIKI_CONTROL_R, DIKI_ALT_L, DIKI_ALT_R, DIKI_ALTGR, DIKI_META_L, DIKI_META_R, DIKI_SUPER_L, DIKI_SUPER_R, DIKI_HYPER_L, DIKI_HYPER_R, DIKI_CAPS_LOCK, DIKI_NUM_LOCK, DIKI_SCROLL_LOCK, DIKI_ESCAPE, DIKI_LEFT, DIKI_RIGHT, DIKI_UP, DIKI_DOWN, DIKI_TAB, DIKI_ENTER, DIKI_SPACE, DIKI_BACKSPACE, DIKI_INSERT, DIKI_DELETE, DIKI_HOME, DIKI_END, DIKI_PAGE_UP, DIKI_PAGE_DOWN, DIKI_PRINT, DIKI_PAUSE, DIKI_QUOTE_LEFT, DIKI_MINUS_SIGN, DIKI_EQUALS_SIGN, DIKI_BRACKET_LEFT, DIKI_BRACKET_RIGHT, DIKI_BACKSLASH, DIKI_SEMICOLON, DIKI_QUOTE_RIGHT, DIKI_COMMA, DIKI_PERIOD, DIKI_SLASH, DIKI_LESS_SIGN, DIKI_KP_DIV, DIKI_KP_MULT, DIKI_KP_MINUS, DIKI_KP_PLUS, DIKI_KP_ENTER, DIKI_KP_SPACE, DIKI_KP_TAB, DIKI_KP_F1, DIKI_KP_F2, DIKI_KP_F3, DIKI_KP_F4, DIKI_KP_EQUAL, DIKI_KP_SEPARATOR, DIKI_KP_DECIMAL, DIKI_KP_0, DIKI_KP_1, DIKI_KP_2, DIKI_KP_3, DIKI_KP_4, DIKI_KP_5, DIKI_KP_6, DIKI_KP_7, DIKI_KP_8, DIKI_KP_9, DIKI_KEYDEF_END, DIKI_NUMBER_OF_KEYS = DIKI_KEYDEF_END - ((DIKT_IDENTIFIER) | (0)) } DFBInputDeviceKeyIdentifier; typedef enum { DIKS_NULL = ((DIKT_UNICODE) | (0x00)), DIKS_BACKSPACE = ((DIKT_UNICODE) | (0x08)), DIKS_TAB = ((DIKT_UNICODE) | (0x09)), DIKS_RETURN = ((DIKT_UNICODE) | (0x0D)), DIKS_CANCEL = ((DIKT_UNICODE) | (0x18)), DIKS_ESCAPE = ((DIKT_UNICODE) | (0x1B)), DIKS_SPACE = ((DIKT_UNICODE) | (0x20)), DIKS_EXCLAMATION_MARK = ((DIKT_UNICODE) | (0x21)), DIKS_QUOTATION = ((DIKT_UNICODE) | (0x22)), DIKS_NUMBER_SIGN = ((DIKT_UNICODE) | (0x23)), DIKS_DOLLAR_SIGN = ((DIKT_UNICODE) | (0x24)), DIKS_PERCENT_SIGN = ((DIKT_UNICODE) | (0x25)), DIKS_AMPERSAND = ((DIKT_UNICODE) | (0x26)), DIKS_APOSTROPHE = ((DIKT_UNICODE) | (0x27)), DIKS_PARENTHESIS_LEFT = ((DIKT_UNICODE) | (0x28)), DIKS_PARENTHESIS_RIGHT = ((DIKT_UNICODE) | (0x29)), DIKS_ASTERISK = ((DIKT_UNICODE) | (0x2A)), DIKS_PLUS_SIGN = ((DIKT_UNICODE) | (0x2B)), DIKS_COMMA = ((DIKT_UNICODE) | (0x2C)), DIKS_MINUS_SIGN = ((DIKT_UNICODE) | (0x2D)), DIKS_PERIOD = ((DIKT_UNICODE) | (0x2E)), DIKS_SLASH = ((DIKT_UNICODE) | (0x2F)), DIKS_0 = ((DIKT_UNICODE) | (0x30)), DIKS_1 = ((DIKT_UNICODE) | (0x31)), DIKS_2 = ((DIKT_UNICODE) | (0x32)), DIKS_3 = ((DIKT_UNICODE) | (0x33)), DIKS_4 = ((DIKT_UNICODE) | (0x34)), DIKS_5 = ((DIKT_UNICODE) | (0x35)), DIKS_6 = ((DIKT_UNICODE) | (0x36)), DIKS_7 = ((DIKT_UNICODE) | (0x37)), DIKS_8 = ((DIKT_UNICODE) | (0x38)), DIKS_9 = ((DIKT_UNICODE) | (0x39)), DIKS_COLON = ((DIKT_UNICODE) | (0x3A)), DIKS_SEMICOLON = ((DIKT_UNICODE) | (0x3B)), DIKS_LESS_THAN_SIGN = ((DIKT_UNICODE) | (0x3C)), DIKS_EQUALS_SIGN = ((DIKT_UNICODE) | (0x3D)), DIKS_GREATER_THAN_SIGN = ((DIKT_UNICODE) | (0x3E)), DIKS_QUESTION_MARK = ((DIKT_UNICODE) | (0x3F)), DIKS_AT = ((DIKT_UNICODE) | (0x40)), DIKS_CAPITAL_A = ((DIKT_UNICODE) | (0x41)), DIKS_CAPITAL_B = ((DIKT_UNICODE) | (0x42)), DIKS_CAPITAL_C = ((DIKT_UNICODE) | (0x43)), DIKS_CAPITAL_D = ((DIKT_UNICODE) | (0x44)), DIKS_CAPITAL_E = ((DIKT_UNICODE) | (0x45)), DIKS_CAPITAL_F = ((DIKT_UNICODE) | (0x46)), DIKS_CAPITAL_G = ((DIKT_UNICODE) | (0x47)), DIKS_CAPITAL_H = ((DIKT_UNICODE) | (0x48)), DIKS_CAPITAL_I = ((DIKT_UNICODE) | (0x49)), DIKS_CAPITAL_J = ((DIKT_UNICODE) | (0x4A)), DIKS_CAPITAL_K = ((DIKT_UNICODE) | (0x4B)), DIKS_CAPITAL_L = ((DIKT_UNICODE) | (0x4C)), DIKS_CAPITAL_M = ((DIKT_UNICODE) | (0x4D)), DIKS_CAPITAL_N = ((DIKT_UNICODE) | (0x4E)), DIKS_CAPITAL_O = ((DIKT_UNICODE) | (0x4F)), DIKS_CAPITAL_P = ((DIKT_UNICODE) | (0x50)), DIKS_CAPITAL_Q = ((DIKT_UNICODE) | (0x51)), DIKS_CAPITAL_R = ((DIKT_UNICODE) | (0x52)), DIKS_CAPITAL_S = ((DIKT_UNICODE) | (0x53)), DIKS_CAPITAL_T = ((DIKT_UNICODE) | (0x54)), DIKS_CAPITAL_U = ((DIKT_UNICODE) | (0x55)), DIKS_CAPITAL_V = ((DIKT_UNICODE) | (0x56)), DIKS_CAPITAL_W = ((DIKT_UNICODE) | (0x57)), DIKS_CAPITAL_X = ((DIKT_UNICODE) | (0x58)), DIKS_CAPITAL_Y = ((DIKT_UNICODE) | (0x59)), DIKS_CAPITAL_Z = ((DIKT_UNICODE) | (0x5A)), DIKS_SQUARE_BRACKET_LEFT = ((DIKT_UNICODE) | (0x5B)), DIKS_BACKSLASH = ((DIKT_UNICODE) | (0x5C)), DIKS_SQUARE_BRACKET_RIGHT = ((DIKT_UNICODE) | (0x5D)), DIKS_CIRCUMFLEX_ACCENT = ((DIKT_UNICODE) | (0x5E)), DIKS_UNDERSCORE = ((DIKT_UNICODE) | (0x5F)), DIKS_GRAVE_ACCENT = ((DIKT_UNICODE) | (0x60)), DIKS_SMALL_A = ((DIKT_UNICODE) | (0x61)), DIKS_SMALL_B = ((DIKT_UNICODE) | (0x62)), DIKS_SMALL_C = ((DIKT_UNICODE) | (0x63)), DIKS_SMALL_D = ((DIKT_UNICODE) | (0x64)), DIKS_SMALL_E = ((DIKT_UNICODE) | (0x65)), DIKS_SMALL_F = ((DIKT_UNICODE) | (0x66)), DIKS_SMALL_G = ((DIKT_UNICODE) | (0x67)), DIKS_SMALL_H = ((DIKT_UNICODE) | (0x68)), DIKS_SMALL_I = ((DIKT_UNICODE) | (0x69)), DIKS_SMALL_J = ((DIKT_UNICODE) | (0x6A)), DIKS_SMALL_K = ((DIKT_UNICODE) | (0x6B)), DIKS_SMALL_L = ((DIKT_UNICODE) | (0x6C)), DIKS_SMALL_M = ((DIKT_UNICODE) | (0x6D)), DIKS_SMALL_N = ((DIKT_UNICODE) | (0x6E)), DIKS_SMALL_O = ((DIKT_UNICODE) | (0x6F)), DIKS_SMALL_P = ((DIKT_UNICODE) | (0x70)), DIKS_SMALL_Q = ((DIKT_UNICODE) | (0x71)), DIKS_SMALL_R = ((DIKT_UNICODE) | (0x72)), DIKS_SMALL_S = ((DIKT_UNICODE) | (0x73)), DIKS_SMALL_T = ((DIKT_UNICODE) | (0x74)), DIKS_SMALL_U = ((DIKT_UNICODE) | (0x75)), DIKS_SMALL_V = ((DIKT_UNICODE) | (0x76)), DIKS_SMALL_W = ((DIKT_UNICODE) | (0x77)), DIKS_SMALL_X = ((DIKT_UNICODE) | (0x78)), DIKS_SMALL_Y = ((DIKT_UNICODE) | (0x79)), DIKS_SMALL_Z = ((DIKT_UNICODE) | (0x7A)), DIKS_CURLY_BRACKET_LEFT = ((DIKT_UNICODE) | (0x7B)), DIKS_VERTICAL_BAR = ((DIKT_UNICODE) | (0x7C)), DIKS_CURLY_BRACKET_RIGHT = ((DIKT_UNICODE) | (0x7D)), DIKS_TILDE = ((DIKT_UNICODE) | (0x7E)), DIKS_DELETE = ((DIKT_UNICODE) | (0x7F)), DIKS_ENTER = DIKS_RETURN, DIKS_CURSOR_LEFT = ((DIKT_SPECIAL) | (0x00)), DIKS_CURSOR_RIGHT = ((DIKT_SPECIAL) | (0x01)), DIKS_CURSOR_UP = ((DIKT_SPECIAL) | (0x02)), DIKS_CURSOR_DOWN = ((DIKT_SPECIAL) | (0x03)), DIKS_INSERT = ((DIKT_SPECIAL) | (0x04)), DIKS_HOME = ((DIKT_SPECIAL) | (0x05)), DIKS_END = ((DIKT_SPECIAL) | (0x06)), DIKS_PAGE_UP = ((DIKT_SPECIAL) | (0x07)), DIKS_PAGE_DOWN = ((DIKT_SPECIAL) | (0x08)), DIKS_PRINT = ((DIKT_SPECIAL) | (0x09)), DIKS_PAUSE = ((DIKT_SPECIAL) | (0x0A)), DIKS_OK = ((DIKT_SPECIAL) | (0x0B)), DIKS_SELECT = ((DIKT_SPECIAL) | (0x0C)), DIKS_GOTO = ((DIKT_SPECIAL) | (0x0D)), DIKS_CLEAR = ((DIKT_SPECIAL) | (0x0E)), DIKS_POWER = ((DIKT_SPECIAL) | (0x0F)), DIKS_POWER2 = ((DIKT_SPECIAL) | (0x10)), DIKS_OPTION = ((DIKT_SPECIAL) | (0x11)), DIKS_MENU = ((DIKT_SPECIAL) | (0x12)), DIKS_HELP = ((DIKT_SPECIAL) | (0x13)), DIKS_INFO = ((DIKT_SPECIAL) | (0x14)), DIKS_TIME = ((DIKT_SPECIAL) | (0x15)), DIKS_VENDOR = ((DIKT_SPECIAL) | (0x16)), DIKS_ARCHIVE = ((DIKT_SPECIAL) | (0x17)), DIKS_PROGRAM = ((DIKT_SPECIAL) | (0x18)), DIKS_CHANNEL = ((DIKT_SPECIAL) | (0x19)), DIKS_FAVORITES = ((DIKT_SPECIAL) | (0x1A)), DIKS_EPG = ((DIKT_SPECIAL) | (0x1B)), DIKS_PVR = ((DIKT_SPECIAL) | (0x1C)), DIKS_MHP = ((DIKT_SPECIAL) | (0x1D)), DIKS_LANGUAGE = ((DIKT_SPECIAL) | (0x1E)), DIKS_TITLE = ((DIKT_SPECIAL) | (0x1F)), DIKS_SUBTITLE = ((DIKT_SPECIAL) | (0x20)), DIKS_ANGLE = ((DIKT_SPECIAL) | (0x21)), DIKS_ZOOM = ((DIKT_SPECIAL) | (0x22)), DIKS_MODE = ((DIKT_SPECIAL) | (0x23)), DIKS_KEYBOARD = ((DIKT_SPECIAL) | (0x24)), DIKS_PC = ((DIKT_SPECIAL) | (0x25)), DIKS_SCREEN = ((DIKT_SPECIAL) | (0x26)), DIKS_TV = ((DIKT_SPECIAL) | (0x27)), DIKS_TV2 = ((DIKT_SPECIAL) | (0x28)), DIKS_VCR = ((DIKT_SPECIAL) | (0x29)), DIKS_VCR2 = ((DIKT_SPECIAL) | (0x2A)), DIKS_SAT = ((DIKT_SPECIAL) | (0x2B)), DIKS_SAT2 = ((DIKT_SPECIAL) | (0x2C)), DIKS_CD = ((DIKT_SPECIAL) | (0x2D)), DIKS_TAPE = ((DIKT_SPECIAL) | (0x2E)), DIKS_RADIO = ((DIKT_SPECIAL) | (0x2F)), DIKS_TUNER = ((DIKT_SPECIAL) | (0x30)), DIKS_PLAYER = ((DIKT_SPECIAL) | (0x31)), DIKS_TEXT = ((DIKT_SPECIAL) | (0x32)), DIKS_DVD = ((DIKT_SPECIAL) | (0x33)), DIKS_AUX = ((DIKT_SPECIAL) | (0x34)), DIKS_MP3 = ((DIKT_SPECIAL) | (0x35)), DIKS_PHONE = ((DIKT_SPECIAL) | (0x36)), DIKS_AUDIO = ((DIKT_SPECIAL) | (0x37)), DIKS_VIDEO = ((DIKT_SPECIAL) | (0x38)), DIKS_INTERNET = ((DIKT_SPECIAL) | (0x39)), DIKS_MAIL = ((DIKT_SPECIAL) | (0x3A)), DIKS_NEWS = ((DIKT_SPECIAL) | (0x3B)), DIKS_DIRECTORY = ((DIKT_SPECIAL) | (0x3C)), DIKS_LIST = ((DIKT_SPECIAL) | (0x3D)), DIKS_CALCULATOR = ((DIKT_SPECIAL) | (0x3E)), DIKS_MEMO = ((DIKT_SPECIAL) | (0x3F)), DIKS_CALENDAR = ((DIKT_SPECIAL) | (0x40)), DIKS_EDITOR = ((DIKT_SPECIAL) | (0x41)), DIKS_RED = ((DIKT_SPECIAL) | (0x42)), DIKS_GREEN = ((DIKT_SPECIAL) | (0x43)), DIKS_YELLOW = ((DIKT_SPECIAL) | (0x44)), DIKS_BLUE = ((DIKT_SPECIAL) | (0x45)), DIKS_CHANNEL_UP = ((DIKT_SPECIAL) | (0x46)), DIKS_CHANNEL_DOWN = ((DIKT_SPECIAL) | (0x47)), DIKS_BACK = ((DIKT_SPECIAL) | (0x48)), DIKS_FORWARD = ((DIKT_SPECIAL) | (0x49)), DIKS_FIRST = ((DIKT_SPECIAL) | (0x4A)), DIKS_LAST = ((DIKT_SPECIAL) | (0x4B)), DIKS_VOLUME_UP = ((DIKT_SPECIAL) | (0x4C)), DIKS_VOLUME_DOWN = ((DIKT_SPECIAL) | (0x4D)), DIKS_MUTE = ((DIKT_SPECIAL) | (0x4E)), DIKS_AB = ((DIKT_SPECIAL) | (0x4F)), DIKS_PLAYPAUSE = ((DIKT_SPECIAL) | (0x50)), DIKS_PLAY = ((DIKT_SPECIAL) | (0x51)), DIKS_STOP = ((DIKT_SPECIAL) | (0x52)), DIKS_RESTART = ((DIKT_SPECIAL) | (0x53)), DIKS_SLOW = ((DIKT_SPECIAL) | (0x54)), DIKS_FAST = ((DIKT_SPECIAL) | (0x55)), DIKS_RECORD = ((DIKT_SPECIAL) | (0x56)), DIKS_EJECT = ((DIKT_SPECIAL) | (0x57)), DIKS_SHUFFLE = ((DIKT_SPECIAL) | (0x58)), DIKS_REWIND = ((DIKT_SPECIAL) | (0x59)), DIKS_FASTFORWARD = ((DIKT_SPECIAL) | (0x5A)), DIKS_PREVIOUS = ((DIKT_SPECIAL) | (0x5B)), DIKS_NEXT = ((DIKT_SPECIAL) | (0x5C)), DIKS_BEGIN = ((DIKT_SPECIAL) | (0x5D)), DIKS_DIGITS = ((DIKT_SPECIAL) | (0x5E)), DIKS_TEEN = ((DIKT_SPECIAL) | (0x5F)), DIKS_TWEN = ((DIKT_SPECIAL) | (0x60)), DIKS_BREAK = ((DIKT_SPECIAL) | (0x61)), DIKS_EXIT = ((DIKT_SPECIAL) | (0x62)), DIKS_SETUP = ((DIKT_SPECIAL) | (0x63)), DIKS_CURSOR_LEFT_UP = ((DIKT_SPECIAL) | (0x64)), DIKS_CURSOR_LEFT_DOWN = ((DIKT_SPECIAL) | (0x65)), DIKS_CURSOR_UP_RIGHT = ((DIKT_SPECIAL) | (0x66)), DIKS_CURSOR_DOWN_RIGHT = ((DIKT_SPECIAL) | (0x67)), DIKS_F1 = (((DIKT_FUNCTION) | (1))), DIKS_F2 = (((DIKT_FUNCTION) | (2))), DIKS_F3 = (((DIKT_FUNCTION) | (3))), DIKS_F4 = (((DIKT_FUNCTION) | (4))), DIKS_F5 = (((DIKT_FUNCTION) | (5))), DIKS_F6 = (((DIKT_FUNCTION) | (6))), DIKS_F7 = (((DIKT_FUNCTION) | (7))), DIKS_F8 = (((DIKT_FUNCTION) | (8))), DIKS_F9 = (((DIKT_FUNCTION) | (9))), DIKS_F10 = (((DIKT_FUNCTION) | (10))), DIKS_F11 = (((DIKT_FUNCTION) | (11))), DIKS_F12 = (((DIKT_FUNCTION) | (12))), DIKS_SHIFT = (((DIKT_MODIFIER) | ((1 << DIMKI_SHIFT)))), DIKS_CONTROL = (((DIKT_MODIFIER) | ((1 << DIMKI_CONTROL)))), DIKS_ALT = (((DIKT_MODIFIER) | ((1 << DIMKI_ALT)))), DIKS_ALTGR = (((DIKT_MODIFIER) | ((1 << DIMKI_ALTGR)))), DIKS_META = (((DIKT_MODIFIER) | ((1 << DIMKI_META)))), DIKS_SUPER = (((DIKT_MODIFIER) | ((1 << DIMKI_SUPER)))), DIKS_HYPER = (((DIKT_MODIFIER) | ((1 << DIMKI_HYPER)))), DIKS_CAPS_LOCK = ((DIKT_LOCK) | (0x00)), DIKS_NUM_LOCK = ((DIKT_LOCK) | (0x01)), DIKS_SCROLL_LOCK = ((DIKT_LOCK) | (0x02)), DIKS_DEAD_ABOVEDOT = ((DIKT_DEAD) | (0x00)), DIKS_DEAD_ABOVERING = ((DIKT_DEAD) | (0x01)), DIKS_DEAD_ACUTE = ((DIKT_DEAD) | (0x02)), DIKS_DEAD_BREVE = ((DIKT_DEAD) | (0x03)), DIKS_DEAD_CARON = ((DIKT_DEAD) | (0x04)), DIKS_DEAD_CEDILLA = ((DIKT_DEAD) | (0x05)), DIKS_DEAD_CIRCUMFLEX = ((DIKT_DEAD) | (0x06)), DIKS_DEAD_DIAERESIS = ((DIKT_DEAD) | (0x07)), DIKS_DEAD_DOUBLEACUTE = ((DIKT_DEAD) | (0x08)), DIKS_DEAD_GRAVE = ((DIKT_DEAD) | (0x09)), DIKS_DEAD_IOTA = ((DIKT_DEAD) | (0x0A)), DIKS_DEAD_MACRON = ((DIKT_DEAD) | (0x0B)), DIKS_DEAD_OGONEK = ((DIKT_DEAD) | (0x0C)), DIKS_DEAD_SEMIVOICED_SOUND = ((DIKT_DEAD) | (0x0D)), DIKS_DEAD_TILDE = ((DIKT_DEAD) | (0x0E)), DIKS_DEAD_VOICED_SOUND = ((DIKT_DEAD) | (0x0F)), DIKS_CUSTOM0 = (((DIKT_CUSTOM) | (0))), DIKS_CUSTOM1 = (((DIKT_CUSTOM) | (1))), DIKS_CUSTOM2 = (((DIKT_CUSTOM) | (2))), DIKS_CUSTOM3 = (((DIKT_CUSTOM) | (3))), DIKS_CUSTOM4 = (((DIKT_CUSTOM) | (4))), DIKS_CUSTOM5 = (((DIKT_CUSTOM) | (5))), DIKS_CUSTOM6 = (((DIKT_CUSTOM) | (6))), DIKS_CUSTOM7 = (((DIKT_CUSTOM) | (7))), DIKS_CUSTOM8 = (((DIKT_CUSTOM) | (8))), DIKS_CUSTOM9 = (((DIKT_CUSTOM) | (9))) } DFBInputDeviceKeySymbol; typedef enum { DILS_SCROLL = 0x00000001, DILS_NUM = 0x00000002, DILS_CAPS = 0x00000004 } DFBInputDeviceLockState; typedef enum { DIKSI_BASE = 0x00, DIKSI_BASE_SHIFT = 0x01, DIKSI_ALT = 0x02, DIKSI_ALT_SHIFT = 0x03, DIKSI_LAST = DIKSI_ALT_SHIFT } DFBInputDeviceKeymapSymbolIndex; typedef struct { int code; DFBInputDeviceLockState locks; DFBInputDeviceKeyIdentifier identifier; DFBInputDeviceKeySymbol symbols[DIKSI_LAST+1]; } DFBInputDeviceKeymapEntry; # 35 "/usr/include/directfb/directfb.h" 2 # 68 "/usr/include/directfb/directfb.h" extern const unsigned int directfb_major_version; extern const unsigned int directfb_minor_version; extern const unsigned int directfb_micro_version; extern const unsigned int directfb_binary_age; extern const unsigned int directfb_interface_age; const char * DirectFBCheckVersion( unsigned int required_major, unsigned int required_minor, unsigned int required_micro ); typedef struct _IDirectFB IDirectFB; typedef struct _IDirectFBScreen IDirectFBScreen; typedef struct _IDirectFBDisplayLayer IDirectFBDisplayLayer; typedef struct _IDirectFBSurface IDirectFBSurface; typedef struct _IDirectFBPalette IDirectFBPalette; typedef struct _IDirectFBWindow IDirectFBWindow; typedef struct _IDirectFBInputDevice IDirectFBInputDevice; typedef struct _IDirectFBEventBuffer IDirectFBEventBuffer; typedef struct _IDirectFBFont IDirectFBFont; typedef struct _IDirectFBImageProvider IDirectFBImageProvider; typedef struct _IDirectFBVideoProvider IDirectFBVideoProvider; typedef struct _IDirectFBDataBuffer IDirectFBDataBuffer; typedef struct _IDirectFBGL IDirectFBGL; typedef enum { DFB_OK, DFB_FAILURE, DFB_INIT, DFB_BUG, DFB_DEAD, DFB_UNSUPPORTED, DFB_UNIMPLEMENTED, DFB_ACCESSDENIED, DFB_INVARG, DFB_NOSYSTEMMEMORY, DFB_NOVIDEOMEMORY, DFB_LOCKED, DFB_BUFFEREMPTY, DFB_FILENOTFOUND, DFB_IO, DFB_BUSY, DFB_NOIMPL, DFB_MISSINGFONT, DFB_TIMEOUT, DFB_MISSINGIMAGE, DFB_THIZNULL, DFB_IDNOTFOUND, DFB_INVAREA, DFB_DESTROYED, DFB_FUSION, DFB_BUFFERTOOLARGE, DFB_INTERRUPTED, DFB_NOCONTEXT, DFB_TEMPUNAVAIL, DFB_LIMITEXCEEDED, DFB_NOSUCHMETHOD, DFB_NOSUCHINSTANCE, DFB_ITEMNOTFOUND, DFB_VERSIONMISMATCH, DFB_NOSHAREDMEMORY } DFBResult; typedef enum { DFB_FALSE = 0, DFB_TRUE = !DFB_FALSE } DFBBoolean; typedef struct { int x; int y; } DFBPoint; typedef struct { int x; int w; } DFBSpan; typedef struct { int w; int h; } DFBDimension; typedef struct { int x; int y; int w; int h; } DFBRectangle; typedef struct { float x; float y; float w; float h; } DFBLocation; typedef struct { int x1; int y1; int x2; int y2; } DFBRegion; typedef struct { int l; int t; int r; int b; } DFBInsets; typedef struct { int x1; int y1; int x2; int y2; int x3; int y3; } DFBTriangle; typedef struct { __u8 a; __u8 r; __u8 g; __u8 b; } DFBColor; # 335 "/usr/include/directfb/directfb.h" DFBResult DirectFBError( const char *msg, DFBResult result ); DFBResult DirectFBErrorFatal( const char *msg, DFBResult result ); const char *DirectFBErrorString( DFBResult result ); const char *DirectFBUsageString( void ); DFBResult DirectFBInit( int *argc, char **argv[] ); DFBResult DirectFBSetOption( const char *name, const char *value ); DFBResult DirectFBCreate( IDirectFB **interface ); typedef unsigned int DFBScreenID; typedef unsigned int DFBDisplayLayerID; typedef unsigned int DFBDisplayLayerSourceID; typedef unsigned int DFBWindowID; typedef unsigned int DFBInputDeviceID; typedef __u32 DFBDisplayLayerIDs; # 428 "/usr/include/directfb/directfb.h" typedef enum { DFSCL_NORMAL = 0x00000000, DFSCL_FULLSCREEN, DFSCL_EXCLUSIVE } DFBCooperativeLevel; typedef enum { DLCAPS_NONE = 0x00000000, DLCAPS_SURFACE = 0x00000001, DLCAPS_OPACITY = 0x00000002, DLCAPS_ALPHACHANNEL = 0x00000004, DLCAPS_SCREEN_LOCATION = 0x00000008, DLCAPS_FLICKER_FILTERING = 0x00000010, DLCAPS_DEINTERLACING = 0x00000020, DLCAPS_SRC_COLORKEY = 0x00000040, DLCAPS_DST_COLORKEY = 0x00000080, DLCAPS_BRIGHTNESS = 0x00000100, DLCAPS_CONTRAST = 0x00000200, DLCAPS_HUE = 0x00000400, DLCAPS_SATURATION = 0x00000800, DLCAPS_LEVELS = 0x00001000, DLCAPS_FIELD_PARITY = 0x00002000, DLCAPS_WINDOWS = 0x00004000, DLCAPS_SOURCES = 0x00008000, DLCAPS_ALPHA_RAMP = 0x00010000, DLCAPS_PREMULTIPLIED = 0x00020000, DLCAPS_SCREEN_POSITION = 0x00100000, DLCAPS_SCREEN_SIZE = 0x00200000, DLCAPS_ALL = 0x0033FFFF } DFBDisplayLayerCapabilities; typedef enum { DSCCAPS_NONE = 0x00000000, DSCCAPS_VSYNC = 0x00000001, DSCCAPS_POWER_MANAGEMENT = 0x00000002, DSCCAPS_MIXERS = 0x00000010, DSCCAPS_ENCODERS = 0x00000020, DSCCAPS_OUTPUTS = 0x00000040, DSCCAPS_ALL = 0x00000073 } DFBScreenCapabilities; typedef enum { DLOP_NONE = 0x00000000, DLOP_ALPHACHANNEL = 0x00000001, DLOP_FLICKER_FILTERING = 0x00000002, DLOP_DEINTERLACING = 0x00000004, DLOP_SRC_COLORKEY = 0x00000008, DLOP_DST_COLORKEY = 0x00000010, DLOP_OPACITY = 0x00000020, DLOP_FIELD_PARITY = 0x00000040 } DFBDisplayLayerOptions; typedef enum { DLBM_UNKNOWN = 0x00000000, DLBM_FRONTONLY = 0x00000001, DLBM_BACKVIDEO = 0x00000002, DLBM_BACKSYSTEM = 0x00000004, DLBM_TRIPLE = 0x00000008, DLBM_WINDOWS = 0x00000010 } DFBDisplayLayerBufferMode; typedef enum { DSDESC_CAPS = 0x00000001, DSDESC_WIDTH = 0x00000002, DSDESC_HEIGHT = 0x00000004, DSDESC_PIXELFORMAT = 0x00000008, DSDESC_PREALLOCATED = 0x00000010, DSDESC_PALETTE = 0x00000020 } DFBSurfaceDescriptionFlags; typedef enum { DPDESC_CAPS = 0x00000001, DPDESC_SIZE = 0x00000002, DPDESC_ENTRIES = 0x00000004 } DFBPaletteDescriptionFlags; typedef enum { DSCAPS_NONE = 0x00000000, DSCAPS_PRIMARY = 0x00000001, DSCAPS_SYSTEMONLY = 0x00000002, DSCAPS_VIDEOONLY = 0x00000004, DSCAPS_DOUBLE = 0x00000010, DSCAPS_SUBSURFACE = 0x00000020, DSCAPS_INTERLACED = 0x00000040, DSCAPS_SEPARATED = 0x00000080, DSCAPS_STATIC_ALLOC = 0x00000100, DSCAPS_TRIPLE = 0x00000200, DSCAPS_PREMULTIPLIED = 0x00001000, DSCAPS_DEPTH = 0x00010000, DSCAPS_ALL = 0x000113F7, DSCAPS_FLIPPING = DSCAPS_DOUBLE | DSCAPS_TRIPLE } DFBSurfaceCapabilities; typedef enum { DPCAPS_NONE = 0x00000000 } DFBPaletteCapabilities; typedef enum { DSDRAW_NOFX = 0x00000000, DSDRAW_BLEND = 0x00000001, DSDRAW_DST_COLORKEY = 0x00000002, DSDRAW_SRC_PREMULTIPLY = 0x00000004, DSDRAW_DST_PREMULTIPLY = 0x00000008, DSDRAW_DEMULTIPLY = 0x00000010, DSDRAW_XOR = 0x00000020 } DFBSurfaceDrawingFlags; typedef enum { DSBLIT_NOFX = 0x00000000, DSBLIT_BLEND_ALPHACHANNEL = 0x00000001, DSBLIT_BLEND_COLORALPHA = 0x00000002, DSBLIT_COLORIZE = 0x00000004, DSBLIT_SRC_COLORKEY = 0x00000008, DSBLIT_DST_COLORKEY = 0x00000010, DSBLIT_SRC_PREMULTIPLY = 0x00000020, DSBLIT_DST_PREMULTIPLY = 0x00000040, DSBLIT_DEMULTIPLY = 0x00000080, DSBLIT_DEINTERLACE = 0x00000100 } DFBSurfaceBlittingFlags; typedef enum { DFXL_NONE = 0x00000000, DFXL_FILLRECTANGLE = 0x00000001, DFXL_DRAWRECTANGLE = 0x00000002, DFXL_DRAWLINE = 0x00000004, DFXL_FILLTRIANGLE = 0x00000008, DFXL_BLIT = 0x00010000, DFXL_STRETCHBLIT = 0x00020000, DFXL_TEXTRIANGLES = 0x00040000, DFXL_DRAWSTRING = 0x01000000, DFXL_ALL = 0x0107000F } DFBAccelerationMask; # 699 "/usr/include/directfb/directfb.h" typedef struct { DFBAccelerationMask acceleration_mask; DFBSurfaceDrawingFlags drawing_flags; DFBSurfaceBlittingFlags blitting_flags; unsigned int video_memory; } DFBCardCapabilities; typedef enum { DLTF_NONE = 0x00000000, DLTF_GRAPHICS = 0x00000001, DLTF_VIDEO = 0x00000002, DLTF_STILL_PICTURE = 0x00000004, DLTF_BACKGROUND = 0x00000008, DLTF_ALL = 0x0000000F } DFBDisplayLayerTypeFlags; typedef enum { DIDTF_NONE = 0x00000000, DIDTF_KEYBOARD = 0x00000001, DIDTF_MOUSE = 0x00000002, DIDTF_JOYSTICK = 0x00000004, DIDTF_REMOTE = 0x00000008, DIDTF_VIRTUAL = 0x00000010, DIDTF_ALL = 0x0000001F } DFBInputDeviceTypeFlags; typedef enum { DICAPS_KEYS = 0x00000001, DICAPS_AXES = 0x00000002, DICAPS_BUTTONS = 0x00000004, DICAPS_ALL = 0x00000007 } DFBInputDeviceCapabilities; typedef enum { DIBI_LEFT = 0x00000000, DIBI_RIGHT = 0x00000001, DIBI_MIDDLE = 0x00000002, DIBI_FIRST = DIBI_LEFT, DIBI_LAST = 0x0000001F } DFBInputDeviceButtonIdentifier; # 768 "/usr/include/directfb/directfb.h" typedef enum { DIAI_X = 0x00000000, DIAI_Y = 0x00000001, DIAI_Z = 0x00000002, DIAI_FIRST = DIAI_X, DIAI_LAST = 0x0000001F } DFBInputDeviceAxisIdentifier; typedef enum { DWDESC_CAPS = 0x00000001, DWDESC_WIDTH = 0x00000002, DWDESC_HEIGHT = 0x00000004, DWDESC_PIXELFORMAT = 0x00000008, DWDESC_POSX = 0x00000010, DWDESC_POSY = 0x00000020, DWDESC_SURFACE_CAPS = 0x00000040 } DFBWindowDescriptionFlags; typedef enum { DBDESC_FILE = 0x00000001, DBDESC_MEMORY = 0x00000002 } DFBDataBufferDescriptionFlags; typedef enum { DWCAPS_NONE = 0x00000000, DWCAPS_ALPHACHANNEL = 0x00000001, DWCAPS_DOUBLEBUFFER = 0x00000002, DWCAPS_INPUTONLY = 0x00000004, DWCAPS_NODECORATION = 0x00000008, DWCAPS_ALL = 0x0000000F } DFBWindowCapabilities; # 834 "/usr/include/directfb/directfb.h" typedef enum { DFFA_NONE = 0x00000000, DFFA_NOKERNING = 0x00000001, DFFA_NOHINTING = 0x00000002, DFFA_MONOCHROME = 0x00000004, DFFA_NOCHARMAP = 0x00000008 } DFBFontAttributes; typedef enum { DFDESC_ATTRIBUTES = 0x00000001, DFDESC_HEIGHT = 0x00000002, DFDESC_WIDTH = 0x00000004, DFDESC_INDEX = 0x00000008, DFDESC_FIXEDADVANCE = 0x00000010 } DFBFontDescriptionFlags; # 869 "/usr/include/directfb/directfb.h" typedef struct { DFBFontDescriptionFlags flags; DFBFontAttributes attributes; int height; int width; unsigned int index; int fixed_advance; } DFBFontDescription; # 916 "/usr/include/directfb/directfb.h" typedef enum { DSPF_UNKNOWN = 0x00000000, DSPF_ARGB1555 = ( (((0 ) & 0x7F) ) | (((15) & 0x1F) << 7) | (((1) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((2 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_RGB16 = ( (((1 ) & 0x7F) ) | (((16) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((2 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_RGB24 = ( (((2 ) & 0x7F) ) | (((24) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((3 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_RGB32 = ( (((3 ) & 0x7F) ) | (((24) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((4 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_ARGB = ( (((4 ) & 0x7F) ) | (((24) & 0x1F) << 7) | (((8) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((4 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_A8 = ( (((5 ) & 0x7F) ) | (((0) & 0x1F) << 7) | (((8) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_YUY2 = ( (((6 ) & 0x7F) ) | (((16) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((2 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_RGB332 = ( (((7 ) & 0x7F) ) | (((8) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_UYVY = ( (((8 ) & 0x7F) ) | (((16) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((2 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_I420 = ( (((9 ) & 0x7F) ) | (((12) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((2 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_YV12 = ( (((10 ) & 0x7F) ) | (((12) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((2 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_LUT8 = ( (((11 ) & 0x7F) ) | (((8) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((1 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_ALUT44 = ( (((12 ) & 0x7F) ) | (((4) & 0x1F) << 7) | (((4) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((1 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_AiRGB = ( (((13 ) & 0x7F) ) | (((24) & 0x1F) << 7) | (((8) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((4 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((1 ) ? 1 :0) << 31) ), DSPF_A1 = ( (((14 ) & 0x7F) ) | (((0) & 0x1F) << 7) | (((1) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((1 ) & 0x07) << 17) | (((0 ) & 0x07) << 20) | (((7 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_NV12 = ( (((15 ) & 0x7F) ) | (((12) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((2 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_NV16 = ( (((16 ) & 0x7F) ) | (((24) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((2 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_ARGB2554 = ( (((17 ) & 0x7F) ) | (((14) & 0x1F) << 7) | (((2) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((2 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_ARGB4444 = ( (((18 ) & 0x7F) ) | (((12) & 0x1F) << 7) | (((4) & 0x0F) << 12) | (((1 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((2 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((0 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ), DSPF_NV21 = ( (((19 ) & 0x7F) ) | (((12) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0 ) ? 1 :0) << 16) | (((0 ) & 0x07) << 17) | (((1 ) & 0x07) << 20) | (((0 ) & 0x07) << 23) | (((2 ) & 0x03) << 26) | (((0 ) & 0x03) << 28) | (((0 ) ? 1 :0) << 30) | (((0 ) ? 1 :0) << 31) ) } DFBSurfacePixelFormat; # 1012 "/usr/include/directfb/directfb.h" typedef struct { DFBSurfaceDescriptionFlags flags; DFBSurfaceCapabilities caps; int width; int height; DFBSurfacePixelFormat pixelformat; struct { void *data; int pitch; } preallocated[2]; struct { DFBColor *entries; unsigned int size; } palette; } DFBSurfaceDescription; typedef struct { DFBPaletteDescriptionFlags flags; DFBPaletteCapabilities caps; unsigned int size; DFBColor *entries; } DFBPaletteDescription; typedef struct { DFBDisplayLayerTypeFlags type; DFBDisplayLayerCapabilities caps; char name[32]; int level; int regions; int sources; } DFBDisplayLayerDescription; typedef struct { DFBDisplayLayerSourceID source_id; char name[24]; } DFBDisplayLayerSourceDescription; typedef struct { DFBScreenCapabilities caps; char name[32]; int mixers; int encoders; int outputs; } DFBScreenDescription; # 1104 "/usr/include/directfb/directfb.h" typedef struct { DFBInputDeviceTypeFlags type; DFBInputDeviceCapabilities caps; int min_keycode; int max_keycode; DFBInputDeviceAxisIdentifier max_axis; DFBInputDeviceButtonIdentifier max_button; char name[32]; char vendor[40]; } DFBInputDeviceDescription; typedef struct { DFBWindowDescriptionFlags flags; DFBWindowCapabilities caps; int width; int height; DFBSurfacePixelFormat pixelformat; int posx; int posy; DFBSurfaceCapabilities surface_caps; } DFBWindowDescription; typedef struct { DFBDataBufferDescriptionFlags flags; const char *file; struct { const void *data; unsigned int length; } memory; } DFBDataBufferDescription; typedef enum { DFENUM_OK = 0x00000000, DFENUM_CANCEL = 0x00000001 } DFBEnumerationResult; typedef DFBEnumerationResult (*DFBVideoModeCallback) ( int width, int height, int bpp, void *callbackdata ); typedef DFBEnumerationResult (*DFBScreenCallback) ( DFBScreenID screen_id, DFBScreenDescription desc, void *callbackdata ); typedef DFBEnumerationResult (*DFBDisplayLayerCallback) ( DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc, void *callbackdata ); typedef DFBEnumerationResult (*DFBInputDeviceCallback) ( DFBInputDeviceID device_id, DFBInputDeviceDescription desc, void *callbackdata ); typedef int (*DFBGetDataCallback) ( void *buffer, unsigned int length, void *callbackdata ); typedef enum { DVCAPS_BASIC = 0x00000000, DVCAPS_SEEK = 0x00000001, DVCAPS_SCALE = 0x00000002, DVCAPS_INTERLACED = 0x00000004, DVCAPS_BRIGHTNESS = 0x00000010, DVCAPS_CONTRAST = 0x00000020, DVCAPS_HUE = 0x00000040, DVCAPS_SATURATION = 0x00000080 } DFBVideoProviderCapabilities; typedef enum { DCAF_NONE = 0x00000000, DCAF_BRIGHTNESS = 0x00000001, DCAF_CONTRAST = 0x00000002, DCAF_HUE = 0x00000004, DCAF_SATURATION = 0x00000008 } DFBColorAdjustmentFlags; typedef struct { DFBColorAdjustmentFlags flags; __u16 brightness; __u16 contrast; __u16 hue; __u16 saturation; } DFBColorAdjustment; # 1319 "/usr/include/directfb/directfb.h" struct _IDirectFB { void *priv; int magic; DFBResult (*AddRef)( IDirectFB *thiz ); DFBResult (*Release)( IDirectFB *thiz ); DFBResult (*SetCooperativeLevel) ( IDirectFB *thiz, DFBCooperativeLevel level ); DFBResult (*SetVideoMode) ( IDirectFB *thiz, int width, int height, int bpp ); DFBResult (*GetCardCapabilities) ( IDirectFB *thiz, DFBCardCapabilities *ret_caps ); DFBResult (*EnumVideoModes) ( IDirectFB *thiz, DFBVideoModeCallback callback, void *callbackdata ); DFBResult (*CreateSurface) ( IDirectFB *thiz, const DFBSurfaceDescription *desc, IDirectFBSurface **ret_interface ); DFBResult (*CreatePalette) ( IDirectFB *thiz, const DFBPaletteDescription *desc, IDirectFBPalette **ret_interface ); DFBResult (*EnumScreens) ( IDirectFB *thiz, DFBScreenCallback callback, void *callbackdata ); DFBResult (*GetScreen) ( IDirectFB *thiz, DFBScreenID screen_id, IDirectFBScreen **ret_interface ); DFBResult (*EnumDisplayLayers) ( IDirectFB *thiz, DFBDisplayLayerCallback callback, void *callbackdata ); DFBResult (*GetDisplayLayer) ( IDirectFB *thiz, DFBDisplayLayerID layer_id, IDirectFBDisplayLayer **ret_interface ); DFBResult (*EnumInputDevices) ( IDirectFB *thiz, DFBInputDeviceCallback callback, void *callbackdata ); DFBResult (*GetInputDevice) ( IDirectFB *thiz, DFBInputDeviceID device_id, IDirectFBInputDevice **ret_interface ); DFBResult (*CreateEventBuffer) ( IDirectFB *thiz, IDirectFBEventBuffer **ret_buffer ); DFBResult (*CreateInputEventBuffer) ( IDirectFB *thiz, DFBInputDeviceCapabilities caps, DFBBoolean global, IDirectFBEventBuffer **ret_buffer ); DFBResult (*CreateImageProvider) ( IDirectFB *thiz, const char *filename, IDirectFBImageProvider **ret_interface ); DFBResult (*CreateVideoProvider) ( IDirectFB *thiz, const char *filename, IDirectFBVideoProvider **ret_interface ); DFBResult (*CreateFont) ( IDirectFB *thiz, const char *filename, const DFBFontDescription *desc, IDirectFBFont **ret_interface ); DFBResult (*CreateDataBuffer) ( IDirectFB *thiz, const DFBDataBufferDescription *desc, IDirectFBDataBuffer **ret_interface ); DFBResult (*SetClipboardData) ( IDirectFB *thiz, const char *mime_type, const void *data, unsigned int size, struct timeval *ret_timestamp ); DFBResult (*GetClipboardData) ( IDirectFB *thiz, char **ret_mimetype, void **ret_data, unsigned int *ret_size ); DFBResult (*GetClipboardTimeStamp) ( IDirectFB *thiz, struct timeval *ret_timestamp ); DFBResult (*Suspend) ( IDirectFB *thiz ); DFBResult (*Resume) ( IDirectFB *thiz ); DFBResult (*WaitIdle) ( IDirectFB *thiz ); DFBResult (*WaitForSync) ( IDirectFB *thiz ); DFBResult (*GetInterface) ( IDirectFB *thiz, const char *type, const char *implementation, void *arg, void **ret_interface ); }; # 1681 "/usr/include/directfb/directfb.h" typedef enum { DLSCL_SHARED = 0, DLSCL_EXCLUSIVE, DLSCL_ADMINISTRATIVE } DFBDisplayLayerCooperativeLevel; typedef enum { DLBM_DONTCARE = 0, DLBM_COLOR, DLBM_IMAGE, DLBM_TILE } DFBDisplayLayerBackgroundMode; typedef enum { DLCONF_NONE = 0x00000000, DLCONF_WIDTH = 0x00000001, DLCONF_HEIGHT = 0x00000002, DLCONF_PIXELFORMAT = 0x00000004, DLCONF_BUFFERMODE = 0x00000008, DLCONF_OPTIONS = 0x00000010, DLCONF_SOURCE = 0x00000020, DLCONF_SURFACE_CAPS = 0x00000040, DLCONF_ALL = 0x0000007F } DFBDisplayLayerConfigFlags; typedef struct { DFBDisplayLayerConfigFlags flags; int width; int height; DFBSurfacePixelFormat pixelformat; DFBDisplayLayerBufferMode buffermode; DFBDisplayLayerOptions options; DFBDisplayLayerSourceID source; DFBSurfaceCapabilities surface_caps; } DFBDisplayLayerConfig; typedef enum { DSPM_ON = 0, DSPM_STANDBY, DSPM_SUSPEND, DSPM_OFF } DFBScreenPowerMode; typedef enum { DSMCAPS_NONE = 0x00000000, DSMCAPS_FULL = 0x00000001, DSMCAPS_SUB_LEVEL = 0x00000002, DSMCAPS_SUB_LAYERS = 0x00000004, DSMCAPS_BACKGROUND = 0x00000008 } DFBScreenMixerCapabilities; typedef struct { DFBScreenMixerCapabilities caps; DFBDisplayLayerIDs layers; int sub_num; DFBDisplayLayerIDs sub_layers; char name[24]; } DFBScreenMixerDescription; typedef enum { DSMCONF_NONE = 0x00000000, DSMCONF_TREE = 0x00000001, DSMCONF_LEVEL = 0x00000002, DSMCONF_LAYERS = 0x00000004, DSMCONF_BACKGROUND = 0x00000010, DSMCONF_ALL = 0x00000017 } DFBScreenMixerConfigFlags; typedef enum { DSMT_UNKNOWN = 0x00000000, DSMT_FULL = 0x00000001, DSMT_SUB_LEVEL = 0x00000002, DSMT_SUB_LAYERS = 0x00000003 } DFBScreenMixerTree; typedef struct { DFBScreenMixerConfigFlags flags; DFBScreenMixerTree tree; int level; DFBDisplayLayerIDs layers; DFBColor background; } DFBScreenMixerConfig; typedef enum { DSOCAPS_NONE = 0x00000000, DSOCAPS_CONNECTORS = 0x00000001, DSOCAPS_ENCODER_SEL = 0x00000010, DSOCAPS_SIGNAL_SEL = 0x00000020, DSOCAPS_CONNECTOR_SEL = 0x00000040, DSOCAPS_ALL = 0x00000071 } DFBScreenOutputCapabilities; typedef enum { DSOC_UNKNOWN = 0x00000000, DSOC_VGA = 0x00000001, DSOC_SCART = 0x00000002, DSOC_YC = 0x00000004, DSOC_CVBS = 0x00000008 } DFBScreenOutputConnectors; typedef enum { DSOS_NONE = 0x00000000, DSOS_VGA = 0x00000001, DSOS_YC = 0x00000002, DSOS_CVBS = 0x00000004, DSOS_RGB = 0x00000008, DSOS_YCBCR = 0x00000010 } DFBScreenOutputSignals; typedef struct { DFBScreenOutputCapabilities caps; DFBScreenOutputConnectors all_connectors; DFBScreenOutputSignals all_signals; char name[24]; } DFBScreenOutputDescription; typedef enum { DSOCONF_NONE = 0x00000000, DSOCONF_ENCODER = 0x00000001, DSOCONF_SIGNALS = 0x00000002, DSOCONF_CONNECTORS = 0x00000004, DSOCONF_ALL = 0x00000007 } DFBScreenOutputConfigFlags; typedef struct { DFBScreenOutputConfigFlags flags; int encoder; DFBScreenOutputSignals out_signals; DFBScreenOutputConnectors out_connectors; } DFBScreenOutputConfig; typedef enum { DSECAPS_NONE = 0x00000000, DSECAPS_TV_STANDARDS = 0x00000001, DSECAPS_TEST_PICTURE = 0x00000002, DSECAPS_MIXER_SEL = 0x00000004, DSECAPS_OUT_SIGNALS = 0x00000008, DSECAPS_SCANMODE = 0x00000010, DSECAPS_BRIGHTNESS = 0x00000100, DSECAPS_CONTRAST = 0x00000200, DSECAPS_HUE = 0x00000400, DSECAPS_SATURATION = 0x00000800, DSECAPS_ALL = 0x00000f1f } DFBScreenEncoderCapabilities; typedef enum { DSET_UNKNOWN = 0x00000000, DSET_CRTC = 0x00000001, DSET_TV = 0x00000002 } DFBScreenEncoderType; typedef enum { DSETV_UNKNOWN = 0x00000000, DSETV_PAL = 0x00000001, DSETV_NTSC = 0x00000002, DSETV_SECAM = 0x00000004 } DFBScreenEncoderTVStandards; typedef enum { DSESM_UNKNOWN = 0x00000000, DSESM_INTERLACED = 0x00000001, DSESM_PROGRESSIVE = 0x00000002 } DFBScreenEncoderScanMode; typedef struct { DFBScreenEncoderCapabilities caps; DFBScreenEncoderType type; DFBScreenEncoderTVStandards tv_standards; DFBScreenOutputSignals out_signals; char name[24]; } DFBScreenEncoderDescription; typedef enum { DSECONF_NONE = 0x00000000, DSECONF_TV_STANDARD = 0x00000001, DSECONF_TEST_PICTURE = 0x00000002, DSECONF_MIXER = 0x00000004, DSECONF_OUT_SIGNALS = 0x00000008, DSECONF_SCANMODE = 0x00000010, DSECONF_TEST_COLOR = 0x00000020, DSECONF_ADJUSTMENT = 0x00000040, DSECONF_ALL = 0x0000007F } DFBScreenEncoderConfigFlags; typedef enum { DSETP_OFF = 0x00000000, DSETP_MULTI = 0x00000001, DSETP_SINGLE = 0x00000002, DSETP_WHITE = 0x00000010, DSETP_YELLOW = 0x00000020, DSETP_CYAN = 0x00000030, DSETP_GREEN = 0x00000040, DSETP_MAGENTA = 0x00000050, DSETP_RED = 0x00000060, DSETP_BLUE = 0x00000070, DSETP_BLACK = 0x00000080 } DFBScreenEncoderTestPicture; typedef struct { DFBScreenEncoderConfigFlags flags; DFBScreenEncoderTVStandards tv_standard; DFBScreenEncoderTestPicture test_picture; int mixer; DFBScreenOutputSignals out_signals; DFBScreenEncoderScanMode scanmode; DFBColor test_color; DFBColorAdjustment adjustment; } DFBScreenEncoderConfig; # 2030 "/usr/include/directfb/directfb.h" struct _IDirectFBScreen { void *priv; int magic; DFBResult (*AddRef)( IDirectFBScreen *thiz ); DFBResult (*Release)( IDirectFBScreen *thiz ); DFBResult (*GetID) ( IDirectFBScreen *thiz, DFBScreenID *ret_screen_id ); DFBResult (*GetDescription) ( IDirectFBScreen *thiz, DFBScreenDescription *ret_desc ); DFBResult (*EnumDisplayLayers) ( IDirectFBScreen *thiz, DFBDisplayLayerCallback callback, void *callbackdata ); DFBResult (*SetPowerMode) ( IDirectFBScreen *thiz, DFBScreenPowerMode mode ); DFBResult (*WaitForSync) ( IDirectFBScreen *thiz ); DFBResult (*GetMixerDescriptions) ( IDirectFBScreen *thiz, DFBScreenMixerDescription *ret_descriptions ); DFBResult (*GetMixerConfiguration) ( IDirectFBScreen *thiz, int mixer, DFBScreenMixerConfig *ret_config ); DFBResult (*TestMixerConfiguration) ( IDirectFBScreen *thiz, int mixer, const DFBScreenMixerConfig *config, DFBScreenMixerConfigFlags *ret_failed ); DFBResult (*SetMixerConfiguration) ( IDirectFBScreen *thiz, int mixer, const DFBScreenMixerConfig *config ); DFBResult (*GetEncoderDescriptions) ( IDirectFBScreen *thiz, DFBScreenEncoderDescription *ret_descriptions ); DFBResult (*GetEncoderConfiguration) ( IDirectFBScreen *thiz, int encoder, DFBScreenEncoderConfig *ret_config ); DFBResult (*TestEncoderConfiguration) ( IDirectFBScreen *thiz, int encoder, const DFBScreenEncoderConfig *config, DFBScreenEncoderConfigFlags *ret_failed ); DFBResult (*SetEncoderConfiguration) ( IDirectFBScreen *thiz, int encoder, const DFBScreenEncoderConfig *config ); DFBResult (*GetOutputDescriptions) ( IDirectFBScreen *thiz, DFBScreenOutputDescription *ret_descriptions ); DFBResult (*GetOutputConfiguration) ( IDirectFBScreen *thiz, int output, DFBScreenOutputConfig *ret_config ); DFBResult (*TestOutputConfiguration) ( IDirectFBScreen *thiz, int output, const DFBScreenOutputConfig *config, DFBScreenOutputConfigFlags *ret_failed ); DFBResult (*SetOutputConfiguration) ( IDirectFBScreen *thiz, int output, const DFBScreenOutputConfig *config ); }; # 2236 "/usr/include/directfb/directfb.h" struct _IDirectFBDisplayLayer { void *priv; int magic; DFBResult (*AddRef)( IDirectFBDisplayLayer *thiz ); DFBResult (*Release)( IDirectFBDisplayLayer *thiz ); DFBResult (*GetID) ( IDirectFBDisplayLayer *thiz, DFBDisplayLayerID *ret_layer_id ); DFBResult (*GetDescription) ( IDirectFBDisplayLayer *thiz, DFBDisplayLayerDescription *ret_desc ); DFBResult (*GetSourceDescriptions) ( IDirectFBDisplayLayer *thiz, DFBDisplayLayerSourceDescription *ret_descriptions ); DFBResult (*GetCurrentOutputField) ( IDirectFBDisplayLayer *thiz, int *ret_field ); DFBResult (*GetSurface) ( IDirectFBDisplayLayer *thiz, IDirectFBSurface **ret_interface ); DFBResult (*GetScreen) ( IDirectFBDisplayLayer *thiz, IDirectFBScreen **ret_interface ); DFBResult (*SetCooperativeLevel) ( IDirectFBDisplayLayer *thiz, DFBDisplayLayerCooperativeLevel level ); DFBResult (*GetConfiguration) ( IDirectFBDisplayLayer *thiz, DFBDisplayLayerConfig *ret_config ); DFBResult (*TestConfiguration) ( IDirectFBDisplayLayer *thiz, const DFBDisplayLayerConfig *config, DFBDisplayLayerConfigFlags *ret_failed ); DFBResult (*SetConfiguration) ( IDirectFBDisplayLayer *thiz, const DFBDisplayLayerConfig *config ); DFBResult (*SetScreenLocation) ( IDirectFBDisplayLayer *thiz, float x, float y, float width, float height ); DFBResult (*SetScreenPosition) ( IDirectFBDisplayLayer *thiz, int x, int y ); DFBResult (*SetScreenRectangle) ( IDirectFBDisplayLayer *thiz, int x, int y, int width, int height ); DFBResult (*SetOpacity) ( IDirectFBDisplayLayer *thiz, __u8 opacity ); DFBResult (*SetSourceRectangle) ( IDirectFBDisplayLayer *thiz, int x, int y, int width, int height ); DFBResult (*SetFieldParity) ( IDirectFBDisplayLayer *thiz, int field ); DFBResult (*SetSrcColorKey) ( IDirectFBDisplayLayer *thiz, __u8 r, __u8 g, __u8 b ); DFBResult (*SetDstColorKey) ( IDirectFBDisplayLayer *thiz, __u8 r, __u8 g, __u8 b ); DFBResult (*GetLevel) ( IDirectFBDisplayLayer *thiz, int *ret_level ); DFBResult (*SetLevel) ( IDirectFBDisplayLayer *thiz, int level ); DFBResult (*SetBackgroundMode) ( IDirectFBDisplayLayer *thiz, DFBDisplayLayerBackgroundMode mode ); DFBResult (*SetBackgroundImage) ( IDirectFBDisplayLayer *thiz, IDirectFBSurface *surface ); DFBResult (*SetBackgroundColor) ( IDirectFBDisplayLayer *thiz, __u8 r, __u8 g, __u8 b, __u8 a ); DFBResult (*GetColorAdjustment) ( IDirectFBDisplayLayer *thiz, DFBColorAdjustment *ret_adj ); DFBResult (*SetColorAdjustment) ( IDirectFBDisplayLayer *thiz, const DFBColorAdjustment *adj ); DFBResult (*CreateWindow) ( IDirectFBDisplayLayer *thiz, const DFBWindowDescription *desc, IDirectFBWindow **ret_interface ); DFBResult (*GetWindow) ( IDirectFBDisplayLayer *thiz, DFBWindowID window_id, IDirectFBWindow **ret_interface ); DFBResult (*EnableCursor) ( IDirectFBDisplayLayer *thiz, int enable ); DFBResult (*GetCursorPosition) ( IDirectFBDisplayLayer *thiz, int *ret_x, int *ret_y ); DFBResult (*WarpCursor) ( IDirectFBDisplayLayer *thiz, int x, int y ); DFBResult (*SetCursorAcceleration) ( IDirectFBDisplayLayer *thiz, int numerator, int denominator, int threshold ); DFBResult (*SetCursorShape) ( IDirectFBDisplayLayer *thiz, IDirectFBSurface *shape, int hot_x, int hot_y ); DFBResult (*SetCursorOpacity) ( IDirectFBDisplayLayer *thiz, __u8 opacity ); DFBResult (*WaitForSync) ( IDirectFBDisplayLayer *thiz ); }; # 2649 "/usr/include/directfb/directfb.h" typedef enum { DSFLIP_NONE = 0x00000000, DSFLIP_WAIT = 0x00000001, DSFLIP_BLIT = 0x00000002, DSFLIP_ONSYNC = 0x00000004, DSFLIP_PIPELINE = 0x00000008, DSFLIP_WAITFORSYNC = DSFLIP_WAIT | DSFLIP_ONSYNC } DFBSurfaceFlipFlags; typedef enum { DSTF_LEFT = 0x00000000, DSTF_CENTER = 0x00000001, DSTF_RIGHT = 0x00000002, DSTF_TOP = 0x00000004, DSTF_BOTTOM = 0x00000008, DSTF_TOPLEFT = DSTF_TOP | DSTF_LEFT, DSTF_TOPCENTER = DSTF_TOP | DSTF_CENTER, DSTF_TOPRIGHT = DSTF_TOP | DSTF_RIGHT, DSTF_BOTTOMLEFT = DSTF_BOTTOM | DSTF_LEFT, DSTF_BOTTOMCENTER = DSTF_BOTTOM | DSTF_CENTER, DSTF_BOTTOMRIGHT = DSTF_BOTTOM | DSTF_RIGHT } DFBSurfaceTextFlags; typedef enum { DSLF_READ = 0x00000001, DSLF_WRITE = 0x00000002 } DFBSurfaceLockFlags; typedef enum { DSPD_NONE = 0, DSPD_CLEAR = 1, DSPD_SRC = 2, DSPD_SRC_OVER = 3, DSPD_DST_OVER = 4, DSPD_SRC_IN = 5, DSPD_DST_IN = 6, DSPD_SRC_OUT = 7, DSPD_DST_OUT = 8 } DFBSurfacePorterDuffRule; typedef enum { DSBF_ZERO = 1, DSBF_ONE = 2, DSBF_SRCCOLOR = 3, DSBF_INVSRCCOLOR = 4, DSBF_SRCALPHA = 5, DSBF_INVSRCALPHA = 6, DSBF_DESTALPHA = 7, DSBF_INVDESTALPHA = 8, DSBF_DESTCOLOR = 9, DSBF_INVDESTCOLOR = 10, DSBF_SRCALPHASAT = 11 } DFBSurfaceBlendFunction; typedef struct { float x; float y; float z; float w; float s; float t; } DFBVertex; typedef enum { DTTF_LIST, DTTF_STRIP, DTTF_FAN } DFBTriangleFormation; # 2763 "/usr/include/directfb/directfb.h" struct _IDirectFBSurface { void *priv; int magic; DFBResult (*AddRef)( IDirectFBSurface *thiz ); DFBResult (*Release)( IDirectFBSurface *thiz ); DFBResult (*GetCapabilities) ( IDirectFBSurface *thiz, DFBSurfaceCapabilities *ret_caps ); DFBResult (*GetSize) ( IDirectFBSurface *thiz, int *ret_width, int *ret_height ); DFBResult (*GetVisibleRectangle) ( IDirectFBSurface *thiz, DFBRectangle *ret_rect ); DFBResult (*GetPixelFormat) ( IDirectFBSurface *thiz, DFBSurfacePixelFormat *ret_format ); DFBResult (*GetAccelerationMask) ( IDirectFBSurface *thiz, IDirectFBSurface *source, DFBAccelerationMask *ret_mask ); DFBResult (*GetPalette) ( IDirectFBSurface *thiz, IDirectFBPalette **ret_interface ); DFBResult (*SetPalette) ( IDirectFBSurface *thiz, IDirectFBPalette *palette ); DFBResult (*SetAlphaRamp) ( IDirectFBSurface *thiz, __u8 a0, __u8 a1, __u8 a2, __u8 a3 ); DFBResult (*Lock) ( IDirectFBSurface *thiz, DFBSurfaceLockFlags flags, void **ret_ptr, int *ret_pitch ); DFBResult (*Unlock) ( IDirectFBSurface *thiz ); DFBResult (*Flip) ( IDirectFBSurface *thiz, const DFBRegion *region, DFBSurfaceFlipFlags flags ); DFBResult (*SetField) ( IDirectFBSurface *thiz, int field ); DFBResult (*Clear) ( IDirectFBSurface *thiz, __u8 r, __u8 g, __u8 b, __u8 a ); DFBResult (*SetClip) ( IDirectFBSurface *thiz, const DFBRegion *clip ); DFBResult (*SetColor) ( IDirectFBSurface *thiz, __u8 r, __u8 g, __u8 b, __u8 a ); DFBResult (*SetColorIndex) ( IDirectFBSurface *thiz, unsigned int index ); DFBResult (*SetSrcBlendFunction) ( IDirectFBSurface *thiz, DFBSurfaceBlendFunction function ); DFBResult (*SetDstBlendFunction) ( IDirectFBSurface *thiz, DFBSurfaceBlendFunction function ); DFBResult (*SetPorterDuff) ( IDirectFBSurface *thiz, DFBSurfacePorterDuffRule rule ); DFBResult (*SetSrcColorKey) ( IDirectFBSurface *thiz, __u8 r, __u8 g, __u8 b ); DFBResult (*SetSrcColorKeyIndex) ( IDirectFBSurface *thiz, unsigned int index ); DFBResult (*SetDstColorKey) ( IDirectFBSurface *thiz, __u8 r, __u8 g, __u8 b ); DFBResult (*SetDstColorKeyIndex) ( IDirectFBSurface *thiz, unsigned int index ); DFBResult (*SetBlittingFlags) ( IDirectFBSurface *thiz, DFBSurfaceBlittingFlags flags ); DFBResult (*Blit) ( IDirectFBSurface *thiz, IDirectFBSurface *source, const DFBRectangle *source_rect, int x, int y ); DFBResult (*TileBlit) ( IDirectFBSurface *thiz, IDirectFBSurface *source, const DFBRectangle *source_rect, int x, int y ); DFBResult (*BatchBlit) ( IDirectFBSurface *thiz, IDirectFBSurface *source, const DFBRectangle *source_rects, const DFBPoint *dest_points, int num ); DFBResult (*StretchBlit) ( IDirectFBSurface *thiz, IDirectFBSurface *source, const DFBRectangle *source_rect, const DFBRectangle *destination_rect ); DFBResult (*TextureTriangles) ( IDirectFBSurface *thiz, IDirectFBSurface *texture, const DFBVertex *vertices, const int *indices, int num, DFBTriangleFormation formation ); DFBResult (*SetDrawingFlags) ( IDirectFBSurface *thiz, DFBSurfaceDrawingFlags flags ); DFBResult (*FillRectangle) ( IDirectFBSurface *thiz, int x, int y, int w, int h ); DFBResult (*DrawRectangle) ( IDirectFBSurface *thiz, int x, int y, int w, int h ); DFBResult (*DrawLine) ( IDirectFBSurface *thiz, int x1, int y1, int x2, int y2 ); DFBResult (*DrawLines) ( IDirectFBSurface *thiz, const DFBRegion *lines, unsigned int num_lines ); DFBResult (*FillTriangle) ( IDirectFBSurface *thiz, int x1, int y1, int x2, int y2, int x3, int y3 ); DFBResult (*FillRectangles) ( IDirectFBSurface *thiz, const DFBRectangle *rects, unsigned int num ); DFBResult (*FillSpans) ( IDirectFBSurface *thiz, int y, const DFBSpan *spans, unsigned int num ); DFBResult (*SetFont) ( IDirectFBSurface *thiz, IDirectFBFont *font ); DFBResult (*GetFont) ( IDirectFBSurface *thiz, IDirectFBFont **ret_font ); DFBResult (*DrawString) ( IDirectFBSurface *thiz, const char *text, int bytes, int x, int y, DFBSurfaceTextFlags flags ); DFBResult (*DrawGlyph) ( IDirectFBSurface *thiz, unsigned int index, int x, int y, DFBSurfaceTextFlags flags ); DFBResult (*GetSubSurface) ( IDirectFBSurface *thiz, const DFBRectangle *rect, IDirectFBSurface **ret_interface ); DFBResult (*GetGL) ( IDirectFBSurface *thiz, IDirectFBGL **ret_interface ); DFBResult (*Dump) ( IDirectFBSurface *thiz, const char *directory, const char *prefix ); }; # 3354 "/usr/include/directfb/directfb.h" struct _IDirectFBPalette { void *priv; int magic; DFBResult (*AddRef)( IDirectFBPalette *thiz ); DFBResult (*Release)( IDirectFBPalette *thiz ); DFBResult (*GetCapabilities) ( IDirectFBPalette *thiz, DFBPaletteCapabilities *ret_caps ); DFBResult (*GetSize) ( IDirectFBPalette *thiz, unsigned int *ret_size ); DFBResult (*SetEntries) ( IDirectFBPalette *thiz, const DFBColor *entries, unsigned int num_entries, unsigned int offset ); DFBResult (*GetEntries) ( IDirectFBPalette *thiz, DFBColor *ret_entries, unsigned int num_entries, unsigned int offset ); DFBResult (*FindBestMatch) ( IDirectFBPalette *thiz, __u8 r, __u8 g, __u8 b, __u8 a, unsigned int *ret_index ); DFBResult (*CreateCopy) ( IDirectFBPalette *thiz, IDirectFBPalette **ret_interface ); }; # 3433 "/usr/include/directfb/directfb.h" typedef enum { DIKS_UP = 0x00000000, DIKS_DOWN = 0x00000001 } DFBInputDeviceKeyState; typedef enum { DIBS_UP = 0x00000000, DIBS_DOWN = 0x00000001 } DFBInputDeviceButtonState; typedef enum { DIBM_LEFT = 0x00000001, DIBM_RIGHT = 0x00000002, DIBM_MIDDLE = 0x00000004 } DFBInputDeviceButtonMask; typedef enum { DIMM_SHIFT = (1 << DIMKI_SHIFT), DIMM_CONTROL = (1 << DIMKI_CONTROL), DIMM_ALT = (1 << DIMKI_ALT), DIMM_ALTGR = (1 << DIMKI_ALTGR), DIMM_META = (1 << DIMKI_META), DIMM_SUPER = (1 << DIMKI_SUPER), DIMM_HYPER = (1 << DIMKI_HYPER) } DFBInputDeviceModifierMask; # 3476 "/usr/include/directfb/directfb.h" struct _IDirectFBInputDevice { void *priv; int magic; DFBResult (*AddRef)( IDirectFBInputDevice *thiz ); DFBResult (*Release)( IDirectFBInputDevice *thiz ); DFBResult (*GetID) ( IDirectFBInputDevice *thiz, DFBInputDeviceID *ret_device_id ); DFBResult (*GetDescription) ( IDirectFBInputDevice *thiz, DFBInputDeviceDescription *ret_desc ); DFBResult (*GetKeymapEntry) ( IDirectFBInputDevice *thiz, int keycode, DFBInputDeviceKeymapEntry *ret_entry ); DFBResult (*CreateEventBuffer) ( IDirectFBInputDevice *thiz, IDirectFBEventBuffer **ret_buffer ); DFBResult (*AttachEventBuffer) ( IDirectFBInputDevice *thiz, IDirectFBEventBuffer *buffer ); DFBResult (*GetKeyState) ( IDirectFBInputDevice *thiz, DFBInputDeviceKeyIdentifier key_id, DFBInputDeviceKeyState *ret_state ); DFBResult (*GetModifiers) ( IDirectFBInputDevice *thiz, DFBInputDeviceModifierMask *ret_modifiers ); DFBResult (*GetLockState) ( IDirectFBInputDevice *thiz, DFBInputDeviceLockState *ret_locks ); DFBResult (*GetButtons) ( IDirectFBInputDevice *thiz, DFBInputDeviceButtonMask *ret_buttons ); DFBResult (*GetButtonState) ( IDirectFBInputDevice *thiz, DFBInputDeviceButtonIdentifier button, DFBInputDeviceButtonState *ret_state ); DFBResult (*GetAxis) ( IDirectFBInputDevice *thiz, DFBInputDeviceAxisIdentifier axis, int *ret_pos ); DFBResult (*GetXY) ( IDirectFBInputDevice *thiz, int *ret_x, int *ret_y ); }; # 3605 "/usr/include/directfb/directfb.h" typedef enum { DFEC_NONE = 0x00, DFEC_INPUT = 0x01, DFEC_WINDOW = 0x02, DFEC_USER = 0x03 } DFBEventClass; typedef enum { DIET_UNKNOWN = 0, DIET_KEYPRESS, DIET_KEYRELEASE, DIET_BUTTONPRESS, DIET_BUTTONRELEASE, DIET_AXISMOTION } DFBInputEventType; typedef enum { DIEF_NONE = 0x000, DIEF_TIMESTAMP = 0x001, DIEF_AXISABS = 0x002, DIEF_AXISREL = 0x004, DIEF_KEYCODE = 0x008, DIEF_KEYID = 0x010, DIEF_KEYSYMBOL = 0x020, DIEF_MODIFIERS = 0x040, DIEF_LOCKS = 0x080, DIEF_BUTTONS = 0x100, DIEF_GLOBAL = 0x200 } DFBInputEventFlags; typedef struct { DFBEventClass clazz; DFBInputEventType type; DFBInputDeviceID device_id; DFBInputEventFlags flags; struct timeval timestamp; int key_code; DFBInputDeviceKeyIdentifier key_id; DFBInputDeviceKeySymbol key_symbol; DFBInputDeviceModifierMask modifiers; DFBInputDeviceLockState locks; DFBInputDeviceButtonIdentifier button; DFBInputDeviceButtonMask buttons; DFBInputDeviceAxisIdentifier axis; int axisabs; int axisrel; } DFBInputEvent; typedef enum { DWET_NONE = 0x00000000, DWET_POSITION = 0x00000001, DWET_SIZE = 0x00000002, DWET_CLOSE = 0x00000004, DWET_DESTROYED = 0x00000008, DWET_GOTFOCUS = 0x00000010, DWET_LOSTFOCUS = 0x00000020, DWET_KEYDOWN = 0x00000100, DWET_KEYUP = 0x00000200, DWET_BUTTONDOWN = 0x00010000, DWET_BUTTONUP = 0x00020000, DWET_MOTION = 0x00040000, DWET_ENTER = 0x00080000, DWET_LEAVE = 0x00100000, DWET_WHEEL = 0x00200000, DWET_POSITION_SIZE = DWET_POSITION | DWET_SIZE, DWET_ALL = 0x003F033F } DFBWindowEventType; typedef struct { DFBEventClass clazz; DFBWindowEventType type; DFBWindowID window_id; int x; int y; int cx; int cy; int step; int w; int h; int key_code; DFBInputDeviceKeyIdentifier key_id; DFBInputDeviceKeySymbol key_symbol; DFBInputDeviceModifierMask modifiers; DFBInputDeviceLockState locks; DFBInputDeviceButtonIdentifier button; DFBInputDeviceButtonMask buttons; struct timeval timestamp; } DFBWindowEvent; typedef struct { DFBEventClass clazz; unsigned int type; void *data; } DFBUserEvent; typedef union { DFBEventClass clazz; DFBInputEvent input; DFBWindowEvent window; DFBUserEvent user; } DFBEvent; # 3827 "/usr/include/directfb/directfb.h" struct _IDirectFBEventBuffer { void *priv; int magic; DFBResult (*AddRef)( IDirectFBEventBuffer *thiz ); DFBResult (*Release)( IDirectFBEventBuffer *thiz ); DFBResult (*Reset) ( IDirectFBEventBuffer *thiz ); DFBResult (*WaitForEvent) ( IDirectFBEventBuffer *thiz ); DFBResult (*WaitForEventWithTimeout) ( IDirectFBEventBuffer *thiz, unsigned int seconds, unsigned int milli_seconds ); DFBResult (*GetEvent) ( IDirectFBEventBuffer *thiz, DFBEvent *ret_event ); DFBResult (*PeekEvent) ( IDirectFBEventBuffer *thiz, DFBEvent *ret_event ); DFBResult (*HasEvent) ( IDirectFBEventBuffer *thiz ); DFBResult (*PostEvent) ( IDirectFBEventBuffer *thiz, const DFBEvent *event ); DFBResult (*WakeUp) ( IDirectFBEventBuffer *thiz ); DFBResult (*CreateFileDescriptor) ( IDirectFBEventBuffer *thiz, int *ret_fd ); }; # 3939 "/usr/include/directfb/directfb.h" typedef enum { DWOP_NONE = 0x00000000, DWOP_COLORKEYING = 0x00000001, DWOP_ALPHACHANNEL = 0x00000002, DWOP_OPAQUE_REGION = 0x00000004, DWOP_SHAPED = 0x00000008, DWOP_KEEP_POSITION = 0x00000010, DWOP_KEEP_SIZE = 0x00000020, DWOP_KEEP_STACKING = 0x00000040, DWOP_GHOST = 0x00001000, DWOP_INDESTRUCTIBLE = 0x00002000, DWOP_ALL = 0x0000307F } DFBWindowOptions; typedef enum { DWSC_MIDDLE = 0x00000000, DWSC_UPPER = 0x00000001, DWSC_LOWER = 0x00000002 } DFBWindowStackingClass; # 3988 "/usr/include/directfb/directfb.h" struct _IDirectFBWindow { void *priv; int magic; DFBResult (*AddRef)( IDirectFBWindow *thiz ); DFBResult (*Release)( IDirectFBWindow *thiz ); DFBResult (*GetID) ( IDirectFBWindow *thiz, DFBWindowID *ret_window_id ); DFBResult (*GetPosition) ( IDirectFBWindow *thiz, int *ret_x, int *ret_y ); DFBResult (*GetSize) ( IDirectFBWindow *thiz, int *ret_width, int *ret_height ); DFBResult (*CreateEventBuffer) ( IDirectFBWindow *thiz, IDirectFBEventBuffer **ret_buffer ); DFBResult (*AttachEventBuffer) ( IDirectFBWindow *thiz, IDirectFBEventBuffer *buffer ); DFBResult (*EnableEvents) ( IDirectFBWindow *thiz, DFBWindowEventType mask ); DFBResult (*DisableEvents) ( IDirectFBWindow *thiz, DFBWindowEventType mask ); DFBResult (*GetSurface) ( IDirectFBWindow *thiz, IDirectFBSurface **ret_surface ); DFBResult (*SetOptions) ( IDirectFBWindow *thiz, DFBWindowOptions options ); DFBResult (*GetOptions) ( IDirectFBWindow *thiz, DFBWindowOptions *ret_options ); DFBResult (*SetColorKey) ( IDirectFBWindow *thiz, __u8 r, __u8 g, __u8 b ); DFBResult (*SetColorKeyIndex) ( IDirectFBWindow *thiz, unsigned int index ); DFBResult (*SetOpacity) ( IDirectFBWindow *thiz, __u8 opacity ); DFBResult (*SetOpaqueRegion) ( IDirectFBWindow *thiz, int x1, int y1, int x2, int y2 ); DFBResult (*GetOpacity) ( IDirectFBWindow *thiz, __u8 *ret_opacity ); DFBResult (*SetCursorShape) ( IDirectFBWindow *thiz, IDirectFBSurface *shape, int hot_x, int hot_y ); DFBResult (*RequestFocus) ( IDirectFBWindow *thiz ); DFBResult (*GrabKeyboard) ( IDirectFBWindow *thiz ); DFBResult (*UngrabKeyboard) ( IDirectFBWindow *thiz ); DFBResult (*GrabPointer) ( IDirectFBWindow *thiz ); DFBResult (*UngrabPointer) ( IDirectFBWindow *thiz ); DFBResult (*GrabKey) ( IDirectFBWindow *thiz, DFBInputDeviceKeySymbol symbol, DFBInputDeviceModifierMask modifiers ); DFBResult (*UngrabKey) ( IDirectFBWindow *thiz, DFBInputDeviceKeySymbol symbol, DFBInputDeviceModifierMask modifiers ); DFBResult (*Move) ( IDirectFBWindow *thiz, int dx, int dy ); DFBResult (*MoveTo) ( IDirectFBWindow *thiz, int x, int y ); DFBResult (*Resize) ( IDirectFBWindow *thiz, int width, int height ); DFBResult (*SetStackingClass) ( IDirectFBWindow *thiz, DFBWindowStackingClass stacking_class ); DFBResult (*Raise) ( IDirectFBWindow *thiz ); DFBResult (*Lower) ( IDirectFBWindow *thiz ); DFBResult (*RaiseToTop) ( IDirectFBWindow *thiz ); DFBResult (*LowerToBottom) ( IDirectFBWindow *thiz ); DFBResult (*PutAtop) ( IDirectFBWindow *thiz, IDirectFBWindow *lower ); DFBResult (*PutBelow) ( IDirectFBWindow *thiz, IDirectFBWindow *upper ); DFBResult (*Close) ( IDirectFBWindow *thiz ); DFBResult (*Destroy) ( IDirectFBWindow *thiz ); }; # 4356 "/usr/include/directfb/directfb.h" struct _IDirectFBFont { void *priv; int magic; DFBResult (*AddRef)( IDirectFBFont *thiz ); DFBResult (*Release)( IDirectFBFont *thiz ); DFBResult (*GetAscender) ( IDirectFBFont *thiz, int *ret_ascender ); DFBResult (*GetDescender) ( IDirectFBFont *thiz, int *ret_descender ); DFBResult (*GetHeight) ( IDirectFBFont *thiz, int *ret_height ); DFBResult (*GetMaxAdvance) ( IDirectFBFont *thiz, int *ret_maxadvance ); DFBResult (*GetKerning) ( IDirectFBFont *thiz, unsigned int prev_index, unsigned int current_index, int *ret_kern_x, int *ret_kern_y ); DFBResult (*GetStringWidth) ( IDirectFBFont *thiz, const char *text, int bytes, int *ret_width ); DFBResult (*GetStringExtents) ( IDirectFBFont *thiz, const char *text, int bytes, DFBRectangle *ret_logical_rect, DFBRectangle *ret_ink_rect ); DFBResult (*GetGlyphExtents) ( IDirectFBFont *thiz, unsigned int index, DFBRectangle *ret_rect, int *ret_advance ); }; # 4492 "/usr/include/directfb/directfb.h" typedef enum { DICAPS_NONE = 0x00000000, DICAPS_ALPHACHANNEL = 0x00000001, DICAPS_COLORKEY = 0x00000002 } DFBImageCapabilities; typedef struct { DFBImageCapabilities caps; __u8 colorkey_r; __u8 colorkey_g; __u8 colorkey_b; } DFBImageDescription; typedef void (*DIRenderCallback)(DFBRectangle *rect, void *ctx); # 4526 "/usr/include/directfb/directfb.h" struct _IDirectFBImageProvider { void *priv; int magic; DFBResult (*AddRef)( IDirectFBImageProvider *thiz ); DFBResult (*Release)( IDirectFBImageProvider *thiz ); DFBResult (*GetSurfaceDescription) ( IDirectFBImageProvider *thiz, DFBSurfaceDescription *ret_dsc ); DFBResult (*GetImageDescription) ( IDirectFBImageProvider *thiz, DFBImageDescription *ret_dsc ); DFBResult (*RenderTo) ( IDirectFBImageProvider *thiz, IDirectFBSurface *destination, const DFBRectangle *destination_rect ); DFBResult (*SetRenderCallback) ( IDirectFBImageProvider *thiz, DIRenderCallback callback, void *callback_data ); }; # 4592 "/usr/include/directfb/directfb.h" typedef int (*DVFrameCallback)(void *ctx); # 4602 "/usr/include/directfb/directfb.h" struct _IDirectFBVideoProvider { void *priv; int magic; DFBResult (*AddRef)( IDirectFBVideoProvider *thiz ); DFBResult (*Release)( IDirectFBVideoProvider *thiz ); DFBResult (*GetCapabilities) ( IDirectFBVideoProvider *thiz, DFBVideoProviderCapabilities *ret_caps ); DFBResult (*GetSurfaceDescription) ( IDirectFBVideoProvider *thiz, DFBSurfaceDescription *ret_dsc ); DFBResult (*PlayTo) ( IDirectFBVideoProvider *thiz, IDirectFBSurface *destination, const DFBRectangle *destination_rect, DVFrameCallback callback, void *ctx ); DFBResult (*Stop) ( IDirectFBVideoProvider *thiz ); DFBResult (*SeekTo) ( IDirectFBVideoProvider *thiz, double seconds ); DFBResult (*GetPos) ( IDirectFBVideoProvider *thiz, double *ret_seconds ); DFBResult (*GetLength) ( IDirectFBVideoProvider *thiz, double *ret_seconds ); DFBResult (*GetColorAdjustment) ( IDirectFBVideoProvider *thiz, DFBColorAdjustment *ret_adj ); DFBResult (*SetColorAdjustment) ( IDirectFBVideoProvider *thiz, const DFBColorAdjustment *adj ); }; # 4708 "/usr/include/directfb/directfb.h" struct _IDirectFBDataBuffer { void *priv; int magic; DFBResult (*AddRef)( IDirectFBDataBuffer *thiz ); DFBResult (*Release)( IDirectFBDataBuffer *thiz ); DFBResult (*Flush) ( IDirectFBDataBuffer *thiz ); DFBResult (*SeekTo) ( IDirectFBDataBuffer *thiz, unsigned int offset ); DFBResult (*GetPosition) ( IDirectFBDataBuffer *thiz, unsigned int *ret_offset ); DFBResult (*GetLength) ( IDirectFBDataBuffer *thiz, unsigned int *ret_length ); DFBResult (*WaitForData) ( IDirectFBDataBuffer *thiz, unsigned int length ); DFBResult (*WaitForDataWithTimeout) ( IDirectFBDataBuffer *thiz, unsigned int length, unsigned int seconds, unsigned int milli_seconds ); DFBResult (*GetData) ( IDirectFBDataBuffer *thiz, unsigned int length, void *ret_data, unsigned int *ret_read ); DFBResult (*PeekData) ( IDirectFBDataBuffer *thiz, unsigned int length, int offset, void *ret_data, unsigned int *ret_read ); DFBResult (*HasData) ( IDirectFBDataBuffer *thiz ); DFBResult (*PutData) ( IDirectFBDataBuffer *thiz, const void *data, unsigned int length ); DFBResult (*CreateImageProvider) ( IDirectFBDataBuffer *thiz, IDirectFBImageProvider **interface ); }; uncrustify-0.59/tests/input/c/minus-minus.c0000644000175000017500000000043411506773275015774 00000000000000int a = 5; int *b = &a; int negneg(void) { return - -a; } int pospos(void) { return + +a; } int negpos(void) { return - +a; } int posneg(void) { return + -a; } #if VERSION < -5 int negnegneg(void) { return - - -a; } #else int negat(void) { return - *b; } #endif uncrustify-0.59/tests/input/c/align-struct-init.c0000644000175000017500000000156411506773275017072 00000000000000 const char *token_names[] = { [CT_POUND] = "POUND", [CT_PREPROC] = "PREPROC", [CT_PREPROC_BODY] = "PREPROC_BODY", [CT_PP] = "PP", [CT_ELIPSIS] = "ELIPSIS", [CT_NAMESPACE]= "NAMESPACE", [CT_NEW] = "NEW", [CT_OPERATOR] = "OPERATOR", [CT_THROW] = "THROW", [CT_TRY] = "TRY", [CT_USING] = "USING", [CT_PAREN_OPEN] = "PAREN_OPEN", }; int main(int argc, char *argv[]) { struct junk a[] = { { "version", 0, 0, 0}, {"file", 1, 150, 'f'}, {"config", 1, 0, 'c'}, {"parsed", 25, 0, 'p'}, { NULL, 0, 0, 0} }; } color_t colors[] = { {"red",{255,0,0}},{"blue",{0,255,0}}, {"green",{0,0,255}},{"purple",{255,255,0}}, }; struct foo_t bar = { .name = "bar", .age = 21 }; struct foo_t bars[] = { [0] = { .name = "bar", .age = 21 }, [1] = { .name = "barley", .age = 55 }, }; uncrustify-0.59/tests/input/c/pragma.c0000644000175000017500000000046711506773275014765 00000000000000 #pragma do not change anything in this pragma! // This next bit should parse as '#', pragma, preproc-body, nl-cont, // preproc-body, nl-cont, preproc-body #pragma multi \ line \ pragma #pragma mark -------- Protected Member Functions ---------------- #pragma some comment follows // comment uncrustify-0.59/tests/input/c/comment-convert.c0000644000175000017500000000112411506773275016625 00000000000000// This is your typical header comment int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines // Comment with embedded /* C comment */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; // Multi-line comment with embedded /* C comment */ and junk // afterwards res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 // second comment return(res); } // col1 comment in level 0 // and another uncrustify-0.59/tests/input/c/function-def.c0000644000175000017500000000070011506773275016065 00000000000000void foo1(int param1, int param2, char *param2); void foo2(int param1, int param2, char *param2); void foo3(int param1, int param2, char *param2 ); struct whoopee *foo4(int param1, int param2, char *param2); const struct snickers * foo5(int param1, int param2, char *param2); void foo(int param1, int param2, char *param2) { printf("boo!\n"); } EXPORT int DoStuff(int Num); uncrustify-0.59/tests/input/c/if_chain.c0000644000175000017500000000243711506773275015255 00000000000000void foo(void) { if (cond_a) { fcn_a(); fcn_b(); } else { fcn_c(); } if (cond_b) { fcn_d(); } else { fcn_e(); } if (cond_c) { fcn_f(); fcn_g(); } else fcn_h(); if (cond_d) fcn_i(); else { fcn_j(); fcn_k(); } if (cond_e) fcn_l(); else fcn_m(); if (cond_f) fcn_n(); else if (cond_g) { fcn_o(); while (cond_g) { fcn_p(); } } else if (cond_h) while (cond_i) { fcn_q(); fcn_r(); } else fcn_s(); } /* this next bit test whether vbraces can be successfully converted * when the closing brace is in an #ifdef. * Note that the author should have braced the code to begin with. */ void bar(void) { if (jiffies >= hw_priv->Counter[ port ].time) { hw_priv->Counter[ port ].fRead = 1; if (port == MAIN_PORT) { hw_priv->Counter[ MAIN_PORT ].time = jiffies + HZ * 6; } else hw_priv->Counter[ port ].time = #ifdef SOME_DEFINE hw_priv->Counter[ port - 1 ].time + HZ * 2; #else /* ifdef SOME_DEFINE */ hw_priv->Counter[ MAIN_PORT ].time + HZ * 2; #endif /* ifdef SOME_DEFINE */ } } void funct(int v1, int v2, int v3) { if ( v1 ) { if ( v2 ) f1(); } else { if ( v3 ) f2(); } } uncrustify-0.59/tests/input/c/sort_include.c0000644000175000017500000000024311506773275016200 00000000000000// should be ddd, eee, fff #include "ddd" #include "fff" #include "eee" // should be aaa, ccc #include "ccc" #include "aaa" // should be just bbb #include "bbb" uncrustify-0.59/tests/input/c/global-vars.c0000644000175000017500000000016711506773275015724 00000000000000 static int another_try; struct something yup; align_me_t please; const char *name = "hello"; static nothing really; uncrustify-0.59/tests/input/c/struct-brace.c0000644000175000017500000000036611506773275016112 00000000000000struct foo { unsigned int d_ino; unsigned short d_reclen; unsigned short d_namlen; char d_name[1]; }; struct foo { unsigned int d_ino; unsigned short d_reclen; unsigned short d_namlen; char d_name[1]; }; struct foo { int a; char *b }; uncrustify-0.59/tests/input/c/paren_indent.c0000644000175000017500000000015311506773275016154 00000000000000function1 (something1); function2 (something2); x = (float) (number); x = (float) (number); uncrustify-0.59/tests/input/c/align-string.c0000644000175000017500000000046711506773275016114 00000000000000 // note - set threshold to three void foo(void) { printf("This is the first line\n" "And this is the second.\n"); fprintf(stderr, "This is the first line\n" "And this is the second.\n"); fprintf(stderr, "Format string: %s", "This is the first line\n" "And this is the second.\n"); } uncrustify-0.59/tests/input/c/nl_create_one_liner.c0000644000175000017500000000017211506773275017475 00000000000000void foo() { if (a) b++; if (a) { b++; } if (a) if (b) c++; for (i=0;i<5;i++) bar(i); while (i>0) bar(--i); } uncrustify-0.59/tests/input/c/nl-ver-def.c0000644000175000017500000000013011506773275015440 00000000000000void foo(void) { int a; int b;// comment /* comment */ a = b; return; } uncrustify-0.59/tests/input/c/brace.c0000644000175000017500000000023411506773275014562 00000000000000 int function(int arg) { int i; for (i=0;i<5;i++){ /* Do something... */ } if(i<0){ /*Do something else...*/ } return 0; } uncrustify-0.59/tests/input/c/hello.c0000644000175000017500000000027711506773275014620 00000000000000#include void HelloWorld(char* pString) { printf("%s\n", pString); } /* HelloWorld */ int main() { HelloWorld("Hello world"); return 0; } /* main */ uncrustify-0.59/tests/input/c/braces.c0000644000175000017500000000250111506773275014744 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) // trailing C++ comment b++; do // trailing C++ comment { a--; } while (a > 0); do a--; while (a > 0); for (a = 0; a < 10; a++) // trailing C++ comment { printf("a=%d\n", a); } if (a == 10) // trailing C++ comment { printf("a looks good\n"); } else // trailing C++ comment { printf("not so good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } else if (b != 0) a /= b; else // trailing C++ comment a += b; } } list_for_each(k) { if (a) if (b) { c++; } } while (1) ; /* hang forever */ } void f() { if (buf[0] == '~' && strchr(tmp, '/') == NULL) { buf = mallocstrcpy(buf, tmp); matches = username_tab_completion(tmp, &num_matches); } /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ else if (strlen(buf) > strlen(tmp)) buf = mallocstrcpy(buf, tmp); } void f() {} void g() {} uncrustify-0.59/tests/input/c/i2c-core.c0000644000175000017500000007770111506773275015126 00000000000000/* i2c-core.c - a device driver for the iic-bus interface */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-99 Simon G. Vogl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kysti Mlkki . All SMBus-related things are written by Frodo Looijaard SMBus 2.0 support by Mark Studebaker */ #include #include #include #include #include #include #include #include #include static LIST_HEAD(adapters); static LIST_HEAD(drivers); static DECLARE_MUTEX(core_lists); static DEFINE_IDR(i2c_adapter_idr); static int i2c_device_match(struct device *dev, struct device_driver *drv) { return 1; } static int i2c_bus_suspend(struct device * dev, pm_message_t state) { int rc = 0; if (dev->driver && dev->driver->suspend) rc = dev->driver->suspend(dev,state,0); return rc; } static int i2c_bus_resume(struct device * dev) { int rc = 0; if (dev->driver && dev->driver->resume) rc = dev->driver->resume(dev,0); return rc; } struct bus_type i2c_bus_type = { .name = "i2c", .match = i2c_device_match, .suspend = i2c_bus_suspend, .resume = i2c_bus_resume, }; static int i2c_device_probe(struct device *dev) { return -ENODEV; } static int i2c_device_remove(struct device *dev) { return 0; } void i2c_adapter_dev_release(struct device *dev) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); complete(&adap->dev_released); } struct device_driver i2c_adapter_driver = { .name = "i2c_adapter", .bus = &i2c_bus_type, .probe = i2c_device_probe, .remove = i2c_device_remove, }; static void i2c_adapter_class_dev_release(struct class_device *dev) { struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev); complete(&adap->class_dev_released); } struct class i2c_adapter_class = { .name = "i2c-adapter", .release = &i2c_adapter_class_dev_release, }; static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); return sprintf(buf, "%s\n", adap->name); } static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); static void i2c_client_release(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); complete(&client->released); } static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); return sprintf(buf, "%s\n", client->name); } /* * We can't use the DEVICE_ATTR() macro here as we want the same filename for a * different type of a device. So beware if the DEVICE_ATTR() macro ever * changes, this definition will also have to change. */ static struct device_attribute dev_attr_client_name = { .attr = {.name = "name", .mode = S_IRUGO, .owner = THIS_MODULE }, .show = &show_client_name, }; /* --------------------------------------------------- * registering functions * --------------------------------------------------- */ /* ----- * i2c_add_adapter is called from within the algorithm layer, * when a new hw adapter registers. A new device is register to be * available for clients. */ int i2c_add_adapter(struct i2c_adapter *adap) { int id, res = 0; struct list_head *item; struct i2c_driver *driver; down(&core_lists); if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) { res = -ENOMEM; goto out_unlock; } res = idr_get_new(&i2c_adapter_idr, adap, &id); if (res < 0) { if (res == -EAGAIN) res = -ENOMEM; goto out_unlock; } adap->nr = id & MAX_ID_MASK; init_MUTEX(&adap->bus_lock); init_MUTEX(&adap->clist_lock); list_add_tail(&adap->list,&adapters); INIT_LIST_HEAD(&adap->clients); /* Add the adapter to the driver core. * If the parent pointer is not set up, * we add this adapter to the host bus. */ if (adap->dev.parent == NULL) adap->dev.parent = &platform_bus; sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); adap->dev.driver = &i2c_adapter_driver; adap->dev.release = &i2c_adapter_dev_release; device_register(&adap->dev); device_create_file(&adap->dev, &dev_attr_name); /* Add this adapter to the i2c_adapter class */ memset(&adap->class_dev, 0x00, sizeof(struct class_device)); adap->class_dev.dev = &adap->dev; adap->class_dev.class = &i2c_adapter_class; strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE); class_device_register(&adap->class_dev); dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); /* inform drivers of new adapters */ list_for_each(item,&drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->flags & I2C_DF_NOTIFY) /* We ignore the return code; if it fails, too bad */ driver->attach_adapter(adap); } out_unlock: up(&core_lists); return res; } int i2c_del_adapter(struct i2c_adapter *adap) { struct list_head *item, *_n; struct i2c_adapter *adap_from_list; struct i2c_driver *driver; struct i2c_client *client; int res = 0; down(&core_lists); /* First make sure that this adapter was ever added */ list_for_each_entry(adap_from_list, &adapters, list) { if (adap_from_list == adap) break; } if (adap_from_list != adap) { pr_debug("i2c-core: attempting to delete unregistered " "adapter [%s]\n", adap->name); res = -EINVAL; goto out_unlock; } list_for_each(item,&drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->detach_adapter) if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } /* detach any active clients. This must be done first, because * it can fail; in which case we give up. */ list_for_each_safe(item, _n, &adap->clients) { client = list_entry(item, struct i2c_client, list); /* detaching devices is unconditional of the set notify * flag, as _all_ clients that reside on the adapter * must be deleted, as this would cause invalid states. */ if ((res=client->driver->detach_client(client))) { dev_err(&adap->dev, "detach_client failed for client " "[%s] at address 0x%02x\n", client->name, client->addr); goto out_unlock; } } /* clean up the sysfs representation */ init_completion(&adap->dev_released); init_completion(&adap->class_dev_released); class_device_unregister(&adap->class_dev); device_remove_file(&adap->dev, &dev_attr_name); device_unregister(&adap->dev); list_del(&adap->list); /* wait for sysfs to drop all references */ wait_for_completion(&adap->dev_released); wait_for_completion(&adap->class_dev_released); /* free dynamically allocated bus id */ idr_remove(&i2c_adapter_idr, adap->nr); dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); out_unlock: up(&core_lists); return res; } /* ----- * What follows is the "upwards" interface: commands for talking to clients, * which implement the functions to access the physical information of the * chips. */ int i2c_add_driver(struct i2c_driver *driver) { struct list_head *item; struct i2c_adapter *adapter; int res = 0; down(&core_lists); /* add the driver to the list of i2c drivers in the driver core */ driver->driver.name = driver->name; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_device_probe; driver->driver.remove = i2c_device_remove; res = driver_register(&driver->driver); if (res) goto out_unlock; list_add_tail(&driver->list,&drivers); pr_debug("i2c-core: driver [%s] registered\n", driver->name); /* now look for instances of driver on our adapters */ if (driver->flags & I2C_DF_NOTIFY) { list_for_each(item,&adapters) { adapter = list_entry(item, struct i2c_adapter, list); driver->attach_adapter(adapter); } } out_unlock: up(&core_lists); return res; } int i2c_del_driver(struct i2c_driver *driver) { struct list_head *item1, *item2, *_n; struct i2c_client *client; struct i2c_adapter *adap; int res = 0; down(&core_lists); /* Have a look at each adapter, if clients of this driver are still * attached. If so, detach them to be able to kill the driver * afterwards. * * Removing clients does not depend on the notify flag, else * invalid operation might (will!) result, when using stale client * pointers. */ list_for_each(item1,&adapters) { adap = list_entry(item1, struct i2c_adapter, list); if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } else { list_for_each_safe(item2, _n, &adap->clients) { client = list_entry(item2, struct i2c_client, list); if (client->driver != driver) continue; dev_dbg(&adap->dev, "detaching client [%s] " "at 0x%02x\n", client->name, client->addr); if ((res = driver->detach_client(client))) { dev_err(&adap->dev, "detach_client " "failed for client [%s] at " "0x%02x\n", client->name, client->addr); goto out_unlock; } } } } driver_unregister(&driver->driver); list_del(&driver->list); pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); out_unlock: up(&core_lists); return 0; } static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr) { struct list_head *item; struct i2c_client *client; list_for_each(item,&adapter->clients) { client = list_entry(item, struct i2c_client, list); if (client->addr == addr) return -EBUSY; } return 0; } int i2c_check_addr(struct i2c_adapter *adapter, int addr) { int rval; down(&adapter->clist_lock); rval = __i2c_check_addr(adapter, addr); up(&adapter->clist_lock); return rval; } int i2c_attach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; down(&adapter->clist_lock); if (__i2c_check_addr(client->adapter, client->addr)) { up(&adapter->clist_lock); return -EBUSY; } list_add_tail(&client->list,&adapter->clients); up(&adapter->clist_lock); if (adapter->client_register) { if (adapter->client_register(client)) { dev_dbg(&adapter->dev, "client_register " "failed for client [%s] at 0x%02x\n", client->name, client->addr); } } if (client->flags & I2C_CLIENT_ALLOW_USE) client->usage_count = 0; client->dev.parent = &client->adapter->dev; client->dev.driver = &client->driver->driver; client->dev.bus = &i2c_bus_type; client->dev.release = &i2c_client_release; snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), "%d-%04x", i2c_adapter_id(adapter), client->addr); dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", client->name, client->dev.bus_id); device_register(&client->dev); device_create_file(&client->dev, &dev_attr_client_name); return 0; } int i2c_detach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int res = 0; if ((client->flags & I2C_CLIENT_ALLOW_USE) && (client->usage_count > 0)) { dev_warn(&client->dev, "Client [%s] still busy, " "can't detach\n", client->name); return -EBUSY; } if (adapter->client_unregister) { res = adapter->client_unregister(client); if (res) { dev_err(&client->dev, "client_unregister [%s] failed, " "client not detached\n", client->name); goto out; } } down(&adapter->clist_lock); list_del(&client->list); init_completion(&client->released); device_remove_file(&client->dev, &dev_attr_client_name); device_unregister(&client->dev); up(&adapter->clist_lock); wait_for_completion(&client->released); out: return res; } static int i2c_inc_use_client(struct i2c_client *client) { if (!try_module_get(client->driver->owner)) return -ENODEV; if (!try_module_get(client->adapter->owner)) { module_put(client->driver->owner); return -ENODEV; } return 0; } static void i2c_dec_use_client(struct i2c_client *client) { module_put(client->driver->owner); module_put(client->adapter->owner); } int i2c_use_client(struct i2c_client *client) { int ret; ret = i2c_inc_use_client(client); if (ret) return ret; if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) client->usage_count++; else if (client->usage_count > 0) goto busy; else client->usage_count++; } return 0; busy: i2c_dec_use_client(client); return -EBUSY; } int i2c_release_client(struct i2c_client *client) { if(client->flags & I2C_CLIENT_ALLOW_USE) { if(client->usage_count>0) client->usage_count--; else { pr_debug("i2c-core: %s used one too many times\n", __FUNCTION__); return -EPERM; } } i2c_dec_use_client(client); return 0; } void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) { struct list_head *item; struct i2c_client *client; down(&adap->clist_lock); list_for_each(item,&adap->clients) { client = list_entry(item, struct i2c_client, list); if (!try_module_get(client->driver->owner)) continue; if (NULL != client->driver->command) { up(&adap->clist_lock); client->driver->command(client,cmd,arg); down(&adap->clist_lock); } module_put(client->driver->owner); } up(&adap->clist_lock); } static int __init i2c_init(void) { int retval; retval = bus_register(&i2c_bus_type); if (retval) return retval; retval = driver_register(&i2c_adapter_driver); if (retval) return retval; return class_register(&i2c_adapter_class); } static void __exit i2c_exit(void) { class_unregister(&i2c_adapter_class); driver_unregister(&i2c_adapter_driver); bus_unregister(&i2c_bus_type); } subsys_initcall(i2c_init); module_exit(i2c_exit); /* ---------------------------------------------------- * the functional interface to the i2c busses. * ---------------------------------------------------- */ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num) { int ret; if (adap->algo->master_xfer) { #ifdef DEBUG for (ret = 0; ret < num; ret++) { dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, " "len=%d\n", ret, msgs[ret].flags & I2C_M_RD ? 'R' : 'W', msgs[ret].addr, msgs[ret].len); } #endif down(&adap->bus_lock); ret = adap->algo->master_xfer(adap,msgs,num); up(&adap->bus_lock); return ret; } else { dev_dbg(&adap->dev, "I2C level transfers not supported\n"); return -ENOSYS; } } int i2c_master_send(struct i2c_client *client,const char *buf ,int count) { int ret; struct i2c_adapter *adap=client->adapter; struct i2c_msg msg; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.len = count; msg.buf = (char *)buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes transmitted, else error code. */ return (ret == 1) ? count : ret; } int i2c_master_recv(struct i2c_client *client, char *buf ,int count) { struct i2c_adapter *adap=client->adapter; struct i2c_msg msg; int ret; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.flags |= I2C_M_RD; msg.len = count; msg.buf = buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes transmitted, else error code. */ return (ret == 1) ? count : ret; } int i2c_control(struct i2c_client *client, unsigned int cmd, unsigned long arg) { int ret = 0; struct i2c_adapter *adap = client->adapter; dev_dbg(&client->adapter->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg); switch (cmd) { case I2C_RETRIES: adap->retries = arg; break; case I2C_TIMEOUT: adap->timeout = arg; break; default: if (adap->algo->algo_control!=NULL) ret = adap->algo->algo_control(adap,cmd,arg); } return ret; } /* ---------------------------------------------------- * the i2c address scanning function * Will not work for 10-bit addresses! * ---------------------------------------------------- */ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind, int (*found_proc) (struct i2c_adapter *, int, int)) { int err; /* Make sure the address is valid */ if (addr < 0x03 || addr > 0x77) { dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n", addr); return -EINVAL; } /* Skip if already in use */ if (i2c_check_addr(adapter, addr)) return 0; /* Make sure there is something at this address, unless forced */ if (kind < 0) { if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0) return 0; /* prevent 24RF08 corruption */ if ((addr & ~0x0f) == 0x50) i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL); } /* Finally call the custom detection function */ err = found_proc(adapter, addr, kind); /* -ENODEV can be returned if there is a chip at the given address but it isn't supported by this chip driver. We catch it here as this isn't an error. */ return (err == -ENODEV) ? 0 : err; } int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data, int (*found_proc) (struct i2c_adapter *, int, int)) { int i, err; int adap_id = i2c_adapter_id(adapter); /* Forget it if we can't probe using SMBUS_QUICK */ if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_QUICK)) return -1; /* Force entries are done first, and are not affected by ignore entries */ if (address_data->forces) { unsigned short **forces = address_data->forces; int kind; for (kind = 0; forces[kind]; kind++) { for (i = 0; forces[kind][i] != I2C_CLIENT_END; i += 2) { if (forces[kind][i] == adap_id || forces[kind][i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found force " "parameter for adapter %d, " "addr 0x%02x, kind %d\n", adap_id, forces[kind][i + 1], kind); err = i2c_probe_address(adapter, forces[kind][i + 1], kind, found_proc); if (err) return err; } } } } /* Probe entries are done second, and are not affected by ignore entries either */ for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { if (address_data->probe[i] == adap_id || address_data->probe[i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found probe parameter for " "adapter %d, addr 0x%02x\n", adap_id, address_data->probe[i + 1]); err = i2c_probe_address(adapter, address_data->probe[i + 1], -1, found_proc); if (err) return err; } } /* Normal entries are done last, unless shadowed by an ignore entry */ for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { int j, ignore; ignore = 0; for (j = 0; address_data->ignore[j] != I2C_CLIENT_END; j += 2) { if ((address_data->ignore[j] == adap_id || address_data->ignore[j] == ANY_I2C_BUS) && address_data->ignore[j + 1] == address_data->normal_i2c[i]) { dev_dbg(&adapter->dev, "found ignore " "parameter for adapter %d, " "addr 0x%02x\n", adap_id, address_data->ignore[j + 1]); } ignore = 1; break; } if (ignore) continue; dev_dbg(&adapter->dev, "found normal entry for adapter %d, " "addr 0x%02x\n", adap_id, address_data->normal_i2c[i]); err = i2c_probe_address(adapter, address_data->normal_i2c[i], -1, found_proc); if (err) return err; } return 0; } struct i2c_adapter* i2c_get_adapter(int id) { struct i2c_adapter *adapter; down(&core_lists); adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); if (adapter && !try_module_get(adapter->owner)) adapter = NULL; up(&core_lists); return adapter; } void i2c_put_adapter(struct i2c_adapter *adap) { module_put(adap->owner); } /* The SMBus parts */ #define POLY (0x1070U << 3) static u8 crc8(u16 data) { int i; for(i = 0; i < 8; i++) { if (data & 0x8000) data = data ^ POLY; data = data << 1; } return (u8)(data >> 8); } /* CRC over count bytes in the first array plus the bytes in the rest array if it is non-null. rest[0] is the (length of rest) - 1 and is included. */ static u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest) { int i; for(i = 0; i < count; i++) crc = crc8((crc ^ first[i]) << 8); if(rest != NULL) for(i = 0; i <= rest[0]; i++) crc = crc8((crc ^ rest[i]) << 8); return crc; } static u8 i2c_smbus_pec(int count, u8 *first, u8 *rest) { return i2c_smbus_partial_pec(0, count, first, rest); } /* Returns new "size" (transaction type) Note that we convert byte to byte_data and byte_data to word_data rather than invent new xxx_PEC transactions. */ static int i2c_smbus_add_pec(u16 addr, u8 command, int size, union i2c_smbus_data *data) { u8 buf[3]; buf[0] = addr << 1; buf[1] = command; switch(size) { case I2C_SMBUS_BYTE: data->byte = i2c_smbus_pec(2, buf, NULL); size = I2C_SMBUS_BYTE_DATA; break; case I2C_SMBUS_BYTE_DATA: buf[2] = data->byte; data->word = buf[2] || (i2c_smbus_pec(3, buf, NULL) << 8); size = I2C_SMBUS_WORD_DATA; break; case I2C_SMBUS_WORD_DATA: /* unsupported */ break; case I2C_SMBUS_BLOCK_DATA: data->block[data->block[0] + 1] = i2c_smbus_pec(2, buf, data->block); size = I2C_SMBUS_BLOCK_DATA_PEC; break; } return size; } static int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial, union i2c_smbus_data *data) { u8 buf[3], rpec, cpec; buf[1] = command; switch(size) { case I2C_SMBUS_BYTE_DATA: buf[0] = (addr << 1) | 1; cpec = i2c_smbus_pec(2, buf, NULL); rpec = data->byte; break; case I2C_SMBUS_WORD_DATA: buf[0] = (addr << 1) | 1; buf[2] = data->word & 0xff; cpec = i2c_smbus_pec(3, buf, NULL); rpec = data->word >> 8; break; case I2C_SMBUS_WORD_DATA_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_PROC_CALL_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_BLOCK_DATA_PEC: buf[0] = (addr << 1); buf[2] = (addr << 1) | 1; cpec = i2c_smbus_pec(3, buf, data->block); rpec = data->block[data->block[0] + 1]; break; case I2C_SMBUS_BLOCK_PROC_CALL_PEC: buf[0] = (addr << 1) | 1; rpec = i2c_smbus_partial_pec(partial, 1, buf, data->block); cpec = data->block[data->block[0] + 1]; break; default: cpec = rpec = 0; break; } if (rpec != cpec) { pr_debug("i2c-core: Bad PEC 0x%02x vs. 0x%02x\n", rpec, cpec); return -1; } return 0; } s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) { return i2c_smbus_xfer(client->adapter,client->addr,client->flags, value,0,I2C_SMBUS_QUICK,NULL); } s32 i2c_smbus_read_byte(struct i2c_client *client) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,0,I2C_SMBUS_BYTE, &data)) return -1; else return 0x0FF & data.byte; } s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) { union i2c_smbus_data data; /* only for PEC */ return i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_WRITE,value, I2C_SMBUS_BYTE,&data); } s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,command, I2C_SMBUS_BYTE_DATA,&data)) return -1; else return 0x0FF & data.byte; } s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) { union i2c_smbus_data data; data.byte = value; return i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_WRITE,command, I2C_SMBUS_BYTE_DATA,&data); } s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,command, I2C_SMBUS_WORD_DATA, &data)) return -1; else return 0x0FFFF & data.word; } s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) { union i2c_smbus_data data; data.word = value; return i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_WRITE,command, I2C_SMBUS_WORD_DATA,&data); } s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, u8 length, u8 *values) { union i2c_smbus_data data; int i; if (length > I2C_SMBUS_BLOCK_MAX) length = I2C_SMBUS_BLOCK_MAX; for (i = 1; i <= length; i++) data.block[i] = values[i-1]; data.block[0] = length; return i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_WRITE,command, I2C_SMBUS_BLOCK_DATA,&data); } /* Returns the number of read bytes */ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) { union i2c_smbus_data data; int i; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,command, I2C_SMBUS_I2C_BLOCK_DATA,&data)) return -1; else { for (i = 1; i <= data.block[0]; i++) values[i-1] = data.block[i]; return data.block[0]; } } /* Simulate a SMBus command using the i2c protocol No checking of parameters is done! */ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data * data) { /* So we need to generate a series of msgs. In the case of writing, we need to use only one message; when reading, we need two. We initialize most things with sane defaults, to keep the code below somewhat simpler. */ unsigned char msgbuf0[34]; unsigned char msgbuf1[34]; int num = read_write == I2C_SMBUS_READ?2:1; struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, { addr, flags | I2C_M_RD, 0, msgbuf1 } }; int i; msgbuf0[0] = command; switch(size) { case I2C_SMBUS_QUICK: msg[0].len = 0; /* Special case: The read/write field is used as data */ msg[0].flags = flags | (read_write==I2C_SMBUS_READ)?I2C_M_RD:0; num = 1; break; case I2C_SMBUS_BYTE: if (read_write == I2C_SMBUS_READ) { /* Special case: only a read! */ msg[0].flags = I2C_M_RD | flags; num = 1; } break; case I2C_SMBUS_BYTE_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = 1; else { msg[0].len = 2; msgbuf0[1] = data->byte; } break; case I2C_SMBUS_WORD_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = 2; else { msg[0].len=3; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; } break; case I2C_SMBUS_PROC_CALL: num = 2; /* Special case */ read_write = I2C_SMBUS_READ; msg[0].len = 3; msg[1].len = 2; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; break; case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA_PEC: if (read_write == I2C_SMBUS_READ) { dev_err(&adapter->dev, "Block read not supported " "under I2C emulation!\n"); return -1; } else { msg[0].len = data->block[0] + 2; if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) { dev_err(&adapter->dev, "smbus_access called with " "invalid block write size (%d)\n", data->block[0]); return -1; } if(size == I2C_SMBUS_BLOCK_DATA_PEC) (msg[0].len)++; for (i = 1; i <= msg[0].len; i++) msgbuf0[i] = data->block[i-1]; } break; case I2C_SMBUS_BLOCK_PROC_CALL: case I2C_SMBUS_BLOCK_PROC_CALL_PEC: dev_dbg(&adapter->dev, "Block process call not supported " "under I2C emulation!\n"); return -1; case I2C_SMBUS_I2C_BLOCK_DATA: if (read_write == I2C_SMBUS_READ) { msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; } else { msg[0].len = data->block[0] + 1; if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) { dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " "invalid block write size (%d)\n", data->block[0]); return -1; } for (i = 1; i <= data->block[0]; i++) msgbuf0[i] = data->block[i]; } break; default: dev_err(&adapter->dev, "smbus_access called with invalid size (%d)\n", size); return -1; } if (i2c_transfer(adapter, msg, num) < 0) return -1; if (read_write == I2C_SMBUS_READ) switch(size) { case I2C_SMBUS_BYTE: data->byte = msgbuf0[0]; break; case I2C_SMBUS_BYTE_DATA: data->byte = msgbuf1[0]; break; case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_PROC_CALL: data->word = msgbuf1[0] | (msgbuf1[1] << 8); break; case I2C_SMBUS_I2C_BLOCK_DATA: /* fixed at 32 for now */ data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX; for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++) data->block[i+1] = msgbuf1[i]; break; } return 0; } s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data * data) { s32 res; int swpec = 0; u8 partial = 0; flags &= I2C_M_TEN | I2C_CLIENT_PEC; if((flags & I2C_CLIENT_PEC) && !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) { swpec = 1; if(read_write == I2C_SMBUS_READ && size == I2C_SMBUS_BLOCK_DATA) size = I2C_SMBUS_BLOCK_DATA_PEC; else if(size == I2C_SMBUS_PROC_CALL) size = I2C_SMBUS_PROC_CALL_PEC; else if(size == I2C_SMBUS_BLOCK_PROC_CALL) { i2c_smbus_add_pec(addr, command, I2C_SMBUS_BLOCK_DATA, data); partial = data->block[data->block[0] + 1]; size = I2C_SMBUS_BLOCK_PROC_CALL_PEC; } else if(read_write == I2C_SMBUS_WRITE && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA) size = i2c_smbus_add_pec(addr, command, size, data); } if (adapter->algo->smbus_xfer) { down(&adapter->bus_lock); res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write, command,size,data); up(&adapter->bus_lock); } else res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write, command,size,data); if(res >= 0 && swpec && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA && (read_write == I2C_SMBUS_READ || size == I2C_SMBUS_PROC_CALL_PEC || size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) { if(i2c_smbus_check_pec(addr, command, size, partial, data)) return -1; } return res; } /* Next four are needed by i2c-isa */ EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); EXPORT_SYMBOL_GPL(i2c_adapter_driver); EXPORT_SYMBOL_GPL(i2c_adapter_class); EXPORT_SYMBOL_GPL(i2c_bus_type); EXPORT_SYMBOL(i2c_add_adapter); EXPORT_SYMBOL(i2c_del_adapter); EXPORT_SYMBOL(i2c_add_driver); EXPORT_SYMBOL(i2c_del_driver); EXPORT_SYMBOL(i2c_attach_client); EXPORT_SYMBOL(i2c_detach_client); EXPORT_SYMBOL(i2c_use_client); EXPORT_SYMBOL(i2c_release_client); EXPORT_SYMBOL(i2c_clients_command); EXPORT_SYMBOL(i2c_check_addr); EXPORT_SYMBOL(i2c_master_send); EXPORT_SYMBOL(i2c_master_recv); EXPORT_SYMBOL(i2c_control); EXPORT_SYMBOL(i2c_transfer); EXPORT_SYMBOL(i2c_get_adapter); EXPORT_SYMBOL(i2c_put_adapter); EXPORT_SYMBOL(i2c_probe); EXPORT_SYMBOL(i2c_smbus_xfer); EXPORT_SYMBOL(i2c_smbus_write_quick); EXPORT_SYMBOL(i2c_smbus_read_byte); EXPORT_SYMBOL(i2c_smbus_write_byte); EXPORT_SYMBOL(i2c_smbus_read_byte_data); EXPORT_SYMBOL(i2c_smbus_write_byte_data); EXPORT_SYMBOL(i2c_smbus_read_word_data); EXPORT_SYMBOL(i2c_smbus_write_word_data); EXPORT_SYMBOL(i2c_smbus_write_block_data); EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); MODULE_AUTHOR("Simon G. Vogl "); MODULE_DESCRIPTION("I2C-Bus main module"); MODULE_LICENSE("GPL"); uncrustify-0.59/tests/input/c/include_define.h0000644000175000017500000000006511506773275016452 00000000000000#define MY_HEADER #include MY_HEADER uncrustify-0.59/tests/input/c/braces-2.c0000644000175000017500000000024211506773275015103 00000000000000while (a >= 0) { if (b) for (j = 0; j < 10; j++) { if (j == b) { return; } a++; } b--; } uncrustify-0.59/tests/input/c/output.cpp0000644000175000017500000004045711506773275015421 00000000000000/** * @file output.cpp * Does all the output & comment formatting. * * $Id: output.cpp 510 2006-09-20 01:14:56Z bengardner $ */ #include "uncrustify_types.h" #include "prototypes.h" #include "chunk_list.h" #include #include void add_char(char ch) { /* convert a newline into the LF/CRLF/CR sequence */ if (ch == '\n') { fputs(cpd.newline, cpd.fout); cpd.column = 1; cpd.did_newline = 1; } else { fputc(ch, cpd.fout); if (ch == '\t') { cpd.column = next_tab_column(cpd.column); } else { cpd.column++; } } } void add_text(const char *text) { char ch; while ((ch = *text) != 0) { text++; add_char(ch); } } void add_text_len(const char *text, int len) { while (len-- > 0) { add_char(*text); text++; } } /** * Advance to a specific column * cpd.column is the current column * * @param column The column to advance to */ void output_to_column(int column, bool allow_tabs) { int nc; cpd.did_newline = 0; if (allow_tabs) { /* tab out as far as possible and then use spaces */ while ((nc = next_tab_column(cpd.column)) <= column) { add_text("\t"); } } /* space out the final bit */ while (cpd.column < column) { add_text(" "); } } void output_indent(int column, int brace_col) { if ((cpd.column == 1) && (cpd.settings[UO_indent_with_tabs].n != 0)) { if (cpd.settings[UO_indent_with_tabs].n == 2) { brace_col = column; } /* tab out as far as possible and then use spaces */ int nc; while ((nc = next_tab_column(cpd.column)) <= brace_col) { add_text("\t"); } } /* space out the rest */ while (cpd.column < column) { add_text(" "); } } void output_parsed(FILE *pfile) { chunk_t *pc; int cnt; output_options(pfile); output_defines(pfile); output_types(pfile); fprintf(pfile, "-=====-\n"); fprintf(pfile, "Line Tag Parent Columns Br/Lvl/pp Flg Nl Text"); for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { fprintf(pfile, "\n%3d> %13.13s[%13.13s][%2d/%2d/%2d][%d/%d/%d][%6x][%d-%d]", pc->orig_line, get_token_name(pc->type), get_token_name(pc->parent_type), pc->column, pc->orig_col, pc->orig_col_end, pc->brace_level, pc->level, pc->pp_level, pc->flags, pc->nl_count, pc->after_tab); if ((pc->type != CT_NEWLINE) && (pc->len != 0)) { for (cnt = 0; cnt < pc->column; cnt++) { fprintf(pfile, " "); } fprintf(pfile, "%.*s", pc->len, pc->str); } } fprintf(pfile, "\n-=====-\n"); fflush(pfile); } void output_options(FILE *pfile) { int idx; const option_map_value *ptr; fprintf(pfile, "-== Options ==-\n"); for (idx = 0; idx < UO_option_count; idx++) { ptr = get_option_name(idx); if (ptr != NULL) { if (ptr->type == AT_BOOL) { fprintf(pfile, "%3d) %32s = %s\n", ptr->id, ptr->name, cpd.settings[ptr->id].b ? "True" : "False"); } else if (ptr->type == AT_IARF) { fprintf(pfile, "%3d) %32s = %s\n", ptr->id, ptr->name, (cpd.settings[ptr->id].a == AV_ADD) ? "Add" : (cpd.settings[ptr->id].a == AV_REMOVE) ? "Remove" : (cpd.settings[ptr->id].a == AV_FORCE) ? "Force" : "Ignore"); } else if (ptr->type == AT_LINE) { fprintf(pfile, "%3d) %32s = %s\n", ptr->id, ptr->name, (cpd.settings[ptr->id].le == LE_AUTO) ? "Auto" : (cpd.settings[ptr->id].le == LE_LF) ? "LF" : (cpd.settings[ptr->id].le == LE_CRLF) ? "CRLF" : (cpd.settings[ptr->id].le == LE_CR) ? "CR" : "???"); } else /* AT_NUM */ { fprintf(pfile, "%3d) %32s = %d\n", ptr->id, ptr->name, cpd.settings[ptr->id].n); } } } } /** * This renders the chunk list to a file. */ void output_text(FILE *pfile) { chunk_t *pc; chunk_t *prev; int cnt; int lvlcol; bool allow_tabs; cpd.fout = pfile; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type == CT_NEWLINE) { for (cnt = 0; cnt < pc->nl_count; cnt++) { add_char('\n'); } cpd.did_newline = 1; cpd.column = 1; LOG_FMT(LOUTIND, " xx\n"); } else if (pc->type == CT_COMMENT_MULTI) { output_comment_multi(pc); } else if (pc->type == CT_COMMENT_CPP) { pc = output_comment_cpp(pc); } else if (pc->len == 0) { /* don't do anything for non-visible stuff */ LOG_FMT(LOUTIND, " <%d> -", pc->column); } else { /* indent to the 'level' first */ if (cpd.did_newline) { if (cpd.settings[UO_indent_with_tabs].n == 1) { lvlcol = 1 + (pc->brace_level * cpd.settings[UO_indent_columns].n); if ((pc->column >= lvlcol) && (lvlcol > 1)) { output_to_column(lvlcol, true); } } allow_tabs = (cpd.settings[UO_indent_with_tabs].n == 2) || (chunk_is_comment(pc) && (cpd.settings[UO_indent_with_tabs].n != 0)); LOG_FMT(LOUTIND, " %d> col %d/%d - ", pc->orig_line, pc->column, cpd.column); } else { /* not the first item on a line */ if (cpd.settings[UO_align_keep_tabs].b) { allow_tabs = pc->after_tab; } else { prev = chunk_get_prev(pc); allow_tabs = (cpd.settings[UO_align_with_tabs].b && ((pc->flags & PCF_WAS_ALIGNED) != 0) && (((pc->column - 1) % cpd.settings[UO_output_tab_size].n) == 0) && ((prev->column + prev->len + 1) != pc->column)); } LOG_FMT(LOUTIND, " %d -", pc->column); } output_to_column(pc->column, allow_tabs); add_text_len(pc->str, pc->len); cpd.did_newline = chunk_is_newline(pc); } } } /** * Given a multi-line comemnt block that starts in column X, figure out how * much subsequent lines should be indented. * * The answer is either 0 or 1. * * The decision is based on: * - the first line length * - the second line leader length * - the last line length * * If the first and last line are the same length and don't contain any alnum * chars and (the first line len > 2 or the second leader is the same as the * first line length), then the indent is 0. * * If the leader on the second line is 1 wide or missing, then the indent is 1. * * Otherwise, the indent is 0. * * @param str The comment string * @param len Length of the comment * @param start_col Starting column * @return 0 or 1 */ static int calculate_comment_body_indent(const char *str, int len, int start_col) { int idx = 0; int first_len = 0; int last_len = 0; int width = 0; /* find the last line length */ for (idx = len - 1; idx > 0; idx--) { if ((str[idx] == '\n') || (str[idx] == '\r')) { idx++; while ((idx < len) && ((str[idx] == ' ') || (str[idx] == '\t'))) { idx++; } last_len = len - idx; break; } } /* find the first line length */ for (idx = 0; idx < len; idx++) { if ((str[idx] == '\n') || (str[idx] == '\r')) { first_len = idx; while ((str[first_len - 1] == ' ') || (str[first_len - 1] == '\t')) { first_len--; } /* handle DOS endings */ if ((str[idx] == '\r') && (str[idx + 1] == '\n')) { idx++; } idx++; break; } } /* Scan the second line */ width = 0; for ( /* nada */; idx < len; idx++) { if ((str[idx] == ' ') || (str[idx] == '\t')) { if (width > 0) { break; } continue; } if ((str[idx] == '\n') || (str[idx] == '\r')) { /* Done with second line */ break; } /* Count the leading chars */ if ((str[idx] == '*') || (str[idx] == '|') || (str[idx] == '\\') || (str[idx] == '#') || (str[idx] == '+')) { width++; } else { break; } } //LOG_FMT(LSYS, "%s: first=%d last=%d width=%d\n", __func__, first_len, last_len, width); /*TODO: make the first_len minimum (4) configurable? */ if ((first_len == last_len) && ((first_len > 4) || first_len == width)) { return(0); } return((width == 2) ? 0 : 1); } /** * Outputs the CPP comment at pc. * CPP comment combining is done here * * @return the last chunk output'd */ chunk_t *output_comment_cpp(chunk_t *first) { int col = first->column; int col_br = 1 + (first->brace_level * cpd.settings[UO_indent_columns].n); /* Make sure we have at least one space past the last token */ if (first->parent_type == CT_COMMENT_END) { chunk_t *prev = chunk_get_prev(first); if (prev != NULL) { int col_min = prev->column + prev->len + 1; if (col < col_min) { col = col_min; } } } /* Bump out to the column */ output_indent(col, col_br); if (!cpd.settings[UO_cmt_cpp_to_c].b) { add_text_len(first->str, first->len); return(first); } /* If we are grouping, see if there is something to group */ bool combined = false; if (cpd.settings[UO_cmt_cpp_group].b) { /* next is a newline by definition */ chunk_t *next = chunk_get_next(first); if ((next != NULL) && (next->nl_count == 1)) { next = chunk_get_next(next); /** * Only combine the next comment if they are both at indent level or * the second one is NOT at indent or less * * A trailing comment cannot be combined with a comment at indent * level or less */ if ((next != NULL) && (next->type == CT_COMMENT_CPP) && (((next->column == 1) && (first->column == 1)) || ((next->column == col_br) && (first->column == col_br)) || ((next->column > col_br) && (first->parent_type == CT_COMMENT_END)))) { combined = true; } } } if (!combined) { /* nothing to group: just output a single line */ add_text_len("/*", 2); if ((first->str[2] != ' ') && (first->str[2] != '\t')) { add_char(' '); } add_text_len(&first->str[2], first->len - 2); add_text_len(" */", 3); return(first); } chunk_t *pc = first; chunk_t *last = first; /* Output the first line */ add_text_len("/*", 2); if (combined && cpd.settings[UO_cmt_cpp_nl_start].b) { /* I suppose someone more clever could do this without a goto or * repeating too much code... */ goto cpp_newline; } goto cpp_addline; /* Output combined lines */ while ((pc = chunk_get_next(pc)) != NULL) { if ((pc->type == CT_NEWLINE) && (pc->nl_count == 1)) { continue; } if (pc->type != CT_COMMENT_CPP) { break; } if (((pc->column == 1) && (first->column == 1)) || ((pc->column == col_br) && (first->column == col_br)) || ((pc->column > col_br) && (first->parent_type == CT_COMMENT_END))) { last = pc; cpp_newline: add_char('\n'); output_indent(col, col_br); add_char(' '); add_char(cpd.settings[UO_cmt_star_cont].b ? '*' : ' '); cpp_addline: if ((pc->str[2] != ' ') && (pc->str[2] != '\t')) { add_char(' '); } add_text_len(&pc->str[2], pc->len - 2); } } if (cpd.settings[UO_cmt_cpp_nl_end].b) { add_char('\n'); output_indent(col, col_br); } add_text_len(" */", 3); return(last); } void output_comment_multi(chunk_t *pc) { int cmt_col = pc->column; const char *cmt_str; int remaining; char ch; chunk_t *prev; char line[1024]; int line_len; int line_count = 0; int ccol; int col_diff = 0; int xtra = 1; prev = chunk_get_prev(pc); if ((prev != NULL) && (prev->type != CT_NEWLINE)) { cmt_col = pc->orig_col; } else { col_diff = pc->orig_col - pc->column; } // fprintf(stderr, "Indenting1 line %d to col %d (orig=%d) col_diff=%d\n", // pc->orig_line, cmt_col, pc->orig_col, col_diff); xtra = calculate_comment_body_indent(pc->str, pc->len, pc->column); ccol = 1; remaining = pc->len; cmt_str = pc->str; line_len = 0; while (remaining > 0) { ch = *cmt_str; cmt_str++; remaining--; /* handle the CRLF and CR endings. convert both to LF */ if (ch == '\r') { ch = '\n'; if (*cmt_str == '\n') { cmt_str++; remaining--; } } /* Find the start column */ if (line_len == 0) { if (ch == ' ') { ccol++; continue; } else if (ch == '\t') { ccol = calc_next_tab_column(ccol, cpd.settings[UO_input_tab_size].n); continue; } else { //fprintf(stderr, "%d] Text starts in col %d\n", line_count, ccol); } } line[line_len++] = ch; /* If we just hit an end of line OR we just hit end-of-comment... */ if ((ch == '\n') || (remaining == 0)) { line_count++; /* strip trailing tabs and spaces before the newline */ if (ch == '\n') { line_len--; while ((line_len > 0) && ((line[line_len - 1] == ' ') || (line[line_len - 1] == '\t'))) { line_len--; } line[line_len++] = ch; } line[line_len] = 0; if (line_count == 1) { /* this is the first line - add unchanged */ /*TODO: need to support indent_with_tabs mode 1 */ output_to_column(cmt_col, cpd.settings[UO_indent_with_tabs].b); add_text_len(line, line_len); } else { /* This is not the first line, so we need to indent to the * correct column. */ ccol -= col_diff; if (ccol < cmt_col) { ccol = cmt_col; } if (line[0] == '\n') { /* Emtpy line - just a '\n' */ if (cpd.settings[UO_cmt_star_cont].b) { output_to_column(cmt_col, cpd.settings[UO_indent_with_tabs].b); add_text((xtra == 1) ? " *" : "*"); } add_char('\n'); } else { /* If this doesn't start with a '*' or '|' */ if ((line[0] != '*') && (line[0] != '|') && (line[0] != '#') && (line[0] != '\\') && (line[0] != '+')) { output_to_column(cmt_col, cpd.settings[UO_indent_with_tabs].b); if (cpd.settings[UO_cmt_star_cont].b) { add_text((xtra == 1) ? " * " : "* "); } else { add_text(" "); } output_to_column(ccol, cpd.settings[UO_indent_with_tabs].b); } else { output_to_column(cmt_col + xtra, cpd.settings[UO_indent_with_tabs].b); } add_text_len(line, line_len); } } line_len = 0; ccol = 1; } } } uncrustify-0.59/tests/input/c/pp-nest.c0000644000175000017500000000014711506773275015077 00000000000000#if AA int foo() { #if BB #else #if CC #else #endif #endif } #endif int bar() { } uncrustify-0.59/tests/input/c/type_wrap.c0000644000175000017500000000007611506773275015524 00000000000000void foo(void) { STACK_OF(X509) * st=sk_X509_new_null(); } uncrustify-0.59/tests/input/c/bugs.c0000644000175000017500000000152411506773275014451 00000000000000typedef struct { int a; char b; } foo_t; s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) { union i2c_smbus_data data; int i; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,command, I2C_SMBUS_I2C_BLOCK_DATA,&data)) return -1; else { for (i=1;i<=data.block[0];i ++) values[i-1] = data.block[i]; return data.block[0]; } } void foo(void) { adap->nr= id & MAX_ID_MASK; list_for_each(item,&drivers) { driver=list_entry(item, struct i2c_driver, list); if (driver->detach_adapter) if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } } uncrustify-0.59/tests/input/c/mod_case_brace.c0000644000175000017500000000106311506773275016415 00000000000000int foo(int bar) { switch (bar) { case 0: { showit(0); } c++; break; case 1: { showit(bar); break; } case 2: break; case 3: { int a = bar * 3; showit(a); } c++; break; case 4: foo(bar - 1); { showit(0); } case 10: switch (gl_bug) { case 'a': { gl_foo = true; break; } case 'b': case 'c': { gl_foo = false; break; } default: { // nothing } break; } break; default: { } break; } return(-1); } uncrustify-0.59/tests/input/c/custom_types_ssl.c0000644000175000017500000000540511506773275017132 00000000000000#ifndef HEADER_CONF_H #define HEADER_CONF_H #ifdef __cplusplus extern "C" { #endif typedef struct { char *section; char *name; char *value; } CONF_VALUE; DECLARE_STACK_OF(CONF_VALUE); DECLARE_LHASH_OF(CONF_VALUE); struct conf_st; struct conf_method_st; typedef struct conf_method_st CONF_METHOD; int CONF_set_default_method(CONF_METHOD *meth); void CONF_set_nconf(CONF *conf,LHASH_OF(CONF_VALUE) *hash); LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf,const char *file, long *eline); #ifndef OPENSSL_NO_FP_API LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline); #endif LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,long *eline); STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, const char *section); char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, const char *name); long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group, const char *name); void CONF_free(LHASH_OF(CONF_VALUE) *conf); int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); #ifdef __cplusplus } #endif void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash) { if (default_CONF_method == NULL) default_CONF_method = NCONF_default(); default_CONF_method->init(conf); conf->data = hash; } LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, long *eline) { LHASH_OF(CONF_VALUE) *ltmp; BIO *in=NULL; #ifdef OPENSSL_SYS_VMS in=BIO_new_file(file, "r"); #else in=BIO_new_file(file, "rb"); #endif if (in == NULL) { CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); return NULL; } return ltmp; } #ifndef OPENSSL_NO_FP_API LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline) { BIO *btmp; LHASH_OF(CONF_VALUE) *ltmp; if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); return NULL; } ltmp = CONF_load_bio(conf, btmp, eline); BIO_free(btmp); return ltmp; } #endif LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline) { CONF ctmp; int ret; CONF_set_nconf(&ctmp, conf); ret = NCONF_load_bio(&ctmp, bp, eline); if (ret) return ctmp.data; return NULL; } STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, const char *section) { if (conf == NULL) { return NULL; } else { CONF ctmp; CONF_set_nconf(&ctmp, conf); return NCONF_get_section(&ctmp, section); } } char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, const char *name) { if (conf == NULL) { return NCONF_get_string(NULL, group, name); } else { return NCONF_get_string(&ctmp, group, name); } } uncrustify-0.59/tests/input/c/pp_concat_asn1.h0000644000175000017500000002367511506773275016421 00000000000000#ifndef HEADER_ASN1_H #define HEADER_ASN1_H #define V_ASN1_UNIVERSAL 0x00 #define V_ASN1_APPLICATION 0x40 #define V_ASN1_CONTEXT_SPECIFIC 0x80 #define V_ASN1_PRIVATE 0xc0 #define V_ASN1_CONSTRUCTED 0x20 #define V_ASN1_PRIMITIVE_TAG 0x1f #define V_ASN1_PRIMATIVE_TAG 0x1f #define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ #define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ #define V_ASN1_ANY -4 /* used in ASN1 template code */ #define V_ASN1_NEG 0x100 /* negative flag */ #define V_ASN1_UNDEF -1 #define V_ASN1_EOC 0 #define V_ASN1_BOOLEAN 1 /**/ #define V_ASN1_INTEGER 2 #define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) #define V_ASN1_BIT_STRING 3 #define V_ASN1_OCTET_STRING 4 #define V_ASN1_NULL 5 #define V_ASN1_OBJECT 6 /* object identifier */ #define V_ASN1_OBJECT_DESCRIPTOR 7 #define V_ASN1_EXTERNAL 8 /* external / instance of */ #define V_ASN1_REAL 9 #define V_ASN1_ENUMERATED 10 #define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) #define V_ASN1_EMBEDDED_PDV 11 #define V_ASN1_UTF8STRING 12 #define V_ASN1_SEQUENCE 16 #define V_ASN1_SET 17 #define V_ASN1_NUMERICSTRING 18 /**/ #define V_ASN1_PRINTABLESTRING 19 #define V_ASN1_T61STRING 20 #define V_ASN1_TELETEXSTRING 20 /* alias */ #define V_ASN1_VIDEOTEXSTRING 21 /**/ #define V_ASN1_IA5STRING 22 #define V_ASN1_UTCTIME 23 #define V_ASN1_GENERALIZEDTIME 24 /**/ #define V_ASN1_GRAPHICSTRING 25 /**/ #define V_ASN1_ISO64STRING 26 /**/ #define V_ASN1_VISIBLESTRING 26 /* alias */ #define V_ASN1_GENERALSTRING 27 /**/ #define V_ASN1_UNIVERSALSTRING 28 /**/ #define V_ASN1_BMPSTRING 30 /* For use with d2i_ASN1_type_bytes() */ #define B_ASN1_NUMERICSTRING 0x0001 #define B_ASN1_PRINTABLESTRING 0x0002 #define B_ASN1_T61STRING 0x0004 #define B_ASN1_TELETEXSTRING 0x0004 #define B_ASN1_VIDEOTEXSTRING 0x0008 #define B_ASN1_IA5STRING 0x0010 #define B_ASN1_GRAPHICSTRING 0x0020 #define B_ASN1_ISO64STRING 0x0040 #define B_ASN1_VISIBLESTRING 0x0040 #define B_ASN1_GENERALSTRING 0x0080 #define B_ASN1_UNIVERSALSTRING 0x0100 #define B_ASN1_OCTET_STRING 0x0200 #define B_ASN1_BIT_STRING 0x0400 #define B_ASN1_BMPSTRING 0x0800 #define B_ASN1_UNKNOWN 0x1000 #define B_ASN1_UTF8STRING 0x2000 #define B_ASN1_UTCTIME 0x4000 #define B_ASN1_GENERALIZEDTIME 0x8000 #define B_ASN1_SEQUENCE 0x10000 /* For use with ASN1_mbstring_copy() */ #define MBSTRING_FLAG 0x1000 #define MBSTRING_UTF8 (MBSTRING_FLAG) #define MBSTRING_ASC (MBSTRING_FLAG|1) #define MBSTRING_BMP (MBSTRING_FLAG|2) #define MBSTRING_UNIV (MBSTRING_FLAG|4) #define SMIME_OLDMIME 0x400 #define SMIME_CRLFEOL 0x800 #define SMIME_STREAM 0x1000 struct X509_algor_st; DECLARE_STACK_OF(X509_ALGOR); #define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ #define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ /* We MUST make sure that, except for constness, asn1_ctx_st and asn1_const_ctx are exactly the same. Fortunately, as soon as the old ASN1 parsing macros are gone, we can throw this away as well... */ typedef struct asn1_ctx_st { unsigned char *p; /* work char pointer */ int eos; /* end of sequence read for indefinite encoding */ int error; /* error code to use when returning an error */ int inf; /* constructed if 0x20, indefinite is 0x21 */ int tag; /* tag from last 'get object' */ int xclass; /* class from last 'get object' */ size_t slen; /* length of last 'get object' */ unsigned char *max; /* largest value of p allowed */ unsigned char *q;/* temporary variable */ unsigned char **pp;/* variable */ int line; /* used in error processing */ } ASN1_CTX; typedef struct asn1_const_ctx_st { const unsigned char *p;/* work char pointer */ int eos; /* end of sequence read for indefinite encoding */ int error; /* error code to use when returning an error */ int inf; /* constructed if 0x20, indefinite is 0x21 */ int tag; /* tag from last 'get object' */ int xclass; /* class from last 'get object' */ size_t slen; /* length of last 'get object' */ const unsigned char *max; /* largest value of p allowed */ const unsigned char *q;/* temporary variable */ const unsigned char **pp;/* variable */ int line; /* used in error processing */ } ASN1_const_CTX; /* These are used internally in the ASN1_OBJECT to keep track of * whether the names and data need to be free()ed */ #define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */ #define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ #define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ #define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ typedef struct asn1_object_st { const char *sn,*ln; int nid; size_t length; const unsigned char *data; /* data remains const after init */ int flags; /* Should we free this one */ } ASN1_OBJECT; #define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ /* This indicates that the ASN1_STRING is not a real value but just a place * holder for the location where indefinite length constructed data should * be inserted in the memory buffer */ #define ASN1_STRING_FLAG_NDEF 0x010 /* This flag is used by the CMS code to indicate that a string is not * complete and is a place holder for content when it had all been * accessed. The flag will be reset when content has been written to it. */ #define ASN1_STRING_FLAG_CONT 0x020 /* This is the base type that holds just about everything :-) */ typedef struct asn1_string_st { size_t length; int type; unsigned char *data; /* The value of the following field depends on the type being * held. It is mostly being used for BIT_STRING so if the * input data has a non-zero 'unused bits' value, it will be * handled correctly */ long flags; } ASN1_STRING; /* ASN1_ENCODING structure: this is used to save the received * encoding of an ASN1 type. This is useful to get round * problems with invalid encodings which can break signatures. */ typedef struct ASN1_ENCODING_st { unsigned char *enc; /* DER encoding */ size_t len; /* Length of encoding */ int modified; /* set to 1 if 'enc' is invalid */ } ASN1_ENCODING; /* Used with ASN1 LONG type: if a long is set to this it is omitted */ #define ASN1_LONG_UNDEF 0x7fffffffL #define STABLE_FLAGS_MALLOC 0x01 #define STABLE_NO_MASK 0x02 #define DIRSTRING_TYPE \ (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING) #define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING) /* Declarations for template structures: for full definitions * see asn1t.h */ typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; typedef struct ASN1_ITEM_st ASN1_ITEM; typedef struct ASN1_TLC_st ASN1_TLC; /* This is just an opaque pointer */ typedef struct ASN1_VALUE_st ASN1_VALUE; /* Declare ASN1 functions: the implement macro in in asn1t.h */ #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) #define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) #define DECLARE_ASN1_FUNCTIONS_name(type, name) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name); \ DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name); \ DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ type *d2i_##name(type **a, const unsigned char **in, size_t len); \ int i2d_##name(const type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(itname) #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ type *d2i_##name(type **a, const unsigned char **in, size_t len); \ int i2d_##name(const type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(name) #define DECLARE_ASN1_NDEF_FUNCTION(name) \ int i2d_##name##_NDEF(const name *a, unsigned char **out) #define DECLARE_ASN1_FUNCTIONS_const(name) \ DECLARE_ASN1_ALLOC_FUNCTIONS(name); \ DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) #define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ type *name##_new(void); \ void name##_free(type *a) #define DECLARE_ASN1_PRINT_FUNCTION(stname) \ DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) #define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ int fname##_print_ctx(BIO *out, const stname *x, int indent, \ const ASN1_PCTX *pctx) /* * WARNING WARNING WARNING * * uncrustify still introduces whitespace in here at some spots, but then * one might ask how crazy we want to go regarding ## encumbered parsing? * There's always the copout of INDENT-OFF markers for files like these, * once you've got them 95% right through uncrustify and that extra 5% * by hand ;-) */ #define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,size_t) #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **) #define TYPEDEF_I2D_OF_CONST(type) typedef int i2d_of_const_##type(const type *,unsigned char **) /* [i_a] */ #define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type); TYPEDEF_I2D_OF_CONST(type) /* [i_a] */ /* Macro to include ASN1_ITEM pointer from base type */ #define ASN1_ITEM_ref(iptr) (&(iptr##_it)) #define ASN1_ITEM_rptr(ref) (&(ref##_it)) #define DECLARE_ASN1_ITEM(name) \ extern const ASN1_ITEM name##_it; #define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ ASN1_STRFLGS_ESC_CTRL | \ ASN1_STRFLGS_ESC_MSB | \ ASN1_STRFLGS_UTF8_CONVERT | \ ASN1_STRFLGS_DUMP_UNKNOWN | \ ASN1_STRFLGS_DUMP_DER) DECLARE_STACK_OF(ASN1_INTEGER); DECLARE_ASN1_SET_OF(ASN1_INTEGER); DECLARE_STACK_OF(ASN1_GENERALSTRING); typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY); DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY); #define B_ASN1_DIRECTORYSTRING \ B_ASN1_PRINTABLESTRING| \ B_ASN1_TELETEXSTRING|\ B_ASN1_BMPSTRING|\ B_ASN1_UNIVERSALSTRING|\ B_ASN1_UTF8STRING #define B_ASN1_DISPLAYTEXT \ B_ASN1_IA5STRING| \ B_ASN1_VISIBLESTRING| \ B_ASN1_BMPSTRING|\ B_ASN1_UTF8STRING #endif uncrustify-0.59/tests/input/c/br_cmt.c0000644000175000017500000000027511506773275014761 00000000000000int main() { if( foo == bar ) { /* this works */ a; }else if( ranz != bar ) { /* this works too */ b; }else { /* this is broken */ c; } } uncrustify-0.59/tests/input/c/bugs-3.c0000644000175000017500000000205211506773275014606 00000000000000 #ifdef CRUD #define JUNK a #endif #ifdef __QNX__ /** * Does all that QNX trickery to get the MAC address of the interface * * @param if_name The interface name: ie "en0" or "eth0" * @param mac Pointer to a 6-byte array * @return SUCCESS or FAILURE */ static INT32 socket_get_mac_qnx(const CHAR *if_name, UINT8 *mac) { CHAR ionet_name[50]; INT32 en_fd; #if QNX_RELEASE >= 630 nic_config_t nic; INT32 dcmd = DCMD_IO_NET_GET_CONFIG; #else Nic_t nic; INT32 dcmd = DCMD_IO_NET_NICINFO; #endif INT32 ret_val = FAILURE; memset(mac, 0, 6); /* Build the full name */ snprintf(ionet_name, sizeof(ionet_name), "/dev/io-net/%s", if_name); /* Open the device */ en_fd = open(ionet_name, O_RDWR); if (en_fd >= 0) { /* Get the interface info */ if (devctl(en_fd, dcmd, &nic, sizeof(nic), NULL) == EOK) { memcpy(mac, nic.current_address, 6); ret_val = SUCCESS; } close(en_fd); } return(ret_val); } #endif uncrustify-0.59/tests/input/c/pos_conditional.c0000644000175000017500000000027611506773275016700 00000000000000void foo(void) { // conditional colon a = bar() ? 2 : 3; a = bar() ? 2 : 3; // conditional question a = bar() ? 2 : 3; a = bar() ? 2 : 3; } uncrustify-0.59/tests/input/c/beautifier-off.c0000644000175000017500000000077411506773275016406 00000000000000 #define FOO(bar) create_a_really_long_identifier name(some_function(bar1 + bar2), bar3, bar4); /* *INDENT-OFF* */ int foo[] = { 1, 3, 5, 3, 5, 7, 5, 7, 9, }; /* *INDENT-ON* */ #define multilinemacro do { (x+5); } while (0); \ printf("a multilinemacro"); \ printf("a multilinemacro2"); /* *INDENT-OFF* */ int main(int argc, char *argv[]) { int a, b; a = 1; // stupid comment \ b = 2; /* *INDENT-ON* */ return(a+b); } /* *INDENT-OFF* */ int a; /* *INDENT-ON* */ uncrustify-0.59/tests/input/c/case.c0000644000175000017500000000200611506773275014420 00000000000000void foo(void) { switch(ch) { // handle 'a' case 'a': { handle_a(); multiline(123, 345); break; } // handle 'b' case 'b': handle_b(); multiline(123, 345); break; // handle 'c' and 'd' case 'c': case 'd': // c and d are really the same thing handle_cd(); multiline(123, 345); break; case 'e': { handle_a(); multiline(123, 345); } break; // case1 case (case1): { //do stuff break; } case (case2): { //do stuff break; } case (case3): /*do stuff*/ break; case (case3): statement(); { another_statement(); } break; // really should not get here default: handle_default(); multiline(123, 345); break; } multiline(123, 345); } uncrustify-0.59/tests/input/c/bool-pos.c0000644000175000017500000000165511506773275015250 00000000000000void foo(void) { if ((a != 0) && (b == 0) && (c < 0) && (d > 0)) { printf("hi"); } if (flag1 #ifdef FLAG2 || flag2 #endif ) { printf("yar"); } if (flag1 && #ifdef FLAG2 flag2 && #endif flag3) { printf("bo"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if (!this -> writeOwiFile () || // comment1 broken () || !saveArchiveData () /* comment2 */ || broken () || !deleteCentralArchive () // comment3 || broken () || !copyArchivFiles () // comment4 || broken () || !appendToPlanetDb ()) // comment5 { ; } foobar(param1, param2, param3, param4); foobar2(param1 , param2, param3 , param4); } uncrustify-0.59/tests/input/c/bugs-5.c0000644000175000017500000000025011506773275014606 00000000000000 static void log_roll_file(log_output_t *plo) { INT32 retcode; const CHAR *name_save; const CHAR *name_temp; if (plo->pfile != NULL) { } } uncrustify-0.59/tests/input/c/nl-cont2.c0000644000175000017500000000050211506773275015140 00000000000000 #define FOO(bar) create_a_really_long_identifier name(some_function(bar1 + bar2), bar3, bar4); #define multilinemacro do { (x+5); } while (0); \ printf("a multilinemacro"); \ printf("a multilinemacro2"); int main(int argc, char *argv[]) { int a, b; a = 1; // stupid comment \ b = 2; return(a+b); } uncrustify-0.59/tests/input/c/t3.in.c0000644000175000017500000000035211506773275014442 00000000000000extern /*@observer@*/ /*@null@*/ const dcroid_t* dcrp_oidget ( /*@in@*/ const char* h, /*@in@*/const char* t ) /*@ensures maxRead(result) >= 0@*/; extern /*@observer@*/const char* dcrp_oidlabel ( /*@in@*/const dcroid_t* oid ); uncrustify-0.59/tests/input/c/cmt_right_align.c0000644000175000017500000000137211506773275016644 00000000000000 int foo1(int bar) { if(bar) { if(b) { if(a) { if(r) { return(r); /* cool */ } else /* if (r) */ { return(bar); /* uncool */ } /* if (r) */ } /* if (a) */ } /* if (b) */ } /* if (bar) */ return(-1); } /* foo */ int foo2(int bar) { if(bar) { if(b) { if(a) { if(r) { return(r); } else { return(bar); } /* if (r) */ } /* if (a) */ } /* if (b) */ } /* if (bar) */ return(-1); } /* foo */ uncrustify-0.59/tests/input/c/func_wrap.c0000644000175000017500000000005411506773275015472 00000000000000 void FSUB(MPI_Foo)(MPI_Fint* sendcount); uncrustify-0.59/tests/input/c/braces-3.c0000644000175000017500000000014311506773275015104 00000000000000{ list_for_each(k) { if (a) if (b) { c++; } } } uncrustify-0.59/tests/input/c/indent-assign.c0000644000175000017500000000017311506773275016253 00000000000000void foo(void) { int a; junk(a = 3); } void f() { int x = size_t(1.0) + 2; int y = (size_t(1.0) + 5); } uncrustify-0.59/tests/input/c/empty-for.c0000644000175000017500000000005711506773275015433 00000000000000void foo(void) { for (;x<2;x++) { } } uncrustify-0.59/tests/input/c/enum-struct-init.c0000644000175000017500000000045211506773275016737 00000000000000 enum foo_idx { FOO_1, FOO_2, FOO_3, }; struct foo { const char *str; int values[8]; }; struct foo bar[] = { [FOO_1] = { "junk", { 1 } }, [FOO_2] = { "morejunk", {1, 2, 3} }, [FOO_3] = { "somemore", {1, 2, 3, 4, 5, 6} }, }; uncrustify-0.59/tests/input/c/bugs-7.c0000644000175000017500000000036711506773275014621 00000000000000 struct somestruct * mult2(int val); somestruct * dumb_func(int val); struct somestruct * mult2(int val) { int a; a = val + (foo * bar); a = val + (bar); a = val + (CFoo::bar_t)7; a = val + (myfoo.size); return NULL; } uncrustify-0.59/tests/input/c/brace-remove.c0000644000175000017500000000165411506773275016064 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) b++; do { a--; } while (a > 0); for (a = 0; a < 10; a++) { printf("a=%d\n", a); } if (a == 10) { printf("a looks good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } } } while (*ptr++ != ',') { } } // mod_full_brace_for = remove should not remove the braces in this example: int main() { if(true) // indent=1 for(int i = 0; i < 3; i++) { if(false) continue; // indent=4 } else return; // indent=2 } // mod_full_brace_if = remove should not remove the braces in this example: int main() { if(true) { for(int i = 0; i < 3; i++) if(false) continue; // indent=4 } else return; // indent=2 } uncrustify-0.59/tests/input/c/nl-cont.c0000644000175000017500000000104511506773275015061 00000000000000 #define FOO(bar) create_a_really_long_identifier name(some_function(bar1 + bar2), bar3, bar4); #define VNV_RECORD_CYCLES(m) do { \ uint16_t cyc_out = ((uint16_t )TMR4) - cyc_in; \ if (cyc_out < vnv_ticks[m].min) vnv_ticks[m].min = cyc_out; \ if (cyc_out > vnv_ticks[m].max) vnv_ticks[m].max = cyc_out; \ } while (0) #define multilinemacro do { (x+5); } while (0); \ printf("a multilinemacro"); \ printf("a multilinemacro2"); int main(int argc, char *argv[]) { int a, b; a = 1; // stupid comment \\ b = 2; return(a+b); } uncrustify-0.59/tests/input/c/pp_ret.c0000644000175000017500000000012411506773275014775 00000000000000#if 0 int #else unsigned #endif f() { return 0; } #ifdef FOO #define BAR . #endif uncrustify-0.59/tests/input/c/kw_subst.c0000644000175000017500000000024111506773275015345 00000000000000#include int foo1() { } /** header comment */ #if 2 int foo2(void) { } #endif #if 1 void foo3(int a) { } #endif void *foo4(int a, int b, int c) { } uncrustify-0.59/tests/input/c/switch.c0000644000175000017500000000045711506773275015016 00000000000000 int foo(int op) { switch (op) { case 1: { do_something(); return 0; } case 2: do_something_else(); return 1; case 3: case 4: /* don't do anything */ break; case 5: return 3; default: break; } return -1; } uncrustify-0.59/tests/input/c/nl_ds_struct_enum.c0000644000175000017500000000046411506773275017242 00000000000000struct foo { unsigned int d_ino; /* Comment */ unsigned short d_reclen; unsigned short d_namlen; /* Comment */ char d_name[1]; }; struct foo { /* Comment */ unsigned int d_ino; unsigned short d_reclen; unsigned short d_namlen; /* Comment */ char d_name[1]; }; struct foo { int a; char *b }; uncrustify-0.59/tests/input/c/dos.c0000644000175000017500000000100411506773275014267 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) { /* comment in virtual braces */ res += idx; } res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 return(res); } // col1 comment in level 0 /* Silly multiline comment. Oh yes. Really */ uncrustify-0.59/tests/input/c/ifdef-nest.c0000644000175000017500000000062611506773275015537 00000000000000 namespace MonoTests.System.IO.IsolatedStorageTest { public class NonAbstractIsolatedStorage : IsolatedStorage { public NonAbstractIsolatedStorage () { string s = String.Format ("{0} {1}", Environment.NewLine, #if NET_2_0 String.Empty); #else " "); #endif } } } uncrustify-0.59/tests/input/c/misc.c0000644000175000017500000000153411506773275014445 00000000000000/********************/ /* Before Unrustify */ /********************/ #define MACRO( cond, action ) if ((cond)) (action) void hurz(murks) { if (murks = 4) // This comment belongs to (murks = 4) schrott(); // And this to schrott() #ifdef SCHNIEPEL else if (murks = 6) // This comment belongs to (murks = 6) // I had to write more comment than one line // so I inserted some comment only blocks schniepel(); #endif // SCHNIEPEL else flursen(); if (murks = 4) // This comment belongs to (murks = 4) #ifdef FOO foo(); #else bar(); #endif if (murks = 4) // This comment belongs to (murks = 4) { schrott(); // And this to schrott() } return; } // hurz() uncrustify-0.59/tests/input/c/pascal_ptr.c0000644000175000017500000000017411506773275015641 00000000000000foobar_t* a; int *b; int * c; something no; char * main() { int i = (5*3)+2; } void foo(int* a, int *b, int * c) { } uncrustify-0.59/tests/input/c/align-var.c0000644000175000017500000000133511506773275015371 00000000000000struct foo1 { unsigned int d_ino; const char *d_reclen; unsigned short d_namlen; char d_name[1]; }; struct foo2 { unsigned int a : 1; unsigned int bcd : 3; unsigned int ef : 2; unsigned int : 2; unsigned short more; int fields; }; typedef struct { bitfld a : 8; bitfld b : 16; bitfld : 8; } type_t; struct foo { int a; char *b }; static int idx; static const char **tmp; static char buf[64]; static unsigned long how_long; // comment static int **tmp; static char buf[64]; void bar(int someval, void *puser, const char *filename, struct willy *the_list, int list_len) { int idx; const char **tmp; char buf[64]; unsigned long how_long; return(-1); } uncrustify-0.59/tests/input/c/add_long_comment.c0000644000175000017500000000106011506773275016775 00000000000000/** * trailing comments are added at 8 newlines in this test. * * */ void short_function(void) { /* this is a 'short' function, so no added comment */ } void long_function(void) { /* this is a 'long' function, so a comment is added */ switch (some_int_value()) { case 0: handle_zero(); break; case 50: handle_fifty(); break; case 127: handle_another_value(); break; default: boy_do_i_lack_imagination(); break; } /* call one last function... */ one_last_func_call(); } uncrustify-0.59/tests/input/c/casts.c0000644000175000017500000000270311506773275014626 00000000000000 #define SOME_VAL1 ((MYINT)-1) #define SOME_VAL2 (-2) #define SOME_VAL3 -3 #define MULT(X,Y) (X) * (Y) #define SOME_JUNK /*lint -e123 */(const mytype *)-1 typedef (*my_fcn_ptr_t)(char *, int); typedef (my_fcn_t)(char *, int); void foo(void) { uint crc = crc32_calc_full((const UINT8 *)"String", 6); crc = crc32_calc_full((const UINT8 *)&crc, sizeof(crc)); a = (b) - 4; a = (UINT) - 4; a = (UINT) + 4; a = (UINT) * 4; a = (UINT) & 4; a = (uint32_t) - pb; a = (uint32_t) + pb; a = (uint32_t) * pb; a = (uint32_t) & pb; a = (Uint) - 4; a = (Uint) + 4; a = (Uint) * 4; a = (Uint) & 4; a = b * (int)flt; a = b * ((int)flt); a = b * (int)flt; a = b * (INT8)flt; a = b * (Uint)flt; a = *(int)&b; a = *(CHAR)&b; a = *(Uint)&b; a = (int)*pb; a = (CHAR)*pb; a = (Uint)*pb; a = (int)'a'; a = (UINT8)'a'; a = (Uint)'a'; a = (int)*'a'; a = (UINT8)*'a'; a = (Uint)*'a'; a = (int)*5; a = (UINT)*5; a = (Uint)*5; a = (int)*ape; a = (UINT)*ape; a = (Uint)*ape; a = (int)ape; a = (UINT)ape; a = (Uint)ape; a = (int)sizeof(x); a = (INT16)sizeof(x); a = (Uint)sizeof(x); a = (int)foo(x); a = (CHAR)foo(x); a = (Uint)foo(x); a = (int)(x); a = (CHAR)(x); a = (Uint)(x); a = (int)*(x); a = (CHAR)*(x); a = (Uint)*(x); a = (unsigned int)(1 + 4); a = (int)(1 + 1); a = (void *)(&str); } uncrustify-0.59/tests/input/c/bsnl.c0000644000175000017500000000014111506773275014441 00000000000000# define SOME_MACRO \ bool has_err; \ bool is_comp;\ struct some_stream ostream uncrustify-0.59/tests/input/c/braces-5.c0000644000175000017500000000061711506773275015114 00000000000000/** * this is a really tough case - perhaps we shouldn't keep any #if crap * unless they all end with the same stack? */ void foo(void) { int a; #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) ROOT_DEV = Root_RAM0; #elif defined(CONFIG_ROOT_NFS) ROOT_DEV = Root_NFS; #elif defined(CONFIG_BLK_DEV_IDEDISK) ROOT_DEV = Root_HDA1; #else ROOT_DEV = Root_SDA1; #endif return; } uncrustify-0.59/tests/input/c/bugs-1.c0000644000175000017500000000137111506773275014607 00000000000000int oldfoo(bar) char bar; { return bar -2; } int i2c_use_client(struct i2c_client *client) { int ret; ret = i2c_inc_use_client(client); if (ret) return ret; if ((client->flags & I2C_CLIENT_ALLOW_USE) || (a && something_else)) { if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) client->usage_count++; else if (client->usage_count > 0) goto busy; else client->usage_count++; } return 0; busy: i2c_dec_use_client(client); return -EBUSY; } void get_name(void) { a = (int)5; if (a) if (b) b--; else { a++; } for (a=0; a < 10; a++) if (b) { b--; } else a++; return; } uncrustify-0.59/tests/input/c/vb-do.c0000644000175000017500000000031611506773275014516 00000000000000 struct beef a = { 1, 2, 3 }; void get_name(void) { int _ = 3; do a--; while (a); while (a) //something a--; do while (a) //something a--; while (b--); } uncrustify-0.59/tests/input/c/one-liner-init.c~0000644000175000017500000000042411506773275016536 00000000000000 enum boo { FOO = 1 }; void foo(void) { char str[123] = { 0 }; enum hoo { NOO = 1 }; strcat(str, "foo"); } void f(){if(bar())baz(1);else baz(2);} int foo() { return 0; } void foo(int a, int b) { if (a == b) { a++; } else { b++; } if (a == b) a++; else b++; } uncrustify-0.59/tests/input/c/align-proto.c0000644000175000017500000000012611506773275015741 00000000000000unsigned int align_here(); int this_works(int x); int bug(int); // BUG: left-aligned uncrustify-0.59/tests/input/c/cmt-align.c0000644000175000017500000000061611506773275015365 00000000000000#ifndef HAVE_FOO void foo(void) { if (bar) { call_some_function(); /* call the function */ return(foo); /* comment */ } /* if (bar) */ } #endif /* HAVE_FOO */ #ifndef HAVE_BAR /* bar isn't available on all HW */ void bar(void) { if (foo) { call_some_function(); /* call the function */ return(foo); /* comment */ } /* if (foo) */ } #endif /* HAVE_BAR */ uncrustify-0.59/tests/input/c/nl_return_expr.c0000644000175000017500000000025011506773275016552 00000000000000 int foo1(void) { return NewClass(1); } int foo2(void) { return NewClass(2); } int foo3(void) { return(3); } int foo4(void) { return (4); } uncrustify-0.59/tests/input/c/else-if.c0000644000175000017500000000053411506773275015035 00000000000000int test (int A, int B) { int C; if (A == 0) if (B == 0) C = 1; else if (B == 1) C = 2; else C = 3; else if (A == 1) if (B == 0) C = 4; else if (B == 1) C = 5; else C = 6; else if (B == 0) C = 7; else if (B == 1) C = 8; else C = 9; return C; } uncrustify-0.59/tests/input/c/fcn_param.c0000644000175000017500000000030511511363473015422 00000000000000#include void x(custom_t *e, void (*funcptr)); void x(custom_t *e, void (*funcptr)[]); void x(custom_t *e, void (*funcptr)(int, int)); void x(custom_t *e, void (*funcptr)(int, int)[]); uncrustify-0.59/tests/input/c/colon-asm.c0000644000175000017500000000107711506773275015404 00000000000000static void __marvel_access_rtc(void *info) { struct marvel_rtc_access_info *rtc_access = info; register unsigned long __r0 __asm__("$0"); register unsigned long __r16 __asm__("$16") = rtc_access->function; register unsigned long __r17 __asm__("$17") = rtc_access->index; register unsigned long __r18 __asm__("$18") = rtc_access->data; __asm__ __volatile__( "call_pal %4 # cserve rtc" : "=r"(__r16), "=r"(__r17), "=r"(__r18), "=r"(__r0) : "i"(PAL_cserve), "0"(__r16), "1"(__r17), "2"(__r18) : "$1", "$22", "$23", "$24", "$25"); rtc_access->data = __r0; } uncrustify-0.59/tests/input/c/bits.c0000644000175000017500000000011111506773275014441 00000000000000struct foo { unsigned long bar; u_int ndots : 4, nsort: 4, : 0; }; uncrustify-0.59/tests/input/c/sp_embed_comment.c0000644000175000017500000000011411506773275017003 00000000000000void f(); void g(int); void h() { f(/*foo*/); g(42/*foo*/); g(/*foo*/42); } uncrustify-0.59/tests/input/c/semicolons.c0000644000175000017500000000131211506773275015657 00000000000000 int foo(int bar) { for (;;) { break; };; if (a) { foo();; }; if (b) if (c) bar(); else ; else { foo();;;;; }; switch (a) { case 1: break; case 2: break; default: break;; };; while (b-->0) { bar();; }; do { bar(); } while (b-->0 ); }; enum FPP { FPP_ONE = 1, FPP_TWO = 2, };; struct narg { int abc; ; ; char def; ; ; ; ;const char *ghi; }; void f2(void) { { i++; }; for (;;) ; for (;;) { ; } } int main(int argc, char *argv[]) { if( argc == 1 ) { printf("one"); }; else if( argc == 2 ) { printf("two"); }; else { printf("%d", argc); }; return 0; } uncrustify-0.59/tests/input/c/define-if-indent.c0000644000175000017500000000011111506773275016605 00000000000000 #define foobar(x) \ { \ for (i=0; i < x; i++) \ { \ junk(i,x); \ } \ } uncrustify-0.59/tests/input/c/brace-remove2.c0000644000175000017500000000130611506773275016140 00000000000000/* else is tied to if(two) */ int main() { if (one) { if (two) sleep (1); else sleep (2); } if (three) sleep(1); else if (four) sleep(2); } /* else is tied to if(one) */ int main() { if (one) { if (two) sleep (1); } else { if (three) sleep (2); } } /* else.1 is tied to if(two), else.2 is tied to if(one) */ int main() { if (one) { if (two) sleep (1); else { if (three) sleep (2); } } else sleep (3); } int main() { if (read_write == I2C_SMBUS_READ) { msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; } else { msg[0].len = data->block[0] + 1; } } uncrustify-0.59/tests/input/c/sp_cmt_cpp_start.c0000644000175000017500000000006311506773275017052 00000000000000 //zero // one // two // three void foo(void); uncrustify-0.59/tests/input/c/bugs-4.c0000644000175000017500000000163311506773275014613 00000000000000 static void set_md_connected(CHAR *msg_data) { UINT32 rd_idx = 0; CHAR mobile_device_id[MOBILE_DEVICE_NAME_LEN]; CHAR ip_addr[IP_ADDRESS_LEN]; CHAR mac_addr[MAC_ADDR_LEN]; CHAR ap_name[AP_NAME_LEN]; rdc_strz(msg_data,MAX_SIZE,&rd_idx,mobile_device_id,0); rdc_strz(msg_data,MAX_SIZE,&rd_idx,ip_addr,0); rdc_strz(msg_data,MAX_SIZE,&rd_idx,mac_addr,0); rdc_strz(msg_data,MAX_SIZE,&rd_idx,ap_name,0); #if defined (DB_MGR_ORACLE) (void)db_set_md_connected(mobile_device_id,ip_addr,mac_addr,ap_name); LOG(LFTR,"CONNECTED Loco %s, IP Addr %s,MAC Addr %s, AP Name %s", mobile_device_id,ip_addr,mac_addr,ap_name); #elif defined (DB_MGR_FILE) LOG(LFTR,"%s CONNECTED Loco %s, IP Addr %s,MAC Addr %s, AP Name %s", status_str,mobile_device_id,ip_addr,mac_addr,ap_name); #else #error Unknown device type must be DB_MGR_ORACLE or DB_MGR_FILE #endif } uncrustify-0.59/tests/input/c/mac.c0000644000175000017500000000067011506773275014252 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 return(res); } // col1 comment in level 0 uncrustify-0.59/tests/input/c/nl_assign.c0000644000175000017500000000062711506773275015471 00000000000000 void foo() { some.really_long.variable_name = another.big.one[55] + something_else; some.really_long.variable_name = another.big.one[55] + something_else; some.really_long.variable_name = another.big.one[55] + something_else; a_really_long_assignment_to_test = line_breaks_around_assign_and_arith; a_really_long_assignment_to_test = line_breaks_around + assign_and_arith; } uncrustify-0.59/tests/input/c/align_attr.c0000644000175000017500000000013411506773275015631 00000000000000 char test[3] _PREPROCESSOR_SOMETHING; int numberThatIsReallyCool _PREPROCESSOR_SOMETHING; uncrustify-0.59/tests/input/c/nl_endif.c0000644000175000017500000000021011506773275015256 00000000000000int main ( ) { #ifdef useJPLvelocity for(i = 0; i < x; i++) y++; #endif return (0); } /* main */ uncrustify-0.59/tests/input/c/type-cast.c0000644000175000017500000000031611506773275015420 00000000000000 void foo(void) { drab bar; bar = (bat) * r; bar = (int) * r; bar = (UINT8) * r; bar = (time_t) * r; a = &arg[dog * 13]; b = arg[dog * cat]; hc = "0123456789ABCDEF"[0xf & *val]; } uncrustify-0.59/tests/input/c/multi.h0000644000175000017500000000017411506773275014650 00000000000000/* This is a multiline comment that should not be indented */ { /* No trailing spaces in this comment */ } uncrustify-0.59/tests/input/c/for-space.c0000644000175000017500000000043411506773275015367 00000000000000void f() { for ( ; it != Values.end(); ++it) BTree.insert(std::pair < int, double > (*it, double (*it) + 1.0)); for ( ; vIt != Values.end(); ++vIt) { } for ( ; vIt != Values.end(); ++vIt) { } for ( ; ; ) ; for (int i = 0; i < 42; ) i += 3; for (int i = 0; i < 42; ++i) k += 3; } uncrustify-0.59/tests/input/c/funcfunc.c0000644000175000017500000000017011506773275015314 00000000000000int main() { mWriter( "class Clst_"c )( cluster.getChild( HO_SHORT_NAME ).getText() )( " : Cluster {"c ).newline; } uncrustify-0.59/tests/input/cpp/0000755000175000017500000000000011631561151013746 500000000000000uncrustify-0.59/tests/input/cpp/align_left_shift.cpp0000644000175000017500000000104511506773275017710 00000000000000#include #define MACRO(x) x int main() { int X[1]; MACRO(std::cout << X << X[0]); std::cout << X << X; std::cout2 << X << X; std::cout << X << X[0]; } #define A_LONG_MACRO_NAME(x) x void f() { std::cout << "Hello, " << "World!" << std::endl; A_LONG_MACRO_NAME(std::cout << "Hello, " << "World!" << std::endl); A_LONG_MACRO_NAME( std::cout << "Hello, " << "World!" << std::endl); } uncrustify-0.59/tests/input/cpp/sp_before_tr_emb_cmt_input.cpp0000644000175000017500000000051411631560313021747 00000000000000/* leading cmt */ int w; int y;/* embedded cmt */int z; // whole cpp cmt int x; // trailing cpp cmt /* whole c cmt */ int x; /* trailing c cmt */ struct foo { // trailing cmt int x; // trailing cmt // whole cmt int a; /* emb cmt */ int b; // trailing cmt }; // trailing cmt int a;/* emb cmt */ int b;// trailing cmt uncrustify-0.59/tests/input/cpp/misc.cpp.uncrustify0000644000175000017500000000246411506773275017562 00000000000000 /* Not detected as a prototype? Spacing wrong. */ static struct my_entry *get_first_entry(const CHAR *blah); static CFooo::entry *get_next_entry(const CHAR *blah); static struct my_entry *get_next_entry(const CHAR *blah); /* Not handling prototype params: */ typedef void (*function_name)(my_t * p_my, int foo); typedef void (*function_name)(my_t *, int ); typedef enum { one = 1, three = 3, five_hundred = 5, a_really_really_big_number = 6, two = 7, a_really_really_really_big_number = 8, }yuck_t; const char *names[] = { one = "one", three = "three", five_hundred = "five_hundred", a_really_really_big_number = "a_really_really_big_number", two = "two", a_really_really_really_big_number = "a_really_really_really_big_number", }; bool foo(char c) { xWindow *pWindow = ::RelatedWindow(); /* space between ] and ( */ function_list[idx](param); /* Indenting with multiple members: */ sass.asdfvas->asdfasd[asdfasdf]. asdfasdf = 5; dookie::wookie << "asd" << "bag" << "sag"; sp_sign = 4 - -5; sp_sign = -sp_sign; sp_sign = 4 + +7; sp_sign = +sp_sign; sp_sign = 4 + +sp_sign; } #ifndef abc #define abc 123 /* some comment */ #endif /* another comment uncrustify-0.59/tests/input/cpp/indent_braces_no.h0000644000175000017500000000021211506773275017343 00000000000000 class MyClass { public: struct something { int one; int two; } MyClass() { } void oneFunction() { if (1 == 0) { instructions; } } }; uncrustify-0.59/tests/input/cpp/class.h0000644000175000017500000000207211506773275015162 00000000000000#ifndef _FOO_BAR_H_INCLUDED_ #define _FOO_BAR_H_INCLUDED_ class CFooBarDlg : public CDialog { // Construction public: CFooBarDlg(CFooBar *pDataMan, CWnd* pParent = NULL ); virtual ~CFooBarDlg(); void Initialize( BYTE nDelay=100 ); UINT GetCount() { return (m_nCount); } void SetCount(int count=1) { if ((count > 0) && (count < MAX_COUNT)) { m_nCount = count; } }; // Dialog Data //{{AFX_DATA(CATCSMgrDlg) enum { IDD = IDD_ATCS_MGR_DLG }; //}}AFX_DATA protected: int m_nCount; // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CATCSMgrDlg) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation // Generated message map functions //{{AFX_MSG(CATCSMgrDlg) virtual BOOL OnInitDialog(); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnBtnSendFooBar(); afx_msg void OnSelchangeFooBarCombo(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #endif /* _FOO_BAR_H_INCLUDED_ */ uncrustify-0.59/tests/input/cpp/semicolons.cpp0000644000175000017500000000230211506773275016557 00000000000000static int foo(int bar); static int foo(int bar) { for (;;) { break; };; if (a) { foo();; }; if (b) if (c) bar(); else ; else { foo();;;;; }; switch (a) { case 1: break; case 2: break; default: break;; };; while (b-->0) { bar();; }; do { bar(); } while (b-->0 ); }; enum FPP { FPP_ONE = 1, FPP_TWO = 2, };; struct narg { int abc; ; ; char def; ; ; ; ;const char *ghi; }; class CFooRun { long stick(); int bar() { m_ick++; }; CFooRun();; ~CFooRun() {}; }; void f() { if (tmp[0] == "disk") { tmp = split (tmp[1], ","); DiskEntry entry = { tmp[0], tmp[2], stxxl::int64 (str2int (tmp[1])) * stxxl::int64 (1024 * 1024) }; disks_props.push_back (entry); } } template < class > struct type; template < class T > class X { typedef type < T > base ; void f () { ( base :: operator * () ) ;; }; }; namespace N { class C { #define NOP(x) { } }; } namespace N { class C { }; } uncrustify-0.59/tests/input/cpp/cmt-cpp-cont.cpp0000644000175000017500000000100411506773275016706 00000000000000#include "foo.h" // // plshade z xmin xmax ymin ymax \ // sh_min sh_max sh_cmap sh_color sh_width \ // min_col min_wid max_col max_wid \ rect [[pltr x y] | NULL ] [wrap] //-------------------------------------------------------------------------- void foo() { // plshade z xmin xmax ymin ymax \ // sh_min sh_max sh_cmap sh_color sh_width \ // min_col min_wid max_col max_wid \ rect [[pltr x y] | NULL ] [wrap] //-------------------------------------------------------------------------- } uncrustify-0.59/tests/input/cpp/function-def.cpp~0000644000175000017500000000170411506773275017170 00000000000000int &Function() { static int x; return (x); } void foo1(int param1, int param2, char *param2); void foo2(int param1, int param2, char *param2); void foo3(int param1, int param2, // comment char *param2 ); struct whoopee *foo4(int param1, int param2, char *param2 /* comment */); const struct snickers * foo5(int param1, int param2, char *param2); void foo(int param1, int param2, char *param2) { printf("boo!\n"); } int classname::method(); int classname::method() { foo(); } int classname::method2(); int classname::method2() { foo2(); } const int& className::method1(void) const { // stuff } const longtypename& className::method2(void) const { // stuff } int &foo(); int &foo() { list_for_each(a,b) { bar(a); } return nuts; } void Foo::bar() {} Foo::Foo() {} Foo::~Foo() {} void func(void) { Directory dir("arg"); } uncrustify-0.59/tests/input/cpp/align-star-amp-pos.cpp0000644000175000017500000000141011506773275020016 00000000000000 /** First, the typedefs */ typedef int MY_INT; typedef int * MY_INTP; typedef int & MY_INTR; typedef CFoo& foo_ref_t; typedef int(*foo_t)(void *bar); typedef int(*somefunc_t)(void *barstool); /* Now, the types */ struct foo1 { unsigned int d_ino; const char *d_reclen; unsigned short d_namlen; char d_name[1]; CFoo&fref; }; struct foo { int a; char *b }; static int idx; static const char **tmp; CFoo&fref; static char buf[64]; static unsigned long how_long; // comment static int **tmp; static char buf[64]; void bar(int someval, void *puser, const char *filename, struct willy *the_list, int list_len) { int idx; const char **tmp; char buf[64]; CFoo&fref; unsigned long how_long; return(-1); } uncrustify-0.59/tests/input/cpp/sp_before_ellipsis.cpp0000644000175000017500000000042411506773275020257 00000000000000 void log_fmt( log_sev_t sev, const char *fmt,... ) __attribute__((format(printf, 2, 3))); #define LOG_FMT(sev, args...) \ do { if (log_sev_on(sev)) { log_fmt(sev, ## args); } } while (0) #endif void foo() { try {} catch (...) // <== HERE {} } uncrustify-0.59/tests/input/cpp/cmt-reflow.cpp0000644000175000017500000000133211506773275016465 00000000000000 typedef enum stuff { Value1 = 0x00000400 , // Just a comment for the value Value2 = 0x00000800 , // A much longer comment that needs to be truncated to fit within a set character width. In this case, its 80 characters so two truncates are required. } JustAnEnum; // this is another comment that is meant to exceed the code width so that it can be wrapped // and combined to see how that works. /* this is another comment that is meant to exceed the code width so that it can be wrapped * and combined to see how that works. */ /* Line A */ /* Line 1 */ /* line 2 */ /* line 3 */ /* line 4 */ /** * Multi-line comment */ void foo(void) { /** * Multi-line comment */ int idx; /** * Multi-line comment */ } uncrustify-0.59/tests/input/cpp/nl_func_scope_name.cpp0000644000175000017500000000001711506773275020222 00000000000000void A::f() {} uncrustify-0.59/tests/input/cpp/case-brace-remove.cpp0000644000175000017500000000031011574756532017663 00000000000000int SomeClass::method() { switch (1) { case 0: { double v; break; } case 1: { double v; v = this->mat.operator()(0, 0); break; } case 2: { foo(); } } } uncrustify-0.59/tests/input/cpp/qt-1.cpp0000644000175000017500000000067611506773275015202 00000000000000class Foo: public QObject { Q_OBJECT private slots: void mySlot(); public slots: void publicSlot(); signals: void somesignal(); }; class foo{bool b;public:int i;};class bar:public foo{void*p;protected:double d;}; class Foo1: public QObject { Q_OBJECT private Q_SLOTS: void mySlot(); public Q_SLOTS: void publicSlot(); Q_SIGNALS: void somesignal(); }; class foo1{bool b;public:int i;};class bar:public foo1{void*p;protected:double d;}; uncrustify-0.59/tests/input/cpp/misc6.cpp0000644000175000017500000000011311506773275015423 00000000000000#include void f(std::vector * vip, std::vector & vir); uncrustify-0.59/tests/input/cpp/templates3.cpp0000644000175000017500000000055711506773275016477 00000000000000template struct T { typedef int result; }; template struct X { typedef typename T::result result; }; template class new_alloc { public: void deallocate (int* p, int /*num*/) { T::operator delete((void *)p); } }; void test(void) { return x != 0 && x >= 1 && x < 2 && y >= 3 && y < 4; } uncrustify-0.59/tests/input/cpp/angle.cpp0000644000175000017500000000103311506773275015472 00000000000000#include typedef std::vector > Table; // OK typedef std::vector> Flags; // Error void func(List= default_val1); void func(List>= default_val2); void foo() { A<(X>Y)> a; a = static_cast>(ld); } template class X { /* ... */ }; X< 1>2 > x1; // Syntax error. X<(1>2)> x2; // Okay. template class Y { /* ... */ }; Y> x3; // Okay, same as "Y > x3;". Y>1>> x4; // Syntax error. Instead, write "Y>1)>> x4;". Y>1)>> x4; uncrustify-0.59/tests/input/cpp/strings.cpp0000644000175000017500000000350211574756633016104 00000000000000void foo() { BSTR test = L"SID"; CHAR s[] = "This is a \"test\""; CHAR ch = 'a'; } /* The 'u8', 'u', and 'U' prefixes */ const char *s1 = u8"I'm a UTF-8 string."; const char16_t *s2 = u"This is a UTF-16 string."; const char32_t *s3 = U"This is a UTF-32 string."; /* The 'R' and 'R"delim(' prefixes */ const char *r1 = R"(Xhe String Data \ Stuff " )"; const char *r2 = R"delimiter(The String Data \ Stuff ")delimiter"; /* Multiline string */ auto foo = R"FOO"( some text and more text )FOO""; /* Combo */ const char *c1 = u8R"XXX(I'm a "raw UTF-8" string.)XXX"; const char16_t *c2 = uR"*(This is a "raw UTF-16" string.)*"; const char32_t *c3 = UR"(This is a "raw UTF-32" string.)"; /* user-defined */ OutputType operator "" _Suffix(unsigned long long); OutputType operator "" _Suffix(long double); OutputType some_variable = 1234_Suffix; // uses the first function OutputType another_variable = 3.1416_Suffix; // uses the second function OutputType operator "" _Suffix(const char * string_values, size_t num_chars); OutputType operator "" _Suffix(const wchar_t * string_values, size_t num_chars); OutputType operator "" _Suffix(const char16_t * string_values, size_t num_chars); OutputType operator "" _Suffix(const char32_t * string_values, size_t num_chars); OutputType some_variable = "1234"_Suffix; //Calls the const char * version OutputType some_variable = u8"1234"_Suffix; //Calls the const char * version OutputType some_variable = L"1234"_Suffix; //Calls the const wchar_t * version OutputType some_variable = u"1234"_Suffix; //Calls the const char16_t * version OutputType some_variable = U"1234"_Suffix; //Calls the const char32_t * version /* Some stuff that should NOT be detected as a C++0x user-defined literal */ sscanf(text, "%"SCNx64, &val); printf("Val=%"PRIx64"\n", val); uncrustify-0.59/tests/input/cpp/templates4.cpp0000644000175000017500000000111611506773275016470 00000000000000#define FOO(X) \ template \ inline X<_blk_sz, _run_type, __pos_type> operator - ( \ const X<_blk_sz, _run_type, __pos_type> & a, \ typename X<_blk_sz, _run_type, __pos_type>::_pos_type off) \ { \ return X<_blk_sz, _run_type, __pos_type>(a.array, a.pos - off); \ } \ template \ inline X<_blk_sz, _run_type, __pos_type> & operator -= ( \ X < _blk_sz, _run_type, __pos_type > & a, \ typename X<_blk_sz, _run_type, __pos_type>::_pos_type off) \ { \ a.pos -= off; \ return a; \ } uncrustify-0.59/tests/input/cpp/deref.cpp0000644000175000017500000000060111506773275015471 00000000000000 myNewValue = something[arrayNumber] *someOtherValue; myNewValue = multidimentional[arrayNumber][anotherNumber] *someOtherValue; myNewValue = noArrayVariableWorksFine * someOtherValue; int func(int * thingy, volatile int *arrayThingy[NUMBER]); int func(int * thingy, volatile int *arrayThingy[NUMBER][anotherNumber]); int func(int * thingy, volatile int *noArrayThingyWorksFine); uncrustify-0.59/tests/input/cpp/long_namespace.cpp0000644000175000017500000000021311506773275017356 00000000000000namespace boo3 { int Fun1() { return 42; } } namespace boo4 { int Fun2() { int a = 7; int b = 8; return a+b; } } uncrustify-0.59/tests/input/cpp/ctor-var.cpp0000644000175000017500000000007111506773275016142 00000000000000int foo() { TextBody textbody(GetBody().GetText()); } uncrustify-0.59/tests/input/cpp/cout.cpp0000644000175000017500000000100611506773275015356 00000000000000void foo() { cout.setf(ios::showpoint); cout.setf(ios::floatfield,ios::fixed); what.the.hell.cout << "hello" << "world!" << "This" << "is a" << "test!"; *aaaaaa = (bbbbb(cccccPtr->ddd) & YYYYYYYYYYYYYYYYYYYYYYYY) | ((bbbbb(cccccPtr->nnnnnnnn) << ZZZZZZZZZZZZZZZZZZZZZZZZZZZ) & WWWWWWWWWWWWWWWWWWWWWWWWWW) | ((bbbbb(cccccPtr->hhhhhhhhhhhhhh) << FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) & EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE); } uncrustify-0.59/tests/input/cpp/pp-define-indent.cpp0000644000175000017500000000070111506773275017533 00000000000000 #define outpsize #define some(f)\ foo(f) class CRC { public: int foo; // Initial CRC Start Value #define 24BITCRC ((ULONG) 0x00864CFB) // This line is not aligned with the other lines char ch; #define MULTI LINE DEFINE \ in column 0 \ that spans //// Operations //// public: ... } { #if defined(WIN32) SYSTEMTIME st; DWORD ThreadId; #else struct timeval mytv; struct tm *mytm; pid_t ProcessId; #endif #if SOME COND (void)loop; #endif } uncrustify-0.59/tests/input/cpp/Example.h0000644000175000017500000000012511506773275015445 00000000000000class Example { Example() : member(0) {} int member; }; uncrustify-0.59/tests/input/cpp/nl_func_type_name.cpp0000644000175000017500000000106611506773275020077 00000000000000 //zero // one // two // three void foo(void); struct A { public: long_complicated_type f(); A& operator+(const A& other); }; A& A::operator+(const A& other) {} B operator+(const B& other) {} B foo(const B& other) {} class A { public: int aFunct() { return a; } int bFunc(); }; // Another file int A::bFunc() { // some code } template typename Foo::Type Foo::Func() { } void Foo::bar() {} namespace foo { Foo::Foo() {} } Foo::~Foo() {} class Object { ~Object(void); }; template void SampleClassTemplate::connect() { } uncrustify-0.59/tests/input/cpp/func_param.cpp0000644000175000017500000000101611511366361016506 00000000000000typedef short (* hello1) (char coolParam, ushort *, unsigned int anotherone); short (* hello2)(char coolParam, ulong *, uchar, unsigned int anotherone); short hello3 (char coolParam, ushort *, unsigned int anotherone); void x (custom_t * e, void (*funcptr) ); void x (custom_t * e, void (*funcptr)[] ); void x (custom_t * e, void (*funcptr)(int, int) ); void x (custom_t * e, void (*funcptr)(int, int)[] ); uncrustify-0.59/tests/input/cpp/operator_proto.cpp0000644000175000017500000000664311506773275017476 00000000000000/* A collection of all the different known operator prototypes in C++ */ // arithmetic operators Type1 operator + (const Type1& a); // +a Type1 operator + (const Type1& a, const Type2& b); // a + b Type1& operator ++(Type1& a); // ++a Type1 operator ++(Type1& a, int); // a++ Type1& operator +=(Type1& a, const Type1& b); // a += b Type1 operator - (const Type1& a); // -a Type1& operator --(Type1& a); // --a Type1 operator --(Type1& a, int); // a-- Type1& operator -=(Type1& a, const Type1& b); // a -= b Type1 operator * (const Type1& a, const Type1& b); // a * b Type1& operator *=(Type1& a, const Type1& b); // a *= b Type1 operator / (const Type1& a, const Type1& b); // a / b Type1& operator /=(Type1& a, const Type1& b); // a /= b Type1 operator % (const Type1& a, const Type1& b); // a % b Type1& operator %=(Type1& a, const Type1& b); // a %= b // comparison operators bool operator < (const Type1& a, const Type1& b); // a < b bool operator <=(const Type1& a, const Type1& b); // a <= b bool operator > (const Type1& a, const Type1& b); // a > b bool operator >=(const Type1& a, const Type1& b); // a >= b bool operator !=(const Type1& a, const Type1& b); // a != b bool operator ==(const Type1& a, const Type1& b); // a == b // logical operators bool operator ! (const Type1& a); // !a bool operator &&(const Type1& a, const Type1& b); // a && b bool operator ||(const Type1& a, const Type1& b); // a || b // bitwise operators Type1 operator << (const Type1& a, const Type1& b); // a << b Type1& operator <<=(Type1& a, const Type1& b); // a <<= b Type1 operator >> (const Type1& a, const Type1& b); // a >> b Type1& operator >>=(Type1& a, const Type1& b); // a >>= b Type1 operator ~ (const Type1& a); // ~a Type1 operator & (const Type1& a, const Type1& b); // a & b Type1& operator &= (Type1& a, const Type1& b); // a &= b Type1 operator | (const Type1& a, const Type1& b); // a | b Type1& operator |= (Type1& a, const Type1& b); // a |= b Type1 operator ^ (const Type1& a, const Type1& b); // a ^ b Type1& operator ^= (Type1& a, const Type1& b); // a ^= b // other operators Type1& Type1::operator = (const Type1& b); // a = b void operator()(Type1& a); // a() const Type2& operator[](const Type1& a, const Type1& b); // a[b] Type2& operator*(const Type1& a); // *a Type2* operator&(const Type1& a); // &a Type2* Type1::operator->(); // a->b Type1::operator type(); // (type)a Type2& operator ,(const Type1& a, Type2& b); // a, b void *Type1::operator new(size_t x); // new Type1 void *Type1::operator new[](size_t x); // new Type1[n] void *Type1::operator delete(size_t x); // delete a void *Type1::operator delete[](size_t x); // delete [] a // Misc examples int& operator* (); Foo::operator const char *(); Foo::operator const Bar&(); uncrustify-0.59/tests/input/cpp/delete.cpp0000644000175000017500000000010111506773275015641 00000000000000 void x(int **d) { delete *d; } void x(int& d) { delete &d; } uncrustify-0.59/tests/input/cpp/indent_var_def.cpp0000644000175000017500000000012211506773275017351 00000000000000void function(){ int n; float f; anotherFunction(); char foo; somethingelse(); } uncrustify-0.59/tests/input/cpp/nl_func.cpp0000644000175000017500000000056711506773275016043 00000000000000class BSRRE1D_file : PhysicalFile { int getFoo() { return(m_foo); } void setFoo(int foo) { m_foo = foo; } public BSRRE1D_file() { this.addFormatName("BSRRE1DF"); } private int m_foo; public void xxx() { ahoj(); } // comment public void yyy() { ahoj(); } /* comment 2 */ public void xxx() { ahoj(); } } uncrustify-0.59/tests/input/cpp/extern_c.h0000644000175000017500000000133411506773275015664 00000000000000#ifndef cRecordMarking_HEADER #define cRecordMarking_HEADER #include "DIS/cPduSnapshot.h" typedef void* disConnectionH; #ifdef __cplusplus extern "C" { #endif disConnectionH createDisConnection(); void setAddressAndPort_DisConnect(disConnectionH record, const char *addr); /* Open network connection */ int open_DisConnect(disConnectionH record); /* Close network connection */ void close_DisConnect(disConnectionH record); /* Send one pdu */ int sendPdu_DisConnect(disConnectionH record, pduSnapshotH pdu); /* Receive one pdu */ int recvPdu_DisConnect(disConnectionH record, pduSnapshotH pdu); void FreeDisConnection(disConnectionH connection); #ifdef __cplusplus } #endif #endif uncrustify-0.59/tests/input/cpp/cmt_right.cpp0000644000175000017500000000073511506773275016374 00000000000000class X { struct Zone { // int a; // int b; int c; int d; double e; inline Zone(int _c) : c(_c) { } // constructor for zone search inline Zone( //int _a, //int _b, int _c, int _d, double _e) : //a(_a), //b(_b), c(_c), d(_d), e(_e) { } }; }; uncrustify-0.59/tests/input/cpp/ptr-star.cpp0000644000175000017500000000112311506773275016160 00000000000000int dx = m_ClipBox.GetWidth() * GetZoom(); m_ClipBox.m_Pos.y = PaintClipBox.y * GetZoom(); int* i; char*i; int MyFunc(std::string& s, char*) { char *c = const_cast(s.c_str()); } int YerFunc(std::string& s, char**) { char **c; int a = b[0] * c; } int*X(int *i, int*); int *i = &a; int *i = *b; int *i = &*c; int *Aclass::X(int* i, int *); class Aclass { int *X(int* i, int *); } extern "C" { int foo1(int *a); int foo2(sometype *a); } int bar1(int *a); int bar2(sometype *a); struct X { int * a; // 3:5 int f() { return * b ; // 7:8 } int g() { return * c ; // 11:8 } }; uncrustify-0.59/tests/input/cpp/misc4.cpp0000644000175000017500000000057211506773275015432 00000000000000struct X { void operator deleteme(void*); void deallocate(int*p){ operator delete((void*)p); delete((void*)q); } }; int f(bool b) { typedef int mytype; if (b) return int(42.0); else return mytype(42.0); } struct X { double f(int n) { return double(n); } }; inline value_type operator () () const { return (double(rnd32()) * (0.5 / 0x80000000)); } uncrustify-0.59/tests/input/cpp/templates.cpp~0000644000175000017500000000437211506773275016611 00000000000000#include #include #include #define MACRO(T) f() class MyClass { public: std::map < int, bool > someData; std::map < int, std::list < bool > > otherData; }; void foo() { List < byte >bob = new List (); } A foo; A bar; A baz; A > bay; void asd(void) { A foo; A bar; A baz; A > bay; if (a < b && b > c) { a = b < c > 0; } if (a < bar() > c) { } a < up_lim() ? do_hi() : do_low; a[ ac] = d; } template class MyClass { } template class MyClass { } template class MyClass : myvar(0), myvar2(0) { } template class MyClass : myvar(0), myvar2(0) { } static int max_value() { return (std :: numeric_limits :: max ) (); } template < class Config_ > priority_queue < Config_ > :: ~ priority_queue () { } template T test(T a) { return a; } int main() { int k,j; h g; k=test(j); return 0; } template class ConcreteStorageClass> class RotationMatrix : public StaticBaseMatrix { public: RotationMatrix() : StaticBaseMatrix() { // do some initialization } void assign(const OtherClass& other) { // do something } }; int main() { MyClass foo; } template< typename CharT, int N, typename Traits > inline std::basic_ostream& FWStreamOut(std::basic_ostream &os, const W::S &s) { return operator<< >( os, s ); } struct foo { type1 < int & > bar; }; struct foo { type1 < int const > bar; }; template void f(); template void g() { f(); f< i >(); f(); f(); } void h() { g<42>(); } #include std::vector A(2); std::vector B; std::vectorC(2); std::vectorD; templatestruct X{templatevoid operator()(U);}; templateclass Y{templatevoid f(V);}; void (* foobar)(void) = NULL; std::vector functions; uncrustify-0.59/tests/input/cpp/custom-open-2.cpp0000644000175000017500000000137411506773275017024 00000000000000 BEGIN_MESSAGE_MAP(CUSB2_camera_developementDlg, CDialog) ON_COMMAND(IDC_ESCAPE, On_Escape) ON_COMMAND(IDC_8_BIT, On_8_Bit) ON_COMMAND(IDC_14_BIT, On_14_Bit) ON_COMMAND(IDC_ACQUIRE, On_Acquire) ON_COMMAND(IDC_SAVE_COLUMN_AVERAGES, On_Save_Column_Averages) ON_COMMAND(IDC_SAVE_ROW_AVERAGES, On_Save_Row_Averages) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_WM_CTLCOLOR() END_MESSAGE_MAP() namespace one { namespace two { int Func(int a, int b) { return a + b; } } } using namespace one::two; void Func2(int c, int d) { } int main() { int a; switch (a) { case 0: Func2(1, Func(1, 2)); Func2(1, one::two::Func(1, 2)); break; } } uncrustify-0.59/tests/input/cpp/misc3.cpp0000644000175000017500000000151611506773275015430 00000000000000// When constructing an object there should not be any space between the & and the variable name: MyClass my1(foo,& bar); MyClass my2(foo, bar); MyClass my3(foo, bar + 3); MyClass my4(42); MyClass my5(foo(), bar); MyClass my6(int foo, int& bar); MyClass my7(const int foo, int& bar); //When using references inside of casts there is also an additional space after the &: MyClass& myInst = static_cast(otherInst); // When using the qt-specific signals and slots the pointer star is separated from the type with a space: connect(&mapper, SIGNAL(mapped(QWidget *)), this, SLOT(onSomeEvent(QWidget*))); extern int select(int __nfds, fd_set * __restrict __readfds, fd_set * __restrict __writefds, fd_set * __restrict __exceptfds, struct timeval * __restrict __timeout); uncrustify-0.59/tests/input/cpp/av.h0000644000175000017500000000167211506773275014470 00000000000000/* 2) There seems to be a problem handling .h-files compared to .cpp-files. The following problem only occurs in header-files, in source-files the output is as desired. */ static inline void foo() { //BEFORE: if (cond) callFunc(); // DESIRED: if (cond) { callFunc(); } // AFTER: if (cond) {callFunc();} /* 3) The spacing around pointer stars is not always maintained as desired. */ //BEFORE: Buffer* buffer; //AFTER: Buffer*buffer; /* 4) Inside of casts the types are not formatted as outside. */ //BEFORE: T* t = dynamic_cast(obj); //AFTER: T* t = dynamic_cast(obj); /* 5) Inside some template-stuff the spacing goes weird. Multiple spaces are inserted, although the configuration (should) say otherwise. */ //BEFORE: for (std::map::iterator it = map.begin(); it != map.end(); it++) { bar(it); } //AFTER: for (std::map < Key, Value * > ::iterator it = map.begin(); it != map.end(); it++) { bar(it); } } uncrustify-0.59/tests/input/cpp/align_fcall.cpp0000644000175000017500000000021311506773275016636 00000000000000void foo() { abc(1,2,3); abc(10,20,30); abc(100,200,300); cab(3,2,1,0); brat("foo",2000,3000); brat("question",2,-42); brat("a",-22, 1); } uncrustify-0.59/tests/input/cpp/init_align.h0000644000175000017500000000110611506773275016167 00000000000000struct file_lang languages[] = { { ".c", "C", LANG_C }, { ".cpp", "CPP", LANG_CPP }, { ".d", "D", LANG_D }, { ".cs", "CS", LANG_CS }, { ".vala", "VALA", LANG_VALA }, { ".java", "JAVA", LANG_JAVA }, { ".pawn", "PAWN", LANG_PAWN }, { ".p", "", LANG_PAWN }, { ".sma", "", LANG_PAWN }, { ".inl", "", LANG_PAWN }, { ".h", "", LANG_CPP }, { ".cxx", "", LANG_CPP }, { ".hpp", "", LANG_CPP }, { ".hxx", "", LANG_CPP }, { ".cc", "", LANG_CPP }, { ".di", "", LANG_D }, { ".m", "OC", LANG_OC }, { ".sqc", "", LANG_C }, // embedded SQL }; uncrustify-0.59/tests/input/cpp/wacky-template.cpp0000644000175000017500000000054411506773275017341 00000000000000template template void turbo_dec_1_15::compute_tail(gamma_t const & gamma, gamma2_t const & gamma2, alpha_t const & alpha, beta_t const & beta, tail_extrinsic_t & tail_extrinsic, rec_tail_t const & rec_tail) { } uncrustify-0.59/tests/input/cpp/operator.cpp~0000644000175000017500000000263511506773275016446 00000000000000 struct bar; struct foo { operator bar*(); }; class Foo { Foo operator+ (const Foo& rhs) const; const Foo& operator ==(Foo& me); bool operator> (const Foo& rhs) const; InStream& operator << (InStream& in); } const Foo& Foo::operator ==(Foo& me) { } Foo Foo::operator+ (const Foo& rhs) const { } bool Foo::operator> (const Foo& rhs) const { } class Example { char m_array[256]; Example & operator=(const Example &rhs); Example & operator+=(const Example &rhs); const Example operator+(const Example &other) const; bool operator==(const Example &other) const; bool operator!=(const Example &other) const; Example operator+ (const Example & x, const Example & y); Example operator* (const Example & x, const Example & y); double& operator() (int row, int col); double operator() (int row, int col) const; void operator++ (); int& operator* (); Example& operator++ (); // prefix ++ Example operator++ (int); // postfix ++ bool operator < (const Example& lhs, const Example& rhs) const; int operator()(int index) { i = ~ ~3; return index + 1; } char& operator[](unsigned i) { return m_array[i & 0xff]; } } bool Example::operator==(const Example &other) const { /*TODO: compare something? */ return false; } bool Example::operator!=(const Example &other) const { return ! operator ==(other); } uncrustify-0.59/tests/input/cpp/sef.cpp0000644000175000017500000000044611506773275015170 00000000000000CFoo::CFoo(const DWORD something, const RECT& positionRect, const UINT aNumber, bool thisIsReadOnly, const CString& windowTitle, CInfo *pStructInfo, int widthOfSomething) : CSuperFoo(something, positionRect, aNumber, thisIsReadOnly, windowTitle), m_pInfo(pInfo), m_width(widthOfSomething) { } uncrustify-0.59/tests/input/cpp/kw_subst2.cpp0000644000175000017500000000040211506773275016326 00000000000000#include namespace bar { class CFoo { int foo1(int arg); private: int foo2() { } }; int CFoo::foo1(int arg, char arg2) { } int CFoo::foo2() { } int CFoo::operator +() { } map func() { // some codes } int some_func(void) { } } uncrustify-0.59/tests/input/cpp/goto.cpp0000644000175000017500000000020011506773275015347 00000000000000#define x struct z #define max(a, b) ((a) > (b) ? (a) : (b)) void f() { goto p; p: goto q; q: goto p; } uncrustify-0.59/tests/input/cpp/exception.cpp0000644000175000017500000000070211506773275016404 00000000000000 #include void foo() { char *buf; try { buf = new unsigned char[1024]; if( buf == 0 ) throw "Out of memory"; } catch( char * str ) { cout << "Exception: " << str << '\n'; } } void bar() { char *buf; try { buf = new unsigned char[1024]; if( buf == 0 ) throw "Out of memory"; } catch( char * str ) { cout << "Exception: " << str << '\n'; } } uncrustify-0.59/tests/input/cpp/var_def_gap.cpp0000644000175000017500000000130411506773275016642 00000000000000#define A -3 #define B 163 #define C 2 void foo() { const std::string &targetName1 = pEntry->getTargetName(); const Point3d_t currentPosition1 = pSatOrbit->GetPositionAtTime(jdNow); } void foo2() { const std::string ** targetName2 = pEntry->getTargetName(); const Point3d_t currentPosition2 = pSatOrbit->GetPositionAtTime(jdNow); } void foo2() { const std::string** targetName3 = pEntry->getTargetName(); const Point3d_t currentPosition3 = pSatOrbit->GetPositionAtTime(jdNow); } typedef int MY_INT; typedef int *MY_INTP; typedef int (*foo_t)(void *bar); typedef int (*somefunc_t)(void *barstool); uncrustify-0.59/tests/input/cpp/class-init.cpp0000644000175000017500000000133711506773275016461 00000000000000 class Foo : public Bar { }; #define CTOR(i, _) : T(X()), \ y() \ { } class Foo2 : public Bar { }; class GLOX_API ClientBase : public Class, public OtherClass, public ThridClass, public ForthClass { public: ClientBase(const ClientBase & f){ // do something } }; ClientBase :: ClientBase (const std::string& ns, const std::string& ns1, const std::string& ns2) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } uncrustify-0.59/tests/input/cpp/alt_tokens.cpp0000644000175000017500000000030411506773275016547 00000000000000%:include // #include int main(int argc, char *argv[]) <% // { int array<:10:>; // int array[10]; %> // } uncrustify-0.59/tests/input/cpp/for_long.cpp0000644000175000017500000000030511506773275016212 00000000000000void foo() { for(std::map::iterator it=m_stat_http_conn_total.m_stat_response_codes.begin(); it!=m_stat_http_conn_total.m_stat_response_codes.end(); ++i) { bar(it); } } uncrustify-0.59/tests/input/cpp/constructor.cpp0000644000175000017500000000115411506773275016775 00000000000000 IMPLEMENT_DYNAMIC(CPropertiesDlg, CDialog) CPropertiesDlg::CPropertiesDlg( CPtcMsgSimControlModule *pcmPtcMsg, CWnd* pParent /*=NULL*/): CDialog( CPropertiesDlg::IDD, pParent ), m_pspRouter( pcmPtcMsg ), m_pspScm( pcmPtcMsg ) { m_pcmPtcMsg = pcmPtcMsg; } CPropertiesDlg::~CPropertiesDlg() { } void CPropertiesDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } CFooBar::CFooBar(CWnd* pParent /*=NULL*/) : CDialog(CFooBar::IDD, pParent), m_parent(pParent) { //{{AFX_DATA_INIT(CRouterBrowser) //}}AFX_DATA_INIT m_nFoo = 0; m_nBar = 0; } uncrustify-0.59/tests/input/cpp/templates2.cpp0000644000175000017500000000102111506773275016461 00000000000000void f() { call_a_function(42, double(-1), "charray"); call_a_function(42, double(-1), "charray" ); call_a_function( 42, double(-1), "charray" ); call_a_template_function (42); call_a_template_function (42); call_a_template_function(42); call_a_template_function( 42 ); call_a_template_function< int, int, int > (42); } template class W; template class X; template< class T, class U> class Y; template< class T, class U > class Z; uncrustify-0.59/tests/input/cpp/nl_func_type_name.cpp~0000644000175000017500000000072311506773275020274 00000000000000 //zero // one // two // three void foo(void); struct A { public: long_complicated_type f(); A& operator+(const A& other); }; A& A::operator+(const A& other) {} B operator+(const B& other) {} B foo(const B& other) {} class A { public: int aFunct() { return a; } int bFunc(); }; // Another file int A::bFunc() { // some code } template typename Foo::Type Foo::Func() { } void Foo::bar() {} namespace foo { Foo::Foo() {} } Foo::~Foo() {} uncrustify-0.59/tests/input/cpp/operator.cpp0000644000175000017500000000334011576727415016244 00000000000000 struct bar; struct foo { operator bar*(); }; class Foo { Foo operator+ (const Foo& rhs) const; const Foo& operator ==(Foo& me); bool operator> (const Foo& rhs) const; InStream& operator << (InStream& in); } const Foo& Foo::operator ==(Foo& me) { } Foo Foo::operator+ (const Foo& rhs) const { } bool Foo::operator> (const Foo& rhs) const { } class Example { char m_array[256]; Example & operator=(const Example &rhs); Example & operator+=(const Example &rhs); const Example operator+(const Example &other) const; bool operator==(const Example &other) const; bool operator!=(const Example &other) const; Example operator+ (const Example & x, const Example & y); Example operator* (const Example & x, const Example & y); double& operator() (int row, int col); double operator() (int row, int col) const; void operator++ (); int& operator* (); Example& operator++ (); // prefix ++ Example operator++ (int); // postfix ++ bool operator < (const Example& lhs, const Example& rhs) const; int operator()(int index) { i = ~ ~3; return index + 1; } char& operator[](unsigned i) { return m_array[i & 0xff]; } } bool Example::operator==(const Example &other) const { /*TODO: compare something? */ return false; } bool Example::operator!=(const Example &other) const { return ! operator ==(other); } void a() { Op op = &X::operator==; if (!A) if (op != &X::operator==) A(1) = a; if (!A) { if (op != &X::operator==) A(1) = a; } } void *operator new(std::size_t) throw(std::bad_alloc); void *operator new[ ](std::size_t) throw(std::bad_alloc); void operator delete(void *) throw(); void operator delete[ ](void *) throw(); uncrustify-0.59/tests/input/cpp/al.cpp0000644000175000017500000000167711506773275015016 00000000000000/* ctest4 */ fm_status fm2000EventHandlingInitialize(fm_int sw); fm_status fm2000MacTableOverflowStart(fm_int sw); fm_bool fm2000ProcessMATableEntry( fm_mac_table_work_list *pWork, fm_int sw, fm_int index, fm_thread * event_handler, fm_uint32 * numUpdates, fm_event **event); void foo() { Logger log = new Logger(); Logger log= new Logger( ); log.foo.bar = 5; log.narf.sweat = "cat"; for (i = 0; i<5; i++) bar(i); } int this_works(int x); int bug(int); // BUG: left-aligned typedef int fooman; enum FLAGS { FLAGS_decimal = 1, // decimal FLAGS_unsigned = 2, // u or U suffix FLAGS_long = 4, // l or L suffix }; uncrustify-0.59/tests/input/cpp/align_constr.cpp0000644000175000017500000000027011506773275017070 00000000000000struct TelegramIndex { TelegramIndex(const char* pN, unsigned long nI) : pTelName(pN), nTelIndex(n) { } ~TelegramIndex() { } const char* const pTelName; unsigned long nTelIndex; }; uncrustify-0.59/tests/input/cpp/sp_throw_paren.cpp0000644000175000017500000000007311506773275017441 00000000000000 void foo() { throw(x); throw (y); throw (z); } uncrustify-0.59/tests/input/cpp/align_class.cpp0000644000175000017500000000172111553715241016656 00000000000000//--------------------------------------------------------------------------- // Statics | //--------------------------------------------------------------------------- void CTdrFile::SetDistanceMode( TDistMode dm ) { CTdrFile::ms_DistMode = dm; } TDistMode CTdrFile::GetDistanceMode( void ) { return CTdrFile::ms_DistMode; } String CTdrFile::GetDistanceModeUnits( void ) { return ( CTdrFile::GetDistanceMode() == dmKM ) ? "km" : "Miles"; } void CTdrFile::SetBSTCompensation( bool bUseBST ){ ms_bCompBST = bUseBST; } void CTdrFile::SetFactoryMode( bool bFactory ) { ms_bFactory = bFactory; } bool CTdrFile::GetFactoryMode( void ) { return ms_bFactory; } unsigned int CAgentCharacter::iReferenceCount = 0; IAgentEx* CAgentCharacter::pAgentEx = NULL; CAgentNotifySink* CAgentCharacter::pSink = NULL; uncrustify-0.59/tests/input/cpp/region.cpp0000644000175000017500000000041311506773275015670 00000000000000class X : Y { int foo1; #pragma region something int foo2 = 2; #pragma endregion int foo() { #pragma region something else int foo3 = 3; #pragma region nested int foo4 = 0; #pragma endregion int foo5 = 0; #pragma endregion } } uncrustify-0.59/tests/input/cpp/const_throw.cpp0000644000175000017500000000015611506773275016762 00000000000000void GetFoo(void) const { return (m_Foo); } int GetFoo(void) throw (std::bad_alloc) { return (m_Foo); } uncrustify-0.59/tests/input/cpp/misc.cpp0000644000175000017500000000251511506773275015345 00000000000000 /* Not detected as a prototype? Spacing wrong. */ static struct my_entry *get_first_entry(const CHAR *blah); static CFooo::entry *get_next_entry(const CHAR *blah); static struct my_entry *get_next_entry(const CHAR *blah); /* Not handling prototype params: */ typedef void (*function_name)(my_t * p_my, int foo); typedef void (*function_name)(my_t * , int ); typedef enum { one = 1, three = 3, five_hundred = 5, a_really_really_big_number = 6, two = 7, a_really_really_really_big_number = 8, }yuck_t; const char *names[] = { one = "one", three = "three", five_hundred = "five_hundred", a_really_really_big_number = "a_really_really_big_number", two = "two", a_really_really_really_big_number = "a_really_really_really_big_number", }; bool foo(char c) { xWindow *pWindow = ::RelatedWindow(); /* space between ] and ( */ function_list[idx](param); /* Indenting with multiple members: */ sass.asdfvas->asdfasd[asdfasdf]. asdfasdf = 5; dookie::wookie << "asd" << "bag" << "sag"; sp_sign = 4 - - 5; sp_sign = -sp_sign; sp_sign = 4 + + 7; sp_sign = + sp_sign; sp_sign = 4 + + sp_sign; } #ifndef abc #define abc 123 /* some comment */ #endif /* another comment uncrustify-0.59/tests/input/cpp/kw_subst.cpp0000644000175000017500000000033011506773275016244 00000000000000#include class CFoo { int foo1(int arg); int foo2(); }; int CFoo::foo1(int arg) { } int CFoo::foo2() { } int CFoo::operator +() { } map func() { // some codes } int some_func(void) { } uncrustify-0.59/tests/input/cpp/align-func-params.cpp0000644000175000017500000000172711506773275017722 00000000000000class test { public: TYPE_EXPORT method1(int a, float b); TYPE_EXPORT method2(int& d, float e); TYPE_EXPORT method3(int* f, float g); TYPE_EXPORT method4(int a); TYPE_EXPORT method5(int & a); TYPE_EXPORT method6(int * a); TYPE_EXPORT method7(float a); TYPE_EXPORT method8(float & a); TYPE_EXPORT method9(float * a); TYPE_EXPORT method3(int* f, char foo, float g); TYPE_EXPORT method1(int a, float b) { int c; if ( true ) callProc; // do stuff. } } uncrustify-0.59/tests/input/cpp/indent_var_def_cont.cpp0000644000175000017500000000026411506773275020403 00000000000000int a, b, c; int d, e, f; void bar(void) { struct foobar a = { 'x', 0 }; struct foobar b = { 'y', 2 }, c = { 'z', 4 }; struct foobar d = { 'y', 2 }, e = { 'z', 4 }; } uncrustify-0.59/tests/input/cpp/misc5.cpp0000644000175000017500000000033611506773275015431 00000000000000typedef std::list::iterator iterator; double foo() { if (a c) { throw int(); return(double()); } call_a_function(42, double(-1), "charray"); return(foo(n)); } uncrustify-0.59/tests/input/cpp/try-catch-nl.cpp0000644000175000017500000000023711506773275016716 00000000000000int foo() { try { foo(bar); } catch (int *e) { return 0; } if (false) try { throw int(); } catch(...){} if (a) { return 1; } else { return 0; } return 1; } uncrustify-0.59/tests/input/cpp/templ_class.h0000644000175000017500000000057111506773275016365 00000000000000template class SpecialClass> class Example { // Copy constructor with other variants of Example template class OtherSpecialClass> Example(const Example& other) { // do something useful here } /** The normal member var based on the template arguments */ SpecialClass memberVar; }; uncrustify-0.59/tests/input/cpp/cmt_indent.cpp0000644000175000017500000000103611506773275016533 00000000000000namespace { /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ class Test { Test() {} ~Test() {} /** Call this method to run the test \param n test number \returns the test result */ bool Run(int n); /** Call this method to stop the test \param n test number \returns the test result */ bool Run(int n); }; } uncrustify-0.59/tests/input/cpp/comment-align.cpp0000644000175000017500000000130011506773275017133 00000000000000template inline void x3(T & a, T & b, T & c) { T temp; if (b < a) { if (c < a) { // b , c < a if (b < c) { // b < c < a temp = a; a = b; b = c; c = temp; } else { // c <=b < a std::swap(c, a); } } else { // b < a <=c // second line of comment std::swap(a, b); } } 0; 0; 0; if (1) // always do_something(); } uncrustify-0.59/tests/input/cpp/Timestamp.h0000644000175000017500000000632311506773275016023 00000000000000/** * @file Timestamp.h * Definition of class example::Timestamp. */ #ifndef __Timestamp_h_ #define __Timestamp_h_ #include namespace example { class IStreamable; class InStream; class OutStream; /** * Timestamp is a timestamp with nanosecond resolution. */ class Timestamp : public IStreamable { public: /** * Default constructor. */ Timestamp(); /** * Constructor. * * @param sec The seconds * @param nsec The nanoseconds */ Timestamp(long sec, unsigned long nsec); /** * Destructor. */ virtual ~Timestamp(); /** * Adds two timestamps. * * @param rhs The other timestamp * @return The resulting timestamp */ Timestamp operator+ (const Timestamp& rhs) const; /** * Substracts two timestamps. * * @param rhs The other timestamp * @return The resulting timestamp */ Timestamp operator- (const Timestamp& rhs) const; /** * Compares two timestamps. * * @param rhs The other timestamp * @return true if timestamp is smaller than the given timestamp */ bool operator< (const Timestamp& rhs) const; /** * Compares two timestamps. * * @param rhs The other timestamp * @return true if timestamp is greater than the given timestamp */ bool operator> (const Timestamp& rhs) const; /** * Compares two timestamps. * * @param rhs The other timestamp * @return true if timestamp is equal to the given timestamp */ bool operator== (const Timestamp& rhs) const; /** * Compares two timestamps. * * @param rhs The other timestamp * @return true if timestamp is not equal to the given timestamp */ bool operator!= (const Timestamp& rhs) const; /** * Adds an other timestamp. * * @param rhs The other timestamp */ void operator+= (const Timestamp& rhs); /** * Adds milliseconds. * * @param ms The milliseconds * @return The resulting timestamp */ Timestamp addMilliseconds(unsigned long ms) const; /** * Adds nanoseconds. * * @param ns The nanoseconds * @return The resulting timestamp */ Timestamp addNanoseconds(unsigned long ns) const; /** * Checks if this timestamp is zero. * * @return true if timestamp is zero */ bool isZero() const; /** * Gets the milliseconds. * @attention Negativ timestamp return zero * * @return The milliseconds */ unsigned long getMilliseconds() const; /** * Divide timestamps by two. * * @return The resulting timestamp */ Timestamp divideByTwo(); /** * Gets the string-representation. * * @return The string representation */ std::string getString() const; /** * Gets the string-representation in milliseconds. * * @return The string representation */ std::string getStringMilliseconds() const; /** * Resets the timestamp. */ void reset(); /** The seconds */ long sec; /** The nanoseconds */ unsigned long nsec; InStream& operator << (InStream& in); OutStream& operator >> (OutStream& out) const; }; } // namespace #endif // __Timestamp_h_ uncrustify-0.59/tests/input/cpp/variadic-template.h0000644000175000017500000000042511506773275017450 00000000000000template struct __index_holder_impl<__i, __index_holder<_Indexes...>, _IdxHolder, _Elements...> { typedef typename __index_holder_impl<__i + 1, __index_holder<_Indexes..., __i>, _Elements...>::type type; }; uncrustify-0.59/tests/input/cpp/nl-namespace.h0000644000175000017500000000017011506773275016415 00000000000000namespace ns1 { void *foo(void); void bar(void); } namespace ns2 { void *foo(void); void bar(void); } uncrustify-0.59/tests/input/cpp/bool.cpp0000644000175000017500000000015111506773275015337 00000000000000bool foo(char c) { if (c == 'a') { return true; } else { return false; } } uncrustify-0.59/tests/input/cpp/indent-misc.cpp0000644000175000017500000000114111506773275016616 00000000000000struct S { int one, two; S(int i = 1) { one = i; two = i + i; } bool check() const { return one == 1; } }; struct S { enum { twentythree = 23, fortytwoseven = 427 }; int one, two; S(int i = 1) { one = i; two = i + i; } bool check() const { return one == 1; } }; static uint jhash(K x) { ubyte *k; uint a, b, c; uint a, b, c; len = x.length; } const char *token_names[] = { [CT_POUND] = "POUND", [CT_PREPROC] = "PREPROC", }; struct whoopee * foo4( int param1, int param2, char *param2 ); uncrustify-0.59/tests/input/cpp/nl_func_decl.cpp0000644000175000017500000000030111506773275017014 00000000000000 void bla ( ); void ble ( int a, char b ); void ble2 ( int a, char b ); void bla() { } void bla2 ( ) { } void ble( int a, char b ) { } void ble2 ( int a, char b ) { } uncrustify-0.59/tests/input/cpp/c++0x_literals.cpp0000644000175000017500000000277711506773275017143 00000000000000 /* The 'u8', 'u', and 'U' prefixes */ const char s1 = u8"I'm a UTF-8 string."; const char16_t s2 = u"This is a UTF-16 string."; const char32_t s3 = U"This is a UTF-32 string."; /* The 'R' and 'R"delim(' prefixes */ const char r1 = R"(Xhe String Data \ Stuff " )"; const char r2 = R"delimiter(The String Data \ Stuff ")delimiter"; /* Combo */ const char c1 = u8R"XXX(I'm a "raw UTF-8" string.)XXX"; const char16_t c2 = uR"*(This is a "raw UTF-16" string.)*"; const char32_t c3 = UR"(This is a "raw UTF-32" string.)"; /* user-defined */ OutputType operator "" _Suffix(unsigned long long); OutputType operator "" _Suffix(long double); OutputType some_variable = 1234_Suffix; // uses the first function OutputType another_variable = 3.1416_Suffix; // uses the second function OutputType operator "" _Suffix(const char * string_values, size_t num_chars); OutputType operator "" _Suffix(const wchar_t * string_values, size_t num_chars); OutputType operator "" _Suffix(const char16_t * string_values, size_t num_chars); OutputType operator "" _Suffix(const char32_t * string_values, size_t num_chars); OutputType some_variable = "1234"_Suffix; //Calls the const char * version OutputType some_variable = u8"1234"_Suffix; //Calls the const char * version OutputType some_variable = L"1234"_Suffix; //Calls the const wchar_t * version OutputType some_variable = u"1234"_Suffix; //Calls the const char16_t * version OutputType some_variable = U"1234"_Suffix; //Calls the const char32_t * version uncrustify-0.59/tests/input/cpp/indent-off.cpp0000644000175000017500000000044211506773275016440 00000000000000struct X { void operator-(int); void operator+(int); void operator()(); }; /* *INDENT-OFF* */ struct Y { void operator-(int){} void operator+(int){} \ void operator()(){} }; /* *INDENT-ON* */ struct Y { void operator-(int){} void operator+(int){} void operator()(){} }; uncrustify-0.59/tests/input/cpp/function-def.cpp0000644000175000017500000000170211506773275016770 00000000000000int &Function() { static int x; return (x); } void foo1(int param1, int param2, char *param2); void foo2(int param1, int param2, char *param2); void foo3(int param1, int param2, // comment char *param2 ); struct whoopee *foo4(int param1, int param2, char *param2 /* comment */); const struct snickers * foo5(int param1, int param2, char *param2); void foo(int param1, int param2, char *param2) { printf("boo!\n"); } int classname::method(); int classname::method() { foo(); } int classname::method2(); int classname::method2() { foo2(); } const int& className::method1(void) const { // stuff } const longtypename& className::method2(void) const { // stuff } int &foo(); int &foo() { list_for_each(a,b) { bar(a); } return nuts; } void Foo::bar() {} Foo::Foo() {} Foo::~Foo() {} void func(void) { Directory dir("arg"); } uncrustify-0.59/tests/input/cpp/custom-open.cpp0000644000175000017500000000057611506773275016670 00000000000000 void className::set(const objectName& obj) { statement1(); MACRO_BEGIN_STUFF(param) DOSTUFF(params) MACRO_ELSE_STUFF() DOMORESTUFF(moreparams) junk = 1; MACRO2_BEGIN_STUFF junk += 3; MACRO2_ELSE_STUFF junk += 4; MACRO2_END_STUFF DOLASTSTUFF(lastparams) MACRO_END_STUFF() statement2(); } MACRO2_BEGIN_STUFF // comment MACRO2_ELSE_STUFF /* Comment */ MACRO2_END_STUFF uncrustify-0.59/tests/input/cpp/misc2.cpp0000644000175000017500000000276711506773275015440 00000000000000/* I tried to modify the spaces when using casts like static_cast etc. by using sp_before_angle, sp_after_angle and sp_inside_angle. Even setting all of those options to remove results in the following: */ myvar = dynamic_cast < MyClass* > (other); // expected: //myvar = dynamic_cast*>(other); /* Sometime pointers and references are still not detected correctly in special cases - i guess. */ //When using "sp_before_ptr_star = remove" the result is: typedef std::list::iterator iterator; //typedef std::list::iterator iterator; //------------------------------^ This space show not be there typedef void (T::*Routine)(void); //Similar with "sp_before_byref = remove": unsigned long allocate(unsigned long size, void* & p); //unsigned long allocate(unsigned long size, void* & p); //------------------------------------------------^ The same here void foo(void) { Listbob = new List (); /* Align assignments */ align_assign(chunk_get_head(), cpd.settings[UO_align_assign_span].n, cpd.settings[UO_align_assign_thresh].n); } Args::Args(int argc, char **argv) { m_count = argc; m_values = argv; int len = (argc >> 3) + 1; m_used = new UINT8[len]; if (m_used != NULL) { memset(m_used, 0, len); } } void Args(int argc, char **argv) { m_count = argc; m_values = argv; int len = (argc >> 3) + 1; m_used = new UINT8[len]; if (m_used != NULL) { memset(m_used, 0, len); } } uncrustify-0.59/tests/input/cpp/sim.h0000644000175000017500000000113211506773275014641 00000000000000namespace ns { template class TOtherClass> class Example { int foo; } } template class Example { T getValue() const; /** A pointer to a T returning function in the software environment */ T (FunctionProvider::*pF)(); }; #if !defined(EVERYTHING_OK) #error Define EVERYTHING_OK if you would like to compile your code \ or not if you would like to stop! #endif template class Example { Vector2() : x(1), y(1) {} Vector2() : x(1.0), y(1.0) {} Vector2() : x(1.0f), y(1.0f) {} V x; V y; }; uncrustify-0.59/tests/input/cpp/indent_namespace.h0000644000175000017500000000035411506773275017353 00000000000000namespace ns1 { void bar1(void); class foo1 { int i1; }; } namespace ns2 { void bar2(void); class foo2 { int i2; }; } namespace { void bar3(void); class foo3 { int i3; }; } uncrustify-0.59/tests/input/cpp/indent_ctor_init.cpp0000644000175000017500000000016311631561151017725 00000000000000struct MyClass { MyClass(int a, int b, int c) : m_a(a), m_b(b), m_c(c) {} private : int m_a, m_b, m_c; }; uncrustify-0.59/tests/input/cpp/byref.cpp0000644000175000017500000000113611506773275015517 00000000000000bool foo(int & idx) { if (idx < m_count) { idx++; return m_bool[idx-1]; } return false; } class Foo { public: Foo(); Foo(const Foo& f); }; class NS::Foo { public: Foo(Bar & b); }; template< class T > class ListManager { protected: T head; public: ListManager() { head.next = head.prev = &head; } ListManager(const ListManager& ref) { head.next = head.prev = &head; } } const Foo & Foo::operator ==(Foo& me){ ::sockaddr* ptr = (::sockaddr*)&host; return me; } MyType& MyClass::myMethode() { const MyType& t = getSomewhere(); } uncrustify-0.59/tests/input/cpp/nl-class.h0000644000175000017500000000120211506773275015563 00000000000000#ifndef NL_CLASS_H_INCLUDED #define NL_CLASS_H_INCLUDED #include namespace example { class IStreamable; class InStream; class OutStream; /** * Timestamp is a timestamp with nanosecond resolution. */ class Inher : public IStreamable { public: Inher(); virtual ~Inher(); }; /** * Timestamp is a timestamp with nanosecond resolution. */ class Inher2 : public IStreamable { public: Inher2(); Inher2(long sec, unsigned long nsec); }; class Simple { public: Simple(); virtual ~Simple(); }; class Simple2 { public: Simple2(); virtual ~Simple2(); }; } // namespace #endif // NL_CLASS_H_INCLUDED uncrustify-0.59/tests/input/cpp/class-addr.h0000644000175000017500000000012011506773275016062 00000000000000class C { public: A* B; C& D; const C& D; static C& D; public C& D; E=C& D; }; uncrustify-0.59/tests/input/cpp/nl_brace_brace.cpp0000644000175000017500000000044311506773275017311 00000000000000 SHOW_VAR status_vars[]= { { "Aborted_clients", (char *)&aborted_threads, SHOW_LONGLONG, } }; SHOW_VAR status_vars[]= { { "Aborted_clients", (char *)&aborted_threads, SHOW_LONGLONG, } }; SHOW_VAR status_vars[]= { { "Aborted_clients", (char *)&aborted_threads, SHOW_LONGLONG, } }; uncrustify-0.59/tests/input/cpp/templates.cpp0000644000175000017500000000564311506773275016415 00000000000000#include #include #include #define MACRO(T) f() class MyClass { public: std::map < int, bool > someData; std::map < int, std::list < bool > > otherData; }; void foo() { List < byte >bob = new List (); } A foo; A bar; A baz; A > bay; void asd(void) { A foo; A bar; A baz; A > bay; if (a < b && b > c) { a = b < c > 0; } if (a < bar() > c) { } a < up_lim() ? do_hi() : do_low; a[ ac] = d; } template class MyClass { } template class MyClass { } template class MyClass : myvar(0), myvar2(0) { } template class MyClass : myvar(0), myvar2(0) { } static int max_value() { return (std :: numeric_limits :: max ) (); } template < class Config_ > priority_queue < Config_ > :: ~ priority_queue () { } template T test(T a) { return a; } int main() { int k,j; h g; k=test(j); return 0; } template class ConcreteStorageClass> class RotationMatrix : public StaticBaseMatrix { public: RotationMatrix() : StaticBaseMatrix() { // do some initialization } void assign(const OtherClass& other) { // do something } }; int main() { MyClass foo; } template< typename CharT, int N, typename Traits > inline std::basic_ostream& FWStreamOut(std::basic_ostream &os, const W::S &s) { return operator<< >( os, s ); } struct foo { type1 < int & > bar; }; struct foo { type1 < int const > bar; }; template void f(); template void g() { f(); f< i >(); f(); f(); } void h() { g<42>(); } #include std::vector A(2); std::vector B; std::vectorC(2); std::vectorD; templatestruct X{templatevoid operator()(U);}; templateclass Y{templatevoid f(V);}; void (* foobar)(void) = NULL; std::vector functions; #define MACRO( a ) a template < typename = int > class X ; MACRO ( void f ( X < > & x ) ) ; void g ( X < > & x ) ; #include typedef std::vector > Table; // OK typedef std::vector> Flags; // Error void func(List= default_val1); void func(List>= default_val2); BLAH<(3.14 >= 42)> blah; void foo() { A<(X>Y)> a; a = static_cast>(ld); } template class X { /* ... */ }; X< 1>2 > x1; // Syntax error. X<(1>2)> x2; // Okay. template class Y { /* ... */ }; Y> x3; // Okay, same as "Y > x3;". Y>1>> x4; // Syntax error. Instead, write "Y>1)>> x4;". Y>1)>> x4; uncrustify-0.59/tests/input/pawn/0000755000175000017500000000000011506773275014146 500000000000000uncrustify-0.59/tests/input/pawn/crusty_ex-1.sma0000755000175000017500000000127311506773275016761 00000000000000public hudtext16(textblock[],colr,colg,colb,posx,posy,screen,time,id) { new y if(contain(textblock,"^n") == -1) { // if there is no linebreak in the text, we can just show it as it is set_hudmessage(colr, colg, colb, float(posx)/1000.0, float(posy)/1000.0, 0, 6.0, float(time), 0.2, 0.2, screen) show_hudmessage(id,textblock) } else { // more than one line new out[128],rowcounter=0,tmp[512],textremain=true;y=screen new i = contain(textblock,"^n") do { } while(textremain > 0); copy(out,i,textblock) // we need to get the first line of text before the loop do { } while(textremain) } return screen-y // we will return how many screens of text we printed } uncrustify-0.59/tests/input/pawn/functions.pawn0000644000175000017500000000056011506773275016766 00000000000000 // prototypes forward bar() native baz() foo(); enum rect { left, top , right, bottom } native intersect[rect](src1[rect], src2[rect]) native getparam(a[], b[], size) = host_getparam // function w/o brace main() printf("hello\n") foo() bar() stock ts_is_waiting(id) return(ts_get_message(id) == TSMSG_WAITING) // regular old functions baz() { do_something() } uncrustify-0.59/tests/input/pawn/enum.pawn0000644000175000017500000000231511506773275015722 00000000000000 enum rect { left, top , right, bottom } enum boot (<<= 1) { a=1, b, c, d } enum booty (<<= 1) { a=1, b, c, d } forward addvector(a[], const b[], size) enum message { text[40 char], priority } enum token { t_type, Rational: t_value, t_word[20], } new bool:flag = true increment(&value, incr=1) value += incr new msg[message] = { !"My Text", 1 } main() { new my_rect[rect] my_rect[left] = 10 my_rect[right] = 100 my_rect[top] = 10 my_rect[bottom] = 100 for (new i = 0; rect:i < rect; i++) my_rect[rect:i] *= 2 new vect[3] = { 1, 2, 3 } addvector(vect, {5, 5, 5}, 3) new Float:xpos new Float:ypos new a = 5 increment(a) increment(a, _) increment(a, 1) } sum(a, b) return a + b power(x, y) { /* returns x raised to the power of y */ assert y >= 0 new r = 1 for (new i = 0; i < y; i++) r *= x return r } addvector(a[], const b[], size) { for (new i = 0; i < size; i++) a[i] += b[i] } stock remove_filepath(szFilePath[], szFile[], pMax) { new len = strlen(szFilePath); while ((--len >= 0) && (szFilePath[len] != '/') && (szFilePath[len] != '\'')) { } copy(szFile, pMax, szFilePath[len + 1]); return; } uncrustify-0.59/tests/input/pawn/tags.pawn0000644000175000017500000000306211506773275015714 00000000000000 enum token { t_type, Rational: t_value, t_word[20], } new bool:flag = true /* "flag" can only hold "true" or "false" */ const error:success = 0 const error:fatal= 1 const error:nonfatal = 2 error:errno = fatal native printf(const format[], {Float, _}: ...); new Float:chance_to_avoid = (p_resists[id][RESISTIDX_FIRE] >= RESIST_MAX_VALUE) ? 1.00 : (float( p_resists[id][RESISTIDX_FIRE] ) / float( RESIST_MAX_VALUE )) xplevel_lev[j] = XP_PER_LEVEL_BASE_LT + ( (j - 10) * XP_PER_LEVEL_LT) + floatround( float( j / 20 ) * XP_PER_LEVEL_LT ); main() { new Float:xpos new Float:ypos new apple:elstar /* variable "elstar" with tag "apple" */ new orange:valencia /* variable "valencia" with tag "orange" */ new x /* untagged variable "x" */ elstar = valencia /* tag mismatch */ elstar = x /* tag mismatch */ x = valencia /* ok */ new Float:chance_to_avoid = (p_resists[id][RESISTIDX_FIRE] >= RESIST_MAX_VALUE) ? 1.00 : (float( p_resists[id][RESISTIDX_FIRE] ) / float( RESIST_MAX_VALUE )) xplevel_lev[j] = XP_PER_LEVEL_BASE_LT + ( (j - 10) * XP_PER_LEVEL_LT) + floatround( float( j / 20 ) * XP_PER_LEVEL_LT ); if (apple:valencia < elstar) valencia = orange:elstar some_label: // target for a goto #pragma rational Float new Float:limit = -5.0 new Float:value = -1.0 if (value < limit) printf("Value %f below limit %f\n", _:value, _:limit) else printf("Value above limit\n") goto some_label } foo() if (ape) dofunc(1) else if (monkey) dofunc(2) else dofunc(3) uncrustify-0.59/tests/input/pawn/str-escape.p0000644000175000017500000000021711506773275016315 00000000000000main() { printf "This is a testof the ^" alternate escape char, value 0x5e" printf "If ^" it doesn't work, there ^"should be some errors" } uncrustify-0.59/tests/input/pawn/unbraced.p0000644000175000017500000000046611506773275016040 00000000000000 public eBombPickUp(id) if (BombPickUp) announceEvent(id, "PICKED_BOMB") stock Float:operator-(Float:oper) return oper^Float:((-1)^((-1)/2)); /* IEEE values are sign/magnitude */ native Float: floatadd( Float:dividend, Float:divisor ); native Result: dbi_query( Sql:_sql, _query[], { Float, _ }: ... ); uncrustify-0.59/tests/input/pawn/rpn_calc.pawn0000644000175000017500000000330111506773275016533 00000000000000/* main rpn parser and lexical analysis, part of the RPN calculator */ #include #include enum token { t_type, /* operator or token type */ Rational: t_value, /* value, if t_type is "Number" */ t_word[20], /* raw string */ } const Number = '0' const EndOfExpr = '#' rpncalc(const string[]) { new index new field[token] for ( ;; ) { field = gettoken(string, index) switch (field[t_type]) { case Number: push field[t_value] case '+': push pop() + pop() case '-': push - pop() + pop() case '*': push pop() * pop() case '/', ':': push 1.0 / pop() * pop() case EndOfExpr: break /* exit "for" loop */ default: printf "Unknown operator '%s'\n", field[t_word] } } printf "Result = %r\n", pop() if (clearstack()) print "Stack not empty\n", red } gettoken(const string[], &index) { /* first get the next "word" from the string */ new word[20] word = strtok(string, index) /* then parse it */ new field[token] field[t_word] = word if (strlen(word) == 0) { field[t_type] = EndOfExpr /* special "stop" symbol */ field[t_value] = 0 } else if ('0' <= word[0] <= '9') { field[t_type] = Number field[t_value] = rationalstr(word) } else { field[t_type] = word[0] field[t_value] = 0 } return field } uncrustify-0.59/tests/input/pawn/comment.p0000644000175000017500000000140411506773275015710 00000000000000/* parse C comments interactively, using events and a state machine */ main() state plain @keypressed(key) { state (key == '/') slash if (key != '/') echo key } @keypressed(key) { state (key != '/') plain state (key == '*') comment echo '/' /* print '/' held back from previous state */ if (key != '/') echo key } @keypressed(key) { echo key state (key == '*') star } @keypressed(key) { echo key state (key != '*') comment state (key == '/') plain } echo(key) printchar key, yellow echo(key) printchar key, green printchar(ch, colour) { setattr .foreground = colour printf "%c", ch } uncrustify-0.59/tests/input/pawn/test1.pawn0000644000175000017500000000213011506773275016011 00000000000000 #define SCROLLMSG_SIZE 512 #define SCROLLMSG_SIZE 512 #define MIN(%1,%2) ((%1) < (%2) ? (%1) : (%2)) #define MAX(%1,%2) ((%1)>(%2)?(%1):(%2)) //Why doesn't it make them all one space? #define ADMIN_NORMAL (1<<1) #define ADMIN_STEAM (1<<2) #define ADMIN_NORMAL (1<<1) #define ADMIN_STEAM (1<<2) //Why space before and after colon? new Float:g_xPos new Float : g_xPos // col1 // col2 // col3 // col4 // col5 //Why so many tabs? main() { remove_task(123) /* remove current messaging */ remove_user_flags(0, read_flags("z")) // Remove 'user' flag from server rights new idtype = ADMIN_STEAM | ADMIN_LOOKUP // trail 1 new idtype = ADMIN_STEAM|ADMIN_LOOKUP // trail 2 // trail 3 // trail 4 if (idtype & ADMIN_STEAM) { a++ } else if (equali(t_arg, "ip")) { b++ } for (new _i=0; _i<_num; _i++) { c++ } for (new _i = 0; _i < _num; _i++) { d++ } } uncrustify-0.59/tests/input/pawn/traffic.p0000644000175000017500000000146411506773275015672 00000000000000/* traffic light synchronizer, using states in an event-driven model */ #include

The value can be retrieved by calling the get method * with a key that is equal to the original key. * * @param key the table key. * @param value the value. * @return the previous value of the specified key in this table, * or null if it did not have one. * @throws NullPointerException if the key or value is * null. */ public V put (K key, V value) { assert (value); uint hash = hash(key); return segmentFor(hash).put(key, hash, value, false); } /** * If the specified key is not already associated * with a value, associate it with the given value. * This is equivalent to *

     *   if (!map.containsKey(key))
     *      return map.put(key, value);
     *   else
     *      return map.get(key);
     * 
* Except that the action is performed atomically. * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or null * if there was no mapping for key. * @throws NullPointerException if the specified key or value is * null. */ public V putIfAbsent (K key, V value) { assert (value); uint hash = hash(key); return segmentFor(hash).put(key, hash, value, true); } /** * Removes the key (and its corresponding value) from this * table. This method does nothing if the key is not in the table. * * @param key the key that needs to be removed. * @return the value to which the key had been mapped in this table, * or null if the key did not have a mapping. * @throws NullPointerException if the key is * null. */ public V remove (K key) { uint hash = hash(key); return segmentFor(hash).remove(key, hash, null); } /** * Remove entry for key only if currently mapped to given value. * Acts as *
     *  if (map.get(key).equals(value)) {
     *     map.remove(key);
     *     return true;
     * } else return false;
     * 
* except that the action is performed atomically. * @param key key with which the specified value is associated. * @param value value associated with the specified key. * @return true if the value was removed * @throws NullPointerException if the specified key is * null. */ public bool remove (K key, V value) { uint hash = hash(key); return cast(bool) (segmentFor(hash).remove(key, hash, value) !is null); } /** * Replace entry for key only if currently mapped to some value. * Acts as *
     *  if ((map.containsKey(key)) {
     *     return map.put(key, value);
     * } else return null;
     * 
* except that the action is performed atomically. * @param key key with which the specified value is associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or null * if there was no mapping for key. * @throws NullPointerException if the specified key or value is * null. */ public V replace (K key, V value) { assert (value); uint hash = hash(key); return segmentFor(hash).replace(key, hash, value); } /** * Removes all mappings from this map. */ public void clear () { for (int i = 0; i < segments.length; ++i) segments[i].clear(); } /** * Returns an enumeration of the keys in this table. * * @return an enumeration of the keys in this table. * @see #keySet */ public KeyIterator keys () { return new KeyIterator (this); } /** * Returns an enumeration of the values in this table. * * @return an enumeration of the values in this table. * @see #values */ public ValueIterator elements () { return new ValueIterator (this); } /********************************************************************** Iterate over all keys in hashmap **********************************************************************/ int opApply (int delegate(inout char[]) dg) { int result = 0; KeyIterator iterator = keys (); while (iterator.hasNext) { char[] ca = cast(char[]) iterator.next; if ((result = dg (ca)) != 0) break; } return result; } /********************************************************************** Iterate over all keys in hashmap **********************************************************************/ int opApply (int delegate(inout char[], inout Object) dg) { int result = 0; KeyIterator iterator = keys (); while (iterator.hasNext) { HashEntry he = iterator.nextElement; char[] ca = cast(char[]) he.key; if ((result = dg (ca, he.value)) != 0) break; } return result; } /* ---------------- Iterator Support -------------- */ abstract static class HashIterator { int nextSegmentIndex; int nextTableIndex; HashEntry[] currentTable; HashEntry nextEntry; HashEntry lastReturned; HashMap map; this (HashMap map) { this.map = map; nextSegmentIndex = map.segments.length - 1; nextTableIndex = -1; advance(); } final void advance () { if (nextEntry !is null && (nextEntry = nextEntry.next) !is null) return; while (nextTableIndex >= 0) { if ( (nextEntry = currentTable[nextTableIndex--]) !is null) return; } while (nextSegmentIndex >= 0) { Segment seg = map.segments[nextSegmentIndex--]; volatile if (seg.count) { currentTable = seg.table; for (int j = currentTable.length - 1; j >= 0; --j) { if ((nextEntry = currentTable[j]) !is null) { nextTableIndex = j - 1; return; } } } } } public bool hasNext () { return cast(bool) (nextEntry !is null); } HashEntry nextElement () { if (nextEntry is null) throw new Exception ("no such element in HashMap"); lastReturned = nextEntry; advance (); return lastReturned; } } static class KeyIterator : HashIterator { this (HashMap map) {super (map);} public K next() { return super.nextElement().key; } } static class ValueIterator : HashIterator { this (HashMap map) {super (map);} public V next() { volatile return super.nextElement().value; } } } uncrustify-0.59/tests/input/d/template.d0000644000175000017500000000044111506773275015323 00000000000000 template Foo(T, U) { class Bar { } T foo(T t, U u) { } T abc; typedef T* FooType; typedef Tte** FooType0; typedef int* FooType1; typedef const char FooType2; } alias Foo!(int, char) f; f.Bar b; f.foo(1,2); f.abc = 3; to!string(10.0); TFoo!int.t x; class Abc(T) { T t; } uncrustify-0.59/tests/input/d/sort_import.d0000644000175000017500000000046011506773275016072 00000000000000// should be ddd, eee, fff import ddd; import fff; import eee; // should be aaa, ccc import ccc; import aaa; // should be just bbb import bbb; // should not change these, as it can't handle multi-line imports private import mango.ccc; private import mango.bbb, mango.aaa; void foo(); uncrustify-0.59/tests/input/d/volatile.d0000644000175000017500000000105511506773275015331 00000000000000void foo(void) { while (nextSegmentIndex >= 0) { Segment seg = map.segments[nextSegmentIndex--]; volatile if (seg.count) { currentTable = seg.table; for (int j = currentTable.length - 1; j >= 0; --j) { if ((nextEntry = currentTable[j]) !is null) { nextTableIndex = j - 1; return; } } } } if (e) volatile { oldValue = e.value; e.value = newValue; } return oldValue; } uncrustify-0.59/tests/input/d/volatile-2.d0000644000175000017500000000013211506773275015463 00000000000000{ if (e) volatile { a++; } return oldValue; } uncrustify-0.59/tests/input/d/tst01.d0000644000175000017500000000123411506773275014464 00000000000000package void writeRegister(int aRegisterOffset, ushort aValue) in { assert(aRegisterOffset >= 0); assert(aRegisterOffset < IMAGE_SIZE); } body { int idx = aRegisterOffset / 2; mMemCache[idx] = aValue; uint readback; uint st; uint st2; volatile { mMemImage[idx] = aValue; //readback = (cast(uint*)mMemImage.ptr)[ idx/2 ]; //st = mMemImage[ 0x28/2 ]; //st2 = mMemImage[ 0x2A/2 ]; } //if( aValue != readback ) { //debug(IRQ) writefln( "writeRegister %04x, %04x", aRegisterOffset, aValue); } // comment } // uncrustify-0.59/tests/input/d/d_sp_paren.d0000644000175000017500000000026111507441026015605 00000000000000version(unittest) { import foo; } void main() { scope(exit) { foo(); } scope(success) suckit(); scope f = new Foo(); if(foo) { } try { throw(e); } catch(Exception e) { } } uncrustify-0.59/tests/input/d/funcfunc.d0000644000175000017500000000017011506773275015316 00000000000000int main() { mWriter( "class Clst_"c )( cluster.getChild( HO_SHORT_NAME ).getText() )( " : Cluster {"c ).newline; } uncrustify-0.59/tests/input/d/delegate.d0000644000175000017500000000066111506773275015266 00000000000000module er; void delegate(ubyte[] a) TSender; bool delegate(ushort a) TVerifier; typedef ushort TAddr; public void delegate(ubyte[] a) TSender; public bool delegate(ushort a) TVerifier; public typedef ushort TAddr; void delegate() dg; dg = { int y; }; int opApply(int delegate(inout Type [, ...]) dg); void main() { assert( findIf( "bcecg", ( int x ) { return x == 'a'; } ) == 5 ); } uncrustify-0.59/tests/input/d/strings.d0000644000175000017500000000110611506773275015200 00000000000000 /* This file goes over all the various string formats for D */ int foo(int bar) { char [] a; char b; a = r"WYSIWYG"; a = `WYSIWYG`; b = 'c'; a = x"12 34 5678 90"; a = "This\nis a \"test\""; a = \' ~ \" ~ \? ~ \\ ~ \a ~ \b ~ \f ~ \n ~ \r ~ \t ~ \v; a = \x1B ~ \0 ~ \74 ~ \123; a = \u1234 ~ \U12345678; a = \& ~ 'a'; a = "Another" " " "Test"; /+ test back to back EscapeSequences +/ a = \r\n\xff\&\u1234; a = "char"c; a = "wchar"w; a = "dchar"d; /* * multi line string */ a = r"Line 1 line 2"; } uncrustify-0.59/tests/input/d/tst02.d0000644000175000017500000000176511506773275014476 00000000000000 package static ushort calcHeaderCrc(bool aStartupFrame, bool aSyncFrame, ushort aFrameId, ushort aPayloadWords) { uint crcData = aPayloadWords; crcData |= (aFrameId << 7); if (aSyncFrame) { crcData |= BIT_19; } if (aStartupFrame) { crcData |= BIT_18; } ushort crc = 0x1a; const ushort table[16] = [ 0x0000, 0x0385, 0x070A, 0x048F, 0x0591, 0x0614, 0x029B, 0x011E, 0x00A7, 0x0322, 0x07AD, 0x0428, 0x0536, 0x06B3, 0x023C, 0x01B9]; for (int i = 0; i < 5; ++i) { if (i != 0) { crcData <<= 4; } crc = ((crc << 4) & 0x7FF) ^ table[((crc >> 7) ^ (crcData >> 16)) & 0x0F]; } return(crc); } uncrustify-0.59/tests/input/d/casts.d0000644000175000017500000000033311506773275014625 00000000000000void foo(int a) { char ch; ch = cast(char) a; ch = cast(char) 45; ch = (char) a; // not a d cast ch = (int)45; ch = cast(foo)*bar; ch = cast(foo)-bar; ch = cast(foo)+45; ch = cast(foo)&45; } uncrustify-0.59/tests/input/d/Lexer.d0000644000175000017500000014435011506773275014577 00000000000000/+ Copyright (c) 1999-2006 by Digital Mars All Rights Reserved written by Walter Bright www.digitalmars.com License for redistribution is by either the Artistic License in artistic.txt, or the GNU General Public License in gnu.txt. See the included readme.txt for details. D Language conversion by: J Duncan +/ /** d language lexer */ module dparser.Lexer; import dparser.Root; import dparser.Tokens; import dparser.Token; import dparser.Keyword; import dparser.Types; import dparser.Module; import dparser.Identifier; import dparser.unialpha; import dparser.OutBuffer; //private import std.ctype; //private import std.string; //import dwf.core.debugapi; int errno = 0; //#if _WIN32 && __DMC__ // from \dm\src\include\setlocal.h //extern "C" char * __cdecl __locale_decpoint; char* __locale_decpoint; //#endif //const uint LS = 0x2028; // UTF line separator //const uint PS = 0x2029; // UTF paragraph separator //extern int isUniAlpha(unsigned u); //extern int HtmlNamedEntity(unsigned char *p, int length); /** Lexer object */ class Lexer { static Identifier[char[]] stringtable; static OutBuffer stringbuffer; static Token* freelist; Token token; // current token Module mod; // current module Loc loc; // for error messages ubyte *base; // pointer to start of buffer ubyte *end; // past end of buffer ubyte *p; // current character int doDocComment; // collect doc comment information int anyToken; // !=0 means seen at least one token int commentToken; // !=0 means comments are TOKcomment's this( Module mod, ubyte* base, uint begoffset, uint endoffset, int doDocComment, int commentToken ) { if( stringbuffer is null ) stringbuffer = new OutBuffer; loc = Loc(mod, 1); this.base = base; this.end = base + endoffset; this.p = base + begoffset; this.mod = mod; this.doDocComment = doDocComment; this.commentToken = commentToken; /* If first line starts with '#!', ignore the line */ if( p[0] == '#' && p[1] =='!' ) { p += 2; while( true ) { ubyte c = *p; switch( c ) { case '\n': p++; break; case '\r': p++; if( *p == '\n' ) p++; break; case 0: case 0x1A: break; default: if( c & 0x80 ) { uint u = decodeUTF(); if( u == PS || u == LS ) break; } p++; continue; } break; } loc.linnum = 2; } } // generate a unique identifier for this string static Identifier idPool( in char[] str ) { // StringValue sv; // uint len = s.length; // StringValue sv = stringtable.update(s, len); // Identifier* id = cast(Identifier*) sv.ptrvalue; // if( id is null ) if( (str in stringtable) == null ) { stringtable[str] = new Identifier( str, TOK.TOKidentifier ); } return stringtable[str]; } static void initKeywords() { // build character map cmtable_init(); // create keyword tokens & identifiers dparser.Keyword.initKeywords(); // create standard lexer tokens dparser.Token.createLexerTokens(); } // Combine two document comments into one. static char[] combineComments( char[] c1, char[] c2 ) { char[] c = c2; if( c1.length ) { c = c1; if( c2.length ) { c = c1 ~ "\n" ~ c2; } } return c; } // Decode UTF character. Issue error messages for invalid sequences. Return decoded character, advance p to last character in UTF sequence. //! fix uint decodeUTF() { ubyte* s = p; ubyte c = *s; assert( c & 0x80 ); if( !(c & 0x80) ) return c; return cast(uint) 'X'; /* dchar u; uint len; // Check length of remaining string up to 6 UTF-8 characters for( len = 1; len < 6 && s[len]; len++ ) { } /+ uint idx = 0; char* msg = utf_decodeChar( s, len, &idx, &u ); p += idx - 1; if( msg ) { error(msg); } +/ return u; */ } void error( ... ) { if( (mod !is null) && !global.gag ) { writefln( formatLoc( loc, _arguments, _argptr ) ); /* char[] p = loc.toChars(); if( p.length ) writef( "%s: ", p ); writefx( stdout, _arguments, _argptr, 1 ); */ if( global.errors >= global.max_errors ) // moderate blizzard of cascading messages throw new Exception( "too many errors" ); } global.errors++; } void errorLoc(Loc loc, ...) { if( (mod !is null) && !global.gag ) { writefln( formatLoc( loc, _arguments, _argptr ) ); /* char[] p = loc.toChars(); if( p.length ) writef("%s: ", p); writefx(stdout, _arguments, _argptr, 1); */ if( global.errors >= 20 ) // moderate blizzard of cascading messages throw new Exception( "too many errors" ); } global.errors++; } TOK nextToken() { if( token.next ) { Token* t = token.next; memcpy( &token, t, Token.sizeof ); // t.next = freelist; // freelist = t; } else { scan( &token ); } // token.print(); return token.value; } Token* peek( inout Token ct ) { Token* t; if( ct.next ) t = ct.next; else { t = new Token; scan( t ); t.next = null; ct.next = t; } return t; } // Turn next token in buffer into a token. void scan( Token* t ) { // debug writefln("scan token"); uint lastLine = loc.linnum; uint linnum; t.blockComment = null; t.lineComment = null; while( true ) { t.ptr = p; // debug writefln( " p = %d, *p = ", cast(uint)p, cast(char)*p ); switch( *p ) { case 0: case 0x1a: t.value = TOK.TOKeof; // end of file // debug writefln( " EOF" ); return; case ' ': case '\t': case '\v': case '\f': p++; // debug writefln( " whitespace" ); continue; // skip white space case '\r': // debug writefln( " cr" ); p++; if( *p != '\n' ) // if CR stands by itself loc.linnum++; continue; // skip white space case '\n': // debug writefln( " nl" ); p++; loc.linnum++; continue; // skip white space case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': t.value = number(t); return; /* #if CSTRINGS case '\'': t.value = charConstant(t, 0); return; case '"': t.value = stringConstant(t,0); return; case 'l': case 'L': if( p[1] == '\'') { p++; t.value = charConstant(t, 1); return; } else if( p[1] == '"') { p++; t.value = stringConstant(t, 1); return; } #else */ case '\'': // debug writefln( " char" ); t.value = charConstant(t,0); return; case 'r': // debug writefln( " wysiwyg" ); if( p[1] != '"') goto case_ident; p++; case '`': t.value = wysiwygStringConstant(t, *p); return; case 'x': // debug writefln( " hex string" ); if( p[1] != '"') goto case_ident; p++; t.value = hexStringConstant(t); return; case '"': // debug writefln( " string" ); t.value = escapeStringConstant( t, 0 ); // debug writefln( t.ustring ); return; case '\\': // escaped string literal // debug writefln( " escaped string literal" ); uint c; stringbuffer.offset = 0; do { p++; c = escapeSequence(); stringbuffer.write(c); } while (*p == '\\'); // t.len = stringbuffer.offset; // stringbuffer.write(cast(byte)0); t.ustring = stringbuffer.toString; // memcpy( t.ustring.ptr, stringbuffer.data, stringbuffer.offset ); t.postfix = 0; t.value = TOK.TOKstring; return; case 'l': case 'L': // #endif case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'm': case 'n': case 'o': case 'p': case 'q': /*case 'r':*/ case 's': case 't': case 'u': case 'v': case 'w': /*case 'x':*/ case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '_': case_ident: { // debug writefln( " identifier" ); ubyte c; do { c = *++p; } while( isidchar(c) || (c & 0x80 && isUniAlpha( decodeUTF())) ); // sv = stringtable.update((char *)t.ptr, p - t.ptr); char[] tmp; tmp.length = p - t.ptr; memcpy( tmp.ptr, t.ptr, p - t.ptr ); Identifier id; Identifier* pid = tmp in stringtable; if( pid ) { id = *pid; } if( id is null ) { id = new Identifier( tmp, TOK.TOKidentifier ); stringtable[tmp] = id; } t.ident = id; t.value = cast(TOK) id.value; anyToken = 1; // if special identifier token if( *t.ptr == '_') { static char date[11+1]; static char time[8+1]; static char timestamp[24+1]; if( !date[0] ) // lazy evaluation { //!! /+ time_t t; char *p; .time(&t); p = ctime(&t); assert(p); sprintf(date.ptr, "%.6s %.4s", p + 4, p + 20); sprintf(time.ptr, "%.8s", p + 11); sprintf(timestamp.ptr, "%.24s", p); +/ } if( mod && id is Id.FILE ) { t.value = TOK.TOKstring; if( loc.filename.length ) t.ustring = loc.filename; else t.ustring = mod.ident.toChars(); goto Llen; } else if( mod && id == Id.LINE ) { t.value = TOK.TOKint64v; t.uns64value = loc.linnum; } else if( id == Id.DATE ) { t.value = TOK.TOKstring; //! t.ustring = date; goto Llen; } else if( id == Id.TIME ) { t.value = TOK.TOKstring; //! t.ustring = time; goto Llen; } else if( id == Id.TIMESTAMP ) { t.value = TOK.TOKstring; //! t.ustring = timestamp; Llen: t.postfix = 0; // t.len = strlen((char *)t.ustring); } } //printf("t.value = %d\n",t.value); return; } // comments case '/': p++; switch( *p ) { case '=': p++; t.value = TOK.TOKdivass; return; case '*': // '/*' p++; linnum = loc.linnum; while( true ) { while( true ) { ubyte c = *p; switch( c ) { case '/': break; case '\n': loc.linnum++; p++; continue; case '\r': p++; if( *p != '\n') loc.linnum++; continue; case 0: case 0x1A: error("unterminated /* */ comment"); p = end; t.value = TOK.TOKeof; return; default: if( c & 0x80) { uint u = decodeUTF(); if( u == PS || u == LS ) loc.linnum++; } p++; continue; } break; } p++; if( p[-2] == '*' && p - 3 != t.ptr ) break; } if( commentToken ) { t.value = TOK.TOKcomment; return; } // if /** but not /**/ else if( doDocComment && t.ptr[2] == '*' && p - 4 != t.ptr ) getDocComment( t, lastLine == linnum ); //! ? continue; case '/': // do // style comments linnum = loc.linnum; while (1) { ubyte c = *++p; switch (c) { case '\n': break; case '\r': if( p[1] == '\n') p++; break; case 0: case 0x1a: if( commentToken ) { p = end; t.value = TOK.TOKcomment; return; } if( doDocComment && t.ptr[2] == '/' ) getDocComment( t, lastLine == linnum ); p = end; t.value = TOK.TOKeof; return; default: if( c & 0x80) { uint u = decodeUTF(); if( u == PS || u == LS) break; } continue; } break; } if( commentToken ) { p++; loc.linnum++; t.value = TOK.TOKcomment; return; } if( doDocComment && t.ptr[2] == '/' ) getDocComment( t, lastLine == linnum ); p++; loc.linnum++; continue; case '+': { int nest; linnum = loc.linnum; p++; nest = 1; while (1) { ubyte c = *p; switch (c) { case '/': p++; if( *p == '+') { p++; nest++; } continue; case '+': p++; if( *p == '/') { p++; if( --nest == 0) break; } continue; case '\r': p++; if( *p != '\n') loc.linnum++; continue; case '\n': loc.linnum++; p++; continue; case 0: case 0x1A: error("unterminated /+ +/ comment"); p = end; t.value = TOK.TOKeof; return; default: if( c & 0x80 ) { uint u = decodeUTF(); if( u == PS || u == LS) loc.linnum++; } p++; continue; } break; } if( commentToken ) { t.value = TOK.TOKcomment; return; } if( doDocComment && t.ptr[2] == '+' && p - 4 != t.ptr ) { // if /++ but not /++/ getDocComment(t, lastLine == linnum); } continue; } default: break; } t.value = TOK.TOKdiv; return; case '.': p++; if( isdigit(*p)) { p--; t.value = inreal(t); } else if( p[0] == '.') { if( p[1] == '.') { p += 2; t.value = TOK.TOKdotdotdot; } else { p++; t.value = TOK.TOKslice; } } else t.value = TOK.TOKdot; return; case '&': p++; if( *p == '=') { p++; t.value = TOK.TOKandass; } else if( *p == '&') { p++; t.value = TOK.TOKandand; } else t.value = TOK.TOKand; return; // |, ||, |= case '|': p++; if( *p == '=' ) { p++; t.value = TOK.TOKorass; } else if( *p == '|') { p++; t.value = TOK.TOKoror; } else t.value = TOK.TOKor; return; case '-': p++; if( *p == '=') { p++; t.value = TOK.TOKminass; } else if( *p == '-') { p++; t.value = TOK.TOKminusminus; } else t.value = TOK.TOKmin; return; // +, +=, ++ case '+': p++; if( *p == '=') { p++; t.value = TOK.TOKaddass; // += } else if( *p == '+') { p++; t.value = TOK.TOKplusplus; // ++ } else t.value = TOK.TOKadd; // + return; // <, <=, <<=, <<, <>=, <> case '<': p++; if( *p == '=') { p++; t.value = TOK.TOKle; // <= } else if( *p == '<') { p++; if( *p == '=') { p++; t.value = TOK.TOKshlass; // <<= } else t.value = TOK.TOKshl; // << } else if( *p == '>') { p++; if( *p == '=') { p++; t.value = TOK.TOKleg; // <>= } else t.value = TOK.TOKlg; // <> } else t.value = TOK.TOKlt; // < return; // >, >>, >>>, >=, >>=, >>>= case '>': p++; if( *p == '=') { p++; t.value = TOK.TOKge; // >= } else if( *p == '>') { p++; if( *p == '=') { p++; t.value = TOK.TOKshrass; // >>= } else if( *p == '>') { p++; if( *p == '=') { p++; t.value = TOK.TOKushrass; // >>>= } else t.value = TOK.TOKushr; // >>> } else t.value = TOK.TOKshr; // >> } else t.value = TOK.TOKgt; // > return; case '!': p++; if( *p == '=') { p++; if( *p == '=') { p++; t.value = TOK.TOKnotidentity; // !== } else t.value = TOK.TOKnotequal; // != } else if( *p == '<') { p++; if( *p == '>') { p++; if( *p == '=') { p++; t.value = TOK.TOKunord; // !<>= } else t.value = TOK.TOKue; // !<> } else if( *p == '=') { p++; t.value = TOK.TOKug; // !<= } else t.value = TOK.TOKuge; // !< } else if( *p == '>') { p++; if( *p == '=') { p++; t.value = TOK.TOKul; // !>= } else t.value = TOK.TOKule; // !> } else t.value = TOK.TOKnot; // ! return; case '=': p++; if( *p == '=') { p++; if( *p == '=') { p++; t.value = TOK.TOKidentity; // === } else t.value = TOK.TOKequal; // == } else t.value = TOK.TOKassign; // = return; case '~': p++; if( *p == '=' ) { p++; t.value = TOK.TOKcatass; // ~= } else t.value = TOK.TOKtilde; // ~ return; // SINGLE case '(': p++; t.value = TOK.TOKlparen; return; case ')': p++; t.value = TOK.TOKrparen; return; case '[': p++; t.value = TOK.TOKlbracket; return; case ']': p++; t.value = TOK.TOKrbracket; return; case '{': p++; t.value = TOK.TOKlcurly; return; case '}': p++; t.value = TOK.TOKrcurly; return; case '?': p++; t.value = TOK.TOKquestion; return; case ',': p++; t.value = TOK.TOKcomma; return; case ';': p++; t.value = TOK.TOKsemicolon; return; case ':': p++; t.value = TOK.TOKcolon; return; case '$': p++; t.value = TOK.TOKdollar; return; // DOUBLE case '*': p++; if( *p == '=' ) { p++; t.value = TOK.TOKmulass; } else t.value = TOK.TOKmul; return; case '%': p++; if( *p == '=' ) { p++; t.value = TOK.TOKmodass; } else t.value = TOK.TOKmod; return; case '^': p++; if( *p == '=' ) { p++; t.value = TOK.TOKxorass; } else t.value = TOK.TOKxor; return; // removed 148 case '~': p++; if( *p == '=' ) { p++; t.value = TOK.TOKcatass; } else t.value = TOK.TOKtilde; return; case '#': p++; Pragma(); continue; default: { debug writefln( " default char" ); ubyte c = *p; if( c & 0x80 ) { uint u = decodeUTF(); // Check for start of unicode identifier if( isUniAlpha(u) ) goto case_ident; if( u == PS || u == LS ) { loc.linnum++; p++; continue; } } if( isprint(c)) error("unsupported char '%s'", cast(char)c); else error("unsupported char 0x%02x", cast(ubyte)c); p++; continue; } } } } // Parse escape sequence. uint escapeSequence() { uint c; int n; int ndigits; c = *p; switch ( c ) { case '\'': case '"': case '?': case '\\': Lconsume: p++; break; case 'a': c = 7; goto Lconsume; case 'b': c = 8; goto Lconsume; case 'f': c = 12; goto Lconsume; case 'n': c = 10; goto Lconsume; case 'r': c = 13; goto Lconsume; case 't': c = 9; goto Lconsume; case 'v': c = 11; goto Lconsume; case 'u': ndigits = 4; goto Lhex; case 'U': ndigits = 8; goto Lhex; case 'x': ndigits = 2; Lhex: p++; c = *p; if( ishex(c)) { uint v; n = 0; v = 0; while (1) { if( isdigit(c)) c -= '0'; else if( islower(c)) c -= 'a' - 10; else c -= 'A' - 10; v = v * 16 + c; c = *++p; if( ++n == ndigits) break; if( !ishex(c)) { error("escape hex sequence has %d hex digits instead of %d", n, ndigits); break; } } //! if( ndigits != 2 && !utf_isValidDchar(v)) //! error("invalid UTF character \\U%08x", v); c = v; } else error("undefined escape hex sequence \\%s\n",c); break; case '&': // named character entity for( ubyte *idstart = ++p; 1; p++ ) { switch( *p ) { case ';': //!!! /+ c = HtmlNamedEntity(idstart, p - idstart); if( c == ~0 ) { error("unnamed character entity &%.*s;", p - idstart, idstart); c = ' '; } p++; +/ break; default: if( isalpha(*p) || (p != idstart + 1 && isdigit(*p))) continue; error("unterminated named entity"); break; } break; } break; case 0: case 0x1a: // end of file c = '\\'; break; default: if( isoctal(c) ) { ubyte v; n = 0; do { v = v * 8 + (c - '0'); c = *++p; } while (++n < 3 && isoctal(c)); c = v; } else error("undefined escape sequence \\%s\n",c); break; } return c; } /************************************** */ TOK wysiwygStringConstant( Token *t, int tc ) { uint c; Loc start = loc; p++; stringbuffer.offset = 0; while (1) { c = *p++; switch( c ) { case '\n': loc.linnum++; break; case '\r': if( *p == '\n') continue; // ignore c = '\n'; // treat EndOfLine as \n character loc.linnum++; break; case 0: case 0x1a: error("unterminated string constant starting at %s", start.toChars()); t.ustring = ""; t.postfix = 0; return TOK.TOKstring; case '"': case '`': if( c == tc) { // t.len = stringbuffer.offset; stringbuffer.write(cast(byte)0); t.ustring = stringbuffer.toString; // t.ustring = (ubyte *)mem.malloc(stringbuffer.offset); // memcpy(t.ustring, stringbuffer.data, stringbuffer.offset); stringPostfix(t); return TOK.TOKstring; } break; default: if( c & 0x80) { p--; uint u = decodeUTF(); p++; if( u == PS || u == LS) loc.linnum++; stringbuffer.write(u); continue; } break; } stringbuffer.write(c); } } /************************************** * Lex hex strings: * x"0A ae 34FE BD" */ TOK hexStringConstant(Token *t) { uint c; Loc start = loc; uint n = 0; uint v; p++; stringbuffer.offset = 0; while (1) { c = *p++; switch (c) { case ' ': case '\t': case '\v': case '\f': continue; // skip white space case '\r': if( *p == '\n') continue; // ignore // Treat isolated '\r' as if it were a '\n' case '\n': loc.linnum++; continue; case 0: case 0x1a: error("unterminated string constant starting at %s", start.toChars()); t.ustring = ""; t.postfix = 0; return TOK.TOKstring; case '"': if( n & 1 ) { error("odd number (%d) of hex characters in hex string", n); stringbuffer.write(v); } // t.len = stringbuffer.offset; // stringbuffer.write(cast(byte)0); t.ustring = stringbuffer.toString; // t.ustring = (ubyte *)mem.malloc(stringbuffer.offset); // memcpy(t.ustring, stringbuffer.data, stringbuffer.offset); stringPostfix(t); return TOK.TOKstring; default: if( c >= '0' && c <= '9') c -= '0'; else if( c >= 'a' && c <= 'f') c -= 'a' - 10; else if( c >= 'A' && c <= 'F') c -= 'A' - 10; else if( c & 0x80) { p--; uint u = decodeUTF(); p++; if( u == PS || u == LS) loc.linnum++; else error("non-hex character \\u%x", u); } else error("non-hex character '%s'", c); if( n & 1) { v = (v << 4) | c; stringbuffer.write(v); } else v = c; n++; break; } } } /************************************** */ TOK escapeStringConstant(Token *t, int wide) { uint c; Loc start = loc; p++; stringbuffer.offset = 0; // debug writefln( "escape string constant: %s", std.string.toString( cast(char*)p ) ); while( 1 ) { c = *p++; switch( c ) { case '\\': switch (*p) { case 'u': case 'U': case '&': c = escapeSequence(); stringbuffer.write(c); continue; default: c = escapeSequence(); break; } break; case '\n': loc.linnum++; break; case '\r': if( *p == '\n') continue; // ignore c = '\n'; // treat EndOfLine as \n character loc.linnum++; break; case '"': // writefln( "end of string: ", stringbuffer.toString ); t.ustring = stringbuffer.toString().dup; // t.len = stringbuffer.offset; // stringbuffer.write(cast(byte)0); // t.ustring = (ubyte *)mem.malloc(stringbuffer.offset); // memcpy(t.ustring, stringbuffer.data, stringbuffer.offset); stringPostfix(t); return TOK.TOKstring; case 0: case 0x1a: p--; error("unterminated string constant starting at %s", start.toChars()); t.ustring = ""; // t.len = 0; t.postfix = 0; return TOK.TOKstring; default: if( c & 0x80 ) { p--; c = decodeUTF(); if( c == LS || c == PS ) { c = '\n'; loc.linnum++; } p++; stringbuffer.write(cast(char)c); continue; } break; } stringbuffer.write(cast(char)c); // writefln( stringbuffer.toString ); } } //************************************** TOK charConstant(Token *t, int wide) { uint c; TOK tk = TOK.TOKcharv; //printf("Lexer.charConstant\n"); p++; c = *p++; switch( c ) { case '\\': switch (*p) { case 'u': t.uns64value = escapeSequence(); tk = TOK.TOKwcharv; break; case 'U': case '&': t.uns64value = escapeSequence(); tk = TOK.TOKdcharv; break; default: t.uns64value = escapeSequence(); break; } break; case '\n': L1: loc.linnum++; case '\r': case 0: case 0x1a: case '\'': error("unterminated character constant"); return tk; default: if( c & 0x80) { p--; c = decodeUTF(); p++; if( c == LS || c == PS ) goto L1; if( c < 0xd800 || (c >= 0xe000 && c < 0xfffe)) tk = TOK.TOKwcharv; else tk = TOK.TOKdcharv; } t.uns64value = c; break; } if( *p != '\'' ) { error("unterminated character constant"); return tk; } p++; return tk; } // Get postfix of string literal. void stringPostfix(Token *t) { switch( *p ) { case 'c': case 'w': case 'd': t.postfix = *p; p++; break; default: t.postfix = 0; break; } } /*************************************** * Read \u or \U unicode sequence * Input: * u 'u' or 'U' */ /* uint Wchar(uint u) { uint value; uint n; ubyte c; uint nchars; nchars = (u == 'U') ? 8 : 4; value = 0; for (n = 0; 1; n++) { ++p; if( n == nchars) break; c = *p; if( !ishex(c)) { error("\\%s sequence must be followed by %d hex characters", u, nchars); break; } if( isdigit(c)) c -= '0'; else if( islower(c)) c -= 'a' - 10; else c -= 'A' - 10; value <<= 4; value |= c; } return value; } */ /************************************** * Read in a number. * If it's an integer, store it in tok.TKutok.Vlong. * integers can be decimal, octal or hex * Handle the suffixes U, UL, LU, L, etc. * If it's double, store it in tok.TKutok.Vdouble. * Returns: * TKnum * TKdouble,... */ TOK number(Token *t) { //debug writefln("Lexer.number()"); // We use a state machine to collect numbers enum STATE { STATE_initial, STATE_0, STATE_decimal, STATE_octal, STATE_octale, STATE_hex, STATE_binary, STATE_hex0, STATE_binary0, STATE_hexh, STATE_error } enum FLAGS { FLAGS_decimal = 1, // decimal FLAGS_unsigned = 2, // u or U suffix FLAGS_long = 4, // l or L suffix } FLAGS flags = FLAGS.FLAGS_decimal; int i; TOK result; int base; stringbuffer.offset = 0; // stringbuffer.data = null; STATE state = STATE.STATE_initial; ubyte* start = p; TOK _isreal() { p = start; return inreal(t); } while( true ) { char c = cast(char)*p; switch( state ) { case STATE.STATE_initial: // opening state if( c == '0' ) state = STATE.STATE_0; else state = STATE.STATE_decimal; break; case STATE.STATE_0: flags = cast(FLAGS) (flags & ~FLAGS.FLAGS_decimal); switch (c) { // #if ZEROH // case 'H': // 0h // case 'h': // goto hexh; // #endif case 'X': case 'x': state = STATE.STATE_hex0; break; case '.': if( p[1] == '.') // .. is a separate token goto done; case 'i': case 'f': case 'F': goto _Real; // #if ZEROH // case 'E': // case 'e': // goto case_hex; // #endif case 'B': case 'b': state = STATE.STATE_binary0; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': state = STATE.STATE_octal; break; // #if ZEROH // case '8': case '9': case 'A': // case 'C': case 'D': case 'F': // case 'a': case 'c': case 'd': case 'f': // case_hex: // state = STATE.STATE_hexh; // break; // #endif case '_': state = STATE.STATE_octal; p++; continue; default: goto done; } break; case STATE.STATE_decimal: // reading decimal number // if its not a digit - decimal complete or not a decimal if( !isdigit( c ) ) { // debug writefln( "\tnon-digit( %s )", c ); // #if ZEROH // if( ishex(c) || c == 'H' || c == 'h' ) // goto hexh; // #endif //! wtf ? // ignore embedded _ if( c == '_' ) { p++; continue; } // check decimal point - make real if( c == '.' && p[1] != '.' ) goto _Real; // check for mantra - make real if( c == 'i' || c == 'f' || c == 'F' || c == 'e' || c == 'E' ) { _Real: // It's a real number. Back up and rescan as a real p = start; return inreal(t); } goto done; } break; case STATE.STATE_hex0: // reading hex number case STATE.STATE_hex: if( !ishex(c) ) { if( c == '_') // ignore embedded _ { p++; continue; } if( c == '.' && p[1] != '.' ) goto _Real; if( c == 'P' || c == 'p' || c == 'i' ) goto _Real; if( state == STATE.STATE_hex0 ) error("Hex digit expected, not '%s'", c); goto done; } state = STATE.STATE_hex; break; // #if ZEROH // hexh: // state = STATE.STATE_hexh; // // case STATE.STATE_hexh: // parse numbers like 0FFh // if( !ishex(c)) // { // if( c == 'H' || c == 'h') // { // p++; // base = 16; // goto done; // } // else // { // // Check for something like 1E3 or 0E24 // if( memchr(stringbuffer.data.ptr, 'E', stringbuffer.offset) || memchr( stringbuffer.data.ptr, 'e', stringbuffer.offset)) // goto _Real; // error("Hex digit expected, not '%s'", c); // goto done; // } // } // break; // #endif case STATE.STATE_octal: // reading octal number case STATE.STATE_octale: // reading octal number with non-octal digits if( !isoctal(c) ) { // #if ZEROH // if( ishex(c) || c == 'H' || c == 'h' ) // goto hexh; // #endif if( c == '_' ) // ignore embedded _ { p++; continue; } if( c == '.' && p[1] != '.' ) goto _Real; if( c == 'i' ) goto _Real; if( isdigit(c) ) state = STATE.STATE_octale; else goto done; } break; case STATE.STATE_binary0: // starting binary number case STATE.STATE_binary: // reading binary number if( c != '0' && c != '1') { // #if ZEROH // if( ishex(c) || c == 'H' || c == 'h' ) // goto hexh; // #endif if( c == '_' ) // ignore embedded _ { p++; continue; } if( state == STATE.STATE_binary0 ) { error("binary digit expected"); state = STATE.STATE_error; break; } else goto done; } state = STATE.STATE_binary; break; case STATE.STATE_error: // for error recovery if( !isdigit(c) ) // scan until non-digit goto done; break; default: assert(0); } stringbuffer.write(cast(char)c); p++; } done: stringbuffer.write( cast(char)0 ); // terminate string // debug writefln( "\tdigit complete( %s )", stringbuffer.toString ); if( state == STATE.STATE_octale ) error("Octal digit expected"); uinteger_t n; // unsigned >=64 bit integer type if( stringbuffer.offset == 2 && ( state == STATE.STATE_decimal || state == STATE.STATE_0 ) ) n = stringbuffer.data[0] - '0'; else { // Convert string to integer char* p = cast(char*)stringbuffer.data.ptr; int r = 10; int d; if( *p == '0' ) { if( p[1] == 'x' || p[1] == 'X') { // "0x#" p += 2; r = 16; } else if( p[1] == 'b' || p[1] == 'B') { // "0b#" - binary p += 2; r = 2; } else if( isdigit(p[1])) { p += 1; r = 8; } } n = 0; while( true ) { if( *p >= '0' && *p <= '9' ) d = *p - '0'; else if( *p >= 'a' && *p <= 'z' ) d = *p - 'a' + 10; else if( *p >= 'A' && *p <= 'Z' ) d = *p - 'A' + 10; else break; if( d >= r ) break; if( n * r + d < n) { error( "integer overflow" ); break; } n = n * r + d; p++; } // if n needs more than 64 bits if( n.sizeof > 8 && n > 0xffffffffffffffffL ) error("integer overflow"); } // Parse trailing 'u', 'U', 'l' or 'L' in any combination while( true ) { ubyte f; switch( *p ) { case 'U': case 'u': f = FLAGS.FLAGS_unsigned; goto L1; case 'L': case 'l': f = FLAGS.FLAGS_long; L1: p++; if( flags & f ) error("unrecognized token"); flags = cast(FLAGS) (flags | f); continue; default: break; } break; } switch ( flags ) { case 0: /* Octal or Hexadecimal constant. * First that fits: int, uint, long, ulong */ if( n & 0x8000000000000000L ) result = TOK.TOKuns64v; else if( n & 0xffffffff00000000L ) result = TOK.TOKint64v; else if( n & 0x80000000 ) result = TOK.TOKuns32v; else result = TOK.TOKint32v; break; case FLAGS.FLAGS_decimal: /* First that fits: int, long, long long */ if( n & 0x8000000000000000L ) { error("signed integer overflow"); result = TOK.TOKuns64v; } else if( n & 0xffffffff80000000L ) result = TOK.TOKint64v; else result = TOK.TOKint32v; break; case FLAGS.FLAGS_unsigned: case FLAGS.FLAGS_decimal | FLAGS.FLAGS_unsigned: /* First that fits: uint, ulong */ if( n & 0xffffffff00000000L ) result = TOK.TOKuns64v; else result = TOK.TOKuns32v; break; case FLAGS.FLAGS_decimal | FLAGS.FLAGS_long: if( n & 0x8000000000000000L ) { error("signed integer overflow"); result = TOK.TOKuns64v; } else result = TOK.TOKint64v; break; case FLAGS.FLAGS_long: if( n & 0x8000000000000000L ) result = TOK.TOKuns64v; else result = TOK.TOKint64v; break; case FLAGS.FLAGS_unsigned | FLAGS.FLAGS_long: case FLAGS.FLAGS_decimal | FLAGS.FLAGS_unsigned | FLAGS.FLAGS_long: result = TOK.TOKuns64v; break; default: debug writefln("%x",flags); assert(0); } t.uns64value = n; return result; } /************************************** * Read in characters, converting them to real. * Bugs: * Exponent overflow not detected. * Too much requested precision is not detected. */ TOK inreal(Token *t) { int dblstate; uint c; char hex; // is this a hexadecimal-floating-constant? TOK result; //printf("Lexer.inreal()\n"); stringbuffer.offset = 0; dblstate = 0; hex = 0; Lnext: while (1) { // Get next char from input c = *p++; //printf("dblstate = %d, c = '%s'\n", dblstate, c); while (1) { switch (dblstate) { case 0: // opening state if( c == '0') dblstate = 9; else if( c == '.') dblstate = 3; else dblstate = 1; break; case 9: dblstate = 1; if( c == 'X' || c == 'x') { hex++; break; } case 1: // digits to left of . case 3: // digits to right of . case 7: // continuing exponent digits if( !isdigit(c) && !(hex && isxdigit(c))) { if( c == '_') goto Lnext; // ignore embedded '_' dblstate++; continue; } break; case 2: // no more digits to left of . if( c == '.') { dblstate++; break; } case 4: // no more digits to right of . if( (c == 'E' || c == 'e') || hex && (c == 'P' || c == 'p')) { dblstate = 5; hex = 0; // exponent is always decimal break; } if( hex) error("binary-exponent-part required"); goto done; case 5: // looking immediately to right of E dblstate++; if( c == '-' || c == '+') break; case 6: // 1st exponent digit expected if( !isdigit(c)) error("exponent expected"); dblstate++; break; case 8: // past end of exponent digits goto done; } break; } stringbuffer.write(c); } done: p--; stringbuffer.write(cast(byte)0); // #if _WIN32 && __DMC__ char *save = __locale_decpoint; __locale_decpoint = "."; // #endif t.float80value = strtold(cast(char *)stringbuffer.data.ptr, null); errno = 0; switch( *p ) { case 'F': case 'f': strtof(cast(char *)stringbuffer.data.ptr, null); result = TOK.TOKfloat32v; p++; break; default: strtod(cast(char *)stringbuffer.data.ptr, null); result = TOK.TOKfloat64v; break; case 'L': case 'l': result = TOK.TOKfloat80v; p++; break; } if( *p == 'i' || *p == 'I') { p++; switch( result ) { case TOK.TOKfloat32v: result = TOK.TOKimaginary32v; break; case TOK.TOKfloat64v: result = TOK.TOKimaginary64v; break; case TOK.TOKfloat80v: result = TOK.TOKimaginary80v; break; } } // #if _WIN32 && __DMC__ __locale_decpoint = save; // #endif if( errno == ERANGE) error("number is not representable"); return result; } /********************************************* * Do pragma. * Currently, the only pragma supported is: * #line linnum [filespec] */ void Pragma() { Token tok; int linnum; char[] filespec; Loc loc = this.loc; scan(&tok); if( tok.value != TOK.TOKidentifier || tok.ident != Id.line ) goto Lerr; scan(&tok); if( tok.value == TOK.TOKint32v || tok.value == TOK.TOKint64v ) linnum = tok.uns64value - 1; else goto Lerr; while (1) { switch (*p) { case 0: case 0x1a: case '\n': Lnewline: this.loc.linnum = linnum; if( filespec.length ) this.loc.filename = filespec; return; case '\r': p++; if( *p != '\n') { p--; goto Lnewline; } continue; case ' ': case '\t': case '\v': case '\f': p++; continue; // skip white space case '_': if( mod && memcmp(p, cast(char*)"__FILE__", 8) == 0) { p += 8; //! filespec = mem.strdup(loc.filename ? loc.filename : mod.ident.toChars()); } continue; case '"': if( filespec ) goto Lerr; stringbuffer.offset = 0; p++; while (1) { uint c; c = *p; switch (c) { case '\n': case '\r': case 0: case 0x1a: goto Lerr; case '"': stringbuffer.write(cast(byte)0); // filespec = mem.strdup((char *)stringbuffer.data); filespec = stringbuffer.toString.dup; p++; break; default: if( c & 0x80 ) { uint u = decodeUTF(); if( u == PS || u == LS ) goto Lerr; } stringbuffer.write(c); p++; continue; } break; } continue; default: if( *p & 0x80 ) { uint u = decodeUTF(); if( u == PS || u == LS) goto Lnewline; } goto Lerr; } } Lerr: errorLoc(loc, "#line integer [\"filespec\"]\\n expected"); } /*************************************************** * Parse doc comment embedded between t.ptr and p. * Remove trailing blanks and tabs from lines. * Replace all newlines with \n. * Remove leading comment character from each line. * Decide if it's a lineComment or a blockComment. * Append to previous one for this token. */ void getDocComment( Token *t, uint lineComment ) { auto OutBuffer buf = new OutBuffer; ubyte ct = t.ptr[2]; ubyte *q = t.ptr + 3; // start of comment text int linestart = 0; ubyte *qend = p; if( ct == '*' || ct == '+') qend -= 2; // Scan over initial row of ****'s or ++++'s or ////'s for (; q < qend; q++) { if( *q != ct) break; } // Remove trailing row of ****'s or ++++'s if( ct != '/') { for (; q < qend; qend--) { if( qend[-1] != ct) break; } } for (; q < qend; q++) { ubyte c = *q; switch (c) { case '*': case '+': if( linestart && c == ct) { linestart = 0; // Trim preceding whitespace up to preceding \n while (buf.offset && (buf.data[buf.offset - 1] == ' ' || buf.data[buf.offset - 1] == '\t')) buf.offset--; continue; } break; case ' ': case '\t': break; case '\r': if( q[1] == '\n') continue; // skip the \r goto Lnewline; default: if( c == 226) { // If LS or PS if( q[1] == 128 && (q[2] == 168 || q[2] == 169)) { q += 2; goto Lnewline; } } linestart = 0; break; Lnewline: c = '\n'; // replace all newlines with \n case '\n': linestart = 1; // Trim trailing whitespace while (buf.offset && (buf.data[buf.offset - 1] == ' ' || buf.data[buf.offset - 1] == '\t')) buf.offset--; break; } buf.write(c); } // Always end with a newline if( !buf.offset || buf.data[buf.offset - 1] != '\n' ) buf.writenl(); //buf.write(cast(char)0); // It's a line comment if the start of the doc comment comes // after other non-whitespace on the same line. // ubyte** dc = (lineComment && anyToken) // ? &t.lineComment // : &t.blockComment; char[] dc = (lineComment && anyToken) ? t.lineComment : t.blockComment; // Combine with previous doc comment, if any if( dc.length ) dc = combineComments( dc, buf.toString().dup ); else dc = buf.toString().dup; // writefln( dc ); if( lineComment && anyToken ) t.lineComment = dc; else t.blockComment = dc; } } // character maps static ubyte[256] cmtable; const int CMoctal = 0x1; const int CMhex = 0x2; const int CMidchar = 0x4; ubyte isoctal (ubyte c) { return cmtable[c] & CMoctal; } ubyte ishex (ubyte c) { return cmtable[c] & CMhex; } ubyte isidchar(ubyte c) { return cmtable[c] & CMidchar; } static void cmtable_init() { for( uint c = 0; c < cmtable.length; c++ ) { if( '0' <= c && c <= '7' ) cmtable[c] |= CMoctal; if( isdigit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F') ) cmtable[c] |= CMhex; if( isalnum(c) || c == '_' ) cmtable[c] |= CMidchar; } } /+ struct StringValue { union { int intvalue; void *ptrvalue; dchar *string; } char[] lstring; } #define CASE_BASIC_TYPES case TOKwchar: case TOKdchar: case TOKbit: case TOKbool: case TOKchar: case TOKint8: case TOKuns8: case TOKint16: case TOKuns16: case TOKint32: case TOKuns32: case TOKint64: case TOKuns64: case TOKfloat32: case TOKfloat64: case TOKfloat80: case TOKimaginary32: case TOKimaginary64: case TOKimaginary80: case TOKcomplex32: case TOKcomplex64: case TOKcomplex80: case TOKvoid: #define CASE_BASIC_TYPES_X(t) \ case TOKvoid: t = Type::tvoid; goto LabelX; \ case TOKint8: t = Type::tint8; goto LabelX; \ case TOKuns8: t = Type::tuns8; goto LabelX; \ case TOKint16: t = Type::tint16; goto LabelX; \ case TOKuns16: t = Type::tuns16; goto LabelX; \ case TOKint32: t = Type::tint32; goto LabelX; \ case TOKuns32: t = Type::tuns32; goto LabelX; \ case TOKint64: t = Type::tint64; goto LabelX; \ case TOKuns64: t = Type::tuns64; goto LabelX; \ case TOKfloat32: t = Type::tfloat32; goto LabelX; \ case TOKfloat64: t = Type::tfloat64; goto LabelX; \ case TOKfloat80: t = Type::tfloat80; goto LabelX; \ case TOKimaginary32: t = Type::timaginary32; goto LabelX; \ case TOKimaginary64: t = Type::timaginary64; goto LabelX; \ case TOKimaginary80: t = Type::timaginary80; goto LabelX; \ case TOKcomplex32: t = Type::tcomplex32; goto LabelX; \ case TOKcomplex64: t = Type::tcomplex64; goto LabelX; \ case TOKcomplex80: t = Type::tcomplex80; goto LabelX; \ case TOKbit: t = Type::tbit; goto LabelX; \ case TOKchar: t = Type::tchar; goto LabelX; \ case TOKwchar: t = Type::twchar; goto LabelX; \ case TOKdchar: t = Type::tdchar; goto LabelX; \ LabelX +/ uncrustify-0.59/tests/input/d/tst01.d.uncrustify0000644000175000017500000000101711506773275016675 00000000000000package void writeRegister(int aRegisterOffset, ushort aValue) in { assert(aRegisterOffset >= 0); assert(aRegisterOffset < IMAGE_SIZE); } body { int idx = aRegisterOffset / 2; mMemCache[idx] = aValue; uint readback; uint st; uint st2; volatile { mMemImage[idx] = aValue; //readback = (cast(uint*)mMemImage.ptr)[ idx/2 ]; //st = mMemImage[ 0x28/2 ]; //st2 = mMemImage[ 0x2A/2 ]; } //if( aValue != readback ) { //debug(IRQ) writefln( "writeRegister %04x, %04x", aRegisterOffset, aValue); } // comment } // uncrustify-0.59/tests/input/d/tst03.d0000644000175000017500000000537211506773275014475 00000000000000import std.stdio; void foo() { float f = x % y; double d = x % y; real r = x % y; result = (x < y); // false if x or y is nan assert(e == 0); int array[17]; array[] = value; int array[17]; for (i = 0; i < array.length; i++) func(array[i]); int array[17]; foreach (int value; array) func(value); int[] array; array.length = array.length + 1; array[array.length - 1] = x; char[] s1; char[] s2; char[] s; s = s1 ~ s2; s ~= "hello"; writefln("Calling all cars %s times!", ntimes); Louter: for (i = 0; i < 10; i++) { for (j = 0; j < 10; j++) { if (j == 3) break Louter; if (j == 4) continue Louter; } } // break Louter goes here typedef bit bHandle; typedef int iHandle = -1; typedef void* Handle = cast(void*)(-1); Handle h; h = func(); if (h != Handle.init) ; char[] string = "hello"; if (string < "betty") ; int* p = address; volatile { i = *p; } char [] ml = "This text spans multiple lines "; } void dostring(char[] s) { switch (s) { case "hello": ; case "goodbye": ; case "maybe": ; default: ; } } struct ABC { int z; // z is aligned to the default align (1) int x; // x is byte aligned align (4) { ... // declarations in {} are dword aligned } align (2): // switch to word alignment from here on int y; // y is word aligned } struct Foo { int i; union { struct { int x; long y; } char* p; } } struct Foo { int x; int y; } // note there is no terminating ; Foo foo; struct Foo { int x; int y; } off = Foo.y.offsetof; union U { int a; long b; } U x = { a:5 }; struct S { int a; int b; } S x = { b:3, a:5 }; int[3] a = [ 3, 2, 0 ]; int[3] a = [ 3, 2 ]; // unsupplied initializers are 0, just like in C int[3] a = [ 2:0, 0:3, 1:2 ]; int[3] a = [ 2:0, 0:3, 2 ]; // if not supplied, the index is the // previous one plus one. enum color { black, red, green } int[3] c = [ black:3, green:2, red:5 ]; char[] file = `c:\root\file.c`; char[] quoteString = \" r"[^\\]*(\\.[^\\]*)*" \"; char[] hello = "hello world" \n; char[] foo_ascii = "hello"; // string is taken to be ascii wchar[] foo_wchar = "hello"; // string is taken to be wchar enum COLORS { red, blue, green }; char[][COLORS.max + 1] cstring = [ COLORS.red : "red", COLORS.blue : "blue", COLORS.green : "green", ]; const ushort table1[16] = [ 0x00A7, 0x0322, 0x07AD, 0x0428, 0x0536, 0x06B3, 0x023C, 0x01B9]; const ushort table2[16] = [ 0x0000, 0x0385, 0x070A, 0x048F, 0x0536, 0x06B3, 0x023C, 0x01B9]; uncrustify-0.59/tests/input/d/imports.d0000644000175000017500000000022511506773275015205 00000000000000 private import mango.cache.Payload; private import mango.io.Exception, mango.io.PickleRegistry; public import mango.cluster.model.ICluster; uncrustify-0.59/tests/input/d/const.d0000644000175000017500000000011011506773275014627 00000000000000// hello A b() { return null; } const(C) d() { return null; } uncrustify-0.59/tests/input/d/volatile-3.d0000644000175000017500000000012511506773275015466 00000000000000{ if (e) { if (!value) volatile e.value = value; } } uncrustify-0.59/tests/input/d/volatile-1.d0000644000175000017500000000015111506773275015463 00000000000000{ while (a) { volatile if (b) { b--; break; } } } uncrustify-0.59/tests/input/d/bug-indent.d0000644000175000017500000000041111506773275015541 00000000000000class C { //--------------| <= (1) Axxxxxxxxxxxxxxxx.A createAssignment() { return(null); } void func2(){ foreach (v; container) { v.f(); } } // | <= (2) void func3(TemplType !(T) aValue){ } } uncrustify-0.59/tests/input/d/enum.d0000644000175000017500000000013711552460173014445 00000000000000/* sized enum like in C# */ enum Metrics : int { SM_CXSCREEN = 0, SM_CYSCREEN, SM_CXVSCROLL, } uncrustify-0.59/tests/input/d/numbers.d0000644000175000017500000000145111506773275015165 00000000000000 /* This file goes over all the various number formats for D */ int foo(int bar) { int a; /* * Interger Literals */ /* Suffixes */ a = 0L + 123U + 345u + 456Lu + 567LU + 678UL + 789_uL; /* Decimal */ a = 0 + 123456 + 123_456 + 1_2_3_4_5_6; /* Binary */ a = 0b1010101 + 0B1001; /* Octal */ a = 01234567_ + 07_6_5_2; /* Hexadecimal */ a = 0x1234567890abcdefABCDEF_ + 0X7_6_5_2; float b; real c; ifloat d; ireal e; /* Floats: float [FloatSuffix] [ImaginarySuffix] */ /* HexFloat */ b = 0xabc.defp-1024 + 0x.defP-64 + 0x123p+32 + 0x123P+16 + 0x123p1024; d = 0x123p45 + 0x234.fi + 0. + .3f; e = 3 + 5i; e = 3.4 + 5.6i; } /* test '..' ranges */ void main() { char[] c = "kkkkkkkkkkkkkkkkkkkkk"; writefln("%s", c[2..3]); } uncrustify-0.59/tests/input/ecma/0000755000175000017500000000000011506773275014106 500000000000000uncrustify-0.59/tests/input/ecma/example-1.es0000644000175000017500000000043311506773275016150 00000000000000x = 0; // A global variable var y = 'Hello!'; // Another global variable function f(){ var z = 'foxes'; // A local variable twenty = 20; // Global because keyword var is not used return x; // We can use x here because it is global } // The value of z is no longer available uncrustify-0.59/tests/output/0000755000175000017500000000000011574757101013375 500000000000000uncrustify-0.59/tests/output/cs/0000755000175000017500000000000011630510162013765 500000000000000uncrustify-0.59/tests/output/cs/10021-region.cs0000644000175000017500000000035611506773275016206 00000000000000class X : Y { int foo1; #region something int foo2 = 2; #endregion int foo() { #region something else int foo3 = 3; #region nested int foo4 = 0; #endregion int foo5 = 0; #endregion } } uncrustify-0.59/tests/output/cs/10001-getset.cs0000644000175000017500000000026311506773275016211 00000000000000public bool Enabled { get { return enabled; } } public bool Enabled { get { return enabled; } } uncrustify-0.59/tests/output/cs/10010-var-member.cs0000644000175000017500000000141511617406211016735 00000000000000namespace Foo.Man.Chu { /// /// Summary description for MainForm. /// public class MainForm : System.Windows.Forms.Form { #region Initialize the private properties private System.Windows.Forms.MenuItem File; private System.Windows.Forms.MenuItem Exit; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private Properties Prop; private About Abt; public MainForm mainform; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.Timer timer1; private System.ComponentModel.IContainer components; protected string strTitle; #endregion } } uncrustify-0.59/tests/output/cs/10073-utf16be_no_bom.cs0000644000175000017500000000036011630510162017510 00000000000000public bool Enabled { get { return(enabled); } } public bool Enabled { get { return(enabled); } } uncrustify-0.59/tests/output/cs/10040-tcf.cs0000644000175000017500000000030511506773275015472 00000000000000void foo() { try { ; } catch (Exception e) { ; } finally { ; } bar(); try { ; } catch (Exception e) { ; } catch (Exception e) { ; } finally { ; } bar(); } uncrustify-0.59/tests/output/cs/10072-utf16le_no_bom.cs0000644000175000017500000000036011630510162017521 00000000000000public bool Enabled { get { return(enabled); } } public bool Enabled { get { return(enabled); } } uncrustify-0.59/tests/output/cs/10060-unsafe.cs0000644000175000017500000000012711506773275016203 00000000000000public class Class1 { public unsafe bool GetValue() { return(true); } } uncrustify-0.59/tests/output/cs/10022-region.cs0000644000175000017500000000034411506773275016204 00000000000000class X : Y { int foo1; #region something int foo2 = 2; #endregion int foo() { #region something else int foo3 = 3; #region nested int foo4 = 0; #endregion int foo5 = 0; #endregion } } uncrustify-0.59/tests/output/cs/10002-simple.cs0000644000175000017500000000344211506773275016212 00000000000000class X : Y { bool Method(int argument_1, int argument_2) { #region something int foo = 0; #endregion if (argument_1 == argument_2) { throw new Exception(Locale.GetText("They are equal!")); } if (argument_1 < argument_2) { if (argument_1 * 3 > 4) { return(true); } else { return(false); } } // // This sample helps keep your sanity while using 8-spaces for tabs // VeryLongIdentifierWhichTakesManyArguments( Argument1, Argument2, Argument3, NestedCallHere( MoreNested)); } bool MyProperty { get { return(x); } set { x = value; } } void AnotherMethod() { Logger log = new Logger(); log.foo.bar = 5; log.narf.sweat = "cat"; if ((a + 5) != 4) { } while (blah) { if (a) { continue; } b++; } } } object lockA; object lockB; void Foo() { lock (lockA) { lock (lockB) { } } } void Bar() { lock (lockB) { lock (lockA) { } } } // class library class Blah { Hashtable ht; void Foo(int zzz, Entry blah) { lock (ht) { ht.Add(zzz, blah); } } void Bar() { lock (ht) { foreach (Entry e in ht) { EachBar(e); } } } virtual void EachBar(Entry e) { } } // User class MyBlah { byte[] box = new byte[6]; box[2] = 56; void DoStuff() { lock (this) { int i = GetNumber(); Entry e = GetEntry(); Foo(i, e); } } override void EachBar(Entry e) { lock (this) { DoSomething(e); } } } uncrustify-0.59/tests/output/cs/10070-utf16le.cs0000644000175000017500000000036011630510017016165 00000000000000public bool Enabled { get { return(enabled); } } public bool Enabled { get { return(enabled); } } uncrustify-0.59/tests/output/cs/10071-utf16be.cs0000644000175000017500000000036011630457175016173 00000000000000public bool Enabled { get { return(enabled); } } public bool Enabled { get { return(enabled); } } uncrustify-0.59/tests/output/cs/10050-generics.cs0000644000175000017500000000016311506773275016520 00000000000000 int foo() { a.b(); a.b>(); a.b(); a.b>(); a.b>(); return default(T); } uncrustify-0.59/tests/output/cs/10041-gs.cs0000644000175000017500000000034311506773275015332 00000000000000private string s = ""; public int Amount { get { ; } set { ; } } public EventHandler MyCustomEventHandler { add { ; } remove { ; } } public this[string index] { get; set; } private string s2 = ""; uncrustify-0.59/tests/output/cs/10003-region.cs0000644000175000017500000000037211506773275016204 00000000000000class X : Y { int foo1; #region something int foo2 = 2; #endregion int foo() { #region something else int foo3 = 3; #region nested int foo4 = 0; #endregion int foo5 = 0; #endregion } } uncrustify-0.59/tests/output/cs/10030-sort_using.cs0000644000175000017500000000042411506773275017113 00000000000000// should be ddd, eee, fff using b.ddd; using b.eee; using b.fff; // should be aaa, ccc using aaa; using ccc; // should be just bbb using bbb; // should not change these, as it can't handle multi-line imports using mango.ccc; using mango.bbb, mango.aaa; void foo(); uncrustify-0.59/tests/output/cs/10023-region.cs0000644000175000017500000000033211506773275016202 00000000000000class X : Y { int foo1; #region something int foo2 = 2; #endregion int foo() { #region something else int foo3 = 3; #region nested int foo4 = 0; #endregion int foo5 = 0; #endregion } } uncrustify-0.59/tests/output/cs/10020-region.cs0000644000175000017500000000034011506773275016176 00000000000000class X : Y { int foo1; #region something int foo2 = 2; #endregion int foo() { #region something else int foo3 = 3; #region nested int foo4 = 0; #endregion int foo5 = 0; #endregion } } uncrustify-0.59/tests/output/cs/10000-simple.cs0000644000175000017500000000463211506773275016212 00000000000000class X : Y { bool Method (int argument_1, int argument_2) { #region something int foo = 0; #endregion if (argument_1 == argument_2) throw new Exception (Locale.GetText ("They are equal!")); if (argument_1 < argument_2) { if (argument_1 * 3 > 4) return true; else return false; } // // This sample helps keep your sanity while using 8-spaces for tabs // VeryLongIdentifierWhichTakesManyArguments ( Argument1, Argument2, Argument3, NestedCallHere ( MoreNested)); } bool MyProperty { get { return x; } set { x = value; } } void AnotherMethod () { Logger log = new Logger (); log.foo.bar = 5; log.narf.sweat = "cat"; if ((a + 5) != 4) { } while (blah) { if (a) continue; b++; } } } object lockA; object lockB; void Foo () { lock (lockA) { lock (lockB) { } } } void Bar () { lock (lockB) { lock (lockA) { } } } // class library class Blah { Hashtable ht; void Foo (int zzz, Entry blah) { lock (ht) { ht.Add (zzz, blah); } } void Bar () { lock (ht) { foreach (Entry e in ht) EachBar (e); } } virtual void EachBar (Entry e) { } } // User class MyBlah { byte[] box = new byte [6]; box [2] = 56; void DoStuff () { lock (this) { int i = GetNumber (); Entry e = GetEntry (); Foo (i, e); } } override void EachBar (Entry e) { lock (this) { DoSomething (e); } } } uncrustify-0.59/tests/output/cs/10011-strings.cs0000644000175000017500000000021411506773275016404 00000000000000void foo() { string s1 = L"C:\\foo\\bar"; string s2 = S"C:\\foo\\bar"; string s3 = "This is a \"test\""; string s4 = "C:\\"; } uncrustify-0.59/tests/output/oc/0000755000175000017500000000000011631562113013765 500000000000000uncrustify-0.59/tests/output/oc/50071-blocks.m0000644000175000017500000000040411506773275016026 00000000000000int* ( ^ blkReturningPointer)(int) = ^ int* (int a) { return a + 1; }; void ( ^ blk2)(int *) = ^(int *b) { *b = 1; }; int ( ^oneFrom)(int) = ^ (int anInt) { return anInt - 1; }; // this should not be flagged as OC_BLOCK_CARET int x = 12 ^ 23;uncrustify-0.59/tests/output/oc/50081-more_blocks.m0000644000175000017500000000255011506773275017055 00000000000000int (^ myBlock)(int) = ^ (int num) { return num * multiplier; }; int d = i % 10; repeat(10, ^ { putc ('0'+d); }); void (^ block)(void); typedef void (^ vstr_t)(char *); typedef void (^ workBlk_t)(void); void AllLinesInFile(char *f, vstr_t block) { FILE *fp = fopen(f, "r"); if (!fp) return; char line[1024]; while (fgets(line, 1024, fp)) block(line); fclose(fp); } @implementation NSArray (WWDC) - (NSArray *)map:(id (^ )(id))xform { id result = [NSMutableArray array]; for (id elem in self) [result addObject:xform(elem)]; return result; } - (NSArray *)collect:(BOOL ( ^ )(id))predicate { id result = [NSMutableArray array]; for (id elem in self) if (predicate(elem)) [result addObject:elem]; return result; } // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL (id item) { return [item length] > 20; }]; // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL* (id item) { return [item length] > 20; }]; @end // 1. block literal: ^{ ... }; // 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional // 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optionaluncrustify-0.59/tests/output/oc/50010-oc-split.m0000644000175000017500000000055611516452454016276 00000000000000[self findstart:&startBarcode end:&endBarcode forLine:greenScalePixels derivative:greenDerivative centerAt:xAxisCenterPoint min:&minValue max:&maxValue]; [self findstart:&startBarcode end:&endBarcode forLine:greenScalePixels derivative:greenDerivative centerAt:xAxisCenterPoint min:&minValue max:&maxValue]; uncrustify-0.59/tests/output/oc/50077-more_blocks.m0000644000175000017500000000254611506773275017067 00000000000000int ( ^myBlock)(int) = ^(int num) { return num * multiplier; }; int d = i % 10; repeat(10, ^{ putc ('0'+d); }); void ( ^block)(void); typedef void ( ^vstr_t)(char *); typedef void ( ^workBlk_t)(void); void AllLinesInFile(char *f, vstr_t block) { FILE *fp = fopen(f, "r"); if (!fp) return; char line[1024]; while (fgets(line, 1024, fp)) block(line); fclose(fp); } @implementation NSArray (WWDC) - (NSArray *)map:(id ( ^)(id))xform { id result = [NSMutableArray array]; for (id elem in self) [result addObject:xform(elem)]; return result; } - (NSArray *)collect:(BOOL ( ^ )(id))predicate { id result = [NSMutableArray array]; for (id elem in self) if (predicate(elem)) [result addObject:elem]; return result; } // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL (id item) { return [item length] > 20; }]; // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL* (id item) { return [item length] > 20; }]; @end // 1. block literal: ^{ ... }; // 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional // 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optionaluncrustify-0.59/tests/output/oc/50010-return_type.m0000644000175000017500000000110211516452454017110 00000000000000#import #import @interface Fraction : NSObject { int numerator; int denominator; } -(void) print; -(void) setNumerator:(int)d; -(void) setDenominator:(int)d; -(int) numerator; -(int) denominator; -(void) setNumDen:(int)n:(int)d; @end @implementation Fraction -(void) print { printf("%i/%i", numerator, denominator); } -(void) setNumerator:(int)n { numerator = n; } -(void) setDenominator:(int)d { denominator = d; } -(int) denominator { return(denominator); } -(int) numerator { return(numerator); } @end uncrustify-0.59/tests/output/oc/50002-Fraction.m0000644000175000017500000000051611506773275016314 00000000000000#import "Fraction.h" #import @implementation Fraction -(void) print { printf("%i/%i", numerator, denominator); } -(void) setNumerator: (int) n { numerator = n; } -(void) setDenominator: (int) d { denominator = d; } -(int) denominator { return(denominator); } -(int) numerator { return(numerator); } @end uncrustify-0.59/tests/output/oc/50073-blocks.m0000644000175000017500000000040511506773275016031 00000000000000int* ( ^ blkReturningPointer)(int) = ^ int* (int a) { return a + 1; }; void (^ blk2)(int *) = ^ (int *b) { *b = 1; }; int (^ oneFrom)(int) = ^ (int anInt) { return anInt - 1; }; // this should not be flagged as OC_BLOCK_CARET int x = 12 ^ 23;uncrustify-0.59/tests/output/oc/50076-blocks.m0000644000175000017500000000037011506773275016035 00000000000000int* (^blkReturningPointer)(int) =^int* (int a) { return a + 1; }; void (^blk2)(int *) =^(int *b) { *b = 1; }; int (^oneFrom)(int) =^(int anInt) { return anInt - 1; }; // this should not be flagged as OC_BLOCK_CARET int x = 12 ^ 23;uncrustify-0.59/tests/output/oc/50003-main.m0000644000175000017500000000056111506773275015474 00000000000000#import #import "Fraction.h" int main(int argc, const char *argv[]) { // create a new instance Fraction *frac = [[Fraction alloc] init]; // set the values [frac setNumerator: 1]; [frac setDenominator: 3]; // print it printf("The fraction is: "); [frac print]; printf("\n"); // free memory [frac release]; return(0); } uncrustify-0.59/tests/output/oc/50090-kw.m0000644000175000017500000000064711516452532015173 00000000000000#include #include @protocol Job -do; @end @interface MyJob : Object -do; @end @implementation MyJob -do { printf("Doing Job\n"); return(self); } @end @interface JobExecutor : Object -doWith: (id ) job for: (int)count; @end @implementation JobExecutor -doWith: (id )job for: (int)count { for (int i = 0; i < count; ++i) { [job do]; } return(self); } @end uncrustify-0.59/tests/output/oc/50022-selector.m0000644000175000017500000000033611506773275016371 00000000000000@selector(methodNameWithArg:); @selector(methodNameNoArg); @selector(methodNameArg1:arg2: ); NSArray *sortedTZs = [[NSTimeZone knownTimeZoneNames] sortedArrayUsingSelector : @selector( compare: )]; uncrustify-0.59/tests/output/oc/50075-blocks.m0000644000175000017500000000037511506773275016041 00000000000000int* ( ^blkReturningPointer)(int) = ^int* (int a) { return a + 1; }; void (^blk2)(int *) = ^(int *b) { *b = 1; }; int (^oneFrom)(int) = ^(int anInt) { return anInt - 1; }; // this should not be flagged as OC_BLOCK_CARET int x = 12 ^ 23;uncrustify-0.59/tests/output/oc/50030-sort_import.m0000644000175000017500000000023511506773275017127 00000000000000// should be ddd, eee, fff #import "ddd" #import "eee" #import "fff" // should be aaa, ccc #import "aaa" #import "ccc" // should be just bbb #import "bbb" uncrustify-0.59/tests/output/oc/50050-real_world_file.m0000644000175000017500000002225711506773275017711 00000000000000/* * File: ATColorTableController.m * Abstract: A controller used by the ATImageTextCell to edit the color property. It is implemented in an abstract enough way to be used by a class other than the cell. * * Version: 1.0 * * Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple * Inc. ("Apple") in consideration of your agreement to the following * terms, and your use, installation, modification or redistribution of * this Apple software constitutes acceptance of these terms. If you do * not agree with these terms, please do not use, install, modify or * redistribute this Apple software. * * In consideration of your agreement to abide by the following terms, and * subject to these terms, Apple grants you a personal, non-exclusive * license, under Apple's copyrights in this original Apple software (the * "Apple Software"), to use, reproduce, modify and redistribute the Apple * Software, with or without modifications, in source and/or binary forms; * provided that if you redistribute the Apple Software in its entirety and * without modifications, you must retain this notice and the following * text and disclaimers in all such redistributions of the Apple Software. * Neither the name, trademarks, service marks or logos of Apple Inc. may * be used to endorse or promote products derived from the Apple Software * without specific prior written permission from Apple. Except as * expressly stated in this notice, no other rights or licenses, express or * implied, are granted by Apple herein, including but not limited to any * patent rights that may be infringed by your derivative works or by other * works in which the Apple Software may be incorporated. * * The Apple Software is provided by Apple on an "AS IS" basis. APPLE * MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION * THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND * OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS. * * IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, * MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED * AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), * STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * Copyright (C) 2009 Apple Inc. All Rights Reserved. * */ #import "ATColorTableController.h" #import "ATPopupWindow.h" @implementation ATColorTableController + (ATColorTableController *) sharedColorTableController { static ATColorTableController * gSharedColorTableController = nil; if (gSharedColorTableController == nil) { gSharedColorTableController = [[[self class] alloc] initWithNibName:@"ColorTable" bundle:[NSBundle bundleForClass:[self class]]]; } return gSharedColorTableController; } @synthesize delegate = _delegate; @dynamic selectedColor, selectedColorName; - (void) dealloc { [_colorList release]; [_colorNames release]; [_window release]; [super dealloc]; } - (void) loadView { [super loadView]; _colorList = [[NSColorList colorListNamed:@"Crayons"] retain]; _colorNames = [[_colorList allKeys] retain]; [_tableColorList setIntercellSpacing:NSMakeSize(3, 3)]; [_tableColorList setTarget:self]; [_tableColorList setAction:@selector(_tableViewAction:)]; } - (NSColor *) selectedColor { NSString * name = [self selectedColorName]; if (name != nil) { return [_colorList colorWithKey:name]; } else { return nil; } } - (NSString *) selectedColorName { if ([_tableColorList selectedRow] != -1) { return [_colorNames objectAtIndex:[_tableColorList selectedRow]]; } else { return nil; } } - (void) _selectColor:(NSColor *)color { // Search for that color in our list NSInteger row = 0; for (NSString * name in _colorNames) { NSColor * colorInList = [_colorList colorWithKey:name]; if ([color isEqual:colorInList]) { break; } row++; } _updatingSelection = YES; if (row != -1) { [_tableColorList scrollRowToVisible:row]; [_tableColorList selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; } else { [_tableColorList scrollRowToVisible:0]; [_tableColorList selectRowIndexes:[NSIndexSet indexSet] byExtendingSelection:NO]; } _updatingSelection = NO; } - (void) _createWindowIfNeeded { if (_window == nil) { NSRect viewFrame = self.view.frame; // Create and setup our window _window = [[ATPopupWindow alloc] initWithContentRect:viewFrame styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; [_window setReleasedWhenClosed:NO]; [_window setLevel:NSPopUpMenuWindowLevel]; [_window setHasShadow:YES]; [[_window contentView] addSubview:self.view]; [_window makeFirstResponder:_tableColorList]; // Make the window have a clear color and be non-opaque for our pop-up animation [_window setBackgroundColor:[NSColor clearColor]]; [_window setOpaque:NO]; } } - (void) _windowClosed:(NSNotification *)note { if (_eventMonitor) { [NSEvent removeMonitor:_eventMonitor]; _eventMonitor = nil; } [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:_window]; [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidResignActiveNotification object:nil]; } - (void) _closeAndSendAction:(BOOL)sendAction { [_window close]; if (sendAction) { if ([self.delegate respondsToSelector:@selector(colorTableController:didChooseColor:named:)]) { [self.delegate colorTableController:self didChooseColor:self.selectedColor named:self.selectedColorName]; } } else { if ([self.delegate respondsToSelector:@selector(didCancelColorTableController:)]) { [self.delegate didCancelColorTableController:self]; } } } - (void) _windowShouldClose:(NSNotification *)note { [self _closeAndSendAction:NO]; } - (void) editColor:(NSColor *)color locatedAtScreenRect:(NSRect)rect { [self _createWindowIfNeeded]; [self _selectColor:color]; NSPoint origin = rect.origin; NSRect windowFrame = [_window frame]; // The origin is the lower left; subtract the window's height origin.y -= NSHeight(windowFrame); // Center the popup window under the rect origin.y += floor(NSHeight(rect) / 3.0); origin.x -= floor(NSWidth(windowFrame) / 2.0); origin.x += floor(NSWidth(rect) / 2.0); [_window setFrameOrigin:origin]; [_window popup]; // Add some watches on the window and application [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowClosed:) name:NSWindowWillCloseNotification object:_window]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowShouldClose:) name:NSApplicationDidResignActiveNotification object:nil]; // Start watching events to figure out when to close the window NSAssert(_eventMonitor == nil, @"_eventMonitor should not be created yet"); _eventMonitor = [NSEvent addLocalMonitorForEventsMatchingMask:NSLeftMouseDownMask | NSRightMouseDownMask | NSOtherMouseDownMask | NSKeyDownMask handler: ^(NSEvent * incomingEvent) { NSEvent * result = incomingEvent; NSWindow * targetWindowForEvent = [incomingEvent window]; if (targetWindowForEvent != _window) { [self _closeAndSendAction:NO]; } else if ([incomingEvent type] == NSKeyDown) { if ([incomingEvent keyCode] == 53) { // Escape [self _closeAndSendAction:NO]; result = nil; // Don't process the event } else if ([incomingEvent keyCode] == 36) { // Enter [self _closeAndSendAction:YES]; result = nil; } } return result; }]; } - (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView { return _colorNames.count; } - (id) tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { return [_colorNames objectAtIndex:row]; } - (void) tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { NSColor * color = [_colorList colorWithKey:[_colorNames objectAtIndex:row]]; [cell setColor:color]; } - (void) _tableViewAction:(id)sender { [self _closeAndSendAction:YES]; } @end uncrustify-0.59/tests/output/oc/50001-Fraction.h0000644000175000017500000000041411506773275016303 00000000000000#import @interface Fraction : NSObject { int numerator; int denominator; } -(void) print; -(void) setNumerator: (int) d; -(void) setDenominator: (int) d; -(int) numerator; -(int) denominator; -(void) setNumDen: (int) n: (int) d; @end uncrustify-0.59/tests/output/oc/50079-more_blocks.m0000644000175000017500000000253511506773275017067 00000000000000int (^myBlock)(int) =^(int num) { return num * multiplier; }; int d = i % 10; repeat(10, ^{ putc ('0'+d); }); void (^block)(void); typedef void (^vstr_t)(char *); typedef void (^workBlk_t)(void); void AllLinesInFile(char *f, vstr_t block) { FILE *fp = fopen(f, "r"); if (!fp) return; char line[1024]; while (fgets(line, 1024, fp)) block(line); fclose(fp); } @implementation NSArray (WWDC) - (NSArray *)map:(id (^)(id))xform { id result = [NSMutableArray array]; for (id elem in self) [result addObject:xform(elem)]; return result; } - (NSArray *)collect:(BOOL (^ )(id))predicate { id result = [NSMutableArray array]; for (id elem in self) if (predicate(elem)) [result addObject:elem]; return result; } // corner case: block literal in use with return type id longLines = [allLines collect:^ BOOL (id item) { return [item length] > 20; }]; // corner case: block literal in use with return type id longLines = [allLines collect:^ BOOL* (id item) { return [item length] > 20; }]; @end // 1. block literal: ^{ ... }; // 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional // 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optionaluncrustify-0.59/tests/output/oc/50072-blocks.m0000644000175000017500000000037611506773275016037 00000000000000int* (^ blkReturningPointer)(int) =^ int* (int a) { return a + 1; }; void (^ blk2)(int *) =^(int *b) { *b = 1; }; int (^oneFrom)(int) =^ (int anInt) { return anInt - 1; }; // this should not be flagged as OC_BLOCK_CARET int x = 12 ^ 23;uncrustify-0.59/tests/output/oc/50006-exceptions.m0000644000175000017500000000045611506773275016737 00000000000000 int main(int argc, const char *argv[]) { @try { [NSException raise: NSInternalInconsistency format: @"An internal inconsistency was raised"]; } @catch (NSException *e) { NSLog(@"Catch"); } @finally { NSLog(@"Finally"); } return(0); } uncrustify-0.59/tests/output/oc/50021-selector.m0000644000175000017500000000034211506773275016365 00000000000000@selector (methodNameWithArg:); @selector (methodNameNoArg); @selector (methodNameArg1:arg2: ); NSArray *sortedTZs = [[NSTimeZone knownTimeZoneNames] sortedArrayUsingSelector : @selector ( compare: )]; uncrustify-0.59/tests/output/oc/50080-more_blocks.m0000644000175000017500000000255011506773275017054 00000000000000int (^ myBlock)(int) = ^ (int num) { return num * multiplier; }; int d = i % 10; repeat(10, ^ { putc ('0'+d); }); void (^ block)(void); typedef void (^ vstr_t)(char *); typedef void (^ workBlk_t)(void); void AllLinesInFile(char *f, vstr_t block) { FILE *fp = fopen(f, "r"); if (!fp) return; char line[1024]; while (fgets(line, 1024, fp)) block(line); fclose(fp); } @implementation NSArray (WWDC) - (NSArray *)map:(id (^ )(id))xform { id result = [NSMutableArray array]; for (id elem in self) [result addObject:xform(elem)]; return result; } - (NSArray *)collect:(BOOL ( ^ )(id))predicate { id result = [NSMutableArray array]; for (id elem in self) if (predicate(elem)) [result addObject:elem]; return result; } // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL (id item) { return [item length] > 20; }]; // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL* (id item) { return [item length] > 20; }]; @end // 1. block literal: ^{ ... }; // 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional // 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optionaluncrustify-0.59/tests/output/oc/50008-protocol.m0000644000175000017500000000073211506773275016416 00000000000000 NSAssert([self.delegate conformsToProtocol: @protocol(UISearchBarDelegate)], @"Some Error."); Protocol *counter = @protocol(ReferenceCounting); @protocol ReferenceCounting -setRefCount: (int)count; -(int)refCount; -incrementCount; -decrementCount; @end @interface Formatter : NSObject @end if ([receiver conformsTo: @protocol(ReferenceCounting)]) { [receiver incrementCount]; } @protocol B; @protocol A -Foo: (id )anObject; @end uncrustify-0.59/tests/output/oc/50012-return_type.m0000644000175000017500000000106211506773275017125 00000000000000#import #import @interface Fraction : NSObject { int numerator; int denominator; } -(void)print; -(void)setNumerator:(int)d; -(void)setDenominator:(int)d; -(int)numerator; -(int)denominator; -(void)setNumDen:(int)n:(int)d; @end @implementation Fraction -(void)print { printf("%i/%i", numerator, denominator); } -(void)setNumerator:(int)n { numerator = n; } -(void)setDenominator:(int)d { denominator = d; } -(int)denominator { return(denominator); } -(int)numerator { return(numerator); } @end uncrustify-0.59/tests/output/oc/50005-Declarations.h0000644000175000017500000000053211506773275017153 00000000000000 @interface EmptyClass : NSObject -(void)aMessage: (id) arg; @end @interface EmptyClass : NSObject {} -(void)aMessage: (id) arg; @end @interface NSObject (ObjectAdditions) -(void)aMessage: (id) arg; @end @protocol TestProtocol -(void)aMessage: (id) arg; @end @interface TestClass : NSObject { } -(void)aMessage: (id) arg; @end uncrustify-0.59/tests/output/oc/50040-complex_method.m0000644000175000017500000000264411506773275017564 00000000000000// Turn the document contents into a single savable lump of data - (NSData *) dataOfType:(NSString *)typeName error:(NSError **)outError { #pragma unused(typeName) // Produce the data lump: NSData * retval = [NSKeyedArchiver archivedDataWithRootObject:model]; // If the lump is nil something went wrong // fill out the error object to explain what wrent wrong if ( outError != NULL ) { // The sender wanted an error reported. If there // was a problem, fill in an NSError object if (retval == nil) { // The error object should include an (unhelpful) // explanation of what happened NSDictionary * userInfoDict = [NSDictionary dictionaryWithObjectsAndKeys: @"Internal error formatting data", NSLocalizedDescriptionKey, @"Archiving of data failed. Probably a bug.", NSLocalizedFailureReasonErrorKey, @"There's nothing you can do.", NSLocalizedRecoverySuggestionErrorKey, nil]; *outError = [NSError errorWithDomain:LinearInternalErrorDomain code:linErrCantFormatDocumentData userInfo:userInfoDict]; } else { // No problem. Don't supply an error object. *outError = nil; } } return retval; } uncrustify-0.59/tests/output/oc/50078-more_blocks.m0000644000175000017500000000254611506773275017070 00000000000000int ( ^myBlock)(int) = ^(int num) { return num * multiplier; }; int d = i % 10; repeat(10, ^{ putc ('0'+d); }); void ( ^block)(void); typedef void ( ^vstr_t)(char *); typedef void ( ^workBlk_t)(void); void AllLinesInFile(char *f, vstr_t block) { FILE *fp = fopen(f, "r"); if (!fp) return; char line[1024]; while (fgets(line, 1024, fp)) block(line); fclose(fp); } @implementation NSArray (WWDC) - (NSArray *)map:(id ( ^)(id))xform { id result = [NSMutableArray array]; for (id elem in self) [result addObject:xform(elem)]; return result; } - (NSArray *)collect:(BOOL ( ^ )(id))predicate { id result = [NSMutableArray array]; for (id elem in self) if (predicate(elem)) [result addObject:elem]; return result; } // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL (id item) { return [item length] > 20; }]; // corner case: block literal in use with return type id longLines = [allLines collect: ^ BOOL* (id item) { return [item length] > 20; }]; @end // 1. block literal: ^{ ... }; // 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional // 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optionaluncrustify-0.59/tests/output/oc/50060-oc-split.m0000644000175000017500000000055611506773275016311 00000000000000[self findstart:&startBarcode end:&endBarcode forLine:greenScalePixels derivative:greenDerivative centerAt:xAxisCenterPoint min:&minValue max:&maxValue]; [self findstart:&startBarcode end:&endBarcode forLine:greenScalePixels derivative:greenDerivative centerAt:xAxisCenterPoint min:&minValue max:&maxValue]; uncrustify-0.59/tests/output/oc/50010-kw.m0000644000175000017500000000064711516452454015166 00000000000000#include #include @protocol Job -do; @end @interface MyJob : Object -do; @end @implementation MyJob -do { printf("Doing Job\n"); return(self); } @end @interface JobExecutor : Object -doWith: (id ) job for: (int)count; @end @implementation JobExecutor -doWith: (id )job for: (int)count { for (int i = 0; i < count; ++i) { [job do]; } return(self); } @end uncrustify-0.59/tests/output/oc/50020-selector.m0000644000175000017500000000035211506773275016365 00000000000000@selector (methodNameWithArg:); @selector (methodNameNoArg); @selector (methodNameArg1:arg2: ); NSArray *sortedTZs = [[NSTimeZone knownTimeZoneNames] sortedArrayUsingSelector : @selector ( compare: )]; uncrustify-0.59/tests/output/oc/50070-blocks.m0000644000175000017500000000040511506773275016026 00000000000000int* ( ^ blkReturningPointer)(int) = ^ int* (int a) { return a + 1; }; void ( ^ blk2)(int *) = ^(int *b) { *b = 1; }; int ( ^oneFrom)(int) = ^ (int anInt) { return anInt - 1; }; // this should not be flagged as OC_BLOCK_CARET int x = 12 ^ 23;uncrustify-0.59/tests/output/oc/50083-more_blocks.m0000644000175000017500000000253211506773275017057 00000000000000int (^myBlock)(int) =^(int num) { return num * multiplier; }; int d = i % 10; repeat(10, ^{ putc ('0'+d); }); void (^block)(void); typedef void (^vstr_t)(char *); typedef void (^workBlk_t)(void); void AllLinesInFile(char *f, vstr_t block) { FILE *fp = fopen(f, "r"); if (!fp) return; char line[1024]; while (fgets(line, 1024, fp)) block(line); fclose(fp); } @implementation NSArray (WWDC) - (NSArray *)map:(id (^)(id))xform { id result = [NSMutableArray array]; for (id elem in self) [result addObject:xform(elem)]; return result; } - (NSArray *)collect:(BOOL (^)(id))predicate { id result = [NSMutableArray array]; for (id elem in self) if (predicate(elem)) [result addObject:elem]; return result; } // corner case: block literal in use with return type id longLines = [allLines collect:^BOOL (id item) { return [item length] > 20; }]; // corner case: block literal in use with return type id longLines = [allLines collect:^BOOL* (id item) { return [item length] > 20; }]; @end // 1. block literal: ^{ ... }; // 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional // 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optionaluncrustify-0.59/tests/output/oc/50082-more_blocks.m0000644000175000017500000000253611506773275017062 00000000000000int (^myBlock)(int) = ^(int num) { return num * multiplier; }; int d = i % 10; repeat(10, ^{ putc ('0'+d); }); void (^block)(void); typedef void (^vstr_t)(char *); typedef void (^workBlk_t)(void); void AllLinesInFile(char *f, vstr_t block) { FILE *fp = fopen(f, "r"); if (!fp) return; char line[1024]; while (fgets(line, 1024, fp)) block(line); fclose(fp); } @implementation NSArray (WWDC) - (NSArray *)map:(id (^)(id))xform { id result = [NSMutableArray array]; for (id elem in self) [result addObject:xform(elem)]; return result; } - (NSArray *)collect:(BOOL ( ^)(id))predicate { id result = [NSMutableArray array]; for (id elem in self) if (predicate(elem)) [result addObject:elem]; return result; } // corner case: block literal in use with return type id longLines = [allLines collect: ^BOOL (id item) { return [item length] > 20; }]; // corner case: block literal in use with return type id longLines = [allLines collect: ^BOOL* (id item) { return [item length] > 20; }]; @end // 1. block literal: ^{ ... }; // 2. block declaration: return_t (^name) (int arg1, int arg2, ...) NB: return_t is optional and name is also optional // 3. block inline call ^ return_t (int arg) { ... }; NB: return_t is optionaluncrustify-0.59/tests/output/oc/50011-return_type.m0000644000175000017500000000107511506773275017130 00000000000000#import #import @interface Fraction : NSObject { int numerator; int denominator; } -(void) print; -(void) setNumerator:(int)d; -(void) setDenominator:(int)d; -(int) numerator; -(int) denominator; -(void) setNumDen:(int)n:(int)d; @end @implementation Fraction -(void) print { printf("%i/%i", numerator, denominator); } -(void) setNumerator:(int)n { numerator = n; } -(void) setDenominator:(int)d { denominator = d; } -(int) denominator { return(denominator); } -(int) numerator { return(numerator); } @end uncrustify-0.59/tests/output/oc/50074-blocks.m0000644000175000017500000000040311506773275016030 00000000000000int* ( ^ blkReturningPointer)(int) = ^ int* (int a) { return a + 1; }; void (^ blk2)(int *) = ^ (int *b) { *b = 1; }; int (^ oneFrom)(int) = ^ (int anInt) { return anInt - 1; }; // this should not be flagged as OC_BLOCK_CARET int x = 12 ^ 23;uncrustify-0.59/tests/output/oc/50007-misc.m0000644000175000017500000000171711631562113015475 00000000000000-(id)init { GLfloat wc[3][3] = { { 0.6, 0.6, 0.0 }, { 1.0, 0.7, 0.1 }, { 0.5, 0.7, 0.2 }, }; GLfloat cc[3][3] = { { 0.0, 0.0, 0.6 }, { 0.3, 0.1, 0.5 }, { 0.0, 0.0, 0.5 }, }; GLfloat sc[3] = { 0.75, 0.75, 0.75 }; return([self initWithWarmColors: (float *)&wc coolColors: (float *)&cc surfaceColor: sc enableTexturing: NO enableSpecular: YES enableQuakeDisruptor: NO]); [NSException raise: NSInternalInconsistency format: @"An internal inconsistency was raised"]; for (i = 0; i < [a count]; i++) { [thePerson setAmount: (1.5 * 17) forKey: @"overtime"]; [screen showtext : x: y: @"Message"]; } } *outError = [NSError errorWithDomain: NSCocoaErrorDomain code: 0 userInfo: [NSDictionary dictionaryWithObject: @"Some Description" forKey: NSLocalizedDescriptionKey]]; uncrustify-0.59/tests/output/oc/50004-string.m0000644000175000017500000000043411506773275016056 00000000000000 -(void)moreScannedData: (Image *) img from: (int) start to: (int) stop; -(void)moreScannedData: (Image *) img from: (int) start to: (int) stop; public bool Enabled { NSString *whatever = @"some lovely text, the fox and co"; a = (enderedImage->h - toplines - bottomlines); } uncrustify-0.59/tests/output/sql/0000755000175000017500000000000011574754665014210 500000000000000uncrustify-0.59/tests/output/sql/02400-mysql.sqc0000644000175000017500000000160111574754743016443 00000000000000#include #include /*----------------------------------------------------------------*/ EXEC SQL INCLUDE SQLCA; short sqlcode; EXEC SQL BEGIN DECLARE SECTION; int host_a; double host_b; char host_c; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE csr1 CURSOR FOR SELECT a, b, c FROM table1 WHERE x = :hostvar1; /*----------------------------------------------------------------*/ void main(void) { hostvar1 = 42; EXEC SQL OPEN csr1; if (sqlcode < 0) { exit(0); } while (rc >= 0 && rc != 100) { EXEC SQL FETCH csr1 INTO :host_a, :host_b, :host_c; printf("Fetch %d, %lf, %s\n", host_a, host_b, host_c); } EXEC SQL CLOSE csr1; } void foo(void) { strcpy(demoquery1, "some SQL statement"); EXEC SQL prepare demo3id from :demoquery1; /* a comment */ EXEC SQL declare demo3cursor cursor for demo3id; } uncrustify-0.59/tests/output/sql/02401-sta-select.sqc0000644000175000017500000000451711574754743017354 00000000000000/******************************************************* ** ** A sample program that demonstrates the use of Static embedded SQL. ** Before compiling this program, be sure you have created a table ** called video and inserted some tuples in it. ** ********************************************************/ #include /* sqlca: is the sql communications area. All error codes * are returned from db2 in that structure which is filled * each time an interaction with db2 takes place. */ EXEC SQL INCLUDE SQLCA; /* SQL communication area structure */ EXEC SQL BEGIN DECLARE SECTION; /* declare host variables */ char db_name[8]; /* database name */ char video_title[30]; /* title of the video */ short video_id; /* serial number */ char director[20]; /* director name */ EXEC SQL END DECLARE SECTION; /* These lines are redundant here because the default * action is to continue. They just show the kind of * errors that could arise and one way to control them. */ EXEC SQL WHENEVER SQLWARNING CONTINUE; /* sqlca.sqlcode > 0 */ EXEC SQL WHENEVER SQLERROR CONTINUE; /* sqlca.sqlcode < 0 */ EXEC SQL WHENEVER NOT FOUND CONTINUE; /* sqlca.sqlcode = 100 */ /* sqlca.sqlcode = 0 (no error) */ void main() { strcpy(db_name, "csc343h"); /* C variables are preceded by a colon when they are passed to DB2 */ EXEC SQL CONNECT TO :db_name; if (sqlca.sqlcode != 0) { printf("Connect failed!: reason %ld\n", sqlca.sqlcode); exit(1); } /* cursor delcaration. Have to declare a cursor each time you * want tuples back from db2 */ EXEC SQL DECLARE c1 CURSOR FOR SELECT video_title FROM video; /* you have to open the cursor in order to get tuples back */ EXEC SQL OPEN c1; do { /* fetch tuples from the cursor. This will execute the statement * the cursor implements and will return the results */ EXEC SQL FETCH c1 into :video_title; if (SQLCODE != 0) { break; /* SQLCODE refers to sqlca.sqlcode */ } /* host variables should have ':' prefix when they are used in DB2 commands */ printf("%s\n", video_title); } while (1); EXEC SQL CLOSE c1; EXEC SQL CONNECT RESET; } uncrustify-0.59/tests/output/sql/21001-sta-select.sqc0000644000175000017500000000451711506773275017345 00000000000000/******************************************************* ** ** A sample program that demonstrates the use of Static embedded SQL. ** Before compiling this program, be sure you have created a table ** called video and inserted some tuples in it. ** ********************************************************/ #include /* sqlca: is the sql communications area. All error codes * are returned from db2 in that structure which is filled * each time an interaction with db2 takes place. */ EXEC SQL INCLUDE SQLCA; /* SQL communication area structure */ EXEC SQL BEGIN DECLARE SECTION; /* declare host variables */ char db_name[8]; /* database name */ char video_title[30]; /* title of the video */ short video_id; /* serial number */ char director[20]; /* director name */ EXEC SQL END DECLARE SECTION; /* These lines are redundant here because the default * action is to continue. They just show the kind of * errors that could arise and one way to control them. */ EXEC SQL WHENEVER SQLWARNING CONTINUE; /* sqlca.sqlcode > 0 */ EXEC SQL WHENEVER SQLERROR CONTINUE; /* sqlca.sqlcode < 0 */ EXEC SQL WHENEVER NOT FOUND CONTINUE; /* sqlca.sqlcode = 100 */ /* sqlca.sqlcode = 0 (no error) */ void main() { strcpy(db_name, "csc343h"); /* C variables are preceded by a colon when they are passed to DB2 */ EXEC SQL CONNECT TO :db_name; if (sqlca.sqlcode != 0) { printf("Connect failed!: reason %ld\n", sqlca.sqlcode); exit(1); } /* cursor delcaration. Have to declare a cursor each time you * want tuples back from db2 */ EXEC SQL DECLARE c1 CURSOR FOR SELECT video_title FROM video; /* you have to open the cursor in order to get tuples back */ EXEC SQL OPEN c1; do { /* fetch tuples from the cursor. This will execute the statement * the cursor implements and will return the results */ EXEC SQL FETCH c1 into :video_title; if (SQLCODE != 0) { break; /* SQLCODE refers to sqlca.sqlcode */ } /* host variables should have ':' prefix when they are used in DB2 commands */ printf("%s\n", video_title); } while (1); EXEC SQL CLOSE c1; EXEC SQL CONNECT RESET; } uncrustify-0.59/tests/output/sql/21000-mysql.sqc0000644000175000017500000000160111506773275016434 00000000000000#include #include /*----------------------------------------------------------------*/ EXEC SQL INCLUDE SQLCA; short sqlcode; EXEC SQL BEGIN DECLARE SECTION; int host_a; double host_b; char host_c; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE csr1 CURSOR FOR SELECT a, b, c FROM table1 WHERE x = :hostvar1; /*----------------------------------------------------------------*/ void main(void) { hostvar1 = 42; EXEC SQL OPEN csr1; if (sqlcode < 0) { exit(0); } while (rc >= 0 && rc != 100) { EXEC SQL FETCH csr1 INTO :host_a, :host_b, :host_c; printf("Fetch %d, %lf, %s\n", host_a, host_b, host_c); } EXEC SQL CLOSE csr1; } void foo(void) { strcpy(demoquery1, "some SQL statement"); EXEC SQL prepare demo3id from :demoquery1; /* a comment */ EXEC SQL declare demo3cursor cursor for demo3id; } uncrustify-0.59/tests/output/java/0000755000175000017500000000000011574757101014316 500000000000000uncrustify-0.59/tests/output/java/80000-assert.java0000644000175000017500000000037511574757101017054 00000000000000public class JavaClass { public static void main(String[] args) { /* assert EXPRESSION1 ; */ assert (a != null) && (b != null); /* assert EXPRESSION1 : EXPRESSION2 ; */ assert (a != null) && (b != null) : "Message"; } } uncrustify-0.59/tests/output/vala/0000755000175000017500000000000011630457175014321 500000000000000uncrustify-0.59/tests/output/vala/70001-advanced.vala0000644000175000017500000000115711630457175017324 00000000000000/* Advanced Vala Sample Code */ using GLib; public class Sample : Object { public string name { get; set; } public signal void foo(); public Sample (construct string !name) { } public void run() { foo += s => { stdout.printf("Lambda expression %s!\n", name); } /* Calling lambda expression */ foo(); } static int main(string[] args) { foreach (string arg in args) { var sample = new Sample(arg); sample.run(); /* Object will automatically be freed * at the end of the block */ } return(0); } } uncrustify-0.59/tests/output/vala/70000-list.vala0000644000175000017500000000061211506773275016530 00000000000000 using GLib; public class GListTest : Object { public GListTest { } static int main(string[] args) { List list; list.append("TestString1"); list.append("myTest"); message("list.length()=%d", list.length()); for (int i = 0; i < list.length(); i++) { string list2 = list.nth_data(i); message("%s", list2); } } } uncrustify-0.59/tests/output/c/0000755000175000017500000000000011632275667013626 500000000000000uncrustify-0.59/tests/output/c/00008-comment-convert.c0000644000175000017500000000113511574754743017501 00000000000000/* This is your typical header comment */ int foo(int bar) { int idx; int res = 0; /* trailing comment * that spans two lines */ /* Comment with embedded / * C comment * / */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; /* Multi-line comment with embedded / * C comment * / and junk * afterwards */ res *= idx; /* some comment */ /* almost continued, but a NL in between */ /* col1 comment in level 1 * second comment */ return(res); } /* col1 comment in level 0 * and another */ uncrustify-0.59/tests/output/c/00505-pos_conditional.c0000644000175000017500000000024711574754743017552 00000000000000void foo(void) { // conditional colon a = bar() ? 2 : 3; a = bar() ? 2 : 3; // conditional question a = bar() ? 2 : 3; a = bar() ? 2 : 3; } uncrustify-0.59/tests/output/c/00000-comment-indent.c0000644000175000017500000000112411574754743017270 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 // second comment return(res); } // col1 comment in level 0 // and another void foo() { if( bar ) { foo(); } /*else if( bar2 ) { foo2(); } */else if( bar3 ) { foo3(); } } uncrustify-0.59/tests/output/c/00153-casts.c0000644000175000017500000000264311574754743015504 00000000000000 #define SOME_VAL1 ((MYINT)-1) #define SOME_VAL2 (-2) #define SOME_VAL3 -3 #define MULT(X, Y) (X)*(Y) #define SOME_JUNK /*lint -e123 */ (const mytype *)-1 typedef (*my_fcn_ptr_t)(char *, int); typedef (my_fcn_t)(char *, int); void foo(void) { uint crc = crc32_calc_full((const UINT8 *)"String", 6); crc = crc32_calc_full((const UINT8 *)&crc, sizeof(crc)); a = (b) - 4; a = (UINT)-4; a = (UINT)+4; a = (UINT)*4; a = (UINT)&4; a = (uint32_t)-pb; a = (uint32_t)+pb; a = (uint32_t)*pb; a = (uint32_t)&pb; a = (Uint)-4; a = (Uint)+4; a = (Uint)*4; a = (Uint)&4; a = b * (int)flt; a = b * ((int)flt); a = b * (int)flt; a = b * (INT8)flt; a = b * (Uint)flt; a = *(int)&b; a = *(CHAR)&b; a = *(Uint)&b; a = (int)*pb; a = (CHAR)*pb; a = (Uint)*pb; a = (int)'a'; a = (UINT8)'a'; a = (Uint)'a'; a = (int)*'a'; a = (UINT8)*'a'; a = (Uint)*'a'; a = (int)*5; a = (UINT)*5; a = (Uint)*5; a = (int)*ape; a = (UINT)*ape; a = (Uint)*ape; a = (int)ape; a = (UINT)ape; a = (Uint)ape; a = (int)sizeof(x); a = (INT16)sizeof(x); a = (Uint)sizeof(x); a = (int)foo(x); a = (CHAR)foo(x); a = (Uint)foo(x); a = (int)(x); a = (CHAR)(x); a = (Uint)(x); a = (int)*(x); a = (CHAR)*(x); a = (Uint)*(x); a = (unsigned int)(1 + 4); a = (int)(1 + 1); a = (void *)(&str); } uncrustify-0.59/tests/output/c/00004-switch.c0000644000175000017500000000037611574754743015664 00000000000000 int foo(int op) { switch (op) { case 1: { do_something(); return 0; } case 2: do_something_else(); return 1; case 3: case 4: /* don't do anything */ break; case 5: return 3; default: break; } return -1; } uncrustify-0.59/tests/output/c/00601-mac.c0000644000175000017500000000063611574754743015125 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 return(res); } // col1 comment in level 0 uncrustify-0.59/tests/output/c/00422-nl_ds_struct_enum.c0000644000175000017500000000046711574754743020117 00000000000000struct foo { unsigned int d_ino; /* Comment */ unsigned short d_reclen; unsigned short d_namlen; /* Comment */ char d_name[1]; }; struct foo { /* Comment */ unsigned int d_ino; unsigned short d_reclen; unsigned short d_namlen; /* Comment */ char d_name[1]; }; struct foo { int a; char *b }; uncrustify-0.59/tests/output/c/02301-preproc-if.c0000644000175000017500000000052011631561414016403 00000000000000 int main() { int a; #ifndef SOMEDEF int b; #endif /* SOMEDEF */ if (a) { } #ifndef SOMEDEF else if (b) { } #endif /* SOMEDEF */ /* same thing w/o preprocs for reference */ if (a) { } else if (b) { } #ifdef FOO do { Foo(); } #endif while (Loop--); } uncrustify-0.59/tests/output/c/02325-sort_include.c0000644000175000017500000000024311631561414017037 00000000000000// should be ddd, eee, fff #include "ddd" #include "eee" #include "fff" // should be aaa, ccc #include "aaa" #include "ccc" // should be just bbb #include "bbb" uncrustify-0.59/tests/output/c/00511-bool-pos.c0000644000175000017500000000203511574754743016112 00000000000000void foo(void) { if ((a != 0) && (b == 0) && (c < 0) && (d > 0)) { printf("hi"); } if (flag1 #ifdef FLAG2 || flag2 #endif ) { printf("yar"); } if (flag1 && #ifdef FLAG2 flag2 && #endif flag3) { printf("bo"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if (!this->writeOwiFile () // comment1 || broken () || !saveArchiveData () /* comment2 */ || broken () || !deleteCentralArchive () // comment3 || broken () || !copyArchivFiles () // comment4 || broken () || !appendToPlanetDb ()) // comment5 { ; } foobar(param1 , param2 , param3 , param4); foobar2(param1 , param2 , param3 , param4); } uncrustify-0.59/tests/output/c/00301-align-struct-init.c0000644000175000017500000000200111574754743017723 00000000000000 const char *token_names[] = { [CT_POUND] = "POUND", [CT_PREPROC] = "PREPROC", [CT_PREPROC_BODY] = "PREPROC_BODY", [CT_PP] = "PP", [CT_ELIPSIS] = "ELIPSIS", [CT_NAMESPACE] = "NAMESPACE", [CT_NEW] = "NEW", [CT_OPERATOR] = "OPERATOR", [CT_THROW] = "THROW", [CT_TRY] = "TRY", [CT_USING] = "USING", [CT_PAREN_OPEN] = "PAREN_OPEN", }; int main(int argc, char *argv[]) { struct junk a[] = { { "version", 0, 0, 0 }, { "file", 1, 150, 'f' }, { "config", 1, 0, 'c' }, { "parsed", 25, 0, 'p' }, { NULL, 0, 0, 0 } }; } color_t colors[] = { { "red", { 255, 0, 0 } }, { "blue", { 0, 255, 0 } }, { "green", { 0, 0, 255 } }, { "purple", { 255, 255, 0 } }, }; struct foo_t bar = { .name = "bar", .age = 21 }; struct foo_t bars[] = { [0] = { .name = "bar", .age = 21 }, [1] = { .name = "barley", .age = 55 }, }; uncrustify-0.59/tests/output/c/00170-beautifier-off.c0000644000175000017500000000101411574754744017245 00000000000000 #define FOO(bar) create_a_really_long_identifier name(some_function(bar1 + bar2), bar3, bar4); /* *INDENT-OFF* */ int foo[] = { 1, 3, 5, 3, 5, 7, 5, 7, 9, }; /* *INDENT-ON* */ #define multilinemacro do { (x+5); } while (0); \ printf("a multilinemacro"); \ printf("a multilinemacro2"); /* *INDENT-OFF* */ int main(int argc, char *argv[]) { int a, b; a = 1; // stupid comment \ b = 2; /* *INDENT-ON* */ return(a+b); } /* *INDENT-OFF* */ int a; /* *INDENT-ON* */ uncrustify-0.59/tests/output/c/00054-if_chain.c0000644000175000017500000000223411574754744016124 00000000000000void foo(void) { if (cond_a) { fcn_a(); fcn_b(); } else { fcn_c(); } if (cond_b) fcn_d(); else fcn_e(); if (cond_c) { fcn_f(); fcn_g(); } else { fcn_h(); } if (cond_d) { fcn_i(); } else { fcn_j(); fcn_k(); } if (cond_e) fcn_l(); else fcn_m(); if (cond_f) { fcn_n(); } else if (cond_g) { fcn_o(); while (cond_g) fcn_p(); } else if (cond_h) { while (cond_i) { fcn_q(); fcn_r(); } } else { fcn_s(); } } /* this next bit test whether vbraces can be successfully converted * when the closing brace is in an #ifdef. * Note that the author should have braced the code to begin with. */ void bar(void) { if (jiffies >= hw_priv->Counter[ port ].time) { hw_priv->Counter[ port ].fRead = 1; if (port == MAIN_PORT) hw_priv->Counter[ MAIN_PORT ].time = jiffies + HZ * 6; else hw_priv->Counter[ port ].time = #ifdef SOME_DEFINE hw_priv->Counter[ port - 1 ].time + HZ * 2; #else /* ifdef SOME_DEFINE */ hw_priv->Counter[ MAIN_PORT ].time + HZ * 2; #endif /* ifdef SOME_DEFINE */ } } void funct(int v1, int v2, int v3) { if (v1) { if (v2) f1(); } else { if (v3) f2(); } } uncrustify-0.59/tests/output/c/00632-nl_assign.c0000644000175000017500000000100411574754744016335 00000000000000 void foo() { some.really_long.variable_name = another.big.one[55] + something_else; some.really_long.variable_name = another.big.one[55] + something_else; some.really_long.variable_name = another.big.one[55] + something_else; a_really_long_assignment_to_test = line_breaks_around_assign_and_arith; a_really_long_assignment_to_test = line_breaks_around + assign_and_arith; } uncrustify-0.59/tests/output/c/02451-nl_return_expr.c0000644000175000017500000000024111631561414017411 00000000000000 int foo1(void) { return(NewClass(1)); } int foo2(void) { return(NewClass(2)); } int foo3(void) { return(3); } int foo4(void) { return(4); } uncrustify-0.59/tests/output/c/02421-cmt_multi.c0000644000175000017500000000124611631561414016343 00000000000000/************************************************ * This is a multiline comment. * The first and last lines are the same length ************************************************/ /**************************************************************************** A multi-line comment that is broken in two parts. *//** Second part ****************************************************************************/ /**************************************************************************** A multi-line comment that is broken in two parts. */ /** Second part ****************************************************************************/ uncrustify-0.59/tests/output/c/00402-align-var.c0000644000175000017500000000152311574754744016241 00000000000000struct foo1 { unsigned int d_ino; const char * d_reclen; unsigned short d_namlen; char d_name[1]; }; struct foo2 { unsigned int a : 1; unsigned int bcd : 3; unsigned int ef : 2; unsigned int : 2; unsigned short more; int fields; }; typedef struct { bitfld a : 8; bitfld b : 16; bitfld : 8; } type_t; struct foo { int a; char *b }; static int idx; static const char ** tmp; static char buf[64]; static unsigned long how_long; // comment static int ** tmp; static char buf[64]; void bar(int someval, void *puser, const char *filename, struct willy *the_list, int list_len) { int idx; const char ** tmp; char buf[64]; unsigned long how_long; return(-1); } uncrustify-0.59/tests/output/c/00614-pp-space.c0000644000175000017500000000074611574754744016104 00000000000000/** * Some file header comment thingy. */ #ifndef SOME_H_INCLUDED #define SOME_H_INCLUDED #include "Somefile.h" #define SOMEMACRO (1+4) #ifdef WIN32 #include "windows_compat.h" #else /* not WIN32 */ #if defined HAVE_STDINT_H #include #elif defined HAVE_INTTYPES_H #include #define YOUR_OS_SUCKS #else #error "Don't know where int8_t is defined" #endif typedef uint32_t UINT32; #endif /* ifdef WIN32 */ #endif /* SOME_H_INCLUDED */ uncrustify-0.59/tests/output/c/01011-semicolons.c0000644000175000017500000000112011574754744016522 00000000000000 int foo(int bar) { for (;;) { break; } if (a) { foo(); } if (b) if (c) bar(); else ; else { foo(); } switch (a) { case 1: break; case 2: break; default: break; } while (b-->0) { bar(); } do { bar(); } while (b-->0 ); } enum FPP { FPP_ONE = 1, FPP_TWO = 2, }; struct narg { int abc; char def; const char *ghi; }; void f2(void) { { i++; } for (;;) ; for (;;) { } } int main(int argc, char *argv[]) { if( argc == 1 ) { printf("one"); } else if( argc == 2 ) { printf("two"); } else { printf("%d", argc); } return 0; } uncrustify-0.59/tests/output/c/00612-pp-space.c0000644000175000017500000000076311574754744016101 00000000000000/** * Some file header comment thingy. */ #ifndef SOME_H_INCLUDED #define SOME_H_INCLUDED #include "Somefile.h" #define SOMEMACRO (1+4) #ifdef WIN32 # include "windows_compat.h" #else /* not WIN32 */ # if defined HAVE_STDINT_H # include # elif defined HAVE_INTTYPES_H # include # define YOUR_OS_SUCKS # else # error "Don't know where int8_t is defined" # endif typedef uint32_t UINT32; #endif /* ifdef WIN32 */ #endif /* SOME_H_INCLUDED */ uncrustify-0.59/tests/output/c/00016-braces.c0000644000175000017500000000223711574754744015624 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) // trailing C++ comment b++; do // trailing C++ comment { a--; } while (a > 0); do a--; while (a > 0); for (a = 0; a < 10; a++) // trailing C++ comment { printf("a=%d\n", a); } if (a == 10) // trailing C++ comment { printf("a looks good\n"); } else // trailing C++ comment { printf("not so good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } else if (b != 0) a /= b; else // trailing C++ comment a += b; } } list_for_each(k) { if (a) if (b) { c++; } } while (1) ; /* hang forever */ } void f() { if (buf[0] == '~' && strchr(tmp, '/') == NULL) { buf = mallocstrcpy(buf, tmp); matches = username_tab_completion(tmp, &num_matches); } /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ else if (strlen(buf) > strlen(tmp)) buf = mallocstrcpy(buf, tmp); } void f() { } void g() { } uncrustify-0.59/tests/output/c/00613-pp-space.c0000644000175000017500000000074611574754744016103 00000000000000/** * Some file header comment thingy. */ #ifndef SOME_H_INCLUDED #define SOME_H_INCLUDED #include "Somefile.h" #define SOMEMACRO (1+4) #ifdef WIN32 #include "windows_compat.h" #else /* not WIN32 */ #if defined HAVE_STDINT_H #include #elif defined HAVE_INTTYPES_H #include #define YOUR_OS_SUCKS #else #error "Don't know where int8_t is defined" #endif typedef uint32_t UINT32; #endif /* ifdef WIN32 */ #endif /* SOME_H_INCLUDED */ uncrustify-0.59/tests/output/c/00620-indent-assign.c0000644000175000017500000000021511574754744017123 00000000000000void foo(void) { int a; junk(a = 3); } void f() { int x = size_t(1.0) + 2; int y = (size_t(1.0) + 5); } uncrustify-0.59/tests/output/c/01001-nl-comment.c0000644000175000017500000000104511574754744016425 00000000000000namespace foo { /** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines /* multi-line comment */ idx = 50; /* single line comment */ for (idx = 1; idx < bar; idx++) { /* comment in virtual braces */ res += idx; } res *= idx; // some comment // almost continued, but a NL in between i++; // col1 comment in level 1 // second comment return(res); } // col1 comment in level 0 // and another } uncrustify-0.59/tests/output/c/00013-braces.c0000644000175000017500000000254011574754744015616 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) // trailing C++ comment b++; do // trailing C++ comment { a--; } while (a > 0); do a--; while (a > 0); for (a = 0; a < 10; a++) // trailing C++ comment { printf("a=%d\n", a); } if (a == 10) // trailing C++ comment { printf("a looks good\n"); } else // trailing C++ comment { printf("not so good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } else if (b != 0) a /= b; else // trailing C++ comment a += b; } } list_for_each(k) { if (a) if (b) { c++; } } while (1) ; /* hang forever */ } void f() { if (buf[0] == '~' && strchr(tmp, '/') == NULL) { buf = mallocstrcpy(buf, tmp); matches = username_tab_completion(tmp, &num_matches); } /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ else if (strlen(buf) > strlen(tmp)) buf = mallocstrcpy(buf, tmp); } void f() { } void g() { } uncrustify-0.59/tests/output/c/00067-vb-do.c0000644000175000017500000000036711574754744015404 00000000000000 struct beef a = { 1, 2, 3 }; void get_name(void) { int _ = 3; do { a--; } while (a); while (a) //something { a--; } do { while (a) //something { a--; } } while (b--); } uncrustify-0.59/tests/output/c/00014-braces.c0000644000175000017500000000216511574754744015622 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) // trailing C++ comment b++; do { // trailing C++ comment a--; } while (a > 0); do a--; while (a > 0); for (a = 0; a < 10; a++) { // trailing C++ comment printf("a=%d\n", a); } if (a == 10) { // trailing C++ comment printf("a looks good\n"); } else { // trailing C++ comment printf("not so good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } else if (b != 0) a /= b; else // trailing C++ comment a += b; } } list_for_each(k) { if (a) if (b) { c++; } } while (1) ; /* hang forever */ } void f() { if (buf[0] == '~' && strchr(tmp, '/') == NULL) { buf = mallocstrcpy(buf, tmp); matches = username_tab_completion(tmp, &num_matches); } /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ else if (strlen(buf) > strlen(tmp)) buf = mallocstrcpy(buf, tmp); } void f() { } void g() { } uncrustify-0.59/tests/output/c/00069-vb-pp.c0000644000175000017500000000064511574754744015422 00000000000000 void f() { if (0) #pragma omp atomic { i++; } } void f() { if (0) #if foo { i++; } #else { i += 2; } #endif } void f() { while (108) { if (42) #pragma omp critical { } if (23) #pragma omp critical { ++i; } while (16) { } int i = 15; if (8) #pragma omp atomic { i += 4; } } } uncrustify-0.59/tests/output/c/01021-hello.c0000644000175000017500000000216011631037666015447 00000000000000/*******************************************************************************//** * * @file hello.c * * * ***********************************************************************************/ #include /*********************************************************************************** * HelloWorld *******************************************************************************//** * * * * @param pString TODO * **********************************************************************************/ void HelloWorld(char* pString) { printf("%s\n", pString); } /* HelloWorld */ /*********************************************************************************** * main *******************************************************************************//** * * * * @return TODO * **********************************************************************************/ int main() { HelloWorld("Hello world"); return 0; } /* main */ /** * CVS History: * $Log $ * */ uncrustify-0.59/tests/output/c/00150-casts.c0000644000175000017500000000271311574754744015500 00000000000000 #define SOME_VAL1 ((MYINT)-1) #define SOME_VAL2 (-2) #define SOME_VAL3 -3 #define MULT(X, Y) (X)*(Y) #define SOME_JUNK /*lint -e123 */ (const mytype *)-1 typedef (*my_fcn_ptr_t)(char *, int); typedef (my_fcn_t)(char *, int); void foo(void) { uint crc = crc32_calc_full((const UINT8 *)"String", 6); crc = crc32_calc_full((const UINT8 *)&crc, sizeof(crc)); a = (b) - 4; a = (UINT)-4; a = (UINT)+4; a = (UINT) * 4; a = (UINT) & 4; a = (uint32_t)-pb; a = (uint32_t) + pb; a = (uint32_t)*pb; a = (uint32_t)&pb; a = (Uint) - 4; a = (Uint) + 4; a = (Uint) * 4; a = (Uint) & 4; a = b * (int)flt; a = b * ((int)flt); a = b * (int)flt; a = b * (INT8)flt; a = b * (Uint)flt; a = *(int)&b; a = *(CHAR)&b; a = *(Uint) & b; a = (int)*pb; a = (CHAR)*pb; a = (Uint) * pb; a = (int)'a'; a = (UINT8)'a'; a = (Uint)'a'; a = (int)*'a'; a = (UINT8) * 'a'; a = (Uint) * 'a'; a = (int)*5; a = (UINT) * 5; a = (Uint) * 5; a = (int)*ape; a = (UINT)*ape; a = (Uint) * ape; a = (int)ape; a = (UINT)ape; a = (Uint)ape; a = (int)sizeof(x); a = (INT16)sizeof(x); a = (Uint)sizeof(x); a = (int)foo(x); a = (CHAR)foo(x); a = (Uint)foo(x); a = (int)(x); a = (CHAR)(x); a = (Uint)(x); a = (int)*(x); a = (CHAR)*(x); a = (Uint) * (x); a = (unsigned int)(1 + 4); a = (int)(1 + 1); a = (void *)(&str); } /* foo */ uncrustify-0.59/tests/output/c/00130-minus-minus.c0000644000175000017500000000044211574754744016642 00000000000000int a = 5; int *b = &a; int negneg(void) { return(- -a); } int pospos(void) { return(+ +a); } int negpos(void) { return(- +a); } int posneg(void) { return(+ -a); } #if VERSION < -5 int negnegneg(void) { return(- - -a); } #else int negat(void) { return(-*b); } #endif uncrustify-0.59/tests/output/c/00107-bugs-7.c0000644000175000017500000000037011574754744015466 00000000000000 struct somestruct * mult2(int val); somestruct * dumb_func(int val); struct somestruct * mult2(int val) { int a; a = val + (foo * bar); a = val + (bar); a = val + (CFoo::bar_t)7; a = val + (myfoo.size); return(NULL); } uncrustify-0.59/tests/output/c/00052-brace-remove2.c0000644000175000017500000000107511574754744017015 00000000000000/* else is tied to if(two) */ int main() { if (one) { if (two) sleep (1); else sleep (2); } if (three) sleep(1); else if (four) sleep(2); } /* else is tied to if(one) */ int main() { if (one) { if (two) sleep (1); } else if (three) sleep (2); } /* else.1 is tied to if(two), else.2 is tied to if(one) */ int main() { if (one) { if (two) sleep (1); else if (three) sleep (2); } else sleep (3); } int main() { if (read_write == I2C_SMBUS_READ) msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; else msg[0].len = data->block[0] + 1; } uncrustify-0.59/tests/output/c/00405-bits.c0000644000175000017500000000014311574754744015322 00000000000000struct foo { unsigned long bar; u_int ndots : 4, nsort : 4, : 0; }; uncrustify-0.59/tests/output/c/02300-preproc-if.c0000644000175000017500000000047411631561414016412 00000000000000 int main() { int a; #ifndef SOMEDEF int b; #endif /* SOMEDEF */ if (a) { } #ifndef SOMEDEF else if (b) { } #endif /* SOMEDEF */ /* same thing w/o preprocs for reference */ if (a) { } else if (b) { } #ifdef FOO do { Foo(); } #endif while (Loop--); } uncrustify-0.59/tests/output/c/00903-code_width.c0000644000175000017500000000374211574754744016505 00000000000000 static int short_function_name(struct device *dev, struct device_driver *drv); /* Assuming a 60-column limit */ static int short_function_name(struct device *dev, struct device_driver *drv) { this->translateLabels(labelID, completedLabelID, selectedLabelID, text, selectedText, completedText, fontId, selectedFontId, completedFontId); call_some_really_long_function.of_some_sort(some_long_parameter1, some_long_parameter2); abc = call_some_other_really_long_function.of_some_sort( some_long_parameter1, some_long_parameter2); abc.def.ghi = call_some_other_really_long_function.of_some_sort( some_long_parameter1, some_long_parameter2); abcdefghijklmnopqrstuvwxyz = abc + def + ghi + jkl + mno + prq + stu + vwx + yz; return 1; } static void some_really_long_function_name(struct device *dev, struct device_driver *drv) { if ((some_variable_name && somefunction(param1, param2, param3))) { asdfghjk = asdfasdfasd.aasdfasd + (asdfasd.asdas * 1234.65); } for (struct something_really_really_excessive *a_long_ptr_name = get_first_item(); a_long_ptr_name != NULL; a_long_ptr_name = get_next_item(a_long_ptr_name)) { } for (a = get_first(); a != NULL; a = get_next(a)) { } for (a_ptr = get_first(); a_ptr != NULL; a_ptr = get_next(a)) { } register_clcmd( "examine", "do_examine", -1, "-Allows a player to examine the health and armor of a teammate" ); register_clcmd( "/examine", "do_examine", -1, "-Allows a player to examine the health and armor of a teammate" ); } uncrustify-0.59/tests/output/c/00615-pp-nest.c0000644000175000017500000000014611574754744015755 00000000000000#if AA int foo() { # if BB # else # if CC # else # endif # endif } #endif int bar() { } uncrustify-0.59/tests/output/c/00911-pascal_ptr.c0000644000175000017500000000017311574754744016516 00000000000000foobar_t* a; int* b; int* c; something no; char* main() { int i = (5 * 3) + 2; } void foo(int* a, int* b, int* c) {} uncrustify-0.59/tests/output/c/02311-pragma.c0000644000175000017500000000047111631561414015612 00000000000000 #pragma do not change anything in this pragma! // This next bit should parse as '#', pragma, preproc-body, nl-cont, // preproc-body, nl-cont, preproc-body #pragma multi \ line \ pragma #pragma mark -------- Protected Member Functions ---------------- #pragma some comment follows // comment uncrustify-0.59/tests/output/c/00092-cond.c0000644000175000017500000000020011574754744015300 00000000000000 int foo1(bool b, int tv, int fv) { return b ? tv : fv; } int foo2(bool b, int tv, int fv) { return b ? tv : fv; } uncrustify-0.59/tests/output/c/00513-bool-pos.c0000644000175000017500000000201711574754744016115 00000000000000void foo(void) { if ((a != 0) && (b == 0) && (c < 0) && (d > 0)) { printf("hi"); } if (flag1 #ifdef FLAG2 || flag2 #endif ) { printf("yar"); } if (flag1 && #ifdef FLAG2 flag2 && #endif flag3) { printf("bo"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if (!this->writeOwiFile () // comment1 || broken () || !saveArchiveData () /* comment2 */ || broken () || !deleteCentralArchive () // comment3 || broken () || !copyArchivFiles () // comment4 || broken () || !appendToPlanetDb ()) // comment5 { ; } foobar(param1 , param2 , param3 , param4); foobar2(param1 , param2 , param3 , param4); } uncrustify-0.59/tests/output/c/00050-brace-remove.c0000644000175000017500000000136611574754744016734 00000000000000 void foo(void) { int a = 0; while (a < 3) a++; while (b < a) b++; do a--; while (a > 0); for (a = 0; a < 10; a++) printf("a=%d\n", a); if (a == 10) printf("a looks good\n"); if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) a *= a; } } while (*ptr++ != ',') { } } // mod_full_brace_for = remove should not remove the braces in this example: int main() { if(true) // indent=1 for(int i = 0; i < 3; i++) { if(false) continue; // indent=4 } else return; // indent=2 } // mod_full_brace_if = remove should not remove the braces in this example: int main() { if(true) { for(int i = 0; i < 3; i++) if(false) continue; // indent=4 } else return; // indent=2 } uncrustify-0.59/tests/output/c/02103-output.cpp0000644000175000017500000003542711631561414016253 00000000000000/** * @file output.cpp * Does all the output & comment formatting. * * $Id: output.cpp 510 2006-09-20 01:14:56Z bengardner $ */ #include "uncrustify_types.h" #include "prototypes.h" #include "chunk_list.h" #include #include void add_char(char ch) { /* convert a newline into the LF/CRLF/CR sequence */ if (ch == '\n') { fputs(cpd.newline, cpd.fout); cpd.column = 1; cpd.did_newline = 1; } else { fputc(ch, cpd.fout); if (ch == '\t') cpd.column = next_tab_column(cpd.column); else cpd.column++; } } void add_text(const char *text) { char ch; while ((ch = *text) != 0) { text++; add_char(ch); } } void add_text_len(const char *text, int len) { while (len-- > 0) { add_char(*text); text++; } } /** * Advance to a specific column * cpd.column is the current column * * @param column The column to advance to */ void output_to_column(int column, bool allow_tabs) { int nc; cpd.did_newline = 0; if (allow_tabs) { /* tab out as far as possible and then use spaces */ while ((nc = next_tab_column(cpd.column)) <= column) add_text("\t"); } /* space out the final bit */ while (cpd.column < column) add_text(" "); } void output_indent(int column, int brace_col) { if ((cpd.column == 1) && (cpd.settings[UO_indent_with_tabs].n != 0)) { if (cpd.settings[UO_indent_with_tabs].n == 2) brace_col = column; /* tab out as far as possible and then use spaces */ int nc; while ((nc = next_tab_column(cpd.column)) <= brace_col) add_text("\t"); } /* space out the rest */ while (cpd.column < column) add_text(" "); } void output_parsed(FILE *pfile) { chunk_t *pc; int cnt; output_options(pfile); output_defines(pfile); output_types(pfile); fprintf(pfile, "-=====-\n"); fprintf(pfile, "Line Tag Parent Columns Br/Lvl/pp Flg Nl Text"); for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { fprintf(pfile, "\n%3d> %13.13s[%13.13s][%2d/%2d/%2d][%d/%d/%d][%6x][%d-%d]", pc->orig_line, get_token_name(pc->type), get_token_name(pc->parent_type), pc->column, pc->orig_col, pc->orig_col_end, pc->brace_level, pc->level, pc->pp_level, pc->flags, pc->nl_count, pc->after_tab); if ((pc->type != CT_NEWLINE) && (pc->len != 0)) { for (cnt = 0; cnt < pc->column; cnt++) fprintf(pfile, " "); fprintf(pfile, "%.*s", pc->len, pc->str); } } fprintf(pfile, "\n-=====-\n"); fflush(pfile); } void output_options(FILE *pfile) { int idx; const option_map_value *ptr; fprintf(pfile, "-== Options ==-\n"); for (idx = 0; idx < UO_option_count; idx++) { ptr = get_option_name(idx); if (ptr != NULL) { if (ptr->type == AT_BOOL) { fprintf(pfile, "%3d) %32s = %s\n", ptr->id, ptr->name, cpd.settings[ptr->id].b ? "True" : "False"); } else if (ptr->type == AT_IARF) { fprintf(pfile, "%3d) %32s = %s\n", ptr->id, ptr->name, (cpd.settings[ptr->id].a == AV_ADD) ? "Add" : (cpd.settings[ptr->id].a == AV_REMOVE) ? "Remove" : (cpd.settings[ptr->id].a == AV_FORCE) ? "Force" : "Ignore"); } else if (ptr->type == AT_LINE) { fprintf(pfile, "%3d) %32s = %s\n", ptr->id, ptr->name, (cpd.settings[ptr->id].le == LE_AUTO) ? "Auto" : (cpd.settings[ptr->id].le == LE_LF) ? "LF" : (cpd.settings[ptr->id].le == LE_CRLF) ? "CRLF" : (cpd.settings[ptr->id].le == LE_CR) ? "CR" : "???"); } else /* AT_NUM */ fprintf(pfile, "%3d) %32s = %d\n", ptr->id, ptr->name, cpd.settings[ptr->id].n); } } } /** * This renders the chunk list to a file. */ void output_text(FILE *pfile) { chunk_t *pc; chunk_t *prev; int cnt; int lvlcol; bool allow_tabs; cpd.fout = pfile; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type == CT_NEWLINE) { for (cnt = 0; cnt < pc->nl_count; cnt++) add_char('\n'); cpd.did_newline = 1; cpd.column = 1; LOG_FMT(LOUTIND, " xx\n"); } else if (pc->type == CT_COMMENT_MULTI) output_comment_multi(pc); else if (pc->type == CT_COMMENT_CPP) pc = output_comment_cpp(pc); else if (pc->len == 0) /* don't do anything for non-visible stuff */ LOG_FMT(LOUTIND, " <%d> -", pc->column); else { /* indent to the 'level' first */ if (cpd.did_newline) { if (cpd.settings[UO_indent_with_tabs].n == 1) { lvlcol = 1 + (pc->brace_level * cpd.settings[UO_indent_columns].n); if ((pc->column >= lvlcol) && (lvlcol > 1)) output_to_column(lvlcol, true); } allow_tabs = (cpd.settings[UO_indent_with_tabs].n == 2) || (chunk_is_comment(pc) && (cpd.settings[UO_indent_with_tabs].n != 0)); LOG_FMT(LOUTIND, " %d> col %d/%d - ", pc->orig_line, pc->column, cpd.column); } else { /* not the first item on a line */ if (cpd.settings[UO_align_keep_tabs].b) allow_tabs = pc->after_tab; else { prev = chunk_get_prev(pc); allow_tabs = (cpd.settings[UO_align_with_tabs].b && ((pc->flags & PCF_WAS_ALIGNED) != 0) && (((pc->column - 1) % cpd.settings[UO_output_tab_size].n) == 0) && ((prev->column + prev->len + 1) != pc->column)); } LOG_FMT(LOUTIND, " %d -", pc->column); } output_to_column(pc->column, allow_tabs); add_text_len(pc->str, pc->len); cpd.did_newline = chunk_is_newline(pc); } } } /** * Given a multi-line comemnt block that starts in column X, figure out how * much subsequent lines should be indented. * * The answer is either 0 or 1. * * The decision is based on: * - the first line length * - the second line leader length * - the last line length * * If the first and last line are the same length and don't contain any alnum * chars and (the first line len > 2 or the second leader is the same as the * first line length), then the indent is 0. * * If the leader on the second line is 1 wide or missing, then the indent is 1. * * Otherwise, the indent is 0. * * @param str The comment string * @param len Length of the comment * @param start_col Starting column * @return 0 or 1 */ static int calculate_comment_body_indent(const char *str, int len, int start_col) { int idx = 0; int first_len = 0; int last_len = 0; int width = 0; /* find the last line length */ for (idx = len - 1; idx > 0; idx--) { if ((str[idx] == '\n') || (str[idx] == '\r')) { idx++; while ((idx < len) && ((str[idx] == ' ') || (str[idx] == '\t'))) idx++; last_len = len - idx; break; } } /* find the first line length */ for (idx = 0; idx < len; idx++) { if ((str[idx] == '\n') || (str[idx] == '\r')) { first_len = idx; while ((str[first_len - 1] == ' ') || (str[first_len - 1] == '\t')) first_len--; /* handle DOS endings */ if ((str[idx] == '\r') && (str[idx + 1] == '\n')) idx++; idx++; break; } } /* Scan the second line */ width = 0; for (/* nada */; idx < len; idx++) { if ((str[idx] == ' ') || (str[idx] == '\t')) { if (width > 0) break; continue; } if ((str[idx] == '\n') || (str[idx] == '\r')) /* Done with second line */ break; /* Count the leading chars */ if ((str[idx] == '*') || (str[idx] == '|') || (str[idx] == '\\') || (str[idx] == '#') || (str[idx] == '+')) width++; else break; } //LOG_FMT(LSYS, "%s: first=%d last=%d width=%d\n", __func__, first_len, last_len, width); /*TODO: make the first_len minimum (4) configurable? */ if ((first_len == last_len) && ((first_len > 4) || first_len == width)) return 0; return (width == 2) ? 0 : 1; } /** * Outputs the CPP comment at pc. * CPP comment combining is done here * * @return the last chunk output'd */ chunk_t *output_comment_cpp(chunk_t *first) { int col = first->column; int col_br = 1 + (first->brace_level * cpd.settings[UO_indent_columns].n); /* Make sure we have at least one space past the last token */ if (first->parent_type == CT_COMMENT_END) { chunk_t *prev = chunk_get_prev(first); if (prev != NULL) { int col_min = prev->column + prev->len + 1; if (col < col_min) col = col_min; } } /* Bump out to the column */ output_indent(col, col_br); if (!cpd.settings[UO_cmt_cpp_to_c].b) { add_text_len(first->str, first->len); return first; } /* If we are grouping, see if there is something to group */ bool combined = false; if (cpd.settings[UO_cmt_cpp_group].b) { /* next is a newline by definition */ chunk_t *next = chunk_get_next(first); if ((next != NULL) && (next->nl_count == 1)) { next = chunk_get_next(next); /** * Only combine the next comment if they are both at indent level or * the second one is NOT at indent or less * * A trailing comment cannot be combined with a comment at indent * level or less */ if ((next != NULL) && (next->type == CT_COMMENT_CPP) && (((next->column == 1) && (first->column == 1)) || ((next->column == col_br) && (first->column == col_br)) || ((next->column > col_br) && (first->parent_type == CT_COMMENT_END)))) combined = true; } } if (!combined) { /* nothing to group: just output a single line */ add_text_len("/*", 2); if ((first->str[2] != ' ') && (first->str[2] != '\t')) add_char(' '); add_text_len(&first->str[2], first->len - 2); add_text_len(" */", 3); return first; } chunk_t *pc = first; chunk_t *last = first; /* Output the first line */ add_text_len("/*", 2); if (combined && cpd.settings[UO_cmt_cpp_nl_start].b) /* I suppose someone more clever could do this without a goto or * repeating too much code... */ goto cpp_newline; goto cpp_addline; /* Output combined lines */ while ((pc = chunk_get_next(pc)) != NULL) { if ((pc->type == CT_NEWLINE) && (pc->nl_count == 1)) continue; if (pc->type != CT_COMMENT_CPP) break; if (((pc->column == 1) && (first->column == 1)) || ((pc->column == col_br) && (first->column == col_br)) || ((pc->column > col_br) && (first->parent_type == CT_COMMENT_END))) { last = pc; cpp_newline: add_char('\n'); output_indent(col, col_br); add_char(' '); add_char(cpd.settings[UO_cmt_star_cont].b ? '*' : ' '); cpp_addline: if ((pc->str[2] != ' ') && (pc->str[2] != '\t')) add_char(' '); add_text_len(&pc->str[2], pc->len - 2); } } if (cpd.settings[UO_cmt_cpp_nl_end].b) { add_char('\n'); output_indent(col, col_br); } add_text_len(" */", 3); return last; } void output_comment_multi(chunk_t *pc) { int cmt_col = pc->column; const char *cmt_str; int remaining; char ch; chunk_t *prev; char line[1024]; int line_len; int line_count = 0; int ccol; int col_diff = 0; int xtra = 1; prev = chunk_get_prev(pc); if ((prev != NULL) && (prev->type != CT_NEWLINE)) cmt_col = pc->orig_col; else col_diff = pc->orig_col - pc->column; // fprintf(stderr, "Indenting1 line %d to col %d (orig=%d) col_diff=%d\n", // pc->orig_line, cmt_col, pc->orig_col, col_diff); xtra = calculate_comment_body_indent(pc->str, pc->len, pc->column); ccol = 1; remaining = pc->len; cmt_str = pc->str; line_len = 0; while (remaining > 0) { ch = *cmt_str; cmt_str++; remaining--; /* handle the CRLF and CR endings. convert both to LF */ if (ch == '\r') { ch = '\n'; if (*cmt_str == '\n') { cmt_str++; remaining--; } } /* Find the start column */ if (line_len == 0) { if (ch == ' ') { ccol++; continue; } else if (ch == '\t') { ccol = calc_next_tab_column(ccol, cpd.settings[UO_input_tab_size].n); continue; } else { //fprintf(stderr, "%d] Text starts in col %d\n", line_count, ccol); } } line[line_len++] = ch; /* If we just hit an end of line OR we just hit end-of-comment... */ if ((ch == '\n') || (remaining == 0)) { line_count++; /* strip trailing tabs and spaces before the newline */ if (ch == '\n') { line_len--; while ((line_len > 0) && ((line[line_len - 1] == ' ') || (line[line_len - 1] == '\t'))) line_len--; line[line_len++] = ch; } line[line_len] = 0; if (line_count == 1) { /* this is the first line - add unchanged */ /*TODO: need to support indent_with_tabs mode 1 */ output_to_column(cmt_col, cpd.settings[UO_indent_with_tabs].b); add_text_len(line, line_len); } else { /* This is not the first line, so we need to indent to the * correct column. */ ccol -= col_diff; if (ccol < cmt_col) ccol = cmt_col; if (line[0] == '\n') { /* Emtpy line - just a '\n' */ if (cpd.settings[UO_cmt_star_cont].b) { output_to_column(cmt_col, cpd.settings[UO_indent_with_tabs].b); add_text((xtra == 1) ? " *" : "*"); } add_char('\n'); } else { /* If this doesn't start with a '*' or '|' */ if ((line[0] != '*') && (line[0] != '|') && (line[0] != '#') && (line[0] != '\\') && (line[0] != '+')) { output_to_column(cmt_col, cpd.settings[UO_indent_with_tabs].b); if (cpd.settings[UO_cmt_star_cont].b) add_text((xtra == 1) ? " * " : "* "); else add_text(" "); output_to_column(ccol, cpd.settings[UO_indent_with_tabs].b); } else output_to_column(cmt_col + xtra, cpd.settings[UO_indent_with_tabs].b); add_text_len(line, line_len); } } line_len = 0; ccol = 1; } } } uncrustify-0.59/tests/output/c/00135-br_cmt.c0000644000175000017500000000023011574754744015624 00000000000000int main() { if( foo == bar ) { /* this works */ a; }else if( ranz != bar ) { /* this works too */ b; }else { /* this is broken */ c; } } uncrustify-0.59/tests/output/c/00001-comment-indent.c0000644000175000017500000000120211574754744017267 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; /* trailing comment */ /* that spans two lines */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; /* some comment */ /* almost continued, but a NL in between */ /* col1 comment in level 1 */ /* second comment */ return(res); } /* col1 comment in level 0 */ /* and another */ void foo() { if( bar ) { foo(); } /*else if( bar2 ) * { * foo2(); * } */else if( bar3 ) { foo3(); } } uncrustify-0.59/tests/output/c/02412-ifdef-indent.c0000644000175000017500000000054611631561414016704 00000000000000#ifdef foo #include #else #include #endif int show_interrupts(struct seq_file *p, void *v) { #ifndef CONFIG_SMP a++; #else for (b = 0; b < 9; b++) if (b & 1) k++; #endif if (v) { bar(v); #if DEBUG == 1 printf("yup\n"); #endif } } void foo() { int i=0; #if DEBUG == 1 i--; #endif i++; } uncrustify-0.59/tests/output/c/01002-mod-paren.c0000644000175000017500000000200511642735444016224 00000000000000int foo(int a, int b) { if (!(a || b)) { return 1; } return 0; } void fooo() { if (enabled) { value = 1; } if (enabled && (value == 100)) { } if (value == 100) { } if ((value == 100) && (i < 15) || enabled) { } if (!failed && ((value == 100) && (i < 15)) || enabled) { } } void foo3() { if ((strcmp(a, b) == 0) && (total < 5)) { add_item(a); } if (glob_add_path(gd, gd->dir, NULL, (flags & GLOB_MARK) && S_ISDIR(gd->st.st_mode)) != 0) { bar(); } return; } int foo1(void) { FOO_ERROR("connect: can only connected from state CLOSED", pcb->state == CLOSED, return ERR_ISCONN); return ERR_OK; } int foo2(void) { return -1; } void foo(void) { if (!value #ifdef OPTION || value == SOMECONST #endif /* comment */ ) { } } void foo3(void) { if ((*p == '-') && (p[1] != ']') ? (*text <= *++p) && (*text >= last) : (*text == *p)) { matched = TRUE; } } uncrustify-0.59/tests/output/c/00121-sp_cmt_cpp_start.c0000644000175000017500000000006411574754744017722 00000000000000 // zero // one // two // three void foo(void); uncrustify-0.59/tests/output/c/00122-sp_cmt_cpp_start.c0000644000175000017500000000006111574754744017720 00000000000000 // zero // one // two // three void foo(void); uncrustify-0.59/tests/output/c/00011-braces.c0000644000175000017500000000355611574754744015624 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) // trailing C++ comment b++; do // trailing C++ comment { a--; } while (a > 0); do a--; while (a > 0); for (a = 0; a < 10; a++) // trailing C++ comment { printf("a=%d\n", a); } if (a == 10) // trailing C++ comment { printf("a looks good\n"); } else // trailing C++ comment { printf("not so good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } else if (b != 0) a /= b; else // trailing C++ comment a += b; } } list_for_each(k) { if (a) if (b) { c++; } } while (1) ; /* hang forever */ } void f() { if (buf[0] == '~' && strchr(tmp, '/') == NULL) { buf = mallocstrcpy(buf, tmp); matches = username_tab_completion(tmp, &num_matches); } /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ else if (strlen(buf) > strlen(tmp)) buf = mallocstrcpy(buf, tmp); } void f() { } void g() { } uncrustify-0.59/tests/output/c/00072-align-proto.c0000644000175000017500000000015011574754744016612 00000000000000unsigned int align_here(); int this_works(int x); int bug(int); // BUG: left-aligned uncrustify-0.59/tests/output/c/01007-mod_case_brace.c0000644000175000017500000000157011574754744017273 00000000000000int foo(int bar) { switch (bar) { case 0: { showit(0); } c++; break; case 1: { showit(bar); break; } case 2: { break; } case 3: { int a = bar * 3; showit(a); } c++; break; case 4: { foo(bar - 1); { showit(0); } } case 10: { switch (gl_bug) { case 'a': { gl_foo = true; break; } case 'b': case 'c': { gl_foo = false; break; } default: { // nothing break; } } break; } default: { break; } } return(-1); } uncrustify-0.59/tests/output/c/00143-t3.in.c0000644000175000017500000000036011574754744015314 00000000000000extern /*@observer@*/ /*@null@*/ const dcroid_t *dcrp_oidget ( /*@in@*/ const char *h, /*@in@*/ const char *t ) /*@ensures maxRead(result) >= 0@*/; extern /*@observer@*/ const char *dcrp_oidlabel ( /*@in@*/ const dcroid_t *oid ); uncrustify-0.59/tests/output/c/00611-pp-space.c0000644000175000017500000000073111574754744016073 00000000000000/** * Some file header comment thingy. */ #ifndef SOME_H_INCLUDED #define SOME_H_INCLUDED #include "Somefile.h" #define SOMEMACRO (1+4) #ifdef WIN32 #include "windows_compat.h" #else /* not WIN32 */ #if defined HAVE_STDINT_H #include #elif defined HAVE_INTTYPES_H #include #define YOUR_OS_SUCKS #else #error "Don't know where int8_t is defined" #endif typedef uint32_t UINT32; #endif /* ifdef WIN32 */ #endif /* SOME_H_INCLUDED */ uncrustify-0.59/tests/output/c/00104-bugs-4.c0000644000175000017500000000163611574754744015466 00000000000000 static void set_md_connected(CHAR *msg_data) { UINT32 rd_idx = 0; CHAR mobile_device_id[MOBILE_DEVICE_NAME_LEN]; CHAR ip_addr[IP_ADDRESS_LEN]; CHAR mac_addr[MAC_ADDR_LEN]; CHAR ap_name[AP_NAME_LEN]; rdc_strz(msg_data, MAX_SIZE, &rd_idx, mobile_device_id, 0); rdc_strz(msg_data, MAX_SIZE, &rd_idx, ip_addr, 0); rdc_strz(msg_data, MAX_SIZE, &rd_idx, mac_addr, 0); rdc_strz(msg_data, MAX_SIZE, &rd_idx, ap_name, 0); #if defined (DB_MGR_ORACLE) (void)db_set_md_connected(mobile_device_id, ip_addr, mac_addr, ap_name); LOG(LFTR, "CONNECTED Loco %s, IP Addr %s,MAC Addr %s, AP Name %s", mobile_device_id, ip_addr, mac_addr, ap_name); #elif defined (DB_MGR_FILE) LOG(LFTR, "%s CONNECTED Loco %s, IP Addr %s,MAC Addr %s, AP Name %s", status_str, mobile_device_id, ip_addr, mac_addr, ap_name); #else #error Unknown device type must be DB_MGR_ORACLE or DB_MGR_FILE #endif } uncrustify-0.59/tests/output/c/02431-cmt_right_align.c0000644000175000017500000000143111631561414017475 00000000000000 int foo1(int bar) { if(bar) { if(b) { if(a) { if(r) { return(r); /* cool */ } else /* if (r) */ { return(bar); /* uncool */ } /* if (r) */ } /* if (a) */ } /* if (b) */ } /* if (bar) */ return(-1); } /* foo */ int foo2(int bar) { if(bar) { if(b) { if(a) { if(r) { return(r); } else { return(bar); } /* if (r) */ } /* if (a) */ } /* if (b) */ } /* if (bar) */ return(-1); } /* foo */ uncrustify-0.59/tests/output/c/00142-type-cast.c0000644000175000017500000000031311574754744016267 00000000000000 void foo(void) { drab bar; bar = (bat) * r; bar = (int)*r; bar = (UINT8)*r; bar = (time_t)*r; a = &arg[dog * 13]; b = arg[dog * cat]; hc = "0123456789ABCDEF"[0xf & *val]; } uncrustify-0.59/tests/output/c/00401-align-equ.c0000644000175000017500000000050611574754744016242 00000000000000 // note - set threshold to three void foo(void) { a = 1; bb = 2; ccc = 3; dddd = 4; eeeee = 5; ffffff = 6; a = 1; eeeeee = 5; fffffff = 6; a = 1; eeeee = 5; ccc = 3; ffffff = 6; a = 1; iiiiiiiiiiiiieeeee = 5; ccc = 3; ffffff = 6; } uncrustify-0.59/tests/output/c/00091-cond.c0000644000175000017500000000017211574754744015307 00000000000000 int foo1(bool b, int tv, int fv) { return b ? tv : fv; } int foo2(bool b, int tv, int fv) { return b ? tv : fv; } uncrustify-0.59/tests/output/c/00161-fcn_indent.c0000644000175000017500000000106311574754744016471 00000000000000int this_is_a_function_proto(int a, char * b); int this_is_a_function_def(int a, char * b) { this_is_a_function_call(a, b); a = another_function_call(a, b); } typedef short (*hello1)(char coolParam, ushort *, unsigned int anotherone); short (*hello2)(char coolParam, ulong *, uchar, unsigned int anotherone); short hello3 (char coolParam, ushort *, unsigned int anotherone); uncrustify-0.59/tests/output/c/00302-one-liner-init.c0000644000175000017500000000060611631036553017173 00000000000000 enum boo { FOO = 1 }; void foo(void) { char str[123] = { 0 }; enum hoo { NOO = 1 }; strcat(str, "foo"); } void f() { if (bar()) { baz(1); } else { baz(2); } } int foo() { return(0); } void foo(int a, int b) { if (a == b) { a++; } else { b++; } if (a == b) { a++; } else { b++; } } uncrustify-0.59/tests/output/c/01005-mod_case_brace.c0000644000175000017500000000155411574754744017273 00000000000000int foo(int bar) { switch (bar) { case 0: { showit(0); } c++; break; case 1: { showit(bar); break; } case 2: { } break; case 3: { int a = bar * 3; showit(a); } c++; break; case 4: { foo(bar - 1); { showit(0); } } case 10: { switch (gl_bug) { case 'a': { gl_foo = true; break; } case 'b': case 'c': { gl_foo = false; break; } default: { // nothing } break; } } break; default: { } break; } return(-1); } uncrustify-0.59/tests/output/c/00320-indent_first_bool_expr.c0000644000175000017500000000137211574754744021123 00000000000000void test(void) { b1 = a & b || c == d; b2 = (a & b) || c == d; b3 = ( a & b || c == d); if ( (a == 3) && (b == 2 & c) || d && r) { } if ( /*test*/ a || b) { } if ( /*test*/ a || /*truc*/ b) { } if ( a /*test*/ || b) { } if ( a || /*test*/ b) { } a = 3; if ( (aaaaaaaaaaaaaaa == sqddqsqsdqsdqsd) && ( dfdssdfsdfsdfsdfs || (qsdfsdfsdfqsdfqsdfqsdsd == fsdqfsdfsdfsdf))) { a++; } while ( (aaaaaaaaaaaaaaa == sqddqsqsdqsdqsd) && ( dfdssdfsdfsdfsdfs || (qsdfsdfsdfqsdfqsdfqsdsd == fsdqfsdfsdfsdf))) { a++; } } uncrustify-0.59/tests/output/c/00202-case.c0000644000175000017500000000150611574754744015273 00000000000000void foo(void) { switch(ch) { // handle 'a' case 'a': { handle_a(); multiline(123, 345); break; } // handle 'b' case 'b': handle_b(); multiline(123, 345); break; // handle 'c' and 'd' case 'c': case 'd': // c and d are really the same thing handle_cd(); multiline(123, 345); break; case 'e': { handle_a(); multiline(123, 345); break; } // case1 case (case1): { //do stuff break; } case (case2): { //do stuff break; } case (case3): /*do stuff*/ break; case (case3): statement(); { another_statement(); } break; // really should not get here default: handle_default(); multiline(123, 345); break; } multiline(123, 345); } uncrustify-0.59/tests/output/c/02302-nl-cont.c0000644000175000017500000000131411631561414015712 00000000000000 #define FOO(bar) create_a_really_long_identifier name(some_function( \ bar1 + bar2), bar3, \ bar4); #define VNV_RECORD_CYCLES(m) do { \ uint16_t cyc_out = ((uint16_t )TMR4) - cyc_in; \ if (cyc_out < vnv_ticks[m].min) vnv_ticks[m].min = cyc_out; \ if (cyc_out > vnv_ticks[m].max) vnv_ticks[m].max = cyc_out; \ } while (0) #define multilinemacro do { (x+5); } while (0); \ printf("a multilinemacro"); \ printf("a multilinemacro2"); int main(int argc, char *argv[]) { int a, b; a = 1; /* stupid comment \\ */ b = 2; return(a+b); } uncrustify-0.59/tests/output/c/01006-mod_case_brace.c0000644000175000017500000000120011630773174017247 00000000000000int foo(int bar) { switch (bar) { case 0: { showit(0); } c++; break; case 1: showit(bar); break; case 2: break; case 3: { int a = bar * 3; showit(a); } c++; break; case 4: foo(bar - 1); { showit(0); } case 10: switch (gl_bug) { case 'a': gl_foo = true; break; case 'b': case 'c': gl_foo = false; break; default: // nothing break; } break; default: break; } return(-1); } uncrustify-0.59/tests/output/c/00012-braces.c0000644000175000017500000000221311574754744015612 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) // trailing C++ comment b++; do { // trailing C++ comment a--; } while (a > 0); do a--; while (a > 0); for (a = 0; a < 10; a++) { // trailing C++ comment printf("a=%d\n", a); } if (a == 10) { // trailing C++ comment printf("a looks good\n"); } else { // trailing C++ comment printf("not so good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } else if (b != 0) a /= b; else // trailing C++ comment a += b; } } list_for_each(k) { if (a) if (b) { c++; } } while (1) ; /* hang forever */ } void f() { if (buf[0] == '~' && strchr(tmp, '/') == NULL) { buf = mallocstrcpy(buf, tmp); matches = username_tab_completion(tmp, &num_matches); } /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ else if (strlen(buf) > strlen(tmp)) buf = mallocstrcpy(buf, tmp); } void f() { } void g() { } uncrustify-0.59/tests/output/c/02454-nl_return_expr.c0000644000175000017500000000030511631561414017415 00000000000000 int foo1(void) { return (NewClass(1)); } int foo2(void) { return (NewClass(2)); } int foo3(void) { return (3); } int foo4(void) { return (4); } uncrustify-0.59/tests/output/c/00432-paren-indent.c0000644000175000017500000000133511574754744016751 00000000000000static void *foo(int param1, char *param2 ); static void *foo ( int param1, char *param2 ) { for ( int i = 0; i< 10; i++ ) { bar( arg1, arg2 ); if ( ( abc < bcd ) &&( 123 < abc ) ) { none(arg1, arg2, arg3 ); } } } void CWarningAnalyzer::SetEffect(int FilterNumber ,bool Exclude , int Red , int Green , int Blue , bool Italic , bool Bold , bool Underlined ) { /* TODO */ } uncrustify-0.59/tests/output/c/00081-else-if.c0000644000175000017500000000051611574754744015711 00000000000000int test (int A, int B) { int C; if (A == 0) if (B == 0) C = 1; else if (B == 1) C = 2; else C = 3; else if (A == 1) if (B == 0) C = 4; else if (B == 1) C = 5; else C = 6; else if (B == 0) C = 7; else if (B == 1) C = 8; else C = 9; return C; } uncrustify-0.59/tests/output/c/01000-mod-paren.c0000644000175000017500000000201111642735444016217 00000000000000int foo(int a, int b) { if (!(a || b)) { return(1); } return(0); } void fooo() { if (enabled) { value = 1; } if (enabled && (value == 100)) { } if (value == 100) { } if ((value == 100) && (i < 15) || enabled) { } if (!failed && ((value == 100) && (i < 15)) || enabled) { } } void foo3() { if ((strcmp(a, b) == 0) && (total < 5)) { add_item(a); } if (glob_add_path(gd, gd->dir, NULL, (flags & GLOB_MARK) && S_ISDIR(gd->st.st_mode)) != 0) { bar(); } return; } int foo1(void) { FOO_ERROR("connect: can only connected from state CLOSED", pcb->state == CLOSED, return ERR_ISCONN); return(ERR_OK); } int foo2(void) { return(-1); } void foo(void) { if (!value #ifdef OPTION || value == SOMECONST #endif /* comment */ ) { } } void foo3(void) { if ((*p == '-') && (p[1] != ']') ? (*text <= *++p) && (*text >= last) : (*text == *p)) { matched = TRUE; } } uncrustify-0.59/tests/output/c/02315-pp_ret.c0000644000175000017500000000012711631561414015636 00000000000000#if 0 int #else unsigned #endif f() { return 0; } #ifdef FOO #define BAR . #endif uncrustify-0.59/tests/output/c/02100-i2c-core.c0000644000175000017500000010553311631561414015747 00000000000000/* i2c-core.c - a device driver for the iic-bus interface */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-99 Simon G. Vogl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kysti Mlkki . All SMBus-related things are written by Frodo Looijaard SMBus 2.0 support by Mark Studebaker */ #include #include #include #include #include #include #include #include #include static LIST_HEAD(adapters); static LIST_HEAD(drivers); static DECLARE_MUTEX(core_lists); static DEFINE_IDR(i2c_adapter_idr); static int i2c_device_match(struct device *dev, struct device_driver *drv) { return 1; } static int i2c_bus_suspend(struct device * dev, pm_message_t state) { int rc = 0; if (dev->driver && dev->driver->suspend) rc = dev->driver->suspend(dev, state, 0); return rc; } static int i2c_bus_resume(struct device * dev) { int rc = 0; if (dev->driver && dev->driver->resume) rc = dev->driver->resume(dev, 0); return rc; } struct bus_type i2c_bus_type = { .name = "i2c", .match = i2c_device_match, .suspend = i2c_bus_suspend, .resume = i2c_bus_resume, }; static int i2c_device_probe(struct device *dev) { return -ENODEV; } static int i2c_device_remove(struct device *dev) { return 0; } void i2c_adapter_dev_release(struct device *dev) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); complete(&adap->dev_released); } struct device_driver i2c_adapter_driver = { .name = "i2c_adapter", .bus = &i2c_bus_type, .probe = i2c_device_probe, .remove = i2c_device_remove, }; static void i2c_adapter_class_dev_release(struct class_device *dev) { struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev); complete(&adap->class_dev_released); } struct class i2c_adapter_class = { .name = "i2c-adapter", .release = &i2c_adapter_class_dev_release, }; static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); return sprintf(buf, "%s\n", adap->name); } static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); static void i2c_client_release(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); complete(&client->released); } static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); return sprintf(buf, "%s\n", client->name); } /* * We can't use the DEVICE_ATTR() macro here as we want the same filename for a * different type of a device. So beware if the DEVICE_ATTR() macro ever * changes, this definition will also have to change. */ static struct device_attribute dev_attr_client_name = { .attr = { .name = "name", .mode = S_IRUGO, .owner = THIS_MODULE }, .show = &show_client_name, }; /* --------------------------------------------------- * registering functions * --------------------------------------------------- */ /* ----- * i2c_add_adapter is called from within the algorithm layer, * when a new hw adapter registers. A new device is register to be * available for clients. */ int i2c_add_adapter(struct i2c_adapter *adap) { int id, res = 0; struct list_head *item; struct i2c_driver *driver; down(&core_lists); if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) { res = -ENOMEM; goto out_unlock; } res = idr_get_new(&i2c_adapter_idr, adap, &id); if (res < 0) { if (res == -EAGAIN) res = -ENOMEM; goto out_unlock; } adap->nr = id & MAX_ID_MASK; init_MUTEX(&adap->bus_lock); init_MUTEX(&adap->clist_lock); list_add_tail(&adap->list, &adapters); INIT_LIST_HEAD(&adap->clients); /* Add the adapter to the driver core. * If the parent pointer is not set up, * we add this adapter to the host bus. */ if (adap->dev.parent == NULL) adap->dev.parent = &platform_bus; sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); adap->dev.driver = &i2c_adapter_driver; adap->dev.release = &i2c_adapter_dev_release; device_register(&adap->dev); device_create_file(&adap->dev, &dev_attr_name); /* Add this adapter to the i2c_adapter class */ memset(&adap->class_dev, 0x00, sizeof(struct class_device)); adap->class_dev.dev = &adap->dev; adap->class_dev.class = &i2c_adapter_class; strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE); class_device_register(&adap->class_dev); dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); /* inform drivers of new adapters */ list_for_each(item, &drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->flags & I2C_DF_NOTIFY) /* We ignore the return code; if it fails, too bad */ driver->attach_adapter(adap); } out_unlock: up(&core_lists); return res; } int i2c_del_adapter(struct i2c_adapter *adap) { struct list_head *item, *_n; struct i2c_adapter *adap_from_list; struct i2c_driver *driver; struct i2c_client *client; int res = 0; down(&core_lists); /* First make sure that this adapter was ever added */ list_for_each_entry(adap_from_list, &adapters, list) { if (adap_from_list == adap) break; } if (adap_from_list != adap) { pr_debug("i2c-core: attempting to delete unregistered " "adapter [%s]\n", adap->name); res = -EINVAL; goto out_unlock; } list_for_each(item, &drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->detach_adapter) if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } /* detach any active clients. This must be done first, because * it can fail; in which case we give up. */ list_for_each_safe(item, _n, &adap->clients) { client = list_entry(item, struct i2c_client, list); /* detaching devices is unconditional of the set notify * flag, as _all_ clients that reside on the adapter * must be deleted, as this would cause invalid states. */ if ((res = client->driver->detach_client(client))) { dev_err(&adap->dev, "detach_client failed for client " "[%s] at address 0x%02x\n", client->name, client->addr); goto out_unlock; } } /* clean up the sysfs representation */ init_completion(&adap->dev_released); init_completion(&adap->class_dev_released); class_device_unregister(&adap->class_dev); device_remove_file(&adap->dev, &dev_attr_name); device_unregister(&adap->dev); list_del(&adap->list); /* wait for sysfs to drop all references */ wait_for_completion(&adap->dev_released); wait_for_completion(&adap->class_dev_released); /* free dynamically allocated bus id */ idr_remove(&i2c_adapter_idr, adap->nr); dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); out_unlock: up(&core_lists); return res; } /* ----- * What follows is the "upwards" interface: commands for talking to clients, * which implement the functions to access the physical information of the * chips. */ int i2c_add_driver(struct i2c_driver *driver) { struct list_head *item; struct i2c_adapter *adapter; int res = 0; down(&core_lists); /* add the driver to the list of i2c drivers in the driver core */ driver->driver.name = driver->name; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_device_probe; driver->driver.remove = i2c_device_remove; res = driver_register(&driver->driver); if (res) goto out_unlock; list_add_tail(&driver->list, &drivers); pr_debug("i2c-core: driver [%s] registered\n", driver->name); /* now look for instances of driver on our adapters */ if (driver->flags & I2C_DF_NOTIFY) { list_for_each(item, &adapters) { adapter = list_entry(item, struct i2c_adapter, list); driver->attach_adapter(adapter); } } out_unlock: up(&core_lists); return res; } int i2c_del_driver(struct i2c_driver *driver) { struct list_head *item1, *item2, *_n; struct i2c_client *client; struct i2c_adapter *adap; int res = 0; down(&core_lists); /* Have a look at each adapter, if clients of this driver are still * attached. If so, detach them to be able to kill the driver * afterwards. * * Removing clients does not depend on the notify flag, else * invalid operation might (will!) result, when using stale client * pointers. */ list_for_each(item1, &adapters) { adap = list_entry(item1, struct i2c_adapter, list); if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } else { list_for_each_safe(item2, _n, &adap->clients) { client = list_entry(item2, struct i2c_client, list); if (client->driver != driver) continue; dev_dbg(&adap->dev, "detaching client [%s] " "at 0x%02x\n", client->name, client->addr); if ((res = driver->detach_client(client))) { dev_err(&adap->dev, "detach_client " "failed for client [%s] at " "0x%02x\n", client->name, client->addr); goto out_unlock; } } } } driver_unregister(&driver->driver); list_del(&driver->list); pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); out_unlock: up(&core_lists); return 0; } static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr) { struct list_head *item; struct i2c_client *client; list_for_each(item, &adapter->clients) { client = list_entry(item, struct i2c_client, list); if (client->addr == addr) return -EBUSY; } return 0; } int i2c_check_addr(struct i2c_adapter *adapter, int addr) { int rval; down(&adapter->clist_lock); rval = __i2c_check_addr(adapter, addr); up(&adapter->clist_lock); return rval; } int i2c_attach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; down(&adapter->clist_lock); if (__i2c_check_addr(client->adapter, client->addr)) { up(&adapter->clist_lock); return -EBUSY; } list_add_tail(&client->list, &adapter->clients); up(&adapter->clist_lock); if (adapter->client_register) { if (adapter->client_register(client)) { dev_dbg(&adapter->dev, "client_register " "failed for client [%s] at 0x%02x\n", client->name, client->addr); } } if (client->flags & I2C_CLIENT_ALLOW_USE) client->usage_count = 0; client->dev.parent = &client->adapter->dev; client->dev.driver = &client->driver->driver; client->dev.bus = &i2c_bus_type; client->dev.release = &i2c_client_release; snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), "%d-%04x", i2c_adapter_id(adapter), client->addr); dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", client->name, client->dev.bus_id); device_register(&client->dev); device_create_file(&client->dev, &dev_attr_client_name); return 0; } int i2c_detach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int res = 0; if ((client->flags & I2C_CLIENT_ALLOW_USE) && (client->usage_count > 0)) { dev_warn(&client->dev, "Client [%s] still busy, " "can't detach\n", client->name); return -EBUSY; } if (adapter->client_unregister) { res = adapter->client_unregister(client); if (res) { dev_err(&client->dev, "client_unregister [%s] failed, " "client not detached\n", client->name); goto out; } } down(&adapter->clist_lock); list_del(&client->list); init_completion(&client->released); device_remove_file(&client->dev, &dev_attr_client_name); device_unregister(&client->dev); up(&adapter->clist_lock); wait_for_completion(&client->released); out: return res; } static int i2c_inc_use_client(struct i2c_client *client) { if (!try_module_get(client->driver->owner)) return -ENODEV; if (!try_module_get(client->adapter->owner)) { module_put(client->driver->owner); return -ENODEV; } return 0; } static void i2c_dec_use_client(struct i2c_client *client) { module_put(client->driver->owner); module_put(client->adapter->owner); } int i2c_use_client(struct i2c_client *client) { int ret; ret = i2c_inc_use_client(client); if (ret) return ret; if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) client->usage_count++; else if (client->usage_count > 0) goto busy; else client->usage_count++; } return 0; busy: i2c_dec_use_client(client); return -EBUSY; } int i2c_release_client(struct i2c_client *client) { if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->usage_count > 0) client->usage_count--; else { pr_debug("i2c-core: %s used one too many times\n", __FUNCTION__); return -EPERM; } } i2c_dec_use_client(client); return 0; } void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) { struct list_head *item; struct i2c_client *client; down(&adap->clist_lock); list_for_each(item, &adap->clients) { client = list_entry(item, struct i2c_client, list); if (!try_module_get(client->driver->owner)) continue; if (NULL != client->driver->command) { up(&adap->clist_lock); client->driver->command(client, cmd, arg); down(&adap->clist_lock); } module_put(client->driver->owner); } up(&adap->clist_lock); } static int __init i2c_init(void) { int retval; retval = bus_register(&i2c_bus_type); if (retval) return retval; retval = driver_register(&i2c_adapter_driver); if (retval) return retval; return class_register(&i2c_adapter_class); } static void __exit i2c_exit(void) { class_unregister(&i2c_adapter_class); driver_unregister(&i2c_adapter_driver); bus_unregister(&i2c_bus_type); } subsys_initcall(i2c_init); module_exit(i2c_exit); /* ---------------------------------------------------- * the functional interface to the i2c busses. * ---------------------------------------------------- */ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num) { int ret; if (adap->algo->master_xfer) { #ifdef DEBUG for (ret = 0; ret < num; ret++) { dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, " "len=%d\n", ret, msgs[ret].flags & I2C_M_RD ? 'R' : 'W', msgs[ret].addr, msgs[ret].len); } #endif down(&adap->bus_lock); ret = adap->algo->master_xfer(adap, msgs, num); up(&adap->bus_lock); return ret; } else { dev_dbg(&adap->dev, "I2C level transfers not supported\n"); return -ENOSYS; } } int i2c_master_send(struct i2c_client *client, const char *buf, int count) { int ret; struct i2c_adapter *adap = client->adapter; struct i2c_msg msg; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.len = count; msg.buf = (char *)buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes transmitted, else error code. */ return (ret == 1) ? count : ret; } int i2c_master_recv(struct i2c_client *client, char *buf, int count) { struct i2c_adapter *adap = client->adapter; struct i2c_msg msg; int ret; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.flags |= I2C_M_RD; msg.len = count; msg.buf = buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes transmitted, else error code. */ return (ret == 1) ? count : ret; } int i2c_control(struct i2c_client *client, unsigned int cmd, unsigned long arg) { int ret = 0; struct i2c_adapter *adap = client->adapter; dev_dbg(&client->adapter->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg); switch (cmd) { case I2C_RETRIES: adap->retries = arg; break; case I2C_TIMEOUT: adap->timeout = arg; break; default: if (adap->algo->algo_control != NULL) ret = adap->algo->algo_control(adap, cmd, arg); } return ret; } /* ---------------------------------------------------- * the i2c address scanning function * Will not work for 10-bit addresses! * ---------------------------------------------------- */ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind, int (*found_proc)(struct i2c_adapter *, int, int)) { int err; /* Make sure the address is valid */ if (addr < 0x03 || addr > 0x77) { dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n", addr); return -EINVAL; } /* Skip if already in use */ if (i2c_check_addr(adapter, addr)) return 0; /* Make sure there is something at this address, unless forced */ if (kind < 0) { if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0) return 0; /* prevent 24RF08 corruption */ if ((addr & ~0x0f) == 0x50) i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL); } /* Finally call the custom detection function */ err = found_proc(adapter, addr, kind); /* -ENODEV can be returned if there is a chip at the given address but it isn't supported by this chip driver. We catch it here as this isn't an error. */ return (err == -ENODEV) ? 0 : err; } int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data, int (*found_proc)(struct i2c_adapter *, int, int)) { int i, err; int adap_id = i2c_adapter_id(adapter); /* Forget it if we can't probe using SMBUS_QUICK */ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) return -1; /* Force entries are done first, and are not affected by ignore entries */ if (address_data->forces) { unsigned short **forces = address_data->forces; int kind; for (kind = 0; forces[kind]; kind++) { for (i = 0; forces[kind][i] != I2C_CLIENT_END; i += 2) { if (forces[kind][i] == adap_id || forces[kind][i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found force " "parameter for adapter %d, " "addr 0x%02x, kind %d\n", adap_id, forces[kind][i + 1], kind); err = i2c_probe_address(adapter, forces[kind][i + 1], kind, found_proc); if (err) return err; } } } } /* Probe entries are done second, and are not affected by ignore entries either */ for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { if (address_data->probe[i] == adap_id || address_data->probe[i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found probe parameter for " "adapter %d, addr 0x%02x\n", adap_id, address_data->probe[i + 1]); err = i2c_probe_address(adapter, address_data->probe[i + 1], -1, found_proc); if (err) return err; } } /* Normal entries are done last, unless shadowed by an ignore entry */ for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { int j, ignore; ignore = 0; for (j = 0; address_data->ignore[j] != I2C_CLIENT_END; j += 2) { if ((address_data->ignore[j] == adap_id || address_data->ignore[j] == ANY_I2C_BUS) && address_data->ignore[j + 1] == address_data->normal_i2c[i]) { dev_dbg(&adapter->dev, "found ignore " "parameter for adapter %d, " "addr 0x%02x\n", adap_id, address_data->ignore[j + 1]); } ignore = 1; break; } if (ignore) continue; dev_dbg(&adapter->dev, "found normal entry for adapter %d, " "addr 0x%02x\n", adap_id, address_data->normal_i2c[i]); err = i2c_probe_address(adapter, address_data->normal_i2c[i], -1, found_proc); if (err) return err; } return 0; } struct i2c_adapter* i2c_get_adapter(int id) { struct i2c_adapter *adapter; down(&core_lists); adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); if (adapter && !try_module_get(adapter->owner)) adapter = NULL; up(&core_lists); return adapter; } void i2c_put_adapter(struct i2c_adapter *adap) { module_put(adap->owner); } /* The SMBus parts */ #define POLY (0x1070U << 3) static u8 crc8(u16 data) { int i; for (i = 0; i < 8; i++) { if (data & 0x8000) data = data ^ POLY; data = data << 1; } return (u8)(data >> 8); } /* CRC over count bytes in the first array plus the bytes in the rest array if it is non-null. rest[0] is the (length of rest) - 1 and is included. */ static u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest) { int i; for (i = 0; i < count; i++) crc = crc8((crc ^ first[i]) << 8); if (rest != NULL) for (i = 0; i <= rest[0]; i++) crc = crc8((crc ^ rest[i]) << 8); return crc; } static u8 i2c_smbus_pec(int count, u8 *first, u8 *rest) { return i2c_smbus_partial_pec(0, count, first, rest); } /* Returns new "size" (transaction type) Note that we convert byte to byte_data and byte_data to word_data rather than invent new xxx_PEC transactions. */ static int i2c_smbus_add_pec(u16 addr, u8 command, int size, union i2c_smbus_data *data) { u8 buf[3]; buf[0] = addr << 1; buf[1] = command; switch (size) { case I2C_SMBUS_BYTE: data->byte = i2c_smbus_pec(2, buf, NULL); size = I2C_SMBUS_BYTE_DATA; break; case I2C_SMBUS_BYTE_DATA: buf[2] = data->byte; data->word = buf[2] || (i2c_smbus_pec(3, buf, NULL) << 8); size = I2C_SMBUS_WORD_DATA; break; case I2C_SMBUS_WORD_DATA: /* unsupported */ break; case I2C_SMBUS_BLOCK_DATA: data->block[data->block[0] + 1] = i2c_smbus_pec(2, buf, data->block); size = I2C_SMBUS_BLOCK_DATA_PEC; break; } return size; } static int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial, union i2c_smbus_data *data) { u8 buf[3], rpec, cpec; buf[1] = command; switch (size) { case I2C_SMBUS_BYTE_DATA: buf[0] = (addr << 1) | 1; cpec = i2c_smbus_pec(2, buf, NULL); rpec = data->byte; break; case I2C_SMBUS_WORD_DATA: buf[0] = (addr << 1) | 1; buf[2] = data->word & 0xff; cpec = i2c_smbus_pec(3, buf, NULL); rpec = data->word >> 8; break; case I2C_SMBUS_WORD_DATA_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_PROC_CALL_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_BLOCK_DATA_PEC: buf[0] = (addr << 1); buf[2] = (addr << 1) | 1; cpec = i2c_smbus_pec(3, buf, data->block); rpec = data->block[data->block[0] + 1]; break; case I2C_SMBUS_BLOCK_PROC_CALL_PEC: buf[0] = (addr << 1) | 1; rpec = i2c_smbus_partial_pec(partial, 1, buf, data->block); cpec = data->block[data->block[0] + 1]; break; default: cpec = rpec = 0; break; } if (rpec != cpec) { pr_debug("i2c-core: Bad PEC 0x%02x vs. 0x%02x\n", rpec, cpec); return -1; } return 0; } s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) { return i2c_smbus_xfer(client->adapter, client->addr, client->flags, value, 0, I2C_SMBUS_QUICK, NULL); } s32 i2c_smbus_read_byte(struct i2c_client *client) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data)) return -1; else return 0x0FF & data.byte; } s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) { union i2c_smbus_data data; /* only for PEC */ return i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, &data); } s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_BYTE_DATA, &data)) return -1; else return 0x0FF & data.byte; } s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) { union i2c_smbus_data data; data.byte = value; return i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA, &data); } s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_WORD_DATA, &data)) return -1; else return 0x0FFFF & data.word; } s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) { union i2c_smbus_data data; data.word = value; return i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_WORD_DATA, &data); } s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, u8 length, u8 *values) { union i2c_smbus_data data; int i; if (length > I2C_SMBUS_BLOCK_MAX) length = I2C_SMBUS_BLOCK_MAX; for (i = 1; i <= length; i++) data.block[i] = values[i - 1]; data.block[0] = length; return i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_BLOCK_DATA, &data); } /* Returns the number of read bytes */ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) { union i2c_smbus_data data; int i; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA, &data)) return -1; else { for (i = 1; i <= data.block[0]; i++) values[i - 1] = data.block[i]; return data.block[0]; } } /* Simulate a SMBus command using the i2c protocol No checking of parameters is done! */ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data * data) { /* So we need to generate a series of msgs. In the case of writing, we need to use only one message; when reading, we need two. We initialize most things with sane defaults, to keep the code below somewhat simpler. */ unsigned char msgbuf0[34]; unsigned char msgbuf1[34]; int num = read_write == I2C_SMBUS_READ ? 2 : 1; struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, { addr, flags | I2C_M_RD, 0, msgbuf1 } }; int i; msgbuf0[0] = command; switch (size) { case I2C_SMBUS_QUICK: msg[0].len = 0; /* Special case: The read/write field is used as data */ msg[0].flags = flags | (read_write == I2C_SMBUS_READ) ? I2C_M_RD : 0; num = 1; break; case I2C_SMBUS_BYTE: if (read_write == I2C_SMBUS_READ) { /* Special case: only a read! */ msg[0].flags = I2C_M_RD | flags; num = 1; } break; case I2C_SMBUS_BYTE_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = 1; else { msg[0].len = 2; msgbuf0[1] = data->byte; } break; case I2C_SMBUS_WORD_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = 2; else { msg[0].len = 3; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; } break; case I2C_SMBUS_PROC_CALL: num = 2; /* Special case */ read_write = I2C_SMBUS_READ; msg[0].len = 3; msg[1].len = 2; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; break; case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA_PEC: if (read_write == I2C_SMBUS_READ) { dev_err(&adapter->dev, "Block read not supported " "under I2C emulation!\n"); return -1; } else { msg[0].len = data->block[0] + 2; if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) { dev_err(&adapter->dev, "smbus_access called with " "invalid block write size (%d)\n", data->block[0]); return -1; } if (size == I2C_SMBUS_BLOCK_DATA_PEC) (msg[0].len)++; for (i = 1; i <= msg[0].len; i++) msgbuf0[i] = data->block[i - 1]; } break; case I2C_SMBUS_BLOCK_PROC_CALL: case I2C_SMBUS_BLOCK_PROC_CALL_PEC: dev_dbg(&adapter->dev, "Block process call not supported " "under I2C emulation!\n"); return -1; case I2C_SMBUS_I2C_BLOCK_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; else { msg[0].len = data->block[0] + 1; if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) { dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " "invalid block write size (%d)\n", data->block[0]); return -1; } for (i = 1; i <= data->block[0]; i++) msgbuf0[i] = data->block[i]; } break; default: dev_err(&adapter->dev, "smbus_access called with invalid size (%d)\n", size); return -1; } if (i2c_transfer(adapter, msg, num) < 0) return -1; if (read_write == I2C_SMBUS_READ) switch (size) { case I2C_SMBUS_BYTE: data->byte = msgbuf0[0]; break; case I2C_SMBUS_BYTE_DATA: data->byte = msgbuf1[0]; break; case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_PROC_CALL: data->word = msgbuf1[0] | (msgbuf1[1] << 8); break; case I2C_SMBUS_I2C_BLOCK_DATA: /* fixed at 32 for now */ data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX; for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++) data->block[i + 1] = msgbuf1[i]; break; } return 0; } s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data * data) { s32 res; int swpec = 0; u8 partial = 0; flags &= I2C_M_TEN | I2C_CLIENT_PEC; if ((flags & I2C_CLIENT_PEC) && !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) { swpec = 1; if (read_write == I2C_SMBUS_READ && size == I2C_SMBUS_BLOCK_DATA) size = I2C_SMBUS_BLOCK_DATA_PEC; else if (size == I2C_SMBUS_PROC_CALL) size = I2C_SMBUS_PROC_CALL_PEC; else if (size == I2C_SMBUS_BLOCK_PROC_CALL) { i2c_smbus_add_pec(addr, command, I2C_SMBUS_BLOCK_DATA, data); partial = data->block[data->block[0] + 1]; size = I2C_SMBUS_BLOCK_PROC_CALL_PEC; } else if (read_write == I2C_SMBUS_WRITE && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA) size = i2c_smbus_add_pec(addr, command, size, data); } if (adapter->algo->smbus_xfer) { down(&adapter->bus_lock); res = adapter->algo->smbus_xfer(adapter, addr, flags, read_write, command, size, data); up(&adapter->bus_lock); } else res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write, command, size, data); if (res >= 0 && swpec && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA && (read_write == I2C_SMBUS_READ || size == I2C_SMBUS_PROC_CALL_PEC || size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) if (i2c_smbus_check_pec(addr, command, size, partial, data)) return -1; return res; } /* Next four are needed by i2c-isa */ EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); EXPORT_SYMBOL_GPL(i2c_adapter_driver); EXPORT_SYMBOL_GPL(i2c_adapter_class); EXPORT_SYMBOL_GPL(i2c_bus_type); EXPORT_SYMBOL(i2c_add_adapter); EXPORT_SYMBOL(i2c_del_adapter); EXPORT_SYMBOL(i2c_add_driver); EXPORT_SYMBOL(i2c_del_driver); EXPORT_SYMBOL(i2c_attach_client); EXPORT_SYMBOL(i2c_detach_client); EXPORT_SYMBOL(i2c_use_client); EXPORT_SYMBOL(i2c_release_client); EXPORT_SYMBOL(i2c_clients_command); EXPORT_SYMBOL(i2c_check_addr); EXPORT_SYMBOL(i2c_master_send); EXPORT_SYMBOL(i2c_master_recv); EXPORT_SYMBOL(i2c_control); EXPORT_SYMBOL(i2c_transfer); EXPORT_SYMBOL(i2c_get_adapter); EXPORT_SYMBOL(i2c_put_adapter); EXPORT_SYMBOL(i2c_probe); EXPORT_SYMBOL(i2c_smbus_xfer); EXPORT_SYMBOL(i2c_smbus_write_quick); EXPORT_SYMBOL(i2c_smbus_read_byte); EXPORT_SYMBOL(i2c_smbus_write_byte); EXPORT_SYMBOL(i2c_smbus_read_byte_data); EXPORT_SYMBOL(i2c_smbus_write_byte_data); EXPORT_SYMBOL(i2c_smbus_read_word_data); EXPORT_SYMBOL(i2c_smbus_write_word_data); EXPORT_SYMBOL(i2c_smbus_write_block_data); EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); MODULE_AUTHOR("Simon G. Vogl "); MODULE_DESCRIPTION("I2C-Bus main module"); MODULE_LICENSE("GPL"); uncrustify-0.59/tests/output/c/00510-bool-pos.c0000644000175000017500000000202711574754744016113 00000000000000void foo(void) { if ((a != 0) && (b == 0) && (c < 0) && (d > 0)) { printf("hi"); } if (flag1 #ifdef FLAG2 || flag2 #endif ) { printf("yar"); } if (flag1 && #ifdef FLAG2 flag2 && #endif flag3) { printf("bo"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if (!this->writeOwiFile () || // comment1 broken () || !saveArchiveData () || /* comment2 */ broken () || !deleteCentralArchive () || // comment3 broken () || !copyArchivFiles () || // comment4 broken () || !appendToPlanetDb ()) // comment5 { ; } foobar(param1, param2, param3, param4); foobar2(param1, param2, param3, param4); } uncrustify-0.59/tests/output/c/00010-braces.c0000644000175000017500000000271411574754744015616 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) // trailing C++ comment { b++; } do // trailing C++ comment { a--; } while (a > 0); do { a--; } while (a > 0); for (a = 0; a < 10; a++) // trailing C++ comment { printf("a=%d\n", a); } if (a == 10) // trailing C++ comment { printf("a looks good\n"); } else // trailing C++ comment { printf("not so good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } else if (b != 0) { a /= b; } else // trailing C++ comment { a += b; } } } list_for_each(k) { if (a) { if (b) { c++; } } } while (1) { /* hang forever */ } } /* foo */ void f() { if (buf[0] == '~' && strchr(tmp, '/') == NULL) { buf = mallocstrcpy(buf, tmp); matches = username_tab_completion(tmp, &num_matches); } /* If we're in the middle of the original line, copy the string * only up to the cursor position into buf, so tab completion * will result in buf's containing only the tab-completed * path/filename. */ else if (strlen(buf) > strlen(tmp)) { buf = mallocstrcpy(buf, tmp); } } void f() { } void g() { } uncrustify-0.59/tests/output/c/00071-include_define.h0000644000175000017500000000006711574754744017327 00000000000000#define MY_HEADER #include MY_HEADER uncrustify-0.59/tests/output/c/02310-empty-for.c0000644000175000017500000000006411631561414016262 00000000000000void foo(void) { for ( ; x < 2; x++) { } } uncrustify-0.59/tests/output/c/00910-pascal_ptr.c0000644000175000017500000000017411574754744016516 00000000000000foobar_t* a; int* b; int* c; something no; char* main() { int i = (5 * 3) + 2; } void foo(int* a, int* b, int* c) { } uncrustify-0.59/tests/output/c/00152-casts.c0000644000175000017500000000302711574754744015501 00000000000000 #define SOME_VAL1 (( MYINT )-1) #define SOME_VAL2 (-2) #define SOME_VAL3 -3 #define MULT(X, Y) ( X )*(Y) #define SOME_JUNK /*lint -e123 */ ( const mytype * )-1 typedef (*my_fcn_ptr_t)(char *, int); typedef (my_fcn_t)(char *, int); void foo(void) { uint crc = crc32_calc_full(( const UINT8 * )"String", 6); crc = crc32_calc_full(( const UINT8 * )&crc, sizeof(crc)); a = (b) - 4; a = ( UINT )-4; a = ( UINT )+4; a = (UINT) * 4; a = (UINT) & 4; a = ( uint32_t )-pb; a = (uint32_t) + pb; a = ( uint32_t )*pb; a = ( uint32_t )&pb; a = (Uint) - 4; a = (Uint) + 4; a = (Uint) * 4; a = (Uint) & 4; a = b * ( int )flt; a = b * (( int )flt); a = b * ( int )flt; a = b * ( INT8 )flt; a = b * ( Uint )flt; a = *( int )&b; a = *( CHAR )&b; a = *(Uint) & b; a = ( int )*pb; a = ( CHAR )*pb; a = (Uint) * pb; a = ( int )'a'; a = ( UINT8 )'a'; a = ( Uint )'a'; a = ( int )*'a'; a = (UINT8) * 'a'; a = (Uint) * 'a'; a = ( int )*5; a = (UINT) * 5; a = (Uint) * 5; a = ( int )*ape; a = ( UINT )*ape; a = (Uint) * ape; a = ( int )ape; a = ( UINT )ape; a = ( Uint )ape; a = ( int )sizeof(x); a = ( INT16 )sizeof(x); a = ( Uint )sizeof(x); a = ( int )foo(x); a = ( CHAR )foo(x); a = ( Uint )foo(x); a = ( int )(x); a = ( CHAR )(x); a = ( Uint )(x); a = ( int )*(x); a = ( CHAR )*(x); a = (Uint) * (x); a = ( unsigned int )(1 + 4); a = ( int )(1 + 1); a = ( void * )(&str); } uncrustify-0.59/tests/output/c/02411-ifdef-indent.c0000644000175000017500000000056011631561414016677 00000000000000#ifdef foo #include #else #include #endif int show_interrupts(struct seq_file *p, void *v) { #ifndef CONFIG_SMP a++; #else for (b = 0; b < 9; b++) if (b & 1) k++; #endif if (v) { bar(v); #if DEBUG == 1 printf("yup\n"); #endif } } void foo() { int i=0; #if DEBUG == 1 i--; #endif i++; } uncrustify-0.59/tests/output/c/00103-bugs-3.c0000644000175000017500000000202211574754744015452 00000000000000 #ifdef CRUD #define JUNK a #endif #ifdef __QNX__ /** * Does all that QNX trickery to get the MAC address of the interface * * @param if_name The interface name: ie "en0" or "eth0" * @param mac Pointer to a 6-byte array * @return SUCCESS or FAILURE */ static INT32 socket_get_mac_qnx(const CHAR *if_name, UINT8 *mac) { CHAR ionet_name[50]; INT32 en_fd; #if QNX_RELEASE >= 630 nic_config_t nic; INT32 dcmd = DCMD_IO_NET_GET_CONFIG; #else Nic_t nic; INT32 dcmd = DCMD_IO_NET_NICINFO; #endif INT32 ret_val = FAILURE; memset(mac, 0, 6); /* Build the full name */ snprintf(ionet_name, sizeof(ionet_name), "/dev/io-net/%s", if_name); /* Open the device */ en_fd = open(ionet_name, O_RDWR); if (en_fd >= 0) { /* Get the interface info */ if (devctl(en_fd, dcmd, &nic, sizeof(nic), NULL) == EOK) { memcpy(mac, nic.current_address, 6); ret_val = SUCCESS; } close(en_fd); } return(ret_val); } #endif uncrustify-0.59/tests/output/c/02410-ifdef-indent.c0000644000175000017500000000056411631561414016702 00000000000000#ifdef foo #include #else #include #endif int show_interrupts(struct seq_file *p, void *v) { #ifndef CONFIG_SMP a++; #else for (b = 0; b < 9; b++) if (b & 1) k++; #endif if (v) { bar(v); #if DEBUG == 1 printf("yup\n"); #endif } } void foo() { int i=0; #if DEBUG == 1 i--; #endif i++; } uncrustify-0.59/tests/output/c/00155-cast_brace.c0000644000175000017500000000022111632275667016443 00000000000000// void disappearing_semicolon(void) { r = (recordtypecast){ a, b, c }; //<-- p = Table_put(t, a, &r); } uncrustify-0.59/tests/output/c/00141-deref.c0000644000175000017500000000045711574754744015453 00000000000000void foo(int *pA, int *pB) { *pB = some.arr[*pA]; foo(sizeof bar / sizeof *bar, baz); } #define MEM_READ_BYTE(phwi, addr, data) \ *data = *((PUCHAR)((phwi)->m_pVirtualMemory + addr)) #define MEM_WRITE_BYTE(phwi, addr, data) \ *((PUCHAR)((phwi)->m_pVirtualMemory + addr)) = (UCHAR)(data) uncrustify-0.59/tests/output/c/00631-nl_assign.c0000644000175000017500000000101011574754744016331 00000000000000 void foo() { some.really_long.variable_name = another.big.one[55] + something_else; some.really_long.variable_name = another.big.one[55] + something_else; some.really_long.variable_name = another.big.one[55] + something_else; a_really_long_assignment_to_test = line_breaks_around_assign_and_arith; a_really_long_assignment_to_test = line_breaks_around + assign_and_arith; } uncrustify-0.59/tests/output/c/00902-code_width.c0000644000175000017500000000356211574754744016504 00000000000000 static int short_function_name(struct device *dev, struct device_driver *drv); /* Assuming a 60-column limit */ static int short_function_name(struct device *dev, struct device_driver *drv) { this->translateLabels(labelID, completedLabelID, selectedLabelID, text, selectedText, completedText, fontId, selectedFontId, completedFontId); call_some_really_long_function.of_some_sort( some_long_parameter1, some_long_parameter2); abc = call_some_other_really_long_function.of_some_sort( some_long_parameter1, some_long_parameter2); abc.def.ghi = call_some_other_really_long_function.of_some_sort( some_long_parameter1, some_long_parameter2); abcdefghijklmnopqrstuvwxyz = abc + def + ghi + jkl + mno + prq + stu + vwx + yz; return 1; } static void some_really_long_function_name( struct device *dev, struct device_driver *drv) { if ((some_variable_name && somefunction(param1, param2, param3))) { asdfghjk = asdfasdfasd.aasdfasd + (asdfasd.asdas * 1234.65); } for (struct something_really_really_excessive * a_long_ptr_name = get_first_item(); a_long_ptr_name != NULL; a_long_ptr_name = get_next_item(a_long_ptr_name)) { } for (a = get_first(); a != NULL; a = get_next(a)) { } for (a_ptr = get_first(); a_ptr != NULL; a_ptr = get_next(a)) { } register_clcmd( "examine", "do_examine", -1, "-Allows a player to examine the health and armor of a teammate" ); register_clcmd( "/examine", "do_examine", -1, "-Allows a player to examine the health and armor of a teammate" ); } uncrustify-0.59/tests/output/c/02000-i2c-core.c0000644000175000017500000011154611574756633015766 00000000000000/* i2c-core.c - a device driver for the iic-bus interface */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-99 Simon G. Vogl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kysti Mlkki . * All SMBus-related things are written by Frodo Looijaard * SMBus 2.0 support by Mark Studebaker */ #include #include #include #include #include #include #include #include #include static LIST_HEAD(adapters); static LIST_HEAD(drivers); static DECLARE_MUTEX(core_lists); static DEFINE_IDR(i2c_adapter_idr); static int i2c_device_match(struct device *dev, struct device_driver *drv) { return(1); } static int i2c_bus_suspend(struct device *dev, pm_message_t state) { int rc = 0; if (dev->driver && dev->driver->suspend) { rc = dev->driver->suspend(dev, state, 0); } return(rc); } static int i2c_bus_resume(struct device *dev) { int rc = 0; if (dev->driver && dev->driver->resume) { rc = dev->driver->resume(dev, 0); } return(rc); } struct bus_type i2c_bus_type = { .name = "i2c", .match = i2c_device_match, .suspend = i2c_bus_suspend, .resume = i2c_bus_resume, }; static int i2c_device_probe(struct device *dev) { return(-ENODEV); } static int i2c_device_remove(struct device *dev) { return(0); } void i2c_adapter_dev_release(struct device *dev) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); complete(&adap->dev_released); } struct device_driver i2c_adapter_driver = { .name = "i2c_adapter", .bus = &i2c_bus_type, .probe = i2c_device_probe, .remove = i2c_device_remove, }; static void i2c_adapter_class_dev_release(struct class_device *dev) { struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev); complete(&adap->class_dev_released); } struct class i2c_adapter_class = { .name = "i2c-adapter", .release = &i2c_adapter_class_dev_release, }; static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); return(sprintf(buf, "%s\n", adap->name)); } static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); static void i2c_client_release(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); complete(&client->released); } static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); return(sprintf(buf, "%s\n", client->name)); } /* * We can't use the DEVICE_ATTR() macro here as we want the same filename for a * different type of a device. So beware if the DEVICE_ATTR() macro ever * changes, this definition will also have to change. */ static struct device_attribute dev_attr_client_name = { .attr = { .name = "name", .mode = S_IRUGO, .owner = THIS_MODULE }, .show = &show_client_name, }; /* --------------------------------------------------- * registering functions * --------------------------------------------------- */ /* ----- * i2c_add_adapter is called from within the algorithm layer, * when a new hw adapter registers. A new device is register to be * available for clients. */ int i2c_add_adapter(struct i2c_adapter *adap) { int id, res = 0; struct list_head *item; struct i2c_driver *driver; down(&core_lists); if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) { res = -ENOMEM; goto out_unlock; } res = idr_get_new(&i2c_adapter_idr, adap, &id); if (res < 0) { if (res == -EAGAIN) { res = -ENOMEM; } goto out_unlock; } adap->nr = id & MAX_ID_MASK; init_MUTEX(&adap->bus_lock); init_MUTEX(&adap->clist_lock); list_add_tail(&adap->list, &adapters); INIT_LIST_HEAD(&adap->clients); /* Add the adapter to the driver core. * If the parent pointer is not set up, * we add this adapter to the host bus. */ if (adap->dev.parent == NULL) { adap->dev.parent = &platform_bus; } sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); adap->dev.driver = &i2c_adapter_driver; adap->dev.release = &i2c_adapter_dev_release; device_register(&adap->dev); device_create_file(&adap->dev, &dev_attr_name); /* Add this adapter to the i2c_adapter class */ memset(&adap->class_dev, 0x00, sizeof(struct class_device)); adap->class_dev.dev = &adap->dev; adap->class_dev.class = &i2c_adapter_class; strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE); class_device_register(&adap->class_dev); dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); /* inform drivers of new adapters */ list_for_each(item, &drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->flags & I2C_DF_NOTIFY) { /* We ignore the return code; if it fails, too bad */ driver->attach_adapter(adap); } } out_unlock: up(&core_lists); return(res); } /* i2c_add_adapter */ int i2c_del_adapter(struct i2c_adapter *adap) { struct list_head *item, *_n; struct i2c_adapter *adap_from_list; struct i2c_driver *driver; struct i2c_client *client; int res = 0; down(&core_lists); /* First make sure that this adapter was ever added */ list_for_each_entry(adap_from_list, &adapters, list) { if (adap_from_list == adap) { break; } } if (adap_from_list != adap) { pr_debug("i2c-core: attempting to delete unregistered " "adapter [%s]\n", adap->name); res = -EINVAL; goto out_unlock; } list_for_each(item, &drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } } /* detach any active clients. This must be done first, because * it can fail; in which case we give up. */ list_for_each_safe(item, _n, &adap->clients) { client = list_entry(item, struct i2c_client, list); /* detaching devices is unconditional of the set notify * flag, as _all_ clients that reside on the adapter * must be deleted, as this would cause invalid states. */ if ((res = client->driver->detach_client(client))) { dev_err(&adap->dev, "detach_client failed for client " "[%s] at address 0x%02x\n", client->name, client->addr); goto out_unlock; } } /* clean up the sysfs representation */ init_completion(&adap->dev_released); init_completion(&adap->class_dev_released); class_device_unregister(&adap->class_dev); device_remove_file(&adap->dev, &dev_attr_name); device_unregister(&adap->dev); list_del(&adap->list); /* wait for sysfs to drop all references */ wait_for_completion(&adap->dev_released); wait_for_completion(&adap->class_dev_released); /* free dynamically allocated bus id */ idr_remove(&i2c_adapter_idr, adap->nr); dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); out_unlock: up(&core_lists); return(res); } /* i2c_del_adapter */ /* ----- * What follows is the "upwards" interface: commands for talking to clients, * which implement the functions to access the physical information of the * chips. */ int i2c_add_driver(struct i2c_driver *driver) { struct list_head *item; struct i2c_adapter *adapter; int res = 0; down(&core_lists); /* add the driver to the list of i2c drivers in the driver core */ driver->driver.name = driver->name; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_device_probe; driver->driver.remove = i2c_device_remove; res = driver_register(&driver->driver); if (res) { goto out_unlock; } list_add_tail(&driver->list, &drivers); pr_debug("i2c-core: driver [%s] registered\n", driver->name); /* now look for instances of driver on our adapters */ if (driver->flags & I2C_DF_NOTIFY) { list_for_each(item, &adapters) { adapter = list_entry(item, struct i2c_adapter, list); driver->attach_adapter(adapter); } } out_unlock: up(&core_lists); return(res); } int i2c_del_driver(struct i2c_driver *driver) { struct list_head *item1, *item2, *_n; struct i2c_client *client; struct i2c_adapter *adap; int res = 0; down(&core_lists); /* Have a look at each adapter, if clients of this driver are still * attached. If so, detach them to be able to kill the driver * afterwards. * * Removing clients does not depend on the notify flag, else * invalid operation might (will!) result, when using stale client * pointers. */ list_for_each(item1, &adapters) { adap = list_entry(item1, struct i2c_adapter, list); if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } else { list_for_each_safe(item2, _n, &adap->clients) { client = list_entry(item2, struct i2c_client, list); if (client->driver != driver) { continue; } dev_dbg(&adap->dev, "detaching client [%s] " "at 0x%02x\n", client->name, client->addr); if ((res = driver->detach_client(client))) { dev_err(&adap->dev, "detach_client " "failed for client [%s] at " "0x%02x\n", client->name, client->addr); goto out_unlock; } } } } driver_unregister(&driver->driver); list_del(&driver->list); pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); out_unlock: up(&core_lists); return(0); } /* i2c_del_driver */ static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr) { struct list_head *item; struct i2c_client *client; list_for_each(item, &adapter->clients) { client = list_entry(item, struct i2c_client, list); if (client->addr == addr) { return(-EBUSY); } } return(0); } int i2c_check_addr(struct i2c_adapter *adapter, int addr) { int rval; down(&adapter->clist_lock); rval = __i2c_check_addr(adapter, addr); up(&adapter->clist_lock); return(rval); } int i2c_attach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; down(&adapter->clist_lock); if (__i2c_check_addr(client->adapter, client->addr)) { up(&adapter->clist_lock); return(-EBUSY); } list_add_tail(&client->list, &adapter->clients); up(&adapter->clist_lock); if (adapter->client_register) { if (adapter->client_register(client)) { dev_dbg(&adapter->dev, "client_register " "failed for client [%s] at 0x%02x\n", client->name, client->addr); } } if (client->flags & I2C_CLIENT_ALLOW_USE) { client->usage_count = 0; } client->dev.parent = &client->adapter->dev; client->dev.driver = &client->driver->driver; client->dev.bus = &i2c_bus_type; client->dev.release = &i2c_client_release; snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), "%d-%04x", i2c_adapter_id(adapter), client->addr); dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", client->name, client->dev.bus_id); device_register(&client->dev); device_create_file(&client->dev, &dev_attr_client_name); return(0); } /* i2c_attach_client */ int i2c_detach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int res = 0; if ((client->flags & I2C_CLIENT_ALLOW_USE) && (client->usage_count > 0)) { dev_warn(&client->dev, "Client [%s] still busy, " "can't detach\n", client->name); return(-EBUSY); } if (adapter->client_unregister) { res = adapter->client_unregister(client); if (res) { dev_err(&client->dev, "client_unregister [%s] failed, " "client not detached\n", client->name); goto out; } } down(&adapter->clist_lock); list_del(&client->list); init_completion(&client->released); device_remove_file(&client->dev, &dev_attr_client_name); device_unregister(&client->dev); up(&adapter->clist_lock); wait_for_completion(&client->released); out: return(res); } static int i2c_inc_use_client(struct i2c_client *client) { if (!try_module_get(client->driver->owner)) { return(-ENODEV); } if (!try_module_get(client->adapter->owner)) { module_put(client->driver->owner); return(-ENODEV); } return(0); } static void i2c_dec_use_client(struct i2c_client *client) { module_put(client->driver->owner); module_put(client->adapter->owner); } int i2c_use_client(struct i2c_client *client) { int ret; ret = i2c_inc_use_client(client); if (ret) { return(ret); } if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) { client->usage_count++; } else if (client->usage_count > 0) { goto busy; } else { client->usage_count++; } } return(0); busy: i2c_dec_use_client(client); return(-EBUSY); } int i2c_release_client(struct i2c_client *client) { if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->usage_count > 0) { client->usage_count--; } else { pr_debug("i2c-core: %s used one too many times\n", __FUNCTION__); return(-EPERM); } } i2c_dec_use_client(client); return(0); } void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) { struct list_head *item; struct i2c_client *client; down(&adap->clist_lock); list_for_each(item, &adap->clients) { client = list_entry(item, struct i2c_client, list); if (!try_module_get(client->driver->owner)) { continue; } if (NULL != client->driver->command) { up(&adap->clist_lock); client->driver->command(client, cmd, arg); down(&adap->clist_lock); } module_put(client->driver->owner); } up(&adap->clist_lock); } static int __init i2c_init(void) { int retval; retval = bus_register(&i2c_bus_type); if (retval) { return(retval); } retval = driver_register(&i2c_adapter_driver); if (retval) { return(retval); } return(class_register(&i2c_adapter_class)); } static void __exit i2c_exit(void) { class_unregister(&i2c_adapter_class); driver_unregister(&i2c_adapter_driver); bus_unregister(&i2c_bus_type); } subsys_initcall(i2c_init); module_exit(i2c_exit); /* ---------------------------------------------------- * the functional interface to the i2c busses. * ---------------------------------------------------- */ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { int ret; if (adap->algo->master_xfer) { #ifdef DEBUG for (ret = 0; ret < num; ret++) { dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, " "len=%d\n", ret, msgs[ret].flags & I2C_M_RD ? 'R' : 'W', msgs[ret].addr, msgs[ret].len); } #endif down(&adap->bus_lock); ret = adap->algo->master_xfer(adap, msgs, num); up(&adap->bus_lock); return(ret); } else { dev_dbg(&adap->dev, "I2C level transfers not supported\n"); return(-ENOSYS); } } int i2c_master_send(struct i2c_client *client, const char *buf, int count) { int ret; struct i2c_adapter *adap = client->adapter; struct i2c_msg msg; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.len = count; msg.buf = (char *)buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes * transmitted, else error code. */ return((ret == 1) ? count : ret); } int i2c_master_recv(struct i2c_client *client, char *buf, int count) { struct i2c_adapter *adap = client->adapter; struct i2c_msg msg; int ret; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.flags |= I2C_M_RD; msg.len = count; msg.buf = buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes * transmitted, else error code. */ return((ret == 1) ? count : ret); } int i2c_control(struct i2c_client *client, unsigned int cmd, unsigned long arg) { int ret = 0; struct i2c_adapter *adap = client->adapter; dev_dbg(&client->adapter->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg); switch (cmd) { case I2C_RETRIES: adap->retries = arg; break; case I2C_TIMEOUT: adap->timeout = arg; break; default: if (adap->algo->algo_control != NULL) { ret = adap->algo->algo_control(adap, cmd, arg); } } return(ret); } /* ---------------------------------------------------- * the i2c address scanning function * Will not work for 10-bit addresses! * ---------------------------------------------------- */ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind, int (*found_proc)(struct i2c_adapter *, int, int)) { int err; /* Make sure the address is valid */ if (addr < 0x03 || addr > 0x77) { dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n", addr); return(-EINVAL); } /* Skip if already in use */ if (i2c_check_addr(adapter, addr)) { return(0); } /* Make sure there is something at this address, unless forced */ if (kind < 0) { if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0) { return(0); } /* prevent 24RF08 corruption */ if ((addr & ~0x0f) == 0x50) { i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL); } } /* Finally call the custom detection function */ err = found_proc(adapter, addr, kind); /* -ENODEV can be returned if there is a chip at the given address * but it isn't supported by this chip driver. We catch it here as * this isn't an error. */ return((err == -ENODEV) ? 0 : err); } int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data, int (*found_proc)(struct i2c_adapter *, int, int)) { int i, err; int adap_id = i2c_adapter_id(adapter); /* Forget it if we can't probe using SMBUS_QUICK */ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { return(-1); } /* Force entries are done first, and are not affected by ignore * entries */ if (address_data->forces) { unsigned short **forces = address_data->forces; int kind; for (kind = 0; forces[kind]; kind++) { for (i = 0; forces[kind][i] != I2C_CLIENT_END; i += 2) { if (forces[kind][i] == adap_id || forces[kind][i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found force " "parameter for adapter %d, " "addr 0x%02x, kind %d\n", adap_id, forces[kind][i + 1], kind); err = i2c_probe_address(adapter, forces[kind][i + 1], kind, found_proc); if (err) { return(err); } } } } } /* Probe entries are done second, and are not affected by ignore * entries either */ for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { if (address_data->probe[i] == adap_id || address_data->probe[i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found probe parameter for " "adapter %d, addr 0x%02x\n", adap_id, address_data->probe[i + 1]); err = i2c_probe_address(adapter, address_data->probe[i + 1], -1, found_proc); if (err) { return(err); } } } /* Normal entries are done last, unless shadowed by an ignore entry */ for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { int j, ignore; ignore = 0; for (j = 0; address_data->ignore[j] != I2C_CLIENT_END; j += 2) { if ((address_data->ignore[j] == adap_id || address_data->ignore[j] == ANY_I2C_BUS) && address_data->ignore[j + 1] == address_data->normal_i2c[i]) { dev_dbg(&adapter->dev, "found ignore " "parameter for adapter %d, " "addr 0x%02x\n", adap_id, address_data->ignore[j + 1]); } ignore = 1; break; } if (ignore) { continue; } dev_dbg(&adapter->dev, "found normal entry for adapter %d, " "addr 0x%02x\n", adap_id, address_data->normal_i2c[i]); err = i2c_probe_address(adapter, address_data->normal_i2c[i], -1, found_proc); if (err) { return(err); } } return(0); } /* i2c_probe */ struct i2c_adapter *i2c_get_adapter(int id) { struct i2c_adapter *adapter; down(&core_lists); adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); if (adapter && !try_module_get(adapter->owner)) { adapter = NULL; } up(&core_lists); return(adapter); } void i2c_put_adapter(struct i2c_adapter *adap) { module_put(adap->owner); } /* The SMBus parts */ #define POLY (0x1070U << 3) static u8 crc8(u16 data) { int i; for (i = 0; i < 8; i++) { if (data & 0x8000) { data = data ^ POLY; } data = data << 1; } return((u8)(data >> 8)); } /* CRC over count bytes in the first array plus the bytes in the rest * array if it is non-null. rest[0] is the (length of rest) - 1 * and is included. */ static u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest) { int i; for (i = 0; i < count; i++) { crc = crc8((crc ^ first[i]) << 8); } if (rest != NULL) { for (i = 0; i <= rest[0]; i++) { crc = crc8((crc ^ rest[i]) << 8); } } return(crc); } static u8 i2c_smbus_pec(int count, u8 *first, u8 *rest) { return(i2c_smbus_partial_pec(0, count, first, rest)); } /* Returns new "size" (transaction type) * Note that we convert byte to byte_data and byte_data to word_data * rather than invent new xxx_PEC transactions. */ static int i2c_smbus_add_pec(u16 addr, u8 command, int size, union i2c_smbus_data *data) { u8 buf[3]; buf[0] = addr << 1; buf[1] = command; switch (size) { case I2C_SMBUS_BYTE: data->byte = i2c_smbus_pec(2, buf, NULL); size = I2C_SMBUS_BYTE_DATA; break; case I2C_SMBUS_BYTE_DATA: buf[2] = data->byte; data->word = buf[2] || (i2c_smbus_pec(3, buf, NULL) << 8); size = I2C_SMBUS_WORD_DATA; break; case I2C_SMBUS_WORD_DATA: /* unsupported */ break; case I2C_SMBUS_BLOCK_DATA: data->block[data->block[0] + 1] = i2c_smbus_pec(2, buf, data->block); size = I2C_SMBUS_BLOCK_DATA_PEC; break; } return(size); } static int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial, union i2c_smbus_data *data) { u8 buf[3], rpec, cpec; buf[1] = command; switch (size) { case I2C_SMBUS_BYTE_DATA: buf[0] = (addr << 1) | 1; cpec = i2c_smbus_pec(2, buf, NULL); rpec = data->byte; break; case I2C_SMBUS_WORD_DATA: buf[0] = (addr << 1) | 1; buf[2] = data->word & 0xff; cpec = i2c_smbus_pec(3, buf, NULL); rpec = data->word >> 8; break; case I2C_SMBUS_WORD_DATA_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_PROC_CALL_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_BLOCK_DATA_PEC: buf[0] = (addr << 1); buf[2] = (addr << 1) | 1; cpec = i2c_smbus_pec(3, buf, data->block); rpec = data->block[data->block[0] + 1]; break; case I2C_SMBUS_BLOCK_PROC_CALL_PEC: buf[0] = (addr << 1) | 1; rpec = i2c_smbus_partial_pec(partial, 1, buf, data->block); cpec = data->block[data->block[0] + 1]; break; default: cpec = rpec = 0; break; } /* switch */ if (rpec != cpec) { pr_debug("i2c-core: Bad PEC 0x%02x vs. 0x%02x\n", rpec, cpec); return(-1); } return(0); } /* i2c_smbus_check_pec */ s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) { return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, value, 0, I2C_SMBUS_QUICK, NULL)); } s32 i2c_smbus_read_byte(struct i2c_client *client) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data)) { return(-1); } else { return(0x0FF & data.byte); } } s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) { union i2c_smbus_data data; /* only for PEC */ return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, &data)); } s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_BYTE_DATA, &data)) { return(-1); } else { return(0x0FF & data.byte); } } s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) { union i2c_smbus_data data; data.byte = value; return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA, &data)); } s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_WORD_DATA, &data)) { return(-1); } else { return(0x0FFFF & data.word); } } s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) { union i2c_smbus_data data; data.word = value; return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_WORD_DATA, &data)); } s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, u8 length, u8 *values) { union i2c_smbus_data data; int i; if (length > I2C_SMBUS_BLOCK_MAX) { length = I2C_SMBUS_BLOCK_MAX; } for (i = 1; i <= length; i++) { data.block[i] = values[i - 1]; } data.block[0] = length; return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_BLOCK_DATA, &data)); } /* Returns the number of read bytes */ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) { union i2c_smbus_data data; int i; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA, &data)) { return(-1); } else { for (i = 1; i <= data.block[0]; i++) { values[i - 1] = data.block[i]; } return(data.block[0]); } } /* Simulate a SMBus command using the i2c protocol * No checking of parameters is done! */ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data) { /* So we need to generate a series of msgs. In the case of writing, we * need to use only one message; when reading, we need two. We initialize * most things with sane defaults, to keep the code below somewhat * simpler. */ unsigned char msgbuf0[34]; unsigned char msgbuf1[34]; int num = read_write == I2C_SMBUS_READ ? 2 : 1; struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, { addr, flags | I2C_M_RD, 0, msgbuf1 } }; int i; msgbuf0[0] = command; switch (size) { case I2C_SMBUS_QUICK: msg[0].len = 0; /* Special case: The read/write field is used as data */ msg[0].flags = flags | (read_write == I2C_SMBUS_READ) ? I2C_M_RD : 0; num = 1; break; case I2C_SMBUS_BYTE: if (read_write == I2C_SMBUS_READ) { /* Special case: only a read! */ msg[0].flags = I2C_M_RD | flags; num = 1; } break; case I2C_SMBUS_BYTE_DATA: if (read_write == I2C_SMBUS_READ) { msg[1].len = 1; } else { msg[0].len = 2; msgbuf0[1] = data->byte; } break; case I2C_SMBUS_WORD_DATA: if (read_write == I2C_SMBUS_READ) { msg[1].len = 2; } else { msg[0].len = 3; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; } break; case I2C_SMBUS_PROC_CALL: num = 2; /* Special case */ read_write = I2C_SMBUS_READ; msg[0].len = 3; msg[1].len = 2; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; break; case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA_PEC: if (read_write == I2C_SMBUS_READ) { dev_err(&adapter->dev, "Block read not supported " "under I2C emulation!\n"); return(-1); } else { msg[0].len = data->block[0] + 2; if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) { dev_err(&adapter->dev, "smbus_access called with " "invalid block write size (%d)\n", data->block[0]); return(-1); } if (size == I2C_SMBUS_BLOCK_DATA_PEC) { (msg[0].len)++; } for (i = 1; i <= msg[0].len; i++) { msgbuf0[i] = data->block[i - 1]; } } break; case I2C_SMBUS_BLOCK_PROC_CALL: case I2C_SMBUS_BLOCK_PROC_CALL_PEC: dev_dbg(&adapter->dev, "Block process call not supported " "under I2C emulation!\n"); return(-1); case I2C_SMBUS_I2C_BLOCK_DATA: if (read_write == I2C_SMBUS_READ) { msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; } else { msg[0].len = data->block[0] + 1; if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) { dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " "invalid block write size (%d)\n", data->block[0]); return(-1); } for (i = 1; i <= data->block[0]; i++) { msgbuf0[i] = data->block[i]; } } break; default: dev_err(&adapter->dev, "smbus_access called with invalid size (%d)\n", size); return(-1); } /* switch */ if (i2c_transfer(adapter, msg, num) < 0) { return(-1); } if (read_write == I2C_SMBUS_READ) { switch (size) { case I2C_SMBUS_BYTE: data->byte = msgbuf0[0]; break; case I2C_SMBUS_BYTE_DATA: data->byte = msgbuf1[0]; break; case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_PROC_CALL: data->word = msgbuf1[0] | (msgbuf1[1] << 8); break; case I2C_SMBUS_I2C_BLOCK_DATA: /* fixed at 32 for now */ data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX; for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++) { data->block[i + 1] = msgbuf1[i]; } break; } } return(0); } /* i2c_smbus_xfer_emulated */ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data) { s32 res; int swpec = 0; u8 partial = 0; flags &= I2C_M_TEN | I2C_CLIENT_PEC; if ((flags & I2C_CLIENT_PEC) && !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) { swpec = 1; if (read_write == I2C_SMBUS_READ && size == I2C_SMBUS_BLOCK_DATA) { size = I2C_SMBUS_BLOCK_DATA_PEC; } else if (size == I2C_SMBUS_PROC_CALL) { size = I2C_SMBUS_PROC_CALL_PEC; } else if (size == I2C_SMBUS_BLOCK_PROC_CALL) { i2c_smbus_add_pec(addr, command, I2C_SMBUS_BLOCK_DATA, data); partial = data->block[data->block[0] + 1]; size = I2C_SMBUS_BLOCK_PROC_CALL_PEC; } else if (read_write == I2C_SMBUS_WRITE && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA) { size = i2c_smbus_add_pec(addr, command, size, data); } } if (adapter->algo->smbus_xfer) { down(&adapter->bus_lock); res = adapter->algo->smbus_xfer(adapter, addr, flags, read_write, command, size, data); up(&adapter->bus_lock); } else { res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write, command, size, data); } if (res >= 0 && swpec && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA && (read_write == I2C_SMBUS_READ || size == I2C_SMBUS_PROC_CALL_PEC || size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) { if (i2c_smbus_check_pec(addr, command, size, partial, data)) { return(-1); } } return(res); } /* i2c_smbus_xfer */ /* Next four are needed by i2c-isa */ EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); EXPORT_SYMBOL_GPL(i2c_adapter_driver); EXPORT_SYMBOL_GPL(i2c_adapter_class); EXPORT_SYMBOL_GPL(i2c_bus_type); EXPORT_SYMBOL(i2c_add_adapter); EXPORT_SYMBOL(i2c_del_adapter); EXPORT_SYMBOL(i2c_add_driver); EXPORT_SYMBOL(i2c_del_driver); EXPORT_SYMBOL(i2c_attach_client); EXPORT_SYMBOL(i2c_detach_client); EXPORT_SYMBOL(i2c_use_client); EXPORT_SYMBOL(i2c_release_client); EXPORT_SYMBOL(i2c_clients_command); EXPORT_SYMBOL(i2c_check_addr); EXPORT_SYMBOL(i2c_master_send); EXPORT_SYMBOL(i2c_master_recv); EXPORT_SYMBOL(i2c_control); EXPORT_SYMBOL(i2c_transfer); EXPORT_SYMBOL(i2c_get_adapter); EXPORT_SYMBOL(i2c_put_adapter); EXPORT_SYMBOL(i2c_probe); EXPORT_SYMBOL(i2c_smbus_xfer); EXPORT_SYMBOL(i2c_smbus_write_quick); EXPORT_SYMBOL(i2c_smbus_read_byte); EXPORT_SYMBOL(i2c_smbus_write_byte); EXPORT_SYMBOL(i2c_smbus_read_byte_data); EXPORT_SYMBOL(i2c_smbus_write_byte_data); EXPORT_SYMBOL(i2c_smbus_read_word_data); EXPORT_SYMBOL(i2c_smbus_write_word_data); EXPORT_SYMBOL(i2c_smbus_write_block_data); EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); MODULE_AUTHOR("Simon G. Vogl "); MODULE_DESCRIPTION("I2C-Bus main module"); MODULE_LICENSE("GPL"); uncrustify-0.59/tests/output/c/02460-freebsd.c0000644000175000017500000000705011631561414015762 00000000000000/* Make the structure name match the typedef. */ typedef struct bar { int level; } BAR; typedef int foo; /* This is foo. */ typedef const long baz; /* This is baz. */ static char *function(int _arg, const char *_arg2, struct foo *_arg3, struct bar *_arg4); static void usage(void); /* * All major routines should have a comment briefly describing what * they do. The comment before the "main" routine should describe * what the program does. */ int main(int argc, char *argv[]) { char *ep; long num; int ch; while ((ch = getopt(argc, argv, "abNn:")) != -1) { switch (ch) /* Indent the switch. */ { case 'a': /* Don't indent the case. */ aflag = 1; /* Indent case body one tab. */ /* FALLTHROUGH */ case 'b': bflag = 1; break; case 'N': Nflag = 1; break; case 'n': num = strtol(optarg, &ep, 10); if ((num <= 0) || (*ep != '\0')) { warnx("illegal number, -n argument -- %s", optarg); usage(); } break; case '?': default: usage(); /* NOTREACHED */ } } argc -= optind; argv += optind; for (p = buf; *p != '\0'; ++p) { /* nothing */ } for ( ; ; ) { stmt; } for ( ; ; ) { zed = a + really + long + statement + that + needs + two + lines + gets + indented + four + spaces + on + the + second + and + subsequent + lines; } for ( ; ; ) { if (cond) { stmt; } } if (val != NULL) { val = realloc(val, newsize); } fcn_call(with, a, really, long, list, of, parameters, that, spans, two, lines); for ( ; cnt < 15; cnt++) { stmt1; stmt2; } almod = (chunk_is_single_line_comment(pc) && cpd.settings[UO_indent_relative_single_line_comments].b) ? ALMODE_KEEP_REL : ALMODE_KEEP_ABS; /* Indentation is an 8 character tab. Second level indents are four spaces. * If you have to wrap a long statement, put the operator at the end of the * line. */ while (cnt < 20 && this_variable_name_is_too_long && ep != NULL) { zappy = a + really + long + statement + that + needs + two + lines + gets + indented + four + spaces + on + the + second + and + subsequent + lines; } // Do not add whitespace at the end of a line, and only use tabs followed by // spaces to form the indentation. Do not use more spaces than a tab will // produce and do not use spaces in front of tabs. // // Closing and opening braces go on the same line as the else. Braces that // are not necessary may be left out. if (test) { stmt; } else if (bar) { stmt; stmt; } else{ stmt; } // No spaces after function names. Commas have a space after them. No spa- // ces after `(' or `[' or preceding `]' or `)' characters. error = function(a1, a2); if (error != 0) { exit(error); } // Unary operators do not require spaces, binary operators do. Do not use // parentheses unless they are required for precedence or unless the state- // ment is confusing without them. Remember that other people may confuse // easier than you. Do YOU understand the following? a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1; k = !(l & FLAGS); // Exits should be 0 on success, or 1 on failure. exit(0); /* * Avoid obvious comments such as * "Exit 0 on success." */ } static char * function(a1, a2, fl, a4) int a1, a2; /* Declare ints, too, don't default them. */ float fl; /* Beware double vs. float prototype differences. */ int a4; /* List in order declared. */ { } uncrustify-0.59/tests/output/c/02001-directfb.h0000644000175000017500000025613611631561414016141 00000000000000#1 "/usr/include/directfb/directfb.h" #1 "" #1 "" #1 "/usr/include/directfb/directfb.h" #31 "/usr/include/directfb/directfb.h" #1 "/usr/include/directfb/dfb_types.h" 1 #1 "/usr/include/sys/types.h" 1 3 4 #27 "/usr/include/sys/types.h" 3 4 #1 "/usr/include/features.h" 1 3 4 #308 "/usr/include/features.h" 3 4 #1 "/usr/include/sys/cdefs.h" 1 3 4 #309 "/usr/include/features.h" 2 3 4 #331 "/usr/include/features.h" 3 4 #1 "/usr/include/gnu/stubs.h" 1 3 4 #332 "/usr/include/features.h" 2 3 4 #28 "/usr/include/sys/types.h" 2 3 4 #1 "/usr/include/bits/types.h" 1 3 4 #28 "/usr/include/bits/types.h" 3 4 #1 "/usr/include/bits/wordsize.h" 1 3 4 #29 "/usr/include/bits/types.h" 2 3 4 #1 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/stddef.h" 1 3 4 #214 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/stddef.h" 3 4 typedef unsigned int size_t; #32 "/usr/include/bits/types.h" 2 3 4 typedef unsigned char __u_char; typedef unsigned short int __u_short; typedef unsigned int __u_int; typedef unsigned long int __u_long; typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; __extension__ typedef long long int __quad_t; __extension__ typedef unsigned long long int __u_quad_t; #129 "/usr/include/bits/types.h" 3 4 #1 "/usr/include/bits/typesizes.h" 1 3 4 #130 "/usr/include/bits/types.h" 2 3 4 __extension__ typedef __u_quad_t __dev_t; __extension__ typedef unsigned int __uid_t; __extension__ typedef unsigned int __gid_t; __extension__ typedef unsigned long int __ino_t; __extension__ typedef __u_quad_t __ino64_t; __extension__ typedef unsigned int __mode_t; __extension__ typedef unsigned int __nlink_t; __extension__ typedef long int __off_t; __extension__ typedef __quad_t __off64_t; __extension__ typedef int __pid_t; __extension__ typedef struct { int __val[2]; } __fsid_t; __extension__ typedef long int __clock_t; __extension__ typedef unsigned long int __rlim_t; __extension__ typedef __u_quad_t __rlim64_t; __extension__ typedef unsigned int __id_t; __extension__ typedef long int __time_t; __extension__ typedef unsigned int __useconds_t; __extension__ typedef long int __suseconds_t; __extension__ typedef int __daddr_t; __extension__ typedef long int __swblk_t; __extension__ typedef int __key_t; __extension__ typedef int __clockid_t; __extension__ typedef int __timer_t; __extension__ typedef long int __blksize_t; __extension__ typedef long int __blkcnt_t; __extension__ typedef __quad_t __blkcnt64_t; __extension__ typedef unsigned long int __fsblkcnt_t; __extension__ typedef __u_quad_t __fsblkcnt64_t; __extension__ typedef unsigned long int __fsfilcnt_t; __extension__ typedef __u_quad_t __fsfilcnt64_t; __extension__ typedef int __ssize_t; typedef __off64_t __loff_t; typedef __quad_t * __qaddr_t; typedef char * __caddr_t; __extension__ typedef int __intptr_t; __extension__ typedef unsigned int __socklen_t; #32 "/usr/include/sys/types.h" 2 3 4 typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; typedef __loff_t loff_t; typedef __ino_t ino_t; #62 "/usr/include/sys/types.h" 3 4 typedef __dev_t dev_t; typedef __gid_t gid_t; typedef __mode_t mode_t; typedef __nlink_t nlink_t; typedef __uid_t uid_t; typedef __off_t off_t; #100 "/usr/include/sys/types.h" 3 4 typedef __pid_t pid_t; typedef __id_t id_t; typedef __ssize_t ssize_t; typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; typedef __key_t key_t; #133 "/usr/include/sys/types.h" 3 4 #1 "/usr/include/time.h" 1 3 4 #74 "/usr/include/time.h" 3 4 typedef __time_t time_t; #92 "/usr/include/time.h" 3 4 typedef __clockid_t clockid_t; #104 "/usr/include/time.h" 3 4 typedef __timer_t timer_t; #134 "/usr/include/sys/types.h" 2 3 4 #147 "/usr/include/sys/types.h" 3 4 #1 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/stddef.h" 1 3 4 #148 "/usr/include/sys/types.h" 2 3 4 typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; #191 "/usr/include/sys/types.h" 3 4 typedef int int8_t __attribute__((__mode__(__QI__))); typedef int int16_t __attribute__((__mode__(__HI__))); typedef int int32_t __attribute__((__mode__(__SI__))); typedef int int64_t __attribute__((__mode__(__DI__))); typedef unsigned int u_int8_t __attribute__((__mode__(__QI__))); typedef unsigned int u_int16_t __attribute__((__mode__(__HI__))); typedef unsigned int u_int32_t __attribute__((__mode__(__SI__))); typedef unsigned int u_int64_t __attribute__((__mode__(__DI__))); typedef int register_t __attribute__((__mode__(__word__))); #213 "/usr/include/sys/types.h" 3 4 #1 "/usr/include/endian.h" 1 3 4 #37 "/usr/include/endian.h" 3 4 #1 "/usr/include/bits/endian.h" 1 3 4 #38 "/usr/include/endian.h" 2 3 4 #214 "/usr/include/sys/types.h" 2 3 4 #1 "/usr/include/sys/select.h" 1 3 4 #31 "/usr/include/sys/select.h" 3 4 #1 "/usr/include/bits/select.h" 1 3 4 #32 "/usr/include/sys/select.h" 2 3 4 #1 "/usr/include/bits/sigset.h" 1 3 4 #23 "/usr/include/bits/sigset.h" 3 4 typedef int __sig_atomic_t; typedef struct { unsigned long int __val[(1024 / (8 * sizeof(unsigned long int)))]; } __sigset_t; #35 "/usr/include/sys/select.h" 2 3 4 typedef __sigset_t sigset_t; #1 "/usr/include/time.h" 1 3 4 #118 "/usr/include/time.h" 3 4 struct timespec { __time_t tv_sec; long int tv_nsec; }; #45 "/usr/include/sys/select.h" 2 3 4 #1 "/usr/include/bits/time.h" 1 3 4 #69 "/usr/include/bits/time.h" 3 4 struct timeval { __time_t tv_sec; __suseconds_t tv_usec; }; #47 "/usr/include/sys/select.h" 2 3 4 typedef __suseconds_t suseconds_t; typedef long int __fd_mask; #67 "/usr/include/sys/select.h" 3 4 typedef struct { __fd_mask __fds_bits[1024 / (8 * sizeof(__fd_mask))]; } fd_set; typedef __fd_mask fd_mask; #99 "/usr/include/sys/select.h" 3 4 #109 "/usr/include/sys/select.h" 3 4 extern int select(int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, struct timeval *__restrict __timeout); #128 "/usr/include/sys/select.h" 3 4 #217 "/usr/include/sys/types.h" 2 3 4 #1 "/usr/include/sys/sysmacros.h" 1 3 4 #29 "/usr/include/sys/sysmacros.h" 3 4 __extension__ extern __inline unsigned int gnu_dev_major(unsigned long long int __dev) __attribute__((__nothrow__)); __extension__ extern __inline unsigned int gnu_dev_minor(unsigned long long int __dev) __attribute__((__nothrow__)); __extension__ extern __inline unsigned long long int gnu_dev_makedev(unsigned int __major, unsigned int __minor) __attribute__((__nothrow__)); __extension__ extern __inline unsigned int __attribute__((__nothrow__)) gnu_dev_major(unsigned long long int __dev) { return(((__dev >> 8) & 0xfff) | ((unsigned int)(__dev >> 32) & ~0xfff)); } __extension__ extern __inline unsigned int __attribute__((__nothrow__)) gnu_dev_minor(unsigned long long int __dev) { return((__dev & 0xff) | ((unsigned int)(__dev >> 12) & ~0xff)); } __extension__ extern __inline unsigned long long int __attribute__((__nothrow__)) gnu_dev_makedev(unsigned int __major, unsigned int __minor) { return((__minor & 0xff) | ((__major & 0xfff) << 8) | (((unsigned long long int)(__minor & ~0xff)) << 12) | (((unsigned long long int)(__major & ~0xfff)) << 32)); } #220 "/usr/include/sys/types.h" 2 3 4 #231 "/usr/include/sys/types.h" 3 4 typedef __blkcnt_t blkcnt_t; typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; #266 "/usr/include/sys/types.h" 3 4 #1 "/usr/include/bits/pthreadtypes.h" 1 3 4 #23 "/usr/include/bits/pthreadtypes.h" 3 4 #1 "/usr/include/bits/sched.h" 1 3 4 #83 "/usr/include/bits/sched.h" 3 4 struct __sched_param { int __sched_priority; }; #24 "/usr/include/bits/pthreadtypes.h" 2 3 4 typedef int __atomic_lock_t; struct _pthread_fastlock { long int __status; __atomic_lock_t __spinlock; }; typedef struct _pthread_descr_struct * _pthread_descr; typedef struct __pthread_attr_s { int __detachstate; int __schedpolicy; struct __sched_param __schedparam; int __inheritsched; int __scope; size_t __guardsize; int __stackaddr_set; void *__stackaddr; size_t __stacksize; } pthread_attr_t; __extension__ typedef long long __pthread_cond_align_t; typedef struct { struct _pthread_fastlock __c_lock; _pthread_descr __c_waiting; char __padding[48 - sizeof(struct _pthread_fastlock) - sizeof(_pthread_descr) - sizeof(__pthread_cond_align_t)]; __pthread_cond_align_t __align; } pthread_cond_t; typedef struct { int __dummy; } pthread_condattr_t; typedef unsigned int pthread_key_t; typedef struct { int __m_reserved; int __m_count; _pthread_descr __m_owner; int __m_kind; struct _pthread_fastlock __m_lock; } pthread_mutex_t; typedef struct { int __mutexkind; } pthread_mutexattr_t; typedef int pthread_once_t; #152 "/usr/include/bits/pthreadtypes.h" 3 4 typedef unsigned long int pthread_t; #267 "/usr/include/sys/types.h" 2 3 4 #5 "/usr/include/directfb/dfb_types.h" 2 #1 "/usr/include/linux/types.h" 1 3 4 #1 "/usr/include/linux/posix_types.h" 1 3 4 #1 "/usr/include/linux/stddef.h" 1 3 4 #5 "/usr/include/linux/posix_types.h" 2 3 4 #36 "/usr/include/linux/posix_types.h" 3 4 typedef struct { unsigned long fds_bits [(1024 / (8 * sizeof(unsigned long)))]; } __kernel_fd_set; typedef void (*__kernel_sighandler_t)(int); typedef int __kernel_key_t; typedef int __kernel_mqd_t; #1 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/asm/posix_types.h" 1 3 4 #14 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/asm/posix_types.h" 3 4 #1 "/usr/include/asm/posix_types.h" 1 3 4 #11 "/usr/include/asm/posix_types.h" 3 4 #1 "/usr/include/asm-i386/posix_types.h" 1 3 4 #10 "/usr/include/asm-i386/posix_types.h" 3 4 typedef unsigned long __kernel_ino_t; typedef unsigned short __kernel_mode_t; typedef unsigned short __kernel_nlink_t; typedef long __kernel_off_t; typedef int __kernel_pid_t; typedef unsigned short __kernel_ipc_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_timer_t; typedef int __kernel_clockid_t; typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; typedef unsigned short __kernel_gid16_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; typedef unsigned short __kernel_old_uid_t; typedef unsigned short __kernel_old_gid_t; typedef unsigned short __kernel_old_dev_t; typedef long long __kernel_loff_t; typedef struct { int __val[2]; } __kernel_fsid_t; #12 "/usr/include/asm/posix_types.h" 2 3 4 #15 "/usr/lib/gcc/i486-linux-gnu/4.0.3/include/asm/posix_types.h" 2 3 4 #48 "/usr/include/linux/posix_types.h" 2 3 4 #6 "/usr/include/linux/types.h" 2 3 4 #1 "/usr/include/asm/types.h" 1 3 4 #11 "/usr/include/asm/types.h" 3 4 #1 "/usr/include/asm-i386/types.h" 1 3 4 typedef unsigned short umode_t; typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; typedef __signed__ long long __s64; typedef unsigned long long __u64; #12 "/usr/include/asm/types.h" 2 3 4 #7 "/usr/include/linux/types.h" 2 3 4 #133 "/usr/include/linux/types.h" 3 4 typedef __u16 __le16; typedef __u16 __be16; typedef __u32 __le32; typedef __u32 __be32; typedef __u64 __le64; typedef __u64 __be64; #6 "/usr/include/directfb/dfb_types.h" 2 #32 "/usr/include/directfb/directfb.h" 2 #1 "/usr/include/sys/time.h" 1 3 4 #26 "/usr/include/sys/time.h" 3 4 #1 "/usr/include/time.h" 1 3 4 #27 "/usr/include/sys/time.h" 2 3 4 #1 "/usr/include/bits/time.h" 1 3 4 #29 "/usr/include/sys/time.h" 2 3 4 #38 "/usr/include/sys/time.h" 3 4 #56 "/usr/include/sys/time.h" 3 4 struct timezone { int tz_minuteswest; int tz_dsttime; }; typedef struct timezone *__restrict __timezone_ptr_t; #72 "/usr/include/sys/time.h" 3 4 extern int gettimeofday(struct timeval *__restrict __tv, __timezone_ptr_t __tz) __attribute__((__nothrow__)); extern int settimeofday(__const struct timeval *__tv, __const struct timezone *__tz) __attribute__((__nothrow__)); extern int adjtime(__const struct timeval *__delta, struct timeval *__olddelta) __attribute__((__nothrow__)); enum __itimer_which { ITIMER_REAL = 0, ITIMER_VIRTUAL = 1, ITIMER_PROF = 2 }; struct itimerval { struct timeval it_interval; struct timeval it_value; }; typedef int __itimer_which_t; extern int getitimer(__itimer_which_t __which, struct itimerval *__value) __attribute__((__nothrow__)); extern int setitimer(__itimer_which_t __which, __const struct itimerval *__restrict __new, struct itimerval *__restrict __old) __attribute__((__nothrow__)); extern int utimes(__const char *__file, __const struct timeval __tvp[2]) __attribute__((__nothrow__)); extern int lutimes(__const char *__file, __const struct timeval __tvp[2]) __attribute__((__nothrow__)); extern int futimes(int __fd, __const struct timeval __tvp[2]) __attribute__((__nothrow__)); #181 "/usr/include/sys/time.h" 3 4 #33 "/usr/include/directfb/directfb.h" 2 #1 "/usr/include/directfb/directfb_keyboard.h" 1 #40 "/usr/include/directfb/directfb_keyboard.h" typedef enum { DIKT_UNICODE = 0x0000, DIKT_SPECIAL = 0xF000, DIKT_FUNCTION = 0xF100, DIKT_MODIFIER = 0xF200, DIKT_LOCK = 0xF300, DIKT_DEAD = 0xF400, DIKT_CUSTOM = 0xF500, DIKT_IDENTIFIER = 0xF600 } DFBInputDeviceKeyType; #71 "/usr/include/directfb/directfb_keyboard.h" typedef enum { DIMKI_SHIFT, DIMKI_CONTROL, DIMKI_ALT, DIMKI_ALTGR, DIMKI_META, DIMKI_SUPER, DIMKI_HYPER, DIMKI_FIRST = DIMKI_SHIFT, DIMKI_LAST = DIMKI_HYPER } DFBInputDeviceModifierKeyIdentifier; typedef enum { DIKI_UNKNOWN = ((DIKT_IDENTIFIER) | (0)), DIKI_A, DIKI_B, DIKI_C, DIKI_D, DIKI_E, DIKI_F, DIKI_G, DIKI_H, DIKI_I, DIKI_J, DIKI_K, DIKI_L, DIKI_M, DIKI_N, DIKI_O, DIKI_P, DIKI_Q, DIKI_R, DIKI_S, DIKI_T, DIKI_U, DIKI_V, DIKI_W, DIKI_X, DIKI_Y, DIKI_Z, DIKI_0, DIKI_1, DIKI_2, DIKI_3, DIKI_4, DIKI_5, DIKI_6, DIKI_7, DIKI_8, DIKI_9, DIKI_F1, DIKI_F2, DIKI_F3, DIKI_F4, DIKI_F5, DIKI_F6, DIKI_F7, DIKI_F8, DIKI_F9, DIKI_F10, DIKI_F11, DIKI_F12, DIKI_SHIFT_L, DIKI_SHIFT_R, DIKI_CONTROL_L, DIKI_CONTROL_R, DIKI_ALT_L, DIKI_ALT_R, DIKI_ALTGR, DIKI_META_L, DIKI_META_R, DIKI_SUPER_L, DIKI_SUPER_R, DIKI_HYPER_L, DIKI_HYPER_R, DIKI_CAPS_LOCK, DIKI_NUM_LOCK, DIKI_SCROLL_LOCK, DIKI_ESCAPE, DIKI_LEFT, DIKI_RIGHT, DIKI_UP, DIKI_DOWN, DIKI_TAB, DIKI_ENTER, DIKI_SPACE, DIKI_BACKSPACE, DIKI_INSERT, DIKI_DELETE, DIKI_HOME, DIKI_END, DIKI_PAGE_UP, DIKI_PAGE_DOWN, DIKI_PRINT, DIKI_PAUSE, DIKI_QUOTE_LEFT, DIKI_MINUS_SIGN, DIKI_EQUALS_SIGN, DIKI_BRACKET_LEFT, DIKI_BRACKET_RIGHT, DIKI_BACKSLASH, DIKI_SEMICOLON, DIKI_QUOTE_RIGHT, DIKI_COMMA, DIKI_PERIOD, DIKI_SLASH, DIKI_LESS_SIGN, DIKI_KP_DIV, DIKI_KP_MULT, DIKI_KP_MINUS, DIKI_KP_PLUS, DIKI_KP_ENTER, DIKI_KP_SPACE, DIKI_KP_TAB, DIKI_KP_F1, DIKI_KP_F2, DIKI_KP_F3, DIKI_KP_F4, DIKI_KP_EQUAL, DIKI_KP_SEPARATOR, DIKI_KP_DECIMAL, DIKI_KP_0, DIKI_KP_1, DIKI_KP_2, DIKI_KP_3, DIKI_KP_4, DIKI_KP_5, DIKI_KP_6, DIKI_KP_7, DIKI_KP_8, DIKI_KP_9, DIKI_KEYDEF_END, DIKI_NUMBER_OF_KEYS = DIKI_KEYDEF_END - ((DIKT_IDENTIFIER) | (0)) } DFBInputDeviceKeyIdentifier; typedef enum { DIKS_NULL = ((DIKT_UNICODE) | (0x00)), DIKS_BACKSPACE = ((DIKT_UNICODE) | (0x08)), DIKS_TAB = ((DIKT_UNICODE) | (0x09)), DIKS_RETURN = ((DIKT_UNICODE) | (0x0D)), DIKS_CANCEL = ((DIKT_UNICODE) | (0x18)), DIKS_ESCAPE = ((DIKT_UNICODE) | (0x1B)), DIKS_SPACE = ((DIKT_UNICODE) | (0x20)), DIKS_EXCLAMATION_MARK = ((DIKT_UNICODE) | (0x21)), DIKS_QUOTATION = ((DIKT_UNICODE) | (0x22)), DIKS_NUMBER_SIGN = ((DIKT_UNICODE) | (0x23)), DIKS_DOLLAR_SIGN = ((DIKT_UNICODE) | (0x24)), DIKS_PERCENT_SIGN = ((DIKT_UNICODE) | (0x25)), DIKS_AMPERSAND = ((DIKT_UNICODE) | (0x26)), DIKS_APOSTROPHE = ((DIKT_UNICODE) | (0x27)), DIKS_PARENTHESIS_LEFT = ((DIKT_UNICODE) | (0x28)), DIKS_PARENTHESIS_RIGHT = ((DIKT_UNICODE) | (0x29)), DIKS_ASTERISK = ((DIKT_UNICODE) | (0x2A)), DIKS_PLUS_SIGN = ((DIKT_UNICODE) | (0x2B)), DIKS_COMMA = ((DIKT_UNICODE) | (0x2C)), DIKS_MINUS_SIGN = ((DIKT_UNICODE) | (0x2D)), DIKS_PERIOD = ((DIKT_UNICODE) | (0x2E)), DIKS_SLASH = ((DIKT_UNICODE) | (0x2F)), DIKS_0 = ((DIKT_UNICODE) | (0x30)), DIKS_1 = ((DIKT_UNICODE) | (0x31)), DIKS_2 = ((DIKT_UNICODE) | (0x32)), DIKS_3 = ((DIKT_UNICODE) | (0x33)), DIKS_4 = ((DIKT_UNICODE) | (0x34)), DIKS_5 = ((DIKT_UNICODE) | (0x35)), DIKS_6 = ((DIKT_UNICODE) | (0x36)), DIKS_7 = ((DIKT_UNICODE) | (0x37)), DIKS_8 = ((DIKT_UNICODE) | (0x38)), DIKS_9 = ((DIKT_UNICODE) | (0x39)), DIKS_COLON = ((DIKT_UNICODE) | (0x3A)), DIKS_SEMICOLON = ((DIKT_UNICODE) | (0x3B)), DIKS_LESS_THAN_SIGN = ((DIKT_UNICODE) | (0x3C)), DIKS_EQUALS_SIGN = ((DIKT_UNICODE) | (0x3D)), DIKS_GREATER_THAN_SIGN = ((DIKT_UNICODE) | (0x3E)), DIKS_QUESTION_MARK = ((DIKT_UNICODE) | (0x3F)), DIKS_AT = ((DIKT_UNICODE) | (0x40)), DIKS_CAPITAL_A = ((DIKT_UNICODE) | (0x41)), DIKS_CAPITAL_B = ((DIKT_UNICODE) | (0x42)), DIKS_CAPITAL_C = ((DIKT_UNICODE) | (0x43)), DIKS_CAPITAL_D = ((DIKT_UNICODE) | (0x44)), DIKS_CAPITAL_E = ((DIKT_UNICODE) | (0x45)), DIKS_CAPITAL_F = ((DIKT_UNICODE) | (0x46)), DIKS_CAPITAL_G = ((DIKT_UNICODE) | (0x47)), DIKS_CAPITAL_H = ((DIKT_UNICODE) | (0x48)), DIKS_CAPITAL_I = ((DIKT_UNICODE) | (0x49)), DIKS_CAPITAL_J = ((DIKT_UNICODE) | (0x4A)), DIKS_CAPITAL_K = ((DIKT_UNICODE) | (0x4B)), DIKS_CAPITAL_L = ((DIKT_UNICODE) | (0x4C)), DIKS_CAPITAL_M = ((DIKT_UNICODE) | (0x4D)), DIKS_CAPITAL_N = ((DIKT_UNICODE) | (0x4E)), DIKS_CAPITAL_O = ((DIKT_UNICODE) | (0x4F)), DIKS_CAPITAL_P = ((DIKT_UNICODE) | (0x50)), DIKS_CAPITAL_Q = ((DIKT_UNICODE) | (0x51)), DIKS_CAPITAL_R = ((DIKT_UNICODE) | (0x52)), DIKS_CAPITAL_S = ((DIKT_UNICODE) | (0x53)), DIKS_CAPITAL_T = ((DIKT_UNICODE) | (0x54)), DIKS_CAPITAL_U = ((DIKT_UNICODE) | (0x55)), DIKS_CAPITAL_V = ((DIKT_UNICODE) | (0x56)), DIKS_CAPITAL_W = ((DIKT_UNICODE) | (0x57)), DIKS_CAPITAL_X = ((DIKT_UNICODE) | (0x58)), DIKS_CAPITAL_Y = ((DIKT_UNICODE) | (0x59)), DIKS_CAPITAL_Z = ((DIKT_UNICODE) | (0x5A)), DIKS_SQUARE_BRACKET_LEFT = ((DIKT_UNICODE) | (0x5B)), DIKS_BACKSLASH = ((DIKT_UNICODE) | (0x5C)), DIKS_SQUARE_BRACKET_RIGHT = ((DIKT_UNICODE) | (0x5D)), DIKS_CIRCUMFLEX_ACCENT = ((DIKT_UNICODE) | (0x5E)), DIKS_UNDERSCORE = ((DIKT_UNICODE) | (0x5F)), DIKS_GRAVE_ACCENT = ((DIKT_UNICODE) | (0x60)), DIKS_SMALL_A = ((DIKT_UNICODE) | (0x61)), DIKS_SMALL_B = ((DIKT_UNICODE) | (0x62)), DIKS_SMALL_C = ((DIKT_UNICODE) | (0x63)), DIKS_SMALL_D = ((DIKT_UNICODE) | (0x64)), DIKS_SMALL_E = ((DIKT_UNICODE) | (0x65)), DIKS_SMALL_F = ((DIKT_UNICODE) | (0x66)), DIKS_SMALL_G = ((DIKT_UNICODE) | (0x67)), DIKS_SMALL_H = ((DIKT_UNICODE) | (0x68)), DIKS_SMALL_I = ((DIKT_UNICODE) | (0x69)), DIKS_SMALL_J = ((DIKT_UNICODE) | (0x6A)), DIKS_SMALL_K = ((DIKT_UNICODE) | (0x6B)), DIKS_SMALL_L = ((DIKT_UNICODE) | (0x6C)), DIKS_SMALL_M = ((DIKT_UNICODE) | (0x6D)), DIKS_SMALL_N = ((DIKT_UNICODE) | (0x6E)), DIKS_SMALL_O = ((DIKT_UNICODE) | (0x6F)), DIKS_SMALL_P = ((DIKT_UNICODE) | (0x70)), DIKS_SMALL_Q = ((DIKT_UNICODE) | (0x71)), DIKS_SMALL_R = ((DIKT_UNICODE) | (0x72)), DIKS_SMALL_S = ((DIKT_UNICODE) | (0x73)), DIKS_SMALL_T = ((DIKT_UNICODE) | (0x74)), DIKS_SMALL_U = ((DIKT_UNICODE) | (0x75)), DIKS_SMALL_V = ((DIKT_UNICODE) | (0x76)), DIKS_SMALL_W = ((DIKT_UNICODE) | (0x77)), DIKS_SMALL_X = ((DIKT_UNICODE) | (0x78)), DIKS_SMALL_Y = ((DIKT_UNICODE) | (0x79)), DIKS_SMALL_Z = ((DIKT_UNICODE) | (0x7A)), DIKS_CURLY_BRACKET_LEFT = ((DIKT_UNICODE) | (0x7B)), DIKS_VERTICAL_BAR = ((DIKT_UNICODE) | (0x7C)), DIKS_CURLY_BRACKET_RIGHT = ((DIKT_UNICODE) | (0x7D)), DIKS_TILDE = ((DIKT_UNICODE) | (0x7E)), DIKS_DELETE = ((DIKT_UNICODE) | (0x7F)), DIKS_ENTER = DIKS_RETURN, DIKS_CURSOR_LEFT = ((DIKT_SPECIAL) | (0x00)), DIKS_CURSOR_RIGHT = ((DIKT_SPECIAL) | (0x01)), DIKS_CURSOR_UP = ((DIKT_SPECIAL) | (0x02)), DIKS_CURSOR_DOWN = ((DIKT_SPECIAL) | (0x03)), DIKS_INSERT = ((DIKT_SPECIAL) | (0x04)), DIKS_HOME = ((DIKT_SPECIAL) | (0x05)), DIKS_END = ((DIKT_SPECIAL) | (0x06)), DIKS_PAGE_UP = ((DIKT_SPECIAL) | (0x07)), DIKS_PAGE_DOWN = ((DIKT_SPECIAL) | (0x08)), DIKS_PRINT = ((DIKT_SPECIAL) | (0x09)), DIKS_PAUSE = ((DIKT_SPECIAL) | (0x0A)), DIKS_OK = ((DIKT_SPECIAL) | (0x0B)), DIKS_SELECT = ((DIKT_SPECIAL) | (0x0C)), DIKS_GOTO = ((DIKT_SPECIAL) | (0x0D)), DIKS_CLEAR = ((DIKT_SPECIAL) | (0x0E)), DIKS_POWER = ((DIKT_SPECIAL) | (0x0F)), DIKS_POWER2 = ((DIKT_SPECIAL) | (0x10)), DIKS_OPTION = ((DIKT_SPECIAL) | (0x11)), DIKS_MENU = ((DIKT_SPECIAL) | (0x12)), DIKS_HELP = ((DIKT_SPECIAL) | (0x13)), DIKS_INFO = ((DIKT_SPECIAL) | (0x14)), DIKS_TIME = ((DIKT_SPECIAL) | (0x15)), DIKS_VENDOR = ((DIKT_SPECIAL) | (0x16)), DIKS_ARCHIVE = ((DIKT_SPECIAL) | (0x17)), DIKS_PROGRAM = ((DIKT_SPECIAL) | (0x18)), DIKS_CHANNEL = ((DIKT_SPECIAL) | (0x19)), DIKS_FAVORITES = ((DIKT_SPECIAL) | (0x1A)), DIKS_EPG = ((DIKT_SPECIAL) | (0x1B)), DIKS_PVR = ((DIKT_SPECIAL) | (0x1C)), DIKS_MHP = ((DIKT_SPECIAL) | (0x1D)), DIKS_LANGUAGE = ((DIKT_SPECIAL) | (0x1E)), DIKS_TITLE = ((DIKT_SPECIAL) | (0x1F)), DIKS_SUBTITLE = ((DIKT_SPECIAL) | (0x20)), DIKS_ANGLE = ((DIKT_SPECIAL) | (0x21)), DIKS_ZOOM = ((DIKT_SPECIAL) | (0x22)), DIKS_MODE = ((DIKT_SPECIAL) | (0x23)), DIKS_KEYBOARD = ((DIKT_SPECIAL) | (0x24)), DIKS_PC = ((DIKT_SPECIAL) | (0x25)), DIKS_SCREEN = ((DIKT_SPECIAL) | (0x26)), DIKS_TV = ((DIKT_SPECIAL) | (0x27)), DIKS_TV2 = ((DIKT_SPECIAL) | (0x28)), DIKS_VCR = ((DIKT_SPECIAL) | (0x29)), DIKS_VCR2 = ((DIKT_SPECIAL) | (0x2A)), DIKS_SAT = ((DIKT_SPECIAL) | (0x2B)), DIKS_SAT2 = ((DIKT_SPECIAL) | (0x2C)), DIKS_CD = ((DIKT_SPECIAL) | (0x2D)), DIKS_TAPE = ((DIKT_SPECIAL) | (0x2E)), DIKS_RADIO = ((DIKT_SPECIAL) | (0x2F)), DIKS_TUNER = ((DIKT_SPECIAL) | (0x30)), DIKS_PLAYER = ((DIKT_SPECIAL) | (0x31)), DIKS_TEXT = ((DIKT_SPECIAL) | (0x32)), DIKS_DVD = ((DIKT_SPECIAL) | (0x33)), DIKS_AUX = ((DIKT_SPECIAL) | (0x34)), DIKS_MP3 = ((DIKT_SPECIAL) | (0x35)), DIKS_PHONE = ((DIKT_SPECIAL) | (0x36)), DIKS_AUDIO = ((DIKT_SPECIAL) | (0x37)), DIKS_VIDEO = ((DIKT_SPECIAL) | (0x38)), DIKS_INTERNET = ((DIKT_SPECIAL) | (0x39)), DIKS_MAIL = ((DIKT_SPECIAL) | (0x3A)), DIKS_NEWS = ((DIKT_SPECIAL) | (0x3B)), DIKS_DIRECTORY = ((DIKT_SPECIAL) | (0x3C)), DIKS_LIST = ((DIKT_SPECIAL) | (0x3D)), DIKS_CALCULATOR = ((DIKT_SPECIAL) | (0x3E)), DIKS_MEMO = ((DIKT_SPECIAL) | (0x3F)), DIKS_CALENDAR = ((DIKT_SPECIAL) | (0x40)), DIKS_EDITOR = ((DIKT_SPECIAL) | (0x41)), DIKS_RED = ((DIKT_SPECIAL) | (0x42)), DIKS_GREEN = ((DIKT_SPECIAL) | (0x43)), DIKS_YELLOW = ((DIKT_SPECIAL) | (0x44)), DIKS_BLUE = ((DIKT_SPECIAL) | (0x45)), DIKS_CHANNEL_UP = ((DIKT_SPECIAL) | (0x46)), DIKS_CHANNEL_DOWN = ((DIKT_SPECIAL) | (0x47)), DIKS_BACK = ((DIKT_SPECIAL) | (0x48)), DIKS_FORWARD = ((DIKT_SPECIAL) | (0x49)), DIKS_FIRST = ((DIKT_SPECIAL) | (0x4A)), DIKS_LAST = ((DIKT_SPECIAL) | (0x4B)), DIKS_VOLUME_UP = ((DIKT_SPECIAL) | (0x4C)), DIKS_VOLUME_DOWN = ((DIKT_SPECIAL) | (0x4D)), DIKS_MUTE = ((DIKT_SPECIAL) | (0x4E)), DIKS_AB = ((DIKT_SPECIAL) | (0x4F)), DIKS_PLAYPAUSE = ((DIKT_SPECIAL) | (0x50)), DIKS_PLAY = ((DIKT_SPECIAL) | (0x51)), DIKS_STOP = ((DIKT_SPECIAL) | (0x52)), DIKS_RESTART = ((DIKT_SPECIAL) | (0x53)), DIKS_SLOW = ((DIKT_SPECIAL) | (0x54)), DIKS_FAST = ((DIKT_SPECIAL) | (0x55)), DIKS_RECORD = ((DIKT_SPECIAL) | (0x56)), DIKS_EJECT = ((DIKT_SPECIAL) | (0x57)), DIKS_SHUFFLE = ((DIKT_SPECIAL) | (0x58)), DIKS_REWIND = ((DIKT_SPECIAL) | (0x59)), DIKS_FASTFORWARD = ((DIKT_SPECIAL) | (0x5A)), DIKS_PREVIOUS = ((DIKT_SPECIAL) | (0x5B)), DIKS_NEXT = ((DIKT_SPECIAL) | (0x5C)), DIKS_BEGIN = ((DIKT_SPECIAL) | (0x5D)), DIKS_DIGITS = ((DIKT_SPECIAL) | (0x5E)), DIKS_TEEN = ((DIKT_SPECIAL) | (0x5F)), DIKS_TWEN = ((DIKT_SPECIAL) | (0x60)), DIKS_BREAK = ((DIKT_SPECIAL) | (0x61)), DIKS_EXIT = ((DIKT_SPECIAL) | (0x62)), DIKS_SETUP = ((DIKT_SPECIAL) | (0x63)), DIKS_CURSOR_LEFT_UP = ((DIKT_SPECIAL) | (0x64)), DIKS_CURSOR_LEFT_DOWN = ((DIKT_SPECIAL) | (0x65)), DIKS_CURSOR_UP_RIGHT = ((DIKT_SPECIAL) | (0x66)), DIKS_CURSOR_DOWN_RIGHT = ((DIKT_SPECIAL) | (0x67)), DIKS_F1 = (((DIKT_FUNCTION) | (1))), DIKS_F2 = (((DIKT_FUNCTION) | (2))), DIKS_F3 = (((DIKT_FUNCTION) | (3))), DIKS_F4 = (((DIKT_FUNCTION) | (4))), DIKS_F5 = (((DIKT_FUNCTION) | (5))), DIKS_F6 = (((DIKT_FUNCTION) | (6))), DIKS_F7 = (((DIKT_FUNCTION) | (7))), DIKS_F8 = (((DIKT_FUNCTION) | (8))), DIKS_F9 = (((DIKT_FUNCTION) | (9))), DIKS_F10 = (((DIKT_FUNCTION) | (10))), DIKS_F11 = (((DIKT_FUNCTION) | (11))), DIKS_F12 = (((DIKT_FUNCTION) | (12))), DIKS_SHIFT = (((DIKT_MODIFIER) | ((1 << DIMKI_SHIFT)))), DIKS_CONTROL = (((DIKT_MODIFIER) | ((1 << DIMKI_CONTROL)))), DIKS_ALT = (((DIKT_MODIFIER) | ((1 << DIMKI_ALT)))), DIKS_ALTGR = (((DIKT_MODIFIER) | ((1 << DIMKI_ALTGR)))), DIKS_META = (((DIKT_MODIFIER) | ((1 << DIMKI_META)))), DIKS_SUPER = (((DIKT_MODIFIER) | ((1 << DIMKI_SUPER)))), DIKS_HYPER = (((DIKT_MODIFIER) | ((1 << DIMKI_HYPER)))), DIKS_CAPS_LOCK = ((DIKT_LOCK) | (0x00)), DIKS_NUM_LOCK = ((DIKT_LOCK) | (0x01)), DIKS_SCROLL_LOCK = ((DIKT_LOCK) | (0x02)), DIKS_DEAD_ABOVEDOT = ((DIKT_DEAD) | (0x00)), DIKS_DEAD_ABOVERING = ((DIKT_DEAD) | (0x01)), DIKS_DEAD_ACUTE = ((DIKT_DEAD) | (0x02)), DIKS_DEAD_BREVE = ((DIKT_DEAD) | (0x03)), DIKS_DEAD_CARON = ((DIKT_DEAD) | (0x04)), DIKS_DEAD_CEDILLA = ((DIKT_DEAD) | (0x05)), DIKS_DEAD_CIRCUMFLEX = ((DIKT_DEAD) | (0x06)), DIKS_DEAD_DIAERESIS = ((DIKT_DEAD) | (0x07)), DIKS_DEAD_DOUBLEACUTE = ((DIKT_DEAD) | (0x08)), DIKS_DEAD_GRAVE = ((DIKT_DEAD) | (0x09)), DIKS_DEAD_IOTA = ((DIKT_DEAD) | (0x0A)), DIKS_DEAD_MACRON = ((DIKT_DEAD) | (0x0B)), DIKS_DEAD_OGONEK = ((DIKT_DEAD) | (0x0C)), DIKS_DEAD_SEMIVOICED_SOUND = ((DIKT_DEAD) | (0x0D)), DIKS_DEAD_TILDE = ((DIKT_DEAD) | (0x0E)), DIKS_DEAD_VOICED_SOUND = ((DIKT_DEAD) | (0x0F)), DIKS_CUSTOM0 = (((DIKT_CUSTOM) | (0))), DIKS_CUSTOM1 = (((DIKT_CUSTOM) | (1))), DIKS_CUSTOM2 = (((DIKT_CUSTOM) | (2))), DIKS_CUSTOM3 = (((DIKT_CUSTOM) | (3))), DIKS_CUSTOM4 = (((DIKT_CUSTOM) | (4))), DIKS_CUSTOM5 = (((DIKT_CUSTOM) | (5))), DIKS_CUSTOM6 = (((DIKT_CUSTOM) | (6))), DIKS_CUSTOM7 = (((DIKT_CUSTOM) | (7))), DIKS_CUSTOM8 = (((DIKT_CUSTOM) | (8))), DIKS_CUSTOM9 = (((DIKT_CUSTOM) | (9))) } DFBInputDeviceKeySymbol; typedef enum { DILS_SCROLL = 0x00000001, DILS_NUM = 0x00000002, DILS_CAPS = 0x00000004 } DFBInputDeviceLockState; typedef enum { DIKSI_BASE = 0x00, DIKSI_BASE_SHIFT = 0x01, DIKSI_ALT = 0x02, DIKSI_ALT_SHIFT = 0x03, DIKSI_LAST = DIKSI_ALT_SHIFT } DFBInputDeviceKeymapSymbolIndex; typedef struct { int code; DFBInputDeviceLockState locks; DFBInputDeviceKeyIdentifier identifier; DFBInputDeviceKeySymbol symbols[DIKSI_LAST + 1]; } DFBInputDeviceKeymapEntry; #35 "/usr/include/directfb/directfb.h" 2 #68 "/usr/include/directfb/directfb.h" extern const unsigned int directfb_major_version; extern const unsigned int directfb_minor_version; extern const unsigned int directfb_micro_version; extern const unsigned int directfb_binary_age; extern const unsigned int directfb_interface_age; const char *DirectFBCheckVersion(unsigned int required_major, unsigned int required_minor, unsigned int required_micro); typedef struct _IDirectFB IDirectFB; typedef struct _IDirectFBScreen IDirectFBScreen; typedef struct _IDirectFBDisplayLayer IDirectFBDisplayLayer; typedef struct _IDirectFBSurface IDirectFBSurface; typedef struct _IDirectFBPalette IDirectFBPalette; typedef struct _IDirectFBWindow IDirectFBWindow; typedef struct _IDirectFBInputDevice IDirectFBInputDevice; typedef struct _IDirectFBEventBuffer IDirectFBEventBuffer; typedef struct _IDirectFBFont IDirectFBFont; typedef struct _IDirectFBImageProvider IDirectFBImageProvider; typedef struct _IDirectFBVideoProvider IDirectFBVideoProvider; typedef struct _IDirectFBDataBuffer IDirectFBDataBuffer; typedef struct _IDirectFBGL IDirectFBGL; typedef enum { DFB_OK, DFB_FAILURE, DFB_INIT, DFB_BUG, DFB_DEAD, DFB_UNSUPPORTED, DFB_UNIMPLEMENTED, DFB_ACCESSDENIED, DFB_INVARG, DFB_NOSYSTEMMEMORY, DFB_NOVIDEOMEMORY, DFB_LOCKED, DFB_BUFFEREMPTY, DFB_FILENOTFOUND, DFB_IO, DFB_BUSY, DFB_NOIMPL, DFB_MISSINGFONT, DFB_TIMEOUT, DFB_MISSINGIMAGE, DFB_THIZNULL, DFB_IDNOTFOUND, DFB_INVAREA, DFB_DESTROYED, DFB_FUSION, DFB_BUFFERTOOLARGE, DFB_INTERRUPTED, DFB_NOCONTEXT, DFB_TEMPUNAVAIL, DFB_LIMITEXCEEDED, DFB_NOSUCHMETHOD, DFB_NOSUCHINSTANCE, DFB_ITEMNOTFOUND, DFB_VERSIONMISMATCH, DFB_NOSHAREDMEMORY } DFBResult; typedef enum { DFB_FALSE = 0, DFB_TRUE = !DFB_FALSE } DFBBoolean; typedef struct { int x; int y; } DFBPoint; typedef struct { int x; int w; } DFBSpan; typedef struct { int w; int h; } DFBDimension; typedef struct { int x; int y; int w; int h; } DFBRectangle; typedef struct { float x; float y; float w; float h; } DFBLocation; typedef struct { int x1; int y1; int x2; int y2; } DFBRegion; typedef struct { int l; int t; int r; int b; } DFBInsets; typedef struct { int x1; int y1; int x2; int y2; int x3; int y3; } DFBTriangle; typedef struct { __u8 a; __u8 r; __u8 g; __u8 b; } DFBColor; #335 "/usr/include/directfb/directfb.h" DFBResult DirectFBError( const char *msg, DFBResult result ); DFBResult DirectFBErrorFatal( const char *msg, DFBResult result ); const char *DirectFBErrorString( DFBResult result ); const char *DirectFBUsageString(void); DFBResult DirectFBInit( int *argc, char **argv[] ); DFBResult DirectFBSetOption( const char *name, const char *value ); DFBResult DirectFBCreate( IDirectFB **interface ); typedef unsigned int DFBScreenID; typedef unsigned int DFBDisplayLayerID; typedef unsigned int DFBDisplayLayerSourceID; typedef unsigned int DFBWindowID; typedef unsigned int DFBInputDeviceID; typedef __u32 DFBDisplayLayerIDs; #428 "/usr/include/directfb/directfb.h" typedef enum { DFSCL_NORMAL = 0x00000000, DFSCL_FULLSCREEN, DFSCL_EXCLUSIVE } DFBCooperativeLevel; typedef enum { DLCAPS_NONE = 0x00000000, DLCAPS_SURFACE = 0x00000001, DLCAPS_OPACITY = 0x00000002, DLCAPS_ALPHACHANNEL = 0x00000004, DLCAPS_SCREEN_LOCATION = 0x00000008, DLCAPS_FLICKER_FILTERING = 0x00000010, DLCAPS_DEINTERLACING = 0x00000020, DLCAPS_SRC_COLORKEY = 0x00000040, DLCAPS_DST_COLORKEY = 0x00000080, DLCAPS_BRIGHTNESS = 0x00000100, DLCAPS_CONTRAST = 0x00000200, DLCAPS_HUE = 0x00000400, DLCAPS_SATURATION = 0x00000800, DLCAPS_LEVELS = 0x00001000, DLCAPS_FIELD_PARITY = 0x00002000, DLCAPS_WINDOWS = 0x00004000, DLCAPS_SOURCES = 0x00008000, DLCAPS_ALPHA_RAMP = 0x00010000, DLCAPS_PREMULTIPLIED = 0x00020000, DLCAPS_SCREEN_POSITION = 0x00100000, DLCAPS_SCREEN_SIZE = 0x00200000, DLCAPS_ALL = 0x0033FFFF } DFBDisplayLayerCapabilities; typedef enum { DSCCAPS_NONE = 0x00000000, DSCCAPS_VSYNC = 0x00000001, DSCCAPS_POWER_MANAGEMENT = 0x00000002, DSCCAPS_MIXERS = 0x00000010, DSCCAPS_ENCODERS = 0x00000020, DSCCAPS_OUTPUTS = 0x00000040, DSCCAPS_ALL = 0x00000073 } DFBScreenCapabilities; typedef enum { DLOP_NONE = 0x00000000, DLOP_ALPHACHANNEL = 0x00000001, DLOP_FLICKER_FILTERING = 0x00000002, DLOP_DEINTERLACING = 0x00000004, DLOP_SRC_COLORKEY = 0x00000008, DLOP_DST_COLORKEY = 0x00000010, DLOP_OPACITY = 0x00000020, DLOP_FIELD_PARITY = 0x00000040 } DFBDisplayLayerOptions; typedef enum { DLBM_UNKNOWN = 0x00000000, DLBM_FRONTONLY = 0x00000001, DLBM_BACKVIDEO = 0x00000002, DLBM_BACKSYSTEM = 0x00000004, DLBM_TRIPLE = 0x00000008, DLBM_WINDOWS = 0x00000010 } DFBDisplayLayerBufferMode; typedef enum { DSDESC_CAPS = 0x00000001, DSDESC_WIDTH = 0x00000002, DSDESC_HEIGHT = 0x00000004, DSDESC_PIXELFORMAT = 0x00000008, DSDESC_PREALLOCATED = 0x00000010, DSDESC_PALETTE = 0x00000020 } DFBSurfaceDescriptionFlags; typedef enum { DPDESC_CAPS = 0x00000001, DPDESC_SIZE = 0x00000002, DPDESC_ENTRIES = 0x00000004 } DFBPaletteDescriptionFlags; typedef enum { DSCAPS_NONE = 0x00000000, DSCAPS_PRIMARY = 0x00000001, DSCAPS_SYSTEMONLY = 0x00000002, DSCAPS_VIDEOONLY = 0x00000004, DSCAPS_DOUBLE = 0x00000010, DSCAPS_SUBSURFACE = 0x00000020, DSCAPS_INTERLACED = 0x00000040, DSCAPS_SEPARATED = 0x00000080, DSCAPS_STATIC_ALLOC = 0x00000100, DSCAPS_TRIPLE = 0x00000200, DSCAPS_PREMULTIPLIED = 0x00001000, DSCAPS_DEPTH = 0x00010000, DSCAPS_ALL = 0x000113F7, DSCAPS_FLIPPING = DSCAPS_DOUBLE | DSCAPS_TRIPLE } DFBSurfaceCapabilities; typedef enum { DPCAPS_NONE = 0x00000000 } DFBPaletteCapabilities; typedef enum { DSDRAW_NOFX = 0x00000000, DSDRAW_BLEND = 0x00000001, DSDRAW_DST_COLORKEY = 0x00000002, DSDRAW_SRC_PREMULTIPLY = 0x00000004, DSDRAW_DST_PREMULTIPLY = 0x00000008, DSDRAW_DEMULTIPLY = 0x00000010, DSDRAW_XOR = 0x00000020 } DFBSurfaceDrawingFlags; typedef enum { DSBLIT_NOFX = 0x00000000, DSBLIT_BLEND_ALPHACHANNEL = 0x00000001, DSBLIT_BLEND_COLORALPHA = 0x00000002, DSBLIT_COLORIZE = 0x00000004, DSBLIT_SRC_COLORKEY = 0x00000008, DSBLIT_DST_COLORKEY = 0x00000010, DSBLIT_SRC_PREMULTIPLY = 0x00000020, DSBLIT_DST_PREMULTIPLY = 0x00000040, DSBLIT_DEMULTIPLY = 0x00000080, DSBLIT_DEINTERLACE = 0x00000100 } DFBSurfaceBlittingFlags; typedef enum { DFXL_NONE = 0x00000000, DFXL_FILLRECTANGLE = 0x00000001, DFXL_DRAWRECTANGLE = 0x00000002, DFXL_DRAWLINE = 0x00000004, DFXL_FILLTRIANGLE = 0x00000008, DFXL_BLIT = 0x00010000, DFXL_STRETCHBLIT = 0x00020000, DFXL_TEXTRIANGLES = 0x00040000, DFXL_DRAWSTRING = 0x01000000, DFXL_ALL = 0x0107000F } DFBAccelerationMask; #699 "/usr/include/directfb/directfb.h" typedef struct { DFBAccelerationMask acceleration_mask; DFBSurfaceDrawingFlags drawing_flags; DFBSurfaceBlittingFlags blitting_flags; unsigned int video_memory; } DFBCardCapabilities; typedef enum { DLTF_NONE = 0x00000000, DLTF_GRAPHICS = 0x00000001, DLTF_VIDEO = 0x00000002, DLTF_STILL_PICTURE = 0x00000004, DLTF_BACKGROUND = 0x00000008, DLTF_ALL = 0x0000000F } DFBDisplayLayerTypeFlags; typedef enum { DIDTF_NONE = 0x00000000, DIDTF_KEYBOARD = 0x00000001, DIDTF_MOUSE = 0x00000002, DIDTF_JOYSTICK = 0x00000004, DIDTF_REMOTE = 0x00000008, DIDTF_VIRTUAL = 0x00000010, DIDTF_ALL = 0x0000001F } DFBInputDeviceTypeFlags; typedef enum { DICAPS_KEYS = 0x00000001, DICAPS_AXES = 0x00000002, DICAPS_BUTTONS = 0x00000004, DICAPS_ALL = 0x00000007 } DFBInputDeviceCapabilities; typedef enum { DIBI_LEFT = 0x00000000, DIBI_RIGHT = 0x00000001, DIBI_MIDDLE = 0x00000002, DIBI_FIRST = DIBI_LEFT, DIBI_LAST = 0x0000001F } DFBInputDeviceButtonIdentifier; #768 "/usr/include/directfb/directfb.h" typedef enum { DIAI_X = 0x00000000, DIAI_Y = 0x00000001, DIAI_Z = 0x00000002, DIAI_FIRST = DIAI_X, DIAI_LAST = 0x0000001F } DFBInputDeviceAxisIdentifier; typedef enum { DWDESC_CAPS = 0x00000001, DWDESC_WIDTH = 0x00000002, DWDESC_HEIGHT = 0x00000004, DWDESC_PIXELFORMAT = 0x00000008, DWDESC_POSX = 0x00000010, DWDESC_POSY = 0x00000020, DWDESC_SURFACE_CAPS = 0x00000040 } DFBWindowDescriptionFlags; typedef enum { DBDESC_FILE = 0x00000001, DBDESC_MEMORY = 0x00000002 } DFBDataBufferDescriptionFlags; typedef enum { DWCAPS_NONE = 0x00000000, DWCAPS_ALPHACHANNEL = 0x00000001, DWCAPS_DOUBLEBUFFER = 0x00000002, DWCAPS_INPUTONLY = 0x00000004, DWCAPS_NODECORATION = 0x00000008, DWCAPS_ALL = 0x0000000F } DFBWindowCapabilities; #834 "/usr/include/directfb/directfb.h" typedef enum { DFFA_NONE = 0x00000000, DFFA_NOKERNING = 0x00000001, DFFA_NOHINTING = 0x00000002, DFFA_MONOCHROME = 0x00000004, DFFA_NOCHARMAP = 0x00000008 } DFBFontAttributes; typedef enum { DFDESC_ATTRIBUTES = 0x00000001, DFDESC_HEIGHT = 0x00000002, DFDESC_WIDTH = 0x00000004, DFDESC_INDEX = 0x00000008, DFDESC_FIXEDADVANCE = 0x00000010 } DFBFontDescriptionFlags; #869 "/usr/include/directfb/directfb.h" typedef struct { DFBFontDescriptionFlags flags; DFBFontAttributes attributes; int height; int width; unsigned int index; int fixed_advance; } DFBFontDescription; #916 "/usr/include/directfb/directfb.h" typedef enum { DSPF_UNKNOWN = 0x00000000, DSPF_ARGB1555 = ((((0) & 0x7F)) | (((15) & 0x1F) << 7) | (((1) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((2) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_RGB16 = ((((1) & 0x7F)) | (((16) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((2) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_RGB24 = ((((2) & 0x7F)) | (((24) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((3) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_RGB32 = ((((3) & 0x7F)) | (((24) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((4) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_ARGB = ((((4) & 0x7F)) | (((24) & 0x1F) << 7) | (((8) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((4) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_A8 = ((((5) & 0x7F)) | (((0) & 0x1F) << 7) | (((8) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_YUY2 = ((((6) & 0x7F)) | (((16) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((2) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_RGB332 = ((((7) & 0x7F)) | (((8) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_UYVY = ((((8) & 0x7F)) | (((16) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((2) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_I420 = ((((9) & 0x7F)) | (((12) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((2) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_YV12 = ((((10) & 0x7F)) | (((12) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((2) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_LUT8 = ((((11) & 0x7F)) | (((8) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((1) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_ALUT44 = ((((12) & 0x7F)) | (((4) & 0x1F) << 7) | (((4) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((1) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_AiRGB = ((((13) & 0x7F)) | (((24) & 0x1F) << 7) | (((8) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((4) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((1) ? 1 : 0) << 31)), DSPF_A1 = ((((14) & 0x7F)) | (((0) & 0x1F) << 7) | (((1) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((1) & 0x07) << 17) | (((0) & 0x07) << 20) | (((7) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_NV12 = ((((15) & 0x7F)) | (((12) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((2) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_NV16 = ((((16) & 0x7F)) | (((24) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((2) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_ARGB2554 = ((((17) & 0x7F)) | (((14) & 0x1F) << 7) | (((2) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((2) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_ARGB4444 = ((((18) & 0x7F)) | (((12) & 0x1F) << 7) | (((4) & 0x0F) << 12) | (((1) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((2) & 0x07) << 20) | (((0) & 0x07) << 23) | (((0) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)), DSPF_NV21 = ((((19) & 0x7F)) | (((12) & 0x1F) << 7) | (((0) & 0x0F) << 12) | (((0) ? 1 : 0) << 16) | (((0) & 0x07) << 17) | (((1) & 0x07) << 20) | (((0) & 0x07) << 23) | (((2) & 0x03) << 26) | (((0) & 0x03) << 28) | (((0) ? 1 : 0) << 30) | (((0) ? 1 : 0) << 31)) } DFBSurfacePixelFormat; #1012 "/usr/include/directfb/directfb.h" typedef struct { DFBSurfaceDescriptionFlags flags; DFBSurfaceCapabilities caps; int width; int height; DFBSurfacePixelFormat pixelformat; struct { void *data; int pitch; } preallocated[2]; struct { DFBColor *entries; unsigned int size; } palette; } DFBSurfaceDescription; typedef struct { DFBPaletteDescriptionFlags flags; DFBPaletteCapabilities caps; unsigned int size; DFBColor *entries; } DFBPaletteDescription; typedef struct { DFBDisplayLayerTypeFlags type; DFBDisplayLayerCapabilities caps; char name[32]; int level; int regions; int sources; } DFBDisplayLayerDescription; typedef struct { DFBDisplayLayerSourceID source_id; char name[24]; } DFBDisplayLayerSourceDescription; typedef struct { DFBScreenCapabilities caps; char name[32]; int mixers; int encoders; int outputs; } DFBScreenDescription; #1104 "/usr/include/directfb/directfb.h" typedef struct { DFBInputDeviceTypeFlags type; DFBInputDeviceCapabilities caps; int min_keycode; int max_keycode; DFBInputDeviceAxisIdentifier max_axis; DFBInputDeviceButtonIdentifier max_button; char name[32]; char vendor[40]; } DFBInputDeviceDescription; typedef struct { DFBWindowDescriptionFlags flags; DFBWindowCapabilities caps; int width; int height; DFBSurfacePixelFormat pixelformat; int posx; int posy; DFBSurfaceCapabilities surface_caps; } DFBWindowDescription; typedef struct { DFBDataBufferDescriptionFlags flags; const char *file; struct { const void *data; unsigned int length; } memory; } DFBDataBufferDescription; typedef enum { DFENUM_OK = 0x00000000, DFENUM_CANCEL = 0x00000001 } DFBEnumerationResult; typedef DFBEnumerationResult (*DFBVideoModeCallback)( int width, int height, int bpp, void *callbackdata ); typedef DFBEnumerationResult (*DFBScreenCallback)( DFBScreenID screen_id, DFBScreenDescription desc, void *callbackdata ); typedef DFBEnumerationResult (*DFBDisplayLayerCallback)( DFBDisplayLayerID layer_id, DFBDisplayLayerDescription desc, void *callbackdata ); typedef DFBEnumerationResult (*DFBInputDeviceCallback)( DFBInputDeviceID device_id, DFBInputDeviceDescription desc, void *callbackdata ); typedef int (*DFBGetDataCallback)( void *buffer, unsigned int length, void *callbackdata ); typedef enum { DVCAPS_BASIC = 0x00000000, DVCAPS_SEEK = 0x00000001, DVCAPS_SCALE = 0x00000002, DVCAPS_INTERLACED = 0x00000004, DVCAPS_BRIGHTNESS = 0x00000010, DVCAPS_CONTRAST = 0x00000020, DVCAPS_HUE = 0x00000040, DVCAPS_SATURATION = 0x00000080 } DFBVideoProviderCapabilities; typedef enum { DCAF_NONE = 0x00000000, DCAF_BRIGHTNESS = 0x00000001, DCAF_CONTRAST = 0x00000002, DCAF_HUE = 0x00000004, DCAF_SATURATION = 0x00000008 } DFBColorAdjustmentFlags; typedef struct { DFBColorAdjustmentFlags flags; __u16 brightness; __u16 contrast; __u16 hue; __u16 saturation; } DFBColorAdjustment; #1319 "/usr/include/directfb/directfb.h" struct _IDirectFB { void *priv; int magic; DFBResult (*AddRef)(IDirectFB *thiz); DFBResult (*Release)(IDirectFB *thiz); DFBResult (*SetCooperativeLevel)(IDirectFB *thiz, DFBCooperativeLevel level); DFBResult (*SetVideoMode)(IDirectFB *thiz, int width, int height, int bpp); DFBResult (*GetCardCapabilities)(IDirectFB *thiz, DFBCardCapabilities *ret_caps); DFBResult (*EnumVideoModes)(IDirectFB *thiz, DFBVideoModeCallback callback, void *callbackdata); DFBResult (*CreateSurface)(IDirectFB *thiz, const DFBSurfaceDescription *desc, IDirectFBSurface **ret_interface); DFBResult (*CreatePalette)(IDirectFB *thiz, const DFBPaletteDescription *desc, IDirectFBPalette **ret_interface); DFBResult (*EnumScreens)(IDirectFB *thiz, DFBScreenCallback callback, void *callbackdata); DFBResult (*GetScreen)(IDirectFB *thiz, DFBScreenID screen_id, IDirectFBScreen **ret_interface); DFBResult (*EnumDisplayLayers)(IDirectFB *thiz, DFBDisplayLayerCallback callback, void *callbackdata); DFBResult (*GetDisplayLayer)(IDirectFB *thiz, DFBDisplayLayerID layer_id, IDirectFBDisplayLayer **ret_interface); DFBResult (*EnumInputDevices)(IDirectFB *thiz, DFBInputDeviceCallback callback, void *callbackdata); DFBResult (*GetInputDevice)(IDirectFB *thiz, DFBInputDeviceID device_id, IDirectFBInputDevice **ret_interface); DFBResult (*CreateEventBuffer)(IDirectFB *thiz, IDirectFBEventBuffer **ret_buffer); DFBResult (*CreateInputEventBuffer)(IDirectFB *thiz, DFBInputDeviceCapabilities caps, DFBBoolean global, IDirectFBEventBuffer **ret_buffer); DFBResult (*CreateImageProvider)(IDirectFB *thiz, const char *filename, IDirectFBImageProvider **ret_interface); DFBResult (*CreateVideoProvider)(IDirectFB *thiz, const char *filename, IDirectFBVideoProvider **ret_interface); DFBResult (*CreateFont)(IDirectFB *thiz, const char *filename, const DFBFontDescription *desc, IDirectFBFont **ret_interface); DFBResult (*CreateDataBuffer)(IDirectFB *thiz, const DFBDataBufferDescription *desc, IDirectFBDataBuffer **ret_interface); DFBResult (*SetClipboardData)(IDirectFB *thiz, const char *mime_type, const void *data, unsigned int size, struct timeval *ret_timestamp); DFBResult (*GetClipboardData)(IDirectFB *thiz, char **ret_mimetype, void **ret_data, unsigned int *ret_size); DFBResult (*GetClipboardTimeStamp)(IDirectFB *thiz, struct timeval *ret_timestamp); DFBResult (*Suspend)(IDirectFB *thiz); DFBResult (*Resume)(IDirectFB *thiz); DFBResult (*WaitIdle)(IDirectFB *thiz); DFBResult (*WaitForSync)(IDirectFB *thiz); DFBResult (*GetInterface)(IDirectFB *thiz, const char *type, const char *implementation, void *arg, void **ret_interface); }; #1681 "/usr/include/directfb/directfb.h" typedef enum { DLSCL_SHARED = 0, DLSCL_EXCLUSIVE, DLSCL_ADMINISTRATIVE } DFBDisplayLayerCooperativeLevel; typedef enum { DLBM_DONTCARE = 0, DLBM_COLOR, DLBM_IMAGE, DLBM_TILE } DFBDisplayLayerBackgroundMode; typedef enum { DLCONF_NONE = 0x00000000, DLCONF_WIDTH = 0x00000001, DLCONF_HEIGHT = 0x00000002, DLCONF_PIXELFORMAT = 0x00000004, DLCONF_BUFFERMODE = 0x00000008, DLCONF_OPTIONS = 0x00000010, DLCONF_SOURCE = 0x00000020, DLCONF_SURFACE_CAPS = 0x00000040, DLCONF_ALL = 0x0000007F } DFBDisplayLayerConfigFlags; typedef struct { DFBDisplayLayerConfigFlags flags; int width; int height; DFBSurfacePixelFormat pixelformat; DFBDisplayLayerBufferMode buffermode; DFBDisplayLayerOptions options; DFBDisplayLayerSourceID source; DFBSurfaceCapabilities surface_caps; } DFBDisplayLayerConfig; typedef enum { DSPM_ON = 0, DSPM_STANDBY, DSPM_SUSPEND, DSPM_OFF } DFBScreenPowerMode; typedef enum { DSMCAPS_NONE = 0x00000000, DSMCAPS_FULL = 0x00000001, DSMCAPS_SUB_LEVEL = 0x00000002, DSMCAPS_SUB_LAYERS = 0x00000004, DSMCAPS_BACKGROUND = 0x00000008 } DFBScreenMixerCapabilities; typedef struct { DFBScreenMixerCapabilities caps; DFBDisplayLayerIDs layers; int sub_num; DFBDisplayLayerIDs sub_layers; char name[24]; } DFBScreenMixerDescription; typedef enum { DSMCONF_NONE = 0x00000000, DSMCONF_TREE = 0x00000001, DSMCONF_LEVEL = 0x00000002, DSMCONF_LAYERS = 0x00000004, DSMCONF_BACKGROUND = 0x00000010, DSMCONF_ALL = 0x00000017 } DFBScreenMixerConfigFlags; typedef enum { DSMT_UNKNOWN = 0x00000000, DSMT_FULL = 0x00000001, DSMT_SUB_LEVEL = 0x00000002, DSMT_SUB_LAYERS = 0x00000003 } DFBScreenMixerTree; typedef struct { DFBScreenMixerConfigFlags flags; DFBScreenMixerTree tree; int level; DFBDisplayLayerIDs layers; DFBColor background; } DFBScreenMixerConfig; typedef enum { DSOCAPS_NONE = 0x00000000, DSOCAPS_CONNECTORS = 0x00000001, DSOCAPS_ENCODER_SEL = 0x00000010, DSOCAPS_SIGNAL_SEL = 0x00000020, DSOCAPS_CONNECTOR_SEL = 0x00000040, DSOCAPS_ALL = 0x00000071 } DFBScreenOutputCapabilities; typedef enum { DSOC_UNKNOWN = 0x00000000, DSOC_VGA = 0x00000001, DSOC_SCART = 0x00000002, DSOC_YC = 0x00000004, DSOC_CVBS = 0x00000008 } DFBScreenOutputConnectors; typedef enum { DSOS_NONE = 0x00000000, DSOS_VGA = 0x00000001, DSOS_YC = 0x00000002, DSOS_CVBS = 0x00000004, DSOS_RGB = 0x00000008, DSOS_YCBCR = 0x00000010 } DFBScreenOutputSignals; typedef struct { DFBScreenOutputCapabilities caps; DFBScreenOutputConnectors all_connectors; DFBScreenOutputSignals all_signals; char name[24]; } DFBScreenOutputDescription; typedef enum { DSOCONF_NONE = 0x00000000, DSOCONF_ENCODER = 0x00000001, DSOCONF_SIGNALS = 0x00000002, DSOCONF_CONNECTORS = 0x00000004, DSOCONF_ALL = 0x00000007 } DFBScreenOutputConfigFlags; typedef struct { DFBScreenOutputConfigFlags flags; int encoder; DFBScreenOutputSignals out_signals; DFBScreenOutputConnectors out_connectors; } DFBScreenOutputConfig; typedef enum { DSECAPS_NONE = 0x00000000, DSECAPS_TV_STANDARDS = 0x00000001, DSECAPS_TEST_PICTURE = 0x00000002, DSECAPS_MIXER_SEL = 0x00000004, DSECAPS_OUT_SIGNALS = 0x00000008, DSECAPS_SCANMODE = 0x00000010, DSECAPS_BRIGHTNESS = 0x00000100, DSECAPS_CONTRAST = 0x00000200, DSECAPS_HUE = 0x00000400, DSECAPS_SATURATION = 0x00000800, DSECAPS_ALL = 0x00000f1f } DFBScreenEncoderCapabilities; typedef enum { DSET_UNKNOWN = 0x00000000, DSET_CRTC = 0x00000001, DSET_TV = 0x00000002 } DFBScreenEncoderType; typedef enum { DSETV_UNKNOWN = 0x00000000, DSETV_PAL = 0x00000001, DSETV_NTSC = 0x00000002, DSETV_SECAM = 0x00000004 } DFBScreenEncoderTVStandards; typedef enum { DSESM_UNKNOWN = 0x00000000, DSESM_INTERLACED = 0x00000001, DSESM_PROGRESSIVE = 0x00000002 } DFBScreenEncoderScanMode; typedef struct { DFBScreenEncoderCapabilities caps; DFBScreenEncoderType type; DFBScreenEncoderTVStandards tv_standards; DFBScreenOutputSignals out_signals; char name[24]; } DFBScreenEncoderDescription; typedef enum { DSECONF_NONE = 0x00000000, DSECONF_TV_STANDARD = 0x00000001, DSECONF_TEST_PICTURE = 0x00000002, DSECONF_MIXER = 0x00000004, DSECONF_OUT_SIGNALS = 0x00000008, DSECONF_SCANMODE = 0x00000010, DSECONF_TEST_COLOR = 0x00000020, DSECONF_ADJUSTMENT = 0x00000040, DSECONF_ALL = 0x0000007F } DFBScreenEncoderConfigFlags; typedef enum { DSETP_OFF = 0x00000000, DSETP_MULTI = 0x00000001, DSETP_SINGLE = 0x00000002, DSETP_WHITE = 0x00000010, DSETP_YELLOW = 0x00000020, DSETP_CYAN = 0x00000030, DSETP_GREEN = 0x00000040, DSETP_MAGENTA = 0x00000050, DSETP_RED = 0x00000060, DSETP_BLUE = 0x00000070, DSETP_BLACK = 0x00000080 } DFBScreenEncoderTestPicture; typedef struct { DFBScreenEncoderConfigFlags flags; DFBScreenEncoderTVStandards tv_standard; DFBScreenEncoderTestPicture test_picture; int mixer; DFBScreenOutputSignals out_signals; DFBScreenEncoderScanMode scanmode; DFBColor test_color; DFBColorAdjustment adjustment; } DFBScreenEncoderConfig; #2030 "/usr/include/directfb/directfb.h" struct _IDirectFBScreen { void *priv; int magic; DFBResult (*AddRef)(IDirectFBScreen *thiz); DFBResult (*Release)(IDirectFBScreen *thiz); DFBResult (*GetID)(IDirectFBScreen *thiz, DFBScreenID *ret_screen_id); DFBResult (*GetDescription)(IDirectFBScreen *thiz, DFBScreenDescription *ret_desc); DFBResult (*EnumDisplayLayers)(IDirectFBScreen *thiz, DFBDisplayLayerCallback callback, void *callbackdata); DFBResult (*SetPowerMode)(IDirectFBScreen *thiz, DFBScreenPowerMode mode); DFBResult (*WaitForSync)(IDirectFBScreen *thiz); DFBResult (*GetMixerDescriptions)(IDirectFBScreen *thiz, DFBScreenMixerDescription *ret_descriptions); DFBResult (*GetMixerConfiguration)(IDirectFBScreen *thiz, int mixer, DFBScreenMixerConfig *ret_config); DFBResult (*TestMixerConfiguration)(IDirectFBScreen *thiz, int mixer, const DFBScreenMixerConfig *config, DFBScreenMixerConfigFlags *ret_failed); DFBResult (*SetMixerConfiguration)(IDirectFBScreen *thiz, int mixer, const DFBScreenMixerConfig *config); DFBResult (*GetEncoderDescriptions)(IDirectFBScreen *thiz, DFBScreenEncoderDescription *ret_descriptions); DFBResult (*GetEncoderConfiguration)(IDirectFBScreen *thiz, int encoder, DFBScreenEncoderConfig *ret_config); DFBResult (*TestEncoderConfiguration)(IDirectFBScreen *thiz, int encoder, const DFBScreenEncoderConfig *config, DFBScreenEncoderConfigFlags *ret_failed); DFBResult (*SetEncoderConfiguration)(IDirectFBScreen *thiz, int encoder, const DFBScreenEncoderConfig *config); DFBResult (*GetOutputDescriptions)(IDirectFBScreen *thiz, DFBScreenOutputDescription *ret_descriptions); DFBResult (*GetOutputConfiguration)(IDirectFBScreen *thiz, int output, DFBScreenOutputConfig *ret_config); DFBResult (*TestOutputConfiguration)(IDirectFBScreen *thiz, int output, const DFBScreenOutputConfig *config, DFBScreenOutputConfigFlags *ret_failed); DFBResult (*SetOutputConfiguration)(IDirectFBScreen *thiz, int output, const DFBScreenOutputConfig *config); }; #2236 "/usr/include/directfb/directfb.h" struct _IDirectFBDisplayLayer { void *priv; int magic; DFBResult (*AddRef)(IDirectFBDisplayLayer *thiz); DFBResult (*Release)(IDirectFBDisplayLayer *thiz); DFBResult (*GetID)(IDirectFBDisplayLayer *thiz, DFBDisplayLayerID *ret_layer_id); DFBResult (*GetDescription)(IDirectFBDisplayLayer *thiz, DFBDisplayLayerDescription *ret_desc); DFBResult (*GetSourceDescriptions)(IDirectFBDisplayLayer *thiz, DFBDisplayLayerSourceDescription *ret_descriptions); DFBResult (*GetCurrentOutputField)(IDirectFBDisplayLayer *thiz, int *ret_field); DFBResult (*GetSurface)(IDirectFBDisplayLayer *thiz, IDirectFBSurface **ret_interface); DFBResult (*GetScreen)(IDirectFBDisplayLayer *thiz, IDirectFBScreen **ret_interface); DFBResult (*SetCooperativeLevel)(IDirectFBDisplayLayer *thiz, DFBDisplayLayerCooperativeLevel level); DFBResult (*GetConfiguration)(IDirectFBDisplayLayer *thiz, DFBDisplayLayerConfig *ret_config); DFBResult (*TestConfiguration)(IDirectFBDisplayLayer *thiz, const DFBDisplayLayerConfig *config, DFBDisplayLayerConfigFlags *ret_failed); DFBResult (*SetConfiguration)(IDirectFBDisplayLayer *thiz, const DFBDisplayLayerConfig *config); DFBResult (*SetScreenLocation)(IDirectFBDisplayLayer *thiz, float x, float y, float width, float height); DFBResult (*SetScreenPosition)(IDirectFBDisplayLayer *thiz, int x, int y); DFBResult (*SetScreenRectangle)(IDirectFBDisplayLayer *thiz, int x, int y, int width, int height); DFBResult (*SetOpacity)(IDirectFBDisplayLayer *thiz, __u8 opacity); DFBResult (*SetSourceRectangle)(IDirectFBDisplayLayer *thiz, int x, int y, int width, int height); DFBResult (*SetFieldParity)(IDirectFBDisplayLayer *thiz, int field); DFBResult (*SetSrcColorKey)(IDirectFBDisplayLayer *thiz, __u8 r, __u8 g, __u8 b); DFBResult (*SetDstColorKey)(IDirectFBDisplayLayer *thiz, __u8 r, __u8 g, __u8 b); DFBResult (*GetLevel)(IDirectFBDisplayLayer *thiz, int *ret_level); DFBResult (*SetLevel)(IDirectFBDisplayLayer *thiz, int level); DFBResult (*SetBackgroundMode)(IDirectFBDisplayLayer *thiz, DFBDisplayLayerBackgroundMode mode); DFBResult (*SetBackgroundImage)(IDirectFBDisplayLayer *thiz, IDirectFBSurface *surface); DFBResult (*SetBackgroundColor)(IDirectFBDisplayLayer *thiz, __u8 r, __u8 g, __u8 b, __u8 a); DFBResult (*GetColorAdjustment)(IDirectFBDisplayLayer *thiz, DFBColorAdjustment *ret_adj); DFBResult (*SetColorAdjustment)(IDirectFBDisplayLayer *thiz, const DFBColorAdjustment *adj); DFBResult (*CreateWindow)(IDirectFBDisplayLayer *thiz, const DFBWindowDescription *desc, IDirectFBWindow **ret_interface); DFBResult (*GetWindow)(IDirectFBDisplayLayer *thiz, DFBWindowID window_id, IDirectFBWindow **ret_interface); DFBResult (*EnableCursor)(IDirectFBDisplayLayer *thiz, int enable); DFBResult (*GetCursorPosition)(IDirectFBDisplayLayer *thiz, int *ret_x, int *ret_y); DFBResult (*WarpCursor)(IDirectFBDisplayLayer *thiz, int x, int y); DFBResult (*SetCursorAcceleration)(IDirectFBDisplayLayer *thiz, int numerator, int denominator, int threshold); DFBResult (*SetCursorShape)(IDirectFBDisplayLayer *thiz, IDirectFBSurface *shape, int hot_x, int hot_y); DFBResult (*SetCursorOpacity)(IDirectFBDisplayLayer *thiz, __u8 opacity); DFBResult (*WaitForSync)(IDirectFBDisplayLayer *thiz); }; #2649 "/usr/include/directfb/directfb.h" typedef enum { DSFLIP_NONE = 0x00000000, DSFLIP_WAIT = 0x00000001, DSFLIP_BLIT = 0x00000002, DSFLIP_ONSYNC = 0x00000004, DSFLIP_PIPELINE = 0x00000008, DSFLIP_WAITFORSYNC = DSFLIP_WAIT | DSFLIP_ONSYNC } DFBSurfaceFlipFlags; typedef enum { DSTF_LEFT = 0x00000000, DSTF_CENTER = 0x00000001, DSTF_RIGHT = 0x00000002, DSTF_TOP = 0x00000004, DSTF_BOTTOM = 0x00000008, DSTF_TOPLEFT = DSTF_TOP | DSTF_LEFT, DSTF_TOPCENTER = DSTF_TOP | DSTF_CENTER, DSTF_TOPRIGHT = DSTF_TOP | DSTF_RIGHT, DSTF_BOTTOMLEFT = DSTF_BOTTOM | DSTF_LEFT, DSTF_BOTTOMCENTER = DSTF_BOTTOM | DSTF_CENTER, DSTF_BOTTOMRIGHT = DSTF_BOTTOM | DSTF_RIGHT } DFBSurfaceTextFlags; typedef enum { DSLF_READ = 0x00000001, DSLF_WRITE = 0x00000002 } DFBSurfaceLockFlags; typedef enum { DSPD_NONE = 0, DSPD_CLEAR = 1, DSPD_SRC = 2, DSPD_SRC_OVER = 3, DSPD_DST_OVER = 4, DSPD_SRC_IN = 5, DSPD_DST_IN = 6, DSPD_SRC_OUT = 7, DSPD_DST_OUT = 8 } DFBSurfacePorterDuffRule; typedef enum { DSBF_ZERO = 1, DSBF_ONE = 2, DSBF_SRCCOLOR = 3, DSBF_INVSRCCOLOR = 4, DSBF_SRCALPHA = 5, DSBF_INVSRCALPHA = 6, DSBF_DESTALPHA = 7, DSBF_INVDESTALPHA = 8, DSBF_DESTCOLOR = 9, DSBF_INVDESTCOLOR = 10, DSBF_SRCALPHASAT = 11 } DFBSurfaceBlendFunction; typedef struct { float x; float y; float z; float w; float s; float t; } DFBVertex; typedef enum { DTTF_LIST, DTTF_STRIP, DTTF_FAN } DFBTriangleFormation; #2763 "/usr/include/directfb/directfb.h" struct _IDirectFBSurface { void *priv; int magic; DFBResult (*AddRef)(IDirectFBSurface *thiz); DFBResult (*Release)(IDirectFBSurface *thiz); DFBResult (*GetCapabilities)(IDirectFBSurface *thiz, DFBSurfaceCapabilities *ret_caps); DFBResult (*GetSize)(IDirectFBSurface *thiz, int *ret_width, int *ret_height); DFBResult (*GetVisibleRectangle)(IDirectFBSurface *thiz, DFBRectangle *ret_rect); DFBResult (*GetPixelFormat)(IDirectFBSurface *thiz, DFBSurfacePixelFormat *ret_format); DFBResult (*GetAccelerationMask)(IDirectFBSurface *thiz, IDirectFBSurface *source, DFBAccelerationMask *ret_mask); DFBResult (*GetPalette)(IDirectFBSurface *thiz, IDirectFBPalette **ret_interface); DFBResult (*SetPalette)(IDirectFBSurface *thiz, IDirectFBPalette *palette); DFBResult (*SetAlphaRamp)(IDirectFBSurface *thiz, __u8 a0, __u8 a1, __u8 a2, __u8 a3); DFBResult (*Lock)(IDirectFBSurface *thiz, DFBSurfaceLockFlags flags, void **ret_ptr, int *ret_pitch); DFBResult (*Unlock)(IDirectFBSurface *thiz); DFBResult (*Flip)(IDirectFBSurface *thiz, const DFBRegion *region, DFBSurfaceFlipFlags flags); DFBResult (*SetField)(IDirectFBSurface *thiz, int field); DFBResult (*Clear)(IDirectFBSurface *thiz, __u8 r, __u8 g, __u8 b, __u8 a); DFBResult (*SetClip)(IDirectFBSurface *thiz, const DFBRegion *clip); DFBResult (*SetColor)(IDirectFBSurface *thiz, __u8 r, __u8 g, __u8 b, __u8 a); DFBResult (*SetColorIndex)(IDirectFBSurface *thiz, unsigned int index); DFBResult (*SetSrcBlendFunction)(IDirectFBSurface *thiz, DFBSurfaceBlendFunction function); DFBResult (*SetDstBlendFunction)(IDirectFBSurface *thiz, DFBSurfaceBlendFunction function); DFBResult (*SetPorterDuff)(IDirectFBSurface *thiz, DFBSurfacePorterDuffRule rule); DFBResult (*SetSrcColorKey)(IDirectFBSurface *thiz, __u8 r, __u8 g, __u8 b); DFBResult (*SetSrcColorKeyIndex)(IDirectFBSurface *thiz, unsigned int index); DFBResult (*SetDstColorKey)(IDirectFBSurface *thiz, __u8 r, __u8 g, __u8 b); DFBResult (*SetDstColorKeyIndex)(IDirectFBSurface *thiz, unsigned int index); DFBResult (*SetBlittingFlags)(IDirectFBSurface *thiz, DFBSurfaceBlittingFlags flags); DFBResult (*Blit)(IDirectFBSurface *thiz, IDirectFBSurface *source, const DFBRectangle *source_rect, int x, int y); DFBResult (*TileBlit)(IDirectFBSurface *thiz, IDirectFBSurface *source, const DFBRectangle *source_rect, int x, int y); DFBResult (*BatchBlit)(IDirectFBSurface *thiz, IDirectFBSurface *source, const DFBRectangle *source_rects, const DFBPoint *dest_points, int num); DFBResult (*StretchBlit)(IDirectFBSurface *thiz, IDirectFBSurface *source, const DFBRectangle *source_rect, const DFBRectangle *destination_rect); DFBResult (*TextureTriangles)(IDirectFBSurface *thiz, IDirectFBSurface *texture, const DFBVertex *vertices, const int *indices, int num, DFBTriangleFormation formation); DFBResult (*SetDrawingFlags)(IDirectFBSurface *thiz, DFBSurfaceDrawingFlags flags); DFBResult (*FillRectangle)(IDirectFBSurface *thiz, int x, int y, int w, int h); DFBResult (*DrawRectangle)(IDirectFBSurface *thiz, int x, int y, int w, int h); DFBResult (*DrawLine)(IDirectFBSurface *thiz, int x1, int y1, int x2, int y2); DFBResult (*DrawLines)(IDirectFBSurface *thiz, const DFBRegion *lines, unsigned int num_lines); DFBResult (*FillTriangle)(IDirectFBSurface *thiz, int x1, int y1, int x2, int y2, int x3, int y3); DFBResult (*FillRectangles)(IDirectFBSurface *thiz, const DFBRectangle *rects, unsigned int num); DFBResult (*FillSpans)(IDirectFBSurface *thiz, int y, const DFBSpan *spans, unsigned int num); DFBResult (*SetFont)(IDirectFBSurface *thiz, IDirectFBFont *font); DFBResult (*GetFont)(IDirectFBSurface *thiz, IDirectFBFont **ret_font); DFBResult (*DrawString)(IDirectFBSurface *thiz, const char *text, int bytes, int x, int y, DFBSurfaceTextFlags flags); DFBResult (*DrawGlyph)(IDirectFBSurface *thiz, unsigned int index, int x, int y, DFBSurfaceTextFlags flags); DFBResult (*GetSubSurface)(IDirectFBSurface *thiz, const DFBRectangle *rect, IDirectFBSurface **ret_interface); DFBResult (*GetGL)(IDirectFBSurface *thiz, IDirectFBGL **ret_interface); DFBResult (*Dump)(IDirectFBSurface *thiz, const char *directory, const char *prefix); }; #3354 "/usr/include/directfb/directfb.h" struct _IDirectFBPalette { void *priv; int magic; DFBResult (*AddRef)(IDirectFBPalette *thiz); DFBResult (*Release)(IDirectFBPalette *thiz); DFBResult (*GetCapabilities)(IDirectFBPalette *thiz, DFBPaletteCapabilities *ret_caps); DFBResult (*GetSize)(IDirectFBPalette *thiz, unsigned int *ret_size); DFBResult (*SetEntries)(IDirectFBPalette *thiz, const DFBColor *entries, unsigned int num_entries, unsigned int offset); DFBResult (*GetEntries)(IDirectFBPalette *thiz, DFBColor *ret_entries, unsigned int num_entries, unsigned int offset); DFBResult (*FindBestMatch)(IDirectFBPalette *thiz, __u8 r, __u8 g, __u8 b, __u8 a, unsigned int *ret_index); DFBResult (*CreateCopy)(IDirectFBPalette *thiz, IDirectFBPalette **ret_interface); }; #3433 "/usr/include/directfb/directfb.h" typedef enum { DIKS_UP = 0x00000000, DIKS_DOWN = 0x00000001 } DFBInputDeviceKeyState; typedef enum { DIBS_UP = 0x00000000, DIBS_DOWN = 0x00000001 } DFBInputDeviceButtonState; typedef enum { DIBM_LEFT = 0x00000001, DIBM_RIGHT = 0x00000002, DIBM_MIDDLE = 0x00000004 } DFBInputDeviceButtonMask; typedef enum { DIMM_SHIFT = (1 << DIMKI_SHIFT), DIMM_CONTROL = (1 << DIMKI_CONTROL), DIMM_ALT = (1 << DIMKI_ALT), DIMM_ALTGR = (1 << DIMKI_ALTGR), DIMM_META = (1 << DIMKI_META), DIMM_SUPER = (1 << DIMKI_SUPER), DIMM_HYPER = (1 << DIMKI_HYPER) } DFBInputDeviceModifierMask; #3476 "/usr/include/directfb/directfb.h" struct _IDirectFBInputDevice { void *priv; int magic; DFBResult (*AddRef)(IDirectFBInputDevice *thiz); DFBResult (*Release)(IDirectFBInputDevice *thiz); DFBResult (*GetID)(IDirectFBInputDevice *thiz, DFBInputDeviceID *ret_device_id); DFBResult (*GetDescription)(IDirectFBInputDevice *thiz, DFBInputDeviceDescription *ret_desc); DFBResult (*GetKeymapEntry)(IDirectFBInputDevice *thiz, int keycode, DFBInputDeviceKeymapEntry *ret_entry); DFBResult (*CreateEventBuffer)(IDirectFBInputDevice *thiz, IDirectFBEventBuffer **ret_buffer); DFBResult (*AttachEventBuffer)(IDirectFBInputDevice *thiz, IDirectFBEventBuffer *buffer); DFBResult (*GetKeyState)(IDirectFBInputDevice *thiz, DFBInputDeviceKeyIdentifier key_id, DFBInputDeviceKeyState *ret_state); DFBResult (*GetModifiers)(IDirectFBInputDevice *thiz, DFBInputDeviceModifierMask *ret_modifiers); DFBResult (*GetLockState)(IDirectFBInputDevice *thiz, DFBInputDeviceLockState *ret_locks); DFBResult (*GetButtons)(IDirectFBInputDevice *thiz, DFBInputDeviceButtonMask *ret_buttons); DFBResult (*GetButtonState)(IDirectFBInputDevice *thiz, DFBInputDeviceButtonIdentifier button, DFBInputDeviceButtonState *ret_state); DFBResult (*GetAxis)(IDirectFBInputDevice *thiz, DFBInputDeviceAxisIdentifier axis, int *ret_pos); DFBResult (*GetXY)(IDirectFBInputDevice *thiz, int *ret_x, int *ret_y); }; #3605 "/usr/include/directfb/directfb.h" typedef enum { DFEC_NONE = 0x00, DFEC_INPUT = 0x01, DFEC_WINDOW = 0x02, DFEC_USER = 0x03 } DFBEventClass; typedef enum { DIET_UNKNOWN = 0, DIET_KEYPRESS, DIET_KEYRELEASE, DIET_BUTTONPRESS, DIET_BUTTONRELEASE, DIET_AXISMOTION } DFBInputEventType; typedef enum { DIEF_NONE = 0x000, DIEF_TIMESTAMP = 0x001, DIEF_AXISABS = 0x002, DIEF_AXISREL = 0x004, DIEF_KEYCODE = 0x008, DIEF_KEYID = 0x010, DIEF_KEYSYMBOL = 0x020, DIEF_MODIFIERS = 0x040, DIEF_LOCKS = 0x080, DIEF_BUTTONS = 0x100, DIEF_GLOBAL = 0x200 } DFBInputEventFlags; typedef struct { DFBEventClass clazz; DFBInputEventType type; DFBInputDeviceID device_id; DFBInputEventFlags flags; struct timeval timestamp; int key_code; DFBInputDeviceKeyIdentifier key_id; DFBInputDeviceKeySymbol key_symbol; DFBInputDeviceModifierMask modifiers; DFBInputDeviceLockState locks; DFBInputDeviceButtonIdentifier button; DFBInputDeviceButtonMask buttons; DFBInputDeviceAxisIdentifier axis; int axisabs; int axisrel; } DFBInputEvent; typedef enum { DWET_NONE = 0x00000000, DWET_POSITION = 0x00000001, DWET_SIZE = 0x00000002, DWET_CLOSE = 0x00000004, DWET_DESTROYED = 0x00000008, DWET_GOTFOCUS = 0x00000010, DWET_LOSTFOCUS = 0x00000020, DWET_KEYDOWN = 0x00000100, DWET_KEYUP = 0x00000200, DWET_BUTTONDOWN = 0x00010000, DWET_BUTTONUP = 0x00020000, DWET_MOTION = 0x00040000, DWET_ENTER = 0x00080000, DWET_LEAVE = 0x00100000, DWET_WHEEL = 0x00200000, DWET_POSITION_SIZE = DWET_POSITION | DWET_SIZE, DWET_ALL = 0x003F033F } DFBWindowEventType; typedef struct { DFBEventClass clazz; DFBWindowEventType type; DFBWindowID window_id; int x; int y; int cx; int cy; int step; int w; int h; int key_code; DFBInputDeviceKeyIdentifier key_id; DFBInputDeviceKeySymbol key_symbol; DFBInputDeviceModifierMask modifiers; DFBInputDeviceLockState locks; DFBInputDeviceButtonIdentifier button; DFBInputDeviceButtonMask buttons; struct timeval timestamp; } DFBWindowEvent; typedef struct { DFBEventClass clazz; unsigned int type; void *data; } DFBUserEvent; typedef union { DFBEventClass clazz; DFBInputEvent input; DFBWindowEvent window; DFBUserEvent user; } DFBEvent; #3827 "/usr/include/directfb/directfb.h" struct _IDirectFBEventBuffer { void *priv; int magic; DFBResult (*AddRef)(IDirectFBEventBuffer *thiz); DFBResult (*Release)(IDirectFBEventBuffer *thiz); DFBResult (*Reset)(IDirectFBEventBuffer *thiz); DFBResult (*WaitForEvent)(IDirectFBEventBuffer *thiz); DFBResult (*WaitForEventWithTimeout)(IDirectFBEventBuffer *thiz, unsigned int seconds, unsigned int milli_seconds); DFBResult (*GetEvent)(IDirectFBEventBuffer *thiz, DFBEvent *ret_event); DFBResult (*PeekEvent)(IDirectFBEventBuffer *thiz, DFBEvent *ret_event); DFBResult (*HasEvent)(IDirectFBEventBuffer *thiz); DFBResult (*PostEvent)(IDirectFBEventBuffer *thiz, const DFBEvent *event); DFBResult (*WakeUp)(IDirectFBEventBuffer *thiz); DFBResult (*CreateFileDescriptor)(IDirectFBEventBuffer *thiz, int *ret_fd); }; #3939 "/usr/include/directfb/directfb.h" typedef enum { DWOP_NONE = 0x00000000, DWOP_COLORKEYING = 0x00000001, DWOP_ALPHACHANNEL = 0x00000002, DWOP_OPAQUE_REGION = 0x00000004, DWOP_SHAPED = 0x00000008, DWOP_KEEP_POSITION = 0x00000010, DWOP_KEEP_SIZE = 0x00000020, DWOP_KEEP_STACKING = 0x00000040, DWOP_GHOST = 0x00001000, DWOP_INDESTRUCTIBLE = 0x00002000, DWOP_ALL = 0x0000307F } DFBWindowOptions; typedef enum { DWSC_MIDDLE = 0x00000000, DWSC_UPPER = 0x00000001, DWSC_LOWER = 0x00000002 } DFBWindowStackingClass; #3988 "/usr/include/directfb/directfb.h" struct _IDirectFBWindow { void *priv; int magic; DFBResult (*AddRef)(IDirectFBWindow *thiz); DFBResult (*Release)(IDirectFBWindow *thiz); DFBResult (*GetID)(IDirectFBWindow *thiz, DFBWindowID *ret_window_id); DFBResult (*GetPosition)(IDirectFBWindow *thiz, int *ret_x, int *ret_y); DFBResult (*GetSize)(IDirectFBWindow *thiz, int *ret_width, int *ret_height); DFBResult (*CreateEventBuffer)(IDirectFBWindow *thiz, IDirectFBEventBuffer **ret_buffer); DFBResult (*AttachEventBuffer)(IDirectFBWindow *thiz, IDirectFBEventBuffer *buffer); DFBResult (*EnableEvents)(IDirectFBWindow *thiz, DFBWindowEventType mask); DFBResult (*DisableEvents)(IDirectFBWindow *thiz, DFBWindowEventType mask); DFBResult (*GetSurface)(IDirectFBWindow *thiz, IDirectFBSurface **ret_surface); DFBResult (*SetOptions)(IDirectFBWindow *thiz, DFBWindowOptions options); DFBResult (*GetOptions)(IDirectFBWindow *thiz, DFBWindowOptions *ret_options); DFBResult (*SetColorKey)(IDirectFBWindow *thiz, __u8 r, __u8 g, __u8 b); DFBResult (*SetColorKeyIndex)(IDirectFBWindow *thiz, unsigned int index); DFBResult (*SetOpacity)(IDirectFBWindow *thiz, __u8 opacity); DFBResult (*SetOpaqueRegion)(IDirectFBWindow *thiz, int x1, int y1, int x2, int y2); DFBResult (*GetOpacity)(IDirectFBWindow *thiz, __u8 *ret_opacity); DFBResult (*SetCursorShape)(IDirectFBWindow *thiz, IDirectFBSurface *shape, int hot_x, int hot_y); DFBResult (*RequestFocus)(IDirectFBWindow *thiz); DFBResult (*GrabKeyboard)(IDirectFBWindow *thiz); DFBResult (*UngrabKeyboard)(IDirectFBWindow *thiz); DFBResult (*GrabPointer)(IDirectFBWindow *thiz); DFBResult (*UngrabPointer)(IDirectFBWindow *thiz); DFBResult (*GrabKey)(IDirectFBWindow *thiz, DFBInputDeviceKeySymbol symbol, DFBInputDeviceModifierMask modifiers); DFBResult (*UngrabKey)(IDirectFBWindow *thiz, DFBInputDeviceKeySymbol symbol, DFBInputDeviceModifierMask modifiers); DFBResult (*Move)(IDirectFBWindow *thiz, int dx, int dy); DFBResult (*MoveTo)(IDirectFBWindow *thiz, int x, int y); DFBResult (*Resize)(IDirectFBWindow *thiz, int width, int height); DFBResult (*SetStackingClass)(IDirectFBWindow *thiz, DFBWindowStackingClass stacking_class); DFBResult (*Raise)(IDirectFBWindow *thiz); DFBResult (*Lower)(IDirectFBWindow *thiz); DFBResult (*RaiseToTop)(IDirectFBWindow *thiz); DFBResult (*LowerToBottom)(IDirectFBWindow *thiz); DFBResult (*PutAtop)(IDirectFBWindow *thiz, IDirectFBWindow *lower); DFBResult (*PutBelow)(IDirectFBWindow *thiz, IDirectFBWindow *upper); DFBResult (*Close)(IDirectFBWindow *thiz); DFBResult (*Destroy)(IDirectFBWindow *thiz); }; #4356 "/usr/include/directfb/directfb.h" struct _IDirectFBFont { void *priv; int magic; DFBResult (*AddRef)(IDirectFBFont *thiz); DFBResult (*Release)(IDirectFBFont *thiz); DFBResult (*GetAscender)(IDirectFBFont *thiz, int *ret_ascender); DFBResult (*GetDescender)(IDirectFBFont *thiz, int *ret_descender); DFBResult (*GetHeight)(IDirectFBFont *thiz, int *ret_height); DFBResult (*GetMaxAdvance)(IDirectFBFont *thiz, int *ret_maxadvance); DFBResult (*GetKerning)(IDirectFBFont *thiz, unsigned int prev_index, unsigned int current_index, int *ret_kern_x, int *ret_kern_y); DFBResult (*GetStringWidth)(IDirectFBFont *thiz, const char *text, int bytes, int *ret_width); DFBResult (*GetStringExtents)(IDirectFBFont *thiz, const char *text, int bytes, DFBRectangle *ret_logical_rect, DFBRectangle *ret_ink_rect); DFBResult (*GetGlyphExtents)(IDirectFBFont *thiz, unsigned int index, DFBRectangle *ret_rect, int *ret_advance); }; #4492 "/usr/include/directfb/directfb.h" typedef enum { DICAPS_NONE = 0x00000000, DICAPS_ALPHACHANNEL = 0x00000001, DICAPS_COLORKEY = 0x00000002 } DFBImageCapabilities; typedef struct { DFBImageCapabilities caps; __u8 colorkey_r; __u8 colorkey_g; __u8 colorkey_b; } DFBImageDescription; typedef void (*DIRenderCallback)(DFBRectangle *rect, void *ctx); #4526 "/usr/include/directfb/directfb.h" struct _IDirectFBImageProvider { void *priv; int magic; DFBResult (*AddRef)(IDirectFBImageProvider *thiz); DFBResult (*Release)(IDirectFBImageProvider *thiz); DFBResult (*GetSurfaceDescription)(IDirectFBImageProvider *thiz, DFBSurfaceDescription *ret_dsc); DFBResult (*GetImageDescription)(IDirectFBImageProvider *thiz, DFBImageDescription *ret_dsc); DFBResult (*RenderTo)(IDirectFBImageProvider *thiz, IDirectFBSurface *destination, const DFBRectangle *destination_rect); DFBResult (*SetRenderCallback)(IDirectFBImageProvider *thiz, DIRenderCallback callback, void *callback_data); }; #4592 "/usr/include/directfb/directfb.h" typedef int (*DVFrameCallback)(void *ctx); #4602 "/usr/include/directfb/directfb.h" struct _IDirectFBVideoProvider { void *priv; int magic; DFBResult (*AddRef)(IDirectFBVideoProvider *thiz); DFBResult (*Release)(IDirectFBVideoProvider *thiz); DFBResult (*GetCapabilities)(IDirectFBVideoProvider *thiz, DFBVideoProviderCapabilities *ret_caps); DFBResult (*GetSurfaceDescription)(IDirectFBVideoProvider *thiz, DFBSurfaceDescription *ret_dsc); DFBResult (*PlayTo)(IDirectFBVideoProvider *thiz, IDirectFBSurface *destination, const DFBRectangle *destination_rect, DVFrameCallback callback, void *ctx); DFBResult (*Stop)(IDirectFBVideoProvider *thiz); DFBResult (*SeekTo)(IDirectFBVideoProvider *thiz, double seconds); DFBResult (*GetPos)(IDirectFBVideoProvider *thiz, double *ret_seconds); DFBResult (*GetLength)(IDirectFBVideoProvider *thiz, double *ret_seconds); DFBResult (*GetColorAdjustment)(IDirectFBVideoProvider *thiz, DFBColorAdjustment *ret_adj); DFBResult (*SetColorAdjustment)(IDirectFBVideoProvider *thiz, const DFBColorAdjustment *adj); }; #4708 "/usr/include/directfb/directfb.h" struct _IDirectFBDataBuffer { void *priv; int magic; DFBResult (*AddRef)(IDirectFBDataBuffer *thiz); DFBResult (*Release)(IDirectFBDataBuffer *thiz); DFBResult (*Flush)(IDirectFBDataBuffer *thiz); DFBResult (*SeekTo)(IDirectFBDataBuffer *thiz, unsigned int offset); DFBResult (*GetPosition)(IDirectFBDataBuffer *thiz, unsigned int *ret_offset); DFBResult (*GetLength)(IDirectFBDataBuffer *thiz, unsigned int *ret_length); DFBResult (*WaitForData)(IDirectFBDataBuffer *thiz, unsigned int length); DFBResult (*WaitForDataWithTimeout)(IDirectFBDataBuffer *thiz, unsigned int length, unsigned int seconds, unsigned int milli_seconds); DFBResult (*GetData)(IDirectFBDataBuffer *thiz, unsigned int length, void *ret_data, unsigned int *ret_read); DFBResult (*PeekData)(IDirectFBDataBuffer *thiz, unsigned int length, int offset, void *ret_data, unsigned int *ret_read); DFBResult (*HasData)(IDirectFBDataBuffer *thiz); DFBResult (*PutData)(IDirectFBDataBuffer *thiz, const void *data, unsigned int length); DFBResult (*CreateImageProvider)(IDirectFBDataBuffer *thiz, IDirectFBImageProvider **interface); }; uncrustify-0.59/tests/output/c/00111-misc.c0000644000175000017500000000137611574754744015317 00000000000000/********************/ /* Before Unrustify */ /********************/ #define MACRO( cond, action ) if ((cond)) (action) void hurz(murks) { if (murks = 4) { // This comment belongs to (murks = 4) schrott(); // And this to schrott() } #ifdef SCHNIEPEL else if (murks = 6) { // This comment belongs to (murks = 6) // I had to write more comment than one line // so I inserted some comment only blocks schniepel(); } #endif // SCHNIEPEL else { flursen(); } if (murks = 4) // This comment belongs to (murks = 4) #ifdef FOO { foo(); } #else { bar(); } #endif if (murks = 4) { // This comment belongs to (murks = 4) schrott(); // And this to schrott() } return; } // hurz() uncrustify-0.59/tests/output/c/00009-comment-convert.c0000644000175000017500000000123711574754744017506 00000000000000/* This is your typical header comment */ int foo(int bar) { int idx; int res = 0; /* * trailing comment * that spans two lines */ /* Comment with embedded / * C comment * / */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; /* * Multi-line comment with embedded / * C comment * / and junk * afterwards */ res *= idx; /* some comment */ /* almost continued, but a NL in between */ /* * col1 comment in level 1 * second comment */ return(res); } /* * col1 comment in level 0 * and another */ uncrustify-0.59/tests/output/c/01016-align_attr.c0000644000175000017500000000015411574754744016506 00000000000000 char test[3] _PREPROCESSOR_SOMETHING; int numberThatIsReallyCool _PREPROCESSOR_SOMETHING; uncrustify-0.59/tests/output/c/00512-bool-pos.c0000644000175000017500000000201111574754744016106 00000000000000void foo(void) { if ((a != 0) && (b == 0) && (c < 0) && (d > 0)) { printf("hi"); } if (flag1 #ifdef FLAG2 || flag2 #endif ) { printf("yar"); } if (flag1 && #ifdef FLAG2 flag2 && #endif flag3) { printf("bo"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if (!this->writeOwiFile () || // comment1 broken () || !saveArchiveData () || /* comment2 */ broken () || !deleteCentralArchive () || // comment3 broken () || !copyArchivFiles () || // comment4 broken () || !appendToPlanetDb ()) // comment5 { ; } foobar(param1, param2, param3, param4); foobar2(param1, param2, param3, param4); } uncrustify-0.59/tests/output/c/00006-comment-convert.c0000644000175000017500000000106611574754744017503 00000000000000// This is your typical header comment int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines // Comment with embedded /* C comment */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; // Multi-line comment with embedded /* C comment */ and junk // afterwards res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 // second comment return(res); } // col1 comment in level 0 // and another uncrustify-0.59/tests/output/c/00303-one-liner-init.c0000644000175000017500000000056711631037504017177 00000000000000enum boo { FOO = 1 }; void foo(void) { char str[123] = { 0 }; enum hoo { NOO = 1 }; strcat(str, "foo"); } void f() { if (bar()) baz(1); else baz(2); } int foo() { return 0; } void foo(int a, int b) { if (a == b) { a++; } else { b++; } if (a == b) a++; else b++; } uncrustify-0.59/tests/output/c/00403-align-var.c0000644000175000017500000000154111574754744016242 00000000000000struct foo1 { unsigned int d_ino; const char *d_reclen; unsigned short d_namlen; char d_name[1]; }; struct foo2 { unsigned int a : 1; unsigned int bcd : 3; unsigned int ef : 2; unsigned int : 2; unsigned short more; int fields; }; typedef struct { bitfld a : 8; bitfld b : 16; bitfld : 8; } type_t; struct foo { int a; char *b }; static int idx; static const char **tmp; static char buf[64]; static unsigned long how_long; // comment static int **tmp; static char buf[64]; void bar(int someval, void *puser, const char *filename, struct willy *the_list, int list_len) { int idx; const char **tmp; char buf[64]; unsigned long how_long; return(-1); } uncrustify-0.59/tests/output/c/00066-vb-while.c0000644000175000017500000000137011574754744016104 00000000000000unsigned long xdl_adler32(unsigned long adler, unsigned char const *buf, unsigned int len) { int k; unsigned long s1 = adler & 0xffff; unsigned long s2 = (adler >> 16) & 0xffff; if (!buf) { return(1); } while (len > 0) { k = len < NMAX ? len : NMAX; len -= k; while (k >= 16) { DO16(buf); buf += 16; k -= 16; } if (k != 0) { do { s1 += *buf++; s2 += s1; } while (--k); } s1 %= BASE; s2 %= BASE; } return((s2 << 16) | s1); } void f() { while (1) { if (2) { 3; } else { 4; } } } uncrustify-0.59/tests/output/c/00413-align-typedef.c0000644000175000017500000000100611574754744017107 00000000000000 typedef int MY_INT; typedef int * MY_INTP; typedef int (*foo_t)(void *bar); typedef int (*somefunc_t)(void *barstool); typedef int int8_t __attribute__((__mode__(__QI__))); typedef int uint8_t; typedef struct _IDirectFBSurface IDirectFBSurface; typedef struct _IDirectFBPalette IDirectFBPalette; typedef struct timezone *__restrict __timezone_ptr_t; uncrustify-0.59/tests/output/c/01030-multi.h0000644000175000017500000000016011574754744015512 00000000000000/* This is a multiline comment that should not be indented */ { /* No trailing spaces in this comment */ } uncrustify-0.59/tests/output/c/00007-comment-convert.c0000644000175000017500000000115111574754744017477 00000000000000/* This is your typical header comment */ int foo(int bar) { int idx; int res = 0; /* trailing comment */ /* that spans two lines */ /* Comment with embedded / * C comment * / */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; /* Multi-line comment with embedded / * C comment * / and junk */ /* afterwards */ res *= idx; /* some comment */ /* almost continued, but a NL in between */ /* col1 comment in level 1 */ /* second comment */ return(res); } /* col1 comment in level 0 */ /* and another */ uncrustify-0.59/tests/output/c/00053-brace.c0000644000175000017500000000026711574754744015443 00000000000000 int function (int arg) { int i; for (i = 0; i < 5; i++) { /* Do something... */ } if (i < 0) { /*Do something else...*/ } return (0); } uncrustify-0.59/tests/output/c/00414-align-typedef.c0000644000175000017500000000100211574754744017104 00000000000000 typedef int MY_INT; typedef int *MY_INTP; typedef int (*foo_t)(void *bar); typedef int (*somefunc_t)(void *barstool); typedef int int8_t __attribute__((__mode__(__QI__))); typedef int uint8_t; typedef struct _IDirectFBSurface IDirectFBSurface; typedef struct _IDirectFBPalette IDirectFBPalette; typedef struct timezone *__restrict __timezone_ptr_t; uncrustify-0.59/tests/output/c/02502-custom_types_ssl.c0000644000175000017500000000554311631561414017771 00000000000000#ifndef HEADER_CONF_H #define HEADER_CONF_H #ifdef __cplusplus extern "C" { #endif typedef struct { char *section; char *name; char *value; } CONF_VALUE; DECLARE_STACK_OF( CONF_VALUE ); DECLARE_LHASH_OF( CONF_VALUE ); struct conf_st; struct conf_method_st; typedef struct conf_method_st CONF_METHOD; int CONF_set_default_method ( CONF_METHOD *meth ); void CONF_set_nconf ( CONF *conf,LHASH_OF(CONF_VALUE) *hash ); LHASH_OF(CONF_VALUE) *CONF_load ( LHASH_OF(CONF_VALUE) *conf,const char *file, long *eline ); #ifndef OPENSSL_NO_FP_API LHASH_OF(CONF_VALUE) *CONF_load_fp ( LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline ); #endif LHASH_OF(CONF_VALUE) *CONF_load_bio ( LHASH_OF(CONF_VALUE) *conf, BIO *bp,long *eline ); STACK_OF(CONF_VALUE) *CONF_get_section ( LHASH_OF(CONF_VALUE) *conf, const char * section ); char *CONF_get_string ( LHASH_OF(CONF_VALUE) *conf,const char *group, const char *name ); long CONF_get_number ( LHASH_OF(CONF_VALUE) *conf,const char *group, const char *name ); void CONF_free ( LHASH_OF(CONF_VALUE) *conf ); int CONF_dump_fp ( LHASH_OF(CONF_VALUE) *conf, FILE *out ); int CONF_dump_bio ( LHASH_OF(CONF_VALUE) *conf, BIO *out ); #ifdef __cplusplus } #endif void CONF_set_nconf ( CONF *conf, LHASH_OF(CONF_VALUE) *hash ) { if (default_CONF_method == NULL) default_CONF_method = NCONF_default(); default_CONF_method->init( conf ); conf->data = hash; } LHASH_OF(CONF_VALUE) *CONF_load ( LHASH_OF(CONF_VALUE) *conf, const char *file, long *eline ) { LHASH_OF(CONF_VALUE) *ltmp; BIO *in = NULL; #ifdef OPENSSL_SYS_VMS in = BIO_new_file( file, "r" ); #else in = BIO_new_file( file, "rb" ); #endif if (in == NULL) { CONFerr( CONF_F_CONF_LOAD,ERR_R_SYS_LIB ); return NULL; } return ltmp; } #ifndef OPENSSL_NO_FP_API LHASH_OF(CONF_VALUE) *CONF_load_fp ( LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline ) { BIO *btmp; LHASH_OF(CONF_VALUE) *ltmp; if(!(btmp = BIO_new_fp( fp, BIO_NOCLOSE ))) { CONFerr( CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB ); return NULL; } ltmp = CONF_load_bio( conf, btmp, eline ); BIO_free( btmp ); return ltmp; } #endif LHASH_OF(CONF_VALUE) *CONF_load_bio ( LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline ) { CONF ctmp; int ret; CONF_set_nconf( &ctmp, conf ); ret = NCONF_load_bio( &ctmp, bp, eline ); if (ret) return ctmp.data; return NULL; } STACK_OF(CONF_VALUE) *CONF_get_section ( LHASH_OF(CONF_VALUE) *conf, const char * section ) { if (conf == NULL) { return NULL; } else { CONF ctmp; CONF_set_nconf( &ctmp, conf ); return NCONF_get_section( &ctmp, section ); } } char *CONF_get_string ( LHASH_OF(CONF_VALUE) *conf,const char *group, const char *name ) { if (conf == NULL) { return NCONF_get_string( NULL, group, name ); } else { return NCONF_get_string( &ctmp, group, name ); } } uncrustify-0.59/tests/output/c/01036-func_wrap.c0000644000175000017500000000005711574754744016352 00000000000000 void FSUB( MPI_Foo )( MPI_Fint* sendcount ); uncrustify-0.59/tests/output/c/02102-indent.cpp0000644000175000017500000007076511631561414016177 00000000000000/** * @file indent.cpp * Does all the indenting stuff. * * $Id: indent.cpp 548 2006-10-21 02:31:55Z bengardner $ */ #include "uncrustify_types.h" #include "chunk_list.h" #include "prototypes.h" #include #include #include #include #include /** * General indenting approach: * Indenting levels are put into a stack. * * The stack entries contain: * - opening type * - brace column * - continuation column * * Items that start a new stack item: * - preprocessor (new parse frame) * - Brace Open (Virtual brace also) * - Paren, Square, Angle open * - Assignments * - C++ '<<' operator (ie, cout << "blah") * - case * - class colon * - return * - types * - any other continued statement * * Note that the column of items marked 'PCF_WAS_ALIGNED' is not changed. * * For an open brace: * - indent increases by indent_columns * - if part of if/else/do/while/switch/etc, an extra indent may be applied * - if in a paren, then cont-col is set to column + 1, ie "({ some code })" * * Open paren/square/angle: * cont-col is set to the column of the item after the open paren, unless * followed by a newline, then it is set to (brace-col + indent_columns). * Examples: * a_really_long_funcion_name( * param1, param2); * a_really_long_funcion_name(param1, * param2); * * Assignments: * Assignments are continued aligned with the first item after the assignment, * unless the assign is followed by a newline. * Examples: * some.variable = asdf + asdf + * asdf; * some.variable = * asdf + asdf + asdf; * * C++ << operator: * Handled the same as assignment. * Examples: * cout << "this is test number: " * << test_number; * * case: * Started with case or default. * Terminated with close brace at level or another case or default. * Special indenting according to various rules. * - indent of case label * - indent of case body * - how to handle optional braces * Examples: * { * case x: { * a++; * break; * } * case y: * b--; * break; * default: * c++; * break; * } * * Class colon: * Indent continuation by indent_columns: * class my_class : * baseclass1, * baseclass2 * { * * Return: same as assignemts * If the return statement is not fully paren'd, then the indent continues at * the column of the item after the return. If it is paren'd, then the paren * rules apply. * return somevalue + * othervalue; * * Type: pretty much the same as assignments * Examples: * int foo, * bar, * baz; * * Any other continued item: * There shouldn't be anything not covered by the above cases, but any other * continued item is indented by indent_columns: * Example: * somereallycrazylongname.with[lotsoflongstuff]. * thatreallyannoysme.whenIhavetomaintain[thecode] = 3; */ static void indent_comment(chunk_t *pc, int col); void indent_to_column(chunk_t *pc, int column) { if (column < pc->column) column = pc->column; reindent_line(pc, column); } /** * Changes the initial indent for a line to the given column * * @param pc The chunk at the start of the line * @param column The desired column */ void reindent_line(chunk_t *pc, int column) { int col_delta; int min_col; LOG_FMT(LINDLINE, "%s: %d] col %d on %.*s [%s] => %d\n", __func__, pc->orig_line, pc->column, pc->len, pc->str, get_token_name(pc->type), column); if (column == pc->column) return; col_delta = column - pc->column; pc->column = column; min_col = pc->column; do { min_col += pc->len; pc = chunk_get_next(pc); if (pc != NULL) { if (chunk_is_comment(pc)) { pc->column = pc->orig_col; if (pc->column < min_col) pc->column = min_col + 1; LOG_FMT(LINDLINE, "%s: set comment on line %d to col %d (orig %d)\n", __func__, pc->orig_line, pc->column, pc->orig_col); } else { pc->column += col_delta; if (pc->column < min_col) pc->column = min_col; } } } while ((pc != NULL) && (pc->nl_count == 0)); } /** * Starts a new entry * * @param frm The parse frame * @param pc The chunk causing the push */ static void indent_pse_push(struct parse_frame& frm, chunk_t *pc) { static int ref = 0; /* check the stack depth */ if (frm.pse_tos < (int)ARRAY_SIZE(frm.pse)) { /* Bump up the index and initialize it */ frm.pse_tos++; memset(&frm.pse[frm.pse_tos], 0, sizeof(frm.pse[frm.pse_tos])); LOG_FMT(LINDPSE, "%4d] OPEN [%d,%s] level=%d\n", pc->orig_line, frm.pse_tos, get_token_name(pc->type), pc->level); frm.pse[frm.pse_tos].type = pc->type; frm.pse[frm.pse_tos].level = pc->level; frm.pse[frm.pse_tos].open_line = pc->orig_line; frm.pse[frm.pse_tos].ref = ++ref; frm.pse[frm.pse_tos].in_preproc = (pc->flags & PCF_IN_PREPROC) != 0; } } /** * Removes the top entry * * @param frm The parse frame * @param pc The chunk causing the push */ static void indent_pse_pop(struct parse_frame& frm, chunk_t *pc) { /* Bump up the index and initialize it */ if (frm.pse_tos > 0) { if (pc != NULL) { LOG_FMT(LINDPSE, "%4d] CLOSE [%d,%s] on %s, started on line %d, level=%d/%d\n", pc->orig_line, frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), get_token_name(pc->type), frm.pse[frm.pse_tos].open_line, frm.pse[frm.pse_tos].level, pc->level); } else { LOG_FMT(LINDPSE, " EOF] CLOSE [%d,%s], started on line %d\n", frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), frm.pse[frm.pse_tos].open_line); } frm.pse_tos--; } } static int token_indent(c_token_t type) { switch (type) { case CT_IF: case CT_DO: return 3; case CT_FOR: case CT_ELSE: // wacky, but that's what is wanted return 4; case CT_WHILE: return 6; case CT_SWITCH: return 7; case CT_ELSEIF: return 8; default: return 0; //cpd.settings[UO_indent_braces].n; } } /** * Change the top-level indentation only by changing the column member in * the chunk structures. * The level indicator must already be set. */ void indent_text(void) { chunk_t *pc; chunk_t *next; chunk_t *prev = NULL; bool did_newline = true; int idx; int vardefcol = 0; int indent_size = cpd.settings[UO_indent_columns].n; int tmp; struct parse_frame frm; bool in_preproc = false, was_preproc = false; int indent_column; int cout_col = 0; // for aligning << stuff int cout_level = 0; // for aligning << stuff int parent_token_indent = 0; memset(&frm, 0, sizeof(frm)); /* dummy top-level entry */ frm.pse[0].indent = 1; frm.pse[0].indent_tmp = 1; frm.pse[0].type = CT_EOF; pc = chunk_get_head(); while (pc != NULL) { /* Handle proprocessor transitions */ was_preproc = in_preproc; in_preproc = (pc->flags & PCF_IN_PREPROC) != 0; if (cpd.settings[UO_indent_brace_parent].b) parent_token_indent = token_indent(pc->parent_type); /* Clean up after a #define */ if (!in_preproc) while ((frm.pse_tos > 0) && frm.pse[frm.pse_tos].in_preproc) indent_pse_pop(frm, pc); else { pf_check(&frm, pc); if (!was_preproc) { /* Transition into a preproc by creating a dummy indent */ frm.level++; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = 1 + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; } } if ((cout_col > 0) && (chunk_is_semicolon(pc) || (pc->level < cout_level))) { cout_col = 0; cout_level = 0; } /** * Handle non-brace closures */ int old_pse_tos; do { old_pse_tos = frm.pse_tos; /* End anything that drops a level * REVISIT: not sure about the preproc check */ if (!chunk_is_newline(pc) && !chunk_is_comment(pc) && ((pc->flags & PCF_IN_PREPROC) == 0) && (frm.pse[frm.pse_tos].level > pc->level)) indent_pse_pop(frm, pc); if (frm.pse[frm.pse_tos].level == pc->level) { /* process virtual braces closes (no text output) */ if ((pc->type == CT_VBRACE_CLOSE) && (frm.pse[frm.pse_tos].type == CT_VBRACE_OPEN)) { indent_pse_pop(frm, pc); frm.level--; pc = chunk_get_next(pc); } /* End any assign operations with a semicolon on the same level */ if ((frm.pse[frm.pse_tos].type == CT_ASSIGN) && (chunk_is_semicolon(pc) || (pc->type == CT_COMMA) || (pc->type == CT_BRACE_OPEN))) indent_pse_pop(frm, pc); /* End any CPP class colon crap */ if ((frm.pse[frm.pse_tos].type == CT_CLASS_COLON) && ((pc->type == CT_BRACE_OPEN) || chunk_is_semicolon(pc))) indent_pse_pop(frm, pc); /* a case is ended with another case or a close brace */ if ((frm.pse[frm.pse_tos].type == CT_CASE) && ((pc->type == CT_BRACE_CLOSE) || (pc->type == CT_CASE))) indent_pse_pop(frm, pc); /* a return is ended with a semicolon */ if ((frm.pse[frm.pse_tos].type == CT_RETURN) && chunk_is_semicolon(pc)) indent_pse_pop(frm, pc); /* Close out parens and squares */ if ((frm.pse[frm.pse_tos].type == (pc->type - 1)) && ((pc->type == CT_PAREN_CLOSE) || (pc->type == CT_SPAREN_CLOSE) || (pc->type == CT_FPAREN_CLOSE) || (pc->type == CT_SQUARE_CLOSE) || (pc->type == CT_ANGLE_CLOSE))) { indent_pse_pop(frm, pc); frm.paren_count--; } } } while (old_pse_tos > frm.pse_tos); /* Grab a copy of the current indent */ indent_column = frm.pse[frm.pse_tos].indent_tmp; if (!chunk_is_newline(pc) && !chunk_is_comment(pc)) { LOG_FMT(LINDPC, " -=[ %.*s ]=- top=%d %s %d/%d\n", pc->len, pc->str, frm.pse_tos, get_token_name(frm.pse[frm.pse_tos].type), frm.pse[frm.pse_tos].indent_tmp, frm.pse[frm.pse_tos].indent); } /** * Handle stuff that can affect the current indent: * - brace close * - vbrace open * - brace open * - case (immediate) * - labels (immediate) * - class colons (immediate) * * And some stuff that can't * - open paren * - open square * - assignment * - return */ if (pc->type == CT_BRACE_CLOSE) { if (frm.pse[frm.pse_tos].type == CT_BRACE_OPEN) { indent_pse_pop(frm, pc); frm.level--; /* Update the indent_column if needed */ if (!cpd.settings[UO_indent_braces].b && (parent_token_indent == 0)) indent_column = frm.pse[frm.pse_tos].indent_tmp; if ((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE) || (pc->parent_type == CT_ELSEIF) || (pc->parent_type == CT_DO) || (pc->parent_type == CT_WHILE) || (pc->parent_type == CT_SWITCH) || (pc->parent_type == CT_FOR)) indent_column += cpd.settings[UO_indent_brace].n; } } else if (pc->type == CT_VBRACE_OPEN) { frm.level++; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; /* Always indent on virtual braces */ indent_column = frm.pse[frm.pse_tos].indent_tmp; } else if (pc->type == CT_BRACE_OPEN) { frm.level++; indent_pse_push(frm, pc); if (frm.paren_count != 0) /* We are inside ({ ... }) -- indent one tab from the paren */ frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; else { /* Use the prev indent level + indent_size. */ frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; /* If this brace is part of a statement, bump it out by indent_brace */ if ((pc->parent_type == CT_IF) || (pc->parent_type == CT_ELSE) || (pc->parent_type == CT_ELSEIF) || (pc->parent_type == CT_DO) || (pc->parent_type == CT_WHILE) || (pc->parent_type == CT_SWITCH) || (pc->parent_type == CT_FOR)) { if (parent_token_indent != 0) frm.pse[frm.pse_tos].indent += parent_token_indent - indent_size; else { frm.pse[frm.pse_tos].indent += cpd.settings[UO_indent_brace].n; indent_column += cpd.settings[UO_indent_brace].n; } } else if (pc->parent_type == CT_CASE) { /* The indent_case_brace setting affects the parent CT_CASE */ frm.pse[frm.pse_tos].indent_tmp += cpd.settings[UO_indent_case_brace].n; frm.pse[frm.pse_tos].indent += cpd.settings[UO_indent_case_brace].n; } else if ((pc->parent_type == CT_CLASS) && !cpd.settings[UO_indent_class].b) frm.pse[frm.pse_tos].indent -= indent_size; else if ((pc->parent_type == CT_NAMESPACE) && !cpd.settings[UO_indent_namespace].b) frm.pse[frm.pse_tos].indent -= indent_size; } if ((pc->flags & PCF_DONT_INDENT) != 0) { frm.pse[frm.pse_tos].indent = pc->column; indent_column = pc->column; } else { /** * If there isn't a newline between the open brace and the next * item, just indent to wherever the next token is. * This covers this sort of stuff: * { a++; * b--; }; */ next = chunk_get_next_ncnl(pc); if (!chunk_is_newline_between(pc, next)) frm.pse[frm.pse_tos].indent = next->column; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.pse[frm.pse_tos].open_line = pc->orig_line; /* Update the indent_column if needed */ if (cpd.settings[UO_indent_braces].n || (parent_token_indent != 0)) indent_column = frm.pse[frm.pse_tos].indent_tmp; } } else if (pc->type == CT_CASE) { /* Start a case - indent UO_indent_switch_case from the switch level */ tmp = frm.pse[frm.pse_tos].indent + cpd.settings[UO_indent_switch_case].n; indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = tmp; frm.pse[frm.pse_tos].indent_tmp = tmp - indent_size; /* Always set on case statements */ indent_column = frm.pse[frm.pse_tos].indent_tmp; } else if (pc->type == CT_LABEL) { /* Labels get sent to the left or backed up */ if (cpd.settings[UO_indent_label].n > 0) indent_column = cpd.settings[UO_indent_label].n; else indent_column = frm.pse[frm.pse_tos].indent + cpd.settings[UO_indent_label].n; } else if (pc->type == CT_CLASS_COLON) { /* just indent one level */ indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; indent_column = frm.pse[frm.pse_tos].indent_tmp; if (cpd.settings[UO_indent_class_colon].b) { prev = chunk_get_prev(pc); if (chunk_is_newline(prev)) frm.pse[frm.pse_tos].indent += 2; /* don't change indent of current line */ } } else if ((pc->type == CT_PAREN_OPEN) || (pc->type == CT_SPAREN_OPEN) || (pc->type == CT_FPAREN_OPEN) || (pc->type == CT_SQUARE_OPEN) || (pc->type == CT_ANGLE_OPEN)) { /* Open parens and squares - never update indent_column */ indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = pc->column + pc->len; if (cpd.settings[UO_indent_func_call_param].b && (pc->type == CT_FPAREN_OPEN) && (pc->parent_type == CT_FUNC_CALL)) frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + indent_size; if ((chunk_is_str(pc, "(", 1) && !cpd.settings[UO_indent_paren_nl].b) || (chunk_is_str(pc, "[", 1) && !cpd.settings[UO_indent_square_nl].b)) { next = chunk_get_next_nc(pc); if (chunk_is_newline(next)) { int sub = 1; if (frm.pse[frm.pse_tos - 1].type == CT_ASSIGN) sub = 2; frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - sub].indent + indent_size; } } frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; frm.paren_count++; } else if (pc->type == CT_ASSIGN) { /** * if there is a newline after the '=', just indent one level, * otherwise align on the '='. * Never update indent_column. */ next = chunk_get_next(pc); if (next != NULL) { indent_pse_push(frm, pc); if (chunk_is_newline(next)) frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent_tmp + indent_size; else frm.pse[frm.pse_tos].indent = pc->column + pc->len + 1; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; } } else if (pc->type == CT_RETURN) { /* don't count returns inside a () or [] */ if (pc->level == pc->brace_level) { indent_pse_push(frm, pc); frm.pse[frm.pse_tos].indent = frm.pse[frm.pse_tos - 1].indent + pc->len + 1; frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos - 1].indent; } } else if (chunk_is_str(pc, "<<", 2)) { if (cout_col == 0) { cout_col = pc->column; cout_level = pc->level; } } else { /* anything else? */ } /** * Indent the line if needed */ if (did_newline && !chunk_is_newline(pc) && (pc->len != 0)) { /** * Check for special continuations. * Note that some of these could be done as a stack item like * everything else */ prev = chunk_get_prev_ncnl(pc); if ((pc->type == CT_MEMBER) || (pc->type == CT_DC_MEMBER) || ((prev != NULL) && ((prev->type == CT_MEMBER) || (prev->type == CT_DC_MEMBER)))) { tmp = cpd.settings[UO_indent_member].n + indent_column; LOG_FMT(LINDENT, "%s: %d] member => %d\n", __func__, pc->orig_line, tmp); reindent_line(pc, tmp); } else if (chunk_is_str(pc, "<<", 2) && (cout_col > 0)) { LOG_FMT(LINDENT, "%s: %d] cout_col => %d\n", __func__, pc->orig_line, cout_col); reindent_line(pc, cout_col); } else if ((vardefcol > 0) && (pc->type == CT_WORD) && ((pc->flags & PCF_VAR_DEF) != 0) && (prev != NULL) && (prev->type == CT_COMMA)) { LOG_FMT(LINDENT, "%s: %d] Vardefcol => %d\n", __func__, pc->orig_line, vardefcol); reindent_line(pc, vardefcol); } else if ((pc->type == CT_STRING) && (prev->type == CT_STRING) && cpd.settings[UO_indent_align_string].b) { LOG_FMT(LINDENT, "%s: %d] String => %d\n", __func__, pc->orig_line, prev->column); reindent_line(pc, prev->column); } else if (chunk_is_comment(pc)) { LOG_FMT(LINDENT, "%s: %d] comment => %d\n", __func__, pc->orig_line, frm.pse[frm.pse_tos].indent_tmp); indent_comment(pc, frm.pse[frm.pse_tos].indent_tmp); } else if (pc->type == CT_PREPROC) { /* Preprocs are always in column 1. See indent_preproc() */ if (pc->column != 1) reindent_line(pc, 1); } else { if (pc->column != indent_column) { LOG_FMT(LINDENT, "%s: %d] indent => %d [%.*s]\n", __func__, pc->orig_line, indent_column, pc->len, pc->str); reindent_line(pc, indent_column); } } did_newline = false; } /** * Handle variable definition continuation indenting */ if ((pc->type == CT_WORD) && ((pc->flags & PCF_IN_FCN_DEF) == 0) && ((pc->flags & PCF_VAR_1ST_DEF) == PCF_VAR_1ST_DEF)) vardefcol = pc->column; if (chunk_is_semicolon(pc) || ((pc->type == CT_BRACE_OPEN) && (pc->parent_type == CT_FUNCTION))) vardefcol = 0; /* if we hit a newline, reset indent_tmp */ if (chunk_is_newline(pc) || (pc->type == CT_COMMENT_MULTI) || (pc->type == CT_COMMENT_CPP)) { frm.pse[frm.pse_tos].indent_tmp = frm.pse[frm.pse_tos].indent; /** * Handle the case of a multi-line #define w/o anything on the * first line (indent_tmp will be 1 or 0) */ if ((pc->type == CT_NL_CONT) && (frm.pse[frm.pse_tos].indent_tmp <= indent_size)) frm.pse[frm.pse_tos].indent_tmp = indent_size + 1; /* Get ready to indent the next item */ did_newline = true; } if (!chunk_is_comment(pc) && !chunk_is_newline(pc)) prev = pc; pc = chunk_get_next(pc); } /* Throw out any stuff inside a preprocessor - no need to warn */ while ((frm.pse_tos > 0) && frm.pse[frm.pse_tos].in_preproc) indent_pse_pop(frm, pc); for (idx = 1; idx <= frm.pse_tos; idx++) { LOG_FMT(LWARN, "%s:%d Unmatched %s\n", cpd.filename, frm.pse[idx].open_line, get_token_name(frm.pse[idx].type)); cpd.error_count++; } } /** * returns true if forward scan reveals only single newlines or comments * stops when hits code * false if next thing hit is a closing brace, also if 2 newlines in a row */ static bool single_line_comment_indent_rule_applies(chunk_t *start) { chunk_t *pc = start; int nl_count = 0; if (!chunk_is_single_line_comment(pc)) return false; /* scan forward, if only single newlines and comments before next line of code, we want to apply */ while ((pc = chunk_get_next(pc)) != NULL) { if (chunk_is_newline(pc)) { if (nl_count > 0 || pc->nl_count > 1) return false; nl_count++; } else { nl_count = 0; if (!chunk_is_single_line_comment(pc)) { /* here we check for things to run into that we wouldn't want to indent the comment for */ /* for example, non-single line comment, closing brace */ if (chunk_is_comment(pc) || chunk_is_closing_brace(pc)) return false; return true; } } } return false; } /** * REVISIT: This needs to be re-checked, maybe cleaned up * * Indents comments in a (hopefully) smart manner. * * There are two type of comments that get indented: * - stand alone (ie, no tokens on the line before the comment) * - trailing comments (last token on the line apart from a linefeed) * + note that a stand-alone comment is a special case of a trailing * * The stand alone comments will get indented in one of three ways: * - column 1: * + There is an empty line before the comment AND the indent level is 0 * + The comment was originally in column 1 * * - Same column as trailing comment on previous line (ie, aligned) * + if originally within TBD (3) columns of the previous comment * * - syntax indent level * + doesn't fit in the previous categories * * Options modify this behavior: * - keep original column (don't move the comment, if possible) * - keep relative column (move out the same amount as first item on line) * - fix trailing comment in column TBD * * @param pc The comment, which is the first item on a line * @param col The column if this is to be put at indent level */ static void indent_comment(chunk_t *pc, int col) { chunk_t *nl; chunk_t *prev; LOG_FMT(LCMTIND, "%s: line %d, col %d, level %d: ", __func__, pc->orig_line, pc->orig_col, pc->level); /* force column 1 comment to column 1 if not changing them */ if ((pc->orig_col == 1) && !cpd.settings[UO_indent_col1_comment].b) { LOG_FMT(LCMTIND, "rule 1 - keep in col 1\n"); pc->column = 1; return; } nl = chunk_get_prev(pc); /* outside of any expression or statement? */ if (pc->level == 0) { if ((nl != NULL) && (nl->nl_count > 1)) { LOG_FMT(LCMTIND, "rule 2 - level 0, nl before\n"); pc->column = 1; return; } } prev = chunk_get_prev(nl); if (chunk_is_comment(prev) && (nl->nl_count == 1)) { int coldiff = prev->orig_col - pc->orig_col; if ((coldiff <= 3) && (coldiff >= -3)) { pc->column = prev->column; LOG_FMT(LCMTIND, "rule 3 - prev comment, coldiff = %d, now in %d\n", coldiff, pc->column); return; } } /* check if special single line comment rule applies */ if (cpd.settings[UO_indent_sing_line_comments].n > 0 && single_line_comment_indent_rule_applies(pc)) { pc->column = col + cpd.settings[UO_indent_sing_line_comments].n; LOG_FMT(LCMTIND, "rule 4 - single line comment indent, now in %d\n", pc->column); return; } LOG_FMT(LCMTIND, "rule 5 - fall-through, stay in %d\n", col); pc->column = col; } /** * Put spaces on either side of the preproc (#) symbol. * This is done by pointing pc->str into pp_str and adjusting the * length. */ void indent_preproc(void) { chunk_t *pc; chunk_t *next; int pp_level; int pp_level_sub = 0; int tmp; /* Define a string of 16 spaces + # + 16 spaces */ static const char *pp_str = " # "; static const char *alt_str = " %: "; /* Scan to see if the whole file is covered by one #ifdef */ int stage = 0; for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (chunk_is_comment(pc) || chunk_is_newline(pc)) continue; if (stage == 0) { /* Check the first PP, make sure it is an #if type */ if (pc->type != CT_PREPROC) break; next = chunk_get_next(pc); if ((next == NULL) || (next->type != CT_PP_IF)) break; stage = 1; } else if (stage == 1) { /* Scan until a PP at level 0 is found - the close to the #if */ if ((pc->type == CT_PREPROC) && (pc->pp_level == 0)) stage = 2; continue; } else if (stage == 2) { /* We should only see the rest of the preprocessor */ if ((pc->type == CT_PREPROC) || ((pc->flags & PCF_IN_PREPROC) == 0)) { stage = 0; break; } } } if (stage == 2) { LOG_FMT(LINFO, "The whole file is covered by a #IF\n"); pp_level_sub = 1; } for (pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if (pc->type != CT_PREPROC) continue; if (pc->column != 1) { /* Don't handle preprocessors that aren't in column 1 */ LOG_FMT(LINFO, "%s: Line %d doesn't start in column 1 (%d)\n", __func__, pc->orig_line, pc->column); continue; } /* point into pp_str */ if (pc->len == 2) /* alternate token crap */ pc->str = &alt_str[16]; else pc->str = &pp_str[16]; pp_level = pc->pp_level - pp_level_sub; if (pp_level < 0) pp_level = 0; else if (pp_level > 16) pp_level = 16; /* Note that the indent is removed by default */ if ((cpd.settings[UO_pp_indent].a & AV_ADD) != 0) { /* Need to add some spaces */ pc->str -= pp_level; pc->len += pp_level; } else if (cpd.settings[UO_pp_indent].a == AV_IGNORE) { tmp = (pc->orig_col <= 16) ? pc->orig_col - 1 : 16; pc->str -= tmp; pc->len += tmp; } /* Add spacing by adjusting the length */ if ((cpd.settings[UO_pp_space].a & AV_ADD) != 0) pc->len += pp_level; next = chunk_get_next(pc); if (next != NULL) reindent_line(next, pc->len + 1); LOG_FMT(LPPIS, "%s: Indent line %d to %d (len %d, next->col %d)\n", __func__, pc->orig_line, pp_level, pc->len, next->column); } } uncrustify-0.59/tests/output/c/00065-braces-5.c0000644000175000017500000000063411574754744015771 00000000000000/** * this is a really tough case - perhaps we shouldn't keep any #if crap * unless they all end with the same stack? */ void foo(void) { int a; #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) { ROOT_DEV = Root_RAM0; } #elif defined (CONFIG_ROOT_NFS) ROOT_DEV = Root_NFS; #elif defined (CONFIG_BLK_DEV_IDEDISK) ROOT_DEV = Root_HDA1; #else ROOT_DEV = Root_SDA1; #endif return; } uncrustify-0.59/tests/output/c/00073-nl_proto_endif.c0000644000175000017500000000026611574754744017371 00000000000000 #include static void status_cb(status_t *status); static int add_conn(const char *path); #ifdef USE_FOO_CMD static void foo_cmd(void *user, const info_t *info); #endif uncrustify-0.59/tests/output/c/02320-nl_create_one_liner.c0000644000175000017500000000022011631561414020321 00000000000000void foo() { if (a) b++; if (a) { b++; } if (a) if (b) c++; for (i=0; i<5; i++) bar(i); while (i>0) bar(--i); } uncrustify-0.59/tests/output/c/00061-braces-3.c0000644000175000017500000000016611574754744015763 00000000000000{ list_for_each(k) { if (a) { if (b) { c++; } } } } uncrustify-0.59/tests/output/c/02422-cmt_multi.c0000644000175000017500000000123711631561414016344 00000000000000/************************************************ * This is a multiline comment. * The first and last lines are the same length ************************************************/ /**************************************************************************** A multi-line comment that is broken in two parts. *//** Second part ****************************************************************************/ /**************************************************************************** A multi-line comment that is broken in two parts. */ /** Second part ****************************************************************************/ uncrustify-0.59/tests/output/c/02432-cmt_right_align.c0000644000175000017500000000137311631561414017503 00000000000000 int foo1(int bar) { if(bar) { if(b) { if(a) { if(r) { return(r); /* cool */ } else /* if (r) */ { return(bar); /* uncool */ } /* if (r) */ } /* if (a) */ } /* if (b) */ } /* if (bar) */ return(-1); } /* foo */ int foo2(int bar) { if(bar) { if(b) { if(a) { if(r) { return(r); } else { return(bar); } /* if (r) */ } /* if (a) */ } /* if (b) */ } /* if (bar) */ return(-1); } /* foo */ uncrustify-0.59/tests/output/c/02303-nl-cont2.c0000644000175000017500000000073311631561414016001 00000000000000 #define FOO(bar) create_a_really_long_identifier name(some_function( \ bar1 + bar2), bar3, \ bar4); #define multilinemacro do { (x+5); } while (0); \ printf("a multilinemacro"); \ printf("a multilinemacro2"); int main(int argc, char *argv[]) { int a, b; a = 1; /* stupid comment \ * b = 2; */ return(a+b); } uncrustify-0.59/tests/output/c/00154-casts.c0000644000175000017500000000275411574754744015511 00000000000000 #define SOME_VAL1 ((MYINT) -1) #define SOME_VAL2 (-2) #define SOME_VAL3 -3 #define MULT(X, Y) (X) *(Y) #define SOME_JUNK /*lint -e123 */ (const mytype *) -1 typedef (*my_fcn_ptr_t)(char *, int); typedef (my_fcn_t)(char *, int); void foo(void) { uint crc = crc32_calc_full((const UINT8 *) "String", 6); crc = crc32_calc_full((const UINT8 *) &crc, sizeof(crc)); a = (b) - 4; a = (UINT) -4; a = (UINT) +4; a = (UINT) * 4; a = (UINT) & 4; a = (uint32_t) -pb; a = (uint32_t) + pb; a = (uint32_t) *pb; a = (uint32_t) &pb; a = (Uint) - 4; a = (Uint) + 4; a = (Uint) * 4; a = (Uint) & 4; a = b * (int) flt; a = b * ((int) flt); a = b * (int) flt; a = b * (INT8) flt; a = b * (Uint) flt; a = *(int) &b; a = *(CHAR) &b; a = *(Uint) & b; a = (int) *pb; a = (CHAR) *pb; a = (Uint) * pb; a = (int) 'a'; a = (UINT8) 'a'; a = (Uint) 'a'; a = (int) *'a'; a = (UINT8) * 'a'; a = (Uint) * 'a'; a = (int) *5; a = (UINT) * 5; a = (Uint) * 5; a = (int) *ape; a = (UINT) *ape; a = (Uint) * ape; a = (int) ape; a = (UINT) ape; a = (Uint) ape; a = (int) sizeof(x); a = (INT16) sizeof(x); a = (Uint) sizeof(x); a = (int) foo(x); a = (CHAR) foo(x); a = (Uint) foo(x); a = (int) (x); a = (CHAR) (x); a = (Uint) (x); a = (int) *(x); a = (CHAR) *(x); a = (Uint) * (x); a = (unsigned int) (1 + 4); a = (int) (1 + 1); a = (void *) (&str); } uncrustify-0.59/tests/output/c/00701-function-def.c0000644000175000017500000000073511574754744016750 00000000000000void foo1( int param1, int param2, char *param2 ); void foo2( int param1, int param2, char *param2 ); void foo3( int param1, int param2, char *param2 ); struct whoopee * foo4( int param1, int param2, char *param2 ); const struct snickers * foo5( int param1, int param2, char *param2 ); void foo( int param1, int param2, char *param2 ) { printf("boo!\n"); } EXPORT int DoStuff( int Num ); uncrustify-0.59/tests/output/c/00162-fcn_indent.c0000644000175000017500000000107511574754744016475 00000000000000int this_is_a_function_proto(int a, char * b); int this_is_a_function_def(int a, char * b) { this_is_a_function_call(a, b); a = another_function_call(a, b); } typedef short (*hello1)(char coolParam, ushort *, unsigned int anotherone); short (*hello2)(char coolParam, ulong *, uchar, unsigned int anotherone); short hello3 (char coolParam, ushort *, unsigned int anotherone); uncrustify-0.59/tests/output/c/00404-align-var.c0000644000175000017500000000147711574754744016253 00000000000000struct foo1 { unsigned int d_ino; const char *d_reclen; unsigned short d_namlen; char d_name[1]; }; struct foo2 { unsigned int a : 1; unsigned int bcd : 3; unsigned int ef : 2; unsigned int : 2; unsigned short more; int fields; }; typedef struct { bitfld a : 8; bitfld b : 16; bitfld : 8; } type_t; struct foo { int a; char *b }; static int idx; static const char **tmp; static char buf[64]; static unsigned long how_long; // comment static int **tmp; static char buf[64]; void bar(int someval, void *puser, const char *filename, struct willy *the_list, int list_len) { int idx; const char **tmp; char buf[64]; unsigned long how_long; return(-1); } uncrustify-0.59/tests/output/c/00501-bool-pos.c0000644000175000017500000000165311574754744016117 00000000000000void foo(void) { if ((a != 0) && (b == 0) && (c < 0) && (d > 0)) { printf("hi"); } if (flag1 #ifdef FLAG2 || flag2 #endif ) { printf("yar"); } if (flag1 && #ifdef FLAG2 flag2 && #endif flag3) { printf("bo"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if (!this->writeOwiFile () || // comment1 broken () || !saveArchiveData () || /* comment2 */ broken () || !deleteCentralArchive () || // comment3 broken () || !copyArchivFiles () || // comment4 broken () || !appendToPlanetDb ()) // comment5 { ; } foobar(param1, param2, param3, param4); foobar2(param1, param2, param3, param4); } uncrustify-0.59/tests/output/c/01050-func_call_user.c0000644000175000017500000000016511574754744017346 00000000000000int func(n) { int a = foo (); char *a = _("some text"); char *str = N_("other text"); } /* func */ uncrustify-0.59/tests/output/c/00055-braces-2.c0000644000175000017500000000026011574754744015760 00000000000000while ( a >= 0) { if ( b) { for ( j = 0; j < 10; j++) { if ( j == b) { return; } a++; } } b--; } uncrustify-0.59/tests/output/c/00502-bool-pos.c0000644000175000017500000000165711574754744016124 00000000000000void foo(void) { if ((a != 0) && (b == 0) && (c < 0) && (d > 0)) { printf("hi"); } if (flag1 #ifdef FLAG2 || flag2 #endif ) { printf("yar"); } if (flag1 && #ifdef FLAG2 flag2 && #endif flag3) { printf("bo"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if ((a != 0) && (b == 0) && (c < 0)) { printf("hi"); } if (!this->writeOwiFile () // comment1 || broken () || !saveArchiveData () /* comment2 */ || broken () || !deleteCentralArchive () // comment3 || broken () || !copyArchivFiles () // comment4 || broken () || !appendToPlanetDb ()) // comment5 { ; } foobar(param1 , param2, param3 , param4); foobar2(param1 , param2, param3 , param4); } uncrustify-0.59/tests/output/c/00411-align-typedef.c0000644000175000017500000000072211574754744017111 00000000000000 typedef int MY_INT; typedef int * MY_INTP; typedef int (*foo_t)(void *bar); typedef int (*somefunc_t)(void *barstool); typedef int int8_t __attribute__((__mode__(__QI__))); typedef int uint8_t; typedef struct _IDirectFBSurface IDirectFBSurface; typedef struct _IDirectFBPalette IDirectFBPalette; typedef struct timezone *__restrict __timezone_ptr_t; uncrustify-0.59/tests/output/c/01015-paren_indent.c0000644000175000017500000000017011574754744017025 00000000000000function1 (something1); function2 (something2); x = (float) (number); x = (float) (number); uncrustify-0.59/tests/output/c/00421-nl_ds_struct_enum.c0000644000175000017500000000046511574754744020115 00000000000000struct foo { unsigned int d_ino; /* Comment */ unsigned short d_reclen; unsigned short d_namlen; /* Comment */ char d_name[1]; }; struct foo { /* Comment */ unsigned int d_ino; unsigned short d_reclen; unsigned short d_namlen; /* Comment */ char d_name[1]; }; struct foo { int a; char *b }; uncrustify-0.59/tests/output/c/00105-bugs-5.c0000644000175000017500000000024411574754744015462 00000000000000 static void log_roll_file(log_output_t *plo) { INT32 retcode; const CHAR *name_save; const CHAR *name_temp; if (plo->pfile != NULL) { } } uncrustify-0.59/tests/output/c/00051-brace-remove.c0000644000175000017500000000135011574754744016726 00000000000000 void foo(void) { int a = 0; while (a < 3) a++; while (b < a) b++; do a--; while (a > 0); for (a = 0; a < 10; a++) printf("a=%d\n", a); if (a == 10) printf("a looks good\n"); if (state == ST_RUN) if ((foo < bar) && (bar > foo2)) if (a < 5) a *= a; while (*ptr++ != ',') { } } // mod_full_brace_for = remove should not remove the braces in this example: int main() { if(true) // indent=1 for(int i = 0; i < 3; i++) { if(false) continue; // indent=4 } else return; // indent=2 } // mod_full_brace_if = remove should not remove the braces in this example: int main() { if(true) { for(int i = 0; i < 3; i++) if(false) continue; // indent=4 } else return; // indent=2 } uncrustify-0.59/tests/output/c/00110-misc.c0000644000175000017500000000161411574754744015311 00000000000000/********************/ /* Before Unrustify */ /********************/ #define MACRO(cond, action) if ((cond)) \ (action) void hurz(murks) { if (murks = 4) // This comment belongs to (murks = 4) { schrott(); // And this to schrott() } #ifdef SCHNIEPEL else if (murks = 6) // This comment belongs to (murks = 6) { // I had to write more comment than one line // so I inserted some comment only blocks schniepel(); } #endif // SCHNIEPEL else { flursen(); } if (murks = 4) // This comment belongs to (murks = 4) #ifdef FOO { foo(); } #else { bar(); } #endif if (murks = 4) // This comment belongs to (murks = 4) { schrott(); // And this to schrott() } return; } // hurz() uncrustify-0.59/tests/output/c/00015-braces.c0000644000175000017500000000224711574754744015624 00000000000000 void foo(void) { int a = 0; while (a < 3) { a++; } while (b < a) // trailing C++ comment b++; do // trailing C++ comment { a--; } while (a > 0); do a--; while (a > 0); for (a = 0; a < 10; a++) // trailing C++ comment { printf("a=%d\n", a); } if (a == 10) // trailing C++ comment { printf("a looks good\n"); } else // trailing C++ comment { printf("not so good\n"); } if (state == ST_RUN) { if ((foo < bar) && (bar > foo2)) { if (a < 5) { a *= a; } else if (b != 0) a /= b; else // trailing C++ comment a += b; } } list_for_each(k) { if (a) if (b) { c++; } } while (1) ; /* hang forever */ } void f() { if (buf[0] == '~' && strchr(tmp, '/') == NULL) { buf = mallocstrcpy(buf, tmp); matches = username_tab_completion(tmp, &num_matches); } /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ else if (strlen(buf) > strlen(tmp)) buf = mallocstrcpy(buf, tmp); } void f() { } void g() { } uncrustify-0.59/tests/output/c/00068-bsnl.c0000644000175000017500000000013611574754744015326 00000000000000#define SOME_MACRO \ bool has_err; \ bool is_comp; \ struct some_stream ostream uncrustify-0.59/tests/output/c/00005-cmt-align.c0000644000175000017500000000072511574754744016236 00000000000000#ifndef HAVE_FOO void foo(void) { if (bar) { call_some_function(); /* call the function */ return(foo); /* comment */ } /* if (bar) */ } #endif /* HAVE_FOO */ #ifndef HAVE_BAR /* bar isn't available on all HW */ void bar(void) { if (foo) { call_some_function(); /* call the function */ return(foo); /* comment */ } /* if (foo) */ } #endif /* HAVE_BAR */ uncrustify-0.59/tests/output/c/02201-align-string.c0000644000175000017500000000055511631561414016742 00000000000000 // note - set threshold to three void foo(void) { printf("This is the first line\n" "And this is the second.\n"); fprintf(stderr, "This is the first line\n" "And this is the second.\n"); fprintf(stderr, "Format string: %s", "This is the first line\n" "And this is the second.\n"); } uncrustify-0.59/tests/output/c/00412-align-typedef.c0000644000175000017500000000072211574754744017112 00000000000000 typedef int MY_INT; typedef int * MY_INTP; typedef int (*foo_t)(void *bar); typedef int (*somefunc_t)(void *barstool); typedef int int8_t __attribute__((__mode__(__QI__))); typedef int uint8_t; typedef struct _IDirectFBSurface IDirectFBSurface; typedef struct _IDirectFBPalette IDirectFBPalette; typedef struct timezone *__restrict __timezone_ptr_t; uncrustify-0.59/tests/output/c/00801-fcn_type.c0000644000175000017500000000154411574754744016176 00000000000000typedef void (*my_fcn_ptr)(char *, int); typedef const char *(my_fcn_ptr)(char *, int); typedef int (my_fcn_ptr)(char *, int); typedef struct foo *(my_fcn_ptr)(char *, int); typedef enum foo *(*my_fcn_ptr)(char *, int); typedef const struct foo *(*my_fcn_ptr)(char *, int); typedef BOOL (my_fcn_ptr)(char *, int); typedef INT32 (*my_fcn_ptr)(char *, int); typedef int INT32; typedef struct foo { int a; } fooey; typedef struct { int a; } queso; struct myfoo { INT32 age; const struct foo *(*my_fcn_ptr)(char *, int); const CHAR *name; MYTYPE (*foo)(int, char); void *user; void (*foo)(int, char); }; SMU foo(void) { a = 4; return(SMUIFY(a)); } typedef struct { void (*newObject)(const object_info *info, const IObject **interface, struct object_h *instance); } IObjectFactory; uncrustify-0.59/tests/output/c/00721-nl-semicolon.c0000644000175000017500000000043311631037516016744 00000000000000void foo(void) { a = 5; b = 3; j = 6; for (a = 0; a < j; a++) { b *= (a + b); } } struct somestruct { int a; char b; foo c; bar *d; }; struct foo { int a; char *b }; void f() { for (;;) { nothing(); } foobar(); } ; uncrustify-0.59/tests/output/c/00102-bugs-2.c0000644000175000017500000000044611574754744015460 00000000000000static void tcps_proc_server_msg(void *p_user, const ptc_msg_info_t *p_info) { if (z) { if (a) /* comment */ { a++; } /* comment */ else if (b) { b++; } /* Comment */ else { c++; } } } uncrustify-0.59/tests/output/c/00082-else-if.c0000644000175000017500000000053411574754744015712 00000000000000int test (int A, int B) { int C; if (A == 0) if (B == 0) C = 1; else if (B == 1) C = 2; else C = 3; else if (A == 1) if (B == 0) C = 4; else if (B == 1) C = 5; else C = 6; else if (B == 0) C = 7; else if (B == 1) C = 8; else C = 9; return C; } uncrustify-0.59/tests/output/c/02413-ifdef-indent.c0000644000175000017500000000053211631561414016700 00000000000000#ifdef foo #include #else #include #endif int show_interrupts(struct seq_file *p, void *v) { #ifndef CONFIG_SMP a++; #else for (b = 0; b < 9; b++) if (b & 1) k++; #endif if (v) { bar(v); #if DEBUG == 1 printf("yup\n"); #endif } } void foo() { int i=0; #if DEBUG == 1 i--; #endif i++; } uncrustify-0.59/tests/output/c/00201-case.c0000644000175000017500000000141611574754744015272 00000000000000void foo(void) { switch(ch) { // handle 'a' case 'a': { handle_a(); multiline(123, 345); break; } // handle 'b' case 'b': handle_b(); multiline(123, 345); break; // handle 'c' and 'd' case 'c': case 'd': // c and d are really the same thing handle_cd(); multiline(123, 345); break; case 'e': { handle_a(); multiline(123, 345); } break; // case1 case (case1): { //do stuff break; } case (case2): { //do stuff break; } case (case3): /*do stuff*/ break; case (case3): statement(); { another_statement(); } break; // really should not get here default: handle_default(); multiline(123, 345); break; } multiline(123, 345); } uncrustify-0.59/tests/output/c/00506-pos_conditional.c0000644000175000017500000000024711574754744017554 00000000000000void foo(void) { // conditional colon a = bar() ? 2 : 3; a = bar() ? 2 : 3; // conditional question a = bar() ? 2 : 3; a = bar() ? 2 : 3; } uncrustify-0.59/tests/output/c/00431-paren-indent.c0000644000175000017500000000141311574754744016745 00000000000000static void *foo( int param1 , char *param2 ); static void *foo ( int param1 , char *param2 ) { for ( int i = 0; i< 10; i++ ) { bar( arg1 , arg2 ); if ( ( abc < bcd ) &&( 123 < abc ) ) { none( arg1 , arg2 , arg3 ); } } } void CWarningAnalyzer::SetEffect( int FilterNumber , bool Exclude , int Red , int Green , int Blue , bool Italic , bool Bold , bool Underlined ) { /* TODO */ } uncrustify-0.59/tests/output/c/00901-code_width.c0000644000175000017500000000402111574754744016472 00000000000000 static int short_function_name(struct device *dev, struct device_driver *drv); /* Assuming a 60-column limit */ static int short_function_name(struct device *dev, struct device_driver *drv) { this->translateLabels(labelID, completedLabelID, selectedLabelID, text, selectedText, completedText, fontId, selectedFontId, completedFontId); call_some_really_long_function.of_some_sort( some_long_parameter1, some_long_parameter2); abc = call_some_other_really_long_function.of_some_sort( some_long_parameter1, some_long_parameter2); abc.def.ghi = call_some_other_really_long_function.of_some_sort( some_long_parameter1, some_long_parameter2); abcdefghijklmnopqrstuvwxyz = abc + def + ghi + jkl + mno + prq + stu + vwx + yz; return 1; } static void some_really_long_function_name( struct device *dev, struct device_driver *drv) { if ((some_variable_name && somefunction(param1, param2, param3))) { asdfghjk = asdfasdfasd.aasdfasd + (asdfasd.asdas * 1234.65); } for (struct something_really_really_excessive * a_long_ptr_name = get_first_item(); a_long_ptr_name != NULL; a_long_ptr_name = get_next_item(a_long_ptr_name)) { } for (a = get_first(); a != NULL; a = get_next(a)) { } for (a_ptr = get_first(); a_ptr != NULL; a_ptr = get_next(a)) { } register_clcmd( "examine", "do_examine", -1, "-Allows a player to examine the health and armor of a teammate" ); register_clcmd( "/examine", "do_examine", -1, "-Allows a player to examine the health and armor of a teammate" ); } uncrustify-0.59/tests/output/c/02503-pp_concat_asn1.h0000644000175000017500000002567311631561414017256 00000000000000#ifndef HEADER_ASN1_H #define HEADER_ASN1_H #define V_ASN1_UNIVERSAL 0x00 #define V_ASN1_APPLICATION 0x40 #define V_ASN1_CONTEXT_SPECIFIC 0x80 #define V_ASN1_PRIVATE 0xc0 #define V_ASN1_CONSTRUCTED 0x20 #define V_ASN1_PRIMITIVE_TAG 0x1f #define V_ASN1_PRIMATIVE_TAG 0x1f #define V_ASN1_APP_CHOOSE -2 /* let the recipient choose */ #define V_ASN1_OTHER -3 /* used in ASN1_TYPE */ #define V_ASN1_ANY -4 /* used in ASN1 template code */ #define V_ASN1_NEG 0x100 /* negative flag */ #define V_ASN1_UNDEF -1 #define V_ASN1_EOC 0 #define V_ASN1_BOOLEAN 1 /**/ #define V_ASN1_INTEGER 2 #define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG) #define V_ASN1_BIT_STRING 3 #define V_ASN1_OCTET_STRING 4 #define V_ASN1_NULL 5 #define V_ASN1_OBJECT 6 /* object identifier */ #define V_ASN1_OBJECT_DESCRIPTOR 7 #define V_ASN1_EXTERNAL 8 /* external / instance of */ #define V_ASN1_REAL 9 #define V_ASN1_ENUMERATED 10 #define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG) #define V_ASN1_EMBEDDED_PDV 11 #define V_ASN1_UTF8STRING 12 #define V_ASN1_SEQUENCE 16 #define V_ASN1_SET 17 #define V_ASN1_NUMERICSTRING 18 /**/ #define V_ASN1_PRINTABLESTRING 19 #define V_ASN1_T61STRING 20 #define V_ASN1_TELETEXSTRING 20 /* alias */ #define V_ASN1_VIDEOTEXSTRING 21 /**/ #define V_ASN1_IA5STRING 22 #define V_ASN1_UTCTIME 23 #define V_ASN1_GENERALIZEDTIME 24 /**/ #define V_ASN1_GRAPHICSTRING 25 /**/ #define V_ASN1_ISO64STRING 26 /**/ #define V_ASN1_VISIBLESTRING 26 /* alias */ #define V_ASN1_GENERALSTRING 27 /**/ #define V_ASN1_UNIVERSALSTRING 28 /**/ #define V_ASN1_BMPSTRING 30 /* For use with d2i_ASN1_type_bytes() */ #define B_ASN1_NUMERICSTRING 0x0001 #define B_ASN1_PRINTABLESTRING 0x0002 #define B_ASN1_T61STRING 0x0004 #define B_ASN1_TELETEXSTRING 0x0004 #define B_ASN1_VIDEOTEXSTRING 0x0008 #define B_ASN1_IA5STRING 0x0010 #define B_ASN1_GRAPHICSTRING 0x0020 #define B_ASN1_ISO64STRING 0x0040 #define B_ASN1_VISIBLESTRING 0x0040 #define B_ASN1_GENERALSTRING 0x0080 #define B_ASN1_UNIVERSALSTRING 0x0100 #define B_ASN1_OCTET_STRING 0x0200 #define B_ASN1_BIT_STRING 0x0400 #define B_ASN1_BMPSTRING 0x0800 #define B_ASN1_UNKNOWN 0x1000 #define B_ASN1_UTF8STRING 0x2000 #define B_ASN1_UTCTIME 0x4000 #define B_ASN1_GENERALIZEDTIME 0x8000 #define B_ASN1_SEQUENCE 0x10000 /* For use with ASN1_mbstring_copy() */ #define MBSTRING_FLAG 0x1000 #define MBSTRING_UTF8 (MBSTRING_FLAG) #define MBSTRING_ASC (MBSTRING_FLAG | 1) #define MBSTRING_BMP (MBSTRING_FLAG | 2) #define MBSTRING_UNIV (MBSTRING_FLAG | 4) #define SMIME_OLDMIME 0x400 #define SMIME_CRLFEOL 0x800 #define SMIME_STREAM 0x1000 struct X509_algor_st; DECLARE_STACK_OF(X509_ALGOR); #define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ #define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ /* We MUST make sure that, except for constness, asn1_ctx_st and * asn1_const_ctx are exactly the same. Fortunately, as soon as * the old ASN1 parsing macros are gone, we can throw this away * as well... */ typedef struct asn1_ctx_st { unsigned char *p; /* work char pointer */ int eos; /* end of sequence read for indefinite encoding */ int error; /* error code to use when returning an error */ int inf; /* constructed if 0x20, indefinite is 0x21 */ int tag; /* tag from last 'get object' */ int xclass; /* class from last 'get object' */ size_t slen; /* length of last 'get object' */ unsigned char * max; /* largest value of p allowed */ unsigned char * q; /* temporary variable */ unsigned char **pp; /* variable */ int line; /* used in error processing */ } ASN1_CTX; typedef struct asn1_const_ctx_st { const unsigned char *p; /* work char pointer */ int eos; /* end of sequence read for indefinite encoding */ int error; /* error code to use when returning an error */ int inf; /* constructed if 0x20, indefinite is 0x21 */ int tag; /* tag from last 'get object' */ int xclass; /* class from last 'get object' */ size_t slen; /* length of last 'get object' */ const unsigned char * max; /* largest value of p allowed */ const unsigned char * q; /* temporary variable */ const unsigned char **pp; /* variable */ int line; /* used in error processing */ } ASN1_const_CTX; /* These are used internally in the ASN1_OBJECT to keep track of * whether the names and data need to be free()ed */ #define ASN1_OBJECT_FLAG_DYNAMIC 0x01 /* internal use */ #define ASN1_OBJECT_FLAG_CRITICAL 0x02 /* critical x509v3 object id */ #define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04 /* internal use */ #define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08 /* internal use */ typedef struct asn1_object_st { const char *sn, *ln; int nid; size_t length; const unsigned char *data; /* data remains const after init */ int flags; /* Should we free this one */ } ASN1_OBJECT; #define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */ /* This indicates that the ASN1_STRING is not a real value but just a place * holder for the location where indefinite length constructed data should * be inserted in the memory buffer */ #define ASN1_STRING_FLAG_NDEF 0x010 /* This flag is used by the CMS code to indicate that a string is not * complete and is a place holder for content when it had all been * accessed. The flag will be reset when content has been written to it. */ #define ASN1_STRING_FLAG_CONT 0x020 /* This is the base type that holds just about everything :-) */ typedef struct asn1_string_st { size_t length; int type; unsigned char *data; /* The value of the following field depends on the type being * held. It is mostly being used for BIT_STRING so if the * input data has a non-zero 'unused bits' value, it will be * handled correctly */ long flags; } ASN1_STRING; /* ASN1_ENCODING structure: this is used to save the received * encoding of an ASN1 type. This is useful to get round * problems with invalid encodings which can break signatures. */ typedef struct ASN1_ENCODING_st { unsigned char *enc; /* DER encoding */ size_t len; /* Length of encoding */ int modified; /* set to 1 if 'enc' is invalid */ } ASN1_ENCODING; /* Used with ASN1 LONG type: if a long is set to this it is omitted */ #define ASN1_LONG_UNDEF 0x7fffffffL #define STABLE_FLAGS_MALLOC 0x01 #define STABLE_NO_MASK 0x02 #define DIRSTRING_TYPE \ (B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING) #define PKCS9STRING_TYPE (DIRSTRING_TYPE | B_ASN1_IA5STRING) /* Declarations for template structures: for full definitions * see asn1t.h */ typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE; typedef struct ASN1_ITEM_st ASN1_ITEM; typedef struct ASN1_TLC_st ASN1_TLC; /* This is just an opaque pointer */ typedef struct ASN1_VALUE_st ASN1_VALUE; /* Declare ASN1 functions: the implement macro in in asn1t.h */ #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) #define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) #define DECLARE_ASN1_FUNCTIONS_name(type, name) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name); \ DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name); \ DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ type *d2i_##name(type **a, const unsigned char **in, size_t len); \ int i2d_##name(const type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(itname) #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ type *d2i_##name(type **a, const unsigned char **in, size_t len); \ int i2d_##name(const type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(name) #define DECLARE_ASN1_NDEF_FUNCTION(name) \ int i2d_##name##_NDEF(const name * a, unsigned char **out) #define DECLARE_ASN1_FUNCTIONS_const(name) \ DECLARE_ASN1_ALLOC_FUNCTIONS(name); \ DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) #define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ type *name##_new(void); \ void name##_free(type *a) #define DECLARE_ASN1_PRINT_FUNCTION(stname) \ DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) #define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \ int fname##_print_ctx(BIO *out, const stname *x, int indent, \ const ASN1_PCTX * pctx) /* * WARNING WARNING WARNING * * uncrustify still introduces whitespace in here at some spots, but then * one might ask how crazy we want to go regarding ## encumbered parsing? * There's always the copout of INDENT-OFF markers for files like these, * once you've got them 95% right through uncrustify and that extra 5% * by hand ;-) */ #define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type (type **, const unsigned char **, size_t) #define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type (type *, unsigned char **) #define TYPEDEF_I2D_OF_CONST(type) typedef int i2d_of_const_##type (const type *, unsigned char **) /* [i_a] */ #define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type); TYPEDEF_I2D_OF_CONST(type) /* [i_a] */ /* Macro to include ASN1_ITEM pointer from base type */ #define ASN1_ITEM_ref(iptr) (&(iptr##_it)) #define ASN1_ITEM_rptr(ref) (&(ref##_it)) #define DECLARE_ASN1_ITEM(name) \ extern const ASN1_ITEM name##_it; #define ASN1_STRFLGS_RFC2253 \ (ASN1_STRFLGS_ESC_2253 | \ ASN1_STRFLGS_ESC_CTRL | \ ASN1_STRFLGS_ESC_MSB | \ ASN1_STRFLGS_UTF8_CONVERT | \ ASN1_STRFLGS_DUMP_UNKNOWN | \ ASN1_STRFLGS_DUMP_DER) DECLARE_STACK_OF(ASN1_INTEGER); DECLARE_ASN1_SET_OF(ASN1_INTEGER); DECLARE_STACK_OF(ASN1_GENERALSTRING); typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY); DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY); #define B_ASN1_DIRECTORYSTRING \ B_ASN1_PRINTABLESTRING | \ B_ASN1_TELETEXSTRING | \ B_ASN1_BMPSTRING | \ B_ASN1_UNIVERSALSTRING | \ B_ASN1_UTF8STRING #define B_ASN1_DISPLAYTEXT \ B_ASN1_IA5STRING | \ B_ASN1_VISIBLESTRING | \ B_ASN1_BMPSTRING | \ B_ASN1_UTF8STRING #endif // ifndef HEADER_ASN1_H uncrustify-0.59/tests/output/c/02002-i2c-core.c0000644000175000017500000011155011631561414015744 00000000000000/* i2c-core.c - a device driver for the iic-bus interface */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-99 Simon G. Vogl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kyösti Mälkki . * All SMBus-related things are written by Frodo Looijaard * SMBus 2.0 support by Mark Studebaker */ #include #include #include #include #include #include #include #include #include static LIST_HEAD(adapters); static LIST_HEAD(drivers); static DECLARE_MUTEX(core_lists); static DEFINE_IDR(i2c_adapter_idr); static int i2c_device_match(struct device *dev, struct device_driver *drv) { return(1); } static int i2c_bus_suspend(struct device *dev, pm_message_t state) { int rc = 0; if (dev->driver && dev->driver->suspend) { rc = dev->driver->suspend(dev, state, 0); } return(rc); } static int i2c_bus_resume(struct device *dev) { int rc = 0; if (dev->driver && dev->driver->resume) { rc = dev->driver->resume(dev, 0); } return(rc); } struct bus_type i2c_bus_type = { .name = "i2c", .match = i2c_device_match, .suspend = i2c_bus_suspend, .resume = i2c_bus_resume, }; static int i2c_device_probe(struct device *dev) { return(-ENODEV); } static int i2c_device_remove(struct device *dev) { return(0); } void i2c_adapter_dev_release(struct device *dev) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); complete(&adap->dev_released); } struct device_driver i2c_adapter_driver = { .name = "i2c_adapter", .bus = &i2c_bus_type, .probe = i2c_device_probe, .remove = i2c_device_remove, }; static void i2c_adapter_class_dev_release(struct class_device *dev) { struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev); complete(&adap->class_dev_released); } struct class i2c_adapter_class = { .name = "i2c-adapter", .release = &i2c_adapter_class_dev_release, }; static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); return(sprintf(buf, "%s\n", adap->name)); } static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); static void i2c_client_release(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); complete(&client->released); } static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); return(sprintf(buf, "%s\n", client->name)); } /* * We can't use the DEVICE_ATTR() macro here as we want the same filename for a * different type of a device. So beware if the DEVICE_ATTR() macro ever * changes, this definition will also have to change. */ static struct device_attribute dev_attr_client_name = { .attr = { .name = "name", .mode = S_IRUGO, .owner = THIS_MODULE }, .show = &show_client_name, }; /* --------------------------------------------------- * registering functions * --------------------------------------------------- */ /* ----- * i2c_add_adapter is called from within the algorithm layer, * when a new hw adapter registers. A new device is register to be * available for clients. */ int i2c_add_adapter(struct i2c_adapter *adap) { int id, res = 0; struct list_head *item; struct i2c_driver *driver; down(&core_lists); if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) { res = -ENOMEM; goto out_unlock; } res = idr_get_new(&i2c_adapter_idr, adap, &id); if (res < 0) { if (res == -EAGAIN) { res = -ENOMEM; } goto out_unlock; } adap->nr = id & MAX_ID_MASK; init_MUTEX(&adap->bus_lock); init_MUTEX(&adap->clist_lock); list_add_tail(&adap->list, &adapters); INIT_LIST_HEAD(&adap->clients); /* Add the adapter to the driver core. * If the parent pointer is not set up, * we add this adapter to the host bus. */ if (adap->dev.parent == NULL) { adap->dev.parent = &platform_bus; } sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); adap->dev.driver = &i2c_adapter_driver; adap->dev.release = &i2c_adapter_dev_release; device_register(&adap->dev); device_create_file(&adap->dev, &dev_attr_name); /* Add this adapter to the i2c_adapter class */ memset(&adap->class_dev, 0x00, sizeof(struct class_device)); adap->class_dev.dev = &adap->dev; adap->class_dev.class = &i2c_adapter_class; strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE); class_device_register(&adap->class_dev); dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); /* inform drivers of new adapters */ list_for_each(item, &drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->flags & I2C_DF_NOTIFY) { /* We ignore the return code; if it fails, too bad */ driver->attach_adapter(adap); } } out_unlock: up(&core_lists); return(res); } /* i2c_add_adapter */ int i2c_del_adapter(struct i2c_adapter *adap) { struct list_head *item, *_n; struct i2c_adapter *adap_from_list; struct i2c_driver *driver; struct i2c_client *client; int res = 0; down(&core_lists); /* First make sure that this adapter was ever added */ list_for_each_entry(adap_from_list, &adapters, list) { if (adap_from_list == adap) { break; } } if (adap_from_list != adap) { pr_debug("i2c-core: attempting to delete unregistered " "adapter [%s]\n", adap->name); res = -EINVAL; goto out_unlock; } list_for_each(item, &drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } } /* detach any active clients. This must be done first, because * it can fail; in which case we give up. */ list_for_each_safe(item, _n, &adap->clients) { client = list_entry(item, struct i2c_client, list); /* detaching devices is unconditional of the set notify * flag, as _all_ clients that reside on the adapter * must be deleted, as this would cause invalid states. */ if ((res = client->driver->detach_client(client))) { dev_err(&adap->dev, "detach_client failed for client " "[%s] at address 0x%02x\n", client->name, client->addr); goto out_unlock; } } /* clean up the sysfs representation */ init_completion(&adap->dev_released); init_completion(&adap->class_dev_released); class_device_unregister(&adap->class_dev); device_remove_file(&adap->dev, &dev_attr_name); device_unregister(&adap->dev); list_del(&adap->list); /* wait for sysfs to drop all references */ wait_for_completion(&adap->dev_released); wait_for_completion(&adap->class_dev_released); /* free dynamically allocated bus id */ idr_remove(&i2c_adapter_idr, adap->nr); dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); out_unlock: up(&core_lists); return(res); } /* i2c_del_adapter */ /* ----- * What follows is the "upwards" interface: commands for talking to clients, * which implement the functions to access the physical information of the * chips. */ int i2c_add_driver(struct i2c_driver *driver) { struct list_head *item; struct i2c_adapter *adapter; int res = 0; down(&core_lists); /* add the driver to the list of i2c drivers in the driver core */ driver->driver.name = driver->name; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_device_probe; driver->driver.remove = i2c_device_remove; res = driver_register(&driver->driver); if (res) { goto out_unlock; } list_add_tail(&driver->list, &drivers); pr_debug("i2c-core: driver [%s] registered\n", driver->name); /* now look for instances of driver on our adapters */ if (driver->flags & I2C_DF_NOTIFY) { list_for_each(item, &adapters) { adapter = list_entry(item, struct i2c_adapter, list); driver->attach_adapter(adapter); } } out_unlock: up(&core_lists); return(res); } int i2c_del_driver(struct i2c_driver *driver) { struct list_head *item1, *item2, *_n; struct i2c_client *client; struct i2c_adapter *adap; int res = 0; down(&core_lists); /* Have a look at each adapter, if clients of this driver are still * attached. If so, detach them to be able to kill the driver * afterwards. * * Removing clients does not depend on the notify flag, else * invalid operation might (will!) result, when using stale client * pointers. */ list_for_each(item1, &adapters) { adap = list_entry(item1, struct i2c_adapter, list); if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } else { list_for_each_safe(item2, _n, &adap->clients) { client = list_entry(item2, struct i2c_client, list); if (client->driver != driver) { continue; } dev_dbg(&adap->dev, "detaching client [%s] " "at 0x%02x\n", client->name, client->addr); if ((res = driver->detach_client(client))) { dev_err(&adap->dev, "detach_client " "failed for client [%s] at " "0x%02x\n", client->name, client->addr); goto out_unlock; } } } } driver_unregister(&driver->driver); list_del(&driver->list); pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); out_unlock: up(&core_lists); return(0); } /* i2c_del_driver */ static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr) { struct list_head *item; struct i2c_client *client; list_for_each(item, &adapter->clients) { client = list_entry(item, struct i2c_client, list); if (client->addr == addr) { return(-EBUSY); } } return(0); } int i2c_check_addr(struct i2c_adapter *adapter, int addr) { int rval; down(&adapter->clist_lock); rval = __i2c_check_addr(adapter, addr); up(&adapter->clist_lock); return(rval); } int i2c_attach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; down(&adapter->clist_lock); if (__i2c_check_addr(client->adapter, client->addr)) { up(&adapter->clist_lock); return(-EBUSY); } list_add_tail(&client->list, &adapter->clients); up(&adapter->clist_lock); if (adapter->client_register) { if (adapter->client_register(client)) { dev_dbg(&adapter->dev, "client_register " "failed for client [%s] at 0x%02x\n", client->name, client->addr); } } if (client->flags & I2C_CLIENT_ALLOW_USE) { client->usage_count = 0; } client->dev.parent = &client->adapter->dev; client->dev.driver = &client->driver->driver; client->dev.bus = &i2c_bus_type; client->dev.release = &i2c_client_release; snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), "%d-%04x", i2c_adapter_id(adapter), client->addr); dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", client->name, client->dev.bus_id); device_register(&client->dev); device_create_file(&client->dev, &dev_attr_client_name); return(0); } /* i2c_attach_client */ int i2c_detach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int res = 0; if ((client->flags & I2C_CLIENT_ALLOW_USE) && (client->usage_count > 0)) { dev_warn(&client->dev, "Client [%s] still busy, " "can't detach\n", client->name); return(-EBUSY); } if (adapter->client_unregister) { res = adapter->client_unregister(client); if (res) { dev_err(&client->dev, "client_unregister [%s] failed, " "client not detached\n", client->name); goto out; } } down(&adapter->clist_lock); list_del(&client->list); init_completion(&client->released); device_remove_file(&client->dev, &dev_attr_client_name); device_unregister(&client->dev); up(&adapter->clist_lock); wait_for_completion(&client->released); out: return(res); } static int i2c_inc_use_client(struct i2c_client *client) { if (!try_module_get(client->driver->owner)) { return(-ENODEV); } if (!try_module_get(client->adapter->owner)) { module_put(client->driver->owner); return(-ENODEV); } return(0); } static void i2c_dec_use_client(struct i2c_client *client) { module_put(client->driver->owner); module_put(client->adapter->owner); } int i2c_use_client(struct i2c_client *client) { int ret; ret = i2c_inc_use_client(client); if (ret) { return(ret); } if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) { client->usage_count++; } else if (client->usage_count > 0) { goto busy; } else { client->usage_count++; } } return(0); busy: i2c_dec_use_client(client); return(-EBUSY); } int i2c_release_client(struct i2c_client *client) { if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->usage_count > 0) { client->usage_count--; } else { pr_debug("i2c-core: %s used one too many times\n", __FUNCTION__); return(-EPERM); } } i2c_dec_use_client(client); return(0); } void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) { struct list_head *item; struct i2c_client *client; down(&adap->clist_lock); list_for_each(item, &adap->clients) { client = list_entry(item, struct i2c_client, list); if (!try_module_get(client->driver->owner)) { continue; } if (NULL != client->driver->command) { up(&adap->clist_lock); client->driver->command(client, cmd, arg); down(&adap->clist_lock); } module_put(client->driver->owner); } up(&adap->clist_lock); } static int __init i2c_init(void) { int retval; retval = bus_register(&i2c_bus_type); if (retval) { return(retval); } retval = driver_register(&i2c_adapter_driver); if (retval) { return(retval); } return(class_register(&i2c_adapter_class)); } static void __exit i2c_exit(void) { class_unregister(&i2c_adapter_class); driver_unregister(&i2c_adapter_driver); bus_unregister(&i2c_bus_type); } subsys_initcall(i2c_init); module_exit(i2c_exit); /* ---------------------------------------------------- * the functional interface to the i2c busses. * ---------------------------------------------------- */ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { int ret; if (adap->algo->master_xfer) { #ifdef DEBUG for (ret = 0; ret < num; ret++) { dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, " "len=%d\n", ret, msgs[ret].flags & I2C_M_RD ? 'R' : 'W', msgs[ret].addr, msgs[ret].len); } #endif down(&adap->bus_lock); ret = adap->algo->master_xfer(adap, msgs, num); up(&adap->bus_lock); return(ret); } else { dev_dbg(&adap->dev, "I2C level transfers not supported\n"); return(-ENOSYS); } } int i2c_master_send(struct i2c_client *client, const char *buf, int count) { int ret; struct i2c_adapter *adap = client->adapter; struct i2c_msg msg; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.len = count; msg.buf = (char *)buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes * transmitted, else error code. */ return((ret == 1) ? count : ret); } int i2c_master_recv(struct i2c_client *client, char *buf, int count) { struct i2c_adapter *adap = client->adapter; struct i2c_msg msg; int ret; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.flags |= I2C_M_RD; msg.len = count; msg.buf = buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes * transmitted, else error code. */ return((ret == 1) ? count : ret); } int i2c_control(struct i2c_client *client, unsigned int cmd, unsigned long arg) { int ret = 0; struct i2c_adapter *adap = client->adapter; dev_dbg(&client->adapter->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg); switch (cmd) { case I2C_RETRIES: adap->retries = arg; break; case I2C_TIMEOUT: adap->timeout = arg; break; default: if (adap->algo->algo_control != NULL) { ret = adap->algo->algo_control(adap, cmd, arg); } } return(ret); } /* ---------------------------------------------------- * the i2c address scanning function * Will not work for 10-bit addresses! * ---------------------------------------------------- */ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind, int (*found_proc)(struct i2c_adapter *, int, int)) { int err; /* Make sure the address is valid */ if (addr < 0x03 || addr > 0x77) { dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n", addr); return(-EINVAL); } /* Skip if already in use */ if (i2c_check_addr(adapter, addr)) { return(0); } /* Make sure there is something at this address, unless forced */ if (kind < 0) { if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0) { return(0); } /* prevent 24RF08 corruption */ if ((addr & ~0x0f) == 0x50) { i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL); } } /* Finally call the custom detection function */ err = found_proc(adapter, addr, kind); /* -ENODEV can be returned if there is a chip at the given address * but it isn't supported by this chip driver. We catch it here as * this isn't an error. */ return((err == -ENODEV) ? 0 : err); } int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data, int (*found_proc)(struct i2c_adapter *, int, int)) { int i, err; int adap_id = i2c_adapter_id(adapter); /* Forget it if we can't probe using SMBUS_QUICK */ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) { return(-1); } /* Force entries are done first, and are not affected by ignore * entries */ if (address_data->forces) { unsigned short **forces = address_data->forces; int kind; for (kind = 0; forces[kind]; kind++) { for (i = 0; forces[kind][i] != I2C_CLIENT_END; i += 2) { if (forces[kind][i] == adap_id || forces[kind][i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found force " "parameter for adapter %d, " "addr 0x%02x, kind %d\n", adap_id, forces[kind][i + 1], kind); err = i2c_probe_address(adapter, forces[kind][i + 1], kind, found_proc); if (err) { return(err); } } } } } /* Probe entries are done second, and are not affected by ignore * entries either */ for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { if (address_data->probe[i] == adap_id || address_data->probe[i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found probe parameter for " "adapter %d, addr 0x%02x\n", adap_id, address_data->probe[i + 1]); err = i2c_probe_address(adapter, address_data->probe[i + 1], -1, found_proc); if (err) { return(err); } } } /* Normal entries are done last, unless shadowed by an ignore entry */ for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { int j, ignore; ignore = 0; for (j = 0; address_data->ignore[j] != I2C_CLIENT_END; j += 2) { if ((address_data->ignore[j] == adap_id || address_data->ignore[j] == ANY_I2C_BUS) && address_data->ignore[j + 1] == address_data->normal_i2c[i]) { dev_dbg(&adapter->dev, "found ignore " "parameter for adapter %d, " "addr 0x%02x\n", adap_id, address_data->ignore[j + 1]); } ignore = 1; break; } if (ignore) { continue; } dev_dbg(&adapter->dev, "found normal entry for adapter %d, " "addr 0x%02x\n", adap_id, address_data->normal_i2c[i]); err = i2c_probe_address(adapter, address_data->normal_i2c[i], -1, found_proc); if (err) { return(err); } } return(0); } /* i2c_probe */ struct i2c_adapter *i2c_get_adapter(int id) { struct i2c_adapter *adapter; down(&core_lists); adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); if (adapter && !try_module_get(adapter->owner)) { adapter = NULL; } up(&core_lists); return(adapter); } void i2c_put_adapter(struct i2c_adapter *adap) { module_put(adap->owner); } /* The SMBus parts */ #define POLY (0x1070U << 3) static u8 crc8(u16 data) { int i; for (i = 0; i < 8; i++) { if (data & 0x8000) { data = data ^ POLY; } data = data << 1; } return((u8)(data >> 8)); } /* CRC over count bytes in the first array plus the bytes in the rest * array if it is non-null. rest[0] is the (length of rest) - 1 * and is included. */ static u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest) { int i; for (i = 0; i < count; i++) { crc = crc8((crc ^ first[i]) << 8); } if (rest != NULL) { for (i = 0; i <= rest[0]; i++) { crc = crc8((crc ^ rest[i]) << 8); } } return(crc); } static u8 i2c_smbus_pec(int count, u8 *first, u8 *rest) { return(i2c_smbus_partial_pec(0, count, first, rest)); } /* Returns new "size" (transaction type) * Note that we convert byte to byte_data and byte_data to word_data * rather than invent new xxx_PEC transactions. */ static int i2c_smbus_add_pec(u16 addr, u8 command, int size, union i2c_smbus_data *data) { u8 buf[3]; buf[0] = addr << 1; buf[1] = command; switch (size) { case I2C_SMBUS_BYTE: data->byte = i2c_smbus_pec(2, buf, NULL); size = I2C_SMBUS_BYTE_DATA; break; case I2C_SMBUS_BYTE_DATA: buf[2] = data->byte; data->word = buf[2] || (i2c_smbus_pec(3, buf, NULL) << 8); size = I2C_SMBUS_WORD_DATA; break; case I2C_SMBUS_WORD_DATA: /* unsupported */ break; case I2C_SMBUS_BLOCK_DATA: data->block[data->block[0] + 1] = i2c_smbus_pec(2, buf, data->block); size = I2C_SMBUS_BLOCK_DATA_PEC; break; } return(size); } static int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial, union i2c_smbus_data *data) { u8 buf[3], rpec, cpec; buf[1] = command; switch (size) { case I2C_SMBUS_BYTE_DATA: buf[0] = (addr << 1) | 1; cpec = i2c_smbus_pec(2, buf, NULL); rpec = data->byte; break; case I2C_SMBUS_WORD_DATA: buf[0] = (addr << 1) | 1; buf[2] = data->word & 0xff; cpec = i2c_smbus_pec(3, buf, NULL); rpec = data->word >> 8; break; case I2C_SMBUS_WORD_DATA_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_PROC_CALL_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_BLOCK_DATA_PEC: buf[0] = (addr << 1); buf[2] = (addr << 1) | 1; cpec = i2c_smbus_pec(3, buf, data->block); rpec = data->block[data->block[0] + 1]; break; case I2C_SMBUS_BLOCK_PROC_CALL_PEC: buf[0] = (addr << 1) | 1; rpec = i2c_smbus_partial_pec(partial, 1, buf, data->block); cpec = data->block[data->block[0] + 1]; break; default: cpec = rpec = 0; break; } /* switch */ if (rpec != cpec) { pr_debug("i2c-core: Bad PEC 0x%02x vs. 0x%02x\n", rpec, cpec); return(-1); } return(0); } /* i2c_smbus_check_pec */ s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) { return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, value, 0, I2C_SMBUS_QUICK, NULL)); } s32 i2c_smbus_read_byte(struct i2c_client *client) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data)) { return(-1); } else { return(0x0FF & data.byte); } } s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) { union i2c_smbus_data data; /* only for PEC */ return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, &data)); } s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_BYTE_DATA, &data)) { return(-1); } else { return(0x0FF & data.byte); } } s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) { union i2c_smbus_data data; data.byte = value; return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA, &data)); } s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_WORD_DATA, &data)) { return(-1); } else { return(0x0FFFF & data.word); } } s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) { union i2c_smbus_data data; data.word = value; return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_WORD_DATA, &data)); } s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, u8 length, u8 *values) { union i2c_smbus_data data; int i; if (length > I2C_SMBUS_BLOCK_MAX) { length = I2C_SMBUS_BLOCK_MAX; } for (i = 1; i <= length; i++) { data.block[i] = values[i - 1]; } data.block[0] = length; return(i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_BLOCK_DATA, &data)); } /* Returns the number of read bytes */ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) { union i2c_smbus_data data; int i; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA, &data)) { return(-1); } else { for (i = 1; i <= data.block[0]; i++) { values[i - 1] = data.block[i]; } return(data.block[0]); } } /* Simulate a SMBus command using the i2c protocol * No checking of parameters is done! */ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data) { /* So we need to generate a series of msgs. In the case of writing, we * need to use only one message; when reading, we need two. We initialize * most things with sane defaults, to keep the code below somewhat * simpler. */ unsigned char msgbuf0[34]; unsigned char msgbuf1[34]; int num = read_write == I2C_SMBUS_READ ? 2 : 1; struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, { addr, flags | I2C_M_RD, 0, msgbuf1 } }; int i; msgbuf0[0] = command; switch (size) { case I2C_SMBUS_QUICK: msg[0].len = 0; /* Special case: The read/write field is used as data */ msg[0].flags = flags | (read_write == I2C_SMBUS_READ) ? I2C_M_RD : 0; num = 1; break; case I2C_SMBUS_BYTE: if (read_write == I2C_SMBUS_READ) { /* Special case: only a read! */ msg[0].flags = I2C_M_RD | flags; num = 1; } break; case I2C_SMBUS_BYTE_DATA: if (read_write == I2C_SMBUS_READ) { msg[1].len = 1; } else { msg[0].len = 2; msgbuf0[1] = data->byte; } break; case I2C_SMBUS_WORD_DATA: if (read_write == I2C_SMBUS_READ) { msg[1].len = 2; } else { msg[0].len = 3; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; } break; case I2C_SMBUS_PROC_CALL: num = 2; /* Special case */ read_write = I2C_SMBUS_READ; msg[0].len = 3; msg[1].len = 2; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; break; case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA_PEC: if (read_write == I2C_SMBUS_READ) { dev_err(&adapter->dev, "Block read not supported " "under I2C emulation!\n"); return(-1); } else { msg[0].len = data->block[0] + 2; if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) { dev_err(&adapter->dev, "smbus_access called with " "invalid block write size (%d)\n", data->block[0]); return(-1); } if (size == I2C_SMBUS_BLOCK_DATA_PEC) { (msg[0].len)++; } for (i = 1; i <= msg[0].len; i++) { msgbuf0[i] = data->block[i - 1]; } } break; case I2C_SMBUS_BLOCK_PROC_CALL: case I2C_SMBUS_BLOCK_PROC_CALL_PEC: dev_dbg(&adapter->dev, "Block process call not supported " "under I2C emulation!\n"); return(-1); case I2C_SMBUS_I2C_BLOCK_DATA: if (read_write == I2C_SMBUS_READ) { msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; } else { msg[0].len = data->block[0] + 1; if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) { dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " "invalid block write size (%d)\n", data->block[0]); return(-1); } for (i = 1; i <= data->block[0]; i++) { msgbuf0[i] = data->block[i]; } } break; default: dev_err(&adapter->dev, "smbus_access called with invalid size (%d)\n", size); return(-1); } /* switch */ if (i2c_transfer(adapter, msg, num) < 0) { return(-1); } if (read_write == I2C_SMBUS_READ) { switch (size) { case I2C_SMBUS_BYTE: data->byte = msgbuf0[0]; break; case I2C_SMBUS_BYTE_DATA: data->byte = msgbuf1[0]; break; case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_PROC_CALL: data->word = msgbuf1[0] | (msgbuf1[1] << 8); break; case I2C_SMBUS_I2C_BLOCK_DATA: /* fixed at 32 for now */ data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX; for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++) { data->block[i + 1] = msgbuf1[i]; } break; } } return(0); } /* i2c_smbus_xfer_emulated */ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data) { s32 res; int swpec = 0; u8 partial = 0; flags &= I2C_M_TEN | I2C_CLIENT_PEC; if ((flags & I2C_CLIENT_PEC) && !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) { swpec = 1; if (read_write == I2C_SMBUS_READ && size == I2C_SMBUS_BLOCK_DATA) { size = I2C_SMBUS_BLOCK_DATA_PEC; } else if (size == I2C_SMBUS_PROC_CALL) { size = I2C_SMBUS_PROC_CALL_PEC; } else if (size == I2C_SMBUS_BLOCK_PROC_CALL) { i2c_smbus_add_pec(addr, command, I2C_SMBUS_BLOCK_DATA, data); partial = data->block[data->block[0] + 1]; size = I2C_SMBUS_BLOCK_PROC_CALL_PEC; } else if (read_write == I2C_SMBUS_WRITE && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA) { size = i2c_smbus_add_pec(addr, command, size, data); } } if (adapter->algo->smbus_xfer) { down(&adapter->bus_lock); res = adapter->algo->smbus_xfer(adapter, addr, flags, read_write, command, size, data); up(&adapter->bus_lock); } else { res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write, command, size, data); } if (res >= 0 && swpec && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA && (read_write == I2C_SMBUS_READ || size == I2C_SMBUS_PROC_CALL_PEC || size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) { if (i2c_smbus_check_pec(addr, command, size, partial, data)) { return(-1); } } return(res); } /* i2c_smbus_xfer */ /* Next four are needed by i2c-isa */ EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); EXPORT_SYMBOL_GPL(i2c_adapter_driver); EXPORT_SYMBOL_GPL(i2c_adapter_class); EXPORT_SYMBOL_GPL(i2c_bus_type); EXPORT_SYMBOL(i2c_add_adapter); EXPORT_SYMBOL(i2c_del_adapter); EXPORT_SYMBOL(i2c_add_driver); EXPORT_SYMBOL(i2c_del_driver); EXPORT_SYMBOL(i2c_attach_client); EXPORT_SYMBOL(i2c_detach_client); EXPORT_SYMBOL(i2c_use_client); EXPORT_SYMBOL(i2c_release_client); EXPORT_SYMBOL(i2c_clients_command); EXPORT_SYMBOL(i2c_check_addr); EXPORT_SYMBOL(i2c_master_send); EXPORT_SYMBOL(i2c_master_recv); EXPORT_SYMBOL(i2c_control); EXPORT_SYMBOL(i2c_transfer); EXPORT_SYMBOL(i2c_get_adapter); EXPORT_SYMBOL(i2c_put_adapter); EXPORT_SYMBOL(i2c_probe); EXPORT_SYMBOL(i2c_smbus_xfer); EXPORT_SYMBOL(i2c_smbus_write_quick); EXPORT_SYMBOL(i2c_smbus_read_byte); EXPORT_SYMBOL(i2c_smbus_write_byte); EXPORT_SYMBOL(i2c_smbus_read_byte_data); EXPORT_SYMBOL(i2c_smbus_write_byte_data); EXPORT_SYMBOL(i2c_smbus_read_word_data); EXPORT_SYMBOL(i2c_smbus_write_word_data); EXPORT_SYMBOL(i2c_smbus_write_block_data); EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); MODULE_AUTHOR("Simon G. Vogl "); MODULE_DESCRIPTION("I2C-Bus main module"); MODULE_LICENSE("GPL"); uncrustify-0.59/tests/output/c/00163-fcn_indent.c0000644000175000017500000000100411574754744016466 00000000000000int this_is_a_function_proto(int a, char * b); int this_is_a_function_def(int a, char * b) { this_is_a_function_call(a, b); a = another_function_call(a, b); } typedef short (*hello1)(char coolParam, ushort *, unsigned int anotherone); short (*hello2)(char coolParam, ulong *, uchar, unsigned int anotherone); short hello3 (char coolParam, ushort *, unsigned int anotherone); uncrustify-0.59/tests/output/c/00504-pos_compare.c0000644000175000017500000000025211574754744016671 00000000000000void foo(void) { if ((a_really_long_number > another_really_long_number) || (some_really_long_bool != another_really_long_bool)) { foo2(); } } uncrustify-0.59/tests/output/c/00160-fcn_indent.c0000644000175000017500000000067211574754744016475 00000000000000int this_is_a_function_proto(int a, char * b); int this_is_a_function_def(int a, char * b) { this_is_a_function_call(a, b); a = another_function_call(a, b); } typedef short (*hello1)(char coolParam, ushort *, unsigned int anotherone); short (*hello2)(char coolParam, ulong *, uchar, unsigned int anotherone); short hello3 (char coolParam, ushort *, unsigned int anotherone); uncrustify-0.59/tests/output/c/01022-kw_subst.c0000644000175000017500000000305211631037735016204 00000000000000/*******************************************************************************//** * * @file kw_subst.c * * * ***********************************************************************************/ #include /*********************************************************************************** * foo1 *******************************************************************************//** * * * * @return TODO * **********************************************************************************/ int foo1() { } /** header comment */ #if 2 int foo2(void) { } #endif #if 1 /*********************************************************************************** * foo3 *******************************************************************************//** * * * * @param a TODO * **********************************************************************************/ void foo3(int a) { } #endif /*********************************************************************************** * foo4 *******************************************************************************//** * * * * @param a TODO * @param b TODO * @param c TODO * @return TODO * **********************************************************************************/ void * foo4(int a, int b, int c) { } /** * CVS History: * $Log $ * */ uncrustify-0.59/tests/output/c/00600-dos.c0000644000175000017500000000100511574754744015141 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) { /* comment in virtual braces */ res += idx; } res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 return(res); } // col1 comment in level 0 /* Silly multiline comment. Oh yes. Really */ uncrustify-0.59/tests/output/c/00503-pos_compare.c0000644000175000017500000000025211574754744016670 00000000000000void foo(void) { if ((a_really_long_number > another_really_long_number) || (some_really_long_bool != another_really_long_bool)) { foo2(); } } uncrustify-0.59/tests/output/c/00060-braces-2.c0000644000175000017500000000025411574754744015757 00000000000000while (a >= 0) { if (b) { for (j = 0; j < 10; j++) { if (j == b) { return; } a++; } } b--; } uncrustify-0.59/tests/output/c/00101-bugs-1.c0000644000175000017500000000162511574754744015456 00000000000000int oldfoo(bar) char bar; { return(bar - 2); } int i2c_use_client(struct i2c_client *client) { int ret; ret = i2c_inc_use_client(client); if (ret) { return(ret); } if ((client->flags & I2C_CLIENT_ALLOW_USE) || (a && something_else)) { if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) { client->usage_count++; } else if (client->usage_count > 0) { goto busy; } else { client->usage_count++; } } return(0); busy: i2c_dec_use_client(client); return(-EBUSY); } void get_name(void) { a = (int)5; if (a) { if (b) { b--; } else { a++; } } for (a = 0; a < 10; a++) { if (b) { b--; } else { a++; } } return; } uncrustify-0.59/tests/output/c/00002-comment-indent.c0000644000175000017500000000117111574754744017275 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; /* trailing comment * that spans two lines */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; /* some comment */ /* almost continued, but a NL in between */ /* col1 comment in level 1 * second comment */ return(res); } /* col1 comment in level 0 * and another */ void foo() { if( bar ) { foo(); } /*else if( bar2 ) * { * foo2(); * } */else if( bar3 ) { foo3(); } } uncrustify-0.59/tests/output/c/00003-comment-indent.c0000644000175000017500000000126411574754744017301 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; /* * trailing comment * that spans two lines */ for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; /* some comment */ /* almost continued, but a NL in between */ /* * col1 comment in level 1 * second comment */ return(res); } /* * col1 comment in level 0 * and another */ void foo() { if( bar ) { foo(); } /*else if( bar2 ) * { * foo2(); * } */ else if( bar3 ) { foo3(); } } uncrustify-0.59/tests/output/c/00020-define-if-indent.c0000644000175000017500000000030711574754744017461 00000000000000 #define foobar(x) \ { \ for (i = 0; i < x; i++) \ { \ junk(i, x); \ } \ } uncrustify-0.59/tests/output/c/00430-paren-indent.c0000644000175000017500000000145111574754745016747 00000000000000static void *foo(int param1, char *param2 ); static void *foo ( int param1, char *param2 ) { for ( int i = 0; i< 10; i++ ) { bar( arg1, arg2 ); if ( ( abc < bcd ) &&( 123 < abc ) ) { none(arg1, arg2, arg3 ); } } } void CWarningAnalyzer::SetEffect(int FilterNumber ,bool Exclude , int Red , int Green , int Blue , bool Italic , bool Bold , bool Underlined ) { /* TODO */ } uncrustify-0.59/tests/output/c/00140-global-vars.c0000644000175000017500000000021211574754745016564 00000000000000 static int another_try; struct something yup; align_me_t please; const char *name = "hello"; static nothing really; uncrustify-0.59/tests/output/c/02452-nl_return_expr.c0000644000175000017500000000023511631561414017415 00000000000000 int foo1(void) { return NewClass(1); } int foo2(void) { return NewClass(2); } int foo3(void) { return 3; } int foo4(void) { return 4; } uncrustify-0.59/tests/output/c/00710-add_long_comment.c0000644000175000017500000000103311574754745017651 00000000000000/** * trailing comments are added at 8 newlines in this test. * * */ void short_function(void) { /* this is a 'short' function, so no added comment */ } void long_function(void) { /* this is a 'long' function, so a comment is added */ switch (some_int_value()) { case 0: handle_zero(); break; case 50: handle_fifty(); break; case 127: handle_another_value(); break; default: boy_do_i_lack_imagination(); break; } /* switch */ /* call one last function... */ one_last_func_call(); } /* long_function */ uncrustify-0.59/tests/output/c/00144-align-proto-vars.c0000644000175000017500000000036411574754745017573 00000000000000int doStuff(int i, float f); int doStuff(int i, float f); MACRO_MODIFIER int doStuff(int i, float f); typedef void (*my_callback)(int id, void *context); uncrustify-0.59/tests/output/c/02416-cmt_nl_end.c0000644000175000017500000000022311631561414016446 00000000000000int do_this ( int x, int y ) { x += y; // x = x + y if(x == 3) x++; // x plus 1 return (x) } uncrustify-0.59/tests/output/c/01012-semicolons.c0000644000175000017500000000145311574754745016535 00000000000000 int foo(int bar) { for ( ; ; ) { break; } if (a) { foo(); } if (b) { if (c) { bar(); } else { } } else { foo(); } switch (a) { case 1: break; case 2: break; default: break; } while (b-- > 0) { bar(); } do { bar(); } while (b-- > 0); } /* foo */ enum FPP { FPP_ONE = 1, FPP_TWO = 2, }; struct narg { int abc; char def; const char *ghi; }; void f2(void) { { i++; } for ( ; ; ) { } for ( ; ; ) { } } int main(int argc, char *argv[]) { if (argc == 1) { printf("one"); } else if (argc == 2) { printf("two"); } else { printf("%d", argc); } return(0); } uncrustify-0.59/tests/output/c/02501-custom_types_ssl.c0000644000175000017500000000556011631561414017767 00000000000000#ifndef HEADER_CONF_H #define HEADER_CONF_H #ifdef __cplusplus extern "C" { #endif /* ifdef __cplusplus */ typedef struct { char *section; char *name; char *value; } CONF_VALUE; DECLARE_STACK_OF(CONF_VALUE); DECLARE_LHASH_OF(CONF_VALUE); struct conf_st; struct conf_method_st; typedef struct conf_method_st CONF_METHOD; int CONF_set_default_method(CONF_METHOD *meth); void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, long *eline); #ifndef OPENSSL_NO_FP_API LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline); #endif /* ifndef OPENSSL_NO_FP_API */ LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline); STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, const char *section); char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, const char *name); long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, const char *name); void CONF_free(LHASH_OF(CONF_VALUE) *conf); int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); #ifdef __cplusplus } #endif /* ifdef __cplusplus */ void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash) { if (default_CONF_method == NULL) default_CONF_method = NCONF_default(); default_CONF_method->init(conf); conf->data = hash; } LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, long *eline) { LHASH_OF(CONF_VALUE) *ltmp; BIO *in = NULL; #ifdef OPENSSL_SYS_VMS in = BIO_new_file(file, "r"); #else /* ifdef OPENSSL_SYS_VMS */ in = BIO_new_file(file, "rb"); #endif /* ifdef OPENSSL_SYS_VMS */ if (in == NULL) { CONFerr(CONF_F_CONF_LOAD, ERR_R_SYS_LIB); return NULL; } return ltmp; } #ifndef OPENSSL_NO_FP_API LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, long *eline) { BIO *btmp; LHASH_OF(CONF_VALUE) *ltmp; if (!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { CONFerr(CONF_F_CONF_LOAD_FP, ERR_R_BUF_LIB); return NULL; } ltmp = CONF_load_bio(conf, btmp, eline); BIO_free(btmp); return ltmp; } #endif /* ifndef OPENSSL_NO_FP_API */ LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline) { CONF ctmp; int ret; CONF_set_nconf(&ctmp, conf); ret = NCONF_load_bio(&ctmp, bp, eline); if (ret) return ctmp.data; return NULL; } STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, const char *section) { if (conf == NULL) { return NULL; } else { CONF ctmp; CONF_set_nconf(&ctmp, conf); return NCONF_get_section(&ctmp, section); } } char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, const char *name) { if (conf == NULL) { return NCONF_get_string(NULL, group, name); } else { return NCONF_get_string(&ctmp, group, name); } } uncrustify-0.59/tests/output/c/01037-type_wrap.c0000644000175000017500000000007511574754745016402 00000000000000void foo(void) { STACK_OF(X509) *st = sk_X509_new_null(); } uncrustify-0.59/tests/output/c/00151-casts.c0000644000175000017500000000270111574754745015477 00000000000000 #define SOME_VAL1 ((MYINT)-1) #define SOME_VAL2 (-2) #define SOME_VAL3 -3 #define MULT(X, Y) (X)*(Y) #define SOME_JUNK /*lint -e123 */ (const mytype *)-1 typedef (*my_fcn_ptr_t)(char *, int); typedef (my_fcn_t)(char *, int); void foo(void) { uint crc = crc32_calc_full((const UINT8 *)"String", 6); crc = crc32_calc_full((const UINT8 *)&crc, sizeof(crc)); a = (b) - 4; a = (UINT)-4; a = (UINT)+4; a = (UINT) * 4; a = (UINT) & 4; a = (uint32_t)-pb; a = (uint32_t) + pb; a = (uint32_t)*pb; a = (uint32_t)&pb; a = (Uint) - 4; a = (Uint) + 4; a = (Uint) * 4; a = (Uint) & 4; a = b * (int)flt; a = b * ((int)flt); a = b * (int)flt; a = b * (INT8)flt; a = b * (Uint)flt; a = *(int)&b; a = *(CHAR)&b; a = *(Uint) & b; a = (int)*pb; a = (CHAR)*pb; a = (Uint) * pb; a = (int)'a'; a = (UINT8)'a'; a = (Uint)'a'; a = (int)*'a'; a = (UINT8) * 'a'; a = (Uint) * 'a'; a = (int)*5; a = (UINT) * 5; a = (Uint) * 5; a = (int)*ape; a = (UINT)*ape; a = (Uint) * ape; a = (int)ape; a = (UINT)ape; a = (Uint)ape; a = (int)sizeof(x); a = (INT16)sizeof(x); a = (Uint)sizeof(x); a = (int)foo(x); a = (CHAR)foo(x); a = (Uint)foo(x); a = (int)(x); a = (CHAR)(x); a = (Uint)(x); a = (int)*(x); a = (CHAR)*(x); a = (Uint) * (x); a = (unsigned int)(1 + 4); a = (int)(1 + 1); a = (void *)(&str); } uncrustify-0.59/tests/output/c/00108-bugs-8.c0000644000175000017500000000012511574754745015467 00000000000000 void foo(void) { p[0].x = x + (rx * cos(rs)); p[0].y = y - (ry * sin(rs)); } uncrustify-0.59/tests/output/c/02200-xml.c0000644000175000017500000000031711631561414015137 00000000000000void foo(void) { const char *a = "" "" "" "" ""; } uncrustify-0.59/tests/output/c/02101-comment-indent.c0000644000175000017500000000104511631561414017257 00000000000000/** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 // second comment return res; } // col1 comment in level 0 // and another void foo() { if (bar) foo(); /*else if( bar2 ) { foo2(); } */else if (bar3) foo3(); } uncrustify-0.59/tests/output/c/01035-func_wrap.c0000644000175000017500000000005311574754745016346 00000000000000 void FSUB(MPI_Foo)(MPI_Fint* sendcount); uncrustify-0.59/tests/output/c/02415-endif.c0000644000175000017500000000052011631561414015430 00000000000000int do_this ( int x, int y ) { x++; #ifdef ABC #ifdef DEF x += y; #endif #endif a++; #ifdef ABC b++; #ifdef DEF c++; #ifdef HIJ d++; #endif e++; #endif f++; #endif g++; return (x) } uncrustify-0.59/tests/output/c/02453-nl_return_expr.c0000644000175000017500000000027511631561414017422 00000000000000 int foo1(void) { return NewClass(1); } int foo2(void) { return NewClass(2); } int foo3(void) { return 3; } int foo4(void) { return 4; } uncrustify-0.59/tests/output/c/00621-nl_endif.c0000644000175000017500000000020711574754745016141 00000000000000int main ( ) { #ifdef useJPLvelocity for(i = 0; i < x; i++) y++; #endif return (0); } /* main */ uncrustify-0.59/tests/output/c/00120-sp_cmt_cpp_start.c0000644000175000017500000000005511574754745017722 00000000000000 //zero //one //two //three void foo(void); uncrustify-0.59/tests/output/c/00106-bugs-6.c0000644000175000017500000000055611574754745015473 00000000000000/*=-------------------------------------------------------------------------=*\ * | FUNCTION NAME: mult2 | | DESCRIPTION: | Multiplies a number by two. | | INPUTS/OUTPUTS: | val - the number to double | | RETURNS: | val * 2 * \*=-------------------------------------------------------------------------=*/ int mult2(int val) { return(val * 2); } uncrustify-0.59/tests/output/c/00062-braces-4.c0000644000175000017500000000026311574754745015764 00000000000000int foo(int bar) { #ifndef CONFIG_1 bar -= 3; #else for (j = 0; j < NR_CPUS; j++) { if (cpu_online(j)) { bar++; } } #endif return(0); } uncrustify-0.59/tests/output/c/01020-kw_subst.c0000644000175000017500000000073711574754745016226 00000000000000/** * @file kw_subst.c * Description * * $Id$ */ #include /** * foo1 * TODO: DESCRIPTION * @return TODO */ int foo1() { } /** header comment */ #if 2 /** * foo2 * TODO: DESCRIPTION * @return TODO */ int foo2(void) { } #endif #if 1 /** * foo3 * TODO: DESCRIPTION * @param a TODO */ void foo3(int a) { } #endif /** * foo4 * TODO: DESCRIPTION * @param a TODO * @param b TODO * @param c TODO * @return TODO */ void *foo4(int a, int b, int c) { } uncrustify-0.59/tests/output/c/00802-funcfunc.c0000644000175000017500000000016211574754745016173 00000000000000int main() { mWriter("class Clst_"c) (cluster.getChild(HO_SHORT_NAME).getText()) (" : Cluster {"c).newline; } uncrustify-0.59/tests/output/c/01040-newline_after_endif.c0000644000175000017500000000112111574754745020342 00000000000000int main ( ) { #ifdef useJPLvelocity for(i = 0; i < x; i++) y++; #endif return (0); } /* main */ int main ( ) { if(y < 3) y++; #ifdef ABC if(y < 3) y++ // comment #endif if(y < 3) y++; y++; return (0); } /* main */ int main ( ) { #ifdef ABC if(j < y) { if(j < x) { j++; #ifdef XYZ if(j < x) j++; #endif } } #endif return (0); } /* main */ uncrustify-0.59/tests/output/c/00703-function-def.c0000644000175000017500000000057311574754745016753 00000000000000void foo1(int param1, int param2, char *param2); void foo2(int param1,int param2,char *param2); void foo3(int param1,int param2,char *param2); struct whoopee *foo4(int param1, int param2, char *param2); const struct snickers *foo5(int param1, int param2, char *param2); void foo(int param1, int param2, char *param2) { printf("boo!\n"); } EXPORT int DoStuff(int Num); uncrustify-0.59/tests/output/c/00310-sp_embed_comment.c0000644000175000017500000000012111574754745017651 00000000000000void f(); void g(int); void h() { f(/*foo*/); g(42 /*foo*/); g(/*foo*/ 42); } uncrustify-0.59/tests/output/c/00203-case.c0000644000175000017500000000146111574754745015275 00000000000000void foo(void) { switch(ch) { // handle 'a' case 'a': { handle_a(); multiline(123, 345); break; } // handle 'b' case 'b': handle_b(); multiline(123, 345); break; // handle 'c' and 'd' case 'c': case 'd': // c and d are really the same thing handle_cd(); multiline(123, 345); break; case 'e': { handle_a(); multiline(123, 345); } break; // case1 case (case1): { //do stuff break; } case (case2): { //do stuff break; } case (case3): /*do stuff*/ break; case (case3): statement(); { another_statement(); } break; // really should not get here default: handle_default(); multiline(123, 345); break; } multiline(123, 345); } uncrustify-0.59/tests/output/c/00304-one-liner-init.c0000644000175000017500000000046411574754745017217 00000000000000enum boo { FOO = 1 }; void foo(void) { char str[123] = { 0 }; enum hoo { NOO = 1 }; strcat(str, "foo"); } void f() { if (bar()) { baz(1); } else { baz(2); } } int foo() { return(0); } void foo(int a, int b) { if (a == b) { a++; } else { b++; } if (a == b) { a++; } else { b++; } } uncrustify-0.59/tests/output/c/00702-function-def.c0000644000175000017500000000064711574754745016754 00000000000000void foo1(int param1, int param2, char *param2); void foo2(int param1, int param2, char *param2); void foo3(int param1, int param2, char *param2); struct whoopee *foo4(int param1, int param2, char *param2); const struct snickers *foo5(int param1, int param2, char *param2); void foo(int param1, int param2, char *param2) { printf("boo!\n"); } EXPORT int DoStuff(int Num); uncrustify-0.59/tests/output/c/00070-return-multi.c0000644000175000017500000000163611574754745017037 00000000000000 static inline long get_tv32(struct timeval *o, struct timeval32 __user *i) { return(!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec))); } static inline long get_tv32(struct timeval *o, struct timeval32 __user *i) { return(!access_ok(VERIFY_READ, i, sizeof(*i)) || (__get_user(o->tv_sec, &i->tv_sec) | __get_user(o->tv_usec, &i->tv_usec))); } const char * dcrp_license_feature(int32_t idx) { #define FEATURESTR(f) \ case DCRMIB_LICENSE_ ## f: \ return DCRP_LICENSE_FEATURE_ ## f ## _STR switch (idx) { DCRP_LICENSE_FOREACH_FEATURES(FEATURESTR); } return(""); } static int isValidLicenseType(int32_t idx) { #define CHECKFEATURE(f) \ case DCRMIB_LICENSE_ ## f: \ return 1 switch (idx) { DCRP_LICENSE_FOREACH_FEATURES(CHECKFEATURE); } return(n * foo(5)); } uncrustify-0.59/tests/output/cpp/0000755000175000017500000000000011631561151014147 500000000000000uncrustify-0.59/tests/output/cpp/30922-variadic-template.h0000644000175000017500000000070111506773275020323 00000000000000template struct __index_holder_impl<__i, __index_holder<_Indexes ...>, _IdxHolder, _Elements ...> { typedef typename __index_holder_impl<__i + 1, __index_holder<_Indexes ..., __i>, _Elements ...>::type type; }; uncrustify-0.59/tests/output/cpp/30102-templates.cpp0000644000175000017500000000622511506773275017256 00000000000000#include #include #include #define MACRO(T) f < T > () class MyClass { public: std::map < int, bool > someData; std::map < int, std::list < bool > > otherData; }; void foo() { List < byte > bob = new List < byte > (); } A < B > foo; A < B,C > bar; A < B* > baz; A < B < C > > bay; void asd(void) { A < B > foo; A < B,C > bar; A < B* > baz; A < B < C > > bay; if (ac) { a = b0; } if (a < bar() > c) { } ac] = d; } template< typename T > class MyClass { } template< typename T > class MyClass { } template< typename A, typename B, typename C > class MyClass : myvar(0), myvar2(0) { } template< typename A, typename B, typename C > class MyClass : myvar(0), myvar2(0) { } static int max_value() { return (std :: numeric_limits < int >:: max )(); } template< class Config_ > priority_queue < Config_ > :: ~priority_queue () { } template< class T > T test(T a) { return a; } int main() { int k,j; h g < int >; k=test < int > (j); return 0; } template< typename T, template< typename, unsigned int, unsigned int > class ConcreteStorageClass > class RotationMatrix : public StaticBaseMatrix < T, 3, 3, ConcreteStorageClass > { public: RotationMatrix() : StaticBaseMatrix < T, 3, 3, ConcreteStorageClass > () { // do some initialization } void assign(const OtherClass < T, 3, 3 >& other) { // do something } }; int main() { MyClass < double, 3, 3, MyStorage > foo; } template< typename CharT, int N, typename Traits > inline std::basic_ostream < CharT,Traits >& FWStreamOut(std::basic_ostream < CharT,Traits >& os, const W::S < CharT,N,Traits >& s) { return operator << < CharT, N, Traits, char, std::char_traits < char > > ( os, s ); } struct foo { type1 < int& > bar; }; struct foo { type1 < int const > bar; }; template< int i > void f(); template< int i > void g() { f < i - 1 > (); f < i > (); f < i + 1 > (); f < bar() > (); } void h() { g < 42 > (); } #include std::vector < int > A(2); std::vector < int > B; std::vector < int > C(2); std::vector < int > D; template< class T > struct X { template< class U > void operator ()(U); }; template< class T > class Y { template< class V > void f(V); }; void (* foobar)(void) = NULL; std::vector < void (*)(void) > functions; #define MACRO( a ) a template< typename = int > class X; MACRO ( void f( X < >& x ) ); void g( X < >& x ); #include typedef std::vector < std::vector < int > > Table; // OK typedef std::vector < std::vector < bool > > Flags; // Error void func(List < B > = default_val1); void func(List < List < B > > = default_val2); BLAH < (3.14>=42) > blah; void foo() { A < (X>Y) > a; a = static_cast < List < B > > (ld); } template< int i > class X { /* ... */ }; X<1>2>x1; // Syntax error. X < (1>2) > x2; // Okay. template< class T > class Y { /* ... */ }; Y < X < 1 > > x3; // Okay, same as "Y > x3;". Y >1 >> x4; // Syntax error. Instead, write "Y>1)>> x4;". Y < X < (6 >> 1) > > x4; uncrustify-0.59/tests/output/cpp/30045-nl_func_decl.cpp0000644000175000017500000000031611506773275017674 00000000000000 void bla ( ); void ble( int a, char b ); void ble2 ( int a, char b ); void bla ( ) { } void bla2 ( ) { } void ble ( int a, char b ) { } void ble2 ( int a, char b ) { } uncrustify-0.59/tests/output/cpp/30720-custom-open-2.cpp0000644000175000017500000000143711506773275017676 00000000000000 BEGIN_MESSAGE_MAP(CUSB2_camera_developementDlg, CDialog) ON_COMMAND(IDC_ESCAPE, On_Escape) ON_COMMAND(IDC_8_BIT, On_8_Bit) ON_COMMAND(IDC_14_BIT, On_14_Bit) ON_COMMAND(IDC_ACQUIRE, On_Acquire) ON_COMMAND(IDC_SAVE_COLUMN_AVERAGES, On_Save_Column_Averages) ON_COMMAND(IDC_SAVE_ROW_AVERAGES, On_Save_Row_Averages) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_WM_CTLCOLOR() END_MESSAGE_MAP() namespace one { namespace two { int Func(int a, int b) { return a + b; } } } using namespace one::two; void Func2(int c, int d) { } int main() { int a; switch (a) { case 0: Func2(1, Func(1, 2)); Func2(1, one::two::Func(1, 2)); break; } } uncrustify-0.59/tests/output/cpp/30924-sp_before_ellipsis.cpp0000644000175000017500000000045211506773275021140 00000000000000 void log_fmt( log_sev_t sev, const char *fmt, ... ) __attribute__(( format( printf, 2, 3 ))); #define LOG_FMT( sev, args... ) \ do { if ( log_sev_on( sev )) { log_fmt( sev, ## args ); } } while ( 0 ) #endif void foo() { try {} catch ( ... ) // <== HERE {} } uncrustify-0.59/tests/output/cpp/30820-pp-define-indent.cpp0000644000175000017500000000077211506773275020416 00000000000000 #define outpsize #define some(f) \ foo(f) class CRC { public: int foo; // Initial CRC Start Value #define 24BITCRC ((ULONG) 0x00864CFB) // This line is not aligned with the other lines char ch; #define MULTI LINE DEFINE \ in column 0 \ that spans //// Operations //// public: ... } { #if defined(WIN32) SYSTEMTIME st; DWORD ThreadId; #else struct timeval mytv; struct tm *mytm; pid_t ProcessId; #endif #if SOME COND (void)loop; #endif } uncrustify-0.59/tests/output/cpp/30811-misc3.cpp0000644000175000017500000000141311631041564016263 00000000000000// When constructing an object there should not be any space between the & and the variable name: MyClass my1(foo, &bar); MyClass my2(foo, bar); MyClass my3(foo, bar + 3); MyClass my4(42); MyClass my5(foo(), bar); MyClass my6(int foo, int& bar); MyClass my7(const int foo, int& bar); //When using references inside of casts there is also an additional space after the &: MyClass& myInst = static_cast(otherInst); // When using the qt-specific signals and slots the pointer star is separated from the type with a space: connect(&mapper, SIGNAL(mapped(QWidget*)), this, SLOT(onSomeEvent(QWidget*))); extern int select(int __nfds, fd_set* __restrict __readfds, fd_set* __restrict __writefds, fd_set* __restrict __exceptfds, struct timeval* __restrict __timeout); uncrustify-0.59/tests/output/cpp/30040-nl-class.h0000644000175000017500000000121511506773275016434 00000000000000#ifndef NL_CLASS_H_INCLUDED #define NL_CLASS_H_INCLUDED #include namespace example { class IStreamable; class InStream; class OutStream; /** * Timestamp is a timestamp with nanosecond resolution. */ class Inher : public IStreamable { public: Inher(); virtual ~Inher(); }; /** * Timestamp is a timestamp with nanosecond resolution. */ class Inher2 : public IStreamable { public: Inher2(); Inher2(long sec, unsigned long nsec); }; class Simple { public: Simple(); virtual ~Simple(); }; class Simple2 { public: Simple2(); virtual ~Simple2(); }; } // namespace #endif // NL_CLASS_H_INCLUDED uncrustify-0.59/tests/output/cpp/30031-operator.cpp0000644000175000017500000000320711576727500017106 00000000000000struct bar; struct foo { operator bar*(); }; class Foo { Foo operator+(const Foo& rhs) const; const Foo& operator ==(Foo& me); bool operator>(const Foo& rhs) const; InStream& operator <<(InStream& in); } const Foo& Foo::operator ==(Foo& me) { } Foo Foo::operator+(const Foo& rhs) const { } bool Foo::operator>(const Foo& rhs) const { } class Example { char m_array [256]; Example& operator=(const Example&rhs); Example& operator+=(const Example&rhs); const Example operator+(const Example&other) const; bool operator==(const Example&other) const; bool operator!=(const Example&other) const; Example operator+(const Example& x, const Example& y); Example operator*(const Example& x, const Example& y); double& operator()(int row, int col); double operator()(int row, int col) const; void operator++(); int& operator*(); Example& operator++(); // prefix ++ Example operator++(int); // postfix ++ bool operator <(const Example& lhs, const Example& rhs) const; int operator()(int index) { i = ~~3; return index + 1; } char& operator[](unsigned i) { return m_array [i & 0xff]; } } bool Example::operator==(const Example&other) const { /*TODO: compare something? */ return false; } bool Example::operator!=(const Example&other) const { return !operator ==(other); } void a() { Op op = &X::operator==; if (!A) { if (op != &X::operator==) { A(1) = a; } } if (!A) { if (op != &X::operator==) { A(1) = a; } } } void *operator new(std::size_t) throw(std::bad_alloc); void *operator new[](std::size_t) throw(std::bad_alloc); void operator delete(void *) throw(); void operator delete[](void *) throw(); uncrustify-0.59/tests/output/cpp/30021-byref.cpp0000644000175000017500000000114611506773275016364 00000000000000bool foo(int& idx) { if (idx < m_count) { idx++; return(m_bool[idx - 1]); } return(false); } class Foo { public: Foo(); Foo(const Foo& f); }; class NS::Foo { public: Foo(Bar& b); }; template class ListManager { protected: T head; public: ListManager() { head.next = head.prev = &head; } ListManager(const ListManager& ref) { head.next = head.prev = &head; } } const Foo& Foo::operator ==(Foo& me) { ::sockaddr *ptr = (::sockaddr *)&host; return(me); } MyType& MyClass::myMethode() { const MyType& t = getSomewhere(); } uncrustify-0.59/tests/output/cpp/30030-Timestamp.h0000644000175000017500000000573011631041564016654 00000000000000/** * @file Timestamp.h * Definition of class example::Timestamp. */ #ifndef __Timestamp_h_ #define __Timestamp_h_ #include namespace example { class IStreamable; class InStream; class OutStream; /** * Timestamp is a timestamp with nanosecond resolution. */ class Timestamp : public IStreamable { public: /** * Default constructor. */ Timestamp(); /** * Constructor. * * @param sec The seconds * @param nsec The nanoseconds */ Timestamp(long sec, unsigned long nsec); /** * Destructor. */ virtual ~Timestamp(); /** * Adds two timestamps. * * @param rhs The other timestamp * @return The resulting timestamp */ Timestamp operator+(const Timestamp& rhs) const; /** * Substracts two timestamps. * * @param rhs The other timestamp * @return The resulting timestamp */ Timestamp operator-(const Timestamp& rhs) const; /** * Compares two timestamps. * * @param rhs The other timestamp * @return true if timestamp is smaller than the given timestamp */ bool operator<(const Timestamp& rhs) const; /** * Compares two timestamps. * * @param rhs The other timestamp * @return true if timestamp is greater than the given timestamp */ bool operator>(const Timestamp& rhs) const; /** * Compares two timestamps. * * @param rhs The other timestamp * @return true if timestamp is equal to the given timestamp */ bool operator==(const Timestamp& rhs) const; /** * Compares two timestamps. * * @param rhs The other timestamp * @return true if timestamp is not equal to the given timestamp */ bool operator!=(const Timestamp& rhs) const; /** * Adds an other timestamp. * * @param rhs The other timestamp */ void operator+=(const Timestamp& rhs); /** * Adds milliseconds. * * @param ms The milliseconds * @return The resulting timestamp */ Timestamp addMilliseconds(unsigned long ms) const; /** * Adds nanoseconds. * * @param ns The nanoseconds * @return The resulting timestamp */ Timestamp addNanoseconds(unsigned long ns) const; /** * Checks if this timestamp is zero. * * @return true if timestamp is zero */ bool isZero() const; /** * Gets the milliseconds. * @attention Negativ timestamp return zero * * @return The milliseconds */ unsigned long getMilliseconds() const; /** * Divide timestamps by two. * * @return The resulting timestamp */ Timestamp divideByTwo(); /** * Gets the string-representation. * * @return The string representation */ std::string getString() const; /** * Gets the string-representation in milliseconds. * * @return The string representation */ std::string getStringMilliseconds() const; /** * Resets the timestamp. */ void reset(); /** The seconds */ long sec; /** The nanoseconds */ unsigned long nsec; InStream& operator <<(InStream& in); OutStream& operator >>(OutStream& out) const; }; } // namespace #endif // __Timestamp_h_ uncrustify-0.59/tests/output/cpp/30920-indent-off.cpp0000644000175000017500000000046411506773275017320 00000000000000struct X { void operator-(int); void operator+(int); void operator()(); }; /* *INDENT-OFF* */ struct Y { void operator-(int){} void operator+(int){} \ void operator()(){} }; /* *INDENT-ON* */ struct Y { void operator-(int){} void operator+(int){} void operator()(){} }; uncrustify-0.59/tests/output/cpp/30070-nl_func_scope_name.cpp0000644000175000017500000000002111506773275021065 00000000000000void A:: f() { } uncrustify-0.59/tests/output/cpp/30903-region.cpp0000644000175000017500000000040411506773275016545 00000000000000class X : Y { int foo1; #pragma region something int foo2 = 2; #pragma endregion int foo() { #pragma region something else int foo3 = 3; #pragma region nested int foo4 = 0; #pragma endregion int foo5 = 0; #pragma endregion } } uncrustify-0.59/tests/output/cpp/30025-class-init.cpp0000644000175000017500000000142411506773275017326 00000000000000 class Foo : public Bar { }; #define CTOR(i, _) : \ T(X()), \ y() \ { } class Foo2 : public Bar { }; class GLOX_API ClientBase : public Class, public OtherClass, public ThridClass, public ForthClass { public: ClientBase(const ClientBase & f) { // do something } }; ClientBase::ClientBase (const std::string& ns, const std::string& ns1, const std::string& ns2) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } uncrustify-0.59/tests/output/cpp/30703-function-def.cpp0000644000175000017500000000163411506773275017647 00000000000000int &Function() { static int x; return (x); } void foo1(int param1, int param2, char *param2); void foo2(int param1,int param2,char *param2); void foo3(int param1,int param2, // comment char *param2); struct whoopee *foo4(int param1, int param2, char *param2 /* comment */); const struct snickers *foo5(int param1, int param2, char *param2); void foo(int param1, int param2, char *param2) { printf("boo!\n"); } int classname::method(); int classname::method() { foo(); } int classname::method2(); int classname::method2() { foo2(); } const int& className::method1(void) const { // stuff } const longtypename& className::method2(void) const { // stuff } int &foo(); int &foo() { list_for_each(a,b) { bar(a); } return nuts; } void Foo::bar() { } Foo::Foo() { } Foo::~Foo() { } void func(void) { Directory dir("arg"); } uncrustify-0.59/tests/output/cpp/30270-const_throw.cpp0000644000175000017500000000033011506773275017626 00000000000000void GetFoo(void) const { return (m_Foo); } int GetFoo(void) throw (std::bad_alloc) { return (m_Foo); } uncrustify-0.59/tests/output/cpp/30056-nl_func.cpp0000644000175000017500000000051511506773275016710 00000000000000class BSRRE1D_file : PhysicalFile { int getFoo() { return(m_foo); } void setFoo(int foo) { m_foo = foo; } public BSRRE1D_file() { this.addFormatName("BSRRE1DF"); } private int m_foo; public void xxx() { ahoj(); } // comment public void yyy() { ahoj(); } /* comment 2 */ public void xxx() { ahoj(); } } uncrustify-0.59/tests/output/cpp/30900-region.cpp0000644000175000017500000000041211506773275016541 00000000000000class X : Y { int foo1; #pragma region something int foo2 = 2; #pragma endregion int foo() { #pragma region something else int foo3 = 3; #pragma region nested int foo4 = 0; #pragma endregion int foo5 = 0; #pragma endregion } } uncrustify-0.59/tests/output/cpp/30901-region.cpp0000644000175000017500000000043011506773275016542 00000000000000class X : Y { int foo1; #pragma region something int foo2 = 2; #pragma endregion int foo() { #pragma region something else int foo3 = 3; #pragma region nested int foo4 = 0; #pragma endregion int foo5 = 0; #pragma endregion } } uncrustify-0.59/tests/output/cpp/30064-class-init.cpp0000644000175000017500000000153511506773275017334 00000000000000 class Foo : public Bar { }; #define CTOR( i, _ ) \ : T( X()), \ y() \ { } class Foo2 : public Bar { }; class GLOX_API ClientBase : public Class, public OtherClass, public ThridClass, public ForthClass { public: ClientBase( const ClientBase & f ){ // do something } }; ClientBase::ClientBase ( const std::string& ns, const std::string& ns1, const std::string& ns2 ) { } Foo::Foo( int bar ) : someVar( bar ), othervar( 0 ) { } Foo::Foo( int bar ) : someVar( bar ), othervar( 0 ) { } Foo::Foo( int bar ) : someVar( bar ), othervar( 0 ) { } Foo::Foo( int bar ) : someVar( bar ), othervar( 0 ) { } Foo::Foo( int bar ) : someVar( bar ), othervar( 0 ) { } Foo::Foo( int bar ) : someVar( bar ), othervar( 0 ) { } uncrustify-0.59/tests/output/cpp/30936-indent_braces_no.h0000644000175000017500000000027011506773275020232 00000000000000class MyClass { public: struct something { int one; int two; } MyClass() { } void oneFunction() { if (1 == 0) { instructions; } } }; uncrustify-0.59/tests/output/cpp/30035-operator_proto.cpp0000644000175000017500000000664111576727500020342 00000000000000/* A collection of all the different known operator prototypes in C++ */ // arithmetic operators Type1 operator+(const Type1& a); // +a Type1 operator+(const Type1& a, const Type2& b); // a + b Type1& operator++(Type1& a); // ++a Type1 operator++(Type1& a, int); // a++ Type1& operator+=(Type1& a, const Type1& b); // a += b Type1 operator-(const Type1& a); // -a Type1& operator--(Type1& a); // --a Type1 operator--(Type1& a, int); // a-- Type1& operator-=(Type1& a, const Type1& b); // a -= b Type1 operator*(const Type1& a, const Type1& b); // a * b Type1& operator*=(Type1& a, const Type1& b); // a *= b Type1 operator/(const Type1& a, const Type1& b); // a / b Type1& operator/=(Type1& a, const Type1& b); // a /= b Type1 operator%(const Type1& a, const Type1& b); // a % b Type1& operator%=(Type1& a, const Type1& b); // a %= b // comparison operators bool operator<(const Type1& a, const Type1& b); // a < b bool operator<=(const Type1& a, const Type1& b); // a <= b bool operator>(const Type1& a, const Type1& b); // a > b bool operator>=(const Type1& a, const Type1& b); // a >= b bool operator!=(const Type1& a, const Type1& b); // a != b bool operator==(const Type1& a, const Type1& b); // a == b // logical operators bool operator!(const Type1& a); // !a bool operator&&(const Type1& a, const Type1& b); // a && b bool operator||(const Type1& a, const Type1& b); // a || b // bitwise operators Type1 operator<<(const Type1& a, const Type1& b); // a << b Type1& operator<<=(Type1& a, const Type1& b); // a <<= b Type1 operator>>(const Type1& a, const Type1& b); // a >> b Type1& operator>>=(Type1& a, const Type1& b); // a >>= b Type1 operator~(const Type1& a); // ~a Type1 operator&(const Type1& a, const Type1& b); // a & b Type1& operator&=(Type1& a, const Type1& b); // a &= b Type1 operator|(const Type1& a, const Type1& b); // a | b Type1& operator|=(Type1& a, const Type1& b); // a |= b Type1 operator^(const Type1& a, const Type1& b); // a ^ b Type1& operator^=(Type1& a, const Type1& b); // a ^= b // other operators Type1& Type1::operator=(const Type1& b); // a = b void operator()(Type1& a); // a() const Type2& operator[](const Type1& a, const Type1& b); // a[b] Type2& operator*(const Type1& a); // *a Type2* operator&(const Type1& a); // &a Type2* Type1::operator->(); // a->b Type1::operator type(); // (type)a Type2& operator,(const Type1& a, Type2& b); // a, b void *Type1::operator new(size_t x); // new Type1 void *Type1::operator new[](size_t x); // new Type1[n] void *Type1::operator delete(size_t x); // delete a void *Type1::operator delete[](size_t x); // delete [] a // Misc examples int& operator*(); Foo::operator const char *(); Foo::operator const Bar&(); uncrustify-0.59/tests/output/cpp/30741-al.cpp0000644000175000017500000000171311506773275015662 00000000000000/* ctest4 */ fm_status fm2000EventHandlingInitialize(fm_int sw); fm_status fm2000MacTableOverflowStart(fm_int sw); fm_bool fm2000ProcessMATableEntry(fm_mac_table_work_list *pWork, fm_int sw, fm_int index, fm_thread * event_handler, fm_uint32 * numUpdates, fm_event ** event); void foo() { Logger log = new Logger(); Logger log = new Logger(); log.foo.bar = 5; log.narf.sweat = "cat"; for (i = 0 ; i < 5 ; i++) { bar(i); } } /* foo */ int this_works(int x); int bug(int); /* BUG: left-aligned */ typedef int fooman; enum FLAGS { FLAGS_decimal = 1, /* decimal */ FLAGS_unsigned = 2, /* u or U suffix */ FLAGS_long = 4, /* l or L suffix */ }; uncrustify-0.59/tests/output/cpp/30052-try-catch-nl.cpp0000644000175000017500000000027511506773275017570 00000000000000int foo() { try { foo(bar); } catch (int *e) { return 0; } if (false) try { throw int(); } catch(...) { } if (a) { return 1; } else { return 0; } return 1; } uncrustify-0.59/tests/output/cpp/30731-qt-1.cpp0000644000175000017500000000101311630461311016017 00000000000000class Foo : public QObject { Q_OBJECT private slots: void mySlot(); public slots: void publicSlot(); signals: void somesignal(); }; class foo { bool b; public: int i; }; class bar : public foo { void*p; protected: double d; }; class Foo1 : public QObject { Q_OBJECT private Q_SLOTS: void mySlot(); public Q_SLOTS: void publicSlot(); Q_SIGNALS: void somesignal(); }; class foo1 { bool b; public: int i; }; class bar : public foo1 { void*p; protected: double d; }; uncrustify-0.59/tests/output/cpp/30063-class-init.cpp0000644000175000017500000000142311506773275017327 00000000000000 class Foo : public Bar { }; #define CTOR(i, _) : \ T(X()), \ y() \ { } class Foo2 : public Bar { }; class GLOX_API ClientBase : public Class, public OtherClass, public ThridClass, public ForthClass { public: ClientBase(const ClientBase & f){ // do something } }; ClientBase::ClientBase (const std::string& ns, const std::string& ns1, const std::string& ns2) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } uncrustify-0.59/tests/output/cpp/30022-extern_c.h0000644000175000017500000000126611506773275016535 00000000000000#ifndef cRecordMarking_HEADER #define cRecordMarking_HEADER #include "DIS/cPduSnapshot.h" typedef void * disConnectionH; #ifdef __cplusplus extern "C" { #endif disConnectionH createDisConnection(); void setAddressAndPort_DisConnect(disConnectionH record, const char *addr); /* Open network connection */ int open_DisConnect(disConnectionH record); /* Close network connection */ void close_DisConnect(disConnectionH record); /* Send one pdu */ int sendPdu_DisConnect(disConnectionH record, pduSnapshotH pdu); /* Receive one pdu */ int recvPdu_DisConnect(disConnectionH record, pduSnapshotH pdu); void FreeDisConnection(disConnectionH connection); #ifdef __cplusplus } #endif #endif uncrustify-0.59/tests/output/cpp/30830-kw_subst.cpp0000644000175000017500000000134511506773275017127 00000000000000/** * @file kw_subst.cpp * Description * * $Id$ */ #include /** * CLASS: CFoo * TODO: DESCRIPTION */ class CFoo { int foo1(int arg); int foo2(); }; /** * CLASS: CFoo * METHOD: foo1 * TODO: DESCRIPTION * @param arg TODO * @return TODO */ int CFoo::foo1(int arg) { } /** * CLASS: CFoo * METHOD: foo2 * TODO: DESCRIPTION * @return TODO */ int CFoo::foo2() { } /** * CLASS: CFoo * METHOD: operator + * TODO: DESCRIPTION * @return TODO */ int CFoo::operator +() { } /** * CLASS: $(fclass) * METHOD: func * TODO: DESCRIPTION * @return TODO */ map func() { // some codes } /** * CLASS: $(fclass) * METHOD: some_func * TODO: DESCRIPTION * @return TODO */ int some_func(void) { } uncrustify-0.59/tests/output/cpp/30730-qt-1.cpp0000644000175000017500000000104111506773275016040 00000000000000class Foo : public QObject { Q_OBJECT private slots: void mySlot(); public slots: void publicSlot(); signals: void somesignal(); }; class foo { bool b; public: int i; }; class bar : public foo { void *p; protected: double d; }; class Foo1 : public QObject { Q_OBJECT private Q_SLOTS: void mySlot(); public Q_SLOTS: void publicSlot(); Q_SIGNALS: void somesignal(); }; class foo1 { bool b; public: int i; }; class bar : public foo1 { void *p; protected: double d; }; uncrustify-0.59/tests/output/cpp/30831-kw_subst2.cpp0000644000175000017500000000142211506773275017206 00000000000000/** * @file kw_subst2.cpp * Description * * $Id$ */ #include namespace bar { /** * CLASS: CFoo * TODO: DESCRIPTION */ class CFoo { int foo1(int arg); private: /** * foo2 * TODO: DESCRIPTION * @return TODO */ int foo2() { } }; /** * foo1 * TODO: DESCRIPTION * @param arg TODO * @param arg2 TODO * @return TODO */ int CFoo::foo1(int arg, char arg2) { } /** * foo2 * TODO: DESCRIPTION * @return TODO */ int CFoo::foo2() { } /** * operator + * TODO: DESCRIPTION * @return TODO */ int CFoo::operator +() { } /** * func * TODO: DESCRIPTION * @return TODO */ map func() { // some codes } /** * some_func * TODO: DESCRIPTION * @return TODO */ int some_func(void) { } } uncrustify-0.59/tests/output/cpp/30027-byref.cpp0000644000175000017500000000113711506773275016372 00000000000000bool foo(int& idx) { if (idx < m_count) { idx++; return m_bool[idx-1]; } return false; } class Foo { public: Foo(); Foo(const Foo& f); }; class NS::Foo { public: Foo(Bar& b); }; template< class T > class ListManager { protected: T head; public: ListManager() { head.next = head.prev = &head; } ListManager(const ListManager& ref) { head.next = head.prev = &head; } } const Foo& Foo::operator ==(Foo& me){ ::sockaddr* ptr = (::sockaddr*)&host; return me; } MyType& MyClass::myMethode() { const MyType& t = getSomewhere(); } uncrustify-0.59/tests/output/cpp/30925-function-def.cpp0000644000175000017500000000172211506773275017653 00000000000000int&Function() { static int x; return(x); } void foo1(int param1, int param2, char *param2); void foo2(int param1, int param2, char *param2); void foo3(int param1, int param2, // comment char *param2 ); struct whoopee *foo4(int param1, int param2, char *param2 /* comment */); const struct snickers * foo5(int param1, int param2, char *param2); void foo(int param1, int param2, char *param2) { printf ("boo!\n"); } int classname::method(); int classname::method() { foo(); } int classname::method2(); int classname::method2() { foo2(); } const int& className::method1(void) const { // stuff } const longtypename& className::method2(void) const { // stuff } int&foo(); int&foo() { list_for_each (a, b) { bar (a); } return(nuts); } void Foo::bar() { } Foo::Foo() { } Foo::~Foo() { } void func(void) { Directory dir ("arg"); } uncrustify-0.59/tests/output/cpp/30912-long_namespace.cpp0000644000175000017500000000021111506773275020231 00000000000000namespace boo3 { int Fun1() { return 42; } } namespace boo4 { int Fun2() { int a = 7; int b = 8; return a+b; } } uncrustify-0.59/tests/output/cpp/30105-av.h0000644000175000017500000000176411631041564015325 00000000000000/* 2) There seems to be a problem handling .h-files compared to .cpp-files. The following problem only occurs in header-files, in source-files the output is as desired. */ static inline void foo() { //BEFORE: if (cond) { callFunc(); } // DESIRED: if (cond) { callFunc(); } // AFTER: if (cond) { callFunc(); } /* 3) The spacing around pointer stars is not always maintained as desired. */ //BEFORE: Buffer* buffer; //AFTER: Buffer* buffer; /* 4) Inside of casts the types are not formatted as outside. */ //BEFORE: T* t = dynamic_cast(obj); //AFTER: T* t = dynamic_cast(obj); /* 5) Inside some template-stuff the spacing goes weird. Multiple spaces are inserted, although the configuration (should) say otherwise. */ //BEFORE: for (std::map::iterator it = map.begin(); it != map.end(); it++) { bar(it); } //AFTER: for (std::map::iterator it = map.begin(); it != map.end(); it++) { bar(it); } } uncrustify-0.59/tests/output/cpp/30024-class-init.cpp0000644000175000017500000000142411506773275017325 00000000000000 class Foo : public Bar { }; #define CTOR(i, _) : \ T(X()), \ y() \ { } class Foo2 : public Bar { }; class GLOX_API ClientBase : public Class, public OtherClass, public ThridClass, public ForthClass { public: ClientBase(const ClientBase & f) { // do something } }; ClientBase::ClientBase (const std::string& ns, const std::string& ns1, const std::string& ns2) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } uncrustify-0.59/tests/output/cpp/30931-indent_var_def_cont.cpp0000644000175000017500000000034011506773275021254 00000000000000int a, b, c; int d, e, f; void bar(void) { struct foobar a = { 'x', 0 }; struct foobar b = { 'y', 2 }, c = { 'z', 4 }; struct foobar d = { 'y', 2 }, e = { 'z', 4 }; } uncrustify-0.59/tests/output/cpp/30028-byref.cpp0000644000175000017500000000114711506773275016374 00000000000000bool foo(int & idx) { if (idx < m_count) { idx++; return m_bool[idx-1]; } return false; } class Foo { public: Foo(); Foo(const Foo & f); }; class NS::Foo { public: Foo(Bar & b); }; template< class T > class ListManager { protected: T head; public: ListManager() { head.next = head.prev = &head; } ListManager(const ListManager & ref) { head.next = head.prev = &head; } } const Foo & Foo::operator ==(Foo & me){ ::sockaddr* ptr = (::sockaddr*)&host; return me; } MyType & MyClass::myMethode() { const MyType & t = getSomewhere(); } uncrustify-0.59/tests/output/cpp/30034-operator_proto.cpp0000644000175000017500000000664511576727500020345 00000000000000/* A collection of all the different known operator prototypes in C++ */ // arithmetic operators Type1 operator + (const Type1& a); // +a Type1 operator + (const Type1& a, const Type2& b); // a + b Type1& operator ++ (Type1& a); // ++a Type1 operator ++ (Type1& a, int); // a++ Type1& operator += (Type1& a, const Type1& b); // a += b Type1 operator - (const Type1& a); // -a Type1& operator -- (Type1& a); // --a Type1 operator -- (Type1& a, int); // a-- Type1& operator -= (Type1& a, const Type1& b); // a -= b Type1 operator * (const Type1& a, const Type1& b); // a * b Type1& operator *= (Type1& a, const Type1& b); // a *= b Type1 operator / (const Type1& a, const Type1& b); // a / b Type1& operator /= (Type1& a, const Type1& b); // a /= b Type1 operator % (const Type1& a, const Type1& b); // a % b Type1& operator %= (Type1& a, const Type1& b); // a %= b // comparison operators bool operator < (const Type1& a, const Type1& b); // a < b bool operator <= (const Type1& a, const Type1& b); // a <= b bool operator > (const Type1& a, const Type1& b); // a > b bool operator >= (const Type1& a, const Type1& b); // a >= b bool operator != (const Type1& a, const Type1& b); // a != b bool operator == (const Type1& a, const Type1& b); // a == b // logical operators bool operator ! (const Type1& a); // !a bool operator && (const Type1& a, const Type1& b); // a && b bool operator || (const Type1& a, const Type1& b); // a || b // bitwise operators Type1 operator << (const Type1& a, const Type1& b); // a << b Type1& operator <<= (Type1& a, const Type1& b); // a <<= b Type1 operator >> (const Type1& a, const Type1& b); // a >> b Type1& operator >>= (Type1& a, const Type1& b); // a >>= b Type1 operator ~ (const Type1& a); // ~a Type1 operator & (const Type1& a, const Type1& b); // a & b Type1& operator &= (Type1& a, const Type1& b); // a &= b Type1 operator | (const Type1& a, const Type1& b); // a | b Type1& operator |= (Type1& a, const Type1& b); // a |= b Type1 operator ^ (const Type1& a, const Type1& b); // a ^ b Type1& operator ^= (Type1& a, const Type1& b); // a ^= b // other operators Type1& Type1::operator = (const Type1& b); // a = b void operator () (Type1& a); // a() const Type2& operator [] (const Type1& a, const Type1& b); // a[b] Type2& operator * (const Type1& a); // *a Type2* operator & (const Type1& a); // &a Type2* Type1::operator -> (); // a->b Type1::operator type (); // (type)a Type2& operator , (const Type1& a, Type2& b); // a, b void *Type1::operator new (size_t x); // new Type1 void *Type1::operator new[] (size_t x); // new Type1[n] void *Type1::operator delete (size_t x); // delete a void *Type1::operator delete[] (size_t x); // delete [] a // Misc examples int& operator * (); Foo::operator const char * (); Foo::operator const Bar& (); uncrustify-0.59/tests/output/cpp/30202-cmt_indent.cpp0000644000175000017500000000105011506773275017374 00000000000000namespace { /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ class Test { Test() {} ~Test() {} /** Call this method to run the test \param n test number \returns the test result */ bool Run(int n); /** Call this method to stop the test \param n test number \returns the test result */ bool Run(int n); }; } uncrustify-0.59/tests/output/cpp/30080-nl_brace_brace.cpp0000644000175000017500000000045111506773275020161 00000000000000 SHOW_VAR status_vars[]= { { "Aborted_clients", (char *)&aborted_threads, SHOW_LONGLONG, } }; SHOW_VAR status_vars[]= { { "Aborted_clients", (char *)&aborted_threads, SHOW_LONGLONG, } }; SHOW_VAR status_vars[]= { { "Aborted_clients", (char *)&aborted_threads, SHOW_LONGLONG, } }; uncrustify-0.59/tests/output/cpp/30003-strings.cpp0000644000175000017500000000347311574756633016757 00000000000000void foo() { BSTR test = L"SID"; CHAR s[] = "This is a \"test\""; CHAR ch = 'a'; } /* The 'u8', 'u', and 'U' prefixes */ const char *s1 = u8"I'm a UTF-8 string."; const char16_t *s2 = u"This is a UTF-16 string."; const char32_t *s3 = U"This is a UTF-32 string."; /* The 'R' and 'R"delim(' prefixes */ const char *r1 = R"(Xhe String Data \ Stuff " )"; const char *r2 = R"delimiter(The String Data \ Stuff ")delimiter"; /* Multiline string */ auto foo = R"FOO"( some text and more text )FOO""; /* Combo */ const char *c1 = u8R"XXX(I'm a "raw UTF-8" string.)XXX"; const char16_t *c2 = uR"*(This is a "raw UTF-16" string.)*"; const char32_t *c3 = UR"(This is a "raw UTF-32" string.)"; /* user-defined */ OutputType operator "" _Suffix(unsigned long long); OutputType operator "" _Suffix(long double); OutputType some_variable = 1234_Suffix; // uses the first function OutputType another_variable = 3.1416_Suffix; // uses the second function OutputType operator "" _Suffix(const char *string_values, size_t num_chars); OutputType operator "" _Suffix(const wchar_t *string_values, size_t num_chars); OutputType operator "" _Suffix(const char16_t *string_values, size_t num_chars); OutputType operator "" _Suffix(const char32_t *string_values, size_t num_chars); OutputType some_variable = "1234"_Suffix; //Calls the const char * version OutputType some_variable = u8"1234"_Suffix; //Calls the const char * version OutputType some_variable = L"1234"_Suffix; //Calls the const wchar_t * version OutputType some_variable = u"1234"_Suffix; //Calls the const char16_t * version OutputType some_variable = U"1234"_Suffix; //Calls the const char32_t * version /* Some stuff that should NOT be detected as a C++0x user-defined literal */ sscanf(text, "%" SCNx64, &val); printf("Val=%" PRIx64 "\n", val); uncrustify-0.59/tests/output/cpp/30816-for_long.cpp0000644000175000017500000000035211506773275017074 00000000000000void foo() { for (std::map::iterator it = m_stat_http_conn_total.m_stat_response_codes.begin(); it != m_stat_http_conn_total.m_stat_response_codes.end(); ++i) { bar(it); } } uncrustify-0.59/tests/output/cpp/30104-templ_class.h0000644000175000017500000000056611506773275017237 00000000000000template class SpecialClass> class Example { // Copy constructor with other variants of Example template class OtherSpecialClass> Example(const Example& other) { // do something useful here } /** The normal member var based on the template arguments */ SpecialClass memberVar; }; uncrustify-0.59/tests/output/cpp/30062-class-init.cpp0000644000175000017500000000146311506773275017332 00000000000000 class Foo : public Bar { }; #define CTOR(i, _) : T(X()), \ y() \ { } class Foo2 : public Bar { }; class GLOX_API ClientBase : public Class, public OtherClass, public ThridClass, public ForthClass { public: ClientBase(const ClientBase & f){ // do something } }; ClientBase::ClientBase (const std::string& ns, const std::string& ns1, const std::string& ns2) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } uncrustify-0.59/tests/output/cpp/30841-nl_func_type_name.cpp0000644000175000017500000000111011506773275020743 00000000000000 // zero // one // two // three void foo(void); struct A { public: long_complicated_type f(); A& operator+(const A& other); }; A& A::operator+(const A& other) { } B operator+(const B& other) { } B foo(const B& other) { } class A { public: int aFunct() { return a; } int bFunc(); }; // Another file int A::bFunc() { // some code } template typename Foo::Type Foo::Func() { } void Foo::bar() { } namespace foo { Foo::Foo() { } } Foo::~Foo() { } class Object { ~Object(void); }; template void SampleClassTemplate::connect() { } uncrustify-0.59/tests/output/cpp/30061-class-init.cpp0000644000175000017500000000145711506773275017334 00000000000000 class Foo : public Bar { }; #define CTOR(i, _) : T(X()), \ y() \ { } class Foo2 : public Bar { }; class GLOX_API ClientBase : public Class, public OtherClass, public ThridClass, public ForthClass { public: ClientBase(const ClientBase & f){ // do something } }; ClientBase::ClientBase (const std::string& ns, const std::string& ns1, const std::string& ns2) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } Foo::Foo(int bar) : someVar(bar), othervar(0) { } uncrustify-0.59/tests/output/cpp/30103-templates.cpp0000644000175000017500000000565011506773275017260 00000000000000#include #include #include #define MACRO(T) f() class MyClass { public: std::mapsomeData; std::map >otherData; }; void foo() { Listbob = new List(); } Afoo; Abar; Abaz; A >bay; void asd(void) { Afoo; Abar; Abaz; A >bay; if (a < b && b > c) { a = b < c > 0; } if (ac) { } a < up_lim() ? do_hi() : do_low; a[ a < b > c] = d; } templateclass MyClass { } template class MyClass { } templateclass MyClass : myvar(0), myvar2(0) { } templateclass MyClass : myvar(0), myvar2(0) { } static int max_value() { return (std :: numeric_limits:: max )(); } template priority_queue :: ~priority_queue () { } template T test(T a) { return a; } int main() { int k,j; h g; k=test(j); return 0; } templateclass ConcreteStorageClass> class RotationMatrix : public StaticBaseMatrix { public: RotationMatrix() : StaticBaseMatrix() { // do some initialization } void assign(const OtherClass& other) { // do something } }; int main() { MyClassfoo; } template inline std::basic_ostream& FWStreamOut(std::basic_ostream& os, const W::S& s) { return operator<< >( os, s ); } struct foo { type1bar; }; struct foo { type1bar; }; templatevoid f(); templatevoid g() { f(); f(); f(); f(); } void h() { g<42>(); } #include std::vectorA(2); std::vectorB; std::vectorC(2); std::vectorD; templatestruct X { templatevoid operator()(U); }; templateclass Y { templatevoid f(V); }; void (* foobar)(void) = NULL; std::vectorfunctions; #define MACRO( a ) a templateclass X; MACRO( void f( X<>& x ) ); void g( X<>& x ); #include typedef std::vector >Table; // OK typedef std::vector >Flags; // Error void func(List = default_val1); void func(List > = default_val2); BLAH<(3.14 >= 42)>blah; void foo() { A<(X > Y)>a; a = static_cast >(ld); } templateclass X { /* ... */ }; X < 1 > 2 > x1; // Syntax error. X<(1 > 2)>x2; // Okay. templateclass Y { /* ... */ }; Y >x3; // Okay, same as "Y > x3;". Y < X<6> > 1 >> x4; // Syntax error. Instead, write "Y>1)>> x4;". Y> 1)> >x4; uncrustify-0.59/tests/output/cpp/30814-misc6.cpp0000644000175000017500000000011311506773275016301 00000000000000#include void f(std::vector * vip, std::vector & vir); uncrustify-0.59/tests/output/cpp/30015-exception.cpp0000644000175000017500000000073711506773275017263 00000000000000#include void foo() { char *buf; try { buf = new unsigned char[1024]; if (buf == 0) { throw "Out of memory"; } } catch (char *str) { cout << "Exception: " << str << '\n'; } } void bar() { char *buf; try { buf = new unsigned char[1024]; if (buf == 0) { throw "Out of memory"; } } catch (char *str) { cout << "Exception: " << str << '\n'; } } uncrustify-0.59/tests/output/cpp/30930-indent_var_def.cpp0000644000175000017500000000013611506773275020233 00000000000000void function() { int n; float f; anotherFunction(); char foo; somethingelse(); } uncrustify-0.59/tests/output/cpp/30201-cmt_indent.cpp0000644000175000017500000000107111506773275017376 00000000000000namespace { /* If we're in the middle of the original line, copy the string only up to the cursor position into buf, so tab completion will result in buf's containing only the tab-completed path/filename. */ class Test { Test() {} ~Test() {} /** Call this method to run the test \param n test number \returns the test result */ bool Run(int n); /** Call this method to stop the test \param n test number \returns the test result */ bool Run(int n); }; } uncrustify-0.59/tests/output/cpp/30951-sp_before_tr_emb_cmt_input.cpp0000644000175000017500000000052511631560313022631 00000000000000/* leading cmt */ int w; int y; /* embedded cmt */ int z; // whole cpp cmt int x; // trailing cpp cmt /* whole c cmt */ int x; /* trailing c cmt */ struct foo { // trailing cmt int x; // trailing cmt // whole cmt int a; /* emb cmt */ int b; // trailing cmt }; // trailing cmt int a; /* emb cmt */ int b; // trailing cmt uncrustify-0.59/tests/output/cpp/30100-templates.cpp0000644000175000017500000000602611506773275017253 00000000000000#include #include #include #define MACRO(T) f() class MyClass { public: std::map < int, bool > someData; std::map < int, std::list < bool > > otherData; }; void foo() { List < byte > bob = new List(); } A foo; A bar; A baz; A > bay; void asd(void) { A foo; A bar; A baz; A > bay; if (a < b && b > c) { a = b < c > 0; } if (a < bar() > c) { } a < up_lim() ? do_hi() : do_low; a[ a < b > c] = d; } template class MyClass { } template class MyClass { } template class MyClass : myvar(0), myvar2(0) { } template class MyClass : myvar(0), myvar2(0) { } static int max_value() { return (std :: numeric_limits :: max )(); } template < class Config_ > priority_queue < Config_ > :: ~priority_queue () { } template T test(T a) { return a; } int main() { int k,j; h g; k=test(j); return 0; } template class ConcreteStorageClass> class RotationMatrix : public StaticBaseMatrix { public: RotationMatrix() : StaticBaseMatrix() { // do some initialization } void assign(const OtherClass& other) { // do something } }; int main() { MyClass foo; } template< typename CharT, int N, typename Traits > inline std::basic_ostream& FWStreamOut(std::basic_ostream& os, const W::S& s) { return operator << >( os, s ); } struct foo { type1 < int& > bar; }; struct foo { type1 < int const > bar; }; template void f(); template void g() { f(); f< i >(); f(); f(); } void h() { g<42>(); } #include std::vector A(2); std::vector B; std::vector C(2); std::vector D; template struct X { template void operator ()(U); }; template class Y { template void f(V); }; void (* foobar)(void) = NULL; std::vector functions; #define MACRO( a ) a template < typename = int > class X; MACRO ( void f( X < >& x ) ); void g( X < >& x ); #include typedef std::vector > Table; // OK typedef std::vector > Flags; // Error void func(List = default_val1); void func(List > = default_val2); BLAH<(3.14 >= 42)> blah; void foo() { A<(X > Y)> a; a = static_cast >(ld); } template class X { /* ... */ }; X < 1 > 2 > x1; // Syntax error. X<(1 > 2)> x2; // Okay. template class Y { /* ... */ }; Y > x3; // Okay, same as "Y > x3;". Y < X<6> > 1 >> x4; // Syntax error. Instead, write "Y>1)>> x4;". Y> 1)> > x4; uncrustify-0.59/tests/output/cpp/30002-constructor.cpp0000644000175000017500000000120011506773275017630 00000000000000 IMPLEMENT_DYNAMIC(CPropertiesDlg, CDialog) CPropertiesDlg::CPropertiesDlg(CPtcMsgSimControlModule *pcmPtcMsg, CWnd *pParent /*=NULL*/) : CDialog(CPropertiesDlg::IDD, pParent), m_pspRouter(pcmPtcMsg), m_pspScm(pcmPtcMsg) { m_pcmPtcMsg = pcmPtcMsg; } CPropertiesDlg::~CPropertiesDlg() { } void CPropertiesDlg::DoDataExchange(CDataExchange *pDX) { CDialog::DoDataExchange(pDX); } CFooBar::CFooBar(CWnd *pParent /*=NULL*/) : CDialog(CFooBar::IDD, pParent), m_parent(pParent) { //{{AFX_DATA_INIT(CRouterBrowser) //}}AFX_DATA_INIT m_nFoo = 0; m_nBar = 0; } uncrustify-0.59/tests/output/cpp/30923-sp_before_ellipsis.cpp0000644000175000017500000000043311506773275021136 00000000000000 void log_fmt(log_sev_t sev, const char *fmt, ...) __attribute__((format(printf, 2, 3))); #define LOG_FMT(sev, args ...) \ do { if (log_sev_on(sev)) { log_fmt(sev, ## args); } } while (0) #endif void foo() { try {} catch (...) // <== HERE {} } uncrustify-0.59/tests/output/cpp/30016-custom-open.cpp0000644000175000017500000000061511506773275017532 00000000000000 void className::set(const objectName& obj) { statement1(); MACRO_BEGIN_STUFF(param) DOSTUFF(params) MACRO_ELSE_STUFF() DOMORESTUFF(moreparams) junk = 1; MACRO2_BEGIN_STUFF junk += 3; MACRO2_ELSE_STUFF junk += 4; MACRO2_END_STUFF DOLASTSTUFF(lastparams) MACRO_END_STUFF() statement2(); } MACRO2_BEGIN_STUFF // comment MACRO2_ELSE_STUFF /* Comment */ MACRO2_END_STUFF uncrustify-0.59/tests/output/cpp/30013-sim.h0000644000175000017500000000114511506773275015512 00000000000000namespace ns { templateclass TOtherClass> class Example { int foo; } } template class Example { T getValue() const; /** A pointer to a T returning function in the software environment */ T (FunctionProvider::* pF)(); }; #if !defined(EVERYTHING_OK) #error Define EVERYTHING_OK if you would like to compile your code \ or not if you would like to stop! #endif template class Example { Vector2() : x(1), y(1) {} Vector2() : x(1.0), y(1.0) {} Vector2() : x(1.0f), y(1.0f) {} V x; V y; }; uncrustify-0.59/tests/output/cpp/30272-sp_throw_paren.cpp0000644000175000017500000000006411506773275020315 00000000000000 void foo() { throw (x); throw (y); throw (z); } uncrustify-0.59/tests/output/cpp/30940-case-brace-remove.cpp0000644000175000017500000000036311574756532020551 00000000000000int SomeClass::method() { switch (1) { case 0: { double v; break; } case 1: { double v; v = this->mat.operator()(0, 0); break; } case 2: foo(); } } uncrustify-0.59/tests/output/cpp/30109-templates4.cpp0000644000175000017500000000127011506773275017344 00000000000000#define FOO(X) \ template \ inline X<_blk_sz, _run_type, __pos_type> operator - ( \ const X<_blk_sz, _run_type, __pos_type> & a, \ typename X<_blk_sz, _run_type, __pos_type>::_pos_type off) \ { \ return X<_blk_sz, _run_type, __pos_type>(a.array, a.pos - off); \ } \ template \ inline X<_blk_sz, _run_type, __pos_type> & operator -= ( \ X < _blk_sz, _run_type, __pos_type > & a, \ typename X<_blk_sz, _run_type, __pos_type>::_pos_type off) \ { \ a.pos -= off; \ return a; \ } uncrustify-0.59/tests/output/cpp/30950-sp_before_tr_emb_cmt_input.cpp0000644000175000017500000000052011631560313022623 00000000000000/* leading cmt */ int w; int y; /* embedded cmt */ int z; // whole cpp cmt int x; // trailing cpp cmt /* whole c cmt */ int x; /* trailing c cmt */ struct foo { // trailing cmt int x; // trailing cmt // whole cmt int a; /* emb cmt */ int b; // trailing cmt }; // trailing cmt int a; /* emb cmt */ int b; // trailing cmt uncrustify-0.59/tests/output/cpp/30108-templates3.cpp0000644000175000017500000000061211506773275017341 00000000000000template struct T { typedef int result; }; template struct X { typedef typename T::result result; }; template class new_alloc { public: void deallocate(int* p, int /*num*/) { T::operator delete((void *)p); } }; void test(void) { return x != 0 && x >= 1 && x < 2 && y >= 3 && y < 4; } uncrustify-0.59/tests/output/cpp/30806-ptr-star.cpp0000644000175000017500000000113211506773275017037 00000000000000int dx = m_ClipBox.GetWidth() * GetZoom(); m_ClipBox.m_Pos.y = PaintClipBox.y * GetZoom(); int *i; char *i; int MyFunc(std::string &s, char *) { char *c = const_cast(s.c_str()); } int YerFunc(std::string &s, char **) { char **c; int a = b[0] * c; } int *X(int *i, int *); int *i = &a; int *i = *b; int *i = &*c; int *Aclass::X(int *i, int *); class Aclass { int *X(int *i, int *); } extern "C" { int foo1(int *a); int foo2(sometype *a); } int bar1(int *a); int bar2(sometype *a); struct X { int *a; // 3:5 int f() { return *b; // 7:8 } int g() { return *c; // 11:8 } }; uncrustify-0.59/tests/output/cpp/30251-align_fcall.cpp0000644000175000017500000000026611506773275017517 00000000000000void foo() { abc(1, 2, 3); abc(10, 20, 30); abc(100, 200, 300); cab(3, 2, 1, 0); brat("foo", 2000, 3000); brat("question", 2, -42); brat("a", -22, 1); } uncrustify-0.59/tests/output/cpp/30106-templates2.cpp0000644000175000017500000000177411506773275017350 00000000000000void f() { call_a_function(42, double(-1), "charray"); call_a_function(42, double(-1), "charray" ); call_a_function( 42, double(-1), "charray" ); call_a_template_function (42); call_a_template_function (42); call_a_template_function(42); call_a_template_function( 42 ); call_a_template_function< int, int, int > (42); } template class W; template class X; template< class T, class U> class Y; template< class T, class U > class Z; uncrustify-0.59/tests/output/cpp/30029-init_align.h0000644000175000017500000000125311506773275017046 00000000000000struct file_lang languages[] = { { ".c", "C", LANG_C }, { ".cpp", "CPP", LANG_CPP }, { ".d", "D", LANG_D }, { ".cs", "CS", LANG_CS }, { ".vala", "VALA", LANG_VALA }, { ".java", "JAVA", LANG_JAVA }, { ".pawn", "PAWN", LANG_PAWN }, { ".p", "", LANG_PAWN }, { ".sma", "", LANG_PAWN }, { ".inl", "", LANG_PAWN }, { ".h", "", LANG_CPP }, { ".cxx", "", LANG_CPP }, { ".hpp", "", LANG_CPP }, { ".hxx", "", LANG_CPP }, { ".cc", "", LANG_CPP }, { ".di", "", LANG_D }, { ".m", "OC", LANG_OC }, { ".sqc", "", LANG_C }, // embedded SQL }; uncrustify-0.59/tests/output/cpp/30020-bool.cpp0000644000175000017500000000015311506773275016204 00000000000000bool foo(char c) { if (c == 'a') { return(true); } else { return(false); } } uncrustify-0.59/tests/output/cpp/30807-ptr-star.cpp0000644000175000017500000000112411506773275017041 00000000000000int dx = m_ClipBox.GetWidth() * GetZoom(); m_ClipBox.m_Pos.y = PaintClipBox.y * GetZoom(); int *i; char *i; int MyFunc(std::string& s, char*) { char *c = const_cast(s.c_str()); } int YerFunc(std::string& s, char**) { char **c; int a = b[0] * c; } int* X(int *i, int*); int *i = &a; int *i = *b; int *i = &*c; int* Aclass::X(int *i, int*); class Aclass { int* X(int *i, int*); } extern "C" { int foo1(int *a); int foo2(sometype *a); } int bar1(int *a); int bar2(sometype *a); struct X { int *a; // 3:5 int f() { return *b; // 7:8 } int g() { return *c; // 11:8 } }; uncrustify-0.59/tests/output/cpp/30019-wacky-template.cpp0000644000175000017500000000110011506773275020201 00000000000000template template void turbo_dec_1_15::compute_tail(gamma_t const& gamma, gamma2_t const& gamma2, alpha_t const& alpha, beta_t const& beta, tail_extrinsic_t& tail_extrinsic, rec_tail_t const& rec_tail) { } uncrustify-0.59/tests/output/cpp/30812-misc4.cpp0000644000175000017500000000067211621632311016266 00000000000000struct X { void operator deleteme(void *); void deallocate(int *p) { operator delete((void *)p); delete((void *)q); } }; int f(bool b) { typedef int mytype; if (b) { return(int(42.0)); } else { return(mytype(42.0)); } } struct X { double f(int n) { return(double(n)); } }; inline value_type operator ()() const { return(double(rnd32()) * (0.5 / 0x80000000)); } uncrustify-0.59/tests/output/cpp/30742-delete.cpp0000644000175000017500000000010511506773275016523 00000000000000 void x(int **d) { delete *d; } void x(int& d) { delete &d; } uncrustify-0.59/tests/output/cpp/30815-cmt-reflow.cpp0000644000175000017500000000153311506773275017347 00000000000000 typedef enum stuff { Value1 = 0x00000400, /* Just a comment for the value */ Value2 = 0x00000800, /* A much longer comment that needs * to be truncated to fit within a * set character width. In this * case, its 80 characters so two * truncates are required. */ } JustAnEnum; /* this is another comment that is meant to exceed the code * width so that it can be wrapped * and combined to see how that works. */ /* this is another comment that is meant to exceed the code * width so that it can be wrapped * and combined to see how that works. */ /* Line A */ /* Line 1 * line 2 * line 3 * line 4 */ /** * Multi-line comment */ void foo(void) { /** * Multi-line comment */ int idx; /** * Multi-line comment */ } uncrustify-0.59/tests/output/cpp/30935-indent-misc.cpp0000644000175000017500000000122711506773275017505 00000000000000struct S { int one, two; S(int i=1) { one = i; two = i + i; } bool check() const { return(one == 1); } }; struct S { enum { twentythree = 23, fortytwoseven = 427 }; int one, two; S(int i=1) { one = i; two = i + i; } bool check() const { return(one == 1); } }; static uint jhash(K x) { ubyte *k; uint a, b, c; uint a, b, c; len = x.length; } const char *token_names[] = { [CT_POUND] = "POUND", [CT_PREPROC] = "PREPROC", }; struct whoopee * foo4( int param1, int param2, char *param2 ); uncrustify-0.59/tests/output/cpp/30041-nl-class.h0000644000175000017500000000122111506773275016432 00000000000000#ifndef NL_CLASS_H_INCLUDED #define NL_CLASS_H_INCLUDED #include namespace example { class IStreamable; class InStream; class OutStream; /** * Timestamp is a timestamp with nanosecond resolution. */ class Inher : public IStreamable { public: Inher(); virtual ~Inher(); }; /** * Timestamp is a timestamp with nanosecond resolution. */ class Inher2 : public IStreamable { public: Inher2(); Inher2(long sec, unsigned long nsec); }; class Simple { public: Simple(); virtual ~Simple(); }; class Simple2 { public: Simple2(); virtual ~Simple2(); }; } // namespace #endif // NL_CLASS_H_INCLUDED uncrustify-0.59/tests/output/cpp/30107-templates2.cpp0000644000175000017500000000177411506773275017351 00000000000000void f() { call_a_function(42, double(-1), "charray"); call_a_function(42, double(-1), "charray" ); call_a_function( 42, double(-1), "charray" ); call_a_template_function (42); call_a_template_function (42); call_a_template_function(42); call_a_template_function( 42 ); call_a_template_function< int, int, int > (42); } template class W; template class X; template< class T, class U> class Y; template< class T, class U > class Z; uncrustify-0.59/tests/output/cpp/30033-operator.cpp0000644000175000017500000000330711576727500017111 00000000000000 struct bar; struct foo { operator bar*(); }; class Foo { Foo operator+(const Foo& rhs) const; const Foo& operator==(Foo& me); bool operator>(const Foo& rhs) const; InStream& operator<<(InStream& in); } const Foo& Foo::operator==(Foo& me) { } Foo Foo::operator+(const Foo& rhs) const { } bool Foo::operator>(const Foo& rhs) const { } class Example { char m_array[256]; Example& operator=(const Example& rhs); Example& operator+=(const Example& rhs); const Example operator+(const Example& other) const; bool operator==(const Example& other) const; bool operator!=(const Example& other) const; Example operator+(const Example& x, const Example& y); Example operator*(const Example& x, const Example& y); double& operator()(int row, int col); double operator()(int row, int col) const; void operator++(); int& operator*(); Example& operator++(); // prefix ++ Example operator++(int); // postfix ++ bool operator<(const Example& lhs, const Example& rhs) const; int operator()(int index) { i = ~~3; return index + 1; } char& operator[](unsigned i) { return m_array[i & 0xff]; } } bool Example::operator==(const Example& other) const { /*TODO: compare something? */ return false; } bool Example::operator!=(const Example& other) const { return !operator==(other); } void a() { Op op = &X::operator==; if (!A) if (op != &X::operator==) A(1) = a; if (!A) { if (op != &X::operator==) A(1) = a; } } void *operator new(std::size_t) throw(std::bad_alloc); void *operator new[](std::size_t) throw(std::bad_alloc); void operator delete(void *) throw(); void operator delete[](void *) throw(); uncrustify-0.59/tests/output/cpp/30800-align-star-amp-pos.cpp0000644000175000017500000000157211506773275020700 00000000000000 /** First, the typedefs */ typedef int MY_INT; typedef int* MY_INTP; typedef int& MY_INTR; typedef CFoo& foo_ref_t; typedef int (*foo_t)(void* bar); typedef int (*somefunc_t)(void* barstool); /* Now, the types */ struct foo1 { unsigned int d_ino; const char* d_reclen; unsigned short d_namlen; char d_name[1]; CFoo& fref; }; struct foo { int a; char* b }; static int idx; static const char** tmp; CFoo& fref; static char buf[64]; static unsigned long how_long; // comment static int** tmp; static char buf[64]; void bar(int someval, void* puser, const char* filename, struct willy* the_list, int list_len) { int idx; const char** tmp; char buf[64]; CFoo& fref; unsigned long how_long; return(-1); } uncrustify-0.59/tests/output/cpp/30017-custom-open.cpp0000644000175000017500000000073611506773275017537 00000000000000 void className::set(const objectName& obj) { statement1(); MACRO_BEGIN_STUFF(param) DOSTUFF(params) MACRO_ELSE_STUFF() DOMORESTUFF(moreparams) junk = 1; MACRO2_BEGIN_STUFF junk += 3; MACRO2_ELSE_STUFF junk += 4; MACRO2_END_STUFF DOLASTSTUFF(lastparams) MACRO_END_STUFF() statement2(); } MACRO2_BEGIN_STUFF // comment MACRO2_ELSE_STUFF /* Comment */ MACRO2_END_STUFF uncrustify-0.59/tests/output/cpp/30910-indent_namespace.h0000644000175000017500000000031011506773275020216 00000000000000namespace ns1 { void bar1(void); class foo1 { int i1; }; } namespace ns2 { void bar2(void); class foo2 { int i2; }; } namespace { void bar3(void); class foo3 { int i3; }; } uncrustify-0.59/tests/output/cpp/30271-sp_throw_paren.cpp0000644000175000017500000000006111506773275020311 00000000000000 void foo() { throw(x); throw(y); throw(z); } uncrustify-0.59/tests/output/cpp/30012-misc2.cpp0000644000175000017500000000275211631041564016262 00000000000000/* I tried to modify the spaces when using casts like static_cast etc. by using sp_before_angle, sp_after_angle and sp_inside_angle. Even setting all of those options to remove results in the following: */ myvar = dynamic_cast*>(other); // expected: //myvar = dynamic_cast*>(other); /* Sometime pointers and references are still not detected correctly in special cases - i guess. */ //When using "sp_before_ptr_star = remove" the result is: typedef std::list::iterator iterator; //typedef std::list::iterator iterator; //------------------------------^ This space show not be there typedef void (T::*Routine)(void); //Similar with "sp_before_byref = remove": unsigned long allocate(unsigned long size, void*& p); //unsigned long allocate(unsigned long size, void* & p); //------------------------------------------------^ The same here void foo(void) { List bob = new List(); /* Align assignments */ align_assign(chunk_get_head(), cpd.settings [UO_align_assign_span].n, cpd.settings [UO_align_assign_thresh].n); } Args::Args(int argc, char**argv) { m_count = argc; m_values = argv; int len = (argc >> 3) + 1; m_used = new UINT8 [len]; if (m_used != NULL) { memset(m_used, 0, len); } } void Args(int argc, char**argv) { m_count = argc; m_values = argv; int len = (argc >> 3) + 1; m_used = new UINT8 [len]; if (m_used != NULL) { memset(m_used, 0, len); } } uncrustify-0.59/tests/output/cpp/30921-variadic-template.h0000644000175000017500000000070311506773275020324 00000000000000template struct __index_holder_impl<__i, __index_holder<_Indexes...>, _IdxHolder, _Elements...> { typedef typename __index_holder_impl<__i + 1, __index_holder<_Indexes..., __i>, _Elements...>::type type; }; uncrustify-0.59/tests/output/cpp/30705-func_param.cpp0000644000175000017500000000100511511366174017363 00000000000000typedef short (*hello1)(char coolParam, ushort *, unsigned int anotherone); short (*hello2)(char coolParam, ulong *, uchar, unsigned int anotherone); short hello3(char coolParam, ushort *, unsigned int anotherone); void x(custom_t *e, void (*funcptr)); void x(custom_t *e, void (*funcptr)[]); void x(custom_t *e, void (*funcptr)(int, int)); void x(custom_t *e, void (*funcptr)(int, int)[]); uncrustify-0.59/tests/output/cpp/30817-cmt-cpp-cont.cpp0000644000175000017500000000100611506773275017571 00000000000000#include "foo.h" // // plshade z xmin xmax ymin ymax \ // sh_min sh_max sh_cmap sh_color sh_width \ // min_col min_wid max_col max_wid \ // rect [[pltr x y] | NULL ] [wrap] //-------------------------------------------------------------------------- void foo() { // plshade z xmin xmax ymin ymax \ // sh_min sh_max sh_cmap sh_color sh_width \ // min_col min_wid max_col max_wid \ // rect [[pltr x y] | NULL ] [wrap] //-------------------------------------------------------------------------- } uncrustify-0.59/tests/output/cpp/30840-nl_func_type_name.cpp0000644000175000017500000000115211506773275020750 00000000000000 // zero // one // two // three void foo(void); struct A { public: long_complicated_type f(); A& operator+(const A& other); }; A& A::operator+(const A& other) { } B operator+(const B& other) { } B foo(const B& other) { } class A { public: int aFunct() { return a; } int bFunc(); }; // Another file int A::bFunc() { // some code } template typename Foo::Type Foo::Func() { } void Foo::bar() { } namespace foo { Foo::Foo() { } } Foo::~Foo() { } class Object { ~Object(void); }; template void SampleClassTemplate::connect() { } uncrustify-0.59/tests/output/cpp/30260-var_def_gap.cpp0000644000175000017500000000125111506773275017514 00000000000000#define A -3 #define B 163 #define C 2 void foo() { const std::string & targetName1 = pEntry->getTargetName(); const Point3d_t currentPosition1 = pSatOrbit->GetPositionAtTime(jdNow); } void foo2() { const std::string **targetName2 = pEntry->getTargetName(); const Point3d_t currentPosition2 = pSatOrbit->GetPositionAtTime(jdNow); } void foo2() { const std::string **targetName3 = pEntry->getTargetName(); const Point3d_t currentPosition3 = pSatOrbit->GetPositionAtTime(jdNow); } typedef int MY_INT; typedef int *MY_INTP; typedef int (*foo_t)(void *bar); typedef int (*somefunc_t)(void *barstool); uncrustify-0.59/tests/output/cpp/30810-ptr-star.cpp0000644000175000017500000000117611506773275017042 00000000000000int dx = m_ClipBox.GetWidth() * GetZoom(); m_ClipBox.m_Pos.y = PaintClipBox.y * GetZoom(); int *i; char *i; int MyFunc(std::string& s, char *) { char *c = const_cast(s.c_str()); } int YerFunc(std::string& s, char **) { char **c; int a = b[0] * c; } int *X(int *i, int *); int *i = &a; int *i = *b; int *i = &*c; int *Aclass::X(int *i, int *); class Aclass { int *X(int *i, int *); } extern "C" { int foo1(int *a); int foo2(sometype *a); } int bar1(int *a); int bar2(sometype *a); struct X { int *a; // 3:5 int f() { return(*b); // 7:8 } int g() { return(*c); // 11:8 } }; uncrustify-0.59/tests/output/cpp/30701-function-def.cpp0000644000175000017500000000207211506773275017642 00000000000000int & Function() { static int x; return (x); } void foo1( int param1, int param2, char *param2 ); void foo2( int param1, int param2, char *param2 ); void foo3( int param1, int param2, // comment char *param2 ); struct whoopee * foo4( int param1, int param2, char *param2 /* comment */ ); const struct snickers * foo5( int param1, int param2, char *param2 ); void foo( int param1, int param2, char *param2 ) { printf("boo!\n"); } int classname::method(); int classname::method() { foo(); } int classname::method2(); int classname::method2() { foo2(); } const int& className::method1( void ) const { // stuff } const longtypename& className::method2( void ) const { // stuff } int & foo(); int & foo() { list_for_each(a,b) { bar(a); } return nuts; } void Foo::bar() { } Foo::Foo() { } Foo::~Foo() { } void func( void ) { Directory dir("arg"); } uncrustify-0.59/tests/output/cpp/30911-indent_namespace.h0000644000175000017500000000027111506773275020225 00000000000000namespace ns1 { void bar1(void); class foo1 { int i1; }; } namespace ns2 { void bar2(void); class foo2 { int i2; }; } namespace { void bar3(void); class foo3 { int i3; }; } uncrustify-0.59/tests/output/cpp/30050-nl-namespace.h0000644000175000017500000000016011506773275017262 00000000000000namespace ns1 { void *foo(void); void bar(void); } namespace ns2 { void *foo(void); void bar(void); } uncrustify-0.59/tests/output/cpp/30010-class.h0000644000175000017500000000206111506773275016022 00000000000000#ifndef _FOO_BAR_H_INCLUDED_ #define _FOO_BAR_H_INCLUDED_ class CFooBarDlg : public CDialog { // Construction public: CFooBarDlg(CFooBar *pDataMan, CWnd *pParent=NULL); virtual ~CFooBarDlg(); void Initialize(BYTE nDelay=100); UINT GetCount() { return(m_nCount); } void SetCount(int count=1) { if ((count > 0) && (count < MAX_COUNT)) { m_nCount = count; } } // Dialog Data //{{AFX_DATA(CATCSMgrDlg) enum { IDD = IDD_ATCS_MGR_DLG }; //}}AFX_DATA protected: int m_nCount; // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CATCSMgrDlg) protected: virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation // Generated message map functions //{{AFX_MSG(CATCSMgrDlg) virtual BOOL OnInitDialog(); afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnBtnSendFooBar(); afx_msg void OnSelchangeFooBarCombo(); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #endif /* _FOO_BAR_H_INCLUDED_ */ uncrustify-0.59/tests/output/cpp/30051-nl-namespace.h0000644000175000017500000000016011506773275017263 00000000000000namespace ns1 { void *foo(void); void bar(void); } namespace ns2 { void *foo(void); void bar(void); } uncrustify-0.59/tests/output/cpp/30253-align_left_shift.cpp0000644000175000017500000000110511506773275020560 00000000000000#include #define MACRO(x) x int main() { int X[1]; MACRO(std::cout << X << X[0]); std::cout << X << X; std::cout2 << X << X; std::cout << X << X[0]; } #define A_LONG_MACRO_NAME(x) x void f() { std::cout << "Hello, " << "World!" << std::endl; A_LONG_MACRO_NAME(std::cout << "Hello, " << "World!" << std::endl); A_LONG_MACRO_NAME( std::cout << "Hello, " << "World!" << std::endl); } uncrustify-0.59/tests/output/cpp/30001-alt_tokens.cpp0000644000175000017500000000030411506773275017411 00000000000000%:include // #include int main(int argc, char *argv[]) // { <% int array<:10:>; // int array[10]; %> // } uncrustify-0.59/tests/output/cpp/30802-align-star-amp-pos.cpp0000644000175000017500000000157211506773275020702 00000000000000 /** First, the typedefs */ typedef int MY_INT; typedef int *MY_INTP; typedef int &MY_INTR; typedef CFoo &foo_ref_t; typedef int (*foo_t)(void *bar); typedef int (*somefunc_t)(void *barstool); /* Now, the types */ struct foo1 { unsigned int d_ino; const char *d_reclen; unsigned short d_namlen; char d_name[1]; CFoo &fref; }; struct foo { int a; char *b }; static int idx; static const char **tmp; CFoo &fref; static char buf[64]; static unsigned long how_long; // comment static int **tmp; static char buf[64]; void bar(int someval, void *puser, const char *filename, struct willy *the_list, int list_len) { int idx; const char **tmp; char buf[64]; CFoo &fref; unsigned long how_long; return(-1); } uncrustify-0.59/tests/output/cpp/30205-cmt_right.cpp0000644000175000017500000000056411506773275017244 00000000000000class X { struct Zone { // int a; // int b; int c; int d; double e; inline Zone(int _c) : c(_c) { } // constructor for zone search inline Zone( //int _a, //int _b, int _c, int _d, double _e) : //a(_a), //b(_b), c(_c), d(_d), e(_e) { } }; }; uncrustify-0.59/tests/output/cpp/30032-operator.cpp0000644000175000017500000000337711576727500017117 00000000000000 struct bar; struct foo { operator bar* (); }; class Foo { Foo operator + (const Foo& rhs) const; const Foo& operator == (Foo& me); bool operator > (const Foo& rhs) const; InStream& operator << (InStream& in); } const Foo& Foo::operator == (Foo& me) { } Foo Foo::operator + (const Foo& rhs) const { } bool Foo::operator > (const Foo& rhs) const { } class Example { char m_array[256]; Example& operator = (const Example& rhs); Example& operator += (const Example& rhs); const Example operator + (const Example& other) const; bool operator == (const Example& other) const; bool operator != (const Example& other) const; Example operator + (const Example& x, const Example& y); Example operator * (const Example& x, const Example& y); double& operator () (int row, int col); double operator () (int row, int col) const; void operator ++ (); int& operator * (); Example& operator ++ (); // prefix ++ Example operator ++ (int); // postfix ++ bool operator < (const Example& lhs, const Example& rhs) const; int operator () (int index) { i = ~~3; return index + 1; } char& operator [] (unsigned i) { return m_array[i & 0xff]; } } bool Example::operator == (const Example& other) const { /*TODO: compare something? */ return false; } bool Example::operator != (const Example& other) const { return !operator == (other); } void a() { Op op = &X::operator ==; if (!A) if (op != &X::operator ==) A(1) = a; if (!A) { if (op != &X::operator ==) A(1) = a; } } void *operator new (std::size_t) throw(std::bad_alloc); void *operator new[] (std::size_t) throw(std::bad_alloc); void operator delete (void *) throw(); void operator delete[] (void *) throw(); uncrustify-0.59/tests/output/cpp/30255-align_constr.cpp0000644000175000017500000000034011506773275017743 00000000000000struct TelegramIndex { TelegramIndex(const char *pN, unsigned long nI) : pTelName(pN), nTelIndex(n) { } ~TelegramIndex() { } const char *const pTelName; unsigned long nTelIndex; }; uncrustify-0.59/tests/output/cpp/30085-align_class.cpp0000644000175000017500000000200611553715314017532 00000000000000//--------------------------------------------------------------------------- // Statics | //--------------------------------------------------------------------------- void CTdrFile::SetDistanceMode( TDistMode dm ) { CTdrFile::ms_DistMode = dm; } TDistMode CTdrFile::GetDistanceMode( void ) { return CTdrFile::ms_DistMode; } String CTdrFile::GetDistanceModeUnits( void ) { return ( CTdrFile::GetDistanceMode() == dmKM ) ? "km" : "Miles"; } void CTdrFile::SetBSTCompensation( bool bUseBST ){ ms_bCompBST = bUseBST; } void CTdrFile::SetFactoryMode( bool bFactory ) { ms_bFactory = bFactory; } bool CTdrFile::GetFactoryMode( void ) { return ms_bFactory; } unsigned int CAgentCharacter::iReferenceCount = 0; IAgentEx* CAgentCharacter::pAgentEx = NULL; CAgentNotifySink* CAgentCharacter::pSink = NULL; uncrustify-0.59/tests/output/cpp/30204-comment-align.cpp0000644000175000017500000000102111506773275020002 00000000000000template inline void x3(T & a, T & b, T & c) { T temp; if (b < a) { if (c < a) { // b , c < a if (b < c) { // b < c < a temp = a; a = b; b = c; c = temp; } else { // c <=b < a std::swap(c, a); } } else { // b < a <=c // second line of comment std::swap(a, b); } } 0; 0; 0; if (1) // always do_something(); } uncrustify-0.59/tests/output/cpp/30101-templates.cpp0000644000175000017500000000606411506773275017256 00000000000000#include #include #include #define MACRO(T) f() class MyClass { public: std::map < int, bool > someData; std::map < int, std::list < bool > > otherData; }; void foo() { List < byte > bob = new List(); } A foo; A bar; A baz; A > bay; void asd(void) { A foo; A bar; A baz; A > bay; if (a < b && b > c) { a = b < c > 0; } if (a < bar() > c) { } a < up_lim() ? do_hi() : do_low; a[ a < b > c] = d; } template class MyClass { } template class MyClass { } template class MyClass : myvar(0), myvar2(0) { } template class MyClass : myvar(0), myvar2(0) { } static int max_value() { return (std :: numeric_limits :: max )(); } template < class Config_ > priority_queue < Config_ > :: ~priority_queue () { } template T test(T a) { return a; } int main() { int k,j; h g; k=test(j); return 0; } template class ConcreteStorageClass> class RotationMatrix : public StaticBaseMatrix { public: RotationMatrix() : StaticBaseMatrix() { // do some initialization } void assign(const OtherClass& other) { // do something } }; int main() { MyClass foo; } template< typename CharT, int N, typename Traits > inline std::basic_ostream& FWStreamOut(std::basic_ostream& os, const W::S& s) { return operator << >( os, s ); } struct foo { type1 < int& > bar; }; struct foo { type1 < int const > bar; }; template void f(); template void g() { f(); f< i >(); f(); f(); } void h() { g<42>(); } #include std::vector A(2); std::vector B; std::vector C(2); std::vector D; template struct X { template void operator ()(U); }; template class Y { template void f(V); }; void (* foobar)(void) = NULL; std::vector functions; #define MACRO( a ) a template < typename = int > class X; MACRO ( void f( X < >& x ) ); void g( X < >& x ); #include typedef std::vector > Table; // OK typedef std::vector > Flags; // Error void func(List = default_val1); void func(List > = default_val2); BLAH<(3.14 >= 42)> blah; void foo() { A<(X > Y)> a; a = static_cast >(ld); } template class X { /* ... */ }; X < 1 > 2 > x1; // Syntax error. X<(1 > 2)> x2; // Okay. template class Y { /* ... */ }; Y > x3; // Okay, same as "Y > x3;". Y < X<6> > 1 >> x4; // Syntax error. Instead, write "Y>1)>> x4;". Y> 1)> > x4; uncrustify-0.59/tests/output/cpp/30018-class-addr.h0000644000175000017500000000016611506773275016746 00000000000000class C { public: A *B; C& D; const C& D; static C& D; public C& D; E = C & D; }; uncrustify-0.59/tests/output/cpp/30932-indent_var_def_cont.cpp0000644000175000017500000000034211506773275021257 00000000000000int a, b, c; int d, e, f; void bar(void) { struct foobar a = { 'x', 0 }; struct foobar b = { 'y', 2 }, c = { 'z', 4 }; struct foobar d = { 'y', 2 }, e = { 'z', 4 }; } uncrustify-0.59/tests/output/cpp/30813-misc5.cpp0000644000175000017500000000037111506773275016305 00000000000000typedef std::list::iterator iterator; double foo() { if (a c) { throw int(); return(double()); } call_a_function(42, double(-1), "charray"); return(foo(n)); } uncrustify-0.59/tests/output/cpp/30805-ptr-star.cpp0000644000175000017500000000112411506773275017037 00000000000000int dx = m_ClipBox.GetWidth() * GetZoom(); m_ClipBox.m_Pos.y = PaintClipBox.y * GetZoom(); int* i; char* i; int MyFunc(std::string& s, char*) { char* c = const_cast(s.c_str()); } int YerFunc(std::string& s, char**) { char** c; int a = b[0] * c; } int* X(int* i, int*); int* i = &a; int* i = *b; int* i = &*c; int* Aclass::X(int* i, int*); class Aclass { int* X(int* i, int*); } extern "C" { int foo1(int* a); int foo2(sometype* a); } int bar1(int* a); int bar2(sometype* a); struct X { int* a; // 3:5 int f() { return *b; // 7:8 } int g() { return *c; // 11:8 } }; uncrustify-0.59/tests/output/cpp/30000-cout.cpp0000644000175000017500000000120311506773275016216 00000000000000void foo() { cout.setf(ios::showpoint); cout.setf(ios::floatfield, ios::fixed); what.the.hell.cout << "hello" << "world!" << "This" << "is a" << "test!"; *aaaaaa = (bbbbb(cccccPtr->ddd) & YYYYYYYYYYYYYYYYYYYYYYYY) | ((bbbbb(cccccPtr->nnnnnnnn) << ZZZZZZZZZZZZZZZZZZZZZZZZZZZ) & WWWWWWWWWWWWWWWWWWWWWWWWWW) | ((bbbbb(cccccPtr->hhhhhhhhhhhhhh) << FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) & EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE); } uncrustify-0.59/tests/output/cpp/30955-indent_ctor_init.cpp0000644000175000017500000000023011631561151020604 00000000000000struct MyClass { MyClass( int a, int b, int c) : m_a(a), m_b(b), m_c(c) {} private: int m_a, m_b, m_c; }; uncrustify-0.59/tests/output/cpp/30740-sef.cpp0000644000175000017500000000051011506773275016034 00000000000000CFoo::CFoo(const DWORD something, const RECT& positionRect, const UINT aNumber, bool thisIsReadOnly, const CString& windowTitle, CInfo* pStructInfo, int widthOfSomething) : CSuperFoo(something, positionRect, aNumber, thisIsReadOnly, windowTitle), m_pInfo(pInfo), m_width(widthOfSomething) { } uncrustify-0.59/tests/output/cpp/30055-nl_func.cpp0000644000175000017500000000052711630513606016676 00000000000000class BSRRE1D_file : PhysicalFile { int getFoo() { return(m_foo); } void setFoo(int foo) { m_foo = foo; } public BSRRE1D_file() { this.addFormatName("BSRRE1DF"); } private int m_foo; public void xxx() { ahoj(); } // comment public void yyy() { ahoj(); } /* comment 2 */ public void xxx() { ahoj(); } } uncrustify-0.59/tests/output/cpp/30902-region.cpp0000644000175000017500000000041611506773275016547 00000000000000class X : Y { int foo1; #pragma region something int foo2 = 2; #pragma endregion int foo() { #pragma region something else int foo3 = 3; #pragma region nested int foo4 = 0; #pragma endregion int foo5 = 0; #pragma endregion } } uncrustify-0.59/tests/output/cpp/30801-align-star-amp-pos.cpp0000644000175000017500000000160711506773275020700 00000000000000 /** First, the typedefs */ typedef int MY_INT; typedef int *MY_INTP; typedef int &MY_INTR; typedef CFoo &foo_ref_t; typedef int (*foo_t)(void *bar); typedef int (*somefunc_t)(void *barstool); /* Now, the types */ struct foo1 { unsigned int d_ino; const char *d_reclen; unsigned short d_namlen; char d_name[1]; CFoo &fref; }; struct foo { int a; char *b }; static int idx; static const char **tmp; CFoo &fref; static char buf[64]; static unsigned long how_long; // comment static int **tmp; static char buf[64]; void bar(int someval, void *puser, const char *filename, struct willy *the_list, int list_len) { int idx; const char **tmp; char buf[64]; CFoo &fref; unsigned long how_long; return(-1); } uncrustify-0.59/tests/output/cpp/30011-misc.cpp0000644000175000017500000000274111506773275016211 00000000000000 /* Not detected as a prototype? Spacing wrong. */ static struct my_entry *get_first_entry(const CHAR *blah); static CFooo::entry *get_next_entry(const CHAR *blah); static struct my_entry *get_next_entry(const CHAR *blah); /* Not handling prototype params: */ typedef void (*function_name)(my_t *p_my, int foo); typedef void (*function_name)(my_t *, int); typedef enum { one = 1, three = 3, five_hundred = 5, a_really_really_big_number = 6, two = 7, a_really_really_really_big_number = 8, } yuck_t; const char *names[] = { one = "one", three = "three", five_hundred = "five_hundred", a_really_really_big_number = "a_really_really_big_number", two = "two", a_really_really_really_big_number = "a_really_really_really_big_number", }; bool foo(char c) { xWindow *pWindow = ::RelatedWindow(); /* space between ] and ( */ function_list[idx](param); /* Indenting with multiple members: */ sass.asdfvas->asdfasd[asdfasdf]. asdfasdf = 5; dookie::wookie << "asd" << "bag" << "sag"; sp_sign = 4 - -5; sp_sign = -sp_sign; sp_sign = 4 + +7; sp_sign = +sp_sign; sp_sign = 4 + +sp_sign; } #ifndef abc #define abc 123 /* some comment */ #endif /* another comment uncrustify-0.59/tests/output/cpp/30711-semicolons.cpp0000644000175000017500000000164711506773275017444 00000000000000static int foo(int bar); static int foo(int bar) { for (;;) { break; } if (a) { foo(); } if (b) if (c) bar(); else ; else { foo(); } switch (a) { case 1: break; case 2: break; default: break; } while (b-->0) { bar(); } do { bar(); } while (b-->0 ); } enum FPP { FPP_ONE = 1, FPP_TWO = 2, }; struct narg { int abc; char def; const char *ghi; }; class CFooRun { long stick(); int bar() { m_ick++; } CFooRun(); ~CFooRun() { } }; void f() { if (tmp[0] == "disk") { tmp = split (tmp[1], ","); DiskEntry entry = { tmp[0], tmp[2], stxxl::int64 (str2int (tmp[1])) * stxxl::int64 (1024 * 1024) }; disks_props.push_back (entry); } } template < class > struct type; template < class T > class X { typedef type < T > base; void f () { ( base :: operator * () ); } }; namespace N { class C { #define NOP(x) { \ } }; } namespace N { class C { }; } uncrustify-0.59/tests/output/cpp/30842-nl_func_type_name.cpp0000644000175000017500000000115711506773275020757 00000000000000 // zero // one // two // three void foo(void); struct A { public: long_complicated_type f(); A& operator+(const A& other); }; A& A::operator+(const A& other) { } B operator+(const B& other) { } B foo(const B& other) { } class A { public: int aFunct() { return a; } int bFunc(); }; // Another file int A::bFunc() { // some code } template typename Foo::Type Foo::Func() { } void Foo::bar() { } namespace foo { Foo::Foo() { } } Foo::~Foo() { } class Object { ~Object(void); }; template void SampleClassTemplate::connect() { } uncrustify-0.59/tests/output/cpp/30845-deref.cpp0000644000175000017500000000066611506773275016366 00000000000000 myNewValue = something[arrayNumber] * someOtherValue; myNewValue = multidimentional[arrayNumber][anotherNumber] * someOtherValue; myNewValue = noArrayVariableWorksFine * someOtherValue; int func(int *thingy, volatile int *arrayThingy[NUMBER]); int func(int *thingy, volatile int *arrayThingy[NUMBER][anotherNumber]); int func(int *thingy, volatile int *noArrayThingyWorksFine); uncrustify-0.59/tests/output/cpp/30250-align_fcall.cpp0000644000175000017500000000027511506773275017516 00000000000000void foo() { abc( 1, 2, 3); abc( 10, 20, 30); abc(100, 200, 300); cab(3, 2, 1, 0); brat( "foo", 2000, 3000); brat("question", 2, -42); brat( "a", -22, 1); } uncrustify-0.59/tests/output/cpp/30203-cmt_indent.cpp0000644000175000017500000000110511506773275017376 00000000000000namespace { /* If we're in the middle of the original line, copy the string * only up to the cursor position into buf, so tab completion * will result in buf's containing only the tab-completed * path/filename. */ class Test { Test() {} ~Test() {} /** Call this method to * run the test * * \param n test number * \returns the test result */ bool Run(int n); /** Call this method to * stop the test * * \param n test number * \returns the test result */ bool Run(int n); }; } uncrustify-0.59/tests/output/cpp/30702-function-def.cpp0000644000175000017500000000167711506773275017655 00000000000000int & Function() { static int x; return (x); } void foo1(int param1, int param2, char *param2); void foo2(int param1, int param2, char *param2); void foo3(int param1, int param2, // comment char *param2); struct whoopee *foo4(int param1, int param2, char *param2 /* comment */); const struct snickers *foo5(int param1, int param2, char *param2); void foo(int param1, int param2, char *param2) { printf("boo!\n"); } int classname::method(); int classname::method() { foo(); } int classname::method2(); int classname::method2() { foo2(); } const int& className::method1(void) const { // stuff } const longtypename& className::method2(void) const { // stuff } int &foo(); int & foo() { list_for_each(a,b) { bar(a); } return nuts; } void Foo::bar() { } Foo::Foo() { } Foo::~Foo() { } void func(void) { Directory dir("arg"); } uncrustify-0.59/tests/output/cpp/30046-nl_func_decl.cpp0000644000175000017500000000031311506773275017672 00000000000000 void bla ( ); void ble ( int a, char b ); void ble2 ( int a, char b ); void bla() { } void bla2() { } void ble( int a, char b ) { } void ble2( int a, char b ) { } uncrustify-0.59/tests/output/cpp/30014-ctor-var.cpp0000644000175000017500000000007111506773275017010 00000000000000int foo() { TextBody textbody(GetBody().GetText()); } uncrustify-0.59/tests/output/cpp/30075-goto.cpp0000644000175000017500000000016711506773275016240 00000000000000#define x struct z #define max(a, b) ((a) > (b) ? (a) : (b)) void f() { goto p; p: goto q; q: goto p; } uncrustify-0.59/tests/output/cpp/30023-templates.cpp0000644000175000017500000000605011631037757017251 00000000000000#include #include #include #define MACRO(T) f() class MyClass { public: std::map someData; std::map > otherData; }; void foo() { List bob = new List(); } A foo; A bar; A baz; A > bay; void asd(void) { A foo; A bar; A baz; A > bay; if (a < b && b > c) { a = b < c > 0; } if (a c) { } a < up_lim() ? do_hi() : do_low; a[a < b > c] = d; } template class MyClass { } template class MyClass { } template class MyClass : myvar(0), myvar2(0) { } template class MyClass : myvar(0), myvar2(0) { } static int max_value() { return((std::numeric_limits::max)()); } template priority_queue::~priority_queue () { } template T test(T a) { return(a); } int main() { int k, j; h g; k = test(j); return(0); } template class ConcreteStorageClass> class RotationMatrix : public StaticBaseMatrix { public: RotationMatrix() : StaticBaseMatrix() { // do some initialization } void assign(const OtherClass& other) { // do something } }; int main() { MyClass foo; } template inline std::basic_ostream& FWStreamOut(std::basic_ostream&os, const W::S&s) { return(operator<< >(os, s)); } struct foo { type1 bar; }; struct foo { type1 bar; }; template void f(); template void g() { f(); f(); f(); f(); } void h() { g<42>(); } #include std::vector A(2); std::vector B; std::vector C(2); std::vector D; template struct X { template void operator()(U); }; template class Y { template void f(V); }; void (*foobar)(void) = NULL; std::vector functions; #define MACRO(a) a template class X; MACRO(void f(X<>& x)); void g(X<>& x); #include typedef std::vector > Table; // OK typedef std::vector > Flags; // Error void func(List =default_val1); void func(List > =default_val2); BLAH<(3.14 >= 42)> blah; void foo() { A<(X > Y)> a; a = static_cast >(ld); } template class X { /* ... */ }; X < 1 > 2 > x1; // Syntax error. X<(1 > 2)> x2; // Okay. template class Y { /* ... */ }; Y > x3; // Okay, same as "Y > x3;". Y < X<6> > 1 >> x4; // Syntax error. Instead, write "Y>1)>> x4;". Y> 1)> > x4; uncrustify-0.59/tests/output/cpp/30065-Example.h0000644000175000017500000000011211506773275016315 00000000000000class Example { Example() : member(0) { } int member; }; uncrustify-0.59/tests/output/cpp/30026-byref.cpp0000644000175000017500000000113711506773275016371 00000000000000bool foo(int &idx) { if (idx < m_count) { idx++; return m_bool[idx-1]; } return false; } class Foo { public: Foo(); Foo(const Foo &f); }; class NS::Foo { public: Foo(Bar &b); }; template< class T > class ListManager { protected: T head; public: ListManager() { head.next = head.prev = &head; } ListManager(const ListManager &ref) { head.next = head.prev = &head; } } const Foo &Foo::operator ==(Foo &me){ ::sockaddr* ptr = (::sockaddr*)&host; return me; } MyType &MyClass::myMethode() { const MyType &t = getSomewhere(); } uncrustify-0.59/tests/output/pawn/0000755000175000017500000000000011506773275014347 500000000000000uncrustify-0.59/tests/output/pawn/60002-traffic.p0000644000175000017500000000150711506773275016536 00000000000000/* traffic light synchronizer, using states in an event-driven model */ #include

The value can be retrieved by calling the get method * with a key that is equal to the original key. * * @param key the table key. * @param value the value. * @return the previous value of the specified key in this table, * or null if it did not have one. * @throws NullPointerException if the key or value is * null. */ public V put(K key, V value) { assert(value); uint hash = hash(key); return segmentFor(hash).put(key, hash, value, false); } /** * If the specified key is not already associated * with a value, associate it with the given value. * This is equivalent to *

     *   if (!map.containsKey(key))
     *      return map.put(key, value);
     *   else
     *      return map.get(key);
     * 
* Except that the action is performed atomically. * @param key key with which the specified value is to be associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or null * if there was no mapping for key. * @throws NullPointerException if the specified key or value is * null. */ public V putIfAbsent(K key, V value) { assert(value); uint hash = hash(key); return segmentFor(hash).put(key, hash, value, true); } /** * Removes the key (and its corresponding value) from this * table. This method does nothing if the key is not in the table. * * @param key the key that needs to be removed. * @return the value to which the key had been mapped in this table, * or null if the key did not have a mapping. * @throws NullPointerException if the key is * null. */ public V remove(K key) { uint hash = hash(key); return segmentFor(hash).remove(key, hash, null); } /** * Remove entry for key only if currently mapped to given value. * Acts as *
     *  if (map.get(key).equals(value)) {
     *     map.remove(key);
     *     return true;
     * } else return false;
     * 
* except that the action is performed atomically. * @param key key with which the specified value is associated. * @param value value associated with the specified key. * @return true if the value was removed * @throws NullPointerException if the specified key is * null. */ public bool remove(K key, V value) { uint hash = hash(key); return cast(bool)(segmentFor(hash).remove(key, hash, value) !is null); } /** * Replace entry for key only if currently mapped to some value. * Acts as *
     *  if ((map.containsKey(key)) {
     *     return map.put(key, value);
     * } else return null;
     * 
* except that the action is performed atomically. * @param key key with which the specified value is associated. * @param value value to be associated with the specified key. * @return previous value associated with specified key, or null * if there was no mapping for key. * @throws NullPointerException if the specified key or value is * null. */ public V replace(K key, V value) { assert(value); uint hash = hash(key); return segmentFor(hash).replace(key, hash, value); } /** * Removes all mappings from this map. */ public void clear() { for (int i = 0; i < segments.length; ++i) segments[i].clear(); } /** * Returns an enumeration of the keys in this table. * * @return an enumeration of the keys in this table. * @see #keySet */ public KeyIterator keys() { return new KeyIterator(this); } /** * Returns an enumeration of the values in this table. * * @return an enumeration of the values in this table. * @see #values */ public ValueIterator elements() { return new ValueIterator(this); } /********************************************************************** Iterate over all keys in hashmap **********************************************************************/ int opApply(int delegate(inout char[]) dg) { int result = 0; KeyIterator iterator = keys(); while (iterator.hasNext) { char[] ca = cast(char[])iterator.next; if ((result = dg(ca)) != 0) break; } return result; } /********************************************************************** Iterate over all keys in hashmap **********************************************************************/ int opApply(int delegate(inout char[], inout Object) dg) { int result = 0; KeyIterator iterator = keys(); while (iterator.hasNext) { HashEntry he = iterator.nextElement; char[] ca = cast(char[])he.key; if ((result = dg(ca, he.value)) != 0) break; } return result; } /* ---------------- Iterator Support -------------- */ abstract static class HashIterator { int nextSegmentIndex; int nextTableIndex; HashEntry[] currentTable; HashEntry nextEntry; HashEntry lastReturned; HashMap map; this(HashMap map) { this.map = map; nextSegmentIndex = map.segments.length - 1; nextTableIndex = -1; advance(); } final void advance() { if (nextEntry !is null && (nextEntry = nextEntry.next) !is null) return; while (nextTableIndex >= 0) { if ((nextEntry = currentTable[nextTableIndex--]) !is null) return; } while (nextSegmentIndex >= 0) { Segment seg = map.segments[nextSegmentIndex--]; volatile if (seg.count) { currentTable = seg.table; for (int j = currentTable.length - 1; j >= 0; --j) { if ((nextEntry = currentTable[j]) !is null) { nextTableIndex = j - 1; return; } } } } } public bool hasNext() { return cast(bool)(nextEntry !is null); } HashEntry nextElement() { if (nextEntry is null) throw new Exception("no such element in HashMap"); lastReturned = nextEntry; advance(); return lastReturned; } } static class KeyIterator : HashIterator { this(HashMap map) { super(map); } public K next() { return super.nextElement().key; } } static class ValueIterator : HashIterator { this(HashMap map) { super(map); } public V next() { volatile return super.nextElement().value; } } } uncrustify-0.59/tests/output/d/40002-volatile.d0000644000175000017500000000121111506773275016167 00000000000000void foo(void) { while (nextSegmentIndex >= 0) { Segment seg = map.segments[nextSegmentIndex--]; volatile if (seg.count) { currentTable = seg.table; for (int j = currentTable.length - 1; j >= 0; --j) { if ((nextEntry = currentTable[j]) !is null) { nextTableIndex = j - 1; return; } } } } if (e) volatile { oldValue = e.value; e.value = newValue; } return oldValue; } uncrustify-0.59/tests/output/d/40060-casts.d0000644000175000017500000000034211506773275015475 00000000000000void foo(int a) { char ch; ch = cast(char)a; ch = cast(char)45; ch = (char)a; // not a d cast ch = (int) 45; ch = cast(foo)*bar; ch = cast(foo)-bar; ch = cast(foo)+45; ch = cast(foo)&45; } uncrustify-0.59/tests/output/d/40023-bug-indent.d0000644000175000017500000000045411506773275016417 00000000000000class C { //--------------| <= (1) Axxxxxxxxxxxxxxxx.A createAssignment() { return(null); } void func2() { foreach (v; container) { v.f(); } } // | <= (2) void func3(TemplType!(T) aValue) { } } uncrustify-0.59/tests/output/d/40040-sort_import.d0000644000175000017500000000046011506773275016740 00000000000000// should be ddd, eee, fff import ddd; import eee; import fff; // should be aaa, ccc import aaa; import ccc; // should be just bbb import bbb; // should not change these, as it can't handle multi-line imports private import mango.ccc; private import mango.bbb, mango.aaa; void foo(); uncrustify-0.59/tests/output/ecma/0000755000175000017500000000000011506773275014307 500000000000000uncrustify-0.59/tests/output/ecma/90000-example-1.es0000644000175000017500000000046511506773275017024 00000000000000x = 0; // A global variable var y = 'Hello!'; // Another global variable function f() { var z = 'foxes'; // A local variable twenty = 20; // Global because keyword var is not used return(x); // We can use x here because it is global } // The value of z is no longer available uncrustify-0.59/aclocal.m40000644000175000017500000011065711642741010012451 00000000000000# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, [m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # (`yes' being less verbose, `no' or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [ --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0')]) case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR uncrustify-0.59/AUTHORS0000644000175000017500000000003211506773275011663 000000000000002005 - .... : Ben Gardner uncrustify-0.59/make_win32.sh0000644000175000017500000000160311506773275013113 00000000000000#! /bin/sh # # Builds the release zip for Windows using mingw # On ubuntu, you'll need to install the mingw32 package. # # grab the version - there is probably an easier way... VERSION=`grep '#define UNCRUSTIFY_VERSION ' src/uncrustify_version.h | \ sed -e "s/#define UNCRUSTIFY_VERSION//" -e 's/\"//g' -e 's/ //g'` VERDIR=uncrustify-$VERSION-win32 RELDIR=../release THEZIP=$RELDIR/$VERDIR.zip echo "Building version $VERSION for Win32" ./configure --host=i586-mingw32msvc make clean make if [ -e $VERDIR ] ; then rm -rf $VERDIR fi mkdir $VERDIR cp src/uncrustify.exe $VERDIR/ cp etc/*.cfg $VERDIR/ cp ChangeLog $VERDIR/ cp documentation/htdocs/index.html $VERDIR/ strip $VERDIR/uncrustify.exe if ! [ -e $RELDIR ] ; then mkdir $RELDIR fi [ -e $THEZIP ] && rm -f $THEZIP zip -r9 $THEZIP $VERDIR echo "Stored in $THEZIP" uncrustify-0.59/configure.in0000644000175000017500000000265411642735107013131 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT(uncrustify, 0.59,,,http://uncrustify.sourceforge.net/) enable_silent_rules=${enable_silent_rules-yes} AM_INIT_AUTOMAKE([-Wall silent-rules]) AM_MAINTAINER_MODE AC_CONFIG_SRCDIR([src/uncrustify.cpp]) AC_CONFIG_HEADER([src/config.h]) # Checks for programs. AC_PROG_CXX AC_PROG_CC # Checks for libraries. # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([inttypes.h stdint.h]) AC_CHECK_HEADERS([utime.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_C_CONST AC_C_INLINE # Checks for library functions. AC_FUNC_MEMCMP AC_CHECK_FUNCS([memset strcasecmp strchr strdup strerror strtol strtoul]) AC_MSG_CHECKING([whether our compiler supports __func__]) AC_TRY_COMPILE([], [const char *cp = __func__], AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]) AC_MSG_CHECKING([whether our compiler supports __FUNCTION__]) AC_TRY_COMPILE([], [const char *cp = __FUNCTION__], AC_MSG_RESULT([yes]) AC_DEFINE(__func__, __FUNCTION__, [Define to appropriate substitue if compiler doesnt have __func__]), AC_MSG_RESULT([no]) AC_DEFINE(__func__, __FILE__, [Define to appropriate substitue if compiler doesnt have __func__]))) AC_CONFIG_FILES([Makefile src/Makefile man/Makefile man/uncrustify.1 src/uncrustify_version.h]) AC_OUTPUT uncrustify-0.59/README0000644000175000017500000000446311506773275011507 00000000000000README for Uncrustify ===================== Building the program -------------------- Quick start: $ ./configure $ make The executable is src/uncrustify. Copy that to your ~/bin/ folder or wherever you want. Building the program using Xcode on Mac OS X --------------------------------------------- You can of course just open the Xcode project and build uncrustify using the default 'Debug' configuration but if you want to install it the 'Install' configuration will not work from within Xcode. For that you will have to use the Xcode command line tool 'xcodebuild'. To do that, cd into the uncrustify project folder where uncrustify.xcodeproj resides and enter the following command: sudo xcodebuild -configuration 'Install' You will be prompted for the root level password. By doing this you will install uncrustify into /usr/local/bin. The install location can be changed by editing the Build Settings for the uncrustify target. The setting you need to change is called, surprisingly enough, 'Installation Directory'. Configuring the program ----------------------- Examine the example config files in etc and/or read documentation/htdocs/configuration.txt. Copy the existing config file that closely matches your style and put in ~/.uncrustify/. Modify to your liking. Running the program (and refining your style) --------------------------------------------- As of the current release, I don't particularly trust this program to not make mistakes and screw up my whitespace formatting. Here's how to run it: $ uncrustify -c ~/.uncrustify/mystyle.cfg -f somefile.c > somefile.c.unc The -c option selects the configuration file. The -f option specifies the input file. The output is sent to stdout. Error messages are sent to stderr. Use a quality side-by-side diff tool to determine if the program did what you wanted. Repeat until your style is refined. Running the program (once you've found your style) -------------------------------------------------- Write a script to automate the above. Check out etc/dofiles.sh for an example. That script is used as follows: 1. navigate one level above your project 2. make a list of file to process $ find myproj -name "*.[ch]" > files.txt 3. sh etc/dofiles.sh files.txt 4. Use your favorite diff/merge program to merge in the changes $ xxdiff out/myproj myproj uncrustify-0.59/config.sub0000755000175000017500000007170411506773275012614 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-11-30' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa64 | mipsisa64el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39 | mipstx39el \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3d) basic_machine=alpha-cray os=-unicos ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic4x | c4x*) basic_machine=tic4x-unknown os=-coff ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: uncrustify-0.59/osx/0000755000175000017500000000000011506773275011511 500000000000000uncrustify-0.59/osx/Xcode Organizer Actions.xccommands0000644000175000017500000001032111506773275020050 00000000000000// !$*UTF8*$! { commands = ( { directory = .; name = make; script = "#!/bin/sh\n./configure\nmake\n"; type = other; }, { directory = .; name = "Build uncrustify with configuration Debug"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration Debug build\n"; type = build; }, { directory = .; name = "Build uncrustify with configuration Release"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration Release build\n"; type = build; }, { directory = .; name = "Build uncrustify with configuration Install (xcodebuild only!)"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration \"Install (xcodebuild only!)\" build\n"; type = build; }, { directory = .; name = "Clean uncrustify with configuration Debug"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration Debug clean\n"; type = clean; }, { directory = .; name = "Clean uncrustify with configuration Release"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration Release clean\n"; type = clean; }, { directory = .; name = "Clean uncrustify with configuration Install (xcodebuild only!)"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration \"Install (xcodebuild only!)\" clean\n"; type = clean; }, { directory = selection; name = "----"; type = clean; }, { directory = .; name = "Clean All in uncrustify with configuration Debug"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration Debug -alltargets clean\n"; type = clean; }, { directory = .; name = "Clean All in uncrustify with configuration Release"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration Release -alltargets clean\n"; type = clean; }, { directory = .; name = "Clean All in uncrustify with configuration Install (xcodebuild only!)"; script = "#!/bin/sh\n\nxcodebuild -project uncrustify.xcodeproj -configuration \"Install (xcodebuild only!)\" -alltargets clean\n"; type = clean; }, { arguments = "-l oc+ -c $SOURCE_ROOT/etc/objc.cfg -q -f $SOURCE_ROOT/tests/input/oc/Fraction.m"; directory = .; name = "Run uncrustify from uncrustify with configuration Debug"; script = "/Users/andre/Documents/Xcode/CommandLineUtility/C++Tool/uncrustify/build/Debug/uncrustify"; type = run; }, { arguments = "-l oc+ -c $SOURCE_ROOT/etc/objc.cfg -q -f $SOURCE_ROOT/tests/input/oc/Fraction.m"; directory = .; name = "Run uncrustify from uncrustify with configuration Release"; script = "/Users/andre/Documents/Xcode/CommandLineUtility/C++Tool/uncrustify/build/Release/uncrustify"; type = run; }, { arguments = "-l oc+ -c $SOURCE_ROOT/etc/objc.cfg -q -f $SOURCE_ROOT/tests/input/oc/Fraction.m"; directory = .; name = "Run uncrustify from uncrustify with configuration Install (xcodebuild only!)"; script = "/Users/andre/Documents/Xcode/CommandLineUtility/C++Tool/uncrustify/build/Install (xcodebuild only!)/uncrustify"; type = run; }, { directory = selection; name = "----"; type = run; }, { arguments = "-l oc+ -c $SOURCE_ROOT/etc/objc.cfg -q -f $SOURCE_ROOT/tests/input/oc/Fraction.m"; debugger = gdb; directory = .; name = "Debug uncrustify from uncrustify with configuration Debug"; script = "/Users/andre/Documents/Xcode/CommandLineUtility/C++Tool/uncrustify/build/Debug/uncrustify"; type = run; }, { arguments = "-l oc+ -c $SOURCE_ROOT/etc/objc.cfg -q -f $SOURCE_ROOT/tests/input/oc/Fraction.m"; debugger = gdb; directory = .; name = "Debug uncrustify from uncrustify with configuration Release"; script = "/Users/andre/Documents/Xcode/CommandLineUtility/C++Tool/uncrustify/build/Release/uncrustify"; type = run; }, { arguments = "-l oc+ -c $SOURCE_ROOT/etc/objc.cfg -q -f $SOURCE_ROOT/tests/input/oc/Fraction.m"; debugger = gdb; directory = .; name = "Debug uncrustify from uncrustify with configuration Install (xcodebuild only!)"; script = "/Users/andre/Documents/Xcode/CommandLineUtility/C++Tool/uncrustify/build/Install (xcodebuild only!)/uncrustify"; type = run; }, ); } uncrustify-0.59/scripts/0000755000175000017500000000000011506773275012367 500000000000000uncrustify-0.59/scripts/cmpcfg.pl0000755000175000017500000000561711506773275014117 00000000000000#!/usr/bin/perl # # Copyright (c) 2006 David Thompson # da.thompson@yahoo.com # Fri Nov 17 20:41:23 PST 2006 # License: GPL # Purpose of this script is to process config files and # produce a comparision chart of values. The input files # are simple series of parameter definitions, of the form # 'name=value' pairs, whitespace and comments are correctly # ignored. Invoke on multiple config files to compare # parameter values for all files, try this, # cd /usr/local/share/uncrustify # cmpcfg.pl *.cfg # first build hashes from all input files # 1. %name is a master hash of all parameter names found # across all files, we use a hash to remember the keys, # we don't compare about the values stored for each key # 2. %table is a per file 2 dimensional hash array indexed # by the current filename and parameter; ie, this hash # stores the 'name=value' pairs on per file basis foreach my $file (@ARGV) { open FH, "<$file" or die "Can't open file: $file"; while () { chomp; next if (/^[ \t]*$/); # ignore blank lines next if (/^[ \t]*#/); # ignore comment lines s/#.*$//; # strip trailing comments s/^[ \t]*//; # strip leading whitespace s/[ \t]*$//; # strip trailing whitespace s/[ \t]*=[ \t]*/=/; # remove whitespace around '=' $_ = lc; # lowercase everything ($name, $value) = split /=/; # extract name and value $names{$name} = $name; # master hash of all names $table{$file}{$name} = $value; # per file hash of names } close FH; } # find longest parameter name # we'll use this later for report printing foreach $name (sort keys %names) { if (length($name) > $maxlen) { $maxlen = length($name); } } $maxlen += 4; # add extra padding # return string centered in specified width sub center { ($wid, $str) = @_; $flg = 0; while (length($str) < $wid) { if ($flg) { $flg = 0; $str = " " . $str; } else { $flg = 1; $str = $str . " "; } } return $str; } # print legend for filenames $cnt = 0; foreach $file (@ARGV) { $cnt++; print " <$cnt> $file\n"; } # blank line separates legend & header print "\n"; # print header line print " " x $maxlen . " "; $cnt = 0; foreach (@ARGV) { $cnt++; $fmt = "<$cnt>"; print " ".¢er(6, $fmt); } print "\n"; # print body of report, one line per parameter name foreach $name (sort keys %names) { printf "%-*s ", $maxlen, $name; foreach $file (@ARGV) { if (defined($table{$file}{$name})) { print " ".¢er(6, $table{$file}{$name}); } else { # parameter not defined for this file print " ".¢er(6, "*"); } } print "\n"; } uncrustify-0.59/scripts/update-defaults.sh0000755000175000017500000000021111506773275015727 00000000000000#! /bin/sh src/uncrustify -c /dev/null --update-config-with-doc > etc/defaults.cfg cp etc/defaults.cfg documentation/htdocs/default.cfg uncrustify-0.59/scripts/check_options.py0000644000175000017500000000312111506773275015506 00000000000000#! /usr/bin/env python # # Check the option usage. # Make sure the union member matches the option type. # import sys, os, fnmatch # just use the first letter of the member name - should be unique opt_suffix = { 'b' : 'AT_BOOL', 'a' : 'AT_IARF', 'n' : 'AT_NUM', 'l' : 'AT_LINE', 't' : 'AT_POS' } opts = { } def check_file (fn): problems = 0 fd = open(fn, 'r') line_no = 0 for line in fd: line_no = line_no + 1 cpd = line.find('cpd.settings[UO_') if cpd > 0: sb = line[cpd:].find(']') opt = line[cpd + 13 : cpd + sb] mem = line[cpd + sb + 2] if opt in opts and mem in opt_suffix: if opts[opt] != opt_suffix[mem]: print fn + '[%d]' % (line_no) , opt, 'should use', opts[opt], 'not', opt_suffix[mem] problems += 1 return problems def main (argv): # Read in all the options of = open(os.path.join('src', 'options.cpp'), 'r'); for line in of: if line.find('unc_add_option') > 0 and line.find('UO_') > 0: ps = line.split(',') if len(ps) >= 3: opts[ps[1].strip()] = ps[2].strip() of.close() # Get a list of all the source files ld = os.listdir('src') src_files = fnmatch.filter(ld, '*.cpp') src_files.extend(fnmatch.filter(ld, '*.h')) # Check each source file problems = 0 for fn in src_files: problems += check_file(os.path.join('src', fn)) if problems == 0: print 'No problems found' if __name__ == '__main__': main(sys.argv) uncrustify-0.59/scripts/punc.py0000755000175000017500000000471011506773275013633 00000000000000#! /usr/bin/env python # # Creates a possibly faster lookup table for tokens, etc. # # @author Ben Gardner # @license GPL v2+ # def scan_file (filename): fh = open(filename, 'r') lines = fh.readlines() cur_token = '' token_idx = 0 args = [] for line in lines: line = line.strip() if line.startswith('static const chunk_tag_t'): idx = line.find('[') if idx > 0: cur_token = line[25:idx].strip() token_idx = 0 else: if len(cur_token) > 0: idx1 = line.find('{') idx2 = line.find('CT_') if idx1 >= 0 and idx2 > idx1: tok = line[idx1 + 1:idx2].strip() tok = tok[1:-2] # strip off open quotes and commas args.append([tok, "%s[%d]" % (cur_token, token_idx)]) token_idx += 1 return args def build_table (db, prev, arr): start_idx = len(arr) # do the current level first k = db.keys(); if len(k) <= 0: return k.sort() num_left = len(k) for i in k: did_one = 1 en = db[i] # [ char, full-string, left-in-group, next_index, table-entry ] num_left -= 1 arr.append([en[0], prev + en[0], num_left, 0, en[2]]) # update the one-up level index if len(prev) > 0: for idx in range(0, len(arr)): if arr[idx][1] == prev: arr[idx][3] = start_idx break # Now do each sub level for i in k: en = db[i] build_table(en[3], prev + en[0], arr) def add_to_db(entry, db_top): """ find or create the entry for the first char """ str = entry[0] db_cur = db_top for idx in range(0, len(str)): if not str[idx] in db_cur: db_cur[str[idx]] = [ str[idx], 0, None, {} ] dbe = db_cur[str[idx]] if idx == len(str) - 1: dbe[2] = entry else: db_cur = dbe[3] if __name__ == '__main__': pl = scan_file('src/punctuators.cpp') pl.sort() db = {} for a in pl: add_to_db(a, db) arr = [] build_table(db, '', arr) idx = 0 print "/**" print " * @file punctuators.h" print " * Automatically generated" print " */" print "static const lookup_entry_t punc_table[] =" print "{" max_len = 0 for i in arr: rec = i[4] if rec != None and len(rec[1]) > max_len: max_len = len(rec[1]) for i in arr: rec = i[4] if len(i[0]) == 0: print " { 0, 0, 0, NULL %s }, // %3d:" % ((max_len - 4) * ' ', idx) elif rec == None: print " { '%s', %2d, %2d, NULL %s }, // %3d: '%s'" % (i[0], i[2], i[3], (max_len - 4) * ' ', idx, i[1]) else: print " { '%s', %2d, %2d, &%s%s }, // %3d: '%s'" % (i[0], i[2], i[3], rec[1], (max_len - len(rec[1])) * ' ', idx, i[1]) idx += 1 print '};' uncrustify-0.59/scripts/tokenize.py0000755000175000017500000002207111506773275014516 00000000000000#! /usr/bin/env python # tokenize.py # # Parses a C/C++/C#/D/Java/Pawn/whatever file in an array of # tuples (string, type) # # punctuator lookup table punc_table = [ [ '!', 25, 26, '!' ], # 0: '!' [ '#', 24, 35, '#' ], # 1: '#' [ '$', 23, 0, '$' ], # 2: '$' [ '%', 22, 36, '%' ], # 3: '%' [ '&', 21, 41, '&' ], # 4: '&' [ '(', 20, 0, '(' ], # 5: '(' [ ')', 19, 0, ')' ], # 6: ')' [ '*', 18, 43, '*' ], # 7: '*' [ '+', 17, 44, '+' ], # 8: '+' [ ',', 16, 0, ',' ], # 9: ',' [ '-', 15, 46, '-' ], # 10: '-' [ '.', 14, 50, '.' ], # 11: '.' [ '/', 13, 53, '/' ], # 12: '/' [ ':', 12, 54, ':' ], # 13: ':' [ ';', 11, 0, ';' ], # 14: ';' [ '<', 10, 56, '<' ], # 15: '<' [ '=', 9, 63, '=' ], # 16: '=' [ '>', 8, 65, '>' ], # 17: '>' [ '?', 7, 0, '?' ], # 18: '?' [ '[', 6, 70, '[' ], # 19: '[' [ ']', 5, 0, ']' ], # 20: ']' [ '^', 4, 71, '^' ], # 21: '^' [ '{', 3, 0, '{' ], # 22: '{' [ '|', 2, 72, '|' ], # 23: '|' [ '}', 1, 0, '}' ], # 24: '}' [ '~', 0, 74, '~' ], # 25: '~' [ '<', 3, 30, '!<' ], # 26: '!<' [ '=', 2, 33, '!=' ], # 27: '!=' [ '>', 1, 34, '!>' ], # 28: '!>' [ '~', 0, 0, '!~' ], # 29: '!~' [ '=', 1, 0, '!<=' ], # 30: '!<=' [ '>', 0, 32, '!<>' ], # 31: '!<>' [ '=', 0, 0, '!<>='], # 32: '!<>=' [ '=', 0, 0, '!==' ], # 33: '!==' [ '=', 0, 0, '!>=' ], # 34: '!>=' [ '#', 0, 0, '##' ], # 35: '##' [ ':', 2, 39, '%:' ], # 36: '%:' [ '=', 1, 0, '%=' ], # 37: '%=' [ '>', 0, 0, '%>' ], # 38: '%>' [ '%', 0, 40, None ], # 39: '%:%' [ ':', 0, 0, '%:%:'], # 40: '%:%:' [ '&', 1, 0, '&&' ], # 41: '&&' [ '=', 0, 0, '&=' ], # 42: '&=' [ '=', 0, 0, '*=' ], # 43: '*=' [ '+', 1, 0, '++' ], # 44: '++' [ '=', 0, 0, '+=' ], # 45: '+=' [ '-', 2, 0, '--' ], # 46: '--' [ '=', 1, 0, '-=' ], # 47: '-=' [ '>', 0, 49, '->' ], # 48: '->' [ '*', 0, 0, '->*' ], # 49: '->*' [ '*', 1, 0, '.*' ], # 50: '.*' [ '.', 0, 52, '..' ], # 51: '..' [ '.', 0, 0, '...' ], # 52: '...' [ '=', 0, 0, '/=' ], # 53: '/=' [ ':', 1, 0, '::' ], # 54: '::' [ '>', 0, 0, ':>' ], # 55: ':>' [ '%', 4, 0, '<%' ], # 56: '<%' [ ':', 3, 0, '<:' ], # 57: '<:' [ '<', 2, 61, '<<' ], # 58: '<<' [ '=', 1, 0, '<=' ], # 59: '<=' [ '>', 0, 62, '<>' ], # 60: '<>' [ '=', 0, 0, '<<=' ], # 61: '<<=' [ '=', 0, 0, '<>=' ], # 62: '<>=' [ '=', 0, 64, '==' ], # 63: '==' [ '=', 0, 0, '===' ], # 64: '===' [ '=', 1, 0, '>=' ], # 65: '>=' [ '>', 0, 67, '>>' ], # 66: '>>' [ '=', 1, 0, '>>=' ], # 67: '>>=' [ '>', 0, 69, '>>>' ], # 68: '>>>' [ '=', 0, 0, '>>>='], # 69: '>>>=' [ ']', 0, 0, '[]' ], # 70: '[]' [ '=', 0, 0, '^=' ], # 71: '^=' [ '=', 1, 0, '|=' ], # 72: '|=' [ '|', 0, 0, '||' ], # 73: '||' [ '=', 1, 0, '~=' ], # 74: '~=' [ '~', 0, 0, '~~' ], # 75: '~~' ] # # Token types: # 0 = newline # 1 = punctuator # 2 = integer # 3 = float # 4 = string # 5 = identifier # class tokenizer: def __init__(self): self.tokens = [] self.text = '' self.text_idx = 0 def tokenize_text (self, in_text): self.tokens = [] self.text = in_text self.text_idx = 0 print in_text try: while self.text_idx < len(self.text): if self.parse_whitespace(): continue elif self.text[self.text_idx] == '\\' and self.text[self.text_idx + 1] == '\n': self.text_idx += 2 continue elif self.parse_comment(): continue elif self.parse_number(): continue elif self.parse_identifier(): continue elif self.parse_string(): continue elif self.parse_punctuator(): continue else: print 'confused:', self.text[self.text_idx:] break except: print 'bombed' raise def parse_whitespace(self): start_idx = self.text_idx hit_newline = False while self.text_idx < len(self.text): if self.text[self.text_idx] in '\n\r': hit_newline = True elif not self.text[self.text_idx] in ' \t': break self.text_idx += 1 if hit_newline: self.tokens.append(('\n', 0)) return start_idx != self.text_idx def parse_comment(self): if not self.text[self.text_idx] == '/' or not self.text[self.text_idx + 1] in '/*': return False if self.text[self.text_idx + 1] == '/': while self.text_idx < len(self.text): if self.text[self.text_idx] in '\n\r': break; self.text_idx += 1 else: while self.text_idx < len(self.text) - 1: if self.text[self.text_idx] == '*' and self.text[self.text_idx + 1] == '/': self.text_idx += 2 break; self.text_idx += 1 return True def parse_identifier(self): if not self.text[self.text_idx].upper() in '@_ABCDEFGHIJKLMNOPQRSTUVWXYZ': return False start_idx = self.text_idx while self.text_idx < len(self.text) and self.text[self.text_idx].upper() in '@_ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890': self.text_idx += 1 self.tokens.append((self.text[start_idx : self.text_idx], 5)) return True def parse_string(self): starter = 0 start_ch = self.text[self.text_idx] if start_ch == 'L': starter = 1 start_ch = self.text[self.text_idx + 1] if not start_ch in '"\'': return False start_idx = self.text_idx self.text_idx += starter + 1 escaped = False while self.text_idx < len(self.text): if escaped: escaped = False else: if self.text[self.text_idx] == '\\': escaped = True elif self.text[self.text_idx] == start_ch: self.text_idx += 1 break; self.text_idx += 1 self.tokens.append((self.text[start_idx : self.text_idx], 4)) return True # Checks for punctuators # Returns whether a punctuator was consumed (True or False) def parse_punctuator(self): tab_idx = 0 punc_len = 0 saved_punc = None while 1: pte = punc_table[tab_idx] if pte[0] == self.text[self.text_idx]: if pte[3] != None: saved_punc = pte[3] self.text_idx += 1 tab_idx = pte[2] if tab_idx == 0: break elif pte[1] == 0: break else: tab_idx += 1 if saved_punc != None: self.tokens.append((saved_punc, 1)) return True return False def parse_number(self): # A number must start with a digit or a dot followed by a digit ch = self.text[self.text_idx] if not ch.isdigit() and (ch != '.' or not self.text[self.text_idx + 1].isdigit()): return False; token_type = 2 # integer if (ch == '.'): token_type = 3 # float did_hex = False; start_idx = self.text_idx # Check for Hex, Octal, or Binary # Note that only D and Pawn support binary, but who cares? # if ch == '0': self.text_idx += 1 ch = self.text[self.text_idx].upper() if ch == 'X': # hex did_hex = True self.text_idx += 1 while self.text[self.text_idx] in '_0123456789abcdefABCDEF': self.text_idx += 1 elif ch == 'B': # binary self.text_idx += 1 while self.text[self.text_idx] in '_01': self.text_idx += 1 elif ch >= '0' and ch <= 7: # octal (but allow decimal) self.text_idx += 1 while self.text[self.text_idx] in '_0123456789': self.text_idx += 1 else: # either just 0 or 0.1 or 0UL, etc pass else: # Regular int or float while self.text[self.text_idx] in '_0123456789': self.text_idx += 1 # Check if we stopped on a decimal point if self.text[self.text_idx] == '.': self.text_idx += 1 token_type = 3 # float if did_hex: while self.text[self.text_idx] in '_0123456789abcdefABCDEF': self.text_idx += 1 else: while self.text[self.text_idx] in '_0123456789': self.text_idx += 1 # Check exponent # Valid exponents per language (not that it matters): # C/C++/D/Java: eEpP # C#/Pawn: eE if self.text[self.text_idx] in 'eEpP': token_type = 3 # float self.text_idx += 1 if self.text[self.text_idx] in '+-': self.text_idx += 1 while self.text[self.text_idx] in '_0123456789': self.text_idx += 1 # Check the suffixes # Valid suffixes per language (not that it matters): # Integer Float # C/C++: uUlL lLfF # C#: uUlL fFdDMm # D: uUL ifFL # Java: lL fFdD # Pawn: (none) (none) # # Note that i, f, d, and m only appear in floats. while 1: if self.text[self.text_idx] in 'tTfFdDmM': token_type = 3 # float elif not self.text[self.text_idx] in 'lLuU': break; self.text_idx += 1 self.tokens.append((self.text[start_idx : self.text_idx], token_type)) return True text = """ 1.23+4-3*16%2 *sin(1.e-3 + .5p32) "hello" and "hello\\"there" 123 // some comment a = b + c; #define abc \\ 5 d = 5 /* hello */ + 3; """ t=tokenizer() t.tokenize_text(text) print t.tokens uncrustify-0.59/INSTALL0000644000175000017500000002202411506773275011651 00000000000000Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. uncrustify-0.59/uncrustify.xcodeproj/0000755000175000017500000000000011630456671015103 500000000000000uncrustify-0.59/uncrustify.xcodeproj/project.pbxproj0000644000175000017500000071747211630456671020121 00000000000000// !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 45; objects = { /* Begin PBXBuildFile section */ 65536847107EB7FA00E08A01 /* align.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553680F107EB7FA00E08A01 /* align.cpp */; }; 65536848107EB7FA00E08A01 /* align_stack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536810107EB7FA00E08A01 /* align_stack.cpp */; }; 65536849107EB7FA00E08A01 /* args.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536812107EB7FA00E08A01 /* args.cpp */; }; 6553684A107EB7FA00E08A01 /* backup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536814107EB7FA00E08A01 /* backup.cpp */; }; 6553684B107EB7FA00E08A01 /* brace_cleanup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536817107EB7FA00E08A01 /* brace_cleanup.cpp */; }; 6553684C107EB7FA00E08A01 /* braces.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536818107EB7FA00E08A01 /* braces.cpp */; }; 6553684D107EB7FA00E08A01 /* chunk_list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553681A107EB7FA00E08A01 /* chunk_list.cpp */; }; 6553684E107EB7FA00E08A01 /* ChunkStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553681C107EB7FA00E08A01 /* ChunkStack.cpp */; }; 6553684F107EB7FA00E08A01 /* combine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553681E107EB7FA00E08A01 /* combine.cpp */; }; 65536851107EB7FA00E08A01 /* defines.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536822107EB7FA00E08A01 /* defines.cpp */; }; 65536852107EB7FA00E08A01 /* detect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536823107EB7FA00E08A01 /* detect.cpp */; }; 65536853107EB7FA00E08A01 /* indent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536824107EB7FA00E08A01 /* indent.cpp */; }; 65536854107EB7FA00E08A01 /* keywords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536825107EB7FA00E08A01 /* keywords.cpp */; }; 65536855107EB7FA00E08A01 /* lang_pawn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536826107EB7FA00E08A01 /* lang_pawn.cpp */; }; 65536856107EB7FA00E08A01 /* logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536829107EB7FA00E08A01 /* logger.cpp */; }; 65536857107EB7FA00E08A01 /* logmask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553682B107EB7FA00E08A01 /* logmask.cpp */; }; 65536858107EB7FA00E08A01 /* md5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553682F107EB7FA00E08A01 /* md5.cpp */; }; 65536859107EB7FA00E08A01 /* newlines.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536831107EB7FA00E08A01 /* newlines.cpp */; }; 6553685A107EB7FA00E08A01 /* options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536832107EB7FA00E08A01 /* options.cpp */; }; 6553685B107EB7FA00E08A01 /* output.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536834107EB7FA00E08A01 /* output.cpp */; }; 6553685C107EB7FA00E08A01 /* parens.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536835107EB7FA00E08A01 /* parens.cpp */; }; 6553685D107EB7FA00E08A01 /* parse_frame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536836107EB7FA00E08A01 /* parse_frame.cpp */; }; 6553685E107EB7FA00E08A01 /* punctuators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536838107EB7FA00E08A01 /* punctuators.cpp */; }; 6553685F107EB7FA00E08A01 /* semicolons.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553683A107EB7FA00E08A01 /* semicolons.cpp */; }; 65536860107EB7FA00E08A01 /* sorting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553683B107EB7FA00E08A01 /* sorting.cpp */; }; 65536861107EB7FA00E08A01 /* space.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553683C107EB7FA00E08A01 /* space.cpp */; }; 65536862107EB7FA00E08A01 /* tokenize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6553683F107EB7FA00E08A01 /* tokenize.cpp */; }; 65536863107EB7FA00E08A01 /* tokenize_cleanup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536840107EB7FA00E08A01 /* tokenize_cleanup.cpp */; }; 65536864107EB7FA00E08A01 /* uncrustify.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536842107EB7FA00E08A01 /* uncrustify.cpp */; }; 65536865107EB7FA00E08A01 /* universalindentgui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536845107EB7FA00E08A01 /* universalindentgui.cpp */; }; 65536866107EB7FA00E08A01 /* width.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65536846107EB7FA00E08A01 /* width.cpp */; }; 65536892107EB9B600E08A01 /* uncrustify.1 in Install Man Page */ = {isa = PBXBuildFile; fileRef = 655367CB107EB73F00E08A01 /* uncrustify.1 */; }; 65DB4DD71084D577005E7765 /* uncrustify in Copy to 'src' where tests expect it */ = {isa = PBXBuildFile; fileRef = 8DD76F6C0486A84900D96B5E /* uncrustify */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 65DB4DD61084D563005E7765 /* Copy to 'src' where tests expect it */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = "${PROJECT_DIR}/src"; dstSubfolderSpec = 0; files = ( 65DB4DD71084D577005E7765 /* uncrustify in Copy to 'src' where tests expect it */, ); name = "Copy to 'src' where tests expect it"; runOnlyForDeploymentPostprocessing = 0; }; 8DD76F690486A84900D96B5E /* Install Man Page */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 8; dstPath = /usr/share/man/man1/; dstSubfolderSpec = 0; files = ( 65536892107EB9B600E08A01 /* uncrustify.1 in Install Man Page */, ); name = "Install Man Page"; runOnlyForDeploymentPostprocessing = 1; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 654C6B42108ED8FC00556CD9 /* real_world_file.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = real_world_file.m; sourceTree = ""; }; 654C6C70108F238800556CD9 /* 50050-real_world_file.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50050-real_world_file.m"; sourceTree = ""; }; 654C6DA7108F629F00556CD9 /* 50060-oc-split.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50060-oc-split.m"; sourceTree = ""; }; 654C6DB3108F62E900556CD9 /* oc-split.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "oc-split.cfg"; sourceTree = ""; }; 654C6DBD108F63A200556CD9 /* 50007-misc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50007-misc.m"; sourceTree = ""; }; 654C6DBE108F63B000556CD9 /* misc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = misc.m; sourceTree = ""; }; 654C6FB2108FB40D00556CD9 /* more_blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = more_blocks.m; sourceTree = ""; }; 654C70BA1090E89400556CD9 /* blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = blocks.m; sourceTree = ""; }; 6553629F107EB5B800E08A01 /* AUTHORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AUTHORS; sourceTree = ""; }; 655362A0107EB5B900E08A01 /* BUGS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BUGS; sourceTree = ""; }; 655362A1107EB5B900E08A01 /* COPYING */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = COPYING; sourceTree = ""; }; 655362A2107EB5B900E08A01 /* HELP */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HELP; sourceTree = ""; }; 655362A3107EB5B900E08A01 /* INSTALL */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = INSTALL; sourceTree = ""; }; 655362A4107EB5B900E08A01 /* NEWS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NEWS; sourceTree = ""; }; 655362A5107EB5B900E08A01 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = ""; }; 655362A9107EB67900E08A01 /* configure.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = configure.in; sourceTree = ""; }; 655362AA107EB67900E08A01 /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.in; sourceTree = ""; }; 655362AB107EB67900E08A01 /* release-steps.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "release-steps.txt"; sourceTree = ""; }; 655362AC107EB67900E08A01 /* todo.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = todo.txt; sourceTree = ""; }; 655362AD107EB67900E08A01 /* autogen.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = autogen.sh; sourceTree = ""; }; 655362AE107EB67900E08A01 /* do-c.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "do-c.sh"; sourceTree = ""; }; 655362AF107EB67900E08A01 /* do-d.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "do-d.sh"; sourceTree = ""; }; 655362B0107EB67900E08A01 /* make_token_names.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = make_token_names.sh; sourceTree = ""; }; 655362B1107EB67900E08A01 /* run_tests.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = run_tests.sh; sourceTree = ""; }; 655362B2107EB67900E08A01 /* update-default-cfg.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "update-default-cfg.sh"; sourceTree = ""; }; 655362B4107EB6D900E08A01 /* amxmodx.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = amxmodx.cfg; sourceTree = ""; }; 655362B5107EB6D900E08A01 /* ben.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ben.cfg; sourceTree = ""; }; 655362B6107EB6D900E08A01 /* ben2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ben2.cfg; sourceTree = ""; }; 655362B7107EB6D900E08A01 /* d.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = d.cfg; sourceTree = ""; }; 655362B8107EB6D900E08A01 /* defaults.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = defaults.cfg; sourceTree = ""; }; 655362B9107EB6D900E08A01 /* dofiles.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = dofiles.sh; sourceTree = ""; }; 655362BA107EB6D900E08A01 /* gnu-indent.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "gnu-indent.cfg"; sourceTree = ""; }; 655362BB107EB6D900E08A01 /* klaus.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = klaus.cfg; sourceTree = ""; }; 655362BC107EB6D900E08A01 /* kr-indent.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "kr-indent.cfg"; sourceTree = ""; }; 655362BD107EB6D900E08A01 /* linux-indent.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "linux-indent.cfg"; sourceTree = ""; }; 655362BE107EB6D900E08A01 /* linux.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = linux.cfg; sourceTree = ""; }; 655362BF107EB6D900E08A01 /* mono.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mono.cfg; sourceTree = ""; }; 655362C0107EB6D900E08A01 /* objc.cfg */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = objc.cfg; sourceTree = ""; }; 655362C1107EB6D900E08A01 /* types.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = types.txt; sourceTree = ""; }; 655362C2107EB6D900E08A01 /* uncrust-files.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "uncrust-files.sh"; sourceTree = ""; }; 655362C3107EB6D900E08A01 /* xsupplicant.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = xsupplicant.cfg; sourceTree = ""; }; 655362C5107EB6D900E08A01 /* check_options.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = check_options.py; sourceTree = ""; }; 655362C6107EB6D900E08A01 /* cmpcfg.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = cmpcfg.pl; sourceTree = ""; }; 655362C7107EB6D900E08A01 /* punc.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = punc.py; sourceTree = ""; }; 655362C8107EB6D900E08A01 /* tokenize.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = tokenize.py; sourceTree = ""; }; 655362C9107EB6D900E08A01 /* update-defaults.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "update-defaults.sh"; sourceTree = ""; }; 655362CB107EB6D900E08A01 /* c-sharp.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "c-sharp.test"; sourceTree = ""; }; 655362CC107EB6D900E08A01 /* c.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = c.test; sourceTree = ""; }; 655362CE107EB6D900E08A01 /* 1liner-no-split.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "1liner-no-split.cfg"; sourceTree = ""; }; 655362CF107EB6D900E08A01 /* 1liner-split.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "1liner-split.cfg"; sourceTree = ""; }; 655362D0107EB6D900E08A01 /* add_long_closebrace_comment_1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = add_long_closebrace_comment_1.cfg; sourceTree = ""; }; 655362D1107EB6D900E08A01 /* al.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = al.cfg; sourceTree = ""; }; 655362D2107EB6D900E08A01 /* align-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align-1.cfg"; sourceTree = ""; }; 655362D3107EB6D900E08A01 /* align-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align-2.cfg"; sourceTree = ""; }; 655362D4107EB6D900E08A01 /* align-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align-3.cfg"; sourceTree = ""; }; 655362D5107EB6D900E08A01 /* align_attr.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = align_attr.cfg; sourceTree = ""; }; 655362D6107EB6D900E08A01 /* align_fcall-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align_fcall-2.cfg"; sourceTree = ""; }; 655362D7107EB6D900E08A01 /* align_fcall.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = align_fcall.cfg; sourceTree = ""; }; 655362D8107EB6D900E08A01 /* align_right_cmt_gap-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align_right_cmt_gap-1.cfg"; sourceTree = ""; }; 655362D9107EB6D900E08A01 /* align_right_cmt_gap-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align_right_cmt_gap-2.cfg"; sourceTree = ""; }; 655362DA107EB6D900E08A01 /* align_typedef_func-0.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align_typedef_func-0.cfg"; sourceTree = ""; }; 655362DB107EB6D900E08A01 /* align_typedef_func-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align_typedef_func-1.cfg"; sourceTree = ""; }; 655362DC107EB6D900E08A01 /* align_typedef_func-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "align_typedef_func-2.cfg"; sourceTree = ""; }; 655362DD107EB6D900E08A01 /* amxmodx.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = amxmodx.cfg; sourceTree = ""; }; 655362DE107EB6D900E08A01 /* avalon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = avalon.cfg; sourceTree = ""; }; 655362DF107EB6D900E08A01 /* avalon2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = avalon2.cfg; sourceTree = ""; }; 655362E0107EB6D900E08A01 /* avalon3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = avalon3.cfg; sourceTree = ""; }; 655362E1107EB6D900E08A01 /* avalon4.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = avalon4.cfg; sourceTree = ""; }; 655362E2107EB6D900E08A01 /* ben.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ben.cfg; sourceTree = ""; }; 655362E3107EB6D900E08A01 /* blc-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "blc-1.cfg"; sourceTree = ""; }; 655362E4107EB6D900E08A01 /* bool-pos-eol.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "bool-pos-eol.cfg"; sourceTree = ""; }; 655362E5107EB6D900E08A01 /* bool-pos-sol.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "bool-pos-sol.cfg"; sourceTree = ""; }; 655362E6107EB6D900E08A01 /* brace-allman.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-allman.cfg"; sourceTree = ""; }; 655362E7107EB6D900E08A01 /* brace-banner.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-banner.cfg"; sourceTree = ""; }; 655362E8107EB6D900E08A01 /* brace-gnu.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-gnu.cfg"; sourceTree = ""; }; 655362E9107EB6D900E08A01 /* brace-kr-br.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-kr-br.cfg"; sourceTree = ""; }; 655362EA107EB6D900E08A01 /* brace-kr.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-kr.cfg"; sourceTree = ""; }; 655362EB107EB6D900E08A01 /* brace-remove-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-remove-2.cfg"; sourceTree = ""; }; 655362EC107EB6D900E08A01 /* brace-remove-all.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-remove-all.cfg"; sourceTree = ""; }; 655362ED107EB6D900E08A01 /* brace-ws.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-ws.cfg"; sourceTree = ""; }; 655362EE107EB6D900E08A01 /* brace-ws2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "brace-ws2.cfg"; sourceTree = ""; }; 655362EF107EB6D900E08A01 /* byref-center.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "byref-center.cfg"; sourceTree = ""; }; 655362F0107EB6D900E08A01 /* byref-left.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "byref-left.cfg"; sourceTree = ""; }; 655362F1107EB6D900E08A01 /* byref-right.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "byref-right.cfg"; sourceTree = ""; }; 655362F2107EB6D900E08A01 /* case-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "case-1.cfg"; sourceTree = ""; }; 655362F3107EB6D900E08A01 /* case-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "case-2.cfg"; sourceTree = ""; }; 655362F4107EB6D900E08A01 /* case-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "case-3.cfg"; sourceTree = ""; }; 655362F5107EB6D900E08A01 /* cast-sp-a.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cast-sp-a.cfg"; sourceTree = ""; }; 655362F6107EB6D900E08A01 /* cast-sp-r.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cast-sp-r.cfg"; sourceTree = ""; }; 655362F7107EB6D900E08A01 /* cast-type.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cast-type.cfg"; sourceTree = ""; }; 655362F8107EB6D900E08A01 /* cast-types.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cast-types.txt"; sourceTree = ""; }; 655362F9107EB6D900E08A01 /* cgal.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cgal.cfg; sourceTree = ""; }; 655362FA107EB6D900E08A01 /* clark.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = clark.cfg; sourceTree = ""; }; 655362FB107EB6D900E08A01 /* class-colon-pos-eol-add.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "class-colon-pos-eol-add.cfg"; sourceTree = ""; }; 655362FC107EB6D900E08A01 /* class-colon-pos-eol.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "class-colon-pos-eol.cfg"; sourceTree = ""; }; 655362FD107EB6D900E08A01 /* class-colon-pos-sol-add.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "class-colon-pos-sol-add.cfg"; sourceTree = ""; }; 655362FE107EB6D900E08A01 /* class-colon-pos-sol.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "class-colon-pos-sol.cfg"; sourceTree = ""; }; 655362FF107EB6D900E08A01 /* class-header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "class-header.h"; sourceTree = ""; }; 65536300107EB6D900E08A01 /* class-nl_func-add.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "class-nl_func-add.cfg"; sourceTree = ""; }; 65536301107EB6D900E08A01 /* class-nl_func-del.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "class-nl_func-del.cfg"; sourceTree = ""; }; 65536302107EB6D900E08A01 /* cmt_indent-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cmt_indent-1.cfg"; sourceTree = ""; }; 65536303107EB6D900E08A01 /* cmt_indent-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cmt_indent-2.cfg"; sourceTree = ""; }; 65536304107EB6D900E08A01 /* cmt_indent-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cmt_indent-3.cfg"; sourceTree = ""; }; 65536305107EB6D900E08A01 /* cmt_multi-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cmt_multi-1.cfg"; sourceTree = ""; }; 65536306107EB6D900E08A01 /* cmt_multi-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cmt_multi-2.cfg"; sourceTree = ""; }; 65536307107EB6D900E08A01 /* cmt_nl_end.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cmt_nl_end.cfg; sourceTree = ""; }; 65536308107EB6D900E08A01 /* cmt_right.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cmt_right.cfg; sourceTree = ""; }; 65536309107EB6D900E08A01 /* comment-align.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "comment-align.cfg"; sourceTree = ""; }; 6553630A107EB6D900E08A01 /* cond-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cond-1.cfg"; sourceTree = ""; }; 6553630B107EB6D900E08A01 /* cond-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cond-2.cfg"; sourceTree = ""; }; 6553630C107EB6D900E08A01 /* const_throw.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = const_throw.cfg; sourceTree = ""; }; 6553630D107EB6D900E08A01 /* cpp_to_c-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cpp_to_c-1.cfg"; sourceTree = ""; }; 6553630E107EB6D900E08A01 /* cpp_to_c-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cpp_to_c-2.cfg"; sourceTree = ""; }; 6553630F107EB6D900E08A01 /* cpp_to_c-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "cpp_to_c-3.cfg"; sourceTree = ""; }; 65536310107EB6D900E08A01 /* cs_generics.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cs_generics.cfg; sourceTree = ""; }; 65536311107EB6D900E08A01 /* cu.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cu.cfg; sourceTree = ""; }; 65536312107EB6D900E08A01 /* custom-open.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "custom-open.cfg"; sourceTree = ""; }; 65536313107EB6D900E08A01 /* custom-open2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "custom-open2.cfg"; sourceTree = ""; }; 65536314107EB6D900E08A01 /* custom_types_ssl.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = custom_types_ssl.cfg; sourceTree = ""; }; 65536315107EB6D900E08A01 /* d-tst2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "d-tst2.cfg"; sourceTree = ""; }; 65536316107EB6D900E08A01 /* d.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = d.cfg; sourceTree = ""; }; 65536317107EB6D900E08A01 /* d2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = d2.cfg; sourceTree = ""; }; 65536318107EB6D900E08A01 /* d3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = d3.cfg; sourceTree = ""; }; 65536319107EB6D900E08A01 /* d3a.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = d3a.cfg; sourceTree = ""; }; 6553631A107EB6D900E08A01 /* del_semicolon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = del_semicolon.cfg; sourceTree = ""; }; 6553631B107EB6D900E08A01 /* delete.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = delete.cfg; sourceTree = ""; }; 6553631C107EB6D900E08A01 /* else-if-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "else-if-1.cfg"; sourceTree = ""; }; 6553631D107EB6D900E08A01 /* else-if-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "else-if-2.cfg"; sourceTree = ""; }; 6553631E107EB6D900E08A01 /* empty_body.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = empty_body.cfg; sourceTree = ""; }; 6553631F107EB6D900E08A01 /* endif.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = endif.cfg; sourceTree = ""; }; 65536320107EB6D900E08A01 /* file-header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "file-header.h"; sourceTree = ""; }; 65536321107EB6D900E08A01 /* file_footer.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = file_footer.txt; sourceTree = ""; }; 65536322107EB6D900E08A01 /* file_header.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = file_header.txt; sourceTree = ""; }; 65536323107EB6D900E08A01 /* func-def-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "func-def-1.cfg"; sourceTree = ""; }; 65536324107EB6D900E08A01 /* func-def-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "func-def-2.cfg"; sourceTree = ""; }; 65536325107EB6D900E08A01 /* func-def-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "func-def-3.cfg"; sourceTree = ""; }; 65536326107EB6D900E08A01 /* func-header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "func-header.h"; sourceTree = ""; }; 65536327107EB6D900E08A01 /* func-header2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "func-header2.h"; sourceTree = ""; }; 65536328107EB6D900E08A01 /* func_call_user.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = func_call_user.cfg; sourceTree = ""; }; 65536329107EB6D900E08A01 /* func_wrap1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = func_wrap1.cfg; sourceTree = ""; }; 6553632A107EB6D900E08A01 /* func_wrap2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = func_wrap2.cfg; sourceTree = ""; }; 6553632B107EB6D900E08A01 /* function_header.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = function_header.txt; sourceTree = ""; }; 6553632C107EB6D900E08A01 /* ger.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ger.cfg; sourceTree = ""; }; 6553632D107EB6D900E08A01 /* getset.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = getset.cfg; sourceTree = ""; }; 6553632E107EB6D900E08A01 /* indent-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "indent-1.cfg"; sourceTree = ""; }; 6553632F107EB6D900E08A01 /* indent.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = indent.cfg; sourceTree = ""; }; 65536330107EB6D900E08A01 /* indent_func_call_param.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = indent_func_call_param.cfg; sourceTree = ""; }; 65536331107EB6D900E08A01 /* indent_func_def_param.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = indent_func_def_param.cfg; sourceTree = ""; }; 65536332107EB6D900E08A01 /* indent_func_param.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = indent_func_param.cfg; sourceTree = ""; }; 65536333107EB6D900E08A01 /* indent_func_proto_param.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = indent_func_proto_param.cfg; sourceTree = ""; }; 65536334107EB6D900E08A01 /* indent_namespace-f.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "indent_namespace-f.cfg"; sourceTree = ""; }; 65536335107EB6D900E08A01 /* indent_namespace-t.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "indent_namespace-t.cfg"; sourceTree = ""; }; 65536336107EB6D900E08A01 /* indent_paren_close-0.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "indent_paren_close-0.cfg"; sourceTree = ""; }; 65536337107EB6D900E08A01 /* indent_paren_close-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "indent_paren_close-1.cfg"; sourceTree = ""; }; 65536338107EB6D900E08A01 /* indent_paren_close-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "indent_paren_close-2.cfg"; sourceTree = ""; }; 65536339107EB6D900E08A01 /* indent_var_def.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = indent_var_def.cfg; sourceTree = ""; }; 6553633A107EB6D900E08A01 /* kw_subst.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = kw_subst.cfg; sourceTree = ""; }; 6553633B107EB6D900E08A01 /* kw_subst2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = kw_subst2.cfg; sourceTree = ""; }; 6553633C107EB6D900E08A01 /* kw_subst3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = kw_subst3.cfg; sourceTree = ""; }; 6553633D107EB6D900E08A01 /* misc6.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = misc6.cfg; sourceTree = ""; }; 6553633E107EB6D900E08A01 /* mod-paren.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "mod-paren.cfg"; sourceTree = ""; }; 6553633F107EB6D900E08A01 /* mod-paren2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "mod-paren2.cfg"; sourceTree = ""; }; 65536340107EB6D900E08A01 /* mono.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mono.cfg; sourceTree = ""; }; 65536341107EB6D900E08A01 /* multi.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = multi.cfg; sourceTree = ""; }; 65536342107EB6D900E08A01 /* newline_after_endif.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = newline_after_endif.cfg; sourceTree = ""; }; 65536343107EB6D900E08A01 /* nl-comment.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl-comment.cfg"; sourceTree = ""; }; 65536344107EB6D900E08A01 /* nl_access_spec.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_access_spec.cfg; sourceTree = ""; }; 65536345107EB6D900E08A01 /* nl_after_func_body-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_after_func_body-2.cfg"; sourceTree = ""; }; 65536346107EB6D900E08A01 /* nl_after_func_body.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_after_func_body.cfg; sourceTree = ""; }; 65536347107EB6D900E08A01 /* nl_assign1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_assign1.cfg; sourceTree = ""; }; 65536348107EB6D900E08A01 /* nl_assign2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_assign2.cfg; sourceTree = ""; }; 65536349107EB6D900E08A01 /* nl_brace_test.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_brace_test.cfg; sourceTree = ""; }; 6553634A107EB6D900E08A01 /* nl_class-a.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_class-a.cfg"; sourceTree = ""; }; 6553634B107EB6D900E08A01 /* nl_class-r.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_class-r.cfg"; sourceTree = ""; }; 6553634C107EB6D900E08A01 /* nl_create_one_liner.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_create_one_liner.cfg; sourceTree = ""; }; 6553634D107EB6D900E08A01 /* nl_ds_struct_enum-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_ds_struct_enum-1.cfg"; sourceTree = ""; }; 6553634E107EB6D900E08A01 /* nl_ds_struct_enum-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_ds_struct_enum-2.cfg"; sourceTree = ""; }; 6553634F107EB6D900E08A01 /* nl_endif.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_endif.cfg; sourceTree = ""; }; 65536350107EB6D900E08A01 /* nl_func_scope_name.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_func_scope_name.cfg; sourceTree = ""; }; 65536351107EB6D900E08A01 /* nl_func_type_name_force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_func_type_name_force.cfg; sourceTree = ""; }; 65536352107EB6D900E08A01 /* nl_func_type_name_remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_func_type_name_remove.cfg; sourceTree = ""; }; 65536353107EB6D900E08A01 /* nl_namespace-a.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_namespace-a.cfg"; sourceTree = ""; }; 65536354107EB6D900E08A01 /* nl_namespace-r.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_namespace-r.cfg"; sourceTree = ""; }; 65536355107EB6D900E08A01 /* nl_semicolon.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = nl_semicolon.cfg; sourceTree = ""; }; 65536356107EB6D900E08A01 /* nl_template_class-force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_template_class-force.cfg"; sourceTree = ""; }; 65536357107EB6D900E08A01 /* nl_template_class-remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_template_class-remove.cfg"; sourceTree = ""; }; 65536358107EB6D900E08A01 /* nl_try-a.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "nl_try-a.cfg"; sourceTree = ""; }; 65536359107EB6D900E08A01 /* obj-c.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "obj-c.cfg"; sourceTree = ""; }; 6553635A107EB6D900E08A01 /* op-space-force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "op-space-force.cfg"; sourceTree = ""; }; 6553635B107EB6D900E08A01 /* op-space-remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "op-space-remove.cfg"; sourceTree = ""; }; 6553635C107EB6D900E08A01 /* pascal_ptr.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pascal_ptr.cfg; sourceTree = ""; }; 6553635D107EB6D900E08A01 /* pawn-escape.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pawn-escape.cfg"; sourceTree = ""; }; 6553635E107EB6D900E08A01 /* pawn.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pawn.cfg; sourceTree = ""; }; 6553635F107EB6D900E08A01 /* pp-indent-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp-indent-1.cfg"; sourceTree = ""; }; 65536360107EB6D900E08A01 /* pp-indent-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp-indent-2.cfg"; sourceTree = ""; }; 65536361107EB6D900E08A01 /* pp-indent-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp-indent-3.cfg"; sourceTree = ""; }; 65536362107EB6D900E08A01 /* pp-space.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp-space.cfg"; sourceTree = ""; }; 65536363107EB6D900E08A01 /* pp_define_at_level-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp_define_at_level-1.cfg"; sourceTree = ""; }; 65536364107EB6D900E08A01 /* pp_if_indent-0.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp_if_indent-0.cfg"; sourceTree = ""; }; 65536365107EB6D900E08A01 /* pp_if_indent-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp_if_indent-1.cfg"; sourceTree = ""; }; 65536366107EB6D900E08A01 /* pp_if_indent-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp_if_indent-2.cfg"; sourceTree = ""; }; 65536367107EB6D900E08A01 /* pp_if_indent-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "pp_if_indent-3.cfg"; sourceTree = ""; }; 65536368107EB6D900E08A01 /* pp_ret.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pp_ret.cfg; sourceTree = ""; }; 65536369107EB6D900E08A01 /* preproc-cleanup.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "preproc-cleanup.cfg"; sourceTree = ""; }; 6553636A107EB6D900E08A01 /* ptr_star-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "ptr_star-1.cfg"; sourceTree = ""; }; 6553636B107EB6D900E08A01 /* ptr_star-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "ptr_star-2.cfg"; sourceTree = ""; }; 6553636C107EB6D900E08A01 /* ptr_star-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "ptr_star-3.cfg"; sourceTree = ""; }; 6553636D107EB6D900E08A01 /* region-0.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "region-0.cfg"; sourceTree = ""; }; 6553636E107EB6D900E08A01 /* region-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "region-1.cfg"; sourceTree = ""; }; 6553636F107EB6D900E08A01 /* region-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "region-2.cfg"; sourceTree = ""; }; 65536370107EB6D900E08A01 /* region-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "region-3.cfg"; sourceTree = ""; }; 65536371107EB6D900E08A01 /* return-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "return-1.cfg"; sourceTree = ""; }; 65536372107EB6D900E08A01 /* return-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "return-2.cfg"; sourceTree = ""; }; 65536373107EB6D900E08A01 /* return-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "return-3.cfg"; sourceTree = ""; }; 65536374107EB6D900E08A01 /* return-4.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "return-4.cfg"; sourceTree = ""; }; 65536375107EB6D900E08A01 /* sef.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sef.cfg; sourceTree = ""; }; 65536376107EB6D900E08A01 /* sim.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sim.cfg; sourceTree = ""; }; 65536377107EB6D900E08A01 /* sort_imports.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sort_imports.cfg; sourceTree = ""; }; 65536378107EB6D900E08A01 /* sp-for-semi.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "sp-for-semi.cfg"; sourceTree = ""; }; 65536379107EB6D900E08A01 /* sp_after_cast.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_cast.cfg; sourceTree = ""; }; 6553637A107EB6D900E08A01 /* sp_cmt_cpp_start_add.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_cmt_cpp_start_add.cfg; sourceTree = ""; }; 6553637B107EB6D900E08A01 /* sp_cmt_cpp_start_force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_cmt_cpp_start_force.cfg; sourceTree = ""; }; 6553637C107EB6D900E08A01 /* sp_cmt_cpp_start_remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_cmt_cpp_start_remove.cfg; sourceTree = ""; }; 6553637D107EB6D900E08A01 /* sp_throw_paren-f.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "sp_throw_paren-f.cfg"; sourceTree = ""; }; 6553637E107EB6D900E08A01 /* sp_throw_paren-r.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "sp_throw_paren-r.cfg"; sourceTree = ""; }; 6553637F107EB6D900E08A01 /* star_pos-0.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "star_pos-0.cfg"; sourceTree = ""; }; 65536380107EB6D900E08A01 /* star_pos-1.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "star_pos-1.cfg"; sourceTree = ""; }; 65536381107EB6D900E08A01 /* star_pos-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "star_pos-2.cfg"; sourceTree = ""; }; 65536382107EB6D900E08A01 /* tcf.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcf.cfg; sourceTree = ""; }; 65536383107EB6D900E08A01 /* template4.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = template4.cfg; sourceTree = ""; }; 65536384107EB6D900E08A01 /* template_sp-force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "template_sp-force.cfg"; sourceTree = ""; }; 65536385107EB6D900E08A01 /* template_sp-remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "template_sp-remove.cfg"; sourceTree = ""; }; 65536386107EB6D900E08A01 /* type_wrap.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = type_wrap.cfg; sourceTree = ""; }; 65536387107EB6D900E08A01 /* var_def_gap.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = var_def_gap.cfg; sourceTree = ""; }; 65536388107EB6D900E08A01 /* wessex.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wessex.cfg; sourceTree = ""; }; 65536389107EB6D900E08A01 /* width-2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "width-2.cfg"; sourceTree = ""; }; 6553638A107EB6D900E08A01 /* width-3.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "width-3.cfg"; sourceTree = ""; }; 6553638B107EB6D900E08A01 /* width.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = width.cfg; sourceTree = ""; }; 6553638C107EB6D900E08A01 /* xml-str.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "xml-str.cfg"; sourceTree = ""; }; 6553638D107EB6D900E08A01 /* cpp.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cpp.test; sourceTree = ""; }; 6553638E107EB6D900E08A01 /* d.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = d.test; sourceTree = ""; }; 6553638F107EB6D900E08A01 /* difftest.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = difftest.sh; sourceTree = ""; }; 65536390107EB6D900E08A01 /* ecma.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ecma.test; sourceTree = ""; }; 65536391107EB6D900E08A01 /* embed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = embed.c; sourceTree = ""; }; 65536392107EB6D900E08A01 /* fixtest.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = fixtest.sh; sourceTree = ""; }; 65536394107EB6D900E08A01 /* align_fcall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = align_fcall.cpp; sourceTree = ""; }; 65536396107EB6D900E08A01 /* add_long_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = add_long_comment.c; sourceTree = ""; }; 65536397107EB6D900E08A01 /* align-equ.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "align-equ.c"; sourceTree = ""; }; 65536398107EB6D900E08A01 /* align-proto-vars.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "align-proto-vars.c"; sourceTree = ""; }; 65536399107EB6D900E08A01 /* align-proto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "align-proto.c"; sourceTree = ""; }; 6553639A107EB6D900E08A01 /* align-string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "align-string.c"; sourceTree = ""; }; 6553639B107EB6D900E08A01 /* align-struct-init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "align-struct-init.c"; sourceTree = ""; }; 6553639C107EB6D900E08A01 /* align-typedef.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "align-typedef.c"; sourceTree = ""; }; 6553639D107EB6D900E08A01 /* align-var.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "align-var.c"; sourceTree = ""; }; 6553639E107EB6D900E08A01 /* align_attr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = align_attr.c; sourceTree = ""; }; 6553639F107EB6D900E08A01 /* beautifier-off.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "beautifier-off.c"; sourceTree = ""; }; 655363A0107EB6D900E08A01 /* bits.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bits.c; sourceTree = ""; }; 655363A1107EB6D900E08A01 /* bool-pos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bool-pos.c"; sourceTree = ""; }; 655363A2107EB6D900E08A01 /* brace-remove.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "brace-remove.c"; sourceTree = ""; }; 655363A3107EB6D900E08A01 /* brace-remove2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "brace-remove2.c"; sourceTree = ""; }; 655363A4107EB6D900E08A01 /* brace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = brace.c; sourceTree = ""; }; 655363A5107EB6D900E08A01 /* braces-2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "braces-2.c"; sourceTree = ""; }; 655363A6107EB6D900E08A01 /* braces-3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "braces-3.c"; sourceTree = ""; }; 655363A7107EB6D900E08A01 /* braces-4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "braces-4.c"; sourceTree = ""; }; 655363A8107EB6D900E08A01 /* braces-5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "braces-5.c"; sourceTree = ""; }; 655363A9107EB6D900E08A01 /* braces.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = braces.c; sourceTree = ""; }; 655363AA107EB6D900E08A01 /* bsnl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bsnl.c; sourceTree = ""; }; 655363AB107EB6D900E08A01 /* bugs-1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bugs-1.c"; sourceTree = ""; }; 655363AC107EB6D900E08A01 /* bugs-2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bugs-2.c"; sourceTree = ""; }; 655363AD107EB6D900E08A01 /* bugs-3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bugs-3.c"; sourceTree = ""; }; 655363AE107EB6D900E08A01 /* bugs-4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bugs-4.c"; sourceTree = ""; }; 655363AF107EB6D900E08A01 /* bugs-5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bugs-5.c"; sourceTree = ""; }; 655363B0107EB6D900E08A01 /* bugs-6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bugs-6.c"; sourceTree = ""; }; 655363B1107EB6D900E08A01 /* bugs-7.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bugs-7.c"; sourceTree = ""; }; 655363B2107EB6D900E08A01 /* bugs-8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "bugs-8.c"; sourceTree = ""; }; 655363B3107EB6D900E08A01 /* bugs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bugs.c; sourceTree = ""; }; 655363B4107EB6D900E08A01 /* case.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = case.c; sourceTree = ""; }; 655363B5107EB6D900E08A01 /* casts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = casts.c; sourceTree = ""; }; 655363B6107EB6D900E08A01 /* cmt-align.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "cmt-align.c"; sourceTree = ""; }; 655363B7107EB6D900E08A01 /* cmt_multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cmt_multi.c; sourceTree = ""; }; 655363B8107EB6D900E08A01 /* cmt_nl_end.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cmt_nl_end.c; sourceTree = ""; }; 655363B9107EB6D900E08A01 /* cmt_right_align.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cmt_right_align.c; sourceTree = ""; }; 655363BA107EB6D900E08A01 /* code_width.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = code_width.c; sourceTree = ""; }; 655363BB107EB6D900E08A01 /* colon-asm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "colon-asm.c"; sourceTree = ""; }; 655363BC107EB6D900E08A01 /* comment-convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "comment-convert.c"; sourceTree = ""; }; 655363BD107EB6D900E08A01 /* comment-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "comment-indent.c"; sourceTree = ""; }; 655363BE107EB6D900E08A01 /* cond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cond.c; sourceTree = ""; }; 655363BF107EB6D900E08A01 /* custom_types_ssl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = custom_types_ssl.c; sourceTree = ""; }; 655363C0107EB6D900E08A01 /* define-if-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "define-if-indent.c"; sourceTree = ""; }; 655363C1107EB6D900E08A01 /* deref.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = deref.c; sourceTree = ""; }; 655363C2107EB6D900E08A01 /* directfb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = directfb.h; sourceTree = ""; }; 655363C3107EB6D900E08A01 /* dos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dos.c; sourceTree = ""; }; 655363C4107EB6D900E08A01 /* else-if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "else-if.c"; sourceTree = ""; }; 655363C5107EB6D900E08A01 /* empty-for.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "empty-for.c"; sourceTree = ""; }; 655363C6107EB6D900E08A01 /* endif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = endif.c; sourceTree = ""; }; 655363C7107EB6D900E08A01 /* enum-struct-init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "enum-struct-init.c"; sourceTree = ""; }; 655363C8107EB6D900E08A01 /* fcn_indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fcn_indent.c; sourceTree = ""; }; 655363C9107EB6D900E08A01 /* fcn_type.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fcn_type.c; sourceTree = ""; }; 655363CA107EB6D900E08A01 /* for-space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "for-space.c"; sourceTree = ""; }; 655363CB107EB6D900E08A01 /* func_call_user.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = func_call_user.c; sourceTree = ""; }; 655363CC107EB6D900E08A01 /* func_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = func_wrap.c; sourceTree = ""; }; 655363CD107EB6D900E08A01 /* funcfunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = funcfunc.c; sourceTree = ""; }; 655363CE107EB6D900E08A01 /* function-def.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "function-def.c"; sourceTree = ""; }; 655363CF107EB6D900E08A01 /* global-vars.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "global-vars.c"; sourceTree = ""; }; 655363D0107EB6D900E08A01 /* hello.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hello.c; sourceTree = ""; }; 655363D1107EB6D900E08A01 /* i2c-core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "i2c-core.c"; sourceTree = ""; }; 655363D2107EB6D900E08A01 /* ifdef-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "ifdef-indent.c"; sourceTree = ""; }; 655363D3107EB6D900E08A01 /* ifdef-nest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "ifdef-nest.c"; sourceTree = ""; }; 655363D4107EB6D900E08A01 /* include_define.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = include_define.h; sourceTree = ""; }; 655363D5107EB6D900E08A01 /* indent-assign.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "indent-assign.c"; sourceTree = ""; }; 655363D6107EB6D900E08A01 /* indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = indent.cpp; sourceTree = ""; }; 655363D7107EB6D900E08A01 /* kw_subst.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kw_subst.c; sourceTree = ""; }; 655363D8107EB6D900E08A01 /* mac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mac.c; sourceTree = ""; }; 655363D9107EB6D900E08A01 /* minus-minus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "minus-minus.c"; sourceTree = ""; }; 655363DA107EB6D900E08A01 /* misc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = misc.c; sourceTree = ""; }; 655363DB107EB6D900E08A01 /* mod-paren.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "mod-paren.c"; sourceTree = ""; }; 655363DC107EB6D900E08A01 /* multi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multi.h; sourceTree = ""; }; 655363DD107EB6D900E08A01 /* newline_after_endif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = newline_after_endif.c; sourceTree = ""; }; 655363DE107EB6D900E08A01 /* nl-comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "nl-comment.c"; sourceTree = ""; }; 655363DF107EB6D900E08A01 /* nl-cont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "nl-cont.c"; sourceTree = ""; }; 655363E0107EB6D900E08A01 /* nl-cont2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "nl-cont2.c"; sourceTree = ""; }; 655363E1107EB6D900E08A01 /* nl-semicolon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "nl-semicolon.c"; sourceTree = ""; }; 655363E2107EB6D900E08A01 /* nl-ver-def.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "nl-ver-def.c"; sourceTree = ""; }; 655363E3107EB6D900E08A01 /* nl_assign.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nl_assign.c; sourceTree = ""; }; 655363E4107EB6D900E08A01 /* nl_create_one_liner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nl_create_one_liner.c; sourceTree = ""; }; 655363E5107EB6D900E08A01 /* nl_ds_struct_enum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nl_ds_struct_enum.c; sourceTree = ""; }; 655363E6107EB6D900E08A01 /* nl_endif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nl_endif.c; sourceTree = ""; }; 655363E7107EB6D900E08A01 /* nl_proto_endif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nl_proto_endif.c; sourceTree = ""; }; 655363E8107EB6D900E08A01 /* nl_return_expr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nl_return_expr.c; sourceTree = ""; }; 655363E9107EB6D900E08A01 /* one-liner-init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "one-liner-init.c"; sourceTree = ""; }; 655363EA107EB6D900E08A01 /* output.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = output.cpp; sourceTree = ""; }; 655363EB107EB6D900E08A01 /* paren-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "paren-indent.c"; sourceTree = ""; }; 655363EC107EB6D900E08A01 /* paren_indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = paren_indent.c; sourceTree = ""; }; 655363ED107EB6D900E08A01 /* pascal_ptr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pascal_ptr.c; sourceTree = ""; }; 655363EE107EB6D900E08A01 /* pp-nest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pp-nest.c"; sourceTree = ""; }; 655363EF107EB6D900E08A01 /* pp-space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pp-space.c"; sourceTree = ""; }; 655363F0107EB6D900E08A01 /* pp_concat_asn1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pp_concat_asn1.h; sourceTree = ""; }; 655363F1107EB6D900E08A01 /* pp_ret.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pp_ret.c; sourceTree = ""; }; 655363F2107EB6D900E08A01 /* pragma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pragma.c; sourceTree = ""; }; 655363F3107EB6D900E08A01 /* preproc-if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "preproc-if.c"; sourceTree = ""; }; 655363F4107EB6D900E08A01 /* return-multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "return-multi.c"; sourceTree = ""; }; 655363F5107EB6D900E08A01 /* semicolons.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = semicolons.c; sourceTree = ""; }; 655363F6107EB6D900E08A01 /* sort_include.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sort_include.c; sourceTree = ""; }; 655363F7107EB6D900E08A01 /* sp_cmt_cpp_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sp_cmt_cpp_start.c; sourceTree = ""; }; 655363F8107EB6D900E08A01 /* sp_embed_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sp_embed_comment.c; sourceTree = ""; }; 655363F9107EB6D900E08A01 /* struct-brace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "struct-brace.c"; sourceTree = ""; }; 655363FA107EB6D900E08A01 /* switch-case.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "switch-case.c"; sourceTree = ""; }; 655363FB107EB6D900E08A01 /* switch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = switch.c; sourceTree = ""; }; 655363FC107EB6D900E08A01 /* t3.in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t3.in.c; sourceTree = ""; }; 655363FD107EB6D900E08A01 /* type-cast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "type-cast.c"; sourceTree = ""; }; 655363FE107EB6D900E08A01 /* type_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = type_wrap.c; sourceTree = ""; }; 655363FF107EB6D900E08A01 /* vb-do.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "vb-do.c"; sourceTree = ""; }; 65536400107EB6D900E08A01 /* vb-pp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "vb-pp.c"; sourceTree = ""; }; 65536401107EB6D900E08A01 /* vb-while.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "vb-while.c"; sourceTree = ""; }; 65536402107EB6D900E08A01 /* xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = ""; }; 65536404107EB6D900E08A01 /* al.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = al.cpp; sourceTree = ""; }; 65536405107EB6D900E08A01 /* align-func-params.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "align-func-params.cpp"; sourceTree = ""; }; 65536406107EB6D900E08A01 /* align-star-amp-pos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "align-star-amp-pos.cpp"; sourceTree = ""; }; 65536407107EB6D900E08A01 /* align_constr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = align_constr.cpp; sourceTree = ""; }; 65536408107EB6D900E08A01 /* align_fcall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = align_fcall.cpp; sourceTree = ""; }; 65536409107EB6D900E08A01 /* alt_tokens.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = alt_tokens.cpp; sourceTree = ""; }; 6553640A107EB6D900E08A01 /* av.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = av.h; sourceTree = ""; }; 6553640B107EB6D900E08A01 /* bool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bool.cpp; sourceTree = ""; }; 6553640C107EB6D900E08A01 /* byref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = byref.cpp; sourceTree = ""; }; 6553640D107EB6D900E08A01 /* class-addr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "class-addr.h"; sourceTree = ""; }; 6553640E107EB6D900E08A01 /* class-init.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "class-init.cpp"; sourceTree = ""; }; 6553640F107EB6D900E08A01 /* class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = class.h; sourceTree = ""; }; 65536410107EB6D900E08A01 /* cmt-reflow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "cmt-reflow.cpp"; sourceTree = ""; }; 65536411107EB6D900E08A01 /* cmt_indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cmt_indent.cpp; sourceTree = ""; }; 65536412107EB6D900E08A01 /* cmt_right.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cmt_right.cpp; sourceTree = ""; }; 65536413107EB6D900E08A01 /* comment-align.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "comment-align.cpp"; sourceTree = ""; }; 65536414107EB6D900E08A01 /* const_throw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = const_throw.cpp; sourceTree = ""; }; 65536415107EB6D900E08A01 /* constructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = constructor.cpp; sourceTree = ""; }; 65536416107EB6D900E08A01 /* cout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cout.cpp; sourceTree = ""; }; 65536417107EB6D900E08A01 /* ctor-var.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "ctor-var.cpp"; sourceTree = ""; }; 65536418107EB6D900E08A01 /* custom-open-2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "custom-open-2.cpp"; sourceTree = ""; }; 65536419107EB6D900E08A01 /* custom-open.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "custom-open.cpp"; sourceTree = ""; }; 6553641A107EB6D900E08A01 /* delete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = delete.cpp; sourceTree = ""; }; 6553641B107EB6D900E08A01 /* deref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = deref.cpp; sourceTree = ""; }; 6553641C107EB6D900E08A01 /* Example.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Example.h; sourceTree = ""; }; 6553641D107EB6D900E08A01 /* exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = exception.cpp; sourceTree = ""; }; 6553641E107EB6D900E08A01 /* extern_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = extern_c.h; sourceTree = ""; }; 6553641F107EB6D900E08A01 /* for_long.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = for_long.cpp; sourceTree = ""; }; 65536420107EB6D900E08A01 /* function-def.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "function-def.cpp"; sourceTree = ""; }; 65536421107EB6D900E08A01 /* goto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = goto.cpp; sourceTree = ""; }; 65536422107EB6D900E08A01 /* indent-off.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "indent-off.cpp"; sourceTree = ""; }; 65536423107EB6D900E08A01 /* indent_namespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = indent_namespace.h; sourceTree = ""; }; 65536424107EB6D900E08A01 /* indent_var_def.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = indent_var_def.cpp; sourceTree = ""; }; 65536425107EB6D900E08A01 /* init_align.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = init_align.h; sourceTree = ""; }; 65536426107EB6D900E08A01 /* kw_subst.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = kw_subst.cpp; sourceTree = ""; }; 65536427107EB6D900E08A01 /* kw_subst2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = kw_subst2.cpp; sourceTree = ""; }; 65536428107EB6D900E08A01 /* misc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = misc.cpp; sourceTree = ""; }; 65536429107EB6D900E08A01 /* misc2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = misc2.cpp; sourceTree = ""; }; 6553642A107EB6D900E08A01 /* misc3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = misc3.cpp; sourceTree = ""; }; 6553642B107EB6D900E08A01 /* misc4.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = misc4.cpp; sourceTree = ""; }; 6553642C107EB6D900E08A01 /* misc5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = misc5.cpp; sourceTree = ""; }; 6553642D107EB6D900E08A01 /* misc6.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = misc6.cpp; sourceTree = ""; }; 6553642E107EB6D900E08A01 /* nl-class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "nl-class.h"; sourceTree = ""; }; 6553642F107EB6D900E08A01 /* nl-namespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "nl-namespace.h"; sourceTree = ""; }; 65536430107EB6D900E08A01 /* nl_func.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nl_func.cpp; sourceTree = ""; }; 65536431107EB6D900E08A01 /* nl_func_scope_name.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nl_func_scope_name.cpp; sourceTree = ""; }; 65536432107EB6D900E08A01 /* nl_func_type_name.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nl_func_type_name.cpp; sourceTree = ""; }; 65536433107EB6D900E08A01 /* operator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = operator.cpp; sourceTree = ""; }; 65536434107EB6D900E08A01 /* pp-define-indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "pp-define-indent.cpp"; sourceTree = ""; }; 65536435107EB6D900E08A01 /* ptr-star.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "ptr-star.cpp"; sourceTree = ""; }; 65536436107EB6D900E08A01 /* qt-1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "qt-1.cpp"; sourceTree = ""; }; 65536437107EB6D900E08A01 /* region.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = region.cpp; sourceTree = ""; }; 65536438107EB6D900E08A01 /* sef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sef.cpp; sourceTree = ""; }; 65536439107EB6D900E08A01 /* semicolons.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = semicolons.cpp; sourceTree = ""; }; 6553643A107EB6D900E08A01 /* sim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sim.h; sourceTree = ""; }; 6553643B107EB6D900E08A01 /* sp_throw_paren.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sp_throw_paren.cpp; sourceTree = ""; }; 6553643C107EB6D900E08A01 /* strings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strings.cpp; sourceTree = ""; }; 6553643D107EB6D900E08A01 /* templ_class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = templ_class.h; sourceTree = ""; }; 6553643E107EB6D900E08A01 /* templates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = templates.cpp; sourceTree = ""; }; 6553643F107EB6D900E08A01 /* templates2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = templates2.cpp; sourceTree = ""; }; 65536440107EB6D900E08A01 /* templates3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = templates3.cpp; sourceTree = ""; }; 65536441107EB6D900E08A01 /* templates4.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = templates4.cpp; sourceTree = ""; }; 65536442107EB6D900E08A01 /* Timestamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timestamp.h; sourceTree = ""; }; 65536443107EB6D900E08A01 /* try-catch-nl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "try-catch-nl.cpp"; sourceTree = ""; }; 65536444107EB6D900E08A01 /* var_def_gap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = var_def_gap.cpp; sourceTree = ""; }; 65536445107EB6D900E08A01 /* variadic-template.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "variadic-template.h"; sourceTree = ""; }; 65536446107EB6D900E08A01 /* wacky-template.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "wacky-template.cpp"; sourceTree = ""; }; 65536448107EB6D900E08A01 /* generics.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = generics.cs; sourceTree = ""; }; 65536449107EB6D900E08A01 /* getset.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = getset.cs; sourceTree = ""; }; 6553644A107EB6D900E08A01 /* gs.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = gs.cs; sourceTree = ""; }; 6553644B107EB6D900E08A01 /* region.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = region.cs; sourceTree = ""; }; 6553644C107EB6D900E08A01 /* simple.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = simple.cs; sourceTree = ""; }; 6553644D107EB6D900E08A01 /* sort_using.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sort_using.cs; sourceTree = ""; }; 6553644E107EB6D900E08A01 /* strings.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = strings.cs; sourceTree = ""; }; 6553644F107EB6D900E08A01 /* tcf.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcf.cs; sourceTree = ""; }; 65536450107EB6D900E08A01 /* unsafe.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = unsafe.cs; sourceTree = ""; }; 65536451107EB6D900E08A01 /* var-member.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "var-member.cs"; sourceTree = ""; }; 65536453107EB6D900E08A01 /* bug-indent.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "bug-indent.d"; sourceTree = ""; }; 65536454107EB6D900E08A01 /* casts.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = casts.d; sourceTree = ""; }; 65536455107EB6D900E08A01 /* delegate.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = delegate.d; sourceTree = ""; }; 65536456107EB6D900E08A01 /* funcfunc.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = funcfunc.d; sourceTree = ""; }; 65536457107EB6D900E08A01 /* HashMap.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = HashMap.d; sourceTree = ""; }; 65536458107EB6D900E08A01 /* imports.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = imports.d; sourceTree = ""; }; 65536459107EB6D900E08A01 /* Lexer.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = Lexer.d; sourceTree = ""; }; 6553645A107EB6D900E08A01 /* numbers.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = numbers.d; sourceTree = ""; }; 6553645B107EB6D900E08A01 /* sort_import.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = sort_import.d; sourceTree = ""; }; 6553645C107EB6D900E08A01 /* strings.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = strings.d; sourceTree = ""; }; 6553645D107EB6D900E08A01 /* template.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = template.d; sourceTree = ""; }; 6553645E107EB6D900E08A01 /* tst01.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = tst01.d; sourceTree = ""; }; 6553645F107EB6D900E08A01 /* tst02.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = tst02.d; sourceTree = ""; }; 65536460107EB6D900E08A01 /* tst03.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = tst03.d; sourceTree = ""; }; 65536461107EB6D900E08A01 /* volatile-1.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "volatile-1.d"; sourceTree = ""; }; 65536462107EB6D900E08A01 /* volatile-2.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "volatile-2.d"; sourceTree = ""; }; 65536463107EB6D900E08A01 /* volatile-3.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "volatile-3.d"; sourceTree = ""; }; 65536464107EB6D900E08A01 /* volatile.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = volatile.d; sourceTree = ""; }; 65536466107EB6D900E08A01 /* example-1.es */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "example-1.es"; sourceTree = ""; }; 65536469107EB6D900E08A01 /* Declarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Declarations.h; sourceTree = ""; }; 6553646A107EB6D900E08A01 /* exceptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = exceptions.m; sourceTree = ""; }; 6553646B107EB6D900E08A01 /* Fraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fraction.h; sourceTree = ""; }; 6553646C107EB6D900E08A01 /* Fraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Fraction.m; sourceTree = ""; }; 6553646D107EB6D900E08A01 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 6553646E107EB6D900E08A01 /* sort_import.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = sort_import.m; sourceTree = ""; }; 6553646F107EB6D900E08A01 /* string.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = string.m; sourceTree = ""; }; 65536471107EB6D900E08A01 /* comment.p */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = comment.p; sourceTree = ""; }; 65536472107EB6D900E08A01 /* crusty_ex-1.sma */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "crusty_ex-1.sma"; sourceTree = ""; }; 65536473107EB6D900E08A01 /* enum.pawn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = enum.pawn; sourceTree = ""; }; 65536474107EB6D900E08A01 /* functions.pawn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = functions.pawn; sourceTree = ""; }; 65536475107EB6D900E08A01 /* rpn_calc.pawn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rpn_calc.pawn; sourceTree = ""; }; 65536476107EB6D900E08A01 /* str-escape.p */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = "str-escape.p"; sourceTree = ""; }; 65536477107EB6D900E08A01 /* switch-vsemi.sma */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "switch-vsemi.sma"; sourceTree = ""; }; 65536478107EB6D900E08A01 /* tags.pawn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tags.pawn; sourceTree = ""; }; 65536479107EB6D900E08A01 /* test1.pawn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test1.pawn; sourceTree = ""; }; 6553647A107EB6D900E08A01 /* traffic.p */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = traffic.p; sourceTree = ""; }; 6553647B107EB6D900E08A01 /* unbraced.p */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = unbraced.p; sourceTree = ""; }; 6553647D107EB6D900E08A01 /* mysql.sqc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mysql.sqc; sourceTree = ""; }; 6553647E107EB6D900E08A01 /* sta-select.sqc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "sta-select.sqc"; sourceTree = ""; }; 65536480107EB6D900E08A01 /* advanced.vala */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = advanced.vala; sourceTree = ""; }; 65536481107EB6D900E08A01 /* list.vala */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = list.vala; sourceTree = ""; }; 65536482107EB6D900E08A01 /* java.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = java.test; sourceTree = ""; }; 65536483107EB6D900E08A01 /* objective-c.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "objective-c.test"; sourceTree = ""; }; 65536486107EB6D900E08A01 /* 00000-comment-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00000-comment-indent.c"; sourceTree = ""; }; 65536487107EB6D900E08A01 /* 00001-comment-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00001-comment-indent.c"; sourceTree = ""; }; 65536488107EB6D900E08A01 /* 00002-comment-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00002-comment-indent.c"; sourceTree = ""; }; 65536489107EB6D900E08A01 /* 00003-comment-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00003-comment-indent.c"; sourceTree = ""; }; 6553648A107EB6D900E08A01 /* 00004-switch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00004-switch.c"; sourceTree = ""; }; 6553648B107EB6D900E08A01 /* 00005-cmt-align.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00005-cmt-align.c"; sourceTree = ""; }; 6553648C107EB6D900E08A01 /* 00006-comment-convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00006-comment-convert.c"; sourceTree = ""; }; 6553648D107EB6D900E08A01 /* 00007-comment-convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00007-comment-convert.c"; sourceTree = ""; }; 6553648E107EB6D900E08A01 /* 00008-comment-convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00008-comment-convert.c"; sourceTree = ""; }; 6553648F107EB6D900E08A01 /* 00009-comment-convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00009-comment-convert.c"; sourceTree = ""; }; 65536490107EB6D900E08A01 /* 00010-braces.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00010-braces.c"; sourceTree = ""; }; 65536491107EB6D900E08A01 /* 00011-braces.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00011-braces.c"; sourceTree = ""; }; 65536492107EB6D900E08A01 /* 00012-braces.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00012-braces.c"; sourceTree = ""; }; 65536493107EB6D900E08A01 /* 00013-braces.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00013-braces.c"; sourceTree = ""; }; 65536494107EB6D900E08A01 /* 00014-braces.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00014-braces.c"; sourceTree = ""; }; 65536495107EB6D900E08A01 /* 00015-braces.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00015-braces.c"; sourceTree = ""; }; 65536496107EB6D900E08A01 /* 00016-braces.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00016-braces.c"; sourceTree = ""; }; 65536497107EB6D900E08A01 /* 00020-define-if-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00020-define-if-indent.c"; sourceTree = ""; }; 65536498107EB6D900E08A01 /* 00050-brace-remove.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00050-brace-remove.c"; sourceTree = ""; }; 65536499107EB6D900E08A01 /* 00051-brace-remove.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00051-brace-remove.c"; sourceTree = ""; }; 6553649A107EB6D900E08A01 /* 00052-brace-remove2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00052-brace-remove2.c"; sourceTree = ""; }; 6553649B107EB6D900E08A01 /* 00053-brace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00053-brace.c"; sourceTree = ""; }; 6553649C107EB6D900E08A01 /* 00055-braces-2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00055-braces-2.c"; sourceTree = ""; }; 6553649D107EB6D900E08A01 /* 00060-braces-2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00060-braces-2.c"; sourceTree = ""; }; 6553649E107EB6D900E08A01 /* 00061-braces-3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00061-braces-3.c"; sourceTree = ""; }; 6553649F107EB6D900E08A01 /* 00062-braces-4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00062-braces-4.c"; sourceTree = ""; }; 655364A0107EB6D900E08A01 /* 00065-braces-5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00065-braces-5.c"; sourceTree = ""; }; 655364A1107EB6D900E08A01 /* 00066-vb-while.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00066-vb-while.c"; sourceTree = ""; }; 655364A2107EB6D900E08A01 /* 00067-vb-do.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00067-vb-do.c"; sourceTree = ""; }; 655364A3107EB6D900E08A01 /* 00068-bsnl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00068-bsnl.c"; sourceTree = ""; }; 655364A4107EB6D900E08A01 /* 00069-vb-pp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00069-vb-pp.c"; sourceTree = ""; }; 655364A5107EB6D900E08A01 /* 00070-return-multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00070-return-multi.c"; sourceTree = ""; }; 655364A6107EB6D900E08A01 /* 00071-include_define.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "00071-include_define.h"; sourceTree = ""; }; 655364A7107EB6D900E08A01 /* 00072-align-proto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00072-align-proto.c"; sourceTree = ""; }; 655364A8107EB6D900E08A01 /* 00073-nl_proto_endif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00073-nl_proto_endif.c"; sourceTree = ""; }; 655364A9107EB6D900E08A01 /* 00081-else-if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00081-else-if.c"; sourceTree = ""; }; 655364AA107EB6D900E08A01 /* 00082-else-if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00082-else-if.c"; sourceTree = ""; }; 655364AB107EB6D900E08A01 /* 00091-cond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00091-cond.c"; sourceTree = ""; }; 655364AC107EB6D900E08A01 /* 00092-cond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00092-cond.c"; sourceTree = ""; }; 655364AD107EB6D900E08A01 /* 00101-bugs-1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00101-bugs-1.c"; sourceTree = ""; }; 655364AE107EB6D900E08A01 /* 00102-bugs-2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00102-bugs-2.c"; sourceTree = ""; }; 655364AF107EB6D900E08A01 /* 00103-bugs-3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00103-bugs-3.c"; sourceTree = ""; }; 655364B0107EB6D900E08A01 /* 00104-bugs-4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00104-bugs-4.c"; sourceTree = ""; }; 655364B1107EB6D900E08A01 /* 00105-bugs-5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00105-bugs-5.c"; sourceTree = ""; }; 655364B2107EB6D900E08A01 /* 00106-bugs-6.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00106-bugs-6.c"; sourceTree = ""; }; 655364B3107EB6D900E08A01 /* 00107-bugs-7.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00107-bugs-7.c"; sourceTree = ""; }; 655364B4107EB6D900E08A01 /* 00108-bugs-8.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00108-bugs-8.c"; sourceTree = ""; }; 655364B5107EB6D900E08A01 /* 00110-misc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00110-misc.c"; sourceTree = ""; }; 655364B6107EB6D900E08A01 /* 00111-misc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00111-misc.c"; sourceTree = ""; }; 655364B7107EB6D900E08A01 /* 00120-sp_cmt_cpp_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00120-sp_cmt_cpp_start.c"; sourceTree = ""; }; 655364B8107EB6D900E08A01 /* 00121-sp_cmt_cpp_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00121-sp_cmt_cpp_start.c"; sourceTree = ""; }; 655364B9107EB6D900E08A01 /* 00122-sp_cmt_cpp_start.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00122-sp_cmt_cpp_start.c"; sourceTree = ""; }; 655364BA107EB6D900E08A01 /* 00130-minus-minus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00130-minus-minus.c"; sourceTree = ""; }; 655364BB107EB6D900E08A01 /* 00140-global-vars.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00140-global-vars.c"; sourceTree = ""; }; 655364BC107EB6D900E08A01 /* 00141-deref.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00141-deref.c"; sourceTree = ""; }; 655364BD107EB6D900E08A01 /* 00142-type-cast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00142-type-cast.c"; sourceTree = ""; }; 655364BE107EB6D900E08A01 /* 00143-t3.in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00143-t3.in.c"; sourceTree = ""; }; 655364BF107EB6D900E08A01 /* 00144-align-proto-vars.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00144-align-proto-vars.c"; sourceTree = ""; }; 655364C0107EB6D900E08A01 /* 00150-casts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00150-casts.c"; sourceTree = ""; }; 655364C1107EB6D900E08A01 /* 00151-casts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00151-casts.c"; sourceTree = ""; }; 655364C2107EB6D900E08A01 /* 00152-casts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00152-casts.c"; sourceTree = ""; }; 655364C3107EB6D900E08A01 /* 00153-casts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00153-casts.c"; sourceTree = ""; }; 655364C4107EB6D900E08A01 /* 00154-casts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00154-casts.c"; sourceTree = ""; }; 655364C5107EB6D900E08A01 /* 00160-fcn_indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00160-fcn_indent.c"; sourceTree = ""; }; 655364C6107EB6D900E08A01 /* 00161-fcn_indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00161-fcn_indent.c"; sourceTree = ""; }; 655364C7107EB6D900E08A01 /* 00162-fcn_indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00162-fcn_indent.c"; sourceTree = ""; }; 655364C8107EB6D900E08A01 /* 00163-fcn_indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00163-fcn_indent.c"; sourceTree = ""; }; 655364C9107EB6D900E08A01 /* 00170-beautifier-off.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00170-beautifier-off.c"; sourceTree = ""; }; 655364CA107EB6D900E08A01 /* 00201-case.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00201-case.c"; sourceTree = ""; }; 655364CB107EB6D900E08A01 /* 00202-case.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00202-case.c"; sourceTree = ""; }; 655364CC107EB6D900E08A01 /* 00203-case.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00203-case.c"; sourceTree = ""; }; 655364CD107EB6D900E08A01 /* 00301-align-struct-init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00301-align-struct-init.c"; sourceTree = ""; }; 655364CE107EB6D900E08A01 /* 00302-one-liner-init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00302-one-liner-init.c"; sourceTree = ""; }; 655364CF107EB6D900E08A01 /* 00303-one-liner-init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00303-one-liner-init.c"; sourceTree = ""; }; 655364D0107EB6D900E08A01 /* 00304-one-liner-init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00304-one-liner-init.c"; sourceTree = ""; }; 655364D1107EB6D900E08A01 /* 00310-sp_embed_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00310-sp_embed_comment.c"; sourceTree = ""; }; 655364D2107EB6D900E08A01 /* 00401-align-equ.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00401-align-equ.c"; sourceTree = ""; }; 655364D3107EB6D900E08A01 /* 00402-align-var.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00402-align-var.c"; sourceTree = ""; }; 655364D4107EB6D900E08A01 /* 00403-align-var.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00403-align-var.c"; sourceTree = ""; }; 655364D5107EB6D900E08A01 /* 00404-align-var.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00404-align-var.c"; sourceTree = ""; }; 655364D6107EB6D900E08A01 /* 00405-bits.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00405-bits.c"; sourceTree = ""; }; 655364D7107EB6D900E08A01 /* 00411-align-typedef.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00411-align-typedef.c"; sourceTree = ""; }; 655364D8107EB6D900E08A01 /* 00412-align-typedef.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00412-align-typedef.c"; sourceTree = ""; }; 655364D9107EB6D900E08A01 /* 00413-align-typedef.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00413-align-typedef.c"; sourceTree = ""; }; 655364DA107EB6D900E08A01 /* 00414-align-typedef.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00414-align-typedef.c"; sourceTree = ""; }; 655364DB107EB6D900E08A01 /* 00421-nl_ds_struct_enum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00421-nl_ds_struct_enum.c"; sourceTree = ""; }; 655364DC107EB6D900E08A01 /* 00422-nl_ds_struct_enum.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00422-nl_ds_struct_enum.c"; sourceTree = ""; }; 655364DD107EB6D900E08A01 /* 00430-paren-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00430-paren-indent.c"; sourceTree = ""; }; 655364DE107EB6D900E08A01 /* 00431-paren-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00431-paren-indent.c"; sourceTree = ""; }; 655364DF107EB6D900E08A01 /* 00432-paren-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00432-paren-indent.c"; sourceTree = ""; }; 655364E0107EB6D900E08A01 /* 00501-bool-pos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00501-bool-pos.c"; sourceTree = ""; }; 655364E1107EB6D900E08A01 /* 00502-bool-pos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00502-bool-pos.c"; sourceTree = ""; }; 655364E2107EB6D900E08A01 /* 00600-dos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00600-dos.c"; sourceTree = ""; }; 655364E3107EB6D900E08A01 /* 00601-mac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00601-mac.c"; sourceTree = ""; }; 655364E4107EB6D900E08A01 /* 00611-pp-space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00611-pp-space.c"; sourceTree = ""; }; 655364E5107EB6D900E08A01 /* 00612-pp-space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00612-pp-space.c"; sourceTree = ""; }; 655364E6107EB6D900E08A01 /* 00613-pp-space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00613-pp-space.c"; sourceTree = ""; }; 655364E7107EB6D900E08A01 /* 00614-pp-space.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00614-pp-space.c"; sourceTree = ""; }; 655364E8107EB6D900E08A01 /* 00615-pp-nest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00615-pp-nest.c"; sourceTree = ""; }; 655364E9107EB6D900E08A01 /* 00620-indent-assign.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00620-indent-assign.c"; sourceTree = ""; }; 655364EA107EB6D900E08A01 /* 00621-nl_endif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00621-nl_endif.c"; sourceTree = ""; }; 655364EB107EB6D900E08A01 /* 00631-nl_assign.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00631-nl_assign.c"; sourceTree = ""; }; 655364EC107EB6D900E08A01 /* 00632-nl_assign.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00632-nl_assign.c"; sourceTree = ""; }; 655364ED107EB6D900E08A01 /* 00701-function-def.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00701-function-def.c"; sourceTree = ""; }; 655364EE107EB6D900E08A01 /* 00702-function-def.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00702-function-def.c"; sourceTree = ""; }; 655364EF107EB6D900E08A01 /* 00703-function-def.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00703-function-def.c"; sourceTree = ""; }; 655364F0107EB6D900E08A01 /* 00710-add_long_comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00710-add_long_comment.c"; sourceTree = ""; }; 655364F1107EB6D900E08A01 /* 00721-nl-semicolon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00721-nl-semicolon.c"; sourceTree = ""; }; 655364F2107EB6D900E08A01 /* 00801-fcn_type.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00801-fcn_type.c"; sourceTree = ""; }; 655364F3107EB6D900E08A01 /* 00802-funcfunc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00802-funcfunc.c"; sourceTree = ""; }; 655364F4107EB6D900E08A01 /* 00901-code_width.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00901-code_width.c"; sourceTree = ""; }; 655364F5107EB6D900E08A01 /* 00902-code_width.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00902-code_width.c"; sourceTree = ""; }; 655364F6107EB6D900E08A01 /* 00903-code_width.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00903-code_width.c"; sourceTree = ""; }; 655364F7107EB6D900E08A01 /* 00910-pascal_ptr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00910-pascal_ptr.c"; sourceTree = ""; }; 655364F8107EB6D900E08A01 /* 00911-pascal_ptr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "00911-pascal_ptr.c"; sourceTree = ""; }; 655364F9107EB6D900E08A01 /* 01000-mod-paren.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01000-mod-paren.c"; sourceTree = ""; }; 655364FA107EB6D900E08A01 /* 01001-nl-comment.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01001-nl-comment.c"; sourceTree = ""; }; 655364FB107EB6D900E08A01 /* 01002-mod-paren.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01002-mod-paren.c"; sourceTree = ""; }; 655364FC107EB6D900E08A01 /* 01011-semicolons.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01011-semicolons.c"; sourceTree = ""; }; 655364FD107EB6D900E08A01 /* 01012-semicolons.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01012-semicolons.c"; sourceTree = ""; }; 655364FE107EB6D900E08A01 /* 01015-paren_indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01015-paren_indent.c"; sourceTree = ""; }; 655364FF107EB6D900E08A01 /* 01016-align_attr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01016-align_attr.c"; sourceTree = ""; }; 65536500107EB6D900E08A01 /* 01020-kw_subst.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01020-kw_subst.c"; sourceTree = ""; }; 65536501107EB6D900E08A01 /* 01021-hello.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01021-hello.c"; sourceTree = ""; }; 65536502107EB6D900E08A01 /* 01022-kw_subst.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01022-kw_subst.c"; sourceTree = ""; }; 65536503107EB6D900E08A01 /* 01030-multi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "01030-multi.h"; sourceTree = ""; }; 65536504107EB6D900E08A01 /* 01035-func_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01035-func_wrap.c"; sourceTree = ""; }; 65536505107EB6D900E08A01 /* 01036-func_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01036-func_wrap.c"; sourceTree = ""; }; 65536506107EB6D900E08A01 /* 01037-type_wrap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01037-type_wrap.c"; sourceTree = ""; }; 65536507107EB6D900E08A01 /* 01040-newline_after_endif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01040-newline_after_endif.c"; sourceTree = ""; }; 65536508107EB6D900E08A01 /* 01050-func_call_user.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "01050-func_call_user.c"; sourceTree = ""; }; 65536509107EB6D900E08A01 /* 20000-i2c-core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20000-i2c-core.c"; sourceTree = ""; }; 6553650A107EB6D900E08A01 /* 20001-directfb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "20001-directfb.h"; sourceTree = ""; }; 6553650B107EB6D900E08A01 /* 20100-i2c-core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20100-i2c-core.c"; sourceTree = ""; }; 6553650C107EB6D900E08A01 /* 20101-comment-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20101-comment-indent.c"; sourceTree = ""; }; 6553650D107EB6D900E08A01 /* 20102-indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "20102-indent.cpp"; sourceTree = ""; }; 6553650E107EB6D900E08A01 /* 20103-output.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "20103-output.cpp"; sourceTree = ""; }; 6553650F107EB6D900E08A01 /* 20200-xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20200-xml.c"; sourceTree = ""; }; 65536510107EB6D900E08A01 /* 20201-align-string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20201-align-string.c"; sourceTree = ""; }; 65536511107EB6D900E08A01 /* 20300-preproc-if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20300-preproc-if.c"; sourceTree = ""; }; 65536512107EB6D900E08A01 /* 20301-preproc-if.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20301-preproc-if.c"; sourceTree = ""; }; 65536513107EB6D900E08A01 /* 20302-nl-cont.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20302-nl-cont.c"; sourceTree = ""; }; 65536514107EB6D900E08A01 /* 20303-nl-cont2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20303-nl-cont2.c"; sourceTree = ""; }; 65536515107EB6D900E08A01 /* 20310-empty-for.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20310-empty-for.c"; sourceTree = ""; }; 65536516107EB6D900E08A01 /* 20311-pragma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20311-pragma.c"; sourceTree = ""; }; 65536517107EB6D900E08A01 /* 20315-pp_ret.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20315-pp_ret.c"; sourceTree = ""; }; 65536518107EB6D900E08A01 /* 20320-nl_create_one_liner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20320-nl_create_one_liner.c"; sourceTree = ""; }; 65536519107EB6D900E08A01 /* 20325-sort_include.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "20325-sort_include.c"; sourceTree = ""; }; 6553651A107EB6D900E08A01 /* 21010-ifdef-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21010-ifdef-indent.c"; sourceTree = ""; }; 6553651B107EB6D900E08A01 /* 21011-ifdef-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21011-ifdef-indent.c"; sourceTree = ""; }; 6553651C107EB6D900E08A01 /* 21012-ifdef-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21012-ifdef-indent.c"; sourceTree = ""; }; 6553651D107EB6D900E08A01 /* 21013-ifdef-indent.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21013-ifdef-indent.c"; sourceTree = ""; }; 6553651E107EB6D900E08A01 /* 21015-endif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21015-endif.c"; sourceTree = ""; }; 6553651F107EB6D900E08A01 /* 21016-cmt_nl_end.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21016-cmt_nl_end.c"; sourceTree = ""; }; 65536520107EB6D900E08A01 /* 21021-cmt_multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21021-cmt_multi.c"; sourceTree = ""; }; 65536521107EB6D900E08A01 /* 21022-cmt_multi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21022-cmt_multi.c"; sourceTree = ""; }; 65536522107EB6D900E08A01 /* 21031-cmt_right_align.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21031-cmt_right_align.c"; sourceTree = ""; }; 65536523107EB6D900E08A01 /* 21032-cmt_right_align.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21032-cmt_right_align.c"; sourceTree = ""; }; 65536524107EB6D900E08A01 /* 21051-nl_return_expr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21051-nl_return_expr.c"; sourceTree = ""; }; 65536525107EB6D900E08A01 /* 21052-nl_return_expr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21052-nl_return_expr.c"; sourceTree = ""; }; 65536526107EB6D900E08A01 /* 21053-nl_return_expr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21053-nl_return_expr.c"; sourceTree = ""; }; 65536527107EB6D900E08A01 /* 21054-nl_return_expr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "21054-nl_return_expr.c"; sourceTree = ""; }; 65536528107EB6D900E08A01 /* 66601-custom_types_ssl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "66601-custom_types_ssl.c"; sourceTree = ""; }; 65536529107EB6D900E08A01 /* 66602-custom_types_ssl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "66602-custom_types_ssl.c"; sourceTree = ""; }; 6553652A107EB6D900E08A01 /* 66603-pp_concat_asn1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "66603-pp_concat_asn1.h"; sourceTree = ""; }; 6553652C107EB6D900E08A01 /* 30000-cout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30000-cout.cpp"; sourceTree = ""; }; 6553652D107EB6D900E08A01 /* 30001-alt_tokens.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30001-alt_tokens.cpp"; sourceTree = ""; }; 6553652E107EB6D900E08A01 /* 30002-constructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30002-constructor.cpp"; sourceTree = ""; }; 6553652F107EB6D900E08A01 /* 30003-strings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30003-strings.cpp"; sourceTree = ""; }; 65536530107EB6D900E08A01 /* 30010-class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30010-class.h"; sourceTree = ""; }; 65536531107EB6D900E08A01 /* 30011-misc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30011-misc.cpp"; sourceTree = ""; }; 65536532107EB6D900E08A01 /* 30012-misc2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30012-misc2.cpp"; sourceTree = ""; }; 65536533107EB6D900E08A01 /* 30013-sim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30013-sim.h"; sourceTree = ""; }; 65536534107EB6D900E08A01 /* 30014-ctor-var.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30014-ctor-var.cpp"; sourceTree = ""; }; 65536535107EB6D900E08A01 /* 30015-exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30015-exception.cpp"; sourceTree = ""; }; 65536536107EB6D900E08A01 /* 30016-custom-open.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30016-custom-open.cpp"; sourceTree = ""; }; 65536537107EB6D900E08A01 /* 30017-custom-open.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30017-custom-open.cpp"; sourceTree = ""; }; 65536538107EB6D900E08A01 /* 30018-class-addr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30018-class-addr.h"; sourceTree = ""; }; 65536539107EB6D900E08A01 /* 30019-wacky-template.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30019-wacky-template.cpp"; sourceTree = ""; }; 6553653A107EB6D900E08A01 /* 30020-bool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30020-bool.cpp"; sourceTree = ""; }; 6553653B107EB6D900E08A01 /* 30021-byref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30021-byref.cpp"; sourceTree = ""; }; 6553653C107EB6D900E08A01 /* 30022-extern_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30022-extern_c.h"; sourceTree = ""; }; 6553653D107EB6D900E08A01 /* 30023-templates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30023-templates.cpp"; sourceTree = ""; }; 6553653E107EB6D900E08A01 /* 30024-class-init.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30024-class-init.cpp"; sourceTree = ""; }; 6553653F107EB6D900E08A01 /* 30025-class-init.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30025-class-init.cpp"; sourceTree = ""; }; 65536540107EB6D900E08A01 /* 30026-byref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30026-byref.cpp"; sourceTree = ""; }; 65536541107EB6D900E08A01 /* 30027-byref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30027-byref.cpp"; sourceTree = ""; }; 65536542107EB6D900E08A01 /* 30028-byref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30028-byref.cpp"; sourceTree = ""; }; 65536543107EB6D900E08A01 /* 30029-init_align.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30029-init_align.h"; sourceTree = ""; }; 65536544107EB6D900E08A01 /* 30030-Timestamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30030-Timestamp.h"; sourceTree = ""; }; 65536545107EB6D900E08A01 /* 30031-operator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30031-operator.cpp"; sourceTree = ""; }; 65536546107EB6D900E08A01 /* 30032-operator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30032-operator.cpp"; sourceTree = ""; }; 65536547107EB6D900E08A01 /* 30033-operator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30033-operator.cpp"; sourceTree = ""; }; 65536548107EB6D900E08A01 /* 30040-nl-class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30040-nl-class.h"; sourceTree = ""; }; 65536549107EB6D900E08A01 /* 30041-nl-class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30041-nl-class.h"; sourceTree = ""; }; 6553654A107EB6D900E08A01 /* 30050-nl-namespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30050-nl-namespace.h"; sourceTree = ""; }; 6553654B107EB6D900E08A01 /* 30051-nl-namespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30051-nl-namespace.h"; sourceTree = ""; }; 6553654C107EB6D900E08A01 /* 30052-try-catch-nl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30052-try-catch-nl.cpp"; sourceTree = ""; }; 6553654D107EB6D900E08A01 /* 30055-nl_func.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30055-nl_func.cpp"; sourceTree = ""; }; 6553654E107EB6D900E08A01 /* 30056-nl_func.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30056-nl_func.cpp"; sourceTree = ""; }; 6553654F107EB6D900E08A01 /* 30061-class-init.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30061-class-init.cpp"; sourceTree = ""; }; 65536550107EB6D900E08A01 /* 30062-class-init.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30062-class-init.cpp"; sourceTree = ""; }; 65536551107EB6D900E08A01 /* 30063-class-init.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30063-class-init.cpp"; sourceTree = ""; }; 65536552107EB6D900E08A01 /* 30064-class-init.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30064-class-init.cpp"; sourceTree = ""; }; 65536553107EB6D900E08A01 /* 30065-Example.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30065-Example.h"; sourceTree = ""; }; 65536554107EB6D900E08A01 /* 30070-nl_func_scope_name.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30070-nl_func_scope_name.cpp"; sourceTree = ""; }; 65536555107EB6D900E08A01 /* 30075-goto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30075-goto.cpp"; sourceTree = ""; }; 65536556107EB6D900E08A01 /* 30100-templates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30100-templates.cpp"; sourceTree = ""; }; 65536557107EB6D900E08A01 /* 30101-templates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30101-templates.cpp"; sourceTree = ""; }; 65536558107EB6D900E08A01 /* 30102-templates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30102-templates.cpp"; sourceTree = ""; }; 65536559107EB6D900E08A01 /* 30103-templates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30103-templates.cpp"; sourceTree = ""; }; 6553655A107EB6D900E08A01 /* 30104-templ_class.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30104-templ_class.h"; sourceTree = ""; }; 6553655B107EB6D900E08A01 /* 30105-av.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30105-av.h"; sourceTree = ""; }; 6553655C107EB6D900E08A01 /* 30106-templates2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30106-templates2.cpp"; sourceTree = ""; }; 6553655D107EB6D900E08A01 /* 30107-templates2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30107-templates2.cpp"; sourceTree = ""; }; 6553655E107EB6D900E08A01 /* 30108-templates3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30108-templates3.cpp"; sourceTree = ""; }; 6553655F107EB6D900E08A01 /* 30109-templates4.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30109-templates4.cpp"; sourceTree = ""; }; 65536560107EB6D900E08A01 /* 30201-cmt_indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30201-cmt_indent.cpp"; sourceTree = ""; }; 65536561107EB6D900E08A01 /* 30202-cmt_indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30202-cmt_indent.cpp"; sourceTree = ""; }; 65536562107EB6D900E08A01 /* 30203-cmt_indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30203-cmt_indent.cpp"; sourceTree = ""; }; 65536563107EB6D900E08A01 /* 30204-comment-align.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30204-comment-align.cpp"; sourceTree = ""; }; 65536564107EB6D900E08A01 /* 30205-cmt_right.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30205-cmt_right.cpp"; sourceTree = ""; }; 65536565107EB6D900E08A01 /* 30250-align_fcall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30250-align_fcall.cpp"; sourceTree = ""; }; 65536566107EB6D900E08A01 /* 30251-align_fcall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30251-align_fcall.cpp"; sourceTree = ""; }; 65536567107EB6D900E08A01 /* 30255-align_constr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30255-align_constr.cpp"; sourceTree = ""; }; 65536568107EB6D900E08A01 /* 30260-var_def_gap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30260-var_def_gap.cpp"; sourceTree = ""; }; 65536569107EB6D900E08A01 /* 30270-const_throw.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30270-const_throw.cpp"; sourceTree = ""; }; 6553656A107EB6D900E08A01 /* 30271-sp_throw_paren.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30271-sp_throw_paren.cpp"; sourceTree = ""; }; 6553656B107EB6D900E08A01 /* 30272-sp_throw_paren.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30272-sp_throw_paren.cpp"; sourceTree = ""; }; 6553656C107EB6D900E08A01 /* 30701-function-def.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30701-function-def.cpp"; sourceTree = ""; }; 6553656D107EB6D900E08A01 /* 30702-function-def.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30702-function-def.cpp"; sourceTree = ""; }; 6553656E107EB6D900E08A01 /* 30703-function-def.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30703-function-def.cpp"; sourceTree = ""; }; 6553656F107EB6D900E08A01 /* 30711-semicolons.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30711-semicolons.cpp"; sourceTree = ""; }; 65536570107EB6D900E08A01 /* 30720-custom-open-2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30720-custom-open-2.cpp"; sourceTree = ""; }; 65536571107EB6D900E08A01 /* 30730-qt-1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30730-qt-1.cpp"; sourceTree = ""; }; 65536572107EB6DA00E08A01 /* 30731-qt-1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30731-qt-1.cpp"; sourceTree = ""; }; 65536573107EB6DA00E08A01 /* 30740-sef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30740-sef.cpp"; sourceTree = ""; }; 65536574107EB6DA00E08A01 /* 30741-al.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30741-al.cpp"; sourceTree = ""; }; 65536575107EB6DA00E08A01 /* 30742-delete.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30742-delete.cpp"; sourceTree = ""; }; 65536576107EB6DA00E08A01 /* 30800-align-star-amp-pos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30800-align-star-amp-pos.cpp"; sourceTree = ""; }; 65536577107EB6DA00E08A01 /* 30801-align-star-amp-pos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30801-align-star-amp-pos.cpp"; sourceTree = ""; }; 65536578107EB6DA00E08A01 /* 30802-align-star-amp-pos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30802-align-star-amp-pos.cpp"; sourceTree = ""; }; 65536579107EB6DA00E08A01 /* 30805-ptr-star.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30805-ptr-star.cpp"; sourceTree = ""; }; 6553657A107EB6DA00E08A01 /* 30806-ptr-star.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30806-ptr-star.cpp"; sourceTree = ""; }; 6553657B107EB6DA00E08A01 /* 30807-ptr-star.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30807-ptr-star.cpp"; sourceTree = ""; }; 6553657C107EB6DA00E08A01 /* 30810-ptr-star.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30810-ptr-star.cpp"; sourceTree = ""; }; 6553657D107EB6DA00E08A01 /* 30811-misc3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30811-misc3.cpp"; sourceTree = ""; }; 6553657E107EB6DA00E08A01 /* 30812-misc4.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30812-misc4.cpp"; sourceTree = ""; }; 6553657F107EB6DA00E08A01 /* 30813-misc5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30813-misc5.cpp"; sourceTree = ""; }; 65536580107EB6DA00E08A01 /* 30814-misc6.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30814-misc6.cpp"; sourceTree = ""; }; 65536581107EB6DA00E08A01 /* 30815-cmt-reflow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30815-cmt-reflow.cpp"; sourceTree = ""; }; 65536582107EB6DA00E08A01 /* 30816-for_long.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30816-for_long.cpp"; sourceTree = ""; }; 65536583107EB6DA00E08A01 /* 30820-pp-define-indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30820-pp-define-indent.cpp"; sourceTree = ""; }; 65536584107EB6DA00E08A01 /* 30830-kw_subst.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30830-kw_subst.cpp"; sourceTree = ""; }; 65536585107EB6DA00E08A01 /* 30831-kw_subst2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30831-kw_subst2.cpp"; sourceTree = ""; }; 65536586107EB6DA00E08A01 /* 30840-nl_func_type_name.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30840-nl_func_type_name.cpp"; sourceTree = ""; }; 65536587107EB6DA00E08A01 /* 30841-nl_func_type_name.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30841-nl_func_type_name.cpp"; sourceTree = ""; }; 65536588107EB6DA00E08A01 /* 30845-deref.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30845-deref.cpp"; sourceTree = ""; }; 65536589107EB6DA00E08A01 /* 30900-region.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30900-region.cpp"; sourceTree = ""; }; 6553658A107EB6DA00E08A01 /* 30901-region.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30901-region.cpp"; sourceTree = ""; }; 6553658B107EB6DA00E08A01 /* 30902-region.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30902-region.cpp"; sourceTree = ""; }; 6553658C107EB6DA00E08A01 /* 30903-region.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30903-region.cpp"; sourceTree = ""; }; 6553658D107EB6DA00E08A01 /* 30910-indent_namespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30910-indent_namespace.h"; sourceTree = ""; }; 6553658E107EB6DA00E08A01 /* 30911-indent_namespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30911-indent_namespace.h"; sourceTree = ""; }; 6553658F107EB6DA00E08A01 /* 30920-indent-off.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30920-indent-off.cpp"; sourceTree = ""; }; 65536590107EB6DA00E08A01 /* 30921-variadic-template.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "30921-variadic-template.h"; sourceTree = ""; }; 65536591107EB6DA00E08A01 /* 30930-indent_var_def.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "30930-indent_var_def.cpp"; sourceTree = ""; }; 65536593107EB6DA00E08A01 /* 10000-simple.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10000-simple.cs"; sourceTree = ""; }; 65536594107EB6DA00E08A01 /* 10001-getset.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10001-getset.cs"; sourceTree = ""; }; 65536595107EB6DA00E08A01 /* 10002-simple.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10002-simple.cs"; sourceTree = ""; }; 65536596107EB6DA00E08A01 /* 10003-region.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10003-region.cs"; sourceTree = ""; }; 65536597107EB6DA00E08A01 /* 10010-var-member.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10010-var-member.cs"; sourceTree = ""; }; 65536598107EB6DA00E08A01 /* 10011-strings.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10011-strings.cs"; sourceTree = ""; }; 65536599107EB6DA00E08A01 /* 10020-region.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10020-region.cs"; sourceTree = ""; }; 6553659A107EB6DA00E08A01 /* 10021-region.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10021-region.cs"; sourceTree = ""; }; 6553659B107EB6DA00E08A01 /* 10022-region.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10022-region.cs"; sourceTree = ""; }; 6553659C107EB6DA00E08A01 /* 10023-region.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10023-region.cs"; sourceTree = ""; }; 6553659D107EB6DA00E08A01 /* 10030-sort_using.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10030-sort_using.cs"; sourceTree = ""; }; 6553659E107EB6DA00E08A01 /* 10040-tcf.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10040-tcf.cs"; sourceTree = ""; }; 6553659F107EB6DA00E08A01 /* 10041-gs.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10041-gs.cs"; sourceTree = ""; }; 655365A0107EB6DA00E08A01 /* 10050-generics.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10050-generics.cs"; sourceTree = ""; }; 655365A1107EB6DA00E08A01 /* 10060-unsafe.cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "10060-unsafe.cs"; sourceTree = ""; }; 655365A3107EB6DA00E08A01 /* 40000-HashMap.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40000-HashMap.d"; sourceTree = ""; }; 655365A4107EB6DA00E08A01 /* 40001-imports.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40001-imports.d"; sourceTree = ""; }; 655365A5107EB6DA00E08A01 /* 40002-volatile.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40002-volatile.d"; sourceTree = ""; }; 655365A6107EB6DA00E08A01 /* 40003-volatile-1.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40003-volatile-1.d"; sourceTree = ""; }; 655365A7107EB6DA00E08A01 /* 40004-volatile-2.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40004-volatile-2.d"; sourceTree = ""; }; 655365A8107EB6DA00E08A01 /* 40005-volatile-3.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40005-volatile-3.d"; sourceTree = ""; }; 655365A9107EB6DA00E08A01 /* 40006-Lexer.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40006-Lexer.d"; sourceTree = ""; }; 655365AA107EB6DA00E08A01 /* 40007-Lexer.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40007-Lexer.d"; sourceTree = ""; }; 655365AB107EB6DA00E08A01 /* 40010-template.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40010-template.d"; sourceTree = ""; }; 655365AC107EB6DA00E08A01 /* 40020-funcfunc.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40020-funcfunc.d"; sourceTree = ""; }; 655365AD107EB6DA00E08A01 /* 40021-tst01.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40021-tst01.d"; sourceTree = ""; }; 655365AE107EB6DA00E08A01 /* 40022-tst02.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40022-tst02.d"; sourceTree = ""; }; 655365AF107EB6DA00E08A01 /* 40023-bug-indent.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40023-bug-indent.d"; sourceTree = ""; }; 655365B0107EB6DA00E08A01 /* 40024-tst03.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40024-tst03.d"; sourceTree = ""; }; 655365B1107EB6DA00E08A01 /* 40025-tst03.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40025-tst03.d"; sourceTree = ""; }; 655365B2107EB6DA00E08A01 /* 40030-delegate.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40030-delegate.d"; sourceTree = ""; }; 655365B3107EB6DA00E08A01 /* 40040-sort_import.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40040-sort_import.d"; sourceTree = ""; }; 655365B4107EB6DA00E08A01 /* 40050-strings.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40050-strings.d"; sourceTree = ""; }; 655365B5107EB6DA00E08A01 /* 40051-numbers.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40051-numbers.d"; sourceTree = ""; }; 655365B6107EB6DA00E08A01 /* 40052-numbers.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; path = "40052-numbers.d"; sourceTree = ""; }; 655365B8107EB6DA00E08A01 /* 90000-example-1.es */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "90000-example-1.es"; sourceTree = ""; }; 655365BB107EB6DA00E08A01 /* 50001-Fraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "50001-Fraction.h"; sourceTree = ""; }; 655365BC107EB6DA00E08A01 /* 50002-Fraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50002-Fraction.m"; sourceTree = ""; }; 655365BD107EB6DA00E08A01 /* 50003-main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50003-main.m"; sourceTree = ""; }; 655365BE107EB6DA00E08A01 /* 50004-string.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50004-string.m"; sourceTree = ""; }; 655365BF107EB6DA00E08A01 /* 50005-Declarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "50005-Declarations.h"; sourceTree = ""; }; 655365C0107EB6DA00E08A01 /* 50006-exceptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50006-exceptions.m"; sourceTree = ""; }; 655365C1107EB6DA00E08A01 /* 50030-sort_import.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50030-sort_import.m"; sourceTree = ""; }; 655365C3107EB6DA00E08A01 /* 60000-functions.pawn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "60000-functions.pawn"; sourceTree = ""; }; 655365C4107EB6DA00E08A01 /* 60001-comment.p */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = "60001-comment.p"; sourceTree = ""; }; 655365C5107EB6DA00E08A01 /* 60002-traffic.p */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = "60002-traffic.p"; sourceTree = ""; }; 655365C6107EB6DA00E08A01 /* 60003-tags.pawn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "60003-tags.pawn"; sourceTree = ""; }; 655365C7107EB6DA00E08A01 /* 60004-enum.pawn */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "60004-enum.pawn"; sourceTree = ""; }; 655365C8107EB6DA00E08A01 /* 60005-unbraced.p */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = "60005-unbraced.p"; sourceTree = ""; }; 655365C9107EB6DA00E08A01 /* 60010-str-escape.p */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = "60010-str-escape.p"; sourceTree = ""; }; 655365CA107EB6DA00E08A01 /* 60020-switch-vsemi.sma */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "60020-switch-vsemi.sma"; sourceTree = ""; }; 655365CB107EB6DA00E08A01 /* 60030-crusty_ex-1.sma */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "60030-crusty_ex-1.sma"; sourceTree = ""; }; 655365CD107EB6DA00E08A01 /* 21000-mysql.sqc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "21000-mysql.sqc"; sourceTree = ""; }; 655365CE107EB6DA00E08A01 /* 21001-sta-select.sqc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "21001-sta-select.sqc"; sourceTree = ""; }; 655365D0107EB6DA00E08A01 /* 70000-list.vala */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "70000-list.vala"; sourceTree = ""; }; 655365D1107EB6DA00E08A01 /* 70001-advanced.vala */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "70001-advanced.vala"; sourceTree = ""; }; 655365D2107EB6DA00E08A01 /* pawn.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = pawn.test; sourceTree = ""; }; 655365D3107EB6DA00E08A01 /* run_tests.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = run_tests.py; sourceTree = ""; }; 655365D4107EB6DA00E08A01 /* tests.vpj */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tests.vpj; sourceTree = ""; }; 655365D5107EB6DA00E08A01 /* vala.test */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = vala.test; sourceTree = ""; }; 655365DD107EB6DA00E08A01 /* windows_compat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = windows_compat.h; sourceTree = ""; }; 655367C9107EB73F00E08A01 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; 655367CA107EB73F00E08A01 /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.in; sourceTree = ""; }; 655367CB107EB73F00E08A01 /* uncrustify.1 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.man; path = uncrustify.1; sourceTree = ""; }; 6553680F107EB7FA00E08A01 /* align.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = align.cpp; sourceTree = ""; }; 65536810107EB7FA00E08A01 /* align_stack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = align_stack.cpp; sourceTree = ""; }; 65536811107EB7FA00E08A01 /* align_stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = align_stack.h; sourceTree = ""; }; 65536812107EB7FA00E08A01 /* args.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = args.cpp; sourceTree = ""; }; 65536813107EB7FA00E08A01 /* args.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = args.h; sourceTree = ""; }; 65536814107EB7FA00E08A01 /* backup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = backup.cpp; sourceTree = ""; }; 65536815107EB7FA00E08A01 /* backup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = backup.h; sourceTree = ""; }; 65536816107EB7FA00E08A01 /* base_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base_types.h; sourceTree = ""; }; 65536817107EB7FA00E08A01 /* brace_cleanup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = brace_cleanup.cpp; sourceTree = ""; }; 65536818107EB7FA00E08A01 /* braces.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = braces.cpp; sourceTree = ""; }; 65536819107EB7FA00E08A01 /* char_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = char_table.h; sourceTree = ""; }; 6553681A107EB7FA00E08A01 /* chunk_list.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chunk_list.cpp; sourceTree = ""; }; 6553681B107EB7FA00E08A01 /* chunk_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chunk_list.h; sourceTree = ""; }; 6553681C107EB7FA00E08A01 /* ChunkStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChunkStack.cpp; sourceTree = ""; }; 6553681D107EB7FA00E08A01 /* ChunkStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChunkStack.h; sourceTree = ""; }; 6553681E107EB7FA00E08A01 /* combine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = combine.cpp; sourceTree = ""; }; 6553681F107EB7FA00E08A01 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; 65536820107EB7FA00E08A01 /* config.h.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = config.h.in; sourceTree = ""; }; 65536822107EB7FA00E08A01 /* defines.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = defines.cpp; sourceTree = ""; }; 65536823107EB7FA00E08A01 /* detect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = detect.cpp; sourceTree = ""; }; 65536824107EB7FA00E08A01 /* indent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = indent.cpp; sourceTree = ""; }; 65536825107EB7FA00E08A01 /* keywords.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = keywords.cpp; sourceTree = ""; }; 65536826107EB7FA00E08A01 /* lang_pawn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lang_pawn.cpp; sourceTree = ""; }; 65536827107EB7FA00E08A01 /* ListManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListManager.h; sourceTree = ""; }; 65536828107EB7FA00E08A01 /* log_levels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log_levels.h; sourceTree = ""; }; 65536829107EB7FA00E08A01 /* logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = logger.cpp; sourceTree = ""; }; 6553682A107EB7FA00E08A01 /* logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = logger.h; sourceTree = ""; }; 6553682B107EB7FA00E08A01 /* logmask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = logmask.cpp; sourceTree = ""; }; 6553682C107EB7FA00E08A01 /* logmask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = logmask.h; sourceTree = ""; }; 6553682D107EB7FA00E08A01 /* Makefile.am */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.am; sourceTree = ""; }; 6553682E107EB7FA00E08A01 /* Makefile.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.in; sourceTree = ""; }; 6553682F107EB7FA00E08A01 /* md5.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = md5.cpp; sourceTree = ""; }; 65536830107EB7FA00E08A01 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = ""; }; 65536831107EB7FA00E08A01 /* newlines.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = newlines.cpp; sourceTree = ""; }; 65536832107EB7FA00E08A01 /* options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = options.cpp; sourceTree = ""; }; 65536833107EB7FA00E08A01 /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options.h; sourceTree = ""; }; 65536834107EB7FA00E08A01 /* output.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = output.cpp; sourceTree = ""; }; 65536835107EB7FA00E08A01 /* parens.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parens.cpp; sourceTree = ""; }; 65536836107EB7FA00E08A01 /* parse_frame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = parse_frame.cpp; sourceTree = ""; }; 65536837107EB7FA00E08A01 /* prototypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prototypes.h; sourceTree = ""; }; 65536838107EB7FA00E08A01 /* punctuators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = punctuators.cpp; sourceTree = ""; }; 65536839107EB7FA00E08A01 /* punctuators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = punctuators.h; sourceTree = ""; }; 6553683A107EB7FA00E08A01 /* semicolons.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = semicolons.cpp; sourceTree = ""; }; 6553683B107EB7FA00E08A01 /* sorting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sorting.cpp; sourceTree = ""; }; 6553683C107EB7FA00E08A01 /* space.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = space.cpp; sourceTree = ""; }; 6553683D107EB7FA00E08A01 /* token_enum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = token_enum.h; sourceTree = ""; }; 6553683E107EB7FA00E08A01 /* token_names.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = token_names.h; sourceTree = ""; }; 6553683F107EB7FA00E08A01 /* tokenize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tokenize.cpp; sourceTree = ""; }; 65536840107EB7FA00E08A01 /* tokenize_cleanup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tokenize_cleanup.cpp; sourceTree = ""; }; 65536841107EB7FA00E08A01 /* unc_ctype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unc_ctype.h; sourceTree = ""; }; 65536842107EB7FA00E08A01 /* uncrustify.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = uncrustify.cpp; sourceTree = ""; }; 65536843107EB7FA00E08A01 /* uncrustify_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uncrustify_types.h; sourceTree = ""; }; 65536844107EB7FA00E08A01 /* uncrustify_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uncrustify_version.h; sourceTree = ""; }; 65536845107EB7FA00E08A01 /* universalindentgui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = universalindentgui.cpp; sourceTree = ""; }; 65536846107EB7FA00E08A01 /* width.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = width.cpp; sourceTree = ""; }; 65536921107EC62D00E08A01 /* Xcode Organizer Actions.xccommands */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Xcode Organizer Actions.xccommands"; sourceTree = ""; }; 656E28301082F349007F873A /* selector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = selector.m; sourceTree = ""; }; 659F8D37108A9A380004E4CB /* complex_method.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = complex_method.m; sourceTree = ""; }; 659F8DA6108AD5AC0004E4CB /* 50040-complex_method.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50040-complex_method.m"; sourceTree = ""; }; 659F8DD8108ADCB30004E4CB /* objc_complex_method.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = objc_complex_method.cfg; sourceTree = ""; }; 65A462A61092CB7F007F6EBA /* sp_after_oc_block_caret_add.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_block_caret_add.cfg; sourceTree = ""; }; 65A462A71092CB7F007F6EBA /* sp_after_oc_block_caret_force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_block_caret_force.cfg; sourceTree = ""; }; 65A462A81092CB7F007F6EBA /* sp_after_oc_block_caret_remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_block_caret_remove.cfg; sourceTree = ""; }; 65A462A91092CB7F007F6EBA /* sp_before_oc_block_caret_add.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_before_oc_block_caret_add.cfg; sourceTree = ""; }; 65A462AA1092CB7F007F6EBA /* sp_before_oc_block_caret_force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_before_oc_block_caret_force.cfg; sourceTree = ""; }; 65A462AB1092CB7F007F6EBA /* sp_before_oc_block_caret_remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_before_oc_block_caret_remove.cfg; sourceTree = ""; }; 65A462CE1092CFCC007F6EBA /* sp_before_after_oc_block_caret_remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_before_after_oc_block_caret_remove.cfg; sourceTree = ""; }; 65A462ED1092D101007F6EBA /* 50070-blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50070-blocks.m"; sourceTree = ""; }; 65A462EE1092D101007F6EBA /* 50071-blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50071-blocks.m"; sourceTree = ""; }; 65A462EF1092D101007F6EBA /* 50072-blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50072-blocks.m"; sourceTree = ""; }; 65A462F01092D101007F6EBA /* 50073-blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50073-blocks.m"; sourceTree = ""; }; 65A462F11092D101007F6EBA /* 50074-blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50074-blocks.m"; sourceTree = ""; }; 65A462F21092D101007F6EBA /* 50075-blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50075-blocks.m"; sourceTree = ""; }; 65A462F31092D101007F6EBA /* 50076-blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50076-blocks.m"; sourceTree = ""; }; 65A463291092D346007F6EBA /* 50077-more_blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50077-more_blocks.m"; sourceTree = ""; }; 65A4632A1092D346007F6EBA /* 50078-more_blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50078-more_blocks.m"; sourceTree = ""; }; 65A4632B1092D346007F6EBA /* 50079-more_blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50079-more_blocks.m"; sourceTree = ""; }; 65A4632C1092D346007F6EBA /* 50080-more_blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50080-more_blocks.m"; sourceTree = ""; }; 65A4632D1092D346007F6EBA /* 50081-more_blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50081-more_blocks.m"; sourceTree = ""; }; 65A4632E1092D346007F6EBA /* 50082-more_blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50082-more_blocks.m"; sourceTree = ""; }; 65A4632F1092D346007F6EBA /* 50083-more_blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50083-more_blocks.m"; sourceTree = ""; }; 65B887C61082CBBD00D10769 /* example.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = example.c; path = documentation/example.c; sourceTree = ""; }; 65B887C81082CBBD00D10769 /* align-thresholds.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "align-thresholds.txt"; path = "documentation/align-thresholds.txt"; sourceTree = ""; }; 65B887C91082CBBD00D10769 /* goals.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = goals.txt; path = documentation/goals.txt; sourceTree = ""; }; 65B887CA1082CBBD00D10769 /* paren_stack.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = paren_stack.txt; path = documentation/paren_stack.txt; sourceTree = ""; }; 65B887CB1082CBBD00D10769 /* theory.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = theory.txt; path = documentation/theory.txt; sourceTree = ""; }; 65DB4D851084CEDC005E7765 /* sp_after_oc_return_type_add.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_return_type_add.cfg; sourceTree = ""; }; 65DB4D941084D030005E7765 /* 50010-return_type.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50010-return_type.m"; sourceTree = ""; }; 65DB4DA11084D098005E7765 /* sp_after_oc_return_type_force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_return_type_force.cfg; sourceTree = ""; }; 65DB4DA21084D098005E7765 /* sp_after_oc_return_type_remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_return_type_remove.cfg; sourceTree = ""; }; 65DB4DB41084D174005E7765 /* 50011-return_type.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50011-return_type.m"; sourceTree = ""; }; 65DB4DB51084D174005E7765 /* 50012-return_type.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50012-return_type.m"; sourceTree = ""; }; 65DB4DB81084D200005E7765 /* return_type.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = return_type.m; sourceTree = ""; }; 65DB4DC61084D2E3005E7765 /* 50020-selector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50020-selector.m"; sourceTree = ""; }; 65DB4DC71084D2E3005E7765 /* 50021-selector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50021-selector.m"; sourceTree = ""; }; 65DB4DC81084D2E3005E7765 /* 50022-selector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "50022-selector.m"; sourceTree = ""; }; 65DB4DD21084D423005E7765 /* sp_after_oc_at_sel_add.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_at_sel_add.cfg; sourceTree = ""; }; 65DB4DD31084D423005E7765 /* sp_after_oc_at_sel_force.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_at_sel_force.cfg; sourceTree = ""; }; 65DB4DD41084D423005E7765 /* sp_after_oc_at_sel_remove.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sp_after_oc_at_sel_remove.cfg; sourceTree = ""; }; 65DB4E1D1084D99C005E7765 /* ben.cfg.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ben.cfg.txt; sourceTree = ""; }; 65DB4E1E1084D99C005E7765 /* ChangeLog */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ChangeLog; sourceTree = ""; }; 65DB4E1F1084D99C005E7765 /* config.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = config.txt; sourceTree = ""; }; 65DB4E201084D99C005E7765 /* configuration.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = configuration.txt; sourceTree = ""; }; 65DB4E211084D99C005E7765 /* default.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = default.cfg; sourceTree = ""; }; 65DB4E231084D99C005E7765 /* c-1.in.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "c-1.in.c"; sourceTree = ""; }; 65DB4E241084D99C005E7765 /* c-1.out.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "c-1.out.c"; sourceTree = ""; }; 65DB4E251084D99C005E7765 /* example.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = example.c; sourceTree = ""; }; 65DB4E271084D99C005E7765 /* linuxlinks.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = linuxlinks.gif; sourceTree = ""; }; 65DB4E281084D99C005E7765 /* index.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html.documentation; path = index.html; sourceTree = ""; }; 65DB4E291084D99C005E7765 /* linux.cfg.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = linux.cfg.txt; sourceTree = ""; }; 65DB4E2A1084D99C005E7765 /* project-support.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "project-support.jpg"; sourceTree = ""; }; 65DB4E2B1084D99C005E7765 /* uncrustify.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = uncrustify.css; sourceTree = ""; }; 65DB4E2C1084D99C005E7765 /* uncrustify.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html.documentation; path = uncrustify.html; sourceTree = ""; }; 8DD76F6C0486A84900D96B5E /* uncrustify */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = uncrustify; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 8DD76F660486A84900D96B5E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 08FB7794FE84155DC02AAC07 /* uncrustify */ = { isa = PBXGroup; children = ( 08FB7795FE84155DC02AAC07 /* Source */, C6859E8C029090F304C91782 /* Documentation */, 655362A6107EB5E600E08A01 /* Other Sources */, 1AB674ADFE9D54B511CA2CBB /* Products */, ); name = uncrustify; sourceTree = ""; }; 08FB7795FE84155DC02AAC07 /* Source */ = { isa = PBXGroup; children = ( 6553680E107EB7FA00E08A01 /* src */, ); name = Source; sourceTree = ""; }; 1AB674ADFE9D54B511CA2CBB /* Products */ = { isa = PBXGroup; children = ( 8DD76F6C0486A84900D96B5E /* uncrustify */, ); name = Products; sourceTree = ""; }; 655362A6107EB5E600E08A01 /* Other Sources */ = { isa = PBXGroup; children = ( 655362B3107EB6D900E08A01 /* etc */, 655362C4107EB6D900E08A01 /* scripts */, 655362CA107EB6D900E08A01 /* tests */, 655365D6107EB6DA00E08A01 /* win32 */, 65536904107EC47E00E08A01 /* osx */, 655362A9107EB67900E08A01 /* configure.in */, 655362AA107EB67900E08A01 /* Makefile.in */, 655362AB107EB67900E08A01 /* release-steps.txt */, 655362AC107EB67900E08A01 /* todo.txt */, 655362AD107EB67900E08A01 /* autogen.sh */, 655362AE107EB67900E08A01 /* do-c.sh */, 655362AF107EB67900E08A01 /* do-d.sh */, 655362B0107EB67900E08A01 /* make_token_names.sh */, 655362B1107EB67900E08A01 /* run_tests.sh */, 655362B2107EB67900E08A01 /* update-default-cfg.sh */, ); includeInIndex = 0; name = "Other Sources"; sourceTree = ""; }; 655362B3107EB6D900E08A01 /* etc */ = { isa = PBXGroup; children = ( 655362B4107EB6D900E08A01 /* amxmodx.cfg */, 655362B5107EB6D900E08A01 /* ben.cfg */, 655362B6107EB6D900E08A01 /* ben2.cfg */, 655362B7107EB6D900E08A01 /* d.cfg */, 655362B8107EB6D900E08A01 /* defaults.cfg */, 655362B9107EB6D900E08A01 /* dofiles.sh */, 655362BA107EB6D900E08A01 /* gnu-indent.cfg */, 655362BB107EB6D900E08A01 /* klaus.cfg */, 655362BC107EB6D900E08A01 /* kr-indent.cfg */, 655362BD107EB6D900E08A01 /* linux-indent.cfg */, 655362BE107EB6D900E08A01 /* linux.cfg */, 655362BF107EB6D900E08A01 /* mono.cfg */, 655362C0107EB6D900E08A01 /* objc.cfg */, 655362C1107EB6D900E08A01 /* types.txt */, 655362C2107EB6D900E08A01 /* uncrust-files.sh */, 655362C3107EB6D900E08A01 /* xsupplicant.cfg */, ); path = etc; sourceTree = ""; }; 655362C4107EB6D900E08A01 /* scripts */ = { isa = PBXGroup; children = ( 655362C5107EB6D900E08A01 /* check_options.py */, 655362C6107EB6D900E08A01 /* cmpcfg.pl */, 655362C7107EB6D900E08A01 /* punc.py */, 655362C8107EB6D900E08A01 /* tokenize.py */, 655362C9107EB6D900E08A01 /* update-defaults.sh */, ); path = scripts; sourceTree = ""; }; 655362CA107EB6D900E08A01 /* tests */ = { isa = PBXGroup; children = ( 655362CD107EB6D900E08A01 /* config */, 65536393107EB6D900E08A01 /* input */, 65536484107EB6D900E08A01 /* output */, 65536391107EB6D900E08A01 /* embed.c */, 655365D3107EB6DA00E08A01 /* run_tests.py */, 6553638F107EB6D900E08A01 /* difftest.sh */, 65536392107EB6D900E08A01 /* fixtest.sh */, 655362CB107EB6D900E08A01 /* c-sharp.test */, 655362CC107EB6D900E08A01 /* c.test */, 6553638D107EB6D900E08A01 /* cpp.test */, 6553638E107EB6D900E08A01 /* d.test */, 65536390107EB6D900E08A01 /* ecma.test */, 65536482107EB6D900E08A01 /* java.test */, 65536483107EB6D900E08A01 /* objective-c.test */, 655365D2107EB6DA00E08A01 /* pawn.test */, 655365D5107EB6DA00E08A01 /* vala.test */, 655365D4107EB6DA00E08A01 /* tests.vpj */, ); path = tests; sourceTree = ""; }; 655362CD107EB6D900E08A01 /* config */ = { isa = PBXGroup; children = ( 655362CE107EB6D900E08A01 /* 1liner-no-split.cfg */, 655362CF107EB6D900E08A01 /* 1liner-split.cfg */, 655362D0107EB6D900E08A01 /* add_long_closebrace_comment_1.cfg */, 655362D1107EB6D900E08A01 /* al.cfg */, 655362D2107EB6D900E08A01 /* align-1.cfg */, 655362D3107EB6D900E08A01 /* align-2.cfg */, 655362D4107EB6D900E08A01 /* align-3.cfg */, 655362D5107EB6D900E08A01 /* align_attr.cfg */, 655362D6107EB6D900E08A01 /* align_fcall-2.cfg */, 655362D7107EB6D900E08A01 /* align_fcall.cfg */, 655362D8107EB6D900E08A01 /* align_right_cmt_gap-1.cfg */, 655362D9107EB6D900E08A01 /* align_right_cmt_gap-2.cfg */, 655362DA107EB6D900E08A01 /* align_typedef_func-0.cfg */, 655362DB107EB6D900E08A01 /* align_typedef_func-1.cfg */, 655362DC107EB6D900E08A01 /* align_typedef_func-2.cfg */, 655362DD107EB6D900E08A01 /* amxmodx.cfg */, 655362DE107EB6D900E08A01 /* avalon.cfg */, 655362DF107EB6D900E08A01 /* avalon2.cfg */, 655362E0107EB6D900E08A01 /* avalon3.cfg */, 655362E1107EB6D900E08A01 /* avalon4.cfg */, 655362E2107EB6D900E08A01 /* ben.cfg */, 655362E3107EB6D900E08A01 /* blc-1.cfg */, 655362E4107EB6D900E08A01 /* bool-pos-eol.cfg */, 655362E5107EB6D900E08A01 /* bool-pos-sol.cfg */, 655362E6107EB6D900E08A01 /* brace-allman.cfg */, 655362E7107EB6D900E08A01 /* brace-banner.cfg */, 655362E8107EB6D900E08A01 /* brace-gnu.cfg */, 655362E9107EB6D900E08A01 /* brace-kr-br.cfg */, 655362EA107EB6D900E08A01 /* brace-kr.cfg */, 655362EB107EB6D900E08A01 /* brace-remove-2.cfg */, 655362EC107EB6D900E08A01 /* brace-remove-all.cfg */, 655362ED107EB6D900E08A01 /* brace-ws.cfg */, 655362EE107EB6D900E08A01 /* brace-ws2.cfg */, 655362EF107EB6D900E08A01 /* byref-center.cfg */, 655362F0107EB6D900E08A01 /* byref-left.cfg */, 655362F1107EB6D900E08A01 /* byref-right.cfg */, 655362F2107EB6D900E08A01 /* case-1.cfg */, 655362F3107EB6D900E08A01 /* case-2.cfg */, 655362F4107EB6D900E08A01 /* case-3.cfg */, 655362F5107EB6D900E08A01 /* cast-sp-a.cfg */, 655362F6107EB6D900E08A01 /* cast-sp-r.cfg */, 655362F7107EB6D900E08A01 /* cast-type.cfg */, 655362F8107EB6D900E08A01 /* cast-types.txt */, 655362F9107EB6D900E08A01 /* cgal.cfg */, 655362FA107EB6D900E08A01 /* clark.cfg */, 655362FB107EB6D900E08A01 /* class-colon-pos-eol-add.cfg */, 655362FC107EB6D900E08A01 /* class-colon-pos-eol.cfg */, 655362FD107EB6D900E08A01 /* class-colon-pos-sol-add.cfg */, 655362FE107EB6D900E08A01 /* class-colon-pos-sol.cfg */, 655362FF107EB6D900E08A01 /* class-header.h */, 65536300107EB6D900E08A01 /* class-nl_func-add.cfg */, 65536301107EB6D900E08A01 /* class-nl_func-del.cfg */, 65536302107EB6D900E08A01 /* cmt_indent-1.cfg */, 65536303107EB6D900E08A01 /* cmt_indent-2.cfg */, 65536304107EB6D900E08A01 /* cmt_indent-3.cfg */, 65536305107EB6D900E08A01 /* cmt_multi-1.cfg */, 65536306107EB6D900E08A01 /* cmt_multi-2.cfg */, 65536307107EB6D900E08A01 /* cmt_nl_end.cfg */, 65536308107EB6D900E08A01 /* cmt_right.cfg */, 65536309107EB6D900E08A01 /* comment-align.cfg */, 6553630A107EB6D900E08A01 /* cond-1.cfg */, 6553630B107EB6D900E08A01 /* cond-2.cfg */, 6553630C107EB6D900E08A01 /* const_throw.cfg */, 6553630D107EB6D900E08A01 /* cpp_to_c-1.cfg */, 6553630E107EB6D900E08A01 /* cpp_to_c-2.cfg */, 6553630F107EB6D900E08A01 /* cpp_to_c-3.cfg */, 65536310107EB6D900E08A01 /* cs_generics.cfg */, 65536311107EB6D900E08A01 /* cu.cfg */, 65536312107EB6D900E08A01 /* custom-open.cfg */, 65536313107EB6D900E08A01 /* custom-open2.cfg */, 65536314107EB6D900E08A01 /* custom_types_ssl.cfg */, 65536315107EB6D900E08A01 /* d-tst2.cfg */, 65536316107EB6D900E08A01 /* d.cfg */, 65536317107EB6D900E08A01 /* d2.cfg */, 65536318107EB6D900E08A01 /* d3.cfg */, 65536319107EB6D900E08A01 /* d3a.cfg */, 6553631A107EB6D900E08A01 /* del_semicolon.cfg */, 6553631B107EB6D900E08A01 /* delete.cfg */, 6553631C107EB6D900E08A01 /* else-if-1.cfg */, 6553631D107EB6D900E08A01 /* else-if-2.cfg */, 6553631E107EB6D900E08A01 /* empty_body.cfg */, 6553631F107EB6D900E08A01 /* endif.cfg */, 65536320107EB6D900E08A01 /* file-header.h */, 65536321107EB6D900E08A01 /* file_footer.txt */, 65536322107EB6D900E08A01 /* file_header.txt */, 65536323107EB6D900E08A01 /* func-def-1.cfg */, 65536324107EB6D900E08A01 /* func-def-2.cfg */, 65536325107EB6D900E08A01 /* func-def-3.cfg */, 65536326107EB6D900E08A01 /* func-header.h */, 65536327107EB6D900E08A01 /* func-header2.h */, 65536328107EB6D900E08A01 /* func_call_user.cfg */, 65536329107EB6D900E08A01 /* func_wrap1.cfg */, 6553632A107EB6D900E08A01 /* func_wrap2.cfg */, 6553632B107EB6D900E08A01 /* function_header.txt */, 6553632C107EB6D900E08A01 /* ger.cfg */, 6553632D107EB6D900E08A01 /* getset.cfg */, 6553632E107EB6D900E08A01 /* indent-1.cfg */, 6553632F107EB6D900E08A01 /* indent.cfg */, 65536330107EB6D900E08A01 /* indent_func_call_param.cfg */, 65536331107EB6D900E08A01 /* indent_func_def_param.cfg */, 65536332107EB6D900E08A01 /* indent_func_param.cfg */, 65536333107EB6D900E08A01 /* indent_func_proto_param.cfg */, 65536334107EB6D900E08A01 /* indent_namespace-f.cfg */, 65536335107EB6D900E08A01 /* indent_namespace-t.cfg */, 65536336107EB6D900E08A01 /* indent_paren_close-0.cfg */, 65536337107EB6D900E08A01 /* indent_paren_close-1.cfg */, 65536338107EB6D900E08A01 /* indent_paren_close-2.cfg */, 65536339107EB6D900E08A01 /* indent_var_def.cfg */, 6553633A107EB6D900E08A01 /* kw_subst.cfg */, 6553633B107EB6D900E08A01 /* kw_subst2.cfg */, 6553633C107EB6D900E08A01 /* kw_subst3.cfg */, 6553633D107EB6D900E08A01 /* misc6.cfg */, 6553633E107EB6D900E08A01 /* mod-paren.cfg */, 6553633F107EB6D900E08A01 /* mod-paren2.cfg */, 65536340107EB6D900E08A01 /* mono.cfg */, 65536341107EB6D900E08A01 /* multi.cfg */, 65536342107EB6D900E08A01 /* newline_after_endif.cfg */, 65536343107EB6D900E08A01 /* nl-comment.cfg */, 65536344107EB6D900E08A01 /* nl_access_spec.cfg */, 65536345107EB6D900E08A01 /* nl_after_func_body-2.cfg */, 65536346107EB6D900E08A01 /* nl_after_func_body.cfg */, 65536347107EB6D900E08A01 /* nl_assign1.cfg */, 65536348107EB6D900E08A01 /* nl_assign2.cfg */, 65536349107EB6D900E08A01 /* nl_brace_test.cfg */, 6553634A107EB6D900E08A01 /* nl_class-a.cfg */, 6553634B107EB6D900E08A01 /* nl_class-r.cfg */, 6553634C107EB6D900E08A01 /* nl_create_one_liner.cfg */, 6553634D107EB6D900E08A01 /* nl_ds_struct_enum-1.cfg */, 6553634E107EB6D900E08A01 /* nl_ds_struct_enum-2.cfg */, 6553634F107EB6D900E08A01 /* nl_endif.cfg */, 65536350107EB6D900E08A01 /* nl_func_scope_name.cfg */, 65536351107EB6D900E08A01 /* nl_func_type_name_force.cfg */, 65536352107EB6D900E08A01 /* nl_func_type_name_remove.cfg */, 65536353107EB6D900E08A01 /* nl_namespace-a.cfg */, 65536354107EB6D900E08A01 /* nl_namespace-r.cfg */, 65536355107EB6D900E08A01 /* nl_semicolon.cfg */, 65536356107EB6D900E08A01 /* nl_template_class-force.cfg */, 65536357107EB6D900E08A01 /* nl_template_class-remove.cfg */, 65536358107EB6D900E08A01 /* nl_try-a.cfg */, 65536359107EB6D900E08A01 /* obj-c.cfg */, 659F8DD8108ADCB30004E4CB /* objc_complex_method.cfg */, 654C6DB3108F62E900556CD9 /* oc-split.cfg */, 6553635A107EB6D900E08A01 /* op-space-force.cfg */, 6553635B107EB6D900E08A01 /* op-space-remove.cfg */, 6553635C107EB6D900E08A01 /* pascal_ptr.cfg */, 6553635D107EB6D900E08A01 /* pawn-escape.cfg */, 6553635E107EB6D900E08A01 /* pawn.cfg */, 6553635F107EB6D900E08A01 /* pp-indent-1.cfg */, 65536360107EB6D900E08A01 /* pp-indent-2.cfg */, 65536361107EB6D900E08A01 /* pp-indent-3.cfg */, 65536362107EB6D900E08A01 /* pp-space.cfg */, 65536363107EB6D900E08A01 /* pp_define_at_level-1.cfg */, 65536364107EB6D900E08A01 /* pp_if_indent-0.cfg */, 65536365107EB6D900E08A01 /* pp_if_indent-1.cfg */, 65536366107EB6D900E08A01 /* pp_if_indent-2.cfg */, 65536367107EB6D900E08A01 /* pp_if_indent-3.cfg */, 65536368107EB6D900E08A01 /* pp_ret.cfg */, 65536369107EB6D900E08A01 /* preproc-cleanup.cfg */, 6553636A107EB6D900E08A01 /* ptr_star-1.cfg */, 6553636B107EB6D900E08A01 /* ptr_star-2.cfg */, 6553636C107EB6D900E08A01 /* ptr_star-3.cfg */, 6553636D107EB6D900E08A01 /* region-0.cfg */, 6553636E107EB6D900E08A01 /* region-1.cfg */, 6553636F107EB6D900E08A01 /* region-2.cfg */, 65536370107EB6D900E08A01 /* region-3.cfg */, 65536371107EB6D900E08A01 /* return-1.cfg */, 65536372107EB6D900E08A01 /* return-2.cfg */, 65536373107EB6D900E08A01 /* return-3.cfg */, 65536374107EB6D900E08A01 /* return-4.cfg */, 65536375107EB6D900E08A01 /* sef.cfg */, 65536376107EB6D900E08A01 /* sim.cfg */, 65536377107EB6D900E08A01 /* sort_imports.cfg */, 65536378107EB6D900E08A01 /* sp-for-semi.cfg */, 65536379107EB6D900E08A01 /* sp_after_cast.cfg */, 65DB4DD21084D423005E7765 /* sp_after_oc_at_sel_add.cfg */, 65DB4DD31084D423005E7765 /* sp_after_oc_at_sel_force.cfg */, 65DB4DD41084D423005E7765 /* sp_after_oc_at_sel_remove.cfg */, 65DB4D851084CEDC005E7765 /* sp_after_oc_return_type_add.cfg */, 65DB4DA11084D098005E7765 /* sp_after_oc_return_type_force.cfg */, 65DB4DA21084D098005E7765 /* sp_after_oc_return_type_remove.cfg */, 6553637A107EB6D900E08A01 /* sp_cmt_cpp_start_add.cfg */, 6553637B107EB6D900E08A01 /* sp_cmt_cpp_start_force.cfg */, 6553637C107EB6D900E08A01 /* sp_cmt_cpp_start_remove.cfg */, 6553637D107EB6D900E08A01 /* sp_throw_paren-f.cfg */, 6553637E107EB6D900E08A01 /* sp_throw_paren-r.cfg */, 65A462A61092CB7F007F6EBA /* sp_after_oc_block_caret_add.cfg */, 65A462A71092CB7F007F6EBA /* sp_after_oc_block_caret_force.cfg */, 65A462A81092CB7F007F6EBA /* sp_after_oc_block_caret_remove.cfg */, 65A462A91092CB7F007F6EBA /* sp_before_oc_block_caret_add.cfg */, 65A462AA1092CB7F007F6EBA /* sp_before_oc_block_caret_force.cfg */, 65A462AB1092CB7F007F6EBA /* sp_before_oc_block_caret_remove.cfg */, 65A462CE1092CFCC007F6EBA /* sp_before_after_oc_block_caret_remove.cfg */, 6553637F107EB6D900E08A01 /* star_pos-0.cfg */, 65536380107EB6D900E08A01 /* star_pos-1.cfg */, 65536381107EB6D900E08A01 /* star_pos-2.cfg */, 65536382107EB6D900E08A01 /* tcf.cfg */, 65536383107EB6D900E08A01 /* template4.cfg */, 65536384107EB6D900E08A01 /* template_sp-force.cfg */, 65536385107EB6D900E08A01 /* template_sp-remove.cfg */, 65536386107EB6D900E08A01 /* type_wrap.cfg */, 65536387107EB6D900E08A01 /* var_def_gap.cfg */, 65536388107EB6D900E08A01 /* wessex.cfg */, 65536389107EB6D900E08A01 /* width-2.cfg */, 6553638A107EB6D900E08A01 /* width-3.cfg */, 6553638B107EB6D900E08A01 /* width.cfg */, 6553638C107EB6D900E08A01 /* xml-str.cfg */, ); path = config; sourceTree = ""; }; 65536393107EB6D900E08A01 /* input */ = { isa = PBXGroup; children = ( 65536394107EB6D900E08A01 /* align_fcall.cpp */, 65536395107EB6D900E08A01 /* c */, 65536403107EB6D900E08A01 /* cpp */, 65536447107EB6D900E08A01 /* cs */, 65536452107EB6D900E08A01 /* d */, 65536465107EB6D900E08A01 /* ecma */, 65536468107EB6D900E08A01 /* oc */, 65536470107EB6D900E08A01 /* pawn */, 6553647C107EB6D900E08A01 /* sql */, 6553647F107EB6D900E08A01 /* vala */, ); path = input; sourceTree = ""; }; 65536395107EB6D900E08A01 /* c */ = { isa = PBXGroup; children = ( 65536396107EB6D900E08A01 /* add_long_comment.c */, 65536397107EB6D900E08A01 /* align-equ.c */, 65536398107EB6D900E08A01 /* align-proto-vars.c */, 65536399107EB6D900E08A01 /* align-proto.c */, 6553639A107EB6D900E08A01 /* align-string.c */, 6553639B107EB6D900E08A01 /* align-struct-init.c */, 6553639C107EB6D900E08A01 /* align-typedef.c */, 6553639D107EB6D900E08A01 /* align-var.c */, 6553639E107EB6D900E08A01 /* align_attr.c */, 6553639F107EB6D900E08A01 /* beautifier-off.c */, 655363A0107EB6D900E08A01 /* bits.c */, 655363A1107EB6D900E08A01 /* bool-pos.c */, 655363A2107EB6D900E08A01 /* brace-remove.c */, 655363A3107EB6D900E08A01 /* brace-remove2.c */, 655363A4107EB6D900E08A01 /* brace.c */, 655363A5107EB6D900E08A01 /* braces-2.c */, 655363A6107EB6D900E08A01 /* braces-3.c */, 655363A7107EB6D900E08A01 /* braces-4.c */, 655363A8107EB6D900E08A01 /* braces-5.c */, 655363A9107EB6D900E08A01 /* braces.c */, 655363AA107EB6D900E08A01 /* bsnl.c */, 655363AB107EB6D900E08A01 /* bugs-1.c */, 655363AC107EB6D900E08A01 /* bugs-2.c */, 655363AD107EB6D900E08A01 /* bugs-3.c */, 655363AE107EB6D900E08A01 /* bugs-4.c */, 655363AF107EB6D900E08A01 /* bugs-5.c */, 655363B0107EB6D900E08A01 /* bugs-6.c */, 655363B1107EB6D900E08A01 /* bugs-7.c */, 655363B2107EB6D900E08A01 /* bugs-8.c */, 655363B3107EB6D900E08A01 /* bugs.c */, 655363B4107EB6D900E08A01 /* case.c */, 655363B5107EB6D900E08A01 /* casts.c */, 655363B6107EB6D900E08A01 /* cmt-align.c */, 655363B7107EB6D900E08A01 /* cmt_multi.c */, 655363B8107EB6D900E08A01 /* cmt_nl_end.c */, 655363B9107EB6D900E08A01 /* cmt_right_align.c */, 655363BA107EB6D900E08A01 /* code_width.c */, 655363BB107EB6D900E08A01 /* colon-asm.c */, 655363BC107EB6D900E08A01 /* comment-convert.c */, 655363BD107EB6D900E08A01 /* comment-indent.c */, 655363BE107EB6D900E08A01 /* cond.c */, 655363BF107EB6D900E08A01 /* custom_types_ssl.c */, 655363C0107EB6D900E08A01 /* define-if-indent.c */, 655363C1107EB6D900E08A01 /* deref.c */, 655363C2107EB6D900E08A01 /* directfb.h */, 655363C3107EB6D900E08A01 /* dos.c */, 655363C4107EB6D900E08A01 /* else-if.c */, 655363C5107EB6D900E08A01 /* empty-for.c */, 655363C6107EB6D900E08A01 /* endif.c */, 655363C7107EB6D900E08A01 /* enum-struct-init.c */, 655363C8107EB6D900E08A01 /* fcn_indent.c */, 655363C9107EB6D900E08A01 /* fcn_type.c */, 655363CA107EB6D900E08A01 /* for-space.c */, 655363CB107EB6D900E08A01 /* func_call_user.c */, 655363CC107EB6D900E08A01 /* func_wrap.c */, 655363CD107EB6D900E08A01 /* funcfunc.c */, 655363CE107EB6D900E08A01 /* function-def.c */, 655363CF107EB6D900E08A01 /* global-vars.c */, 655363D0107EB6D900E08A01 /* hello.c */, 655363D1107EB6D900E08A01 /* i2c-core.c */, 655363D2107EB6D900E08A01 /* ifdef-indent.c */, 655363D3107EB6D900E08A01 /* ifdef-nest.c */, 655363D4107EB6D900E08A01 /* include_define.h */, 655363D5107EB6D900E08A01 /* indent-assign.c */, 655363D6107EB6D900E08A01 /* indent.cpp */, 655363D7107EB6D900E08A01 /* kw_subst.c */, 655363D8107EB6D900E08A01 /* mac.c */, 655363D9107EB6D900E08A01 /* minus-minus.c */, 655363DA107EB6D900E08A01 /* misc.c */, 655363DB107EB6D900E08A01 /* mod-paren.c */, 655363DC107EB6D900E08A01 /* multi.h */, 655363DD107EB6D900E08A01 /* newline_after_endif.c */, 655363DE107EB6D900E08A01 /* nl-comment.c */, 655363DF107EB6D900E08A01 /* nl-cont.c */, 655363E0107EB6D900E08A01 /* nl-cont2.c */, 655363E1107EB6D900E08A01 /* nl-semicolon.c */, 655363E2107EB6D900E08A01 /* nl-ver-def.c */, 655363E3107EB6D900E08A01 /* nl_assign.c */, 655363E4107EB6D900E08A01 /* nl_create_one_liner.c */, 655363E5107EB6D900E08A01 /* nl_ds_struct_enum.c */, 655363E6107EB6D900E08A01 /* nl_endif.c */, 655363E7107EB6D900E08A01 /* nl_proto_endif.c */, 655363E8107EB6D900E08A01 /* nl_return_expr.c */, 655363E9107EB6D900E08A01 /* one-liner-init.c */, 655363EA107EB6D900E08A01 /* output.cpp */, 655363EB107EB6D900E08A01 /* paren-indent.c */, 655363EC107EB6D900E08A01 /* paren_indent.c */, 655363ED107EB6D900E08A01 /* pascal_ptr.c */, 655363EE107EB6D900E08A01 /* pp-nest.c */, 655363EF107EB6D900E08A01 /* pp-space.c */, 655363F0107EB6D900E08A01 /* pp_concat_asn1.h */, 655363F1107EB6D900E08A01 /* pp_ret.c */, 655363F2107EB6D900E08A01 /* pragma.c */, 655363F3107EB6D900E08A01 /* preproc-if.c */, 655363F4107EB6D900E08A01 /* return-multi.c */, 655363F5107EB6D900E08A01 /* semicolons.c */, 655363F6107EB6D900E08A01 /* sort_include.c */, 655363F7107EB6D900E08A01 /* sp_cmt_cpp_start.c */, 655363F8107EB6D900E08A01 /* sp_embed_comment.c */, 655363F9107EB6D900E08A01 /* struct-brace.c */, 655363FA107EB6D900E08A01 /* switch-case.c */, 655363FB107EB6D900E08A01 /* switch.c */, 655363FC107EB6D900E08A01 /* t3.in.c */, 655363FD107EB6D900E08A01 /* type-cast.c */, 655363FE107EB6D900E08A01 /* type_wrap.c */, 655363FF107EB6D900E08A01 /* vb-do.c */, 65536400107EB6D900E08A01 /* vb-pp.c */, 65536401107EB6D900E08A01 /* vb-while.c */, 65536402107EB6D900E08A01 /* xml.c */, ); path = c; sourceTree = ""; }; 65536403107EB6D900E08A01 /* cpp */ = { isa = PBXGroup; children = ( 65536404107EB6D900E08A01 /* al.cpp */, 65536405107EB6D900E08A01 /* align-func-params.cpp */, 65536406107EB6D900E08A01 /* align-star-amp-pos.cpp */, 65536407107EB6D900E08A01 /* align_constr.cpp */, 65536408107EB6D900E08A01 /* align_fcall.cpp */, 65536409107EB6D900E08A01 /* alt_tokens.cpp */, 6553640A107EB6D900E08A01 /* av.h */, 6553640B107EB6D900E08A01 /* bool.cpp */, 6553640C107EB6D900E08A01 /* byref.cpp */, 6553640D107EB6D900E08A01 /* class-addr.h */, 6553640E107EB6D900E08A01 /* class-init.cpp */, 6553640F107EB6D900E08A01 /* class.h */, 65536410107EB6D900E08A01 /* cmt-reflow.cpp */, 65536411107EB6D900E08A01 /* cmt_indent.cpp */, 65536412107EB6D900E08A01 /* cmt_right.cpp */, 65536413107EB6D900E08A01 /* comment-align.cpp */, 65536414107EB6D900E08A01 /* const_throw.cpp */, 65536415107EB6D900E08A01 /* constructor.cpp */, 65536416107EB6D900E08A01 /* cout.cpp */, 65536417107EB6D900E08A01 /* ctor-var.cpp */, 65536418107EB6D900E08A01 /* custom-open-2.cpp */, 65536419107EB6D900E08A01 /* custom-open.cpp */, 6553641A107EB6D900E08A01 /* delete.cpp */, 6553641B107EB6D900E08A01 /* deref.cpp */, 6553641C107EB6D900E08A01 /* Example.h */, 6553641D107EB6D900E08A01 /* exception.cpp */, 6553641E107EB6D900E08A01 /* extern_c.h */, 6553641F107EB6D900E08A01 /* for_long.cpp */, 65536420107EB6D900E08A01 /* function-def.cpp */, 65536421107EB6D900E08A01 /* goto.cpp */, 65536422107EB6D900E08A01 /* indent-off.cpp */, 65536423107EB6D900E08A01 /* indent_namespace.h */, 65536424107EB6D900E08A01 /* indent_var_def.cpp */, 65536425107EB6D900E08A01 /* init_align.h */, 65536426107EB6D900E08A01 /* kw_subst.cpp */, 65536427107EB6D900E08A01 /* kw_subst2.cpp */, 65536428107EB6D900E08A01 /* misc.cpp */, 65536429107EB6D900E08A01 /* misc2.cpp */, 6553642A107EB6D900E08A01 /* misc3.cpp */, 6553642B107EB6D900E08A01 /* misc4.cpp */, 6553642C107EB6D900E08A01 /* misc5.cpp */, 6553642D107EB6D900E08A01 /* misc6.cpp */, 6553642E107EB6D900E08A01 /* nl-class.h */, 6553642F107EB6D900E08A01 /* nl-namespace.h */, 65536430107EB6D900E08A01 /* nl_func.cpp */, 65536431107EB6D900E08A01 /* nl_func_scope_name.cpp */, 65536432107EB6D900E08A01 /* nl_func_type_name.cpp */, 65536433107EB6D900E08A01 /* operator.cpp */, 65536434107EB6D900E08A01 /* pp-define-indent.cpp */, 65536435107EB6D900E08A01 /* ptr-star.cpp */, 65536436107EB6D900E08A01 /* qt-1.cpp */, 65536437107EB6D900E08A01 /* region.cpp */, 65536438107EB6D900E08A01 /* sef.cpp */, 65536439107EB6D900E08A01 /* semicolons.cpp */, 6553643A107EB6D900E08A01 /* sim.h */, 6553643B107EB6D900E08A01 /* sp_throw_paren.cpp */, 6553643C107EB6D900E08A01 /* strings.cpp */, 6553643D107EB6D900E08A01 /* templ_class.h */, 6553643E107EB6D900E08A01 /* templates.cpp */, 6553643F107EB6D900E08A01 /* templates2.cpp */, 65536440107EB6D900E08A01 /* templates3.cpp */, 65536441107EB6D900E08A01 /* templates4.cpp */, 65536442107EB6D900E08A01 /* Timestamp.h */, 65536443107EB6D900E08A01 /* try-catch-nl.cpp */, 65536444107EB6D900E08A01 /* var_def_gap.cpp */, 65536445107EB6D900E08A01 /* variadic-template.h */, 65536446107EB6D900E08A01 /* wacky-template.cpp */, ); path = cpp; sourceTree = ""; }; 65536447107EB6D900E08A01 /* cs */ = { isa = PBXGroup; children = ( 65536448107EB6D900E08A01 /* generics.cs */, 65536449107EB6D900E08A01 /* getset.cs */, 6553644A107EB6D900E08A01 /* gs.cs */, 6553644B107EB6D900E08A01 /* region.cs */, 6553644C107EB6D900E08A01 /* simple.cs */, 6553644D107EB6D900E08A01 /* sort_using.cs */, 6553644E107EB6D900E08A01 /* strings.cs */, 6553644F107EB6D900E08A01 /* tcf.cs */, 65536450107EB6D900E08A01 /* unsafe.cs */, 65536451107EB6D900E08A01 /* var-member.cs */, ); path = cs; sourceTree = ""; }; 65536452107EB6D900E08A01 /* d */ = { isa = PBXGroup; children = ( 65536453107EB6D900E08A01 /* bug-indent.d */, 65536454107EB6D900E08A01 /* casts.d */, 65536455107EB6D900E08A01 /* delegate.d */, 65536456107EB6D900E08A01 /* funcfunc.d */, 65536457107EB6D900E08A01 /* HashMap.d */, 65536458107EB6D900E08A01 /* imports.d */, 65536459107EB6D900E08A01 /* Lexer.d */, 6553645A107EB6D900E08A01 /* numbers.d */, 6553645B107EB6D900E08A01 /* sort_import.d */, 6553645C107EB6D900E08A01 /* strings.d */, 6553645D107EB6D900E08A01 /* template.d */, 6553645E107EB6D900E08A01 /* tst01.d */, 6553645F107EB6D900E08A01 /* tst02.d */, 65536460107EB6D900E08A01 /* tst03.d */, 65536461107EB6D900E08A01 /* volatile-1.d */, 65536462107EB6D900E08A01 /* volatile-2.d */, 65536463107EB6D900E08A01 /* volatile-3.d */, 65536464107EB6D900E08A01 /* volatile.d */, ); path = d; sourceTree = ""; }; 65536465107EB6D900E08A01 /* ecma */ = { isa = PBXGroup; children = ( 65536466107EB6D900E08A01 /* example-1.es */, ); path = ecma; sourceTree = ""; }; 65536468107EB6D900E08A01 /* oc */ = { isa = PBXGroup; children = ( 65536469107EB6D900E08A01 /* Declarations.h */, 6553646A107EB6D900E08A01 /* exceptions.m */, 6553646B107EB6D900E08A01 /* Fraction.h */, 6553646C107EB6D900E08A01 /* Fraction.m */, 6553646D107EB6D900E08A01 /* main.m */, 654C6DBE108F63B000556CD9 /* misc.m */, 6553646E107EB6D900E08A01 /* sort_import.m */, 6553646F107EB6D900E08A01 /* string.m */, 656E28301082F349007F873A /* selector.m */, 65DB4DB81084D200005E7765 /* return_type.m */, 659F8D37108A9A380004E4CB /* complex_method.m */, 654C6B42108ED8FC00556CD9 /* real_world_file.m */, 654C6FB2108FB40D00556CD9 /* more_blocks.m */, 654C70BA1090E89400556CD9 /* blocks.m */, ); path = oc; sourceTree = ""; }; 65536470107EB6D900E08A01 /* pawn */ = { isa = PBXGroup; children = ( 65536471107EB6D900E08A01 /* comment.p */, 65536472107EB6D900E08A01 /* crusty_ex-1.sma */, 65536473107EB6D900E08A01 /* enum.pawn */, 65536474107EB6D900E08A01 /* functions.pawn */, 65536475107EB6D900E08A01 /* rpn_calc.pawn */, 65536476107EB6D900E08A01 /* str-escape.p */, 65536477107EB6D900E08A01 /* switch-vsemi.sma */, 65536478107EB6D900E08A01 /* tags.pawn */, 65536479107EB6D900E08A01 /* test1.pawn */, 6553647A107EB6D900E08A01 /* traffic.p */, 6553647B107EB6D900E08A01 /* unbraced.p */, ); path = pawn; sourceTree = ""; }; 6553647C107EB6D900E08A01 /* sql */ = { isa = PBXGroup; children = ( 6553647D107EB6D900E08A01 /* mysql.sqc */, 6553647E107EB6D900E08A01 /* sta-select.sqc */, ); path = sql; sourceTree = ""; }; 6553647F107EB6D900E08A01 /* vala */ = { isa = PBXGroup; children = ( 65536480107EB6D900E08A01 /* advanced.vala */, 65536481107EB6D900E08A01 /* list.vala */, ); path = vala; sourceTree = ""; }; 65536484107EB6D900E08A01 /* output */ = { isa = PBXGroup; children = ( 65536485107EB6D900E08A01 /* c */, 6553652B107EB6D900E08A01 /* cpp */, 65536592107EB6DA00E08A01 /* cs */, 655365A2107EB6DA00E08A01 /* d */, 655365B7107EB6DA00E08A01 /* ecma */, 655365BA107EB6DA00E08A01 /* oc */, 655365C2107EB6DA00E08A01 /* pawn */, 655365CC107EB6DA00E08A01 /* sql */, 655365CF107EB6DA00E08A01 /* vala */, ); path = output; sourceTree = ""; }; 65536485107EB6D900E08A01 /* c */ = { isa = PBXGroup; children = ( 65536486107EB6D900E08A01 /* 00000-comment-indent.c */, 65536487107EB6D900E08A01 /* 00001-comment-indent.c */, 65536488107EB6D900E08A01 /* 00002-comment-indent.c */, 65536489107EB6D900E08A01 /* 00003-comment-indent.c */, 6553648A107EB6D900E08A01 /* 00004-switch.c */, 6553648B107EB6D900E08A01 /* 00005-cmt-align.c */, 6553648C107EB6D900E08A01 /* 00006-comment-convert.c */, 6553648D107EB6D900E08A01 /* 00007-comment-convert.c */, 6553648E107EB6D900E08A01 /* 00008-comment-convert.c */, 6553648F107EB6D900E08A01 /* 00009-comment-convert.c */, 65536490107EB6D900E08A01 /* 00010-braces.c */, 65536491107EB6D900E08A01 /* 00011-braces.c */, 65536492107EB6D900E08A01 /* 00012-braces.c */, 65536493107EB6D900E08A01 /* 00013-braces.c */, 65536494107EB6D900E08A01 /* 00014-braces.c */, 65536495107EB6D900E08A01 /* 00015-braces.c */, 65536496107EB6D900E08A01 /* 00016-braces.c */, 65536497107EB6D900E08A01 /* 00020-define-if-indent.c */, 65536498107EB6D900E08A01 /* 00050-brace-remove.c */, 65536499107EB6D900E08A01 /* 00051-brace-remove.c */, 6553649A107EB6D900E08A01 /* 00052-brace-remove2.c */, 6553649B107EB6D900E08A01 /* 00053-brace.c */, 6553649C107EB6D900E08A01 /* 00055-braces-2.c */, 6553649D107EB6D900E08A01 /* 00060-braces-2.c */, 6553649E107EB6D900E08A01 /* 00061-braces-3.c */, 6553649F107EB6D900E08A01 /* 00062-braces-4.c */, 655364A0107EB6D900E08A01 /* 00065-braces-5.c */, 655364A1107EB6D900E08A01 /* 00066-vb-while.c */, 655364A2107EB6D900E08A01 /* 00067-vb-do.c */, 655364A3107EB6D900E08A01 /* 00068-bsnl.c */, 655364A4107EB6D900E08A01 /* 00069-vb-pp.c */, 655364A5107EB6D900E08A01 /* 00070-return-multi.c */, 655364A6107EB6D900E08A01 /* 00071-include_define.h */, 655364A7107EB6D900E08A01 /* 00072-align-proto.c */, 655364A8107EB6D900E08A01 /* 00073-nl_proto_endif.c */, 655364A9107EB6D900E08A01 /* 00081-else-if.c */, 655364AA107EB6D900E08A01 /* 00082-else-if.c */, 655364AB107EB6D900E08A01 /* 00091-cond.c */, 655364AC107EB6D900E08A01 /* 00092-cond.c */, 655364AD107EB6D900E08A01 /* 00101-bugs-1.c */, 655364AE107EB6D900E08A01 /* 00102-bugs-2.c */, 655364AF107EB6D900E08A01 /* 00103-bugs-3.c */, 655364B0107EB6D900E08A01 /* 00104-bugs-4.c */, 655364B1107EB6D900E08A01 /* 00105-bugs-5.c */, 655364B2107EB6D900E08A01 /* 00106-bugs-6.c */, 655364B3107EB6D900E08A01 /* 00107-bugs-7.c */, 655364B4107EB6D900E08A01 /* 00108-bugs-8.c */, 655364B5107EB6D900E08A01 /* 00110-misc.c */, 655364B6107EB6D900E08A01 /* 00111-misc.c */, 655364B7107EB6D900E08A01 /* 00120-sp_cmt_cpp_start.c */, 655364B8107EB6D900E08A01 /* 00121-sp_cmt_cpp_start.c */, 655364B9107EB6D900E08A01 /* 00122-sp_cmt_cpp_start.c */, 655364BA107EB6D900E08A01 /* 00130-minus-minus.c */, 655364BB107EB6D900E08A01 /* 00140-global-vars.c */, 655364BC107EB6D900E08A01 /* 00141-deref.c */, 655364BD107EB6D900E08A01 /* 00142-type-cast.c */, 655364BE107EB6D900E08A01 /* 00143-t3.in.c */, 655364BF107EB6D900E08A01 /* 00144-align-proto-vars.c */, 655364C0107EB6D900E08A01 /* 00150-casts.c */, 655364C1107EB6D900E08A01 /* 00151-casts.c */, 655364C2107EB6D900E08A01 /* 00152-casts.c */, 655364C3107EB6D900E08A01 /* 00153-casts.c */, 655364C4107EB6D900E08A01 /* 00154-casts.c */, 655364C5107EB6D900E08A01 /* 00160-fcn_indent.c */, 655364C6107EB6D900E08A01 /* 00161-fcn_indent.c */, 655364C7107EB6D900E08A01 /* 00162-fcn_indent.c */, 655364C8107EB6D900E08A01 /* 00163-fcn_indent.c */, 655364C9107EB6D900E08A01 /* 00170-beautifier-off.c */, 655364CA107EB6D900E08A01 /* 00201-case.c */, 655364CB107EB6D900E08A01 /* 00202-case.c */, 655364CC107EB6D900E08A01 /* 00203-case.c */, 655364CD107EB6D900E08A01 /* 00301-align-struct-init.c */, 655364CE107EB6D900E08A01 /* 00302-one-liner-init.c */, 655364CF107EB6D900E08A01 /* 00303-one-liner-init.c */, 655364D0107EB6D900E08A01 /* 00304-one-liner-init.c */, 655364D1107EB6D900E08A01 /* 00310-sp_embed_comment.c */, 655364D2107EB6D900E08A01 /* 00401-align-equ.c */, 655364D3107EB6D900E08A01 /* 00402-align-var.c */, 655364D4107EB6D900E08A01 /* 00403-align-var.c */, 655364D5107EB6D900E08A01 /* 00404-align-var.c */, 655364D6107EB6D900E08A01 /* 00405-bits.c */, 655364D7107EB6D900E08A01 /* 00411-align-typedef.c */, 655364D8107EB6D900E08A01 /* 00412-align-typedef.c */, 655364D9107EB6D900E08A01 /* 00413-align-typedef.c */, 655364DA107EB6D900E08A01 /* 00414-align-typedef.c */, 655364DB107EB6D900E08A01 /* 00421-nl_ds_struct_enum.c */, 655364DC107EB6D900E08A01 /* 00422-nl_ds_struct_enum.c */, 655364DD107EB6D900E08A01 /* 00430-paren-indent.c */, 655364DE107EB6D900E08A01 /* 00431-paren-indent.c */, 655364DF107EB6D900E08A01 /* 00432-paren-indent.c */, 655364E0107EB6D900E08A01 /* 00501-bool-pos.c */, 655364E1107EB6D900E08A01 /* 00502-bool-pos.c */, 655364E2107EB6D900E08A01 /* 00600-dos.c */, 655364E3107EB6D900E08A01 /* 00601-mac.c */, 655364E4107EB6D900E08A01 /* 00611-pp-space.c */, 655364E5107EB6D900E08A01 /* 00612-pp-space.c */, 655364E6107EB6D900E08A01 /* 00613-pp-space.c */, 655364E7107EB6D900E08A01 /* 00614-pp-space.c */, 655364E8107EB6D900E08A01 /* 00615-pp-nest.c */, 655364E9107EB6D900E08A01 /* 00620-indent-assign.c */, 655364EA107EB6D900E08A01 /* 00621-nl_endif.c */, 655364EB107EB6D900E08A01 /* 00631-nl_assign.c */, 655364EC107EB6D900E08A01 /* 00632-nl_assign.c */, 655364ED107EB6D900E08A01 /* 00701-function-def.c */, 655364EE107EB6D900E08A01 /* 00702-function-def.c */, 655364EF107EB6D900E08A01 /* 00703-function-def.c */, 655364F0107EB6D900E08A01 /* 00710-add_long_comment.c */, 655364F1107EB6D900E08A01 /* 00721-nl-semicolon.c */, 655364F2107EB6D900E08A01 /* 00801-fcn_type.c */, 655364F3107EB6D900E08A01 /* 00802-funcfunc.c */, 655364F4107EB6D900E08A01 /* 00901-code_width.c */, 655364F5107EB6D900E08A01 /* 00902-code_width.c */, 655364F6107EB6D900E08A01 /* 00903-code_width.c */, 655364F7107EB6D900E08A01 /* 00910-pascal_ptr.c */, 655364F8107EB6D900E08A01 /* 00911-pascal_ptr.c */, 655364F9107EB6D900E08A01 /* 01000-mod-paren.c */, 655364FA107EB6D900E08A01 /* 01001-nl-comment.c */, 655364FB107EB6D900E08A01 /* 01002-mod-paren.c */, 655364FC107EB6D900E08A01 /* 01011-semicolons.c */, 655364FD107EB6D900E08A01 /* 01012-semicolons.c */, 655364FE107EB6D900E08A01 /* 01015-paren_indent.c */, 655364FF107EB6D900E08A01 /* 01016-align_attr.c */, 65536500107EB6D900E08A01 /* 01020-kw_subst.c */, 65536501107EB6D900E08A01 /* 01021-hello.c */, 65536502107EB6D900E08A01 /* 01022-kw_subst.c */, 65536503107EB6D900E08A01 /* 01030-multi.h */, 65536504107EB6D900E08A01 /* 01035-func_wrap.c */, 65536505107EB6D900E08A01 /* 01036-func_wrap.c */, 65536506107EB6D900E08A01 /* 01037-type_wrap.c */, 65536507107EB6D900E08A01 /* 01040-newline_after_endif.c */, 65536508107EB6D900E08A01 /* 01050-func_call_user.c */, 65536509107EB6D900E08A01 /* 20000-i2c-core.c */, 6553650A107EB6D900E08A01 /* 20001-directfb.h */, 6553650B107EB6D900E08A01 /* 20100-i2c-core.c */, 6553650C107EB6D900E08A01 /* 20101-comment-indent.c */, 6553650D107EB6D900E08A01 /* 20102-indent.cpp */, 6553650E107EB6D900E08A01 /* 20103-output.cpp */, 6553650F107EB6D900E08A01 /* 20200-xml.c */, 65536510107EB6D900E08A01 /* 20201-align-string.c */, 65536511107EB6D900E08A01 /* 20300-preproc-if.c */, 65536512107EB6D900E08A01 /* 20301-preproc-if.c */, 65536513107EB6D900E08A01 /* 20302-nl-cont.c */, 65536514107EB6D900E08A01 /* 20303-nl-cont2.c */, 65536515107EB6D900E08A01 /* 20310-empty-for.c */, 65536516107EB6D900E08A01 /* 20311-pragma.c */, 65536517107EB6D900E08A01 /* 20315-pp_ret.c */, 65536518107EB6D900E08A01 /* 20320-nl_create_one_liner.c */, 65536519107EB6D900E08A01 /* 20325-sort_include.c */, 6553651A107EB6D900E08A01 /* 21010-ifdef-indent.c */, 6553651B107EB6D900E08A01 /* 21011-ifdef-indent.c */, 6553651C107EB6D900E08A01 /* 21012-ifdef-indent.c */, 6553651D107EB6D900E08A01 /* 21013-ifdef-indent.c */, 6553651E107EB6D900E08A01 /* 21015-endif.c */, 6553651F107EB6D900E08A01 /* 21016-cmt_nl_end.c */, 65536520107EB6D900E08A01 /* 21021-cmt_multi.c */, 65536521107EB6D900E08A01 /* 21022-cmt_multi.c */, 65536522107EB6D900E08A01 /* 21031-cmt_right_align.c */, 65536523107EB6D900E08A01 /* 21032-cmt_right_align.c */, 65536524107EB6D900E08A01 /* 21051-nl_return_expr.c */, 65536525107EB6D900E08A01 /* 21052-nl_return_expr.c */, 65536526107EB6D900E08A01 /* 21053-nl_return_expr.c */, 65536527107EB6D900E08A01 /* 21054-nl_return_expr.c */, 65536528107EB6D900E08A01 /* 66601-custom_types_ssl.c */, 65536529107EB6D900E08A01 /* 66602-custom_types_ssl.c */, 6553652A107EB6D900E08A01 /* 66603-pp_concat_asn1.h */, ); path = c; sourceTree = ""; }; 6553652B107EB6D900E08A01 /* cpp */ = { isa = PBXGroup; children = ( 6553652C107EB6D900E08A01 /* 30000-cout.cpp */, 6553652D107EB6D900E08A01 /* 30001-alt_tokens.cpp */, 6553652E107EB6D900E08A01 /* 30002-constructor.cpp */, 6553652F107EB6D900E08A01 /* 30003-strings.cpp */, 65536530107EB6D900E08A01 /* 30010-class.h */, 65536531107EB6D900E08A01 /* 30011-misc.cpp */, 65536532107EB6D900E08A01 /* 30012-misc2.cpp */, 65536533107EB6D900E08A01 /* 30013-sim.h */, 65536534107EB6D900E08A01 /* 30014-ctor-var.cpp */, 65536535107EB6D900E08A01 /* 30015-exception.cpp */, 65536536107EB6D900E08A01 /* 30016-custom-open.cpp */, 65536537107EB6D900E08A01 /* 30017-custom-open.cpp */, 65536538107EB6D900E08A01 /* 30018-class-addr.h */, 65536539107EB6D900E08A01 /* 30019-wacky-template.cpp */, 6553653A107EB6D900E08A01 /* 30020-bool.cpp */, 6553653B107EB6D900E08A01 /* 30021-byref.cpp */, 6553653C107EB6D900E08A01 /* 30022-extern_c.h */, 6553653D107EB6D900E08A01 /* 30023-templates.cpp */, 6553653E107EB6D900E08A01 /* 30024-class-init.cpp */, 6553653F107EB6D900E08A01 /* 30025-class-init.cpp */, 65536540107EB6D900E08A01 /* 30026-byref.cpp */, 65536541107EB6D900E08A01 /* 30027-byref.cpp */, 65536542107EB6D900E08A01 /* 30028-byref.cpp */, 65536543107EB6D900E08A01 /* 30029-init_align.h */, 65536544107EB6D900E08A01 /* 30030-Timestamp.h */, 65536545107EB6D900E08A01 /* 30031-operator.cpp */, 65536546107EB6D900E08A01 /* 30032-operator.cpp */, 65536547107EB6D900E08A01 /* 30033-operator.cpp */, 65536548107EB6D900E08A01 /* 30040-nl-class.h */, 65536549107EB6D900E08A01 /* 30041-nl-class.h */, 6553654A107EB6D900E08A01 /* 30050-nl-namespace.h */, 6553654B107EB6D900E08A01 /* 30051-nl-namespace.h */, 6553654C107EB6D900E08A01 /* 30052-try-catch-nl.cpp */, 6553654D107EB6D900E08A01 /* 30055-nl_func.cpp */, 6553654E107EB6D900E08A01 /* 30056-nl_func.cpp */, 6553654F107EB6D900E08A01 /* 30061-class-init.cpp */, 65536550107EB6D900E08A01 /* 30062-class-init.cpp */, 65536551107EB6D900E08A01 /* 30063-class-init.cpp */, 65536552107EB6D900E08A01 /* 30064-class-init.cpp */, 65536553107EB6D900E08A01 /* 30065-Example.h */, 65536554107EB6D900E08A01 /* 30070-nl_func_scope_name.cpp */, 65536555107EB6D900E08A01 /* 30075-goto.cpp */, 65536556107EB6D900E08A01 /* 30100-templates.cpp */, 65536557107EB6D900E08A01 /* 30101-templates.cpp */, 65536558107EB6D900E08A01 /* 30102-templates.cpp */, 65536559107EB6D900E08A01 /* 30103-templates.cpp */, 6553655A107EB6D900E08A01 /* 30104-templ_class.h */, 6553655B107EB6D900E08A01 /* 30105-av.h */, 6553655C107EB6D900E08A01 /* 30106-templates2.cpp */, 6553655D107EB6D900E08A01 /* 30107-templates2.cpp */, 6553655E107EB6D900E08A01 /* 30108-templates3.cpp */, 6553655F107EB6D900E08A01 /* 30109-templates4.cpp */, 65536560107EB6D900E08A01 /* 30201-cmt_indent.cpp */, 65536561107EB6D900E08A01 /* 30202-cmt_indent.cpp */, 65536562107EB6D900E08A01 /* 30203-cmt_indent.cpp */, 65536563107EB6D900E08A01 /* 30204-comment-align.cpp */, 65536564107EB6D900E08A01 /* 30205-cmt_right.cpp */, 65536565107EB6D900E08A01 /* 30250-align_fcall.cpp */, 65536566107EB6D900E08A01 /* 30251-align_fcall.cpp */, 65536567107EB6D900E08A01 /* 30255-align_constr.cpp */, 65536568107EB6D900E08A01 /* 30260-var_def_gap.cpp */, 65536569107EB6D900E08A01 /* 30270-const_throw.cpp */, 6553656A107EB6D900E08A01 /* 30271-sp_throw_paren.cpp */, 6553656B107EB6D900E08A01 /* 30272-sp_throw_paren.cpp */, 6553656C107EB6D900E08A01 /* 30701-function-def.cpp */, 6553656D107EB6D900E08A01 /* 30702-function-def.cpp */, 6553656E107EB6D900E08A01 /* 30703-function-def.cpp */, 6553656F107EB6D900E08A01 /* 30711-semicolons.cpp */, 65536570107EB6D900E08A01 /* 30720-custom-open-2.cpp */, 65536571107EB6D900E08A01 /* 30730-qt-1.cpp */, 65536572107EB6DA00E08A01 /* 30731-qt-1.cpp */, 65536573107EB6DA00E08A01 /* 30740-sef.cpp */, 65536574107EB6DA00E08A01 /* 30741-al.cpp */, 65536575107EB6DA00E08A01 /* 30742-delete.cpp */, 65536576107EB6DA00E08A01 /* 30800-align-star-amp-pos.cpp */, 65536577107EB6DA00E08A01 /* 30801-align-star-amp-pos.cpp */, 65536578107EB6DA00E08A01 /* 30802-align-star-amp-pos.cpp */, 65536579107EB6DA00E08A01 /* 30805-ptr-star.cpp */, 6553657A107EB6DA00E08A01 /* 30806-ptr-star.cpp */, 6553657B107EB6DA00E08A01 /* 30807-ptr-star.cpp */, 6553657C107EB6DA00E08A01 /* 30810-ptr-star.cpp */, 6553657D107EB6DA00E08A01 /* 30811-misc3.cpp */, 6553657E107EB6DA00E08A01 /* 30812-misc4.cpp */, 6553657F107EB6DA00E08A01 /* 30813-misc5.cpp */, 65536580107EB6DA00E08A01 /* 30814-misc6.cpp */, 65536581107EB6DA00E08A01 /* 30815-cmt-reflow.cpp */, 65536582107EB6DA00E08A01 /* 30816-for_long.cpp */, 65536583107EB6DA00E08A01 /* 30820-pp-define-indent.cpp */, 65536584107EB6DA00E08A01 /* 30830-kw_subst.cpp */, 65536585107EB6DA00E08A01 /* 30831-kw_subst2.cpp */, 65536586107EB6DA00E08A01 /* 30840-nl_func_type_name.cpp */, 65536587107EB6DA00E08A01 /* 30841-nl_func_type_name.cpp */, 65536588107EB6DA00E08A01 /* 30845-deref.cpp */, 65536589107EB6DA00E08A01 /* 30900-region.cpp */, 6553658A107EB6DA00E08A01 /* 30901-region.cpp */, 6553658B107EB6DA00E08A01 /* 30902-region.cpp */, 6553658C107EB6DA00E08A01 /* 30903-region.cpp */, 6553658D107EB6DA00E08A01 /* 30910-indent_namespace.h */, 6553658E107EB6DA00E08A01 /* 30911-indent_namespace.h */, 6553658F107EB6DA00E08A01 /* 30920-indent-off.cpp */, 65536590107EB6DA00E08A01 /* 30921-variadic-template.h */, 65536591107EB6DA00E08A01 /* 30930-indent_var_def.cpp */, ); path = cpp; sourceTree = ""; }; 65536592107EB6DA00E08A01 /* cs */ = { isa = PBXGroup; children = ( 65536593107EB6DA00E08A01 /* 10000-simple.cs */, 65536594107EB6DA00E08A01 /* 10001-getset.cs */, 65536595107EB6DA00E08A01 /* 10002-simple.cs */, 65536596107EB6DA00E08A01 /* 10003-region.cs */, 65536597107EB6DA00E08A01 /* 10010-var-member.cs */, 65536598107EB6DA00E08A01 /* 10011-strings.cs */, 65536599107EB6DA00E08A01 /* 10020-region.cs */, 6553659A107EB6DA00E08A01 /* 10021-region.cs */, 6553659B107EB6DA00E08A01 /* 10022-region.cs */, 6553659C107EB6DA00E08A01 /* 10023-region.cs */, 6553659D107EB6DA00E08A01 /* 10030-sort_using.cs */, 6553659E107EB6DA00E08A01 /* 10040-tcf.cs */, 6553659F107EB6DA00E08A01 /* 10041-gs.cs */, 655365A0107EB6DA00E08A01 /* 10050-generics.cs */, 655365A1107EB6DA00E08A01 /* 10060-unsafe.cs */, ); path = cs; sourceTree = ""; }; 655365A2107EB6DA00E08A01 /* d */ = { isa = PBXGroup; children = ( 655365A3107EB6DA00E08A01 /* 40000-HashMap.d */, 655365A4107EB6DA00E08A01 /* 40001-imports.d */, 655365A5107EB6DA00E08A01 /* 40002-volatile.d */, 655365A6107EB6DA00E08A01 /* 40003-volatile-1.d */, 655365A7107EB6DA00E08A01 /* 40004-volatile-2.d */, 655365A8107EB6DA00E08A01 /* 40005-volatile-3.d */, 655365A9107EB6DA00E08A01 /* 40006-Lexer.d */, 655365AA107EB6DA00E08A01 /* 40007-Lexer.d */, 655365AB107EB6DA00E08A01 /* 40010-template.d */, 655365AC107EB6DA00E08A01 /* 40020-funcfunc.d */, 655365AD107EB6DA00E08A01 /* 40021-tst01.d */, 655365AE107EB6DA00E08A01 /* 40022-tst02.d */, 655365AF107EB6DA00E08A01 /* 40023-bug-indent.d */, 655365B0107EB6DA00E08A01 /* 40024-tst03.d */, 655365B1107EB6DA00E08A01 /* 40025-tst03.d */, 655365B2107EB6DA00E08A01 /* 40030-delegate.d */, 655365B3107EB6DA00E08A01 /* 40040-sort_import.d */, 655365B4107EB6DA00E08A01 /* 40050-strings.d */, 655365B5107EB6DA00E08A01 /* 40051-numbers.d */, 655365B6107EB6DA00E08A01 /* 40052-numbers.d */, ); path = d; sourceTree = ""; }; 655365B7107EB6DA00E08A01 /* ecma */ = { isa = PBXGroup; children = ( 655365B8107EB6DA00E08A01 /* 90000-example-1.es */, ); path = ecma; sourceTree = ""; }; 655365BA107EB6DA00E08A01 /* oc */ = { isa = PBXGroup; children = ( 655365BB107EB6DA00E08A01 /* 50001-Fraction.h */, 655365BC107EB6DA00E08A01 /* 50002-Fraction.m */, 655365BD107EB6DA00E08A01 /* 50003-main.m */, 655365BE107EB6DA00E08A01 /* 50004-string.m */, 655365BF107EB6DA00E08A01 /* 50005-Declarations.h */, 655365C0107EB6DA00E08A01 /* 50006-exceptions.m */, 654C6DBD108F63A200556CD9 /* 50007-misc.m */, 655365C1107EB6DA00E08A01 /* 50030-sort_import.m */, 65DB4D941084D030005E7765 /* 50010-return_type.m */, 65DB4DB41084D174005E7765 /* 50011-return_type.m */, 65DB4DB51084D174005E7765 /* 50012-return_type.m */, 65DB4DC61084D2E3005E7765 /* 50020-selector.m */, 65DB4DC71084D2E3005E7765 /* 50021-selector.m */, 65DB4DC81084D2E3005E7765 /* 50022-selector.m */, 659F8DA6108AD5AC0004E4CB /* 50040-complex_method.m */, 654C6C70108F238800556CD9 /* 50050-real_world_file.m */, 654C6DA7108F629F00556CD9 /* 50060-oc-split.m */, 65A462ED1092D101007F6EBA /* 50070-blocks.m */, 65A462EE1092D101007F6EBA /* 50071-blocks.m */, 65A462EF1092D101007F6EBA /* 50072-blocks.m */, 65A462F01092D101007F6EBA /* 50073-blocks.m */, 65A462F11092D101007F6EBA /* 50074-blocks.m */, 65A462F21092D101007F6EBA /* 50075-blocks.m */, 65A462F31092D101007F6EBA /* 50076-blocks.m */, 65A463291092D346007F6EBA /* 50077-more_blocks.m */, 65A4632A1092D346007F6EBA /* 50078-more_blocks.m */, 65A4632B1092D346007F6EBA /* 50079-more_blocks.m */, 65A4632C1092D346007F6EBA /* 50080-more_blocks.m */, 65A4632D1092D346007F6EBA /* 50081-more_blocks.m */, 65A4632E1092D346007F6EBA /* 50082-more_blocks.m */, 65A4632F1092D346007F6EBA /* 50083-more_blocks.m */, ); path = oc; sourceTree = ""; }; 655365C2107EB6DA00E08A01 /* pawn */ = { isa = PBXGroup; children = ( 655365C3107EB6DA00E08A01 /* 60000-functions.pawn */, 655365C4107EB6DA00E08A01 /* 60001-comment.p */, 655365C5107EB6DA00E08A01 /* 60002-traffic.p */, 655365C6107EB6DA00E08A01 /* 60003-tags.pawn */, 655365C7107EB6DA00E08A01 /* 60004-enum.pawn */, 655365C8107EB6DA00E08A01 /* 60005-unbraced.p */, 655365C9107EB6DA00E08A01 /* 60010-str-escape.p */, 655365CA107EB6DA00E08A01 /* 60020-switch-vsemi.sma */, 655365CB107EB6DA00E08A01 /* 60030-crusty_ex-1.sma */, ); path = pawn; sourceTree = ""; }; 655365CC107EB6DA00E08A01 /* sql */ = { isa = PBXGroup; children = ( 655365CD107EB6DA00E08A01 /* 21000-mysql.sqc */, 655365CE107EB6DA00E08A01 /* 21001-sta-select.sqc */, ); path = sql; sourceTree = ""; }; 655365CF107EB6DA00E08A01 /* vala */ = { isa = PBXGroup; children = ( 655365D0107EB6DA00E08A01 /* 70000-list.vala */, 655365D1107EB6DA00E08A01 /* 70001-advanced.vala */, ); path = vala; sourceTree = ""; }; 655365D6107EB6DA00E08A01 /* win32 */ = { isa = PBXGroup; children = ( 655365DD107EB6DA00E08A01 /* windows_compat.h */, ); path = win32; sourceTree = ""; }; 655367C8107EB73F00E08A01 /* man */ = { isa = PBXGroup; children = ( 655367C9107EB73F00E08A01 /* Makefile.am */, 655367CA107EB73F00E08A01 /* Makefile.in */, 655367CB107EB73F00E08A01 /* uncrustify.1 */, ); path = man; sourceTree = ""; }; 6553680E107EB7FA00E08A01 /* src */ = { isa = PBXGroup; children = ( 6553682D107EB7FA00E08A01 /* Makefile.am */, 6553680F107EB7FA00E08A01 /* align.cpp */, 65536810107EB7FA00E08A01 /* align_stack.cpp */, 65536812107EB7FA00E08A01 /* args.cpp */, 65536814107EB7FA00E08A01 /* backup.cpp */, 65536817107EB7FA00E08A01 /* brace_cleanup.cpp */, 65536818107EB7FA00E08A01 /* braces.cpp */, 6553681A107EB7FA00E08A01 /* chunk_list.cpp */, 6553681C107EB7FA00E08A01 /* ChunkStack.cpp */, 6553681E107EB7FA00E08A01 /* combine.cpp */, 65536822107EB7FA00E08A01 /* defines.cpp */, 65536823107EB7FA00E08A01 /* detect.cpp */, 65536824107EB7FA00E08A01 /* indent.cpp */, 65536825107EB7FA00E08A01 /* keywords.cpp */, 65536826107EB7FA00E08A01 /* lang_pawn.cpp */, 65536829107EB7FA00E08A01 /* logger.cpp */, 6553682B107EB7FA00E08A01 /* logmask.cpp */, 6553682F107EB7FA00E08A01 /* md5.cpp */, 65536831107EB7FA00E08A01 /* newlines.cpp */, 65536832107EB7FA00E08A01 /* options.cpp */, 65536834107EB7FA00E08A01 /* output.cpp */, 65536835107EB7FA00E08A01 /* parens.cpp */, 65536836107EB7FA00E08A01 /* parse_frame.cpp */, 65536838107EB7FA00E08A01 /* punctuators.cpp */, 6553683A107EB7FA00E08A01 /* semicolons.cpp */, 6553683B107EB7FA00E08A01 /* sorting.cpp */, 6553683C107EB7FA00E08A01 /* space.cpp */, 6553683F107EB7FA00E08A01 /* tokenize.cpp */, 65536840107EB7FA00E08A01 /* tokenize_cleanup.cpp */, 65536842107EB7FA00E08A01 /* uncrustify.cpp */, 65536845107EB7FA00E08A01 /* universalindentgui.cpp */, 65536846107EB7FA00E08A01 /* width.cpp */, 65536811107EB7FA00E08A01 /* align_stack.h */, 65536813107EB7FA00E08A01 /* args.h */, 65536815107EB7FA00E08A01 /* backup.h */, 65536816107EB7FA00E08A01 /* base_types.h */, 65536819107EB7FA00E08A01 /* char_table.h */, 6553681B107EB7FA00E08A01 /* chunk_list.h */, 6553681D107EB7FA00E08A01 /* ChunkStack.h */, 6553681F107EB7FA00E08A01 /* config.h */, 65536827107EB7FA00E08A01 /* ListManager.h */, 65536828107EB7FA00E08A01 /* log_levels.h */, 6553682A107EB7FA00E08A01 /* logger.h */, 6553682C107EB7FA00E08A01 /* logmask.h */, 65536830107EB7FA00E08A01 /* md5.h */, 65536833107EB7FA00E08A01 /* options.h */, 65536837107EB7FA00E08A01 /* prototypes.h */, 65536839107EB7FA00E08A01 /* punctuators.h */, 6553683D107EB7FA00E08A01 /* token_enum.h */, 6553683E107EB7FA00E08A01 /* token_names.h */, 65536841107EB7FA00E08A01 /* unc_ctype.h */, 65536843107EB7FA00E08A01 /* uncrustify_types.h */, 65536844107EB7FA00E08A01 /* uncrustify_version.h */, 65536820107EB7FA00E08A01 /* config.h.in */, 6553682E107EB7FA00E08A01 /* Makefile.in */, ); path = src; sourceTree = ""; }; 65536904107EC47E00E08A01 /* osx */ = { isa = PBXGroup; children = ( 65536921107EC62D00E08A01 /* Xcode Organizer Actions.xccommands */, ); path = osx; sourceTree = ""; }; 65B887E71082CBDE00D10769 /* theory */ = { isa = PBXGroup; children = ( 65B887C61082CBBD00D10769 /* example.c */, 65B887C81082CBBD00D10769 /* align-thresholds.txt */, 65B887C91082CBBD00D10769 /* goals.txt */, 65B887CA1082CBBD00D10769 /* paren_stack.txt */, 65B887CB1082CBBD00D10769 /* theory.txt */, ); name = theory; sourceTree = ""; }; 65DB4E1C1084D99C005E7765 /* htdocs */ = { isa = PBXGroup; children = ( 65DB4E1D1084D99C005E7765 /* ben.cfg.txt */, 65DB4E1E1084D99C005E7765 /* ChangeLog */, 65DB4E1F1084D99C005E7765 /* config.txt */, 65DB4E201084D99C005E7765 /* configuration.txt */, 65DB4E211084D99C005E7765 /* default.cfg */, 65DB4E221084D99C005E7765 /* examples */, 65DB4E261084D99C005E7765 /* images */, 65DB4E281084D99C005E7765 /* index.html */, 65DB4E291084D99C005E7765 /* linux.cfg.txt */, 65DB4E2A1084D99C005E7765 /* project-support.jpg */, 65DB4E2B1084D99C005E7765 /* uncrustify.css */, 65DB4E2C1084D99C005E7765 /* uncrustify.html */, ); name = htdocs; path = documentation/htdocs; sourceTree = ""; }; 65DB4E221084D99C005E7765 /* examples */ = { isa = PBXGroup; children = ( 65DB4E231084D99C005E7765 /* c-1.in.c */, 65DB4E241084D99C005E7765 /* c-1.out.c */, 65DB4E251084D99C005E7765 /* example.c */, ); path = examples; sourceTree = ""; }; 65DB4E261084D99C005E7765 /* images */ = { isa = PBXGroup; children = ( 65DB4E271084D99C005E7765 /* linuxlinks.gif */, ); path = images; sourceTree = ""; }; C6859E8C029090F304C91782 /* Documentation */ = { isa = PBXGroup; children = ( 65DB4E1C1084D99C005E7765 /* htdocs */, 655367C8107EB73F00E08A01 /* man */, 65B887E71082CBDE00D10769 /* theory */, 6553629F107EB5B800E08A01 /* AUTHORS */, 655362A0107EB5B900E08A01 /* BUGS */, 655362A1107EB5B900E08A01 /* COPYING */, 655362A2107EB5B900E08A01 /* HELP */, 655362A3107EB5B900E08A01 /* INSTALL */, 655362A4107EB5B900E08A01 /* NEWS */, 655362A5107EB5B900E08A01 /* README */, ); name = Documentation; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 8DD76F620486A84900D96B5E /* uncrustify */ = { isa = PBXNativeTarget; buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "uncrustify" */; buildPhases = ( 656E288E1082F847007F873A /* Replace personal objc.cfg (disabled) */, 656E28731082F71E007F873A /* Generate token_names.h */, 8DD76F640486A84900D96B5E /* Sources */, 8DD76F660486A84900D96B5E /* Frameworks */, 8DD76F690486A84900D96B5E /* Install Man Page */, 65DB4DD61084D563005E7765 /* Copy to 'src' where tests expect it */, 657D87ED10895CB200C5E4AB /* Run tests via run_tests.py (disabled) */, ); buildRules = ( ); dependencies = ( ); name = uncrustify; productInstallPath = "$(HOME)/bin"; productName = uncrustify; productReference = 8DD76F6C0486A84900D96B5E /* uncrustify */; productType = "com.apple.product-type.tool"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "uncrustify" */; compatibilityVersion = "Xcode 3.1"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, Japanese, French, German, ); mainGroup = 08FB7794FE84155DC02AAC07 /* uncrustify */; projectDirPath = ""; projectRoot = ""; targets = ( 8DD76F620486A84900D96B5E /* uncrustify */, ); }; /* End PBXProject section */ /* Begin PBXShellScriptBuildPhase section */ 656E28731082F71E007F873A /* Generate token_names.h */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Generate token_names.h"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "echo \"Generating token_names.h ...\"\n\"${PROJECT_DIR}/make_token_names.sh\""; }; 656E288E1082F847007F873A /* Replace personal objc.cfg (disabled) */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 8; files = ( ); inputPaths = ( ); name = "Replace personal objc.cfg (disabled)"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; shellScript = "# // !!! Andre Berg 20091012: Don't worry about this script phase...\n# this just copies the objc.cfg file I work on over to the project dir because I almost always forget it\n# before building...\n\n#if [[ -e ~/.uncrustify/objc.cfg ]]; then\n#\techo \"Replacing project copy of objc.cfg with personal one\"\n#\tcp -f ~/.uncrustify/objc.cfg \"${PROJECT_DIR}/etc/objc.cfg\"\n#fi"; }; 657D87ED10895CB200C5E4AB /* Run tests via run_tests.py (disabled) */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 8; files = ( ); inputPaths = ( ); name = "Run tests via run_tests.py (disabled)"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 1; shellPath = /bin/sh; shellScript = "# if [[ -x \"${PROJECT_DIR}/tests/results\" ]]; then\n# echo 'Removing \"tests/results...\"'\n# rm -rf \"${PROJECT_DIR}/tests/results\"\n# fi\n# \n# if [[ -f \"${PROJECT_DIR}/tests/difftest.patch\" ]]; then\n# echo 'Removing \"tests/difftest.patch...\"'\n# rm \"${PROJECT_DIR}/tests/difftest.patch\"\n# fi\n# \n# echo \"Running unit tests via tests/run_tests.py...\"\n# cd \"${PROJECT_DIR}/tests\"\n# TESTS_RESULT=`python \"run_tests.py\"`\n# \n# \n# if [[ $TESTS_RESULT =~ \"FAILED\" || $? == 1 ]]; then\n# echo \"Tests seem to have failed (output contains \\\"FAILED\\\" or exit status non-zero). Generating difftest.patch...\"\n# ./difftest.sh > difftest.patch\n# fi"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DD76F640486A84900D96B5E /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 65536847107EB7FA00E08A01 /* align.cpp in Sources */, 65536848107EB7FA00E08A01 /* align_stack.cpp in Sources */, 65536849107EB7FA00E08A01 /* args.cpp in Sources */, 6553684A107EB7FA00E08A01 /* backup.cpp in Sources */, 6553684B107EB7FA00E08A01 /* brace_cleanup.cpp in Sources */, 6553684C107EB7FA00E08A01 /* braces.cpp in Sources */, 6553684D107EB7FA00E08A01 /* chunk_list.cpp in Sources */, 6553684E107EB7FA00E08A01 /* ChunkStack.cpp in Sources */, 6553684F107EB7FA00E08A01 /* combine.cpp in Sources */, 65536851107EB7FA00E08A01 /* defines.cpp in Sources */, 65536852107EB7FA00E08A01 /* detect.cpp in Sources */, 65536853107EB7FA00E08A01 /* indent.cpp in Sources */, 65536854107EB7FA00E08A01 /* keywords.cpp in Sources */, 65536855107EB7FA00E08A01 /* lang_pawn.cpp in Sources */, 65536856107EB7FA00E08A01 /* logger.cpp in Sources */, 65536857107EB7FA00E08A01 /* logmask.cpp in Sources */, 65536858107EB7FA00E08A01 /* md5.cpp in Sources */, 65536859107EB7FA00E08A01 /* newlines.cpp in Sources */, 6553685A107EB7FA00E08A01 /* options.cpp in Sources */, 6553685B107EB7FA00E08A01 /* output.cpp in Sources */, 6553685C107EB7FA00E08A01 /* parens.cpp in Sources */, 6553685D107EB7FA00E08A01 /* parse_frame.cpp in Sources */, 6553685E107EB7FA00E08A01 /* punctuators.cpp in Sources */, 6553685F107EB7FA00E08A01 /* semicolons.cpp in Sources */, 65536860107EB7FA00E08A01 /* sorting.cpp in Sources */, 65536861107EB7FA00E08A01 /* space.cpp in Sources */, 65536862107EB7FA00E08A01 /* tokenize.cpp in Sources */, 65536863107EB7FA00E08A01 /* tokenize_cleanup.cpp in Sources */, 65536864107EB7FA00E08A01 /* uncrustify.cpp in Sources */, 65536865107EB7FA00E08A01 /* universalindentgui.cpp in Sources */, 65536866107EB7FA00E08A01 /* width.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ 1DEB923208733DC60010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = HAVE_CONFIG_H; GCC_VERSION = com.apple.compilers.llvmgcc42; INSTALL_PATH = /usr/local/bin; PRODUCT_NAME = uncrustify; }; name = Debug; }; 1DEB923308733DC60010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = HAVE_CONFIG_H; GCC_VERSION = com.apple.compilers.llvmgcc42; INSTALL_PATH = /usr/local/bin; PRODUCT_NAME = uncrustify; }; name = Release; }; 1DEB923608733DC60010E9CD /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx10.6; }; name = Debug; }; 1DEB923708733DC60010E9CD /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = macosx10.6; }; name = Release; }; 6553622D107EB39900E08A01 /* Install */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvmgcc42; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = macosx10.6; }; name = Install; }; 6553622E107EB39900E08A01 /* Install */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_LOCATION = YES; DEPLOYMENT_POSTPROCESSING = YES; DSTROOT = /; GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = HAVE_CONFIG_H; GCC_VERSION = com.apple.compilers.llvmgcc42; INSTALL_PATH = /usr/local/bin; PRODUCT_NAME = uncrustify; SEPARATE_STRIP = YES; STRIP_INSTALLED_PRODUCT = YES; }; name = Install; }; 65DB4E4D1084DBB7005E7765 /* Debug Clang */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx10.6; }; name = "Debug Clang"; }; 65DB4E4E1084DBB7005E7765 /* Debug Clang */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = HAVE_CONFIG_H; GCC_VERSION = com.apple.compilers.llvmgcc42; INSTALL_PATH = /usr/local/bin; PRODUCT_NAME = uncrustify; }; name = "Debug Clang"; }; 65DB4E4F1084DBC2005E7765 /* Release Clang */ = { isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; SDKROOT = macosx10.6; }; name = "Release Clang"; }; 65DB4E501084DBC2005E7765 /* Release Clang */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PREPROCESSOR_DEFINITIONS = HAVE_CONFIG_H; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INSTALL_PATH = /usr/local/bin; PRODUCT_NAME = uncrustify; }; name = "Release Clang"; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "uncrustify" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB923208733DC60010E9CD /* Debug */, 65DB4E4E1084DBB7005E7765 /* Debug Clang */, 1DEB923308733DC60010E9CD /* Release */, 65DB4E501084DBC2005E7765 /* Release Clang */, 6553622E107EB39900E08A01 /* Install */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "uncrustify" */ = { isa = XCConfigurationList; buildConfigurations = ( 1DEB923608733DC60010E9CD /* Debug */, 65DB4E4D1084DBB7005E7765 /* Debug Clang */, 1DEB923708733DC60010E9CD /* Release */, 65DB4E4F1084DBC2005E7765 /* Release Clang */, 6553622D107EB39900E08A01 /* Install */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; } uncrustify-0.59/documentation/0000755000175000017500000000000011506773275013551 500000000000000uncrustify-0.59/documentation/goals.txt0000644000175000017500000000131411506773275015336 00000000000000------------------------------------------------------------------------------- Goal: Do as little or as much reformatting as desired - everything should be configurable Features: Whitespace modifications + Indent code (tabs, tabs + spaces, spaces) - brace indenting - paren continuation - '=' continuation - broken string continuation - comment indenting + Add/Remove spaces before/after/between symbols + position braces (same line, cuddle else/while, etc) Non-whitespace modifications + Put a '*' on the left in multi-line C comments + Add/Remove outter-most parens on return expressions + Add braces for 'fully braced' format (TODO: update the list to include more available features) uncrustify-0.59/documentation/htdocs/0000755000175000017500000000000011506773275015035 500000000000000uncrustify-0.59/documentation/htdocs/images/0000755000175000017500000000000011506773275016302 500000000000000uncrustify-0.59/documentation/htdocs/images/linuxlinks.gif0000644000175000017500000000071611506773275021115 00000000000000GIF89aVϿï׷ϫǟo_{Oo?f3WK@!,V dihlp,tmxIpH,{rl:ШtJm)"Q-!"C#h,Dehq"(@h{lnxv Y(_'"jwy" s`|#xv  \)^h&ȩ[#  $kmŷ" ܩh x%Yj"1K_hD QGIJ'΢9[Ң"nZըիXjʵk#`Ê 뵬ٳhJ ;uncrustify-0.59/documentation/htdocs/uncrustify.html0000644000175000017500000000141411506773275020056 00000000000000

Uncrustify your C code

Project web site

Download Uncrustify 0.0.3

What it does:
  • Ident code
  • Align code on '=' and variable definitions
  • Align #define stuff
  • Align backslash-newline stuff
  • Reformat comments (a little bit)
  • Fix inter-character spacing
What it doesn't do (yet):
  • Split long lines
  • Handle format changing #if/#else stuff
uncrustify-0.59/documentation/htdocs/configuration.txt0000644000175000017500000000437311574765221020371 00000000000000Quick documentation (probably out of date - see options.h) There are five type of arguments: - boolean (true/false) - numeric - ignore/add/remove/force - LF/CRLF/CR/AUTO - ignore/lead/trail "Ignore" means do not change it. "Add" in the context of spaces means make sure there is at least 1. "Add" elsewhere means make sure one is present. "Remove" mean remove the space/brace/newline/etc. "Force" in the context of spaces means ensure that there is exactly 1. "Force" in other contexts means the same as "add". Configuration items may reference previously defined configuration items. Numeric items may be prefixed with a '-' to invert the number. Boolean items may be prefixed with a '-' or '~' to invert the value. For example, the following is valid: output_tab_size = 4 indent_columns = output_tab_size All items default to false/0/ignore except: - newlines = auto - input_tab_size = 8 - output_tab_size = 8 - indent_columns = 8 - indent_with_tabs = 1 - indent_label = 1 - indent_access_spec = 1 - sp_before_comma = remove - string_escape_char = 92 # '\' Refer to set_option_defaults() Terminology: There are three types of parenthesis: sparen, fparen, paren. sparen are found with if/for/switch/while statements. fparen are found with function prototypes, calls and implementations. paren are everything else, such as those found with arithmetic ops. A 'span' is the maximum number of lines that a aligning feature will be considered. This is done to limit the scope of the aligning. So, if a span is set to 3 and more than 3 lines do not contain the item that is to be aligned, then the aligning set is closed. A 'gap' is the minimum spacing for aligned items. So, if it is set to 3 for typedefs, then there are a minimum of three spaces between the type and the typedef name. A 'threshold' is the maximum number of columns that a aligning feature will be considered. This is done to limit the scope of the aligning. This prevents really longs lines from being aligned with short lines. A list of all the options with documentation can be acquired by running uncrustify with the following options: $ uncrustify --show-config To get a valid configuration file with all defaults, run this: $ uncrustify -c /dev/null --update-config-with-doc uncrustify-0.59/documentation/htdocs/project-support.jpg0000644000175000017500000000731411506773275020644 00000000000000JFIF,,Created with The GIMPCC X"  + !"#&18, !"1#23ACQabq ?o %~Y]g#|OCk+kL؄~׌i -ks|*H̩5TL}9Kh?k^T:#4nc/7c\3jrrBWnM-m#v yfXG[FO.y9un/(5`8&Q tET_hϡϬK˩5qЩ^{zǤ0[/6 *Yq͞sM<݁ T%{tOގV'f2WoYUEf'>goydewƕD1TrNEq&'ݟwϫcFΫLF\5S_yqA #bVURߴ@ ̶LM4zP2^S(Y&ƨ_ǵpᙦ:#Kz}⺞~cWUg=Kh˝'ߝ\ x'_s?u ~iw1D;Ҥƃ((Pfu*|7vR]?eRTa#Ù«iX&tpTŪz҈b{d./<'Odw=z@K^?$as5I6Ƚtj;|Vsp̦50 Bgj#M ϶بM|!lI⡁㽲soI񎧭~bsQ֛>=}\rP96_ǚJ3&R8BLP+Qi6yN=~VxU䁪7j관YÍY- )t9/ 5;o}!/M{d3qS'ѱ?y?RE}ϺV:J )qvqj!"ᾉV?)za΄v sbt}\GM)/Έ CCTW hμ#*df=fF'?"YڌxY"YWCA嗝[ ԻbYfF M ŋG _Z }s_+A= y˲oir40w%nuGrD]fw<`,^;5S@vk|I 2{zUB 6j3)ʂS*5!tvC$}djB=O?v`^ƾRRFGe[5)' ;4$nyvF[qQ i ^3X'6p;R,} rp$v41J%L2ͳ* .=(,;zI:\eUbĘ0*Iy1s?{VFOl'>\)!Ę1_;# Ai#b7V| .`oYwC#ƔٚHμ6OUI?lM7d3fP2y21U%YPH;Q#|窟L40^ #Hf3Q3clT&e.jM}$ICJW5wW"`Euۓ&zW/NE&K1JHv,I@&wa'?\_E Sj7f4b!Ѵzp=}g%y (g&|f]U" BjQj=YQ"±";hWU3/, E~X\ I6[o3[.-gb>Bν]DFaS$9;;^q-$Ǵ ['F*$>1ɳ0 7ӼY *9|WgTJx)!@kY Ȯ;ژY "=Pg25#;է-H[]N =BP.?0ZGRכW(-U`e!$RŬK^7u%pih-Nn),#U8ۉ88s;ϗ˜O\W8ZxQչ#5e4l 2ZA ,!;JEHK5P C>R=²ZU|>8f>/X%%9k,uVӴUg‡G=fٕJܓ)L[jjL J&*.d~T'7kO6Y#LG0XREqˏ{7{U3t8.w{nqc[IE[O>:_PAgmIs✯A{VI0"'5UD6a͎! Qka1|EnwT\ZPۋ;ԹR}׻\|غe*RǍ<#_b^(I }u̜_Or)$"eτI]R0aڦw0oH a6"UܚV\eY@)wQBn7%oSW\Kq}KJx4jx5I}}]l@t˾DٚpUol8f|z8C$^.fc3,cЀO)=):} cw Ԣ] 灰wM?0V'nU+R:+q];hRL<:JL1v"JlgEmmHW:iĸT£u-Σ%m,6_t3s&#iַ;B9q]JRwOݿCM‘5gXզW|az߿Ӹxk]-Ep[`, k!ʝ}zSVA=A~禍xvH┾ssws[P rK;[kS2tpċ)ߓ)YmK~)Wy{e'pdr _kkLA`#:uncrustify-0.59/documentation/htdocs/index.html0000644000175000017500000001362611642735354016757 00000000000000 Uncrustify - Source Code Beautifier for C-like languages

Uncrustify

Source Code Beautifier for C, C++, C#, ObjectiveC, D, Java, Pawn and VALA


Introduction

The goals of this project are simple: Create a highly configurable, easily modifiable source code beautifier.


Features

  • Ident code, aligning on parens, assignments, etc
  • Align on '=' and variable definitions
  • Align structure initializers
  • Align #define stuff
  • Align backslash-newline stuff
  • Reformat comments (a little bit)
  • Fix inter-character spacing
  • Add or remove parens on return statements
  • Add or remove braces on single-statement if/do/while/for statements
  • Supports embedded SQL 'EXEC SQL' stuff
  • Highly configurable - 412 configurable options as of version 0.59

See some example output.


Where to get Uncrustify

Project Websites

Sourceforge project web site
Release downloads
Freshmeat Project
Git Hub

Source Code

As of release 0.54, the source code is maintained in a Git repository.

The public Git URL for Sourceforge.net is
git://uncrustify.git.sourceforge.net/gitroot/uncrustify/uncrustify

The public Git URL for github.com is
git://github.com/bengardner/uncrustify.git

Prebuilt binaries

Windows (i386) : Sourceforge
SPARC/Solaris 2.5-10 and x86/Solaris 8-10 : sunfreeware.com

Universal Indent GUI

Universal Indent GUI is a cross-platform graphical configuration file editor for many code beautifiers, including Uncrustify.


Want to help?

The most helpful way is to try it out and give feedback. Documentation and examples are available in the source tree, so check it out.

You can find the output from 'uncrustify --show-config' here.
Here is the default config file. And one I set up for Linux.
And here is a before and after C source example.
That should give you a pretty good idea of what Uncrustify can do.

If you find a bug, please do the following:

  • Reduce the input source file to the minimum that still has the problem
  • Use the sourceforget.net bug tracker
  • Attach the input source file, the configuration file, and a file that contains the expected output

If you want to add a feature, fix a bug, or implement missing functionality, feel free to do so! Patches are welcome!
Here are some areas that need attention:

  • Test Java support and provide feedback (or patches!)
  • Test Objective C support and provide feedback (or patches!)
  • Test Embedded SQL to see what works
  • This web page need a (re)design
  • A logo of some sort
  • Examples that can be put on this website to show off what Uncrustify can do
  • Anything else that you want to do to make it better?

Project Mailing list

There is one mailing list for Uncrustify.
uncrustify-developer@lists.sourceforge.net
Despite the name, it is for both users and developers.

Portability

I'm pretty sure that I'm not using anything that is OS-specific.
The software has been tested on the following operating systems:

  • Linux
  • QNX
  • OS X
  • FreeBSD, NetBSD, OpenBSD
  • Sun Solaris 9
  • Windows XP (binary available)

Links

Distributions that package Uncrustify


Support This Project
uncrustify-0.59/documentation/htdocs/ben.cfg.txt0000644000175000017500000000703511574765213017023 00000000000000# # My favorite format # newlines = LF # AUTO (default), CRLF, CR, or LF indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 3 # new tab size indent_columns = output_tab_size # indent_label = 0 # pos: absolute col, neg: relative column indent_align_string = False # align broken strings indent_brace = 0 indent_class = true nl_start_of_file = remove # nl_start_of_file_min = 0 nl_end_of_file = force nl_end_of_file_min = 1 nl_max = 4 nl_before_block_comment = 2 nl_after_func_body = 2 nl_after_func_proto_group = 2 nl_assign_brace = add # "= {" vs "= \n {" nl_enum_brace = add # "enum {" vs "enum \n {" nl_union_brace = add # "union {" vs "union \n {" nl_struct_brace = add # "struct {" vs "struct \n {" nl_do_brace = add # "do {" vs "do \n {" nl_if_brace = add # "if () {" vs "if () \n {" nl_for_brace = add # "for () {" vs "for () \n {" nl_else_brace = add # "else {" vs "else \n {" nl_while_brace = add # "while () {" vs "while () \n {" nl_switch_brace = add # "switch () {" vs "switch () \n {" nl_func_var_def_blk = 1 nl_before_case = 1 nl_fcall_brace = add # "foo() {" vs "foo()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" nl_after_return = TRUE nl_brace_while = remove nl_brace_else = add nl_squeeze_ifdef = TRUE pos_bool = trail # BOOL ops on trailing end eat_blanks_before_close_brace = TRUE eat_blanks_after_open_brace = TRUE mod_paren_on_return = add # "return 1;" vs "return (1);" mod_full_brace_if = add # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = add # "for () a--;" vs "for () { a--; }" mod_full_brace_do = add # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = add # "while (a) a--;" vs "while (a) { a--; }" sp_before_byref = remove sp_before_semi = remove sp_paren_paren = remove # space between (( and )) sp_return_paren = remove # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = force # "{ 1 }" vs "{1}" sp_inside_braces_struct = force # "{ 1 }" vs "{1}" sp_inside_braces_enum = force # "{ 1 }" vs "{1}" sp_inside_paren = remove sp_inside_fparen = remove sp_inside_sparen = remove sp_inside_square = remove #sp_type_func = ignore sp_assign = force sp_arith = force sp_bool = force sp_compare = force sp_assign = force sp_after_comma = force sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" sp_func_class_paren = remove sp_before_angle = force sp_after_angle = force sp_inside_angle = remove sp_sparen_brace = add sp_fparen_brace = add sp_after_ptr_star = remove sp_before_ptr_star = force sp_between_ptr_star = remove align_with_tabs = FALSE # use tabs to align align_on_tabstop = FALSE # align on tabstops align_enum_equ_span = 4 align_nl_cont = TRUE align_var_def_span = 1 align_var_def_thresh = 12 align_var_def_inline = TRUE align_var_def_star = TRUE align_var_def_colon = TRUE align_assign_span = 1 align_assign_thresh = 12 align_struct_init_span = 3 align_var_struct_span = 99 align_right_cmt_span = 3 align_pp_define_span = 3 align_pp_define_gap = 4 align_number_left = TRUE align_typedef_span = 5 align_typedef_gap = 3 cmt_star_cont = TRUE uncrustify-0.59/documentation/htdocs/default.cfg0000644000175000017500000017535411642735377017103 00000000000000# Uncrustify 0.59 # # General options # # The type of line endings newlines = auto # auto/lf/crlf/cr # The original size of tabs in the input input_tab_size = 8 # number # The size of tabs in the output (only used if align_with_tabs=true) output_tab_size = 8 # number # The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char = 92 # number # Alternate string escape char for Pawn. Only works right before the quote char. string_escape_char2 = 0 # number # Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. # If true (default), 'assert(x<0 && y>=3)' will be broken. # Improvements to template detection may make this option obsolete. tok_split_gte = false # false/true # Control what to do with the UTF-8 BOM (recommed 'remove') utf8_bom = ignore # ignore/add/remove/force # If the file only contains chars between 128 and 255 and is not UTF-8, then output as UTF-8 utf8_byte = false # false/true # Force the output encoding to UTF-8 utf8_force = false # false/true # # Indenting # # The number of columns to indent per level. # Usually 2, 3, 4, or 8. indent_columns = 8 # number # The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. # For FreeBSD, this is set to 4. indent_continue = 0 # number # How to use tabs when indenting code # 0=spaces only # 1=indent with tabs to brace level, align with spaces # 2=indent and align with tabs, using spaces when not on a tabstop indent_with_tabs = 1 # number # Comments that are not a brace level are indented with tabs on a tabstop. # Requires indent_with_tabs=2. If false, will use spaces. indent_cmt_with_tabs = false # false/true # Whether to indent strings broken by '\' so that they line up indent_align_string = false # false/true # The number of spaces to indent multi-line XML strings. # Requires indent_align_string=True indent_xml_string = 0 # number # Spaces to indent '{' from level indent_brace = 0 # number # Whether braces are indented to the body level indent_braces = false # false/true # Disabled indenting function braces if indent_braces is true indent_braces_no_func = false # false/true # Disabled indenting class braces if indent_braces is true indent_braces_no_class = false # false/true # Disabled indenting struct braces if indent_braces is true indent_braces_no_struct = false # false/true # Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_brace_parent = false # false/true # Whether the 'namespace' body is indented indent_namespace = false # false/true # The number of spaces to indent a namespace block indent_namespace_level = 0 # number # If the body of the namespace is longer than this number, it won't be indented. # Requires indent_namespace=true. Default=0 (no limit) indent_namespace_limit = 0 # number # Whether the 'extern "C"' body is indented indent_extern = false # false/true # Whether the 'class' body is indented indent_class = false # false/true # Whether to indent the stuff after a leading class colon indent_class_colon = false # false/true # Additional indenting for constructor initializer list indent_ctor_init = 0 # number # False=treat 'else\nif' as 'else if' for indenting purposes # True=indent the 'if' one level indent_else_if = false # false/true # Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_blk = 0 # number # Indent continued variable declarations instead of aligning. indent_var_def_cont = false # false/true # True: indent continued function call parameters one indent level # False: align parameters under the open paren indent_func_call_param = false # false/true # Same as indent_func_call_param, but for function defs indent_func_def_param = false # false/true # Same as indent_func_call_param, but for function protos indent_func_proto_param = false # false/true # Same as indent_func_call_param, but for class declarations indent_func_class_param = false # false/true # Same as indent_func_call_param, but for class variable constructors indent_func_ctor_var_param = false # false/true # Same as indent_func_call_param, but for templates indent_template_param = false # false/true # Double the indent for indent_func_xxx_param options indent_func_param_double = false # false/true # Indentation column for standalone 'const' function decl/proto qualifier indent_func_const = 0 # number # Indentation column for standalone 'throw' function decl/proto qualifier indent_func_throw = 0 # number # The number of spaces to indent a continued '->' or '.' # Usually set to 0, 1, or indent_columns. indent_member = 0 # number # Spaces to indent single line ('//') comments on lines before code indent_sing_line_comments = 0 # number # If set, will indent trailing single line ('//') comments relative # to the code instead of trying to keep the same absolute column indent_relative_single_line_comments = false # false/true # Spaces to indent 'case' from 'switch' # Usually 0 or indent_columns. indent_switch_case = 0 # number # Spaces to shift the 'case' line, without affecting any other lines # Usually 0. indent_case_shift = 0 # number # Spaces to indent '{' from 'case'. # By default, the brace will appear under the 'c' in case. # Usually set to 0 or indent_columns. indent_case_brace = 0 # number # Whether to indent comments found in first column indent_col1_comment = false # false/true # How to indent goto labels # >0 : absolute column where 1 is the leftmost column # <=0 : subtract from brace indent indent_label = 1 # number # Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec = 1 # number # Indent the code after an access specifier by one level. # If set, this option forces 'indent_access_spec=0' indent_access_spec_body = false # false/true # If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_nl = false # false/true # Controls the indent of a close paren after a newline. # 0: Indent to body level # 1: Align under the open paren # 2: Indent to the brace level indent_paren_close = 0 # number # Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_comma_paren = false # false/true # Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_bool_paren = false # false/true # If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_first_bool_expr = false # false/true # If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_square_nl = false # false/true # Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_preserve_sql = false # false/true # Align continued statements at the '='. Default=True # If FALSE or the '=' is followed by a newline, the next line is indent one tab. indent_align_assign = true # false/true # # Spacing options # # Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_arith = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=', '+=', etc sp_assign = ignore # ignore/add/remove/force # Add or remove space around assignment operator '=' in a prototype sp_assign_default = ignore # ignore/add/remove/force # Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign = ignore # ignore/add/remove/force # Add or remove space around assignment '=' in enum sp_enum_assign = ignore # ignore/add/remove/force # Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_before_assign = ignore # ignore/add/remove/force # Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign = ignore # ignore/add/remove/force # Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_concat = add # ignore/add/remove/force # Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_pp_stringify = add # ignore/add/remove/force # Add or remove space around boolean operators '&&' and '||' sp_bool = ignore # ignore/add/remove/force # Add or remove space around compare operator '<', '>', '==', etc sp_compare = ignore # ignore/add/remove/force # Add or remove space inside '(' and ')' sp_inside_paren = ignore # ignore/add/remove/force # Add or remove space between nested parens sp_paren_paren = ignore # ignore/add/remove/force # Whether to balance spaces inside nested parens sp_balance_nested_parens = false # false/true # Add or remove space between ')' and '{' sp_paren_brace = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' sp_before_ptr_star = ignore # ignore/add/remove/force # Add or remove space before pointer star '*' that isn't followed by a variable name # If set to 'ignore', sp_before_ptr_star is used instead. sp_before_unnamed_ptr_star = ignore # ignore/add/remove/force # Add or remove space between pointer stars '*' sp_between_ptr_star = ignore # ignore/add/remove/force # Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star = ignore # ignore/add/remove/force # Add or remove space after a pointer star '*', if followed by a func proto/def. sp_after_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' sp_before_byref = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&' that isn't followed by a variable name # If set to 'ignore', sp_before_byref is used instead. sp_before_unnamed_byref = ignore # ignore/add/remove/force # Add or remove space after reference sign '&', if followed by a word. sp_after_byref = ignore # ignore/add/remove/force # Add or remove space after a reference sign '&', if followed by a func proto/def. sp_after_byref_func = ignore # ignore/add/remove/force # Add or remove space before a reference sign '&', if followed by a func proto/def. sp_before_byref_func = ignore # ignore/add/remove/force # Add or remove space between type and word. Default=Force sp_after_type = force # ignore/add/remove/force # Add or remove space in 'template <' vs 'template<'. # If set to ignore, sp_before_angle is used. sp_template_angle = ignore # ignore/add/remove/force # Add or remove space before '<>' sp_before_angle = ignore # ignore/add/remove/force # Add or remove space inside '<' and '>' sp_inside_angle = ignore # ignore/add/remove/force # Add or remove space after '<>' sp_after_angle = ignore # ignore/add/remove/force # Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_paren = ignore # ignore/add/remove/force # Add or remove space between '<>' and a word as in 'List m;' sp_angle_word = ignore # ignore/add/remove/force # Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_angle_shift = add # ignore/add/remove/force # Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_before_sparen = ignore # ignore/add/remove/force # Add or remove space inside if-condition '(' and ')' sp_inside_sparen = ignore # ignore/add/remove/force # Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_inside_sparen_close = ignore # ignore/add/remove/force # Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_after_sparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_sparen_brace = ignore # ignore/add/remove/force # Add or remove space between 'invariant' and '(' in the D language. sp_invariant_paren = ignore # ignore/add/remove/force # Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_after_invariant_paren = ignore # ignore/add/remove/force # Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_special_semi = ignore # ignore/add/remove/force # Add or remove space before ';'. Default=Remove sp_before_semi = remove # ignore/add/remove/force # Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for = ignore # ignore/add/remove/force # Add or remove space before a semicolon of an empty part of a for statement. sp_before_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi = add # ignore/add/remove/force # Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for = force # ignore/add/remove/force # Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_after_semi_for_empty = ignore # ignore/add/remove/force # Add or remove space before '[' (except '[]') sp_before_square = ignore # ignore/add/remove/force # Add or remove space before '[]' sp_before_squares = ignore # ignore/add/remove/force # Add or remove space inside a non-empty '[' and ']' sp_inside_square = ignore # ignore/add/remove/force # Add or remove space after ',' sp_after_comma = ignore # ignore/add/remove/force # Add or remove space before ',' sp_before_comma = remove # ignore/add/remove/force # Add or remove space between an open paren and comma: '(,' vs '( ,' sp_paren_comma = force # ignore/add/remove/force # Add or remove space before the variadic '...' when preceded by a non-punctuator sp_before_ellipsis = ignore # ignore/add/remove/force # Add or remove space after class ':' sp_after_class_colon = ignore # ignore/add/remove/force # Add or remove space before class ':' sp_before_class_colon = ignore # ignore/add/remove/force # Add or remove space before case ':'. Default=Remove sp_before_case_colon = remove # ignore/add/remove/force # Add or remove space between 'operator' and operator sign sp_after_operator = ignore # ignore/add/remove/force # Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_operator_sym = ignore # ignore/add/remove/force # Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_after_cast = ignore # ignore/add/remove/force # Add or remove spaces inside cast parens sp_inside_paren_cast = ignore # ignore/add/remove/force # Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_cpp_cast_paren = ignore # ignore/add/remove/force # Add or remove space between 'sizeof' and '(' sp_sizeof_paren = ignore # ignore/add/remove/force # Add or remove space after the tag keyword (Pawn) sp_after_tag = ignore # ignore/add/remove/force # Add or remove space inside enum '{' and '}' sp_inside_braces_enum = ignore # ignore/add/remove/force # Add or remove space inside struct/union '{' and '}' sp_inside_braces_struct = ignore # ignore/add/remove/force # Add or remove space inside '{' and '}' sp_inside_braces = ignore # ignore/add/remove/force # Add or remove space inside '{}' sp_inside_braces_empty = ignore # ignore/add/remove/force # Add or remove space between return type and function name # A minimum of 1 is forced except for pointer return types. sp_type_func = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function declaration sp_func_proto_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function definition sp_func_def_paren = ignore # ignore/add/remove/force # Add or remove space inside empty function '()' sp_inside_fparens = ignore # ignore/add/remove/force # Add or remove space inside function '(' and ')' sp_inside_fparen = ignore # ignore/add/remove/force # Add or remove space between ']' and '(' when part of a function call. sp_square_fparen = ignore # ignore/add/remove/force # Add or remove space between ')' and '{' of function sp_fparen_brace = ignore # ignore/add/remove/force # Add or remove space between function name and '(' on function calls sp_func_call_paren = ignore # ignore/add/remove/force # Add or remove space between function name and '()' on function calls without parameters. # If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_paren_empty = ignore # ignore/add/remove/force # Add or remove space between the user function name and '(' on function calls # You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_call_user_paren = ignore # ignore/add/remove/force # Add or remove space between a constructor/destructor and the open paren sp_func_class_paren = ignore # ignore/add/remove/force # Add or remove space between 'return' and '(' sp_return_paren = ignore # ignore/add/remove/force # Add or remove space between '__attribute__' and '(' sp_attribute_paren = ignore # ignore/add/remove/force # Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_defined_paren = ignore # ignore/add/remove/force # Add or remove space between 'throw' and '(' in 'throw (something)' sp_throw_paren = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '(' in 'catch (something) { }' # If set to ignore, sp_before_sparen is used. sp_catch_paren = ignore # ignore/add/remove/force # Add or remove space between 'version' and '(' in 'version (something) { }' (D language) # If set to ignore, sp_before_sparen is used. sp_version_paren = ignore # ignore/add/remove/force # Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language) # If set to ignore, sp_before_sparen is used. sp_scope_paren = ignore # ignore/add/remove/force # Add or remove space between macro and value sp_macro = ignore # ignore/add/remove/force # Add or remove space between macro function ')' and value sp_macro_func = ignore # ignore/add/remove/force # Add or remove space between 'else' and '{' if on the same line sp_else_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'else' if on the same line sp_brace_else = ignore # ignore/add/remove/force # Add or remove space between '}' and the name of a typedef on the same line sp_brace_typedef = ignore # ignore/add/remove/force # Add or remove space between 'catch' and '{' if on the same line sp_catch_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'catch' if on the same line sp_brace_catch = ignore # ignore/add/remove/force # Add or remove space between 'finally' and '{' if on the same line sp_finally_brace = ignore # ignore/add/remove/force # Add or remove space between '}' and 'finally' if on the same line sp_brace_finally = ignore # ignore/add/remove/force # Add or remove space between 'try' and '{' if on the same line sp_try_brace = ignore # ignore/add/remove/force # Add or remove space between get/set and '{' if on the same line sp_getset_brace = ignore # ignore/add/remove/force # Add or remove space before the '::' operator sp_before_dc = ignore # ignore/add/remove/force # Add or remove space after the '::' operator sp_after_dc = ignore # ignore/add/remove/force # Add or remove around the D named array initializer ':' operator sp_d_array_colon = ignore # ignore/add/remove/force # Add or remove space after the '!' (not) operator. Default=Remove sp_not = remove # ignore/add/remove/force # Add or remove space after the '~' (invert) operator. Default=Remove sp_inv = remove # ignore/add/remove/force # Add or remove space after the '&' (address-of) operator. Default=Remove # This does not affect the spacing after a '&' that is part of a type. sp_addr = remove # ignore/add/remove/force # Add or remove space around the '.' or '->' operators. Default=Remove sp_member = remove # ignore/add/remove/force # Add or remove space after the '*' (dereference) operator. Default=Remove # This does not affect the spacing after a '*' that is part of a type. sp_deref = remove # ignore/add/remove/force # Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_sign = remove # ignore/add/remove/force # Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_incdec = remove # ignore/add/remove/force # Add or remove space before a backslash-newline at the end of a line. Default=Add sp_before_nl_cont = add # ignore/add/remove/force # Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_scope = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_after_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_before_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the colon in message specs # '[object setValue:1];' vs '[object setValue: 1];' sp_after_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space before the colon in message specs # '[object setValue:1];' vs '[object setValue :1];' sp_before_send_oc_colon = ignore # ignore/add/remove/force # Add or remove space after the (type) in message specs # '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_type = ignore # ignore/add/remove/force # Add or remove space after the first (type) in message specs # '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_return_type = ignore # ignore/add/remove/force # Add or remove space between '@selector' and '(' # '@selector(msgName)' vs '@selector (msgName)' # Also applies to @protocol() constructs sp_after_oc_at_sel = ignore # ignore/add/remove/force # Add or remove space between '@selector(x)' and the following word # '@selector(foo) a:' vs '@selector(foo)a:' sp_after_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space inside '@selector' parens # '@selector(foo)' vs '@selector( foo )' # Also applies to @protocol() constructs sp_inside_oc_at_sel_parens = ignore # ignore/add/remove/force # Add or remove space before a block pointer caret # '^int (int arg){...}' vs. ' ^int (int arg){...}' sp_before_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space after a block pointer caret # '^int (int arg){...}' vs. '^ int (int arg){...}' sp_after_oc_block_caret = ignore # ignore/add/remove/force # Add or remove space around the ':' in 'b ? t : f' sp_cond_colon = ignore # ignore/add/remove/force # Add or remove space around the '?' in 'b ? t : f' sp_cond_question = ignore # ignore/add/remove/force # Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_case_label = ignore # ignore/add/remove/force # Control the space around the D '..' operator. sp_range = ignore # ignore/add/remove/force # Control the space after the opening of a C++ comment '// A' vs '//A' sp_cmt_cpp_start = ignore # ignore/add/remove/force # Controls the spaces between #else or #endif and a trailing comment sp_endif_cmt = ignore # ignore/add/remove/force # Controls the spaces after 'new', 'delete', and 'delete[]' sp_after_new = ignore # ignore/add/remove/force # Controls the spaces before a trailing or embedded comment sp_before_tr_emb_cmt = ignore # ignore/add/remove/force # Number of spaces before a trailing or embedded comment sp_num_before_tr_emb_cmt = 0 # number # # Code alignment (not left column spaces/tabs) # # Whether to keep non-indenting tabs align_keep_tabs = false # false/true # Whether to use tabs for aligning align_with_tabs = false # false/true # Whether to bump out to the next tab when aligning align_on_tabstop = false # false/true # Whether to left-align numbers align_number_left = false # false/true # Align variable definitions in prototypes and functions align_func_params = false # false/true # Align parameters in single-line functions that have the same name. # The function names must already be aligned with each other. align_same_func_call_params = false # false/true # The span for aligning variable definitions (0=don't align) align_var_def_span = 0 # number # How to align the star in variable definitions. # 0=Part of the type 'void * foo;' # 1=Part of the variable 'void *foo;' # 2=Dangling 'void *foo;' align_var_def_star_style = 0 # number # How to align the '&' in variable definitions. # 0=Part of the type # 1=Part of the variable # 2=Dangling align_var_def_amp_style = 0 # number # The threshold for aligning variable definitions (0=no limit) align_var_def_thresh = 0 # number # The gap for aligning variable definitions align_var_def_gap = 0 # number # Whether to align the colon in struct bit fields align_var_def_colon = false # false/true # Whether to align any attribute after the variable name align_var_def_attribute = false # false/true # Whether to align inline struct/enum/union variable definitions align_var_def_inline = false # false/true # The span for aligning on '=' in assignments (0=don't align) align_assign_span = 0 # number # The threshold for aligning on '=' in assignments (0=no limit) align_assign_thresh = 0 # number # The span for aligning on '=' in enums (0=don't align) align_enum_equ_span = 0 # number # The threshold for aligning on '=' in enums (0=no limit) align_enum_equ_thresh = 0 # number # The span for aligning struct/union (0=don't align) align_var_struct_span = 0 # number # The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_thresh = 0 # number # The gap for aligning struct/union member definitions align_var_struct_gap = 0 # number # The span for aligning struct initializer values (0=don't align) align_struct_init_span = 0 # number # The minimum space between the type and the synonym of a typedef align_typedef_gap = 0 # number # The span for aligning single-line typedefs (0=don't align) align_typedef_span = 0 # number # How to align typedef'd functions with other typedefs # 0: Don't mix them at all # 1: align the open paren with the types # 2: align the function type name with the other type names align_typedef_func = 0 # number # Controls the positioning of the '*' in typedefs. Just try it. # 0: Align on typedef type, ignore '*' # 1: The '*' is part of type name: typedef int *pint; # 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_star_style = 0 # number # Controls the positioning of the '&' in typedefs. Just try it. # 0: Align on typedef type, ignore '&' # 1: The '&' is part of type name: typedef int &pint; # 2: The '&' is part of the type, but dangling: typedef int &pint; align_typedef_amp_style = 0 # number # The span for aligning comments that end lines (0=don't align) align_right_cmt_span = 0 # number # If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_mix = false # false/true # If a trailing comment is more than this number of columns away from the text it follows, # it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_gap = 0 # number # Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_right_cmt_at_col = 0 # number # The span for aligning function prototypes (0=don't align) align_func_proto_span = 0 # number # Minimum gap between the return type and the function name. align_func_proto_gap = 0 # number # Align function protos on the 'operator' keyword instead of what follows align_on_operator = false # false/true # Whether to mix aligning prototype and variable declarations. # If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_mix_var_proto = false # false/true # Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_func = false # false/true # Aligning the open brace of single-line functions. # Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace = false # false/true # Gap for align_single_line_brace. align_single_line_brace_gap = 0 # number # The span for aligning ObjC msg spec (0=don't align) align_oc_msg_spec_span = 0 # number # Whether to align macros wrapped with a backslash and a newline. # This will not work right if the macro contains a multi-line comment. align_nl_cont = false # false/true # The minimum space between label and value of a preprocessor define align_pp_define_gap = 0 # number # The span for aligning on '#define' bodies (0=don't align) align_pp_define_span = 0 # number # Align lines that start with '<<' with previous '<<'. Default=true align_left_shift = true # false/true # Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) align_oc_msg_colon_span = 0 # number # Aligning parameters in an Obj-C '+' or '-' declaration on the ':' align_oc_decl_colon = false # false/true # # Newline adding and removing options # # Whether to collapse empty blocks between '{' and '}' nl_collapse_empty_body = false # false/true # Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_assign_leave_one_liners = false # false/true # Don't split one-line braced statements inside a class xx { } body nl_class_leave_one_liners = false # false/true # Don't split one-line enums: 'enum foo { BAR = 15 };' nl_enum_leave_one_liners = false # false/true # Don't split one-line get or set functions nl_getset_leave_one_liners = false # false/true # Don't split one-line function definitions - 'int foo() { return 0; }' nl_func_leave_one_liners = false # false/true # Don't split one-line if/else statements - 'if(a) b++;' nl_if_leave_one_liners = false # false/true # Add or remove newlines at the start of the file nl_start_of_file = ignore # ignore/add/remove/force # The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_start_of_file_min = 0 # number # Add or remove newline at the end of the file nl_end_of_file = ignore # ignore/add/remove/force # The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_end_of_file_min = 0 # number # Add or remove newline between '=' and '{' nl_assign_brace = ignore # ignore/add/remove/force # Add or remove newline between '=' and '[' (D only) nl_assign_square = ignore # ignore/add/remove/force # Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_after_square_assign = ignore # ignore/add/remove/force # The number of blank lines after a block of variable definitions at the top of a function body. # 0=no change (default) nl_func_var_def_blk = 0 # number # Add or remove newline between a function call's ')' and '{', as in: # list_for_each(item, &list) { } nl_fcall_brace = ignore # ignore/add/remove/force # Add or remove newline between 'enum' and '{' nl_enum_brace = ignore # ignore/add/remove/force # Add or remove newline between 'struct and '{' nl_struct_brace = ignore # ignore/add/remove/force # Add or remove newline between 'union' and '{' nl_union_brace = ignore # ignore/add/remove/force # Add or remove newline between 'if' and '{' nl_if_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'else' nl_brace_else = ignore # ignore/add/remove/force # Add or remove newline between 'else if' and '{' # If set to ignore, nl_if_brace is used instead nl_elseif_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and '{' nl_else_brace = ignore # ignore/add/remove/force # Add or remove newline between 'else' and 'if' nl_else_if = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'finally' nl_brace_finally = ignore # ignore/add/remove/force # Add or remove newline between 'finally' and '{' nl_finally_brace = ignore # ignore/add/remove/force # Add or remove newline between 'try' and '{' nl_try_brace = ignore # ignore/add/remove/force # Add or remove newline between get/set and '{' nl_getset_brace = ignore # ignore/add/remove/force # Add or remove newline between 'for' and '{' nl_for_brace = ignore # ignore/add/remove/force # Add or remove newline between 'catch' and '{' nl_catch_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'catch' nl_brace_catch = ignore # ignore/add/remove/force # Add or remove newline between 'while' and '{' nl_while_brace = ignore # ignore/add/remove/force # Add or remove newline between 'using' and '{' nl_using_brace = ignore # ignore/add/remove/force # Add or remove newline between two open or close braces. # Due to general newline/brace handling, REMOVE may not work. nl_brace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'do' and '{' nl_do_brace = ignore # ignore/add/remove/force # Add or remove newline between '}' and 'while' of 'do' statement nl_brace_while = ignore # ignore/add/remove/force # Add or remove newline between 'switch' and '{' nl_switch_brace = ignore # ignore/add/remove/force # Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. # Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_cond = false # false/true # Force a newline in a define after the macro name for multi-line defines. nl_multi_line_define = false # false/true # Whether to put a newline before 'case' statement nl_before_case = false # false/true # Add or remove newline between ')' and 'throw' nl_before_throw = ignore # ignore/add/remove/force # Whether to put a newline after 'case' statement nl_after_case = false # false/true # Add or remove a newline between a case ':' and '{'. Overrides nl_after_case. nl_case_colon_brace = ignore # ignore/add/remove/force # Newline between namespace and { nl_namespace_brace = ignore # ignore/add/remove/force # Add or remove newline between 'template<>' and whatever follows. nl_template_class = ignore # ignore/add/remove/force # Add or remove newline between 'class' and '{' nl_class_brace = ignore # ignore/add/remove/force # Add or remove newline after each ',' in the constructor member initialization nl_class_init_args = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a function definition nl_func_type_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name inside a class {} # Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_type_name_class = ignore # ignore/add/remove/force # Add or remove newline between function scope and name in a definition # Controls the newline after '::' in 'void A::f() { }' nl_func_scope_name = ignore # ignore/add/remove/force # Add or remove newline between return type and function name in a prototype nl_func_proto_type_name = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' nl_func_paren = ignore # ignore/add/remove/force # Add or remove newline between a function name and the opening '(' in the definition nl_func_def_paren = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function declaration nl_func_decl_start = ignore # ignore/add/remove/force # Add or remove newline after '(' in a function definition nl_func_def_start = ignore # ignore/add/remove/force # Overrides nl_func_decl_start when there is only one parameter. nl_func_decl_start_single = ignore # ignore/add/remove/force # Overrides nl_func_def_start when there is only one parameter. nl_func_def_start_single = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function declaration nl_func_decl_args = ignore # ignore/add/remove/force # Add or remove newline after each ',' in a function definition nl_func_def_args = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function declaration nl_func_decl_end = ignore # ignore/add/remove/force # Add or remove newline before the ')' in a function definition nl_func_def_end = ignore # ignore/add/remove/force # Overrides nl_func_decl_end when there is only one parameter. nl_func_decl_end_single = ignore # ignore/add/remove/force # Overrides nl_func_def_end when there is only one parameter. nl_func_def_end_single = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function declaration. nl_func_decl_empty = ignore # ignore/add/remove/force # Add or remove newline between '()' in a function definition. nl_func_def_empty = ignore # ignore/add/remove/force # Add or remove newline between function signature and '{' nl_fdef_brace = ignore # ignore/add/remove/force # Whether to put a newline after 'return' statement nl_after_return = false # false/true # Add or remove a newline between the return keyword and return expression. nl_return_expr = ignore # ignore/add/remove/force # Whether to put a newline after semicolons, except in 'for' statements nl_after_semicolon = false # false/true # Whether to put a newline after brace open. # This also adds a newline before the matching brace close. nl_after_brace_open = false # false/true # If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is # placed between the open brace and a trailing single-line comment. nl_after_brace_open_cmt = false # false/true # Whether to put a newline after a virtual brace open with a non-empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open = false # false/true # Whether to put a newline after a virtual brace open with an empty body. # These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty = false # false/true # Whether to put a newline after a brace close. # Does not apply if followed by a necessary ';'. nl_after_brace_close = false # false/true # Whether to put a newline after a virtual brace close. # Would add a newline before return in: 'if (foo) a++; return;' nl_after_vbrace_close = false # false/true # Whether to alter newlines in '#define' macros nl_define_macro = false # false/true # Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_squeeze_ifdef = false # false/true # Add or remove blank line before 'if' nl_before_if = ignore # ignore/add/remove/force # Add or remove blank line after 'if' statement nl_after_if = ignore # ignore/add/remove/force # Add or remove blank line before 'for' nl_before_for = ignore # ignore/add/remove/force # Add or remove blank line after 'for' statement nl_after_for = ignore # ignore/add/remove/force # Add or remove blank line before 'while' nl_before_while = ignore # ignore/add/remove/force # Add or remove blank line after 'while' statement nl_after_while = ignore # ignore/add/remove/force # Add or remove blank line before 'switch' nl_before_switch = ignore # ignore/add/remove/force # Add or remove blank line after 'switch' statement nl_after_switch = ignore # ignore/add/remove/force # Add or remove blank line before 'do' nl_before_do = ignore # ignore/add/remove/force # Add or remove blank line after 'do/while' statement nl_after_do = ignore # ignore/add/remove/force # Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_cmt = false # false/true # Whether to double-space before the close brace of a struct/union/enum # (lower priority than 'eat_blanks_before_close_brace') nl_ds_struct_enum_close_brace = false # false/true # Add or remove a newline around a class colon. # Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_class_colon = ignore # ignore/add/remove/force # Change simple unbraced if statements into a one-liner # 'if(b)\n i++;' => 'if(b) i++;' nl_create_if_one_liner = false # false/true # Change simple unbraced for statements into a one-liner # 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_for_one_liner = false # false/true # Change simple unbraced while statements into a one-liner # 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' nl_create_while_one_liner = false # false/true # # Positioning options # # The position of arithmetic operators in wrapped expressions pos_arith = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of assignment in wrapped expressions. # Do not affect '=' followed by '{' pos_assign = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of boolean operators in wrapped expressions pos_bool = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of comparison operators in wrapped expressions pos_compare = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of conditional (b ? t : f) operators in wrapped expressions pos_conditional = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in wrapped expressions pos_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of the comma in the constructor initialization list pos_class_comma = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # The position of colons between constructor and member initialization pos_class_colon = ignore # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force # # Line Splitting options # # Try to limit code width to N number of columns code_width = 0 # number # Whether to fully split long 'for' statements at semi-colons ls_for_split_full = false # false/true # Whether to fully split long function protos/calls at commas ls_func_split_full = false # false/true # # Blank line options # # The maximum consecutive newlines nl_max = 0 # number # The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto = 0 # number # The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_proto_group = 0 # number # The number of newlines after '}' of a multi-line function body nl_after_func_body = 0 # number # The number of newlines after '}' of a multi-line function body in a class declaration nl_after_func_body_class = 0 # number # The number of newlines after '}' of a single line function body nl_after_func_body_one_liner = 0 # number # The minimum number of newlines before a multi-line comment. # Doesn't apply if after a brace open or another multi-line comment. nl_before_block_comment = 0 # number # The minimum number of newlines before a single-line C comment. # Doesn't apply if after a brace open or other single-line C comments. nl_before_c_comment = 0 # number # The minimum number of newlines before a CPP comment. # Doesn't apply if after a brace open or other CPP comments. nl_before_cpp_comment = 0 # number # Whether to force a newline after a multi-line comment. nl_after_multiline_comment = false # false/true # The number of newlines after '}' or ';' of a struct/enum/union definition nl_after_struct = 0 # number # The number of newlines after '}' or ';' of a class definition nl_after_class = 0 # number # The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # Will not change the newline count if after a brace open. # 0 = No change. nl_before_access_spec = 0 # number # The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. # 0 = No change. nl_after_access_spec = 0 # number # The number of newlines between a function def and the function comment. # 0 = No change. nl_comment_func_def = 0 # number # The number of newlines after a try-catch-finally block that isn't followed by a brace close. # 0 = No change. nl_after_try_catch_finally = 0 # number # The number of newlines before and after a property, indexer or event decl. # 0 = No change. nl_around_cs_property = 0 # number # The number of newlines between the get/set/add/remove handlers in C#. # 0 = No change. nl_between_get_set = 0 # number # Add or remove newline between C# property and the '{' nl_property_brace = ignore # ignore/add/remove/force # Whether to remove blank lines after '{' eat_blanks_after_open_brace = false # false/true # Whether to remove blank lines before '}' eat_blanks_before_close_brace = false # false/true # # Code modifying options (non-whitespace) # # Add or remove braces on single-line 'do' statement mod_full_brace_do = ignore # ignore/add/remove/force # Add or remove braces on single-line 'for' statement mod_full_brace_for = ignore # ignore/add/remove/force # Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_function = ignore # ignore/add/remove/force # Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if = ignore # ignore/add/remove/force # Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. # If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_if_chain = false # false/true # Don't remove braces around statements that span N newlines mod_full_brace_nl = 0 # number # Add or remove braces on single-line 'while' statement mod_full_brace_while = ignore # ignore/add/remove/force # Add or remove braces on single-line 'using ()' statement mod_full_brace_using = ignore # ignore/add/remove/force # Add or remove unnecessary paren on 'return' statement mod_paren_on_return = ignore # ignore/add/remove/force # Whether to change optional semicolons to real semicolons mod_pawn_semicolon = false # false/true # Add parens on 'while' and 'if' statement around bools mod_full_paren_if_bool = false # false/true # Whether to remove superfluous semicolons mod_remove_extra_semicolon = false # false/true # If a function body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_function_closebrace_comment = 0 # number # If a switch body exceeds the specified number of newlines and doesn't have a comment after # the close brace, a comment will be added. mod_add_long_switch_closebrace_comment = 0 # number # If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after # the #endif, a comment will be added. mod_add_long_ifdef_endif_comment = 0 # number # If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after # the #else, a comment will be added. mod_add_long_ifdef_else_comment = 0 # number # If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_import = false # false/true # If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_using = false # false/true # If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] # This is generally a bad idea, as it may break your code. mod_sort_include = false # false/true # If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_move_case_break = false # false/true # Will add or remove the braces around a fully braced case statement. # Will only remove the braces if there are no variable declarations in the block. mod_case_brace = ignore # ignore/add/remove/force # If TRUE, it will remove a void 'return;' that appears as the last statement in a function. mod_remove_empty_return = false # false/true # # Comment modifications # # Try to wrap comments at cmt_width columns cmt_width = 0 # number # Set the comment reflow mode (default: 0) # 0: no reflowing (apart from the line wrapping due to cmt_width) # 1: no touching at all # 2: full reflow cmt_reflow_mode = 0 # number # If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. # Default is true. cmt_indent_multi = true # false/true # Whether to group c-comments that look like they are in a block cmt_c_group = false # false/true # Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined c-comment cmt_c_nl_end = false # false/true # Whether to group cpp-comments that look like they are in a block cmt_cpp_group = false # false/true # Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_start = false # false/true # Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_nl_end = false # false/true # Whether to change cpp-comments into c-comments cmt_cpp_to_c = false # false/true # Whether to put a star on subsequent comment lines cmt_star_cont = false # false/true # The number of spaces to insert at the start of subsequent comment lines cmt_sp_before_star_cont = 0 # number # The number of spaces to insert after the star on subsequent comment lines cmt_sp_after_star_cont = 0 # number # For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of # the comment are the same length. Default=True cmt_multi_check_last = true # false/true # The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_header = "" # string # The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. # Will substitute $(filename) with the current file's name. cmt_insert_file_footer = "" # string # The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. # Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. # Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_func_header = "" # string # The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. # Will substitute $(class) with the class name. cmt_insert_class_header = "" # string # The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment. # Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. cmt_insert_oc_msg_header = "" # string # If a preprocessor is encountered when stepping backwards from a function name, then # this option decides whether the comment should be inserted. # Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. cmt_insert_before_preproc = false # false/true # # Preprocessor options # # Control indent of preprocessors inside #if blocks at brace level 0 pp_indent = ignore # ignore/add/remove/force # Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_at_level = false # false/true # If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_indent_count = 1 # number # Add or remove space after # based on pp_level of #if blocks pp_space = ignore # ignore/add/remove/force # Sets the number of spaces added with pp_space pp_space_count = 0 # number # The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_indent_region = 0 # number # Whether to indent the code between #region and #endregion pp_region_indent_code = false # false/true # If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_indent_if = 0 # number # Control whether to indent the code between #if, #else and #endif when not at file-level pp_if_indent_code = false # false/true # Whether to indent '#define' at the brace level (true) or from column 1 (false) pp_define_at_level = false # false/true # You can force a token to be a type with the 'type' option. # Example: # type myfoo1 myfoo2 # # You can create custom macro-based indentation using macro-open, # macro-else and macro-close. # Example: # macro-open BEGIN_TEMPLATE_MESSAGE_MAP # macro-open BEGIN_MESSAGE_MAP # macro-close END_MESSAGE_MAP # # You can assign any keyword to any type with the set option. # set func_call_user _ N_ # # The full syntax description of all custom definition config entries # is shown below: # # define custom tokens as: # - embed whitespace in token using '' escape character, or # put token in quotes # - these: ' " and ` are recognized as quote delimiters # # type token1 token2 token3 ... # ^ optionally specify multiple tokens on a single line # define def_token output_token # ^ output_token is optional, then NULL is assumed # macro-open token # macro-close token # macro-else token # set id token1 token2 ... # ^ optionally specify multiple tokens on a single line # ^ id is one of the names in token_enum.h sans the CT_ prefix, # e.g. PP_PRAGMA # # all tokens are separated by any mix of ',' commas, '=' equal signs # and whitespace (space, tab) # uncrustify-0.59/documentation/htdocs/linux.cfg.txt0000644000175000017500000000542711574765225017424 00000000000000# # uncrustify config file for the linux kernel # indent_with_tabs = 2 # 1=indent to level only, 2=indent with tabs input_tab_size = 8 # original tab size output_tab_size = 8 # new tab size indent_columns = output_tab_size indent_label = 1 # pos: absolute col, neg: relative column # # inter-symbol newlines # nl_enum_brace = remove # "enum {" vs "enum \n {" nl_union_brace = remove # "union {" vs "union \n {" nl_struct_brace = remove # "struct {" vs "struct \n {" nl_do_brace = remove # "do {" vs "do \n {" nl_if_brace = remove # "if () {" vs "if () \n {" nl_for_brace = remove # "for () {" vs "for () \n {" nl_else_brace = remove # "else {" vs "else \n {" nl_while_brace = remove # "while () {" vs "while () \n {" nl_switch_brace = remove # "switch () {" vs "switch () \n {" nl_brace_while = remove # "} while" vs "} \n while" - cuddle while nl_brace_else = remove # "} else" vs "} \n else" - cuddle else nl_func_var_def_blk = 1 nl_fcall_brace = remove # "list_for_each() {" vs "list_for_each()\n{" nl_fdef_brace = add # "int foo() {" vs "int foo()\n{" # nl_after_return = TRUE; # nl_before_case = 1 # # Source code modifications # mod_paren_on_return = remove # "return 1;" vs "return (1);" mod_full_brace_if = remove # "if (a) a--;" vs "if (a) { a--; }" mod_full_brace_for = remove # "for () a--;" vs "for () { a--; }" mod_full_brace_do = remove # "do a--; while ();" vs "do { a--; } while ();" mod_full_brace_while = remove # "while (a) a--;" vs "while (a) { a--; }" mod_full_brace_nl = 3 # don't remove if more than 3 newlines # # inter-character spacing options # # sp_return_paren = force # "return (1);" vs "return(1);" sp_sizeof_paren = remove # "sizeof (int)" vs "sizeof(int)" sp_before_sparen = force # "if (" vs "if(" sp_after_sparen = force # "if () {" vs "if (){" sp_after_cast = remove # "(int) a" vs "(int)a" sp_inside_braces = add # "{ 1 }" vs "{1}" sp_inside_braces_struct = add # "{ 1 }" vs "{1}" sp_inside_braces_enum = add # "{ 1 }" vs "{1}" sp_assign = add sp_arith = add sp_bool = add sp_compare = add sp_assign = add sp_after_comma = add sp_func_def_paren = remove # "int foo (){" vs "int foo(){" sp_func_call_paren = remove # "foo (" vs "foo(" sp_func_proto_paren = remove # "int foo ();" vs "int foo();" # # Aligning stuff # align_with_tabs = TRUE # use tabs to align align_on_tabstop = TRUE # align on tabstops # align_keep_tabs = true align_enum_equ_span = 4 # '=' in enum definition # align_nl_cont = TRUE # align_var_def_span = 2 # align_var_def_inline = TRUE # align_var_def_star = FALSE # align_var_def_colon = TRUE # align_assign_span = 1 align_struct_init_span = 3 # align stuff in a structure init '= { }' align_right_cmt_span = 3 # align_pp_define_span = 8; # align_pp_define_gap = 4; # cmt_star_cont = FALSE # indent_brace = 0 uncrustify-0.59/documentation/htdocs/config.txt0000644000175000017500000016065611604504552016766 00000000000000# Uncrustify 0.58 # # General options # newlines { Auto, LF, CR, CRLF } The type of line endings input_tab_size Number The original size of tabs in the input output_tab_size Number The size of tabs in the output (only used if align_with_tabs=true) string_escape_char Number The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn) string_escape_char2 Number Alternate string escape char for Pawn. Only works right before the quote char. tok_split_gte { False, True } Allow interpreting '>=' and '>>=' as part of a template in 'void f(list>=val);'. If true (default), 'assert(x<0 && y>=3)' will be broken. Improvements to template detection may make this option obsolete. # # Indenting # indent_columns Number The number of columns to indent per level. Usually 2, 3, 4, or 8. indent_continue Number The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents. For FreeBSD, this is set to 4. indent_with_tabs Number How to use tabs when indenting code 0=spaces only 1=indent with tabs to brace level, align with spaces 2=indent and align with tabs, using spaces when not on a tabstop indent_cmt_with_tabs { False, True } Comments that are not a brace level are indented with tabs on a tabstop. Requires indent_with_tabs=2. If false, will use spaces. indent_align_string { False, True } Whether to indent strings broken by '\' so that they line up indent_xml_string Number The number of spaces to indent multi-line XML strings. Requires indent_align_string=True indent_brace Number Spaces to indent '{' from level indent_braces { False, True } Whether braces are indented to the body level indent_braces_no_func { False, True } Disabled indenting function braces if indent_braces is true indent_braces_no_class { False, True } Disabled indenting class braces if indent_braces is true indent_braces_no_struct { False, True } Disabled indenting struct braces if indent_braces is true indent_brace_parent { False, True } Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc. indent_namespace { False, True } Whether the 'namespace' body is indented indent_namespace_level Number The number of spaces to indent a namespace block indent_namespace_limit Number If the body of the namespace is longer than this number, it won't be indented. Requires indent_namespace=true. Default=0 (no limit) indent_extern { False, True } Whether the 'extern "C"' body is indented indent_class { False, True } Whether the 'class' body is indented indent_class_colon { False, True } Whether to indent the stuff after a leading class colon indent_else_if { False, True } False=treat 'else\nif' as 'else if' for indenting purposes True=indent the 'if' one level indent_var_def_blk Number Amount to indent variable declarations after a open brace. neg=relative, pos=absolute indent_var_def_cont { False, True } Indent continued variable declarations instead of aligning. indent_func_call_param { False, True } True: indent continued function call parameters one indent level False: align parameters under the open paren indent_func_def_param { False, True } Same as indent_func_call_param, but for function defs indent_func_proto_param { False, True } Same as indent_func_call_param, but for function protos indent_func_class_param { False, True } Same as indent_func_call_param, but for class declarations indent_func_ctor_var_param { False, True } Same as indent_func_call_param, but for class variable constructors indent_template_param { False, True } Same as indent_func_call_param, but for templates indent_func_param_double { False, True } Double the indent for indent_func_xxx_param options indent_func_const Number Indentation column for standalone 'const' function decl/proto qualifier indent_func_throw Number Indentation column for standalone 'throw' function decl/proto qualifier indent_member Number The number of spaces to indent a continued '->' or '.' Usually set to 0, 1, or indent_columns. indent_sing_line_comments Number Spaces to indent single line ('//') comments on lines before code indent_relative_single_line_comments { False, True } If set, will indent trailing single line ('//') comments relative to the code instead of trying to keep the same absolute column indent_switch_case Number Spaces to indent 'case' from 'switch' Usually 0 or indent_columns. indent_case_shift Number Spaces to shift the 'case' line, without affecting any other lines Usually 0. indent_case_brace Number Spaces to indent '{' from 'case'. By default, the brace will appear under the 'c' in case. Usually set to 0 or indent_columns. indent_col1_comment { False, True } Whether to indent comments found in first column indent_label Number How to indent goto labels >0 : absolute column where 1 is the leftmost column <=0 : subtract from brace indent indent_access_spec Number Same as indent_label, but for access specifiers that are followed by a colon indent_access_spec_body { False, True } Indent the code after an access specifier by one level. If set, this option forces 'indent_access_spec=0' indent_paren_nl { False, True } If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended) indent_paren_close Number Controls the indent of a close paren after a newline. 0: Indent to body level 1: Align under the open paren 2: Indent to the brace level indent_comma_paren { False, True } Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren indent_bool_paren { False, True } Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren indent_first_bool_expr { False, True } If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones indent_square_nl { False, True } If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended) indent_preserve_sql { False, True } Don't change the relative indent of ESQL/C 'EXEC SQL' bodies indent_align_assign { False, True } Align continued statements at the '='. Default=True If FALSE or the '=' is followed by a newline, the next line is indent one tab. # # Spacing options # sp_arith { Ignore, Add, Remove, Force } Add or remove space around arithmetic operator '+', '-', '/', '*', etc sp_assign { Ignore, Add, Remove, Force } Add or remove space around assignment operator '=', '+=', etc sp_assign_default { Ignore, Add, Remove, Force } Add or remove space around assignment operator '=' in a prototype sp_before_assign { Ignore, Add, Remove, Force } Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign. sp_after_assign { Ignore, Add, Remove, Force } Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign. sp_enum_assign { Ignore, Add, Remove, Force } Add or remove space around assignment '=' in enum sp_enum_before_assign { Ignore, Add, Remove, Force } Add or remove space before assignment '=' in enum. Overrides sp_enum_assign. sp_enum_after_assign { Ignore, Add, Remove, Force } Add or remove space after assignment '=' in enum. Overrides sp_enum_assign. sp_pp_concat { Ignore, Add, Remove, Force } Add or remove space around preprocessor '##' concatenation operator. Default=Add sp_pp_stringify { Ignore, Add, Remove, Force } Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add sp_bool { Ignore, Add, Remove, Force } Add or remove space around boolean operators '&&' and '||' sp_compare { Ignore, Add, Remove, Force } Add or remove space around compare operator '<', '>', '==', etc sp_inside_paren { Ignore, Add, Remove, Force } Add or remove space inside '(' and ')' sp_paren_paren { Ignore, Add, Remove, Force } Add or remove space between nested parens sp_balance_nested_parens { False, True } Whether to balance spaces inside nested parens sp_paren_brace { Ignore, Add, Remove, Force } Add or remove space between ')' and '{' sp_before_ptr_star { Ignore, Add, Remove, Force } Add or remove space before pointer star '*' sp_before_unnamed_ptr_star { Ignore, Add, Remove, Force } Add or remove space before pointer star '*' that isn't followed by a variable name If set to 'ignore', sp_before_ptr_star is used instead. sp_between_ptr_star { Ignore, Add, Remove, Force } Add or remove space between pointer stars '*' sp_after_ptr_star { Ignore, Add, Remove, Force } Add or remove space after pointer star '*', if followed by a word. sp_after_ptr_star_func { Ignore, Add, Remove, Force } Add or remove space after a pointer star '*', if followed by a func proto/def. sp_before_ptr_star_func { Ignore, Add, Remove, Force } Add or remove space before a pointer star '*', if followed by a func proto/def. sp_before_byref { Ignore, Add, Remove, Force } Add or remove space before a reference sign '&' sp_before_unnamed_byref { Ignore, Add, Remove, Force } Add or remove space before a reference sign '&' that isn't followed by a variable name If set to 'ignore', sp_before_byref is used instead. sp_after_byref { Ignore, Add, Remove, Force } Add or remove space after reference sign '&', if followed by a word. sp_after_byref_func { Ignore, Add, Remove, Force } Add or remove space after a reference sign '&', if followed by a func proto/def. sp_before_byref_func { Ignore, Add, Remove, Force } Add or remove space before a reference sign '&', if followed by a func proto/def. sp_after_type { Ignore, Add, Remove, Force } Add or remove space between type and word. Default=Force sp_template_angle { Ignore, Add, Remove, Force } Add or remove space in 'template <' vs 'template<'. If set to ignore, sp_before_angle is used. sp_before_angle { Ignore, Add, Remove, Force } Add or remove space before '<>' sp_inside_angle { Ignore, Add, Remove, Force } Add or remove space inside '<' and '>' sp_after_angle { Ignore, Add, Remove, Force } Add or remove space after '<>' sp_angle_paren { Ignore, Add, Remove, Force } Add or remove space between '<>' and '(' as found in 'new List();' sp_angle_word { Ignore, Add, Remove, Force } Add or remove space between '<>' and a word as in 'List m;' sp_angle_shift { Ignore, Add, Remove, Force } Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add sp_before_sparen { Ignore, Add, Remove, Force } Add or remove space before '(' of 'if', 'for', 'switch', and 'while' sp_inside_sparen { Ignore, Add, Remove, Force } Add or remove space inside if-condition '(' and ')' sp_inside_sparen_close { Ignore, Add, Remove, Force } Add or remove space before if-condition ')'. Overrides sp_inside_sparen. sp_after_sparen { Ignore, Add, Remove, Force } Add or remove space after ')' of 'if', 'for', 'switch', and 'while' sp_sparen_brace { Ignore, Add, Remove, Force } Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while' sp_invariant_paren { Ignore, Add, Remove, Force } Add or remove space between 'invariant' and '(' in the D language. sp_after_invariant_paren { Ignore, Add, Remove, Force } Add or remove space after the ')' in 'invariant (C) c' in the D language. sp_special_semi { Ignore, Add, Remove, Force } Add or remove space before empty statement ';' on 'if', 'for' and 'while' sp_before_semi { Ignore, Add, Remove, Force } Add or remove space before ';'. Default=Remove sp_before_semi_for { Ignore, Add, Remove, Force } Add or remove space before ';' in non-empty 'for' statements sp_before_semi_for_empty { Ignore, Add, Remove, Force } Add or remove space before a semicolon of an empty part of a for statement. sp_after_semi { Ignore, Add, Remove, Force } Add or remove space after ';', except when followed by a comment. Default=Add sp_after_semi_for { Ignore, Add, Remove, Force } Add or remove space after ';' in non-empty 'for' statements. Default=Force sp_after_semi_for_empty { Ignore, Add, Remove, Force } Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; ). sp_before_square { Ignore, Add, Remove, Force } Add or remove space before '[' (except '[]') sp_before_squares { Ignore, Add, Remove, Force } Add or remove space before '[]' sp_inside_square { Ignore, Add, Remove, Force } Add or remove space inside a non-empty '[' and ']' sp_after_comma { Ignore, Add, Remove, Force } Add or remove space after ',' sp_before_comma { Ignore, Add, Remove, Force } Add or remove space before ',' sp_paren_comma { Ignore, Add, Remove, Force } Add or remove space between an open paren and comma: '(,' vs '( ,' sp_before_ellipsis { Ignore, Add, Remove, Force } Add or remove space before the variadic '...' when preceded by a non-punctuator sp_after_class_colon { Ignore, Add, Remove, Force } Add or remove space after class ':' sp_before_class_colon { Ignore, Add, Remove, Force } Add or remove space before class ':' sp_before_case_colon { Ignore, Add, Remove, Force } Add or remove space before case ':'. Default=Remove sp_after_operator { Ignore, Add, Remove, Force } Add or remove space between 'operator' and operator sign sp_after_operator_sym { Ignore, Add, Remove, Force } Add or remove space between the operator symbol and the open paren, as in 'operator ++(' sp_after_cast { Ignore, Add, Remove, Force } Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a' sp_inside_paren_cast { Ignore, Add, Remove, Force } Add or remove spaces inside cast parens sp_cpp_cast_paren { Ignore, Add, Remove, Force } Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)' sp_sizeof_paren { Ignore, Add, Remove, Force } Add or remove space between 'sizeof' and '(' sp_after_tag { Ignore, Add, Remove, Force } Add or remove space after the tag keyword (Pawn) sp_inside_braces_enum { Ignore, Add, Remove, Force } Add or remove space inside enum '{' and '}' sp_inside_braces_struct { Ignore, Add, Remove, Force } Add or remove space inside struct/union '{' and '}' sp_inside_braces { Ignore, Add, Remove, Force } Add or remove space inside '{' and '}' sp_inside_braces_empty { Ignore, Add, Remove, Force } Add or remove space inside '{}' sp_type_func { Ignore, Add, Remove, Force } Add or remove space between return type and function name A minimum of 1 is forced except for pointer return types. sp_func_proto_paren { Ignore, Add, Remove, Force } Add or remove space between function name and '(' on function declaration sp_func_def_paren { Ignore, Add, Remove, Force } Add or remove space between function name and '(' on function definition sp_inside_fparens { Ignore, Add, Remove, Force } Add or remove space inside empty function '()' sp_inside_fparen { Ignore, Add, Remove, Force } Add or remove space inside function '(' and ')' sp_square_fparen { Ignore, Add, Remove, Force } Add or remove space between ']' and '(' when part of a function call. sp_fparen_brace { Ignore, Add, Remove, Force } Add or remove space between ')' and '{' of function sp_func_call_paren { Ignore, Add, Remove, Force } Add or remove space between function name and '(' on function calls sp_func_call_paren_empty { Ignore, Add, Remove, Force } Add or remove space between function name and '()' on function calls without parameters. If set to 'ignore' (the default), sp_func_call_paren is used. sp_func_call_user_paren { Ignore, Add, Remove, Force } Add or remove space between the user function name and '(' on function calls You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file. sp_func_class_paren { Ignore, Add, Remove, Force } Add or remove space between a constructor/destructor and the open paren sp_return_paren { Ignore, Add, Remove, Force } Add or remove space between 'return' and '(' sp_attribute_paren { Ignore, Add, Remove, Force } Add or remove space between '__attribute__' and '(' sp_defined_paren { Ignore, Add, Remove, Force } Add or remove space between 'defined' and '(' in '#if defined (FOO)' sp_throw_paren { Ignore, Add, Remove, Force } Add or remove space between 'throw' and '(' in 'throw (something)' sp_catch_paren { Ignore, Add, Remove, Force } Add or remove space between 'catch' and '(' in 'catch (something) { }' If set to ignore, sp_before_sparen is used. sp_version_paren { Ignore, Add, Remove, Force } Add or remove space between 'version' and '(' in 'version (something) { }' (D language) If set to ignore, sp_before_sparen is used. sp_scope_paren { Ignore, Add, Remove, Force } Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language) If set to ignore, sp_before_sparen is used. sp_macro { Ignore, Add, Remove, Force } Add or remove space between macro and value sp_macro_func { Ignore, Add, Remove, Force } Add or remove space between macro function ')' and value sp_else_brace { Ignore, Add, Remove, Force } Add or remove space between 'else' and '{' if on the same line sp_brace_else { Ignore, Add, Remove, Force } Add or remove space between '}' and 'else' if on the same line sp_brace_typedef { Ignore, Add, Remove, Force } Add or remove space between '}' and the name of a typedef on the same line sp_catch_brace { Ignore, Add, Remove, Force } Add or remove space between 'catch' and '{' if on the same line sp_brace_catch { Ignore, Add, Remove, Force } Add or remove space between '}' and 'catch' if on the same line sp_finally_brace { Ignore, Add, Remove, Force } Add or remove space between 'finally' and '{' if on the same line sp_brace_finally { Ignore, Add, Remove, Force } Add or remove space between '}' and 'finally' if on the same line sp_try_brace { Ignore, Add, Remove, Force } Add or remove space between 'try' and '{' if on the same line sp_getset_brace { Ignore, Add, Remove, Force } Add or remove space between get/set and '{' if on the same line sp_before_dc { Ignore, Add, Remove, Force } Add or remove space before the '::' operator sp_after_dc { Ignore, Add, Remove, Force } Add or remove space after the '::' operator sp_d_array_colon { Ignore, Add, Remove, Force } Add or remove around the D named array initializer ':' operator sp_not { Ignore, Add, Remove, Force } Add or remove space after the '!' (not) operator. Default=Remove sp_inv { Ignore, Add, Remove, Force } Add or remove space after the '~' (invert) operator. Default=Remove sp_addr { Ignore, Add, Remove, Force } Add or remove space after the '&' (address-of) operator. Default=Remove This does not affect the spacing after a '&' that is part of a type. sp_member { Ignore, Add, Remove, Force } Add or remove space around the '.' or '->' operators. Default=Remove sp_deref { Ignore, Add, Remove, Force } Add or remove space after the '*' (dereference) operator. Default=Remove This does not affect the spacing after a '*' that is part of a type. sp_sign { Ignore, Add, Remove, Force } Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove sp_incdec { Ignore, Add, Remove, Force } Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove sp_before_nl_cont { Ignore, Add, Remove, Force } Add or remove space before a backslash-newline at the end of a line. Default=Add sp_after_oc_scope { Ignore, Add, Remove, Force } Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;' sp_after_oc_colon { Ignore, Add, Remove, Force } Add or remove space after the colon in message specs '-(int) f:(int) x;' vs '-(int) f: (int) x;' sp_before_oc_colon { Ignore, Add, Remove, Force } Add or remove space before the colon in message specs '-(int) f: (int) x;' vs '-(int) f : (int) x;' sp_after_send_oc_colon { Ignore, Add, Remove, Force } Add or remove space after the colon in message specs '[object setValue:1];' vs '[object setValue: 1];' sp_before_send_oc_colon { Ignore, Add, Remove, Force } Add or remove space before the colon in message specs '[object setValue:1];' vs '[object setValue :1];' sp_after_oc_type { Ignore, Add, Remove, Force } Add or remove space after the (type) in message specs '-(int)f: (int) x;' vs '-(int)f: (int)x;' sp_after_oc_return_type { Ignore, Add, Remove, Force } Add or remove space after the first (type) in message specs '-(int) f:(int)x;' vs '-(int)f:(int)x;' sp_after_oc_at_sel { Ignore, Add, Remove, Force } Add or remove space between '@selector' and '(' '@selector(msgName)' vs '@selector (msgName)' Also applies to @protocol() constructs sp_after_oc_at_sel_parens { Ignore, Add, Remove, Force } Add or remove space between '@selector(x)' and the following word '@selector(foo) a:' vs '@selector(foo)a:' sp_inside_oc_at_sel_parens { Ignore, Add, Remove, Force } Add or remove space inside '@selector' parens '@selector(foo)' vs '@selector( foo )' Also applies to @protocol() constructs sp_before_oc_block_caret { Ignore, Add, Remove, Force } Add or remove space before a block pointer caret '^int (int arg){...}' vs. ' ^int (int arg){...}' sp_after_oc_block_caret { Ignore, Add, Remove, Force } Add or remove space after a block pointer caret '^int (int arg){...}' vs. '^ int (int arg){...}' sp_cond_colon { Ignore, Add, Remove, Force } Add or remove space around the ':' in 'b ? t : f' sp_cond_question { Ignore, Add, Remove, Force } Add or remove space around the '?' in 'b ? t : f' sp_case_label { Ignore, Add, Remove, Force } Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here. sp_range { Ignore, Add, Remove, Force } Control the space around the D '..' operator. sp_cmt_cpp_start { Ignore, Add, Remove, Force } Control the space after the opening of a C++ comment '// A' vs '//A' sp_endif_cmt { Ignore, Add, Remove, Force } Controls the spaces between #else or #endif and a trailing comment # # Code alignment (not left column spaces/tabs) # align_keep_tabs { False, True } Whether to keep non-indenting tabs align_with_tabs { False, True } Whether to use tabs for aligning align_on_tabstop { False, True } Whether to bump out to the next tab when aligning align_number_left { False, True } Whether to left-align numbers align_func_params { False, True } Align variable definitions in prototypes and functions align_same_func_call_params { False, True } Align parameters in single-line functions that have the same name. The function names must already be aligned with each other. align_var_def_span Number The span for aligning variable definitions (0=don't align) align_var_def_star_style Number How to align the star in variable definitions. 0=Part of the type 'void * foo;' 1=Part of the variable 'void *foo;' 2=Dangling 'void *foo;' align_var_def_amp_style Number How to align the '&' in variable definitions. 0=Part of the type 1=Part of the variable 2=Dangling align_var_def_thresh Number The threshold for aligning variable definitions (0=no limit) align_var_def_gap Number The gap for aligning variable definitions align_var_def_colon { False, True } Whether to align the colon in struct bit fields align_var_def_attribute { False, True } Whether to align any attribute after the variable name align_var_def_inline { False, True } Whether to align inline struct/enum/union variable definitions align_assign_span Number The span for aligning on '=' in assignments (0=don't align) align_assign_thresh Number The threshold for aligning on '=' in assignments (0=no limit) align_enum_equ_span Number The span for aligning on '=' in enums (0=don't align) align_enum_equ_thresh Number The threshold for aligning on '=' in enums (0=no limit) align_var_struct_span Number The span for aligning struct/union (0=don't align) align_var_struct_thresh Number The threshold for aligning struct/union member definitions (0=no limit) align_var_struct_gap Number The gap for aligning struct/union member definitions align_struct_init_span Number The span for aligning struct initializer values (0=don't align) align_typedef_gap Number The minimum space between the type and the synonym of a typedef align_typedef_span Number The span for aligning single-line typedefs (0=don't align) align_typedef_func Number How to align typedef'd functions with other typedefs 0: Don't mix them at all 1: align the open paren with the types 2: align the function type name with the other type names align_typedef_star_style Number Controls the positioning of the '*' in typedefs. Just try it. 0: Align on typedef type, ignore '*' 1: The '*' is part of type name: typedef int *pint; 2: The '*' is part of the type, but dangling: typedef int *pint; align_typedef_amp_style Number Controls the positioning of the '&' in typedefs. Just try it. 0: Align on typedef type, ignore '&' 1: The '&' is part of type name: typedef int &pint; 2: The '&' is part of the type, but dangling: typedef int &pint; align_right_cmt_span Number The span for aligning comments that end lines (0=don't align) align_right_cmt_mix { False, True } If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment align_right_cmt_gap Number If a trailing comment is more than this number of columns away from the text it follows, it will qualify for being aligned. This has to be > 0 to do anything. align_right_cmt_at_col Number Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore) align_func_proto_span Number The span for aligning function prototypes (0=don't align) align_func_proto_gap Number Minimum gap between the return type and the function name. align_on_operator { False, True } Align function protos on the 'operator' keyword instead of what follows align_mix_var_proto { False, True } Whether to mix aligning prototype and variable declarations. If true, align_var_def_XXX options are used instead of align_func_proto_XXX options. align_single_line_func { False, True } Align single-line functions with function prototypes, uses align_func_proto_span align_single_line_brace { False, True } Aligning the open brace of single-line functions. Requires align_single_line_func=true, uses align_func_proto_span align_single_line_brace_gap Number Gap for align_single_line_brace. align_oc_msg_spec_span Number The span for aligning ObjC msg spec (0=don't align) align_nl_cont { False, True } Whether to align macros wrapped with a backslash and a newline. This will not work right if the macro contains a multi-line comment. align_pp_define_gap Number The minimum space between label and value of a preprocessor define align_pp_define_span Number The span for aligning on '#define' bodies (0=don't align) align_left_shift { False, True } Align lines that start with '<<' with previous '<<'. Default=true align_oc_msg_colon_span Number Span for aligning parameters in an Obj-C message call on the ':' (0=don't align) align_oc_decl_colon { False, True } Aligning parameters in an Obj-C '+' or '-' declaration on the ':' # # Newline adding and removing options # nl_collapse_empty_body { False, True } Whether to collapse empty blocks between '{' and '}' nl_assign_leave_one_liners { False, True } Don't split one-line braced assignments - 'foo_t f = { 1, 2 };' nl_class_leave_one_liners { False, True } Don't split one-line braced statements inside a class xx { } body nl_enum_leave_one_liners { False, True } Don't split one-line enums: 'enum foo { BAR = 15 };' nl_getset_leave_one_liners { False, True } Don't split one-line get or set functions nl_func_leave_one_liners { False, True } Don't split one-line function definitions - 'int foo() { return 0; }' nl_if_leave_one_liners { False, True } Don't split one-line if/else statements - 'if(a) b++;' nl_start_of_file { Ignore, Add, Remove, Force } Add or remove newlines at the start of the file nl_start_of_file_min Number The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force' nl_end_of_file { Ignore, Add, Remove, Force } Add or remove newline at the end of the file nl_end_of_file_min Number The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force') nl_assign_brace { Ignore, Add, Remove, Force } Add or remove newline between '=' and '{' nl_assign_square { Ignore, Add, Remove, Force } Add or remove newline between '=' and '[' (D only) nl_after_square_assign { Ignore, Add, Remove, Force } Add or remove newline after '= [' (D only). Will also affect the newline before the ']' nl_func_var_def_blk Number The number of blank lines after a block of variable definitions nl_fcall_brace { Ignore, Add, Remove, Force } Add or remove newline between a function call's ')' and '{', as in: list_for_each(item, &list) { } nl_enum_brace { Ignore, Add, Remove, Force } Add or remove newline between 'enum' and '{' nl_struct_brace { Ignore, Add, Remove, Force } Add or remove newline between 'struct and '{' nl_union_brace { Ignore, Add, Remove, Force } Add or remove newline between 'union' and '{' nl_if_brace { Ignore, Add, Remove, Force } Add or remove newline between 'if' and '{' nl_brace_else { Ignore, Add, Remove, Force } Add or remove newline between '}' and 'else' nl_elseif_brace { Ignore, Add, Remove, Force } Add or remove newline between 'else if' and '{' If set to ignore, nl_if_brace is used instead nl_else_brace { Ignore, Add, Remove, Force } Add or remove newline between 'else' and '{' nl_else_if { Ignore, Add, Remove, Force } Add or remove newline between 'else' and 'if' nl_brace_finally { Ignore, Add, Remove, Force } Add or remove newline between '}' and 'finally' nl_finally_brace { Ignore, Add, Remove, Force } Add or remove newline between 'finally' and '{' nl_try_brace { Ignore, Add, Remove, Force } Add or remove newline between 'try' and '{' nl_getset_brace { Ignore, Add, Remove, Force } Add or remove newline between get/set and '{' nl_for_brace { Ignore, Add, Remove, Force } Add or remove newline between 'for' and '{' nl_catch_brace { Ignore, Add, Remove, Force } Add or remove newline between 'catch' and '{' nl_brace_catch { Ignore, Add, Remove, Force } Add or remove newline between '}' and 'catch' nl_while_brace { Ignore, Add, Remove, Force } Add or remove newline between 'while' and '{' nl_using_brace { Ignore, Add, Remove, Force } Add or remove newline between 'using' and '{' nl_brace_brace { Ignore, Add, Remove, Force } Add or remove newline between two open or close braces. Due to general newline/brace handling, REMOVE may not work. nl_do_brace { Ignore, Add, Remove, Force } Add or remove newline between 'do' and '{' nl_brace_while { Ignore, Add, Remove, Force } Add or remove newline between '}' and 'while' of 'do' statement nl_switch_brace { Ignore, Add, Remove, Force } Add or remove newline between 'switch' and '{' nl_multi_line_cond { False, True } Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc. Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace. nl_multi_line_define { False, True } Force a newline in a define after the macro name for multi-line defines. nl_before_case { False, True } Whether to put a newline before 'case' statement nl_before_throw { Ignore, Add, Remove, Force } Add or remove newline between ')' and 'throw' nl_after_case { False, True } Whether to put a newline after 'case' statement nl_namespace_brace { Ignore, Add, Remove, Force } Newline between namespace and { nl_template_class { Ignore, Add, Remove, Force } Add or remove newline between 'template<>' and whatever follows. nl_class_brace { Ignore, Add, Remove, Force } Add or remove newline between 'class' and '{' nl_class_init_args { Ignore, Add, Remove, Force } Add or remove newline after each ',' in the constructor member initialization nl_func_type_name { Ignore, Add, Remove, Force } Add or remove newline between return type and function name in a function definition nl_func_type_name_class { Ignore, Add, Remove, Force } Add or remove newline between return type and function name inside a class {} Uses nl_func_type_name or nl_func_proto_type_name if set to ignore. nl_func_scope_name { Ignore, Add, Remove, Force } Add or remove newline between function scope and name in a definition Controls the newline after '::' in 'void A::f() { }' nl_func_proto_type_name { Ignore, Add, Remove, Force } Add or remove newline between return type and function name in a prototype nl_func_paren { Ignore, Add, Remove, Force } Add or remove newline between a function name and the opening '(' nl_func_def_paren { Ignore, Add, Remove, Force } Add or remove newline between a function name and the opening '(' in the definition nl_func_decl_start { Ignore, Add, Remove, Force } Add or remove newline after '(' in a function declaration nl_func_def_start { Ignore, Add, Remove, Force } Add or remove newline after '(' in a function definition nl_func_decl_start_single { Ignore, Add, Remove, Force } Overrides nl_func_decl_start when there is only one parameter. nl_func_def_start_single { Ignore, Add, Remove, Force } Overrides nl_func_def_start when there is only one parameter. nl_func_decl_args { Ignore, Add, Remove, Force } Add or remove newline after each ',' in a function declaration nl_func_def_args { Ignore, Add, Remove, Force } Add or remove newline after each ',' in a function definition nl_func_decl_end { Ignore, Add, Remove, Force } Add or remove newline before the ')' in a function declaration nl_func_def_end { Ignore, Add, Remove, Force } Add or remove newline before the ')' in a function definition nl_func_decl_end_single { Ignore, Add, Remove, Force } Overrides nl_func_decl_end when there is only one parameter. nl_func_def_end_single { Ignore, Add, Remove, Force } Overrides nl_func_def_end when there is only one parameter. nl_func_decl_empty { Ignore, Add, Remove, Force } Add or remove newline between '()' in a function declaration. nl_func_def_empty { Ignore, Add, Remove, Force } Add or remove newline between '()' in a function definition. nl_fdef_brace { Ignore, Add, Remove, Force } Add or remove newline between function signature and '{' nl_after_return { False, True } Whether to put a newline after 'return' statement nl_return_expr { Ignore, Add, Remove, Force } Add or remove a newline between the return keyword and return expression. nl_after_semicolon { False, True } Whether to put a newline after semicolons, except in 'for' statements nl_after_brace_open { False, True } Whether to put a newline after brace open. This also adds a newline before the matching brace close. nl_after_brace_open_cmt { False, True } If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is placed between the open brace and a trailing single-line comment. nl_after_vbrace_open { False, True } Whether to put a newline after a virtual brace open with a non-empty body. These occur in un-braced if/while/do/for statement bodies. nl_after_vbrace_open_empty { False, True } Whether to put a newline after a virtual brace open with an empty body. These occur in un-braced if/while/do/for statement bodies. nl_after_brace_close { False, True } Whether to put a newline after a brace close. Does not apply if followed by a necessary ';'. nl_after_vbrace_close { False, True } Whether to put a newline after a virtual brace close. Would add a newline before return in: 'if (foo) a++; return;' nl_define_macro { False, True } Whether to alter newlines in '#define' macros nl_squeeze_ifdef { False, True } Whether to not put blanks after '#ifxx', '#elxx', or before '#endif' nl_before_if { Ignore, Add, Remove, Force } Add or remove blank line before 'if' nl_after_if { Ignore, Add, Remove, Force } Add or remove blank line after 'if' statement nl_before_for { Ignore, Add, Remove, Force } Add or remove blank line before 'for' nl_after_for { Ignore, Add, Remove, Force } Add or remove blank line after 'for' statement nl_before_while { Ignore, Add, Remove, Force } Add or remove blank line before 'while' nl_after_while { Ignore, Add, Remove, Force } Add or remove blank line after 'while' statement nl_before_switch { Ignore, Add, Remove, Force } Add or remove blank line before 'switch' nl_after_switch { Ignore, Add, Remove, Force } Add or remove blank line after 'switch' statement nl_before_do { Ignore, Add, Remove, Force } Add or remove blank line before 'do' nl_after_do { Ignore, Add, Remove, Force } Add or remove blank line after 'do/while' statement nl_ds_struct_enum_cmt { False, True } Whether to double-space commented-entries in struct/enum nl_ds_struct_enum_close_brace { False, True } Whether to double-space before the close brace of a struct/union/enum (lower priority than 'eat_blanks_before_close_brace') nl_class_colon { Ignore, Add, Remove, Force } Add or remove a newline around a class colon. Related to pos_class_colon, nl_class_init_args, and pos_comma. nl_create_if_one_liner { False, True } Change simple unbraced if statements into a one-liner 'if(b)\n i++;' => 'if(b) i++;' nl_create_for_one_liner { False, True } Change simple unbraced for statements into a one-liner 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);' nl_create_while_one_liner { False, True } Change simple unbraced while statements into a one-liner 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);' # # Positioning options # pos_arith { Ignore, Lead, Trail } The position of arithmetic operators in wrapped expressions pos_assign { Ignore, Lead, Trail } The position of assignment in wrapped expressions. Do not affect '=' followed by '{' pos_bool { Ignore, Lead, Trail } The position of boolean operators in wrapped expressions pos_compare { Ignore, Lead, Trail } The position of comparison operators in wrapped expressions pos_conditional { Ignore, Lead, Trail } The position of conditional (b ? t : f) operators in wrapped expressions pos_comma { Ignore, Lead, Trail } The position of the comma in wrapped expressions pos_class_comma { Ignore, Lead, Trail } The position of the comma in the constructor initialization list pos_class_colon { Ignore, Lead, Trail } The position of colons between constructor and member initialization # # Line Splitting options # code_width Number Try to limit code width to N number of columns ls_for_split_full { False, True } Whether to fully split long 'for' statements at semi-colons ls_func_split_full { False, True } Whether to fully split long function protos/calls at commas # # Blank line options # nl_max Number The maximum consecutive newlines nl_after_func_proto Number The number of newlines after a function prototype, if followed by another function prototype nl_after_func_proto_group Number The number of newlines after a function prototype, if not followed by another function prototype nl_after_func_body Number The number of newlines after '}' of a multi-line function body nl_after_func_body_one_liner Number The number of newlines after '}' of a single line function body nl_before_block_comment Number The minimum number of newlines before a multi-line comment. Doesn't apply if after a brace open or another multi-line comment. nl_before_c_comment Number The minimum number of newlines before a single-line C comment. Doesn't apply if after a brace open or other single-line C comments. nl_before_cpp_comment Number The minimum number of newlines before a CPP comment. Doesn't apply if after a brace open or other CPP comments. nl_after_multiline_comment { False, True } Whether to force a newline after a multi-line comment. nl_before_access_spec Number The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. Will not change the newline count if after a brace open. 0 = No change. nl_after_access_spec Number The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label. 0 = No change. nl_comment_func_def Number The number of newlines between a function def and the function comment. 0 = No change. nl_after_try_catch_finally Number The number of newlines after a try-catch-finally block that isn't followed by a brace close. 0 = No change. nl_around_cs_property Number The number of newlines before and after a property, indexer or event decl. 0 = No change. nl_between_get_set Number The number of newlines between the get/set/add/remove handlers in C#. 0 = No change. eat_blanks_after_open_brace { False, True } Whether to remove blank lines after '{' eat_blanks_before_close_brace { False, True } Whether to remove blank lines before '}' # # Code modifying options (non-whitespace) # mod_full_brace_do { Ignore, Add, Remove, Force } Add or remove braces on single-line 'do' statement mod_full_brace_for { Ignore, Add, Remove, Force } Add or remove braces on single-line 'for' statement mod_full_brace_function { Ignore, Add, Remove, Force } Add or remove braces on single-line function definitions. (Pawn) mod_full_brace_if { Ignore, Add, Remove, Force } Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'. mod_full_brace_if_chain { False, True } Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if. If any must be braced, they are all braced. If all can be unbraced, then the braces are removed. mod_full_brace_nl Number Don't remove braces around statements that span N newlines mod_full_brace_while { Ignore, Add, Remove, Force } Add or remove braces on single-line 'while' statement mod_full_brace_using { Ignore, Add, Remove, Force } Add or remove braces on single-line 'using ()' statement mod_paren_on_return { Ignore, Add, Remove, Force } Add or remove unnecessary paren on 'return' statement mod_pawn_semicolon { False, True } Whether to change optional semicolons to real semicolons mod_full_paren_if_bool { False, True } Add parens on 'while' and 'if' statement around bools mod_remove_extra_semicolon { False, True } Whether to remove superfluous semicolons mod_add_long_function_closebrace_comment Number If a function body exceeds the specified number of newlines and doesn't have a comment after the close brace, a comment will be added. mod_add_long_switch_closebrace_comment Number If a switch body exceeds the specified number of newlines and doesn't have a comment after the close brace, a comment will be added. mod_add_long_ifdef_endif_comment Number If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after the #endif, a comment will be added. mod_add_long_ifdef_else_comment Number If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after the #else, a comment will be added. mod_sort_import { False, True } If TRUE, will sort consecutive single-line 'import' statements [Java, D] mod_sort_using { False, True } If TRUE, will sort consecutive single-line 'using' statements [C#] mod_sort_include { False, True } If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C] This is generally a bad idea, as it may break your code. mod_move_case_break { False, True } If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace. mod_case_brace { Ignore, Add, Remove, Force } Will add or remove the braces around a fully braced case statement. Will only remove the braces if there are no variable declarations in the block. mod_remove_empty_return { False, True } If TRUE, it will remove a void 'return;' that appears as the last statement in a function. # # Comment modifications # cmt_width Number Try to wrap comments at cmt_width columns cmt_reflow_mode Number Set the comment reflow mode (default: 0) 0: no reflowing (apart from the line wrapping due to cmt_width) 1: no touching at all 2: full reflow cmt_indent_multi { False, True } If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars. Default is true. cmt_c_group { False, True } Whether to group c-comments that look like they are in a block cmt_c_nl_start { False, True } Whether to put an empty '/*' on the first line of the combined c-comment cmt_c_nl_end { False, True } Whether to put a newline before the closing '*/' of the combined c-comment cmt_cpp_group { False, True } Whether to group cpp-comments that look like they are in a block cmt_cpp_nl_start { False, True } Whether to put an empty '/*' on the first line of the combined cpp-comment cmt_cpp_nl_end { False, True } Whether to put a newline before the closing '*/' of the combined cpp-comment cmt_cpp_to_c { False, True } Whether to change cpp-comments into c-comments cmt_star_cont { False, True } Whether to put a star on subsequent comment lines cmt_sp_before_star_cont Number The number of spaces to insert at the start of subsequent comment lines cmt_sp_after_star_cont Number The number of spaces to insert after the star on subsequent comment lines cmt_multi_check_last { False, True } For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of the comment are the same length. Default=True cmt_insert_file_header String The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment. Will substitute $(filename) with the current file's name. cmt_insert_file_footer String The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment. Will substitute $(filename) with the current file's name. cmt_insert_func_header String The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment. Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff. Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... } cmt_insert_class_header String The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment. Will substitute $(class) with the class name. cmt_insert_oc_msg_header String The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment. Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff. cmt_insert_before_preproc { False, True } If a preprocessor is encountered when stepping backwards from a function name, then this option decides whether the comment should be inserted. Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header. # # Preprocessor options # pp_indent { Ignore, Add, Remove, Force } Control indent of preprocessors inside #if blocks at brace level 0 pp_indent_at_level { False, True } Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false) pp_indent_count Number If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1. pp_space { Ignore, Add, Remove, Force } Add or remove space after # based on pp_level of #if blocks pp_space_count Number Sets the number of spaces added with pp_space pp_indent_region Number The indent for #region and #endregion in C# and '#pragma region' in C/C++ pp_region_indent_code { False, True } Whether to indent the code between #region and #endregion pp_indent_if Number If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level pp_if_indent_code { False, True } Control whether to indent the code between #if, #else and #endif when not at file-level pp_define_at_level { False, True } Whether to indent '#define' at the brace level (true) or from column 1 (false) uncrustify-0.59/documentation/htdocs/examples/0000755000175000017500000000000011506773275016653 500000000000000uncrustify-0.59/documentation/htdocs/examples/c-1.out.c0000644000175000017500000007676511506773275020152 00000000000000/* i2c-core.c - a device driver for the iic-bus interface */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-99 Simon G. Vogl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kysti Mlkki . All SMBus-related things are written by Frodo Looijaard SMBus 2.0 support by Mark Studebaker */ #include #include #include #include #include #include #include #include #include static LIST_HEAD(adapters); static LIST_HEAD(drivers); static DECLARE_MUTEX(core_lists); static DEFINE_IDR(i2c_adapter_idr); static int i2c_device_match(struct device *dev, struct device_driver *drv) { return 1; } static int i2c_bus_suspend(struct device *dev, pm_message_t state) { int rc = 0; if (dev->driver && dev->driver->suspend) rc = dev->driver->suspend(dev, state, 0); return rc; } static int i2c_bus_resume(struct device *dev) { int rc = 0; if (dev->driver && dev->driver->resume) rc = dev->driver->resume(dev, 0); return rc; } struct bus_type i2c_bus_type = { .name = "i2c", .match = i2c_device_match, .suspend = i2c_bus_suspend, .resume = i2c_bus_resume, }; static int i2c_device_probe(struct device *dev) { return -ENODEV; } static int i2c_device_remove(struct device *dev) { return 0; } void i2c_adapter_dev_release(struct device *dev) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); complete(&adap->dev_released); } struct device_driver i2c_adapter_driver = { .name = "i2c_adapter", .bus = &i2c_bus_type, .probe = i2c_device_probe, .remove = i2c_device_remove, }; static void i2c_adapter_class_dev_release(struct class_device *dev) { struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev); complete(&adap->class_dev_released); } struct class i2c_adapter_class = { .name = "i2c-adapter", .release = &i2c_adapter_class_dev_release, }; static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); return sprintf(buf, "%s\n", adap->name); } static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); static void i2c_client_release(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); complete(&client->released); } static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); return sprintf(buf, "%s\n", client->name); } /* * We can't use the DEVICE_ATTR() macro here as we want the same filename for a * different type of a device. So beware if the DEVICE_ATTR() macro ever * changes, this definition will also have to change. */ static struct device_attribute dev_attr_client_name = { .attr = { .name = "name", .mode = S_IRUGO, .owner = THIS_MODULE }, .show = &show_client_name, }; /* --------------------------------------------------- * registering functions * --------------------------------------------------- */ /* ----- * i2c_add_adapter is called from within the algorithm layer, * when a new hw adapter registers. A new device is register to be * available for clients. */ int i2c_add_adapter(struct i2c_adapter *adap) { int id, res = 0; struct list_head *item; struct i2c_driver *driver; down(&core_lists); if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) { res = -ENOMEM; goto out_unlock; } res = idr_get_new(&i2c_adapter_idr, adap, &id); if (res < 0) { if (res == -EAGAIN) res = -ENOMEM; goto out_unlock; } adap->nr = id & MAX_ID_MASK; init_MUTEX(&adap->bus_lock); init_MUTEX(&adap->clist_lock); list_add_tail(&adap->list, &adapters); INIT_LIST_HEAD(&adap->clients); /* Add the adapter to the driver core. * If the parent pointer is not set up, * we add this adapter to the host bus. */ if (adap->dev.parent == NULL) adap->dev.parent = &platform_bus; sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); adap->dev.driver = &i2c_adapter_driver; adap->dev.release = &i2c_adapter_dev_release; device_register(&adap->dev); device_create_file(&adap->dev, &dev_attr_name); /* Add this adapter to the i2c_adapter class */ memset(&adap->class_dev, 0x00, sizeof(struct class_device)); adap->class_dev.dev = &adap->dev; adap->class_dev.class = &i2c_adapter_class; strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE); class_device_register(&adap->class_dev); dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); /* inform drivers of new adapters */ list_for_each(item, &drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->flags & I2C_DF_NOTIFY) /* We ignore the return code; if it fails, too bad */ driver->attach_adapter(adap); } out_unlock: up(&core_lists); return res; } int i2c_del_adapter(struct i2c_adapter *adap) { struct list_head *item, *_n; struct i2c_adapter *adap_from_list; struct i2c_driver *driver; struct i2c_client *client; int res = 0; down(&core_lists); /* First make sure that this adapter was ever added */ list_for_each_entry(adap_from_list, &adapters, list) { if (adap_from_list == adap) break; } if (adap_from_list != adap) { pr_debug("i2c-core: attempting to delete unregistered " "adapter [%s]\n", adap->name); res = -EINVAL; goto out_unlock; } list_for_each(item, &drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->detach_adapter) if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } /* detach any active clients. This must be done first, because * it can fail; in which case we give up. */ list_for_each_safe(item, _n, &adap->clients) { client = list_entry(item, struct i2c_client, list); /* detaching devices is unconditional of the set notify * flag, as _all_ clients that reside on the adapter * must be deleted, as this would cause invalid states. */ if ((res = client->driver->detach_client(client))) { dev_err(&adap->dev, "detach_client failed for client " "[%s] at address 0x%02x\n", client->name, client->addr); goto out_unlock; } } /* clean up the sysfs representation */ init_completion(&adap->dev_released); init_completion(&adap->class_dev_released); class_device_unregister(&adap->class_dev); device_remove_file(&adap->dev, &dev_attr_name); device_unregister(&adap->dev); list_del(&adap->list); /* wait for sysfs to drop all references */ wait_for_completion(&adap->dev_released); wait_for_completion(&adap->class_dev_released); /* free dynamically allocated bus id */ idr_remove(&i2c_adapter_idr, adap->nr); dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); out_unlock: up(&core_lists); return res; } /* ----- * What follows is the "upwards" interface: commands for talking to clients, * which implement the functions to access the physical information of the * chips. */ int i2c_add_driver(struct i2c_driver *driver) { struct list_head *item; struct i2c_adapter *adapter; int res = 0; down(&core_lists); /* add the driver to the list of i2c drivers in the driver core */ driver->driver.name = driver->name; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_device_probe; driver->driver.remove = i2c_device_remove; res = driver_register(&driver->driver); if (res) goto out_unlock; list_add_tail(&driver->list, &drivers); pr_debug("i2c-core: driver [%s] registered\n", driver->name); /* now look for instances of driver on our adapters */ if (driver->flags & I2C_DF_NOTIFY) { list_for_each(item, &adapters) { adapter = list_entry(item, struct i2c_adapter, list); driver->attach_adapter(adapter); } } out_unlock: up(&core_lists); return res; } int i2c_del_driver(struct i2c_driver *driver) { struct list_head *item1, *item2, *_n; struct i2c_client *client; struct i2c_adapter *adap; int res = 0; down(&core_lists); /* Have a look at each adapter, if clients of this driver are still * attached. If so, detach them to be able to kill the driver * afterwards. * * Removing clients does not depend on the notify flag, else * invalid operation might (will!) result, when using stale client * pointers. */ list_for_each(item1, &adapters) { adap = list_entry(item1, struct i2c_adapter, list); if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } else { list_for_each_safe(item2, _n, &adap->clients) { client = list_entry(item2, struct i2c_client, list); if (client->driver != driver) continue; dev_dbg(&adap->dev, "detaching client [%s] " "at 0x%02x\n", client->name, client->addr); if ((res = driver->detach_client(client))) { dev_err(&adap->dev, "detach_client " "failed for client [%s] at " "0x%02x\n", client->name, client->addr); goto out_unlock; } } } } driver_unregister(&driver->driver); list_del(&driver->list); pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); out_unlock: up(&core_lists); return 0; } static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr) { struct list_head *item; struct i2c_client *client; list_for_each(item, &adapter->clients) { client = list_entry(item, struct i2c_client, list); if (client->addr == addr) return -EBUSY; } return 0; } int i2c_check_addr(struct i2c_adapter *adapter, int addr) { int rval; down(&adapter->clist_lock); rval = __i2c_check_addr(adapter, addr); up(&adapter->clist_lock); return rval; } int i2c_attach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; down(&adapter->clist_lock); if (__i2c_check_addr(client->adapter, client->addr)) { up(&adapter->clist_lock); return -EBUSY; } list_add_tail(&client->list, &adapter->clients); up(&adapter->clist_lock); if (adapter->client_register) { if (adapter->client_register(client)) { dev_dbg(&adapter->dev, "client_register " "failed for client [%s] at 0x%02x\n", client->name, client->addr); } } if (client->flags & I2C_CLIENT_ALLOW_USE) client->usage_count = 0; client->dev.parent = &client->adapter->dev; client->dev.driver = &client->driver->driver; client->dev.bus = &i2c_bus_type; client->dev.release = &i2c_client_release; snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), "%d-%04x", i2c_adapter_id(adapter), client->addr); dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", client->name, client->dev.bus_id); device_register(&client->dev); device_create_file(&client->dev, &dev_attr_client_name); return 0; } int i2c_detach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int res = 0; if ((client->flags & I2C_CLIENT_ALLOW_USE) && (client->usage_count > 0)) { dev_warn(&client->dev, "Client [%s] still busy, " "can't detach\n", client->name); return -EBUSY; } if (adapter->client_unregister) { res = adapter->client_unregister(client); if (res) { dev_err(&client->dev, "client_unregister [%s] failed, " "client not detached\n", client->name); goto out; } } down(&adapter->clist_lock); list_del(&client->list); init_completion(&client->released); device_remove_file(&client->dev, &dev_attr_client_name); device_unregister(&client->dev); up(&adapter->clist_lock); wait_for_completion(&client->released); out: return res; } static int i2c_inc_use_client(struct i2c_client *client) { if (!try_module_get(client->driver->owner)) return -ENODEV; if (!try_module_get(client->adapter->owner)) { module_put(client->driver->owner); return -ENODEV; } return 0; } static void i2c_dec_use_client(struct i2c_client *client) { module_put(client->driver->owner); module_put(client->adapter->owner); } int i2c_use_client(struct i2c_client *client) { int ret; ret = i2c_inc_use_client(client); if (ret) return ret; if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) client->usage_count++; else if (client->usage_count > 0) goto busy; else client->usage_count++; } return 0; busy: i2c_dec_use_client(client); return -EBUSY; } int i2c_release_client(struct i2c_client *client) { if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->usage_count > 0) client->usage_count--; else { pr_debug("i2c-core: %s used one too many times\n", __FUNCTION__); return -EPERM; } } i2c_dec_use_client(client); return 0; } void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) { struct list_head *item; struct i2c_client *client; down(&adap->clist_lock); list_for_each(item, &adap->clients) { client = list_entry(item, struct i2c_client, list); if (!try_module_get(client->driver->owner)) continue; if (NULL != client->driver->command) { up(&adap->clist_lock); client->driver->command(client, cmd, arg); down(&adap->clist_lock); } module_put(client->driver->owner); } up(&adap->clist_lock); } static int __init i2c_init(void) { int retval; retval = bus_register(&i2c_bus_type); if (retval) return retval; retval = driver_register(&i2c_adapter_driver); if (retval) return retval; return class_register(&i2c_adapter_class); } static void __exit i2c_exit(void) { class_unregister(&i2c_adapter_class); driver_unregister(&i2c_adapter_driver); bus_unregister(&i2c_bus_type); } subsys_initcall(i2c_init); module_exit(i2c_exit); /* ---------------------------------------------------- * the functional interface to the i2c busses. * ---------------------------------------------------- */ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { int ret; if (adap->algo->master_xfer) { #ifdef DEBUG for (ret = 0; ret < num; ret++) { dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, " "len=%d\n", ret, msgs[ret].flags & I2C_M_RD ? 'R' : 'W', msgs[ret].addr, msgs[ret].len); } #endif down(&adap->bus_lock); ret = adap->algo->master_xfer(adap, msgs, num); up(&adap->bus_lock); return ret; } else { dev_dbg(&adap->dev, "I2C level transfers not supported\n"); return -ENOSYS; } } int i2c_master_send(struct i2c_client *client, const char *buf, int count) { int ret; struct i2c_adapter *adap = client->adapter; struct i2c_msg msg; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.len = count; msg.buf = (char *)buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes transmitted, else error code. */ return (ret == 1) ? count : ret; } int i2c_master_recv(struct i2c_client *client, char *buf, int count) { struct i2c_adapter *adap = client->adapter; struct i2c_msg msg; int ret; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.flags |= I2C_M_RD; msg.len = count; msg.buf = buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes transmitted, else error code. */ return (ret == 1) ? count : ret; } int i2c_control(struct i2c_client *client, unsigned int cmd, unsigned long arg) { int ret = 0; struct i2c_adapter *adap = client->adapter; dev_dbg(&client->adapter->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg); switch (cmd) { case I2C_RETRIES: adap->retries = arg; break; case I2C_TIMEOUT: adap->timeout = arg; break; default: if (adap->algo->algo_control != NULL) ret = adap->algo->algo_control(adap, cmd, arg); } return ret; } /* ---------------------------------------------------- * the i2c address scanning function * Will not work for 10-bit addresses! * ---------------------------------------------------- */ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind, int (*found_proc)(struct i2c_adapter *, int, int)) { int err; /* Make sure the address is valid */ if (addr < 0x03 || addr > 0x77) { dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n", addr); return -EINVAL; } /* Skip if already in use */ if (i2c_check_addr(adapter, addr)) return 0; /* Make sure there is something at this address, unless forced */ if (kind < 0) { if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0) return 0; /* prevent 24RF08 corruption */ if ((addr & ~0x0f) == 0x50) i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL); } /* Finally call the custom detection function */ err = found_proc(adapter, addr, kind); /* -ENODEV can be returned if there is a chip at the given address but it isn't supported by this chip driver. We catch it here as this isn't an error. */ return (err == -ENODEV) ? 0 : err; } int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data, int (*found_proc)(struct i2c_adapter *, int, int)) { int i, err; int adap_id = i2c_adapter_id(adapter); /* Forget it if we can't probe using SMBUS_QUICK */ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_QUICK)) return -1; /* Force entries are done first, and are not affected by ignore entries */ if (address_data->forces) { unsigned short **forces = address_data->forces; int kind; for (kind = 0; forces[kind]; kind++) { for (i = 0; forces[kind][i] != I2C_CLIENT_END; i += 2) { if (forces[kind][i] == adap_id || forces[kind][i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found force " "parameter for adapter %d, " "addr 0x%02x, kind %d\n", adap_id, forces[kind][i + 1], kind); err = i2c_probe_address(adapter, forces[kind][i + 1], kind, found_proc); if (err) return err; } } } } /* Probe entries are done second, and are not affected by ignore entries either */ for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { if (address_data->probe[i] == adap_id || address_data->probe[i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found probe parameter for " "adapter %d, addr 0x%02x\n", adap_id, address_data->probe[i + 1]); err = i2c_probe_address(adapter, address_data->probe[i + 1], -1, found_proc); if (err) return err; } } /* Normal entries are done last, unless shadowed by an ignore entry */ for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { int j, ignore; ignore = 0; for (j = 0; address_data->ignore[j] != I2C_CLIENT_END; j += 2) { if ((address_data->ignore[j] == adap_id || address_data->ignore[j] == ANY_I2C_BUS) && address_data->ignore[j + 1] == address_data->normal_i2c[i]) { dev_dbg(&adapter->dev, "found ignore " "parameter for adapter %d, " "addr 0x%02x\n", adap_id, address_data->ignore[j + 1]); } ignore = 1; break; } if (ignore) continue; dev_dbg(&adapter->dev, "found normal entry for adapter %d, " "addr 0x%02x\n", adap_id, address_data->normal_i2c[i]); err = i2c_probe_address(adapter, address_data->normal_i2c[i], -1, found_proc); if (err) return err; } return 0; } struct i2c_adapter * i2c_get_adapter(int id) { struct i2c_adapter *adapter; down(&core_lists); adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); if (adapter && !try_module_get(adapter->owner)) adapter = NULL; up(&core_lists); return adapter; } void i2c_put_adapter(struct i2c_adapter *adap) { module_put(adap->owner); } /* The SMBus parts */ #define POLY (0x1070U << 3) static u8 crc8(u16 data) { int i; for (i = 0; i < 8; i++) { if (data & 0x8000) data = data ^ POLY; data = data << 1; } return (u8)(data >> 8); } /* CRC over count bytes in the first array plus the bytes in the rest array if it is non-null. rest[0] is the (length of rest) - 1 and is included. */ static u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest) { int i; for (i = 0; i < count; i++) crc = crc8((crc ^ first[i]) << 8); if (rest != NULL) for (i = 0; i <= rest[0]; i++) crc = crc8((crc ^ rest[i]) << 8); return crc; } static u8 i2c_smbus_pec(int count, u8 *first, u8 *rest) { return i2c_smbus_partial_pec(0, count, first, rest); } /* Returns new "size" (transaction type) Note that we convert byte to byte_data and byte_data to word_data rather than invent new xxx_PEC transactions. */ static int i2c_smbus_add_pec(u16 addr, u8 command, int size, union i2c_smbus_data *data) { u8 buf[3]; buf[0] = addr << 1; buf[1] = command; switch (size) { case I2C_SMBUS_BYTE: data->byte = i2c_smbus_pec(2, buf, NULL); size = I2C_SMBUS_BYTE_DATA; break; case I2C_SMBUS_BYTE_DATA: buf[2] = data->byte; data->word = buf[2] || (i2c_smbus_pec(3, buf, NULL) << 8); size = I2C_SMBUS_WORD_DATA; break; case I2C_SMBUS_WORD_DATA: /* unsupported */ break; case I2C_SMBUS_BLOCK_DATA: data->block[data->block[0] + 1] = i2c_smbus_pec(2, buf, data->block); size = I2C_SMBUS_BLOCK_DATA_PEC; break; } return size; } static int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial, union i2c_smbus_data *data) { u8 buf[3], rpec, cpec; buf[1] = command; switch (size) { case I2C_SMBUS_BYTE_DATA: buf[0] = (addr << 1) | 1; cpec = i2c_smbus_pec(2, buf, NULL); rpec = data->byte; break; case I2C_SMBUS_WORD_DATA: buf[0] = (addr << 1) | 1; buf[2] = data->word & 0xff; cpec = i2c_smbus_pec(3, buf, NULL); rpec = data->word >> 8; break; case I2C_SMBUS_WORD_DATA_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_PROC_CALL_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_BLOCK_DATA_PEC: buf[0] = (addr << 1); buf[2] = (addr << 1) | 1; cpec = i2c_smbus_pec(3, buf, data->block); rpec = data->block[data->block[0] + 1]; break; case I2C_SMBUS_BLOCK_PROC_CALL_PEC: buf[0] = (addr << 1) | 1; rpec = i2c_smbus_partial_pec(partial, 1, buf, data->block); cpec = data->block[data->block[0] + 1]; break; default: cpec = rpec = 0; break; } if (rpec != cpec) { pr_debug("i2c-core: Bad PEC 0x%02x vs. 0x%02x\n", rpec, cpec); return -1; } return 0; } s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) { return i2c_smbus_xfer(client->adapter, client->addr, client->flags, value, 0, I2C_SMBUS_QUICK, NULL); } s32 i2c_smbus_read_byte(struct i2c_client *client) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data)) return -1; else return 0x0FF & data.byte; } s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) { union i2c_smbus_data data; /* only for PEC */ return i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, &data); } s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_BYTE_DATA, &data)) return -1; else return 0x0FF & data.byte; } s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) { union i2c_smbus_data data; data.byte = value; return i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_BYTE_DATA, &data); } s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_WORD_DATA, &data)) return -1; else return 0x0FFFF & data.word; } s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) { union i2c_smbus_data data; data.word = value; return i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_WORD_DATA, &data); } s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, u8 length, u8 *values) { union i2c_smbus_data data; int i; if (length > I2C_SMBUS_BLOCK_MAX) length = I2C_SMBUS_BLOCK_MAX; for (i = 1; i <= length; i++) data.block[i] = values[i - 1]; data.block[0] = length; return i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_WRITE, command, I2C_SMBUS_BLOCK_DATA, &data); } /* Returns the number of read bytes */ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) { union i2c_smbus_data data; int i; if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, I2C_SMBUS_READ, command, I2C_SMBUS_I2C_BLOCK_DATA, &data)) return -1; else { for (i = 1; i <= data.block[0]; i++) values[i - 1] = data.block[i]; return data.block[0]; } } /* Simulate a SMBus command using the i2c protocol No checking of parameters is done! */ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter *adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data) { /* So we need to generate a series of msgs. In the case of writing, we need to use only one message; when reading, we need two. We initialize most things with sane defaults, to keep the code below somewhat simpler. */ unsigned char msgbuf0[34]; unsigned char msgbuf1[34]; int num = read_write == I2C_SMBUS_READ ? 2 : 1; struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, { addr, flags | I2C_M_RD, 0, msgbuf1 } }; int i; msgbuf0[0] = command; switch (size) { case I2C_SMBUS_QUICK: msg[0].len = 0; /* Special case: The read/write field is used as data */ msg[0].flags = flags | (read_write == I2C_SMBUS_READ) ? I2C_M_RD : 0; num = 1; break; case I2C_SMBUS_BYTE: if (read_write == I2C_SMBUS_READ) { /* Special case: only a read! */ msg[0].flags = I2C_M_RD | flags; num = 1; } break; case I2C_SMBUS_BYTE_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = 1; else { msg[0].len = 2; msgbuf0[1] = data->byte; } break; case I2C_SMBUS_WORD_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = 2; else { msg[0].len = 3; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; } break; case I2C_SMBUS_PROC_CALL: num = 2; /* Special case */ read_write = I2C_SMBUS_READ; msg[0].len = 3; msg[1].len = 2; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; break; case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA_PEC: if (read_write == I2C_SMBUS_READ) { dev_err(&adapter->dev, "Block read not supported " "under I2C emulation!\n"); return -1; } else { msg[0].len = data->block[0] + 2; if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) { dev_err(&adapter->dev, "smbus_access called with " "invalid block write size (%d)\n", data->block[0]); return -1; } if (size == I2C_SMBUS_BLOCK_DATA_PEC) (msg[0].len)++; for (i = 1; i <= msg[0].len; i++) msgbuf0[i] = data->block[i - 1]; } break; case I2C_SMBUS_BLOCK_PROC_CALL: case I2C_SMBUS_BLOCK_PROC_CALL_PEC: dev_dbg(&adapter->dev, "Block process call not supported " "under I2C emulation!\n"); return -1; case I2C_SMBUS_I2C_BLOCK_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; else { msg[0].len = data->block[0] + 1; if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) { dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " "invalid block write size (%d)\n", data->block[0]); return -1; } for (i = 1; i <= data->block[0]; i++) msgbuf0[i] = data->block[i]; } break; default: dev_err(&adapter->dev, "smbus_access called with invalid size (%d)\n", size); return -1; } if (i2c_transfer(adapter, msg, num) < 0) return -1; if (read_write == I2C_SMBUS_READ) switch (size) { case I2C_SMBUS_BYTE: data->byte = msgbuf0[0]; break; case I2C_SMBUS_BYTE_DATA: data->byte = msgbuf1[0]; break; case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_PROC_CALL: data->word = msgbuf1[0] | (msgbuf1[1] << 8); break; case I2C_SMBUS_I2C_BLOCK_DATA: /* fixed at 32 for now */ data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX; for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++) data->block[i + 1] = msgbuf1[i]; break; } return 0; } s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data) { s32 res; int swpec = 0; u8 partial = 0; flags &= I2C_M_TEN | I2C_CLIENT_PEC; if ((flags & I2C_CLIENT_PEC) && !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) { swpec = 1; if (read_write == I2C_SMBUS_READ && size == I2C_SMBUS_BLOCK_DATA) size = I2C_SMBUS_BLOCK_DATA_PEC; else if (size == I2C_SMBUS_PROC_CALL) size = I2C_SMBUS_PROC_CALL_PEC; else if (size == I2C_SMBUS_BLOCK_PROC_CALL) { i2c_smbus_add_pec(addr, command, I2C_SMBUS_BLOCK_DATA, data); partial = data->block[data->block[0] + 1]; size = I2C_SMBUS_BLOCK_PROC_CALL_PEC; } else if (read_write == I2C_SMBUS_WRITE && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA) size = i2c_smbus_add_pec(addr, command, size, data); } if (adapter->algo->smbus_xfer) { down(&adapter->bus_lock); res = adapter->algo->smbus_xfer(adapter, addr, flags, read_write, command, size, data); up(&adapter->bus_lock); } else res = i2c_smbus_xfer_emulated(adapter, addr, flags, read_write, command, size, data); if (res >= 0 && swpec && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA && (read_write == I2C_SMBUS_READ || size == I2C_SMBUS_PROC_CALL_PEC || size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) if (i2c_smbus_check_pec(addr, command, size, partial, data)) return -1; return res; } /* Next four are needed by i2c-isa */ EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); EXPORT_SYMBOL_GPL(i2c_adapter_driver); EXPORT_SYMBOL_GPL(i2c_adapter_class); EXPORT_SYMBOL_GPL(i2c_bus_type); EXPORT_SYMBOL(i2c_add_adapter); EXPORT_SYMBOL(i2c_del_adapter); EXPORT_SYMBOL(i2c_add_driver); EXPORT_SYMBOL(i2c_del_driver); EXPORT_SYMBOL(i2c_attach_client); EXPORT_SYMBOL(i2c_detach_client); EXPORT_SYMBOL(i2c_use_client); EXPORT_SYMBOL(i2c_release_client); EXPORT_SYMBOL(i2c_clients_command); EXPORT_SYMBOL(i2c_check_addr); EXPORT_SYMBOL(i2c_master_send); EXPORT_SYMBOL(i2c_master_recv); EXPORT_SYMBOL(i2c_control); EXPORT_SYMBOL(i2c_transfer); EXPORT_SYMBOL(i2c_get_adapter); EXPORT_SYMBOL(i2c_put_adapter); EXPORT_SYMBOL(i2c_probe); EXPORT_SYMBOL(i2c_smbus_xfer); EXPORT_SYMBOL(i2c_smbus_write_quick); EXPORT_SYMBOL(i2c_smbus_read_byte); EXPORT_SYMBOL(i2c_smbus_write_byte); EXPORT_SYMBOL(i2c_smbus_read_byte_data); EXPORT_SYMBOL(i2c_smbus_write_byte_data); EXPORT_SYMBOL(i2c_smbus_read_word_data); EXPORT_SYMBOL(i2c_smbus_write_word_data); EXPORT_SYMBOL(i2c_smbus_write_block_data); EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); MODULE_AUTHOR("Simon G. Vogl "); MODULE_DESCRIPTION("I2C-Bus main module"); MODULE_LICENSE("GPL"); uncrustify-0.59/documentation/htdocs/examples/c-1.in.c0000644000175000017500000007766411506773275017750 00000000000000/* i2c-core.c - a device driver for the iic-bus interface */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 1995-99 Simon G. Vogl This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ /* With some changes from Kysti Mlkki . All SMBus-related things are written by Frodo Looijaard SMBus 2.0 support by Mark Studebaker */ #include #include #include #include #include #include #include #include #include static LIST_HEAD(adapters); static LIST_HEAD(drivers); static DECLARE_MUTEX(core_lists); static DEFINE_IDR(i2c_adapter_idr); static int i2c_device_match(struct device *dev, struct device_driver *drv) { return 1; } static int i2c_bus_suspend(struct device * dev, pm_message_t state) { int rc = 0; if (dev->driver && dev->driver->suspend) rc = dev->driver->suspend(dev,state,0); return rc; } static int i2c_bus_resume(struct device * dev) { int rc = 0; if (dev->driver && dev->driver->resume) rc = dev->driver->resume(dev,0); return rc; } struct bus_type i2c_bus_type = { .name = "i2c", .match = i2c_device_match, .suspend = i2c_bus_suspend, .resume = i2c_bus_resume, }; static int i2c_device_probe(struct device *dev) { return -ENODEV; } static int i2c_device_remove(struct device *dev) { return 0; } void i2c_adapter_dev_release(struct device *dev) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); complete(&adap->dev_released); } struct device_driver i2c_adapter_driver = { .name = "i2c_adapter", .bus = &i2c_bus_type, .probe = i2c_device_probe, .remove = i2c_device_remove, }; static void i2c_adapter_class_dev_release(struct class_device *dev) { struct i2c_adapter *adap = class_dev_to_i2c_adapter(dev); complete(&adap->class_dev_released); } struct class i2c_adapter_class = { .name = "i2c-adapter", .release =&i2c_adapter_class_dev_release, }; static ssize_t show_adapter_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_adapter *adap = dev_to_i2c_adapter(dev); return sprintf(buf, "%s\n", adap->name); } static DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); static void i2c_client_release(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); complete(&client->released); } static ssize_t show_client_name(struct device *dev, struct device_attribute *attr, char *buf) { struct i2c_client *client = to_i2c_client(dev); return sprintf(buf, "%s\n", client->name); } /* * We can't use the DEVICE_ATTR() macro here as we want the same filename for a * different type of a device. So beware if the DEVICE_ATTR() macro ever * changes, this definition will also have to change. */ static struct device_attribute dev_attr_client_name = { .attr = {.name = "name", .mode = S_IRUGO, .owner = THIS_MODULE }, .show = &show_client_name, }; /* --------------------------------------------------- * registering functions * --------------------------------------------------- */ /* ----- * i2c_add_adapter is called from within the algorithm layer, * when a new hw adapter registers. A new device is register to be * available for clients. */ int i2c_add_adapter(struct i2c_adapter *adap) { int id, res = 0; struct list_head *item; struct i2c_driver *driver; down(&core_lists); if (idr_pre_get(&i2c_adapter_idr, GFP_KERNEL) == 0) { res = -ENOMEM; goto out_unlock; } res = idr_get_new(&i2c_adapter_idr, adap, &id); if (res < 0) { if (res == -EAGAIN) res = -ENOMEM; goto out_unlock; } adap->nr = id & MAX_ID_MASK; init_MUTEX(&adap->bus_lock); init_MUTEX(&adap->clist_lock); list_add_tail(&adap->list,&adapters); INIT_LIST_HEAD(&adap->clients); /* Add the adapter to the driver core. * If the parent pointer is not set up, * we add this adapter to the host bus. */ if (adap->dev.parent == NULL) adap->dev.parent = &platform_bus; sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); adap->dev.driver = &i2c_adapter_driver; adap->dev.release = &i2c_adapter_dev_release; device_register(&adap->dev); device_create_file(&adap->dev, &dev_attr_name); /* Add this adapter to the i2c_adapter class */ memset(&adap->class_dev, 0x00, sizeof(struct class_device)); adap->class_dev.dev = &adap->dev; adap->class_dev.class = &i2c_adapter_class; strlcpy(adap->class_dev.class_id, adap->dev.bus_id, BUS_ID_SIZE); class_device_register(&adap->class_dev); dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); /* inform drivers of new adapters */ list_for_each(item,&drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->flags & I2C_DF_NOTIFY) /* We ignore the return code; if it fails, too bad */ driver->attach_adapter(adap); } out_unlock: up(&core_lists); return res; } int i2c_del_adapter(struct i2c_adapter *adap) { struct list_head *item, *_n; struct i2c_adapter *adap_from_list; struct i2c_driver *driver; struct i2c_client *client; int res = 0; down(&core_lists); /* First make sure that this adapter was ever added */ list_for_each_entry(adap_from_list, &adapters, list) { if (adap_from_list == adap) break; } if (adap_from_list != adap) { pr_debug("i2c-core: attempting to delete unregistered " "adapter [%s]\n", adap->name); res = -EINVAL; goto out_unlock; } list_for_each(item,&drivers) { driver = list_entry(item, struct i2c_driver, list); if (driver->detach_adapter) if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } /* detach any active clients. This must be done first, because * it can fail; in which case we give up. */ list_for_each_safe(item, _n, &adap->clients) { client = list_entry(item, struct i2c_client, list); /* detaching devices is unconditional of the set notify * flag, as _all_ clients that reside on the adapter * must be deleted, as this would cause invalid states. */ if ((res=client->driver->detach_client(client))) { dev_err(&adap->dev, "detach_client failed for client " "[%s] at address 0x%02x\n", client->name, client->addr); goto out_unlock; } } /* clean up the sysfs representation */ init_completion(&adap->dev_released); init_completion(&adap->class_dev_released); class_device_unregister(&adap->class_dev); device_remove_file(&adap->dev, &dev_attr_name); device_unregister(&adap->dev); list_del(&adap->list); /* wait for sysfs to drop all references */ wait_for_completion(&adap->dev_released); wait_for_completion(&adap->class_dev_released); /* free dynamically allocated bus id */ idr_remove(&i2c_adapter_idr, adap->nr); dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); out_unlock: up(&core_lists); return res; } /* ----- * What follows is the "upwards" interface: commands for talking to clients, * which implement the functions to access the physical information of the * chips. */ int i2c_add_driver(struct i2c_driver *driver) { struct list_head *item; struct i2c_adapter *adapter; int res = 0; down(&core_lists); /* add the driver to the list of i2c drivers in the driver core */ driver->driver.name = driver->name; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_device_probe; driver->driver.remove = i2c_device_remove; res = driver_register(&driver->driver); if (res) goto out_unlock; list_add_tail(&driver->list,&drivers); pr_debug("i2c-core: driver [%s] registered\n", driver->name); /* now look for instances of driver on our adapters */ if (driver->flags & I2C_DF_NOTIFY) { list_for_each(item,&adapters) { adapter = list_entry(item, struct i2c_adapter, list); driver->attach_adapter(adapter); } } out_unlock: up(&core_lists); return res; } int i2c_del_driver(struct i2c_driver *driver) { struct list_head *item1, *item2, *_n; struct i2c_client *client; struct i2c_adapter *adap; int res = 0; down(&core_lists); /* Have a look at each adapter, if clients of this driver are still * attached. If so, detach them to be able to kill the driver * afterwards. * * Removing clients does not depend on the notify flag, else * invalid operation might (will!) result, when using stale client * pointers. */ list_for_each(item1,&adapters) { adap = list_entry(item1, struct i2c_adapter, list); if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " "for driver [%s]\n", driver->name); goto out_unlock; } } else { list_for_each_safe(item2, _n, &adap->clients) { client = list_entry(item2, struct i2c_client, list); if (client->driver != driver) continue; dev_dbg(&adap->dev, "detaching client [%s] " "at 0x%02x\n", client->name, client->addr); if ((res = driver->detach_client(client))) { dev_err(&adap->dev, "detach_client " "failed for client [%s] at " "0x%02x\n", client->name, client->addr); goto out_unlock; } } } } driver_unregister(&driver->driver); list_del(&driver->list); pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); out_unlock: up(&core_lists); return 0; } static int __i2c_check_addr(struct i2c_adapter *adapter, unsigned int addr) { struct list_head *item; struct i2c_client *client; list_for_each(item,&adapter->clients) { client = list_entry(item, struct i2c_client, list); if (client->addr == addr) return -EBUSY; } return 0; } int i2c_check_addr(struct i2c_adapter *adapter, int addr) { int rval; down(&adapter->clist_lock); rval = __i2c_check_addr(adapter, addr); up(&adapter->clist_lock); return rval; } int i2c_attach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; down(&adapter->clist_lock); if (__i2c_check_addr(client->adapter, client->addr)) { up(&adapter->clist_lock); return -EBUSY; } list_add_tail(&client->list,&adapter->clients); up(&adapter->clist_lock); if (adapter->client_register) { if (adapter->client_register(client)) { dev_dbg(&adapter->dev, "client_register " "failed for client [%s] at 0x%02x\n", client->name, client->addr); } } if (client->flags & I2C_CLIENT_ALLOW_USE) client->usage_count = 0; client->dev.parent = &client->adapter->dev; client->dev.driver = &client->driver->driver; client->dev.bus = &i2c_bus_type; client->dev.release = &i2c_client_release; snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id), "%d-%04x", i2c_adapter_id(adapter), client->addr); dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n", client->name, client->dev.bus_id); device_register(&client->dev); device_create_file(&client->dev, &dev_attr_client_name); return 0; } int i2c_detach_client(struct i2c_client *client) { struct i2c_adapter *adapter = client->adapter; int res = 0; if ((client->flags & I2C_CLIENT_ALLOW_USE) && (client->usage_count > 0)) { dev_warn(&client->dev, "Client [%s] still busy, " "can't detach\n", client->name); return -EBUSY; } if (adapter->client_unregister) { res = adapter->client_unregister(client); if (res) { dev_err(&client->dev, "client_unregister [%s] failed, " "client not detached\n", client->name); goto out; } } down(&adapter->clist_lock); list_del(&client->list); init_completion(&client->released); device_remove_file(&client->dev, &dev_attr_client_name); device_unregister(&client->dev); up(&adapter->clist_lock); wait_for_completion(&client->released); out: return res; } static int i2c_inc_use_client(struct i2c_client *client) { if (!try_module_get(client->driver->owner)) return -ENODEV; if (!try_module_get(client->adapter->owner)) { module_put(client->driver->owner); return -ENODEV; } return 0; } static void i2c_dec_use_client(struct i2c_client *client) { module_put(client->driver->owner); module_put(client->adapter->owner); } int i2c_use_client(struct i2c_client *client) { int ret; ret = i2c_inc_use_client(client); if (ret) return ret; if (client->flags & I2C_CLIENT_ALLOW_USE) { if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) client->usage_count++; else if (client->usage_count > 0) goto busy; else client->usage_count++; } return 0; busy: i2c_dec_use_client(client); return -EBUSY; } int i2c_release_client(struct i2c_client *client) { if(client->flags & I2C_CLIENT_ALLOW_USE) { if(client->usage_count>0) client->usage_count--; else { pr_debug("i2c-core: %s used one too many times\n", __FUNCTION__); return -EPERM; } } i2c_dec_use_client(client); return 0; } void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) { struct list_head *item; struct i2c_client *client; down(&adap->clist_lock); list_for_each(item,&adap->clients) { client = list_entry(item, struct i2c_client, list); if (!try_module_get(client->driver->owner)) continue; if (NULL != client->driver->command) { up(&adap->clist_lock); client->driver->command(client,cmd,arg); down(&adap->clist_lock); } module_put(client->driver->owner); } up(&adap->clist_lock); } static int __init i2c_init(void) { int retval; retval = bus_register(&i2c_bus_type); if (retval) return retval; retval = driver_register(&i2c_adapter_driver); if (retval) return retval; return class_register(&i2c_adapter_class); } static void __exit i2c_exit(void) { class_unregister(&i2c_adapter_class); driver_unregister(&i2c_adapter_driver); bus_unregister(&i2c_bus_type); } subsys_initcall(i2c_init); module_exit(i2c_exit); /* ---------------------------------------------------- * the functional interface to the i2c busses. * ---------------------------------------------------- */ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num) { int ret; if (adap->algo->master_xfer) { #ifdef DEBUG for (ret = 0; ret < num; ret++) { dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, " "len=%d\n", ret, msgs[ret].flags & I2C_M_RD ? 'R' : 'W', msgs[ret].addr, msgs[ret].len); } #endif down(&adap->bus_lock); ret = adap->algo->master_xfer(adap,msgs,num); up(&adap->bus_lock); return ret; } else { dev_dbg(&adap->dev, "I2C level transfers not supported\n"); return -ENOSYS; } } int i2c_master_send(struct i2c_client *client,const char *buf ,int count) { int ret; struct i2c_adapter *adap=client->adapter; struct i2c_msg msg; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.len = count; msg.buf = (char *)buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes transmitted, else error code. */ return (ret == 1) ? count : ret; } int i2c_master_recv(struct i2c_client *client, char *buf ,int count) { struct i2c_adapter *adap=client->adapter; struct i2c_msg msg; int ret; msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.flags |= I2C_M_RD; msg.len = count; msg.buf = buf; ret = i2c_transfer(adap, &msg, 1); /* If everything went ok (i.e. 1 msg transmitted), return #bytes transmitted, else error code. */ return (ret == 1) ? count : ret; } int i2c_control(struct i2c_client *client, unsigned int cmd, unsigned long arg) { int ret = 0; struct i2c_adapter *adap = client->adapter; dev_dbg(&client->adapter->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg); switch (cmd) { case I2C_RETRIES: adap->retries = arg; break; case I2C_TIMEOUT: adap->timeout = arg; break; default: if (adap->algo->algo_control!=NULL) ret = adap->algo->algo_control(adap,cmd,arg); } return ret; } /* ---------------------------------------------------- * the i2c address scanning function * Will not work for 10-bit addresses! * ---------------------------------------------------- */ static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind, int (*found_proc) (struct i2c_adapter *, int, int)) { int err; /* Make sure the address is valid */ if (addr < 0x03 || addr > 0x77) { dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n", addr); return -EINVAL; } /* Skip if already in use */ if (i2c_check_addr(adapter, addr)) return 0; /* Make sure there is something at this address, unless forced */ if (kind < 0) { if (i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL) < 0) return 0; /* prevent 24RF08 corruption */ if ((addr & ~0x0f) == 0x50) i2c_smbus_xfer(adapter, addr, 0, 0, 0, I2C_SMBUS_QUICK, NULL); } /* Finally call the custom detection function */ err = found_proc(adapter, addr, kind); /* -ENODEV can be returned if there is a chip at the given address but it isn't supported by this chip driver. We catch it here as this isn't an error. */ return (err == -ENODEV) ? 0 : err; } int i2c_probe(struct i2c_adapter *adapter, struct i2c_client_address_data *address_data, int (*found_proc) (struct i2c_adapter *, int, int)) { int i, err; int adap_id = i2c_adapter_id(adapter); /* Forget it if we can't probe using SMBUS_QUICK */ if (! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_QUICK)) return -1; /* Force entries are done first, and are not affected by ignore entries */ if (address_data->forces) { unsigned short **forces = address_data->forces; int kind; for (kind = 0; forces[kind]; kind++) { for (i = 0; forces[kind][i] != I2C_CLIENT_END; i += 2) { if (forces[kind][i] == adap_id || forces[kind][i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found force " "parameter for adapter %d, " "addr 0x%02x, kind %d\n", adap_id, forces[kind][i + 1], kind); err = i2c_probe_address(adapter, forces[kind][i + 1], kind, found_proc); if (err) return err; } } } } /* Probe entries are done second, and are not affected by ignore entries either */ for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) { if (address_data->probe[i] == adap_id || address_data->probe[i] == ANY_I2C_BUS) { dev_dbg(&adapter->dev, "found probe parameter for " "adapter %d, addr 0x%02x\n", adap_id, address_data->probe[i + 1]); err = i2c_probe_address(adapter, address_data->probe[i + 1], -1, found_proc); if (err) return err; } } /* Normal entries are done last, unless shadowed by an ignore entry */ for (i = 0; address_data->normal_i2c[i] != I2C_CLIENT_END; i += 1) { int j, ignore; ignore = 0; for (j = 0; address_data->ignore[j] != I2C_CLIENT_END; j += 2) { if ((address_data->ignore[j] == adap_id || address_data->ignore[j] == ANY_I2C_BUS) && address_data->ignore[j + 1] == address_data->normal_i2c[i]) { dev_dbg(&adapter->dev, "found ignore " "parameter for adapter %d, " "addr 0x%02x\n", adap_id, address_data->ignore[j + 1]); } ignore = 1; break; } if (ignore) continue; dev_dbg(&adapter->dev, "found normal entry for adapter %d, " "addr 0x%02x\n", adap_id, address_data->normal_i2c[i]); err = i2c_probe_address(adapter, address_data->normal_i2c[i], -1, found_proc); if (err) return err; } return 0; } struct i2c_adapter* i2c_get_adapter(int id) { struct i2c_adapter *adapter; down(&core_lists); adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id); if (adapter && !try_module_get(adapter->owner)) adapter = NULL; up(&core_lists); return adapter; } void i2c_put_adapter(struct i2c_adapter *adap) { module_put(adap->owner); } /* The SMBus parts */ #define POLY (0x1070U << 3) static u8 crc8(u16 data) { int i; for(i = 0; i < 8; i++) { if (data & 0x8000) data = data ^ POLY; data = data << 1; } return (u8)(data >> 8); } /* CRC over count bytes in the first array plus the bytes in the rest array if it is non-null. rest[0] is the (length of rest) - 1 and is included. */ static u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest) { int i; for(i = 0; i < count; i++) crc = crc8((crc ^ first[i]) << 8); if(rest != NULL) for(i = 0; i <= rest[0]; i++) crc = crc8((crc ^ rest[i]) << 8); return crc; } static u8 i2c_smbus_pec(int count, u8 *first, u8 *rest) { return i2c_smbus_partial_pec(0, count, first, rest); } /* Returns new "size" (transaction type) Note that we convert byte to byte_data and byte_data to word_data rather than invent new xxx_PEC transactions. */ static int i2c_smbus_add_pec(u16 addr, u8 command, int size, union i2c_smbus_data *data) { u8 buf[3]; buf[0] = addr << 1; buf[1] = command; switch(size) { case I2C_SMBUS_BYTE: data->byte = i2c_smbus_pec(2, buf, NULL); size = I2C_SMBUS_BYTE_DATA; break; case I2C_SMBUS_BYTE_DATA: buf[2] = data->byte; data->word = buf[2] || (i2c_smbus_pec(3, buf, NULL) << 8); size = I2C_SMBUS_WORD_DATA; break; case I2C_SMBUS_WORD_DATA: /* unsupported */ break; case I2C_SMBUS_BLOCK_DATA: data->block[data->block[0] + 1] = i2c_smbus_pec(2, buf, data->block); size = I2C_SMBUS_BLOCK_DATA_PEC; break; } return size; } static int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial, union i2c_smbus_data *data) { u8 buf[3], rpec, cpec; buf[1] = command; switch(size) { case I2C_SMBUS_BYTE_DATA: buf[0] = (addr << 1) | 1; cpec = i2c_smbus_pec(2, buf, NULL); rpec = data->byte; break; case I2C_SMBUS_WORD_DATA: buf[0] = (addr << 1) | 1; buf[2] = data->word & 0xff; cpec = i2c_smbus_pec(3, buf, NULL); rpec = data->word >> 8; break; case I2C_SMBUS_WORD_DATA_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_PROC_CALL_PEC: /* unsupported */ cpec = rpec = 0; break; case I2C_SMBUS_BLOCK_DATA_PEC: buf[0] = (addr << 1); buf[2] = (addr << 1) | 1; cpec = i2c_smbus_pec(3, buf, data->block); rpec = data->block[data->block[0] + 1]; break; case I2C_SMBUS_BLOCK_PROC_CALL_PEC: buf[0] = (addr << 1) | 1; rpec = i2c_smbus_partial_pec(partial, 1, buf, data->block); cpec = data->block[data->block[0] + 1]; break; default: cpec = rpec = 0; break; } if (rpec != cpec) { pr_debug("i2c-core: Bad PEC 0x%02x vs. 0x%02x\n", rpec, cpec); return -1; } return 0; } s32 i2c_smbus_write_quick(struct i2c_client *client, u8 value) { return i2c_smbus_xfer(client->adapter,client->addr,client->flags, value,0,I2C_SMBUS_QUICK,NULL); } s32 i2c_smbus_read_byte(struct i2c_client *client) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,0,I2C_SMBUS_BYTE, &data)) return -1; else return 0x0FF & data.byte; } s32 i2c_smbus_write_byte(struct i2c_client *client, u8 value) { union i2c_smbus_data data; /* only for PEC */ return i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_WRITE,value, I2C_SMBUS_BYTE,&data); } s32 i2c_smbus_read_byte_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,command, I2C_SMBUS_BYTE_DATA,&data)) return -1; else return 0x0FF & data.byte; } s32 i2c_smbus_write_byte_data(struct i2c_client *client, u8 command, u8 value) { union i2c_smbus_data data; data.byte = value; return i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_WRITE,command, I2C_SMBUS_BYTE_DATA,&data); } s32 i2c_smbus_read_word_data(struct i2c_client *client, u8 command) { union i2c_smbus_data data; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,command, I2C_SMBUS_WORD_DATA, &data)) return -1; else return 0x0FFFF & data.word; } s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) { union i2c_smbus_data data; data.word = value; return i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_WRITE,command, I2C_SMBUS_WORD_DATA,&data); } s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, u8 length, u8 *values) { union i2c_smbus_data data; int i; if (length > I2C_SMBUS_BLOCK_MAX) length = I2C_SMBUS_BLOCK_MAX; for (i = 1; i <= length; i++) data.block[i] = values[i-1]; data.block[0] = length; return i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_WRITE,command, I2C_SMBUS_BLOCK_DATA,&data); } /* Returns the number of read bytes */ s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client, u8 command, u8 *values) { union i2c_smbus_data data; int i; if (i2c_smbus_xfer(client->adapter,client->addr,client->flags, I2C_SMBUS_READ,command, I2C_SMBUS_I2C_BLOCK_DATA,&data)) return -1; else { for (i = 1; i <= data.block[0]; i++) values[i-1] = data.block[i]; return data.block[0]; } } /* Simulate a SMBus command using the i2c protocol No checking of parameters is done! */ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data * data) { /* So we need to generate a series of msgs. In the case of writing, we need to use only one message; when reading, we need two. We initialize most things with sane defaults, to keep the code below somewhat simpler. */ unsigned char msgbuf0[34]; unsigned char msgbuf1[34]; int num = read_write == I2C_SMBUS_READ?2:1; struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, { addr, flags | I2C_M_RD, 0, msgbuf1 } }; int i; msgbuf0[0] = command; switch(size) { case I2C_SMBUS_QUICK: msg[0].len = 0; /* Special case: The read/write field is used as data */ msg[0].flags = flags | (read_write==I2C_SMBUS_READ)?I2C_M_RD:0; num = 1; break; case I2C_SMBUS_BYTE: if (read_write == I2C_SMBUS_READ) { /* Special case: only a read! */ msg[0].flags = I2C_M_RD | flags; num = 1; } break; case I2C_SMBUS_BYTE_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = 1; else { msg[0].len = 2; msgbuf0[1] = data->byte; } break; case I2C_SMBUS_WORD_DATA: if (read_write == I2C_SMBUS_READ) msg[1].len = 2; else { msg[0].len=3; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; } break; case I2C_SMBUS_PROC_CALL: num = 2; /* Special case */ read_write = I2C_SMBUS_READ; msg[0].len = 3; msg[1].len = 2; msgbuf0[1] = data->word & 0xff; msgbuf0[2] = (data->word >> 8) & 0xff; break; case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA_PEC: if (read_write == I2C_SMBUS_READ) { dev_err(&adapter->dev, "Block read not supported " "under I2C emulation!\n"); return -1; } else { msg[0].len = data->block[0] + 2; if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) { dev_err(&adapter->dev, "smbus_access called with " "invalid block write size (%d)\n", data->block[0]); return -1; } if(size == I2C_SMBUS_BLOCK_DATA_PEC) (msg[0].len)++; for (i = 1; i <= msg[0].len; i++) msgbuf0[i] = data->block[i-1]; } break; case I2C_SMBUS_BLOCK_PROC_CALL: case I2C_SMBUS_BLOCK_PROC_CALL_PEC: dev_dbg(&adapter->dev, "Block process call not supported " "under I2C emulation!\n"); return -1; case I2C_SMBUS_I2C_BLOCK_DATA: if (read_write == I2C_SMBUS_READ) { msg[1].len = I2C_SMBUS_I2C_BLOCK_MAX; } else { msg[0].len = data->block[0] + 1; if (msg[0].len > I2C_SMBUS_I2C_BLOCK_MAX + 1) { dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with " "invalid block write size (%d)\n", data->block[0]); return -1; } for (i = 1; i <= data->block[0]; i++) msgbuf0[i] = data->block[i]; } break; default: dev_err(&adapter->dev, "smbus_access called with invalid size (%d)\n", size); return -1; } if (i2c_transfer(adapter, msg, num) < 0) return -1; if (read_write == I2C_SMBUS_READ) switch(size) { case I2C_SMBUS_BYTE: data->byte = msgbuf0[0]; break; case I2C_SMBUS_BYTE_DATA: data->byte = msgbuf1[0]; break; case I2C_SMBUS_WORD_DATA: case I2C_SMBUS_PROC_CALL: data->word = msgbuf1[0] | (msgbuf1[1] << 8); break; case I2C_SMBUS_I2C_BLOCK_DATA: /* fixed at 32 for now */ data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX; for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++) data->block[i+1] = msgbuf1[i]; break; } return 0; } s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data * data) { s32 res; int swpec = 0; u8 partial = 0; flags &= I2C_M_TEN | I2C_CLIENT_PEC; if((flags & I2C_CLIENT_PEC) && !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) { swpec = 1; if(read_write == I2C_SMBUS_READ && size == I2C_SMBUS_BLOCK_DATA) size = I2C_SMBUS_BLOCK_DATA_PEC; else if(size == I2C_SMBUS_PROC_CALL) size = I2C_SMBUS_PROC_CALL_PEC; else if(size == I2C_SMBUS_BLOCK_PROC_CALL) { i2c_smbus_add_pec(addr, command, I2C_SMBUS_BLOCK_DATA, data); partial = data->block[data->block[0] + 1]; size = I2C_SMBUS_BLOCK_PROC_CALL_PEC; } else if(read_write == I2C_SMBUS_WRITE && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA) size = i2c_smbus_add_pec(addr, command, size, data); } if (adapter->algo->smbus_xfer) { down(&adapter->bus_lock); res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write, command,size,data); up(&adapter->bus_lock); } else res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write, command,size,data); if(res >= 0 && swpec && size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA && (read_write == I2C_SMBUS_READ || size == I2C_SMBUS_PROC_CALL_PEC || size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) { if(i2c_smbus_check_pec(addr, command, size, partial, data)) return -1; } return res; } /* Next four are needed by i2c-isa */ EXPORT_SYMBOL_GPL(i2c_adapter_dev_release); EXPORT_SYMBOL_GPL(i2c_adapter_driver); EXPORT_SYMBOL_GPL(i2c_adapter_class); EXPORT_SYMBOL_GPL(i2c_bus_type); EXPORT_SYMBOL(i2c_add_adapter); EXPORT_SYMBOL(i2c_del_adapter); EXPORT_SYMBOL(i2c_add_driver); EXPORT_SYMBOL(i2c_del_driver); EXPORT_SYMBOL(i2c_attach_client); EXPORT_SYMBOL(i2c_detach_client); EXPORT_SYMBOL(i2c_use_client); EXPORT_SYMBOL(i2c_release_client); EXPORT_SYMBOL(i2c_clients_command); EXPORT_SYMBOL(i2c_check_addr); EXPORT_SYMBOL(i2c_master_send); EXPORT_SYMBOL(i2c_master_recv); EXPORT_SYMBOL(i2c_control); EXPORT_SYMBOL(i2c_transfer); EXPORT_SYMBOL(i2c_get_adapter); EXPORT_SYMBOL(i2c_put_adapter); EXPORT_SYMBOL(i2c_probe); EXPORT_SYMBOL(i2c_smbus_xfer); EXPORT_SYMBOL(i2c_smbus_write_quick); EXPORT_SYMBOL(i2c_smbus_read_byte); EXPORT_SYMBOL(i2c_smbus_write_byte); EXPORT_SYMBOL(i2c_smbus_read_byte_data); EXPORT_SYMBOL(i2c_smbus_write_byte_data); EXPORT_SYMBOL(i2c_smbus_read_word_data); EXPORT_SYMBOL(i2c_smbus_write_word_data); EXPORT_SYMBOL(i2c_smbus_write_block_data); EXPORT_SYMBOL(i2c_smbus_read_i2c_block_data); MODULE_AUTHOR("Simon G. Vogl "); MODULE_DESCRIPTION("I2C-Bus main module"); MODULE_LICENSE("GPL"); uncrustify-0.59/documentation/htdocs/examples/example.c0000644000175000017500000000336311506773275020377 00000000000000 const char *token_names[] = { [CT_POUND] = "POUND", [CT_PREPROC] = "PREPROC", [CT_PREPROC_BODY] = "PREPROC_BODY", [CT_PP] = "PP", }; int main(int argc, char *argv[]) { struct junk a[] = { { "version", 0, 0, 0 }, { "file", 1, 150, 'f' }, { "config", 1, 0, 'c' }, { "parsed", 25, 0, 'p' }, { NULL, 0, 0, 0 } }; } color_t colors[] = { { "red", { 255, 0, 0 } }, { "blue", { 0, 255, 0 } }, { "green", { 0, 0, 255 } }, { "purple", { 255, 255, 0 } }, }; struct foo_t bar = { .name = "bar", .age = 21 }; struct foo_t bars[] = { [0] = { .name = "bar", .age = 21 }, [1] = { .name = "barley", .age = 55 }, }; void foo(void) { int i; char *name; i = 5; name = "bob"; } /** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 return(res); } // col1 comment in level 0 #define foobar(x) \ { \ for (i = 0; i < x; i++) \ { \ junk(i, x); \ } \ } void foo(void) { switch(ch) { case 'a': { handle_a(); break; } case 'b': handle_b(); break; case 'c': case 'd': handle_cd(); break; case 'e': { handle_a(); } break; default: handle_default(); break; } } uncrustify-0.59/documentation/htdocs/uncrustify.css0000644000175000017500000000142411506773275017703 00000000000000html, body { background-color: #5a5f52; color: #ffffff; } div.node1 { margin: 0em; width: 70%; } div.node2 { margin: 0em; width: 90%; } h1, h2, h3, h4 { font-family: Verdana, sans-serif; color: #d1c121; } h1 { font-size: 18pt; } h2 { font-size: 14pt; } h3 { font-size: 11pt; } h4 { font-size: 10pt; } pre { font-family: Verdana, sans-serif; font-size: 11pt; background-color: #6b6f63; } a { font-family: Verdana, sans-serif; font-size: 11pt; color: #d1c121; } p, small, li { font-family: Verdana, sans-serif; color: #ffffff; } p { font-size: 11pt; } small { font-size: 7pt; } li { list-style-type: disc; font-size: 11pt; font-style: italic; } uncrustify-0.59/documentation/theory.txt0000644000175000017500000001001311574765235015541 00000000000000 ------------------------------------------------------------------------------- This document is too incomplete to be of much use. Patches are welcome! Theory of operation ------------------- Uncrustify goes through several steps to reformat code. The first step, parsing, is the most complex and important. Step 1 - Tokenize ----------------- C code must be understood to some degree to be able to be properly indented. The parsing step reads in a text buffer and breaks it into chunks and puts those chunks in a list. When a chunk is parsed, the original column and line are recorded. These are the chunks that are parsed: - punctuators - numbers - words (keywords, variables, etc) - comments - strings - whitespace - preprocessors See token_enum.h for a complete list. See punctuators.cpp and keywords.cpp for examples of how they are used. In the code, chunk types are prefixed with 'CT_'. The CT_WORD token is changed into a more specific token using the lookup table in keywords.cpp Step 2 - Tokenize Cleanup ------------------------- The second step is to change the token type for certain constructs that need to be adjusted early on. For example, the '<' token can be either a CT_COMPARE or CT_ANGLE_OPEN. Both are handled very differently. If a CT_WORD follows CT_ENUM/CT_STRUCT/CT_UNION, then it is marked as a CT_TYPE. Basically, anything that doesn't depend on the nesting level can be done at this stage. Step 3 - Brace Cleanup ------------------------- This is possibly the most difficult step. do/if/else/for/switch/while bodies are examined and virtual braces are added. Brace parent types are set. Statement start and expression starts are labeled. And #ifdef constructs are handled. This step determines the levels (brace_level, level, & pp_level). REVISIT: The code in brace_cleanup.cpp needs to be reworked to take advantage of being able to scan forward and backward. The original code was going to be merged into tokenize.cpp, but that was WAY too complex. Step 4 - Fix Symbols (combine.cpp) ---------------------------------- This step is no longer properly named. In the original design, neighboring chunks were to be combined into longer chunks. This proved to be a silly idea. But the name of the file stuck. This is where most of the interesting identification stuff goes on. Colons type are detected, variables are marked, functions are labeled, etc. Also, all the punctuators are classified. Ie, CT_MINUS become CT_NEG or CT_ARITH. - Types are marked. - Functions are marked. - Parenthesis and braces are marked where appropriate. - finds and marks casts - finds and marks variable definitions (for aligning) - finds and marks assignments that may be aligned - changes CT_INCDEC_AFTER to CT_INCDEC_BEFORE - changes CT_STAR to either CT_PTR_TYPE, CT_DEREF or CT_ARITH - changes CT_MINUS to either CT_NEG or CT_ARITH - changes CT_PLUS and CT_ADDR to CT_ARITH, if needed - other stuff? Casts ----- Casts are detected as follows: - paren pair not part of if/for/etc nor part of a function - contains only CT_QUALIFIER, CT_TYPE, '*', and no more than one CT_WORD - is not followed by CT_ARITH Tough cases: (foo) * bar; If uncertain about a cast like this: (foo_t), some simple rules are applied. If the word ends in '_t', it is a cast, unless followed by '+'. If the word is all caps (FOO), it is a cast. If you use custom types (very likely) that aren't detected properly (unlikely), the add them to the config file like so: (example Using C-Sharp types) type UInt32 UInt16 UInt8 Byte type Int32 Int16 Int8 Step 6+ Everything else ------------------------- From this point on, many filters are run on the chunk list to change the token columns. indent.cpp sets the left-most column. align.cpp set the column for individual chunks. space.cpp sets the spacing between chunks. Others insert newlines, change token position, etc. Last Step - Output ------------------------- At the final step the list is printed to the output. Everything except comments are printed as-is. Comments are reformatted in the output stage. uncrustify-0.59/documentation/paren_stack.txt0000644000175000017500000001666111574765231016534 00000000000000 =-----------------------------------------------------------------------------= * * * Paren Stack * * * =-----------------------------------------------------------------------------= At the heart of this algorithm are two stacks. There is the Paren Stack (PS) and the Frame stack. The PS (pse in the code) keeps track of braces, parens, if/else/switch/do/while/etc items -- anything that is nestable. Complex statements go through some of these BS_ stages: BS_PAREN1 - paren on if/for/switch/while, etc BS_PAREN2 - paren on do{}while() BS_BRACE_DO - brace set on do{} BS_BRACE2 - brace on if/else/for/switch/while BS_ELSE - expecting 'else' after 'if' BS_ELSEIF - expecting 'if' after 'else' BS_WHILE - expecting 'while' after 'do' The file is processed one token at a time to support #if/#else/#endif preprocessors at any point. Take this simple if statement as an example: if ( x ) { x--; } The stack would look like so: The format is first the token processed and then the PSE stack as it appears AFTER the token is processed. 'if' [IF - PAREN1] '(' [IF - PAREN1] [SPAREN OPEN] 'x' [IF - PAREN1] [SPAREN OPEN] ')' [IF - BRACE2] <- note that the stage was changed on SPAREN_CLOSE '{' [IF - BRACE2] [BRACE OPEN] 'x' [IF - BRACE2] [BRACE OPEN] '--' [IF - BRACE2] [BRACE OPEN] ';' [IF - BRACE2] [BRACE OPEN] '}' [IF - ELSE] <- lack of else kills the ELSE, closes statement Virtual brace example: if ( x ) x--; else if (y) y--; else z++; 'if' [IF - PAREN1] '(' [IF - PAREN1] [SPAREN OPEN] 'x' [IF - PAREN1] [SPAREN OPEN] ')' [IF - BRACE2] 'x' [IF - BRACE2] [VBRACE OPEN] <- VBrace open inserted before because the token was not '{' '--' [IF - BRACE2] [VBRACE OPEN] ';' [IF - ELSE] <- Semicolon causes a VBrace close to be inserted after the semicolon 'else' [ELSE - ELSEIF] <- IF changed into ELSE, expect IF or BRACE 'x' [ELSE - BRACE2] [VBRACE OPEN] <- lack of '{' -> VBrace '++' [ELSE - BRACE2] [VBRACE OPEN] ';' <- VBrace close inserted after semicolon ELSE removed after statement close Nested virtual brace example: (EOF represents the end of the file) if ( x ) if (y) y--; else z++; EOF 'if' [IF - PAREN1] '(' [IF - PAREN1] [PAREN OPEN] 'x' [IF - PAREN1] [PAREN OPEN] ')' [IF - BRACE2] 'if' [IF - BRACE2] [VBRACE OPEN] [IF - PAREN1] <- VBrace on BRACE2, IF opened '(' [IF - BRACE2] [VBRACE OPEN] [IF - PAREN1] [SPAREN OPEN] 'y' [IF - BRACE2] [VBRACE OPEN] [IF - PAREN1] [SPAREN OPEN] ')' [IF - BRACE2] [VBRACE OPEN] [IF - BRACE2] 'y' [IF - BRACE2] [VBRACE OPEN] [IF - BRACE2] [VBRACE OPEN] '--' [IF - BRACE2] [VBRACE OPEN] [IF - BRACE2] [VBRACE OPEN] ';' [IF - BRACE2] [VBRACE OPEN] [IF - ELSE] 'else' [IF - BRACE2] [VBRACE OPEN] [ELSE - ELSEIF] 'z' [IF - BRACE2] [VBRACE OPEN] [ELSE - BRACE2] [VBRACE OPEN] '++' [IF - BRACE2] [VBRACE OPEN] [ELSE - BRACE2] [VBRACE OPEN] ';' [IF - BRACE2] [VBRACE OPEN] [ELSE - BRACE2] - step1 [IF - BRACE2] [VBRACE OPEN] - step2 [IF - ELSE] - step3 EOF -- this last semi is more complicated - first it terminates the VBRACE and then the else, which then, since it is the end of a statement, terminates the VBRACE. That bumps the IF stage to ELSE. The EOF kills that off (since it is not an else) Order of operation: 1) if TOS=VBRACE && PC=SEMI, insert VBRACE close, PC=>VBRACE close 2) if PC=VBRACE close or PC=BRACE close, and TOS is complex (if/else/etc) then advance complex stage. If statement ends, pop and advance Stages for each complex statement: if IF-PAREN1, IF-BRACE2, IF-ELSE if/else IF-PAREN1, IF-BRACE2, IF-ELSE, ELSE-ELSEIF, ELSE-BRACE2 if/else if/else IF-PAREN1, IF-BRACE2, IF-ELSE, ELSE-ELSEIF, IF-PAREN1, IF-BRACE2, IF-ELSE, ELSE-ELSEIF, ELSE-BRACE2 for FOR-PAREN1, FOR-BRACE2 while WHILE-PAREN1, WHILE-BRACE2 switch SWITCH-PAREN1, SWITCH-BRACE2 do/while DO-BRACE_DO, DO-WHILE, WHILE-PAREN2 Another less-interesting example: { if (x) volatile { y++; } return y; } '{' [BRACE OPEN] 'if' [BRACE OPEN] [IF - PAREN1] '(' [BRACE OPEN] [IF - PAREN1] [PAREN OPEN] 'x' [BRACE OPEN] [IF - PAREN1] [PAREN OPEN] ')' [BRACE OPEN] [IF - BRACE2] 'volatile' [BRACE OPEN] [IF - BRACE2] [VBRACE OPEN] [VOLATILE - BRACE2] '{' [BRACE OPEN] [IF - BRACE2] [VBRACE OPEN] [VOLATILE - BRACE2] [BRACE OPEN] 'y' [BRACE OPEN] [IF - BRACE2] [VBRACE OPEN] [VOLATILE - BRACE2] [BRACE OPEN] '++' [BRACE OPEN] [IF - BRACE2] [VBRACE OPEN] [VOLATILE - BRACE2] [BRACE OPEN] ';' [BRACE OPEN] [IF - BRACE2] [VBRACE OPEN] [VOLATILE - BRACE2] [BRACE OPEN] '}' [BRACE OPEN] [IF - ELSE] <- the brace close ends brace-open, volatile-brace2 and vbrace-open 'return' [BRACE OPEN] <- not else 'y' [BRACE OPEN] ';' [BRACE OPEN] '}' <- empties the stack =-----------------------------------------------------------------------------= * * * Parse Frames * * * =-----------------------------------------------------------------------------= The pse stack is kept on a frame stack. The frame stack is need for languages that support preprocessors (C, C++, C#) that can arbitrarily change code flow. It also isolates #define macros so that they are indented independently and do not affect the rest of the program. When an #if is hit, a copy of the current frame is push on the frame stack. When an #else/#elif is hit, a copy of the current stack is pushed under the #if frame and the original (pre-#if) frame is copied to the current frame. When #endif is hit, the top frame is popped. This has the following effects: - a simple #if / #endif does not affect program flow - #if / #else /#endif - continues from the #if clause When a #define is entered, the current frame is pushed and cleared. When a #define is exited, the frame is popped. Take this example, which isn't very exciting, as both the #if and #else parts end up with the same paren stack. This is the usual case. { foo(param1, #ifdef DEBUG "debug"); #else "release"); #endif } Right before the #ifdef, we have this for the paren stack: Top> [BRACE OPEN] [PAREN OPEN] The #ifdef pushes a copy of the current stack, so we have this: Top> [BRACE OPEN] [PAREN OPEN] [BRACE OPEN] [PAREN OPEN] The close paren after "debug" closes out the PAREN-OPEN on the top of the stack. Top> [BRACE OPEN] [BRACE OPEN] [PAREN OPEN] The #else swaps the top two frames. Top> [BRACE OPEN] [PAREN OPEN] [BRACE OPEN] Right after the #else, we hit another close paren after the "release". Top> [BRACE OPEN] [BRACE OPEN] At the #endif, the top of stack is thrown out, which restores us to the #if path. Top> [BRACE OPEN] uncrustify-0.59/documentation/example.c0000644000175000017500000000336311506773275015275 00000000000000 const char *token_names[] = { [CT_POUND] = "POUND", [CT_PREPROC] = "PREPROC", [CT_PREPROC_BODY] = "PREPROC_BODY", [CT_PP] = "PP", }; int main(int argc, char *argv[]) { struct junk a[] = { { "version", 0, 0, 0 }, { "file", 1, 150, 'f' }, { "config", 1, 0, 'c' }, { "parsed", 25, 0, 'p' }, { NULL, 0, 0, 0 } }; } color_t colors[] = { { "red", { 255, 0, 0 } }, { "blue", { 0, 255, 0 } }, { "green", { 0, 0, 255 } }, { "purple", { 255, 255, 0 } }, }; struct foo_t bar = { .name = "bar", .age = 21 }; struct foo_t bars[] = { [0] = { .name = "bar", .age = 21 }, [1] = { .name = "barley", .age = 55 }, }; void foo(void) { int i; char *name; i = 5; name = "bob"; } /** * This is your typical header comment */ int foo(int bar) { int idx; int res = 0; // trailing comment // that spans two lines for (idx = 1; idx < bar; idx++) /* comment in virtual braces */ res += idx; res *= idx; // some comment // almost continued, but a NL in between // col1 comment in level 1 return(res); } // col1 comment in level 0 #define foobar(x) \ { \ for (i = 0; i < x; i++) \ { \ junk(i, x); \ } \ } void foo(void) { switch(ch) { case 'a': { handle_a(); break; } case 'b': handle_b(); break; case 'c': case 'd': handle_cd(); break; case 'e': { handle_a(); } break; default: handle_default(); break; } } uncrustify-0.59/documentation/overview.odt0000644000175000017500000004041311506773275016051 00000000000000PK|4^2 ''mimetypeapplication/vnd.oasis.opendocument.textPK|4Configurations2/statusbar/PK|4'Configurations2/accelerator/current.xmlPKPK|4Configurations2/floater/PK|4Configurations2/popupmenu/PK|4Configurations2/progressbar/PK|4Configurations2/menubar/PK|4Configurations2/toolbar/PK|4Configurations2/images/Bitmaps/PK|4 layout-cachecd`d(g``d``Q1< PKE PK|4 content.xml]o񽿂P¹h-KX986@r94EP\]rZV}k_Z3$w+13w/NrŔR6 D(#..^_K[%IiYC W% TvxFչ)5%2yzϻ]P骸pBųFWK)KRq۠a}8|a2P;)Tg)nB0`)OeĔq5j^ytWTqb[1dJ.Q;ra$=ZFRkvXa`ᔺlN-AK|pR,- e8~GhLO:G0MZJ6%6B_,$Hb"8Oou*3G_ԧt1ׂ%,T%3F.;?> }ڗ*B O Z&<"쿚$vEFjw[݀T7yzXk,me! Rj*֣C/XͿ-͆E4`knE>v>gf?H?xhG&hYYUA! v&sa=H7"= R(sWзʫOˁHPGq92t&ZseIm72x3HnBz1o`܄O*R5-Bb i&Nd@fRaub;w`IU TS.'.yD3FOD@ :M^w;n򎶛&vl;nB_{OYiy03iתG|iGt?]]_6DӖO?VΰgAM3I/{_r:kf>.|~6u˦.lz|:|mz&=k7]3MO`}o3\sM2?B] $t?܅}o5v.t߅} w.thB]|څ}Bm.t߅}S{kU/qW.P)X.^Yi>'QySұ31`1+:K8I`i!RǏ7Ik)c좸I~P㽁r7Mkyȩfg߉PY=̡̓)_l-GUyiqv@_1u`XF=r!/e5P] ap}\Ԅ # %}0LD̐ 6?f4!!M.~"-D  I5ɤ z 2rnb |m\ Cjaiuq=oX nF( 궳]K)*6aV֥:d~Z!XgD!ZMֹqYd2V.`۳mW͚%۷[gv=.^%"|DzM5nRuVoё=`@28.]u-e :S/k{IAFE <8 `BQ!$`Cܖ. B4GRn wS;]Bנ"㇌fnW,9+4MA0#iC]""_JT 1mUԾgj$hV Jf 0ݖoOnIdi ^>Tny ^}=,7 ޏuCfĘr׉?o;Χ*SNlSFc>#;_FReZOAp@iyq*P;qA5ku/yd!$ǟܰp?YnMR?~uaog9MU+_|I-+!#3 s\^zXεCppY}mIѺy(\L*hgBVv@o!)lVz;N\q\+Ozԝ~XrPvIq|m[VB?a XK)M*=.$G^>7ѵ}va1`iB7OozMbLX\dPCXcPpdH(b)%1BK{2+ZPqJKCoC﬙]鄣Pa 6ul^ᚅ1r$I >%c2_N&n3Db j$$G˛aS.$Zd+ItU/[džfn&ޛĕ͐vd>D߇u,l^a|1 +*l:}lja{cƕY3E `TFz5j͠>QǩxzcbZFDX ,WFCX+Q"0| Co)FψFg_QomFL1'`ٌ%KNd &{-˃q 䎊i8ː炂^h6$#B4 rtY =kTeﵚK-[s9%^:RlQv!tE<1RBSp(rCG op趏E=P=i- qvDnC3'Q*pGV I񇨐Lm1B +J-h+`!RT!TT>)&Xg5O -F;,*baW i T912ВP  fk)m` SJQq%BAJ)Xe[ZGu}֊$֦kdѐԪl g{ȷh s( TG[yAcY; CsC>4aB d:]hg r|1Kk7n8a[1q S^mɠ@neJ&抴b\ž+$)ʅnrkm+,qJr *NmnXͅ4A< :u_x/uϳKV23O!9F.sKXT2%& ˵Rt~*Gm ĩS9 UeJT(ݡ8U0=Pbx[ kWEKi9?KQtI"(|g2;$(r\5/vl|%ݾ"HY_AtŠ/qҬIslna¬) 3}#sjU^[ޭBᅦ-U*J75nFm9G-@?'J}|): tߡ\ \?,GiYl JYO[ݓO=7D?b"MNa~ّmFnw:9߸XL7Onx+)5Ϭ.a0 Y4|r `M{:l\L ڱɚBAGNzC)'P)6kvnuºNX :aͯ:aEIrR&.BdSpx8a9ҬwT- J \"̙ ROήtԛg?\ GiZ"56s^]w})fHZ4BcCCVToġ%sFpocɳ(yMّD|lozu[^lv93ˌ50Ӕn$ 0CtN\2[u4p>8v 0C hÄAɗBH}fC{ǡS/p lϵHⱢ:C$dHT:Ey\-ߣ= PKdR&PK|4U ""meta.xml OpenOffice.org/2.0$Linux OpenOffice.org_project/680$Build-90112006-03-27T19:37:112006-03-27T20:53:56en-US11PT1H16M49SPK|4Thumbnails/thumbnail.pngxeP-ŵ@ V(ZN((^\(Z(!HR$H{vfw?fwV9QOGHC]Ek!.6APQ|o\MOU_)GTK S|L)tw}yl,snccQ Gv`[ R.*ץɈ'%Y`)bSU(3sYu|,].Brh*q\'^LS;4mt! ,|1\e߽7b3[mZegӓ[ѫr]fd6=xh CTm ?ie݇]ʇ{vݷzv^4Z n)ȯE#\I2AD!Tc⋧h. *3TSSyvJ'&֬p+="mƖ?MVv, aSy,3@va 8 s7Jkp{ @;44}+w|B_F/ JQOuٳŚCΫ~?@-D/u2ۭ#~'w>@7yg(;JWm:KyU%2D[CDbLY =拎>Ҩ*QpjGf Uy#n ;W[LKCeQ.,p`k)Oґ Y;oV+HY4Gq0O'ɊzuJm#zcȁ%9'.Gf̢}gIEif)mК0vE\3263ItپXOl&ɒ0^(8j3D4U|$cSB,Mu6/JnD)3yEq[<%UʾVt^%ˇ?57]{?tPߟ'@DcN*ћk7fS~΀qs=-E(ny_b%$$ܴ'iRHK.Y 2 %7ßlW rp.YlɯVM=o!'8c-%1ZFk:- Bmݭ:Jytg K7Sh]~R=@@ #ԬmbPitNLJڎꬫq&C3Ҡ\'?7$VD\>DuIeWN&^X CT6"w,pw%^<ho,(tc3UAMCqӨ^_~*dj{k5Qҿ&j6v0_xuM)fWK;/OwsYN͑ _%?LplfrO@_+3&a kτ픞f Ly~L(.={c_6GD 2W` 8 bC\SjXQHɋ!GC6a3_ P5Q&cyWAO?:hNY3~i@-մjz76N{rЎ'NzIC9T:ubOn )~-\a@t_]&_-'!_%~~Fú$))AڳoAUދU-ZR, K+g-P8$)ePB> ^0ZT0.1T5/ldH u9IӖ>jWN n,q]6$i7|.Ҁ25 |$d%M- #2ִq`q,Ӧ*# <{SQ$Ƨe`{o^\146`˛!Wp piUT*|޼[9VmO э(i (Do솸o~B(߭xX4>FI ܐ@t{S7a>C~U7F~ra}%s6+G2bxٮ˞`$-q2mzDZG:GJ}<0:lIp5Ď7oqGÁ#c@ ̴r/%bsq02nsIW/(hL<~13_; 1k7ܠDc58ì-FHH"ynP0OKJ%haB글Ë?~rj&ϔo?#r>]i\q*fQSrgKG4`H-ܣ!N_9_9qҾ.jlB?Fm~Yny{H2I\^*W 0Jß?QjJEӨ6-!cx! YOx@{qs ]k}) v9hE3c 0spd)=NfzjK tɹOř:n0۬2B)c"uL&茣6c^Iגk|P7#lq!9 FUuo!y89#M+25{CmlwtV"gBSNo3!A1.yƕUުYH$ghx=Wnrikrּn hCP)dh79^'MwBc\p8 Å]Җ(^/4/}9XIڡ~W*CTjF^wθ^n r$#zcij)K*̪1#d =lBj?`^lrSg*3V黛Q\z~'jiNzxzGǛHuջ|dX@(OC}b\k]XqlWVNI؄&LOl͵jq+bk9d*F}=GY,و0:v,Ĩú ObX,El;.T r -V}mp Y ˸B=AaA&T%mn#v L~XK@sSK ecBz`9FS{D/FnNEoCyHW]MnLr)4tuL4o?, 11p8db5|lrcHv䆴\{yD ,Q8UmJ.J~ c߾4 oǰ-9F7xK@_B6ȣkQ>^Xh&ksB:i !}h4,Hs7/nqr=A[p\ݙZc<ߌL\EO{-;qpaOL%BN[ް4~S ;pwmL#'7L@-׹'6|j})Ծ E,B\6#r1xV;|*KJlZkYqYӈn'ՐK%GGyqNrX̒[oz#)L n{GžZ͞bS;TV\)E ;!4#8OYsqI&=rЄ 㭋E(O|fw# ۗޚs.l MH =+1ECUGF:PKH|QPK|4 settings.xmlY]s:};#m@H饥 7a/Y+2 ]qi (QE+1r-܇f~4e ]R7-/VLsݔ,4~#iͷZpDJeZ]./P-*FQI(|qt[SjNHW*o];״w~m}5~}ldk^ּs~6۽1piUrr:& Z f[WkŰXf.vx|1-\30C6*|6p;p }΄>ek}MdڜATmk[.1]VPM~;P4 8{$.:~8"kB]4L/_rbN ikKTlA7aks9b9|NJY>luDmi7VhHP`oi咩W9qɉ :XӉ ,r=txP玔h\u\Bs*Y,@)(qرr*0…5]219I͝(G v~.?a/#mG'Pekwۛ[΁Fќq,}'Aǂ/$wb03S@b[[V'c|ڄ*u![PSX'Ţ'OʦI *C6Wr4Ql>:f:fb(i[1 r;GjR[4٥N*AJ+W__KHB*A@Is]&d2j\*%5ֆ76l7LLtgaJZFK nrۃ;~U}.($eQvM78vw-X87%;Vɥ+Vdȣcn*jPK5kb_PK|4META-INF/manifest.xmlMn F9ަDj =$ ő6@X)H;ۈAhky+zX`uiP}F`k0 լjѶN-ןדi(.N,0J=67Z:޶U]+*.Sz]#wnS^tñzA)4.HCݕE'3RJgL6G/q'k^PSE]kj|-" TLa'8 NG\ ͎alⰵ I> +o6ӛ{nR~{rWPKOPK|4^2 ''mimetypePK|4MConfigurations2/statusbar/PK|4'Configurations2/accelerator/current.xmlPK|4Configurations2/floater/PK|4Configurations2/popupmenu/PK|4JConfigurations2/progressbar/PK|4Configurations2/menubar/PK|4Configurations2/toolbar/PK|4Configurations2/images/Bitmaps/PK|4E  -layout-cachePK|4ʚn |content.xmlPK|4dR& 9styles.xmlPK|4U ""meta.xmlPK|4H|Q Thumbnails/thumbnail.pngPK|45kb_ 6settings.xmlPK|4O;;META-INF/manifest.xmlPK(<uncrustify-0.59/documentation/align-thresholds.txt0000644000175000017500000001245411506773275017507 00000000000000------------------------------------------------------------------------------- Alignment thresholds: Alignment threshold are used to prevent aligning of certain text. Consider this example when aligning assignments: a = 2; gld.settings[somevariable] = 5; Without thresholds, this would result in: a = 2; gld.settings[somevariable] = 5; However, this is likely not desired. So to handle this, we set a limit on the number of columns that a alignment may move a token. If we set the threshold to, say, 3 characters, then the two would not be aligned together because 'a = 2' would have to be moved by 25 columns. Here's a more complicated case: a = 1; bb = 2; ccc = 3; dddd = 4; eeeee = 5; ffffff = 6; In this case, we may want this output: a = 1; bb = 2; ccc = 3; dddd = 4; eeeee = 5; ffffff = 6; But, with a threshold of 3, 'a' and 'ffffff' cannot be aligned together. So how should these thresholds be implemented? One approach is to use the threshold as the maximum difference between the current maximum and the new maximum. Using this approach, all 6 lines above are aligned, because the change for each is 1 column. Consider this with a line-span of 3 and a column-threshold of 3. Note that we'll now need to keep track of the last line processed. (line and column numbers added for clarity) 111111 123456789012345 --------------- 1 | a = 1; 2 | eeeee = 5; 3 | ffffff = 6; On line 1, the maxcol is set to 3. On line 2, the maxcol would be set to 7, except that exceeds the threshold. On line 3, the maxcol would be set to 8, except that exceeds the threshold. So, it ends up with one item in the align stack - line 1. Then we pick up from where we left off - on line 2. On line 2, the maxcol is set to 7. On line 3, the maxcol is set to 8. End result: 111111 123456789012345 --------------- 1 | a = 1; 2 | eeeee = 5; 3 | ffffff = 6; Now lets get tricky. 111111 123456789012345 --------------- 1 | a = 1; 2 | eeeee = 5; 3 | ccc = 3; 4 | ffffff = 6; How should this be aligned? I think we need to add another list - a 'skipped' list, that runs in parallel with the 'aligned' list. On line 1, the maxcol is set to 3, added to the aligned list. On line 2, col exceeds the threshold, so it is added to the skipped list. On line 3, the maxcol is set to 5, added to the aligned list. Now, after an item is added to the aligned list, the skipped list must be re-scanned. We now see that line 2 is only 2 columns different, so it is added and maxcol = 7. The skipped list is now empty. On line 4, the maxcol is set to 8, added to the aligned list. So the output is: 111111 123456789012345 --------------- 1 | a = 1; 2 | eeeee = 5; 3 | ccc = 3; 4 | ffffff = 6; Now for a case where the skipped list is not absorbed: 111111 123456789012345 --------------- 1 | a = 1; 2 | iiiiiiiiiiiiieeeee = 5; 3 | ccc = 3; 4 | ffffff = 6; On line 1, the maxcol is set to 3, added to the aligned list. On line 2, col exceeds the threshold, so it is added to the skipped list. On line 3, the maxcol is set to 5, added to the aligned list. Skipped list is scanned, nothing moved from the skipped list to the aligned list. On line 4, the maxcol is set to 8, added to the aligned list. So the output is: 111111 123456789012345 --------------- 1 | a = 1; 2 | iiiiiiiiiiiiieeeee = 5; 3 | ccc = 3; 4 | ffffff = 6; As a reminder, the old system would have produced: 1 | a = 1; 2 | iiiiiiiiiiiiieeeee = 5; 3 | ccc = 3; 4 | ffffff = 6; Which is probably not wanted. --===---===---===---===-- How to do this generically in the code... Easy case - one item per line. Here's the functions and what each do: align_start(line_span, col_thresh) align_add(pc) align_flush() align_newline(count) align_end() For each entry, a sequence number is kept. align_start(line_span, col_thresh) - initializes the align and skipped lists - zero max_column - zero cur_seqnum - zero nl_count align_add(pc) - update cur_seqnum, assign to item - if item column is within threshold - zero nl_count - add to the aligned list - if item column is > max_col - update max_col - re-adds all items on the skipped list - if item column is not within threshold, add to skipped list align_newline(count) - adds count to nl_count - if nl_count > line_span, call align_flush() align_flush() - step through all the items in aligned list and align the items to max_column - keep the seq_num of the last aligned item - zero max_column - remove all items with a seq_num < last aligned seq_num - call align_add on all remaining items in the skipped list align_end() - call align_flush - clear the lists - free resources, etc Example usage: Aligning trailing comments void align_trailing_comments(void) { chunk_t *pc; align_start(cpd.settings[UO_align_right_cmt_span], cpd.settings[UO_align_right_cmt_thresh]); for(pc = chunk_get_head(); pc != NULL; pc = chunk_get_next(pc)) { if ((pc->flags & PCF_RIGHT_COMMENT) != 0) { align_add(pc); } else if (chunk_is_newline(pc)) { align_newline(pc->nl_count); } } align_end(); } uncrustify-0.59/Makefile.in0000644000175000017500000006457711642741011012670 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ ChangeLog INSTALL NEWS config.guess config.sub install-sh \ missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = depcomp = am__depfiles_maybe = AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(pkgdatadir)" DATA = $(pkgdata_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign no-dependencies 1.11 SUBDIRS = src man pkgdata_DATA = etc/ben.cfg etc/d.cfg etc/defaults.cfg etc/gnu-indent.cfg etc/kr-indent.cfg etc/linux-indent.cfg etc/linux.cfg etc/mono.cfg etc/xsupplicant.cfg # INCLUDES = @INCLUDES@ testdir = tests TESTS = run_tests.sh EXTRA_DIST = scripts run_tests.sh make_token_names.sh $(pkgdata_DATA) \ tests/*.test tests/*.sh tests/*.py tests/config tests/input \ tests/output win32 uncrustify.xcodeproj osx make_win32.sh documentation DISTCLEANFILES = CLEANFILES = *~ *.bak MAINTAINERCLEANFILES = aclocal.m4 Makefile.in all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): install-pkgdataDATA: $(pkgdata_DATA) @$(NORMAL_INSTALL) test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgdatadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgdatadir)" || exit $$?; \ done uninstall-pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(pkgdata_DATA)'; test -n "$(pkgdatadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ elif test -f $$tst; then dir=; \ else dir="$(srcdir)/"; fi; \ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ col=$$red; res=XPASS; \ ;; \ *) \ col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ col=$$blu; res=SKIP; \ fi; \ echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ All=""; \ else \ tests="tests"; \ All="All "; \ fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ banner="$$All$$all $$tests passed"; \ else \ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ banner="$$failed of $$all $$tests failed"; \ else \ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ skipped="($$skip test was not run)"; \ else \ skipped="($$skip tests were not run)"; \ fi; \ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ echo "$$grn$$dashes"; \ else \ echo "$$red$$dashes"; \ fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-pkgdataDATA install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-pkgdataDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-TESTS check-am check-local \ clean clean-generic ctags ctags-recursive dist dist-all \ dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-xz \ dist-zip distcheck distclean distclean-generic distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkgdataDATA install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am uninstall-pkgdataDATA check-local: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: uncrustify-0.59/configure0000755000175000017500000055641211642741010012523 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.67 for uncrustify 0.59. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='uncrustify' PACKAGE_TARNAME='uncrustify' PACKAGE_VERSION='0.59' PACKAGE_STRING='uncrustify 0.59' PACKAGE_BUGREPORT='' PACKAGE_URL='http://uncrustify.sourceforge.net/' ac_unique_file="src/uncrustify.cpp" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE ac_ct_CC CFLAGS CC am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CXX CPPFLAGS LDFLAGS CXXFLAGS CXX MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking ' ac_precious_vars='build_alias host_alias target_alias CXX CXXFLAGS LDFLAGS LIBS CPPFLAGS CCC CC CFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures uncrustify 0.59 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/uncrustify] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of uncrustify 0.59:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CC C compiler command CFLAGS C compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. uncrustify home page: . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF uncrustify configure 0.59 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_cxx_try_compile LINENO # ---------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_cxx_try_compile # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval "test \"\${$3+set}\"" = set; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_mongrel # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_header_compile # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval "test \"\${$3+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by uncrustify $as_me 0.59, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5 ; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu enable_silent_rules=${enable_silent_rules-yes} am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='uncrustify' VERSION='0.59' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE ac_config_headers="$ac_config_headers src/config.h" # Checks for programs. ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 $as_echo "$CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 $as_echo "$ac_ct_CXX" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 $as_echo_n "checking whether the C++ compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C++ compiler cannot create executables See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 $as_echo_n "checking for C++ compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 $as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GXX=yes else GXX= fi ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 $as_echo_n "checking whether $CXX accepts -g... " >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes else CXXFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : else ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : ac_cv_prog_cxx_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 $as_echo "$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CXX" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 $as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi # Checks for libraries. # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5 ; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in inttypes.h stdint.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in utime.h do : ac_fn_c_check_header_mongrel "$LINENO" "utime.h" "ac_cv_header_utime_h" "$ac_includes_default" if test "x$ac_cv_header_utime_h" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UTIME_H 1 _ACEOF fi done # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } if test "${ac_cv_header_stdbool_h+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #ifndef bool "error: bool is not defined" #endif #ifndef false "error: false is not defined" #endif #if false "error: false is not 0" #endif #ifndef true "error: true is not defined" #endif #if true != 1 "error: true is not 1" #endif #ifndef __bool_true_false_are_defined "error: __bool_true_false_are_defined is not defined" #endif struct s { _Bool s: 1; _Bool t; } s; char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; bool e = &s; char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; /* The following fails for HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; # if defined __xlc__ || defined __GNUC__ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 reported by James Lemley on 2005-10-05; see http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html This test is not quite right, since xlc is allowed to reject this program, as the initializer for xlcbug is not one of the forms that C requires support for. However, doing the test right would require a runtime test, and that would make cross-compilation harder. Let us hope that IBM fixes the xlc bug, and also adds support for this kind of constant expression. In the meantime, this test will reject xlc, which is OK, since our stdbool.h substitute should suffice. We also test this with GCC, where it should work, to detect more quickly whether someone messes up the test in the future. */ char digs[] = "0123456789"; int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); # endif /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html */ _Bool q = true; _Bool *pq = &q; int main () { *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + !m + !n + !o + !p + !q + !pq); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 $as_echo "$ac_cv_header_stdbool_h" >&6; } ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" if test "x$ac_cv_type__Bool" = x""yes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 _ACEOF fi if test $ac_cv_header_stdbool_h = yes; then $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if test "${ac_cv_c_const+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if test "${ac_cv_c_inline+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac # Checks for library functions. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 $as_echo_n "checking for working memcmp... " >&6; } if test "${ac_cv_func_memcmp_working+set}" = set; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_memcmp_working=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Some versions of memcmp are not 8-bit clean. */ char c0 = '\100', c1 = '\200', c2 = '\201'; if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) return 1; /* The Next x86 OpenStep bug shows up only when comparing 16 bytes or more and with at least one buffer not starting on a 4-byte boundary. William Lewis provided this test program. */ { char foo[21]; char bar[21]; int i; for (i = 0; i < 4; i++) { char *a = foo + i; char *b = bar + i; strcpy (a, "--------01111111"); strcpy (b, "--------10000000"); if (memcmp (a, b, 16) >= 0) return 1; } return 0; } ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_memcmp_working=yes else ac_cv_func_memcmp_working=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 $as_echo "$ac_cv_func_memcmp_working" >&6; } test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in *" memcmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac for ac_func in memset strcasecmp strchr strdup strerror strtol strtoul do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether our compiler supports __func__" >&5 $as_echo_n "checking whether our compiler supports __func__... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { const char *cp = __func__ ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether our compiler supports __FUNCTION__" >&5 $as_echo_n "checking whether our compiler supports __FUNCTION__... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { const char *cp = __FUNCTION__ ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } $as_echo "#define __func__ __FUNCTION__" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define __func__ __FILE__" >>confdefs.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_config_files="$ac_config_files Makefile src/Makefile man/Makefile man/uncrustify.1 src/uncrustify_version.h" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by uncrustify $as_me 0.59, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider. uncrustify home page: ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ uncrustify config.status 0.59 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "man/uncrustify.1") CONFIG_FILES="$CONFIG_FILES man/uncrustify.1" ;; "src/uncrustify_version.h") CONFIG_FILES="$CONFIG_FILES src/uncrustify_version.h" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi uncrustify-0.59/config.guess0000755000175000017500000012001111506773275013133 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-11-30' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # This shell variable is my proudest work .. or something. --bje set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; (old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; dummy=$tmpdir/dummy ; files="$dummy.c $dummy.o $dummy.rel $dummy" ; trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $files ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; unset files' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. eval $set_cc_for_build cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF $CC_FOR_BUILD -o $dummy $dummy.s 2>/dev/null if test "$?" = 0 ; then case `$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; 3-1307) UNAME_MACHINE="alphaev7" ;; esac fi rm -f $dummy.s $dummy && rmdir $tmpdir echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy && rmdir $tmpdir fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) # Determine whether the default compiler uses glibc. eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #if __GLIBC__ >= 2 LIBC=gnu #else LIBC= #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` rm -f $dummy.c && rmdir $tmpdir echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i586-pc-interix3 exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` rm -f $dummy.c && rmdir $tmpdir test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` rm -f $dummy.c && rmdir $tmpdir test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` rm -f $dummy.c && rmdir $tmpdir test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 rm -f $dummy.c $dummy && rmdir $tmpdir # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: uncrustify-0.59/Makefile.am0000644000175000017500000000122011506773275012647 00000000000000## Process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS=foreign no-dependencies 1.11 SUBDIRS = src man pkgdata_DATA = etc/ben.cfg etc/d.cfg etc/defaults.cfg etc/gnu-indent.cfg etc/kr-indent.cfg etc/linux-indent.cfg etc/linux.cfg etc/mono.cfg etc/xsupplicant.cfg # INCLUDES = @INCLUDES@ testdir = tests TESTS = run_tests.sh EXTRA_DIST = scripts run_tests.sh make_token_names.sh $(pkgdata_DATA) \ tests/*.test tests/*.sh tests/*.py tests/config tests/input \ tests/output win32 uncrustify.xcodeproj osx make_win32.sh documentation check-local: DISTCLEANFILES = CLEANFILES = *~ *.bak MAINTAINERCLEANFILES = aclocal.m4 Makefile.in uncrustify-0.59/ChangeLog0000644000175000017500000010443511642740444012372 00000000000000 Change highlights in uncrustify-0.59 (4 Oct 2011) ------------------------------------------------------------------------------- The biggest change in this release was to rework the string handling to add proper support for UTF-8 and UTF-16. New options: - nl_case_colon_brace - indent_ctor_init - sp_before_tr_emb_cmt - sp_num_before_tr_emb_cmt - utf8_bom - utf8_byte - utf8_force - sp_after_new - nl_after_struct - nl_after_class - nl_property_brace - nl_after_func_body_class See commit.log for details. Change highlights in uncrustify-0.58 (19 May 2011) ------------------------------------------------------------------------------- New options: - tok_split_gte - sp_catch_paren - sp_scope_paren - sp_version_paren - cmt_insert_oc_msg_header See commit.log for details. Change highlights in uncrustify-0.57 (25 Nov 2010) ------------------------------------------------------------------------------- New options: - sp_func_call_paren_empty - nl_func_def_start - nl_func_def_start_single - nl_func_def_paren - nl_func_def_args - nl_func_def_empty - nl_func_def_end - nl_func_def_end_single See commit.log for details. Change highlights in uncrustify-0.56 (27 Mar 2010) ------------------------------------------------------------------------------- New options: - indent_continue - indent_cmt_with_tabs - indent_first_bool_expr - indent_braces_no_class - indent_braces_no_struct - indent_var_def_cont - sp_assign_default - sp_after_oc_at_sel_parens - sp_inside_oc_at_sel_parens - align_oc_decl_colon - nl_after_vbrace_close - nl_using_brace - mod_full_brace_using See commit.log for details. Change highlights in uncrustify-0.55 (27 Nov 2009) ------------------------------------------------------------------------------- - See the GIT history for a full list of changes - Fix align_left_shift with array indexes - Objective C changes (Andre Berg) - Fix a close paren added inside a preprocessor line - Fix handling of 'mutable' - New options - sp_endif_cmt - nl_func_decl_start_single - nl_func_decl_end_single - nl_after_vbrace_open_empty - Improved options - sp_before_ellipsis - nl_struct_brace - align_on_tabstop - align_with_tabs - align_left_shift - nl_func_type_name - nl_create_if_one_liner - pos_assign Changes in uncrustify-0.54 (16 Oct 2009) ------------------------------------------------------------------------------- - Add mod_case_brace - Add sp_after_semi_for and sp_after_semi - Add align_oc_msg_colon - ObjC: Do not set the parent of everything in a message at OC_MSG (was breaking casts) - ObjC: sp_before_square does not apply in "if (i < [a count])" - Fix crash bug in chunk_get_prev() at the start of the file - Fix issue with #if COND followed by a cast on the next line - Add nl_func_decl_empty - Add nl_func_type_name_class - Add cmt_reflow_mode (Ger Hobbelt) - A case statement starts an expression. Fixes "case -1:" - Improve semicolon removal test - fix marking of brace/paren pairs that have a preproc inside - fix nl_func_type_name where the return type contains a template - Add mod_full_brace_if_chain - fix detection of deref in a macro function - fix detection of "std::vector functions;" - Remove extra semicolons on an 'else if' - Add sp_before_ellipsis - treat a constructor the same as a function regarding nl_func_decl_* - Add nl_brace_brace - Allow any number of spaces between multi-line comments when combining them - Add pos_compare - Add pos_conditional - Fix indent_relative_single_line_comments - Add sp_after_oc_return_type and sp_after_oc_at_sel (Andre Berg) - Add indent_namespace_level (James LewisMoss) - Add indent_namespace_limit (Maciej Libera) Changes in uncrustify-0.53 (16 May 2009) ------------------------------------------------------------------------------- - Fix sp_inside_braces* options, which were broken by the fix to issue #2629652 - Fix sp_after_cast, which was broken by a previous fix - Be a little more agressive in removing unecessary semicolons - Fix one case where the parser leaves a preprocessor #define - Fix indent of line starting with '(' after a function name - Add align_var_def_attribute - Fix nl_func_type_name for function without a return type (ie, cast operator) - Reset up state variables after processing a file - Fix a case where a semicolon was incorrectly removed - Fix a case where braces were incorrectly removed - Fix handling of 'force' setting for many newline options - Add func_wrap type for use with 'set func_wrap FSUB' - Add type_wrap type for use with 'set type_wrap STACK_OF' - Make file replacement more atomic - write to a temp file then rename - With the 'replace' option, only replace if the file content changes - Handle C# wide literal string prefix S"foo" - Handle the ObjC '@protocol' the same as '@interface' - Add 'make check' and 'make clean' (Ger Hobbelt) - Add align_right_cmt_at_col (Ger Hobbelt) - Add sp_pp_concat and sp_pp_stringify (Ger Hobbelt) - Add mod_add_long_ifdef_{else,endif}_comment (Ger Hobbelt) - Objective C improvements (Etienne Samson) - Only mess with escaped newlines in a comment if inside a preprocessor - Fix pos_xxx options when a preprocessor is near - Apply Debian patch to man file - Fix '<<' indenting/aligning (moved from indent.cpp to align.cpp) - Rework the sp_before_nl_cont option - Fix a few other bugs Changes in uncrustify-0.52 (28 Feb 2009) ------------------------------------------------------------------------------- - Add sp_before_assign and sp_after_assign - Add sp_enum_before_assign and sp_enum_after_assign - Add indent_var_def_blk - Add sp_inside_sparen_close for the 'CGAL' style - First pass at supporting ECMAScript (.es) files - Add support for the C# '??' operator - Fix conflict between nl_after_func_proto_group and nl_squeeze_ifdef - Add sp_cmt_cpp_start - Add align_on_operator - Fix nl_func_type_name for operators - Allow '$' to be part of identifiers (global change) - Fix detection of the '*' in 'int a = b[0] * c;' - Fix and improve the description of nl_multi_line_cond - Fix handling of global namespace type such as '::sockaddr' - Add nl_after_brace_close - Add nl_func_scope_name - Add cmt_insert_file_footer Changes in uncrustify-0.51 (27 Nov 2008) ------------------------------------------------------------------------------- - Prefer to split at ',' and then '=' in for() statements if at paren level - Fix a NULL deref crash - Fix nl_namespace_brace when something trails the open brace - Get sp_after_sparen and sp_sparen_brace to play well together - Ignore trailing comments when inserting the function header comment - Combine two C comments when they have no space between them "/***//***/" - Add cmt_insert_before_preproc - Add mod_remove_empty_return - Add nl_comment_func_def - Fix aligning of anonymous bit fields - Add indent_align_assign - Add sp_before_case_colon - Fix D 'invariant' handling - Add sp_invariant_after_paren and sp_invariant_paren - Fix handling of the C# [assembly: xxx] construct - Fix handling of the C# 'base()' construct - Add sp_range for the D '..' range operator as in [start .. end] - Update $(fclass) and $(function) to handle operators - Improve handling of inserted comments - Enable 'finally' blocks for C# - Add nl_after_try_catch_finally - Add nl_between_get_set and nl_around_cs_property Changes in uncrustify-0.50 (25-Oct-2008) ------------------------------------------------------------------------------- - Fix sp_before_unnamed_ptr_star in 'char ** n' - Fix crash when a open brace is at the end of a file - ObjC class definitions do not need { } - Fix ObjC msg detection - Add sp_after_ptr_star_func, sp_before_ptr_star_func - Add sp_after_byref_func, sp_before_byref_func - Treat an ObjC msg decl more like a function def - Add indent_func_const, indent_func_throw (Thanks, Ron) - Fix detection of prototype inside extern or namespace braces - Add align_left_shift to handle aligning of '<<' - Add sp_cpp_cast_paren - Add support for ObjC '@property' statements - Add sp_brace_typedef and sp_case_label - Merge in the lastest UniversalIndent support (Thanks, Thomas!) - Fix extra '\r' in multi-line comments and strings - Add sp_throw_paren - Assume a '<' in a preprocessor can't be part of a template - Don't align a constructor with class variables - Fix ending column error when tokenizing strings Changes in uncrustify-0.49 (22-Aug-2008) ------------------------------------------------------------------------------- - Allow the MSVC++ '64' suffix on numbers - Initialize align_stack class members for the MSVC++ compiler - Indent a line that starts with '=' - Add pos_arith and pos_assign (Thanks, Ron!) - Fix pos_bool & code_width interaction (Thanks, Ron!) - Fix cmt_width, which was going one word over the limit. (Thanks, Ron!) - Major rework of the aligning code to better handle the gap options - Indent comments before 'case' at the same level as 'case' - mod_add_long_*_closebrace_comment adds the right comment type. (Thanks, Ron!) - Relax number parsing even further to accept stuff like "3A" - Add sp_after_oc_colon (Thanks, Kevin!) - Add better detection and labeling of Objective C messages - Add sp_after_send_oc_colon and sp_before_send_oc_colon (Thanks, Kevin!) - Fix detection of '*' in "return n * f();" - Add the 'set' config option which lets you create arbitrary keywords - Add sp_func_call_user_paren and the 'func_call_user' keyword type Changes in uncrustify-0.48 (18-Jul-2008) ------------------------------------------------------------------------------- - Fix classification of '(' in '#if defined (FOO)' - Add sp_defined_paren - Fix handling of negative in '#if X < -1' - Revert a change that broke indent continuation in an assignment - Fix interaction between nl_squeeze_ifdef and nl_after_{if,for,while,switch,do} - Preprocessor indents are indents, so indent_with_tabs=1 should do tabs - Add pp_indent_count - Handle C++ style casts, such as 'int(42.0)' a bit better - Another rework of template detection - Add sp_before_nl_cont, defaults to 'add' - If a statement starts with 'operator', it is a function call - Change sp_angle_word to be more generic - Add sp_after_operator_sym for "operator ++(" vs "operator ++ (" - Add sp_template_angle for "template<" vs "template <" - Add support for " *INDENT-OFF* " and " *INDENT-ON* " - Shuffle around spacing priorities - Add handling for '...' in variadic templates - Extend nl_template_class to handle anything after 'template <...>' - Treat the template '<' the same as '(' for indenting - Add indent_template_param - Split internal CT_CAST into CT_C_CAST, CT_CPP_CAST and CT_D_CAST - Swap priority of sp_after_angle and sp_before_ptr_star - Change cmt_multi_indent=false to disable all reformatting (needs more work) - Fix align_var_def_span - it wasn't counting newlines when it recursed - Add nl_else_if - mod_full_brace_if: Don't remove braces around certain 'else' statements - Tweak template detection a bit more - Rework and simplify multi-line comment indenting - Add indent_else_if - Improve right-comment aligning - Fix detection of functions with a 'const' return type - Add sp_cond_colon and sp_cond_question - Fine-tune the right comment align stuff - Add cmt_multi_check_last - Add align_right_cmt_gap - Add nl_return_expr - Indent FPAREN_OPEN if after a newline but not before a newline - Give sp_after_operator_sym priority over sp_func_call_paren - Add align_same_func_call_params Changes in uncrustify-0.47 (06-Jun-2008) ------------------------------------------------------------------------------- - Fix inifinite loop bug in reindent_line - Fix prototype detection with template parameter types - Fix off-by-1 error on positive values for indent_access_spec and indent_label - Add indent_extern to control indent extern-type namespaces - Add initial support for Objective C++ (extension '.mm') - Add nl_before_throw and indent 'throw' if after a prototype - Extend line numbers to 32 bits (used for logging) - Remove alternate token support for '<%', '%>', '<:', ':>', '%:', and '%:%:' - Fix recently-broken mixing of right-comment aligning (PP_ENDIF/PP_ELSE issue) - Indent a 'break' that follows a fully-braced 'case' at the level of the close brace - Add mod_move_case_break - Fix '&' and '*' after 'delete' - Escape opening '/*' when converting C++ comments to C comments - Add sp_inside_braces_empty - Fix cmt_sp_after_star_cont - Fix cmt_sp_before_star_cont - Explicitly disallow a tab after a space - Improve multi-line comment indenting a bit - Add sp_before_unnamed_byref and sp_before_unnamed_ptr_star Changes in uncrustify-0.46 (22-Apr-2008) ------------------------------------------------------------------------------- - Load the config file, if available, before handling '--universalindent' - Add align_var_def_gap, align_var_def_colon_gap, align_var_struct_gap, align_func_proto_gap, align_mix_var_proto, align_single_line_brace_gap - (internal) Eliminate the 'trailer' stuff, simplify aligning Changes in uncrustify-0.45 (7-Mar-2008) ------------------------------------------------------------------------------- - Fix buffer overflow in logger code - Add sp_enum_assign - For elipses handling in the GCC extension "case 1 ... 5:" - Add sp_after_class_colon, sp_before_class_colon, and sp_after_type - Send usage text to stdout instead of stderr - Fix mod_add_long_function_closebrace_comment if the file doesn't end in a newline - Redo alignments after splitting long lines - Add indent_relative_single_line_comments - Add indent_access_spec_body - Fix indent_func_proto_param to work on constructors - Add cmt_indent_multi - Add align_single_line_brace and align_single_line_func - Fix interaction of virtual braces and #pragma - Fix indenting problem with an assignment the last part of a for() - Fix the order of opening files so that '-f' and '-o' can be used together - Added a man file - Many improvements thanks to Stas Grabois - Fix a D problem due the lack of semicolons after struct/enum definitions - Improve the way aligning is done Changes in uncrustify-0.44 (12-Feb-2008) ------------------------------------------------------------------------------- - Fix issue with #else and unmatched braces (issue 1868493) - Update UnivarsalIndentGUI config output - Add the version to generated config files - Add nl_multi_line_define - Minimize distance between code and the backslash-newline in macros - Properly handle stuff like '#define MYHEADER ' - Fix detection of 'int foo(int);' in C++ (func proto, not class variable) - Improve handling of multi-line comments in a macro - Fix crash bug with some ctype implementations - Fix incorrect indenting of nested #endif with pp_if_indent_code - Fix problem with nl_after_if and nl_before_if w/ trailing comments Changes in uncrustify-0.43 (08-Jan-2008) ------------------------------------------------------------------------------- - Add align_right_cmt_mix to control aligning of comments after '}' and '#endif' - Allow a line split after an assignment - Fix infinite loop bug - Add sp_sign and sp_incdec - Fix vbrace conversion where some are converted and some aren't - Add a vbrace before a #pragma instead of after - Improve Objective C support - Add sp_before_oc_colon, sp_after_oc_scope, and sp_after_oc_type for ObjC - Add align_oc_msg_spec_span for ObjC - Add sp_member for spacing around '->' and '.' - More template handling improvements - Fix a NULL dereference related to __attribute__ Changes in uncrustify-0.42 (30-Nov-2007) ------------------------------------------------------------------------------- - Fix bug that would remove a newline after a C++ comment - Add "--mtime" command line option to preserve the mtime - Remove extra semicolons before inserting newlines after semicolons - Fix broken struct initializer alignment - Fix problem with pos_class_comma in a #define - Fix problem with an incomplete statement in a #define and virtual braces - Add indent_func_proto_param and indent_func_def_param - Add nl_func_proto_type_name, split from nl_func_type_name - Add mod_add_long_switch_closebrace_comment, mod_add_long_function_closebrace_comment - Add mod_sort_import to sort import statements (Java/D) - Add mod_sort_using to sort using statements (C#) - Add mod_sort_include to sort #include (C/C++) and #import (ObjC) statements - Add indent_func_class_param, indent_func_ctor_var_param, and indent_func_param_double - Fix inserting a newline before a preprocessor - Don't split empty function parens for code_width stuff Changes in uncrustify-0.41 (07-Nov-2007) ------------------------------------------------------------------------------- - Add cmt_insert_func_header, cmt_insert_file_header, and cmt_insert_class_header - Fix detection of prototypes without named parameters - sp_after_byref and sp_after_ptr_star only are applied if before a word - internal rework - Add pp_define_at_level - Fix detection of deref in "sizeof *x" - Fix broken output of backslash-newline in certain situations - Fix pp_indent_if stuff - Add nl_after_brace_open_cmt - Properly handle anonymous namespaces - Add pp_space_count Changes in uncrustify-0.40 (12-Oct-2007) ------------------------------------------------------------------------------- - Simplify preprocessor indenting - Add pp_indent_region and pp_region_indent_code - Add pp_indent_at_level - Add pp_indent_if and pp_if_indent_code - Add initial VALA support - Fix a problem with mod_full_paren_if_bool and functions - Add nl_func_paren - Fix function type parameter marking (broken in the last few releases) - Don't remove newline chunks before/after a preprocessor Changes in uncrustify-0.39 (25-Sep-2007) ------------------------------------------------------------------------------- - Improve conversion operators - Prevent undesired chunk combining ("~ ~" vs "~~" in D) - Add nl_after_multiline_comment - Fix handling of try/catch/finally blocks in virtual braces - Add sp_inv, sp_not, sp_addr, sp_deref (default to remove) - Fix nl_class_brace - Fix indent_func_call_param - Add nl_create_if_one_liner, nl_create_for_one_liner, nl_create_while_one_liner - Add indent_preserve_sql - Fix one-liner detection with multiple statements on one line - Add nl_func_leave_one_liners and nl_if_leave_one_liners - More template improvements Changes in uncrustify-0.38 (04-Sep-2007) ------------------------------------------------------------------------------- - Fix line splitting WRT the CT_SPACE token - Improve function call/prototype/definition detection - Fix some spacing issues - More template improvements - Allow for a C++ struct constructor - Add nl_before_access_spec and nl_after_access_spec - Add cmt_width, cmt_c_group, cmt_c_nl_start, cmt_c_nl_end - Handle conversion operators Changes in uncrustify-0.37 (16-Aug-2007) ------------------------------------------------------------------------------- - A bunch of D language improvements - Add sp_d_array_colon, nl_assign_square, nl_after_square_assign - Fix static keyword sort order - Improve typedef detection and aligning - Split nl_ds_struct_enum_close_brace out of nl_ds_struct_enum_cmt - Add indent_paren_close - Add indent_comma_paren and indent_bool_paren Changes in uncrustify-0.36 (04-Aug-2007) ------------------------------------------------------------------------------- - Add nl_after_vbrace_open - Improve option descriptions - Fix seg faults (check for NULL) - Fix spacing for operators () and [] - Add sp_before_dc and sp_after_dc to control spacing around '::' - Split pos_class_comma from pos_comma - Improve line splitting a little - no longer break at '::' or '->' or '.' - Add nl_enum_leave_one_liners and nl_getset_leave_one_liners - Add mod_remove_extra_semicolon - Fix handling of macro-open and macro-close - Add align_var_struct_thresh - Improve handling of comments after braces - Add support for Qt slots and signals - Add align_typedef_amp_style and align_var_def_amp_style - Add sp_attribute_paren and handling of the '__attribute__' macro - Add align_typedef_func, improve aligning of typedefs - Add sp_after_semi_for_empty Changes in uncrustify-0.35 (14-Jul-2007) ------------------------------------------------------------------------------- - Fix bug with nl_func_type_name and empty param list: int foo() { ... } - Don't parse pragma bodies - Properly indent multiline #error and #warning - Change nl_after_func_body to force the newline count (was a minimum) - Fix handling of CT_PTR_STAR when all options are AV_IGNORE - Fix problem when the first token in the file isn't in column 1 - Properly mark catch clauses that contain parameters, ie catch (Exception *e) - Add a newline after the open brace for nl_catch_brace, nl_do_brace, nl_else_brace, nl_try_brace, nl_getset_brace, nl_finally_brace - Add nl_multi_line_cond - Fix a bug with mod_full_paren_if_bool - Fix handling of templated variables: Buffer* buf - Fix handling of dynamic_cast(obj) stuff - Fix detection of templates in for() statements: for (std::map::iterator it = map.begin(); ... - Add --no-backup command-line option to replace w/o a backup file - Fix nl_class_leave_one_liners when set to false - Add nl_class_colon, which split the functionality of nl_class_init_args - Improve detection of reference variable declarations (A& B) Changes in uncrustify-0.34 (11-May-2007) ------------------------------------------------------------------------------- - Add sp_angle_paren and sp_angle_word - Properly handle multi-line CPP comments - Add sp_inside_paren_cast - improve indent_class_colon - fix indenting on open parens - Add sp_before_semi_for_empty - Fix detection of while if the do is in a preprocessor chunk (1675673) - (pawn) Don't add vsemi after case/switch brace close (1684840) - Add nl_assign_leave_one_liners to allow "foo_t foo = { 0, 1 };" - Change handling of #region stuff so that it is indented at brace level - Fix handling of missing semicolon after while-of-do. - Fix crash-bug in handling bad code: "if (a && );" - Add pos_comma Changes in uncrustify-0.33 (05-Mar-2007) ------------------------------------------------------------------------------- - Fix converting C++ comments with embedded C comments - Fix nl_func_var_def_blk with class variables - Fix some output issues with the 1st line and C++ comments - Eliminate indent_case_body, which wasn't used - Change rules for indenting case braces and the use of indent_case_brace - Fix variable declaration detection at the start of a code block - Add support for custom open/close indenting macros MACRO_OPEN, MACRO_ELSE, MACRO_CLOSE - Fix the config updating routines to NOT lose custom types and stuff - Add nl_after_func_body_one_liner - Fix nl_class_init_args - Add --universalindent option to output an ini file for UniversalIndentGUI Changes in uncrustify-0.32 (20-Feb-2007) ------------------------------------------------------------------------------- - Enable align_proto_var_def for constructors - Fix while-of-do handling inside virtual braces - Fix problem with comments between a close brace and else - Add sp_before_comma - Change align_var_def_star to align_var_def_star_style - Change align_proto_var_def to align_func_params - Add ls_func_split_full and ls_for_split_full - Rework code width code a bit - Start Objective C support - Add cmt_sp_before_star_cont and cmt_sp_after_star_cont - Fix spacing between (( and )) - Add nl_try_brace, nl_catch_brace, nl_finally_brace, nl_brace_catch, nl_brace_finally, sp_catch_brace, sp_brace_catch, sp_finally_brace, sp_brace_finally, sp_try_brace - Treat typedef functions the same as other function for param aligning - Turn any word after a enum/struct/union into a type - Add sp_getset_brace and nl_getset_brace - Add mod_full_paren_if_bool - Add nl_before_c_comment and nl_before_cpp_comment - Fix nl_class_leave_one_liners - Add nl_ds_struct_enum_cmt - Add sp_balance_nested_parens Changes in uncrustify-0.31 (24-Jan-2007) ------------------------------------------------------------------------------- - Improve mixed tab indent / space align - Try to fix spacing around embedded comments - Add indent_access_spec - Add __func__ and __FUNCTION__ detection for non-C99 compilers - General code cleanup (Thanks Tom!) - Add indent_xml_string - Add align_proto_var_def to align variables in prototypes Changes in uncrustify-0.30 (24-Nov-2006) ------------------------------------------------------------------------------- - Use environment variable UNCRUSTIFY_CONFIG if no '-c' option (non-WIN32) - Default to ~/.uncrustify.cfg if no '-c' option and no env var (non-WIN32) - Add '-q' option to the usage info - Added initial embedded SQL support - Many bug fixes - New options: indent_braces_no_func, indent_sing_line_comments, nl_before_if, nl_before_for, nl_after_for, nl_before_while, nl_after_while, nl_before_switch, nl_after_switch, nl_before_do, nl_after_do Changes in uncrustify-0.29 (26-Oct-2006) ------------------------------------------------------------------------------- - Add support for the 'Klaus' style - Fix a bunch of c++ template bugs - Add option nl_class_leave_one_liners Changes in uncrustify-0.28 (06-Oct-2006) ------------------------------------------------------------------------------- - Fix D range array detection a[1..4] => a[1 .. 4] - Fix D delegate variable aligning - More documentation updates (thanks Dirk!) - New options: nl_after_semicolon and nl_after_open_brace Changes in uncrustify-0.27 (23-Sep-2006) ------------------------------------------------------------------------------- - Improve template detection again (allow CT_TYPE in a template) - Fix bad formatting in "[ABC * 123]" and "[0xf & *val]" - Add --replace option to convert files in-place - Use a map for the options - Major configuration/option cleanup - add -o option to write to a file instead of stdout Changes in uncrustify-0.26 (09-Sep-2006) (removed a number from the version) ------------------------------------------------------------------------------- - Fix preprocessor labeling WRT comments - Fix an indenting problem - Add sp_after_byref - Fix alignment of global variable definitions - Fix detection of deref inside squares: a[*p] - Fix a weird indenting bug - Fix D template ! spacing - Add sp_after_operator - Add nl_template_class - Add start to detailed docs inside the program - Add --prefix and --suffix command line args - Add align_enum_equ_thresh and fix align_enum_equ_span - Fix formatting of function typedefs - Add indent_member - Simplify the indenting code a bit - Improve type_cast stuff (ie, dynamic_cast<> or static_cast<>) and templates Changes in uncrustify-0.0.25 (26-Aug-2006) ------------------------------------------------------------------------------- - Add sp_after_ptr_star, sp_before_ptr_star, sp_between_ptr_star - Fix D tokenizing for numbers and strings - Fix a bug with cast detection and with nl_after_func_proto - Improve template detection - Rename nl_bool_pos to pos_bool - Add pos_class_colon - Add indent_class_colon - Add nl_class_init_args - Add nl_collapse_empty_body - Add indent_square_nl Changes in uncrustify-0.0.24 (05-Aug-2006) ------------------------------------------------------------------------------- - Add initial PAWN support (thanks to Derek Evan Mart for testing and motivation!) - Fix parsing of numbers like 10.0 - Fix double negative (- -x) vs (--x) - Add ability to convert C++ (//) comments into C (/* */) comments - Fix usage of indent_columns; output_tab_size is only needed if using tabs - Add first small step in code width handling - New options: sp_fparen_brace, sp_macro, sp_marco_func, nl_elseif_brace, mod_pawn_semicolon, cmt_cpp_to_c, cmt_cpp_group, cmt_cpp_nl_start, cmt_cpp_nl_end, sp_after_tag Changes in uncrustify-0.0.23 (22-Jul-2006) ------------------------------------------------------------------------------- - Fix some crash bugs and some formatting problems - Fix Windows CRLF issues (binary vs text mode) - Add indent_class and indent_namespace - Add nl_class_brace and nl_namespace_brace - Add handling of operator stuff in CPP - Improve the test script a bit - Add sp_inside_fparens - Add ability to define types in the config file - Started work on improving #ifdef handling by evaluating the preprocessor Changes in uncrustify-0.0.22 (15-Jul-2006) ------------------------------------------------------------------------------- - Implement nl_max, nl_before_block_comment, nl_after_func_body, nl_after_func_proto, nl_after_func_proto_group - Improve detection of function prototypes - Improve marking of function prototype-related tokens - Improve variable definition aligning - fix align_var_def threshold - Improve handling of "private:" style stuff - Handle types with "::" in them - Add preprocessor spacing and indenting - Fix tab indenting style 1 (tab indent, space align) - Improve multi-line comment formatting Changes in uncrustify-0.0.21 (01-Jul-2006) ------------------------------------------------------------------------------- - Clean up some memory leaks & uninitialized variables - Add option to process multiple files at once - Change the newlines values from [UNIX, DOS, MAC] to [LF, CRLF, CR] - Properly mark the parens for functions - Implement control over the format of the function prototypes and definitions - Update configuration.txt Changes in uncrustify-0.0.20 (10-Jun-2006) ------------------------------------------------------------------------------- - Fix cast on a sizeof: (INT32)sizeof(x) - Fix this: "#define SOME_JUNK /*lint -e123 */(const mytype_t *)-1" - Don't align function typedefs (fixed again) - Finally fix the DOS and MAC line-ending support - Add line-ending autodetection - Add Windows build support Changes in uncrustify-0.0.19 (27-May-2006) ------------------------------------------------------------------------------- - Fix C/C++/C# casts - Improve D casts Changes in uncrustify-0.0.18 (12-May-2006) ------------------------------------------------------------------------------- - Add nl_bool_pos to move boolean ops between eol and sol - Improve C99 array initializer aligning/formatting - Replace nl_eat_start, nl_eat_end, and nl_eof_min with nl_start_of_file, nl_start_of_file_min, nl_end_of_file, and nl_end_of_file_min Changes in uncrustify-0.0.17 (03-May-2006) ------------------------------------------------------------------------------- - Add nl_eat_start to remove newlines at the start of the file - Add nl_eat_end to remove newlines at the end of the file - Add nl_eof_min to set the minimum number of newlines at the end of file - Add newlines setting to configure the newline output - Add '-q' command line option to turn off logging - Fix bug in nl_func_var_def_blk handling Changes in uncrustify-0.0.16 (21-Apr-2006) ------------------------------------------------------------------------------- - Add a stack alignment helper class - Improve typedef formatting - Add aligning thresholds for typedefs and assignments - update the automake/autoconf stuff Changes in uncrustify-0.0.15 (14-Apr-2006) ------------------------------------------------------------------------------- - Switch to C++ - Improve C++ template formatting - Improve C++ class handling Changes in uncrustify-0.0.14 (09-Apr-2006) ------------------------------------------------------------------------------- - Read from stdin if no file is specified - Build on OS X Changes in uncrustify-0.0.13 (07-Apr-2006) ------------------------------------------------------------------------------- - Rewrite the indent code - Fix a bunch of small problems with C casts - Rename a few files - Add more tests Changes in uncrustify-0.0.12 (30-Mar-2006) ------------------------------------------------------------------------------- - Add support for D template format "Foo!(int,char)" - Fix a format bug in a log - Fix elipsis spacing (remove space before elipsis) - Don't use getopt as it isn't all that portable (at least for QNX) - Rename some files - Bugfix: don't add virtual braces on the same line as a preprocessor - Bugfix: clean up indexed array aligning Changes in uncrustify-0.0.11 (27-Mar-2006) ------------------------------------------------------------------------------- - fix brace analysis on else statement - allow options to depend on other options - set the parent for case braces - handle/indent the C++ class colon thingy - handle C++ constructors and function defs - special handling for '::' operator - implement case indenting - handle cout '<<' indenting - handle DOS and MAC line endings in multiline comments - rename some indent options - fix ifndef handling - fix volatile handling - fix private/public/protected 'label' handling - alternate punctuators are also part of C++ - handle C++ wide L"strings" - improve C# get/set handling - fix spacing bug "a++;" vs "a ++;" due to statement start misdetect - add nl_assign_brace - fix parent of vbrace close - more test enhancements Changes in uncrustify-0.0.10 (22-Mar-2006) ------------------------------------------------------------------------------- - Complete rewrite of tokenizer and brace parser - Added support for D nested comments - Fixed some virtual brace bugs - Added some documentation for the brace parsing stuff - Add more tests to improve coverage (still lacking) Changes in uncrustify-0.0.9 (18-Mar-2006) ------------------------------------------------------------------------------- - Major enhancements for D - Add handling for special "[]" sequence for C#/D - add some more tests Changes in uncrustify-0.0.8 (13-Mar-2006) ------------------------------------------------------------------------------- - update TODO list - add a threshold for brace removal - improve brace removal - keep track of whether a token follows a tab - add option to preserve non-indenting tabs - major keyword and operator cleanup for C++, C#, D, and Java - add 'string' variants for ARITH, COMPARE, etc - add C# get/set detection - add template detection - add colon handling for class stuff and anonymous bitfields - pop the whole indent stack when leaving a preprocessor - fix embedded return handling in C#, ie: [ this should return negative ] - fix a problem with the ifdef frame stack (still a problem lurking...) - handle literal strings (C#) - handle non-keyword words (C#) -- example: @if @switch - set the parent on 'do' braces - handle C# #region preprocessor stuff - partially implement align on tabstop - fix virtual brace spacing (no more "else return;" => "elsereturn;") - add some more tests uncrustify-0.59/win32/0000755000175000017500000000000011635774366011647 500000000000000uncrustify-0.59/win32/Uncrustify_Win32.dsp0000644000175000017500000001767111506773275015443 00000000000000# Microsoft Developer Studio Project File - Name="Uncrustify_Win32" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Console Application" 0x0103 CFG=Uncrustify_Win32 - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE !MESSAGE NMAKE /f "Uncrustify_Win32.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE !MESSAGE NMAKE /f "Uncrustify_Win32.mak" CFG="Uncrustify_Win32 - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "Uncrustify_Win32 - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "Uncrustify_Win32 - Win32 Debug" (based on "Win32 (x86) Console Application") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe RSC=rc.exe !IF "$(CFG)" == "Uncrustify_Win32 - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I ".\\" /I ".\win32\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/Uncrustify.exe" !ELSEIF "$(CFG)" == "Uncrustify_Win32 - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".\\" /I ".\win32\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/Uncrustify.exe" /pdbtype:sept !ENDIF # Begin Target # Name "Uncrustify_Win32 - Win32 Release" # Name "Uncrustify_Win32 - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE=..\src\align.cpp # End Source File # Begin Source File SOURCE=..\src\align_stack.cpp # End Source File # Begin Source File SOURCE=..\src\args.cpp # End Source File # Begin Source File SOURCE=..\src\backup.cpp # End Source File # Begin Source File SOURCE=..\src\brace_cleanup.cpp # End Source File # Begin Source File SOURCE=..\src\braces.cpp # End Source File # Begin Source File SOURCE=..\src\chunk_list.cpp # End Source File # Begin Source File SOURCE=..\src\ChunkStack.cpp # End Source File # Begin Source File SOURCE=..\src\combine.cpp # End Source File # Begin Source File SOURCE=..\src\defines.cpp # End Source File # Begin Source File SOURCE=..\src\detect.cpp # End Source File # Begin Source File SOURCE=..\src\indent.cpp # End Source File # Begin Source File SOURCE=..\src\keywords.cpp # End Source File # Begin Source File SOURCE=..\src\lang_pawn.cpp # End Source File # Begin Source File SOURCE=..\src\logger.cpp # End Source File # Begin Source File SOURCE=..\src\logmask.cpp # End Source File # Begin Source File SOURCE=..\src\md5.cpp # End Source File # Begin Source File SOURCE=..\src\newlines.cpp # End Source File # Begin Source File SOURCE=..\src\options.cpp # End Source File # Begin Source File SOURCE=..\src\output.cpp # End Source File # Begin Source File SOURCE=..\src\parens.cpp # End Source File # Begin Source File SOURCE=..\src\parse_frame.cpp # End Source File # Begin Source File SOURCE=..\src\punctuators.cpp # End Source File # Begin Source File SOURCE=..\src\semicolons.cpp # End Source File # Begin Source File SOURCE=..\src\sorting.cpp # End Source File # Begin Source File SOURCE=..\src\space.cpp # End Source File # Begin Source File SOURCE=..\src\tokenize.cpp # End Source File # Begin Source File SOURCE=..\src\tokenize_cleanup.cpp # End Source File # Begin Source File SOURCE=..\src\uncrustify.cpp # End Source File # Begin Source File SOURCE=..\src\universalindentgui.cpp # End Source File # Begin Source File SOURCE=..\src\width.cpp # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE=..\src\align_stack.h # End Source File # Begin Source File SOURCE=..\src\args.h # End Source File # Begin Source File SOURCE=..\src\backup.h # End Source File # Begin Source File SOURCE=..\src\base_types.h # End Source File # Begin Source File SOURCE=..\src\char_table.h # End Source File # Begin Source File SOURCE=..\src\chunk_list.h # End Source File # Begin Source File SOURCE=..\src\ChunkStack.h # End Source File # Begin Source File SOURCE=..\src\config.h # End Source File # Begin Source File SOURCE=..\src\ListManager.h # End Source File # Begin Source File SOURCE=..\src\log_levels.h # End Source File # Begin Source File SOURCE=..\src\logger.h # End Source File # Begin Source File SOURCE=..\src\logmask.h # End Source File # Begin Source File SOURCE=..\src\md5.h # End Source File # Begin Source File SOURCE=..\src\options.h # End Source File # Begin Source File SOURCE=..\src\prototypes.h # End Source File # Begin Source File SOURCE=..\src\punctuators.h # End Source File # Begin Source File SOURCE=..\src\token_enum.h # End Source File # Begin Source File SOURCE=..\src\token_names.h # End Source File # Begin Source File SOURCE=..\src\uncrustify_types.h # End Source File # Begin Source File SOURCE=..\src\uncrustify_version.h # End Source File # Begin Source File SOURCE=.\windows_compat.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project uncrustify-0.59/win32/Uncrustify_Win32.sln0000644000175000017500000000160111506773275015433 00000000000000 Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Uncrustify_Win32", "Uncrustify_Win32.vcproj", "{743E549D-6BCA-4E81-8DCF-C34B85AF8373}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {743E549D-6BCA-4E81-8DCF-C34B85AF8373}.Debug|Win32.ActiveCfg = Debug|Win32 {743E549D-6BCA-4E81-8DCF-C34B85AF8373}.Debug|Win32.Build.0 = Debug|Win32 {743E549D-6BCA-4E81-8DCF-C34B85AF8373}.Release|Win32.ActiveCfg = Release|Win32 {743E549D-6BCA-4E81-8DCF-C34B85AF8373}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal uncrustify-0.59/win32/Uncrustify_Win32.vcproj0000644000175000017500000005245411635774366016163 00000000000000 uncrustify-0.59/win32/Uncrustify_Win32_2010.vcxproj0000644000175000017500000002421711633534163016774 00000000000000 Debug Win32 Release Win32 {743E549D-6BCA-4E81-8DCF-C34B85AF8373} true MultiByte MultiByte <_ProjectFileVersion>10.0.40219.1 .\Debug\ .\Debug\ true .\Release\ .\Intermediate\Release\ false AllRules.ruleset AllRules.ruleset .\Debug/Uncrustify_Win32.tlb Disabled .\;.\win32\;..\src\;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreadedDebug false EditAndContinue uncrustify_types.h Level3 true EnableFastChecks .\Debug/ 4996 _DEBUG;%(PreprocessorDefinitions) 0x0409 Debug/Uncrustify.exe .\Debug/Uncrustify.pdb Console true setargv.obj;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) .\Release/Uncrustify_Win32.tlb Full AnySuitable true Speed true true .\;.\win32\;..\src\;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true MultiThreaded true .\Release/ false ProgramDatabase uncrustify_types.h true Level3 4996 NDEBUG;%(PreprocessorDefinitions) 0x0409 Release/Uncrustify.exe .\Release/Uncrustify.pdb Console false setargv.obj;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) uncrustify-0.59/win32/Uncrustify_Win32_2005.vcproj0000644000175000017500000005360111506773275016617 00000000000000 uncrustify-0.59/win32/windows_compat.h0000644000175000017500000000266311506773275014777 00000000000000/** * @file windows_compat.h * Hacks to work with different versions of windows. * This is only included if WIN32 is set. * * @author Ben Gardner * @license GPL v2+ */ #ifndef WINDOWS_COMPAT_H_INCLUDED #define WINDOWS_COMPAT_H_INCLUDED #define HAVE_SYS_STAT_H #define NO_MACRO_VARARG typedef char CHAR; typedef signed char INT8; typedef short INT16; typedef int INT32; typedef unsigned char UINT8; typedef unsigned short UINT16; typedef unsigned int UINT32; typedef unsigned long long UINT64; #ifndef PRIx64 #define PRIx64 "llx" #endif /* eliminate GNU's attribute */ #define __attribute__(x) /* MSVC compilers before VC7 don't have __func__ at all; later ones call it * __FUNCTION__. */ #ifdef _MSC_VER #if _MSC_VER < 1300 #define __func__ "???" #else #define __func__ __FUNCTION__ #endif #else /* _MSC_VER */ #define __func__ "???" #endif #include "stdio.h" #include "string.h" #undef snprintf #define snprintf _snprintf #undef vsnprintf #define vsnprintf _vsnprintf #undef strcasecmp #define strcasecmp _strcmpi #undef strncasecmp #define strncasecmp _strnicmp #undef strdup #define strdup _strdup #undef fileno #define fileno _fileno /* includes for _setmode() */ #include #include #include #define mkdir(x, y) _mkdir(x) #define PATH_SEP '\\' #endif /* WINDOWS_COMPAT_H_INCLUDED */ uncrustify-0.59/win32/Uncrustify_Win32_2005.sln0000644000175000017500000000317111506773275016105 00000000000000 Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Uncrustify_Win32", "Uncrustify_Win32_2005.vcproj", "{C7201F61-A1A5-4C7E-9632-58AE9EFF408F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Itanium = Debug|Itanium Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Itanium = Release|Itanium Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Debug|Itanium.ActiveCfg = Debug|Itanium {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Debug|Itanium.Build.0 = Debug|Itanium {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Debug|Win32.ActiveCfg = Debug|Win32 {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Debug|Win32.Build.0 = Debug|Win32 {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Debug|x64.ActiveCfg = Debug|x64 {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Debug|x64.Build.0 = Debug|x64 {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Release|Itanium.ActiveCfg = Release|Itanium {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Release|Itanium.Build.0 = Release|Itanium {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Release|Win32.ActiveCfg = Release|Win32 {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Release|Win32.Build.0 = Release|Win32 {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Release|x64.ActiveCfg = Release|x64 {C7201F61-A1A5-4C7E-9632-58AE9EFF408F}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal uncrustify-0.59/win32/Uncrustify_Win32.dsw0000644000175000017500000000105311506773275015435 00000000000000Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "Uncrustify_Win32"=.\Uncrustify_Win32.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### uncrustify-0.59/NEWS0000644000175000017500000000002711506773275011316 00000000000000No news is good news! uncrustify-0.59/COPYING0000644000175000017500000004311011506773276011653 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. uncrustify-0.59/install-sh0000755000175000017500000003253711642741011012616 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End:

This class is a member of the * * Java Collections Framework. * * @since 1.5 * @author Doug Lea * @param the type of keys maintained by this map * @param the type of mapped values */ class HashMap { alias void[] K; alias Object V; alias jhash hash; // jhash, fnv, or walter /* * The basic strategy is to subdivide the table among Segments, * each of which itself is a concurrently readable hash table. */ /* ---------------- Constants -------------- */ /** * The default initial number of table slots for this table. * Used when not otherwise specified in constructor. */ private const uint DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum capacity, used if a higher value is implicitly * specified by either of the constructors with arguments. MUST * be a power of two <= 1<<30 to ensure that entries are indexible * using ints. */ private const uint MAXIMUM_CAPACITY = 1 << 30; /** * The default load factor for this table. Used when not * otherwise specified in constructor. */ private const float DEFAULT_LOAD_FACTOR = 0.75f; /** * The default number of concurrency control segments. **/ private const uint DEFAULT_SEGMENTS = 16; /** * The maximum number of segments to allow; used to bound * constructor arguments. */ private const uint MAX_SEGMENTS = 1 << 16; // slightly conservative /* ---------------- Fields -------------- */ /** * Mask value for indexing into segments. The upper bits of a * key's hash code are used to choose the segment. **/ private final int segmentMask; /** * Shift value for indexing within segments. **/ private final int segmentShift; /** * The segments, each of which is a specialized hash table */ private final Segment[] segments; /* ---------------- Small Utilities -------------- */ /** * Returns a hash code for non-null Object x. * Uses the same hash code spreader as most other java.util hash tables. * @param x the object serving as a key * @return the hash code */ private static final uint walter(K x) { uint h = typeid(char[]).getHash(&x); h += ~(h << 9); h ^= (h >>> 14); h += (h << 4); h ^= (h >>> 10); return h; } /** * Returns a hash code for non-null Object x. * uses the FNV hash function * @param x the object serving as a key * @return the hash code */ private static final uint fnv(K x) { uint hash = 2_166_136_261; foreach (ubyte c; cast(ubyte[])x) { hash ^= c; hash *= 16_777_619; } return hash; } /** * hash() -- hash a variable-length key into a 32-bit value * k : the key (the unaligned variable-length array of bytes) * len : the length of the key, counting by bytes * level : can be any 4-byte value * Returns a 32-bit value. Every bit of the key affects every bit of * the return value. Every 1-bit and 2-bit delta achieves avalanche. * About 36+6len instructions. * * The best hash table sizes are powers of 2. There is no need to do * mod a prime (mod is sooo slow!). If you need less than 32 bits, * use a bitmask. For example, if you need only 10 bits, do * h = (h & hashmask(10)); * In which case, the hash table should have hashsize(10) elements. * * If you are hashing n strings (ub1 **)k, do it like this: * for (i=0, h=0; i= 12) { a += *cast(uint *)(k + 0); b += *cast(uint *)(k + 4); c += *cast(uint *)(k + 8); a -= b; a -= c; a ^= (c >> 13); b -= c; b -= a; b ^= (a << 8); c -= a; c -= b; c ^= (b >> 13); a -= b; a -= c; a ^= (c >> 12); b -= c; b -= a; b ^= (a << 16); c -= a; c -= b; c ^= (b >> 5); a -= b; a -= c; a ^= (c >> 3); b -= c; b -= a; b ^= (a << 10); c -= a; c -= b; c ^= (b >> 15); k += 12; len -= 12; } // handle the last 11 bytes c += x.length; switch (len) { case 11: c += (cast(uint)k[10] << 24); case 10: c += (cast(uint)k[9] << 16); case 9: c += (cast(uint)k[8] << 8); case 8: b += (cast(uint)k[7] << 24); case 7: b += (cast(uint)k[6] << 16); case 6: b += (cast(uint)k[5] << 8); case 5: b += k[4]; case 4: a += (cast(uint)k[3] << 24); case 3: a += (cast(uint)k[2] << 16); case 2: a += (cast(uint)k[1] << 8); case 1: a += k[0]; default: } a -= b; a -= c; a ^= (c >> 13); b -= c; b -= a; b ^= (a << 8); c -= a; c -= b; c ^= (b >> 13); a -= b; a -= c; a ^= (c >> 12); b -= c; b -= a; b ^= (a << 16); c -= a; c -= b; c ^= (b >> 5); a -= b; a -= c; a ^= (c >> 3); b -= c; b -= a; b ^= (a << 10); c -= a; c -= b; c ^= (b >> 15); return c; } /** * Returns the segment that should be used for key with given hash * @param hash the hash code for the key * @return the segment */ private final Segment segmentFor(uint hash) { return segments[(hash >>> segmentShift) & segmentMask]; } /* ---------------- Inner Classes -------------- */ /** * ConcurrentHashMap list entry. Note that this is never exported * out as a user-visible Map.Entry. * * Because the value field is volatile, not final, it is legal wrt * the Java Memory Model for an unsynchronized reader to see null * instead of initial value when read via a data race. Although a * reordering leading to this is not likely to ever actually * occur, the Segment.readValueUnderLock method is used as a * backup in case a null (pre-initialized) value is ever seen in * an unsynchronized access method. */ private static class HashEntry { final K key; final uint hash; final V value; final HashEntry next; this(K key, uint hash, HashEntry next, V value) { this.key = key; this.hash = hash; this.next = next; this.value = value; } } /** * Segments are specialized versions of hash tables. This * subclasses from ReentrantLock opportunistically, just to * simplify some locking and avoid separate construction. **/ static class Segment { /* * Segments maintain a table of entry lists that are ALWAYS * kept in a consistent state, so can be read without locking. * Next fields of nodes are immutable (final). All list * additions are performed at the front of each bin. This * makes it easy to check changes, and also fast to traverse. * When nodes would otherwise be changed, new nodes are * created to replace them. This works well for hash tables * since the bin lists tend to be short. (The average length * is less than two for the default load factor threshold.) * * Read operations can thus proceed without locking, but rely * on selected uses of volatiles to ensure that completed * write operations performed by other threads are * noticed. For most purposes, the "count" field, tracking the * number of elements, serves as that volatile variable * ensuring visibility. This is convenient because this field * needs to be read in many read operations anyway: * * - All (unsynchronized) read operations must first read the * "count" field, and should not look at table entries if * it is 0. * * - All (synchronized) write operations should write to * the "count" field after structurally changing any bin. * The operations must not take any action that could even * momentarily cause a concurrent read operation to see * inconsistent data. This is made easier by the nature of * the read operations in Map. For example, no operation * can reveal that the table has grown but the threshold * has not yet been updated, so there are no atomicity * requirements for this with respect to reads. * * As a guide, all critical volatile reads and writes to the * count field are marked in code comments. */ /** * The number of elements in this segment's region. **/ int count; /** * The table is rehashed when its size exceeds this threshold. * (The value of this field is always (int)(capacity * * loadFactor).) */ int threshold; /** * The per-segment table. Declared as a raw type, casted * to HashEntry on each use. */ HashEntry[] table; /** * The load factor for the hash table. Even though this value * is same for all segments, it is replicated to avoid needing * links to outer object. * @serial */ final float loadFactor; this(int initialCapacity, float lf) { loadFactor = lf; setTable(new HashEntry[initialCapacity]); } /** * Set table to new HashEntry array. * Call only while holding lock or in constructor. **/ private final void setTable(HashEntry[] newTable) { threshold = cast(int)(newTable.length * loadFactor); volatile table = newTable; } /** * Return properly casted first entry of bin for given hash */ private final HashEntry getFirst(uint hash) { HashEntry[] tab; volatile tab = table; return tab[hash & (tab.length - 1)]; } /** * Return true if the two keys match */ private static final bool matchKey(K a, K b) { if (a.length == b.length) return cast(bool)(memcmp(cast(char *)a, cast(char *)b, a.length) == 0); return false; } /* Specialized implementations of map methods */ final V get(K key, uint hash) { int c; // read-volatile volatile c = count; if (c) { HashEntry e = getFirst(hash); while (e) { if (hash == e.hash && matchKey(key, e.key)) { V v; volatile v = e.value; if (v) return v; synchronized (this) return e.value; } e = e.next; } } return null; } final bool containsKey(K key, uint hash) { int c; // read-volatile volatile c = count; if (c) { HashEntry e = getFirst(hash); while (e) { if (e.hash == hash && matchKey(key, e.key)) return true; e = e.next; } } return false; } final synchronized V replace(K key, uint hash, V newValue) { HashEntry e = getFirst(hash); while (e && (e.hash != hash || !matchKey(key, e.key))) e = e.next; V oldValue = null; if (e) volatile { oldValue = e.value; e.value = newValue; } return oldValue; } final synchronized V put(K key, uint hash, V value, bool onlyIfAbsent) { int c; volatile c = count; if (c++ > threshold) rehash(); HashEntry[] tab; volatile tab = table; uint index = hash & (tab.length - 1); HashEntry first = tab[index]; HashEntry e = first; while (e && (e.hash != hash || !matchKey(key, e.key))) e = e.next; V oldValue; if (e) { volatile oldValue = e.value; if (!onlyIfAbsent) volatile e.value = value; } else { oldValue = null; tab[index] = new HashEntry(key, hash, first, value); // write-volatile volatile count = c; } return oldValue; } private final void rehash() { HashEntry[] oldTable; volatile oldTable = table; int oldCapacity = oldTable.length; if (oldCapacity >= MAXIMUM_CAPACITY) return; /* * Reclassify nodes in each list to new Map. Because we are * using power-of-two expansion, the elements from each bin * must either stay at same index, or move with a power of two * offset. We eliminate unnecessary node creation by catching * cases where old nodes can be reused because their next * fields won't change. Statistically, at the default * threshold, only about one-sixth of them need cloning when * a table doubles. The nodes they replace will be garbage * collectable as soon as they are no longer referenced by any * reader thread that may be in the midst of traversing table * right now. */ HashEntry[] newTable = new HashEntry[oldCapacity << 1]; threshold = cast(int)(newTable.length * loadFactor); int sizeMask = newTable.length - 1; for (int i = 0; i < oldCapacity; ++i) { // We need to guarantee that any existing reads of old Map can // proceed. So we cannot yet null out each bin. HashEntry e = oldTable[i]; if (e) { HashEntry next = e.next; uint idx = e.hash & sizeMask; // Single node on list if (next is null) newTable[idx] = e; else { // Reuse trailing consecutive sequence at same slot HashEntry lastRun = e; int lastIdx = idx; for (HashEntry last = next; last; last = last.next) { uint k = last.hash & sizeMask; if (k != lastIdx) { lastIdx = k; lastRun = last; } } newTable[lastIdx] = lastRun; // Clone all remaining nodes for (HashEntry p = e; p !is lastRun; p = p.next) { uint k = p.hash & sizeMask; HashEntry n = newTable[k]; newTable[k] = new HashEntry(p.key, p.hash, n, p.value); } } } } volatile table = newTable; } /** * Remove; match on key only if value null, else match both. */ final synchronized V remove(K key, uint hash, V value) { int c; HashEntry[] tab; volatile c = count - 1; volatile tab = table; uint index = hash & (tab.length - 1); HashEntry first = tab[index]; HashEntry e = first; while (e && (e.hash != hash || !matchKey(key, e.key))) e = e.next; V oldValue = null; if (e) { V v; volatile v = e.value; if (value is null || value == v) { oldValue = v; // All entries following removed node can stay // in list, but all preceding ones need to be // cloned. HashEntry newFirst = e.next; for (HashEntry p = first; p !is e; p = p.next) newFirst = new HashEntry(p.key, p.hash, newFirst, p.value); tab[index] = newFirst; // write-volatile volatile count = c; } } return oldValue; } final synchronized void clear() { if (count) { HashEntry[] tab; volatile tab = table; for (int i = 0; i < tab.length; i++) tab[i] = null; // write-volatile volatile count = 0; } } } /* ---------------- Public operations -------------- */ /** * Creates a new, empty map with the specified initial * capacity and the specified load factor. * * @param initialCapacity the initial capacity. The implementation * performs internal sizing to accommodate this many elements. * @param loadFactor the load factor threshold, used to control resizing. * @param concurrencyLevel the estimated number of concurrently * updating threads. The implementation performs internal sizing * to try to accommodate this many threads. * @throws IllegalArgumentException if the initial capacity is * negative or the load factor or concurrencyLevel are * nonpositive. */ public this(uint initialCapacity, float loadFactor, uint concurrencyLevel) { assert(loadFactor > 0); if (concurrencyLevel > MAX_SEGMENTS) concurrencyLevel = MAX_SEGMENTS; // Find power-of-two sizes best matching arguments int sshift = 0; int ssize = 1; while (ssize < concurrencyLevel) { ++sshift; ssize <<= 1; } segmentShift = 32 - sshift; segmentMask = ssize - 1; this.segments = new Segment[ssize]; if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; int c = initialCapacity / ssize; if (c * ssize < initialCapacity) ++c; int cap = 1; while (cap < c) cap <<= 1; for (int i = 0; i < this.segments.length; ++i) this.segments[i] = new Segment(cap, loadFactor); } /** * Creates a new, empty map with the specified initial * capacity, and with default load factor and concurrencyLevel. * * @param initialCapacity The implementation performs internal * sizing to accommodate this many elements. * @throws IllegalArgumentException if the initial capacity of * elements is negative. */ public this(uint initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); } /** * Creates a new, empty map with a default initial capacity, * load factor, and concurrencyLevel. */ public this() { this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); } /** * Returns the value to which the specified key is mapped in this table. * * @param key a key in the table. * @return the value to which the key is mapped in this table; * null if the key is not mapped to any value in * this table. * @throws NullPointerException if the key is * null. */ public V get(K key) { uint hash = hash(key); // throws NullPointerException if key null return segmentFor(hash).get(key, hash); } /** * Tests if the specified object is a key in this table. * * @param key possible key. * @return true if and only if the specified object * is a key in this table, as determined by the * equals method; false otherwise. * @throws NullPointerException if the key is * null. */ public bool containsKey(K key) { uint hash = hash(key); // throws NullPointerException if key null return segmentFor(hash).containsKey(key, hash); } /** * Maps the specified key to the specified * value in this table. Neither the key nor the * value can be null. * *

This class is a member of the * * Java Collections Framework. * * @since 1.5 * @author Doug Lea * @param the type of keys maintained by this map * @param the type of mapped values */ class HashMap { alias void[] K; alias Object V; alias jhash hash; // jhash, fnv, or walter /* * The basic strategy is to subdivide the table among Segments, * each of which itself is a concurrently readable hash table. */ /* ---------------- Constants -------------- */ /** * The default initial number of table slots for this table. * Used when not otherwise specified in constructor. */ private const uint DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum capacity, used if a higher value is implicitly * specified by either of the constructors with arguments. MUST * be a power of two <= 1<<30 to ensure that entries are indexible * using ints. */ private const uint MAXIMUM_CAPACITY = 1 << 30; /** * The default load factor for this table. Used when not * otherwise specified in constructor. */ private const float DEFAULT_LOAD_FACTOR = 0.75f; /** * The default number of concurrency control segments. **/ private const uint DEFAULT_SEGMENTS = 16; /** * The maximum number of segments to allow; used to bound * constructor arguments. */ private const uint MAX_SEGMENTS = 1 << 16; // slightly conservative /* ---------------- Fields -------------- */ /** * Mask value for indexing into segments. The upper bits of a * key's hash code are used to choose the segment. **/ private final int segmentMask; /** * Shift value for indexing within segments. **/ private final int segmentShift; /** * The segments, each of which is a specialized hash table */ private final Segment[] segments; /* ---------------- Small Utilities -------------- */ /** * Returns a hash code for non-null Object x. * Uses the same hash code spreader as most other java.util hash tables. * @param x the object serving as a key * @return the hash code */ private static final uint walter(K x) { uint h = typeid(char[]).getHash (&x); h += ~(h << 9); h ^= (h >>> 14); h += (h << 4); h ^= (h >>> 10); return h; } /** * Returns a hash code for non-null Object x. * uses the FNV hash function * @param x the object serving as a key * @return the hash code */ private static final uint fnv(K x) { uint hash = 2_166_136_261; foreach (ubyte c; cast(ubyte[]) x) { hash ^= c; hash *= 16_777_619; } return hash; } /** * hash() -- hash a variable-length key into a 32-bit value * k : the key (the unaligned variable-length array of bytes) * len : the length of the key, counting by bytes * level : can be any 4-byte value * Returns a 32-bit value. Every bit of the key affects every bit of * the return value. Every 1-bit and 2-bit delta achieves avalanche. * About 36+6len instructions. * * The best hash table sizes are powers of 2. There is no need to do * mod a prime (mod is sooo slow!). If you need less than 32 bits, * use a bitmask. For example, if you need only 10 bits, do * h = (h & hashmask(10)); * In which case, the hash table should have hashsize(10) elements. * * If you are hashing n strings (ub1 **)k, do it like this: * for (i=0, h=0; i= 12) { a += *cast(uint *)(k+0); b += *cast(uint *)(k+4); c += *cast(uint *)(k+8); a -= b; a -= c; a ^= (c>>13); b -= c; b -= a; b ^= (a<<8); c -= a; c -= b; c ^= (b>>13); a -= b; a -= c; a ^= (c>>12); b -= c; b -= a; b ^= (a<<16); c -= a; c -= b; c ^= (b>>5); a -= b; a -= c; a ^= (c>>3); b -= c; b -= a; b ^= (a<<10); c -= a; c -= b; c ^= (b>>15); k += 12; len -= 12; } // handle the last 11 bytes c += x.length; switch (len) { case 11: c+=(cast(uint)k[10]<<24); case 10: c+=(cast(uint)k[9]<<16); case 9 : c+=(cast(uint)k[8]<<8); case 8 : b+=(cast(uint)k[7]<<24); case 7 : b+=(cast(uint)k[6]<<16); case 6 : b+=(cast(uint)k[5]<<8); case 5 : b+=k[4]; case 4 : a+=(cast(uint)k[3]<<24); case 3 : a+=(cast(uint)k[2]<<16); case 2 : a+=(cast(uint)k[1]<<8); case 1 : a+=k[0]; default: } a -= b; a -= c; a ^= (c>>13); b -= c; b -= a; b ^= (a<<8); c -= a; c -= b; c ^= (b>>13); a -= b; a -= c; a ^= (c>>12); b -= c; b -= a; b ^= (a<<16); c -= a; c -= b; c ^= (b>>5); a -= b; a -= c; a ^= (c>>3); b -= c; b -= a; b ^= (a<<10); c -= a; c -= b; c ^= (b>>15); return c; } /** * Returns the segment that should be used for key with given hash * @param hash the hash code for the key * @return the segment */ private final Segment segmentFor(uint hash) { return segments[(hash >>> segmentShift) & segmentMask]; } /* ---------------- Inner Classes -------------- */ /** * ConcurrentHashMap list entry. Note that this is never exported * out as a user-visible Map.Entry. * * Because the value field is volatile, not final, it is legal wrt * the Java Memory Model for an unsynchronized reader to see null * instead of initial value when read via a data race. Although a * reordering leading to this is not likely to ever actually * occur, the Segment.readValueUnderLock method is used as a * backup in case a null (pre-initialized) value is ever seen in * an unsynchronized access method. */ private static class HashEntry { final K key; final uint hash; final V value; final HashEntry next; this (K key, uint hash, HashEntry next, V value) { this.key = key; this.hash = hash; this.next = next; this.value = value; } } /** * Segments are specialized versions of hash tables. This * subclasses from ReentrantLock opportunistically, just to * simplify some locking and avoid separate construction. **/ static class Segment { /* * Segments maintain a table of entry lists that are ALWAYS * kept in a consistent state, so can be read without locking. * Next fields of nodes are immutable (final). All list * additions are performed at the front of each bin. This * makes it easy to check changes, and also fast to traverse. * When nodes would otherwise be changed, new nodes are * created to replace them. This works well for hash tables * since the bin lists tend to be short. (The average length * is less than two for the default load factor threshold.) * * Read operations can thus proceed without locking, but rely * on selected uses of volatiles to ensure that completed * write operations performed by other threads are * noticed. For most purposes, the "count" field, tracking the * number of elements, serves as that volatile variable * ensuring visibility. This is convenient because this field * needs to be read in many read operations anyway: * * - All (unsynchronized) read operations must first read the * "count" field, and should not look at table entries if * it is 0. * * - All (synchronized) write operations should write to * the "count" field after structurally changing any bin. * The operations must not take any action that could even * momentarily cause a concurrent read operation to see * inconsistent data. This is made easier by the nature of * the read operations in Map. For example, no operation * can reveal that the table has grown but the threshold * has not yet been updated, so there are no atomicity * requirements for this with respect to reads. * * As a guide, all critical volatile reads and writes to the * count field are marked in code comments. */ /** * The number of elements in this segment's region. **/ int count; /** * The table is rehashed when its size exceeds this threshold. * (The value of this field is always (int)(capacity * * loadFactor).) */ int threshold; /** * The per-segment table. Declared as a raw type, casted * to HashEntry on each use. */ HashEntry[] table; /** * The load factor for the hash table. Even though this value * is same for all segments, it is replicated to avoid needing * links to outer object. * @serial */ final float loadFactor; this (int initialCapacity, float lf) { loadFactor = lf; setTable (new HashEntry[initialCapacity]); } /** * Set table to new HashEntry array. * Call only while holding lock or in constructor. **/ private final void setTable (HashEntry[] newTable) { threshold = cast(int) (newTable.length * loadFactor); volatile table = newTable; } /** * Return properly casted first entry of bin for given hash */ private final HashEntry getFirst (uint hash) { HashEntry[] tab; volatile tab = table; return tab [hash & (tab.length - 1)]; } /** * Return true if the two keys match */ private static final bool matchKey (K a, K b) { if (a.length == b.length) return cast(bool) (memcmp (cast(char*) a, cast(char*) b, a.length) == 0); return false; } /* Specialized implementations of map methods */ final V get (K key, uint hash) { int c; // read-volatile volatile c = count; if (c) { HashEntry e = getFirst (hash); while (e) { if (hash == e.hash && matchKey (key, e.key)) { V v; volatile v = e.value; if (v) return v; synchronized (this) return e.value; } e = e.next; } } return null; } final bool containsKey (K key, uint hash) { int c; // read-volatile volatile c = count; if (c) { HashEntry e = getFirst (hash); while (e) { if (e.hash == hash && matchKey (key, e.key)) return true; e = e.next; } } return false; } final synchronized V replace (K key, uint hash, V newValue) { HashEntry e = getFirst(hash); while (e && (e.hash != hash || !matchKey (key, e.key))) e = e.next; V oldValue = null; if (e) volatile { oldValue = e.value; e.value = newValue; } return oldValue; } final synchronized V put (K key, uint hash, V value, bool onlyIfAbsent) { int c; volatile c = count; if (c++ > threshold) rehash(); HashEntry[] tab; volatile tab = table; uint index = hash & (tab.length - 1); HashEntry first = tab[index]; HashEntry e = first; while (e && (e.hash != hash || !matchKey (key, e.key))) e = e.next; V oldValue; if (e) { volatile oldValue = e.value; if (!onlyIfAbsent) volatile e.value = value; } else { oldValue = null; tab[index] = new HashEntry (key, hash, first, value); // write-volatile volatile count = c; } return oldValue; } private final void rehash () { HashEntry[] oldTable; volatile oldTable = table; int oldCapacity = oldTable.length; if (oldCapacity >= MAXIMUM_CAPACITY) return; /* * Reclassify nodes in each list to new Map. Because we are * using power-of-two expansion, the elements from each bin * must either stay at same index, or move with a power of two * offset. We eliminate unnecessary node creation by catching * cases where old nodes can be reused because their next * fields won't change. Statistically, at the default * threshold, only about one-sixth of them need cloning when * a table doubles. The nodes they replace will be garbage * collectable as soon as they are no longer referenced by any * reader thread that may be in the midst of traversing table * right now. */ HashEntry[] newTable = new HashEntry[oldCapacity << 1]; threshold = cast(int) (newTable.length * loadFactor); int sizeMask = newTable.length - 1; for (int i = 0; i < oldCapacity ; ++i) { // We need to guarantee that any existing reads of old Map can // proceed. So we cannot yet null out each bin. HashEntry e = oldTable[i]; if (e) { HashEntry next = e.next; uint idx = e.hash & sizeMask; // Single node on list if (next is null) newTable[idx] = e; else { // Reuse trailing consecutive sequence at same slot HashEntry lastRun = e; int lastIdx = idx; for (HashEntry last=next; last; last = last.next) { uint k = last.hash & sizeMask; if (k != lastIdx) { lastIdx = k; lastRun = last; } } newTable[lastIdx] = lastRun; // Clone all remaining nodes for (HashEntry p = e; p !is lastRun; p = p.next) { uint k = p.hash & sizeMask; HashEntry n = newTable[k]; newTable[k] = new HashEntry(p.key, p.hash, n, p.value); } } } } volatile table = newTable; } /** * Remove; match on key only if value null, else match both. */ final synchronized V remove (K key, uint hash, V value) { int c; HashEntry[] tab; volatile c = count - 1; volatile tab = table; uint index = hash & (tab.length - 1); HashEntry first = tab[index]; HashEntry e = first; while (e && (e.hash != hash || !matchKey (key, e.key))) e = e.next; V oldValue = null; if (e) { V v; volatile v = e.value; if (value is null || value == v) { oldValue = v; // All entries following removed node can stay // in list, but all preceding ones need to be // cloned. HashEntry newFirst = e.next; for (HashEntry p = first; p !is e; p = p.next) newFirst = new HashEntry (p.key, p.hash, newFirst, p.value); tab[index] = newFirst; // write-volatile volatile count = c; } } return oldValue; } final synchronized void clear() { if (count) { HashEntry[] tab; volatile tab = table; for (int i = 0; i < tab.length ; i++) tab[i] = null; // write-volatile volatile count = 0; } } } /* ---------------- Public operations -------------- */ /** * Creates a new, empty map with the specified initial * capacity and the specified load factor. * * @param initialCapacity the initial capacity. The implementation * performs internal sizing to accommodate this many elements. * @param loadFactor the load factor threshold, used to control resizing. * @param concurrencyLevel the estimated number of concurrently * updating threads. The implementation performs internal sizing * to try to accommodate this many threads. * @throws IllegalArgumentException if the initial capacity is * negative or the load factor or concurrencyLevel are * nonpositive. */ public this (uint initialCapacity, float loadFactor, uint concurrencyLevel) { assert (loadFactor > 0); if (concurrencyLevel > MAX_SEGMENTS) concurrencyLevel = MAX_SEGMENTS; // Find power-of-two sizes best matching arguments int sshift = 0; int ssize = 1; while (ssize < concurrencyLevel) { ++sshift; ssize <<= 1; } segmentShift = 32 - sshift; segmentMask = ssize - 1; this.segments = new Segment[ssize]; if (initialCapacity > MAXIMUM_CAPACITY) initialCapacity = MAXIMUM_CAPACITY; int c = initialCapacity / ssize; if (c * ssize < initialCapacity) ++c; int cap = 1; while (cap < c) cap <<= 1; for (int i = 0; i < this.segments.length; ++i) this.segments[i] = new Segment (cap, loadFactor); } /** * Creates a new, empty map with the specified initial * capacity, and with default load factor and concurrencyLevel. * * @param initialCapacity The implementation performs internal * sizing to accommodate this many elements. * @throws IllegalArgumentException if the initial capacity of * elements is negative. */ public this (uint initialCapacity) { this(initialCapacity, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); } /** * Creates a new, empty map with a default initial capacity, * load factor, and concurrencyLevel. */ public this () { this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_SEGMENTS); } /** * Returns the value to which the specified key is mapped in this table. * * @param key a key in the table. * @return the value to which the key is mapped in this table; * null if the key is not mapped to any value in * this table. * @throws NullPointerException if the key is * null. */ public V get (K key) { uint hash = hash(key); // throws NullPointerException if key null return segmentFor(hash).get(key, hash); } /** * Tests if the specified object is a key in this table. * * @param key possible key. * @return true if and only if the specified object * is a key in this table, as determined by the * equals method; false otherwise. * @throws NullPointerException if the key is * null. */ public bool containsKey (K key) { uint hash = hash(key); // throws NullPointerException if key null return segmentFor(hash).containsKey(key, hash); } /** * Maps the specified key to the specified * value in this table. Neither the key nor the * value can be null. * *