diff options
Diffstat (limited to 'debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input')
1040 files changed, 29165 insertions, 0 deletions
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/1225.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/1225.c new file mode 100644 index 00000000..c6533cb1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/1225.c @@ -0,0 +1,6 @@ +float ign_guy(){} +a alig_guy(){} +int align_guy(){} +unsigned int align_here(); +int this_works(int x); +int bug(int); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue-2278.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue-2278.c new file mode 100644 index 00000000..1ecfecf5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue-2278.c @@ -0,0 +1,10 @@ +typedef int LIST_tzHEAD; +typedef int tucBOOL; +struct LIST_zNODE { int a; int b;}; +struct LIST_zzzDATA { int a; int b;}; + +int foo1( LIST_tzHEAD *pList, + tucBOOL ( *pFn )( struct LIST_zNODE *pNode, + struct LIST_zzzDATA *pListData, + void *arg1 ), + void *arg2 ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2279.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2279.c new file mode 100644 index 00000000..88c0ae84 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2279.c @@ -0,0 +1,9 @@ +/*| AG_DECLARE() |*/ +/* *INDENT-OFF* */ +static int x; +/* *INDENT-ON* */ +/*| END |*/ + +static FILE *ramfp = NULL; +static FILE *dbgfp = NULL; +static xxxXXXXX *pLockXXX = NULL; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2360.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2360.c new file mode 100644 index 00000000..dd4530c7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2360.c @@ -0,0 +1,39 @@ +int short_function(); +int some_very_very_very_very_very_very_very_very_long_function(); +int main() { + // short condition, no existing newlines + if (short_function()) {} + + // short condition, existing newlines + if ( + short_function() + ) {} + + // long condition, no newlines + if (some_very_very_very_very_very_very_very_very_long_function() && + some_very_very_very_very_very_very_very_very_long_function()) {} + + // long condition, newlines + else if ( + some_very_very_very_very_very_very_very_very_long_function() && + some_very_very_very_very_very_very_very_very_long_function() + ) {} + + // switch condition + switch (some_very_very_very_very_very_very_very_very_long_function() && + some_very_very_very_very_very_very_very_very_long_function()) { + case default: break; + } + + // while condition, line comments + while ( + // comment 1 + short_function() + // comment 2 + ) {} + + // for condition, inline comments + for ( /* a */ int i=0; some_very_very_very_very_very_very_very_very_long_function() + && some_very_very_very_very_very_very_very_very_long_function() && i < 10; i++ // trailing comment + ){} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2411.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2411.c new file mode 100644 index 00000000..40244488 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2411.c @@ -0,0 +1,5 @@ +void foo() { + /* + hello world + */ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2640.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2640.c new file mode 100644 index 00000000..ba25bcbe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2640.c @@ -0,0 +1,12 @@ +struct Struct +{ + void test1(int* x) + { + *x = 1; + } +}; + +void test2(int* x) +{ + *x = 1; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2845.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2845.h new file mode 100644 index 00000000..9f34b1dc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/Issue_2845.h @@ -0,0 +1,3 @@ +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT __packed struct +#endif diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/add_long_comment.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/add_long_comment.c new file mode 100644 index 00000000..5900de52 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/add_long_comment.c @@ -0,0 +1,36 @@ +/** + * 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(); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-equ.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-equ.c new file mode 100644 index 00000000..374ccbfb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-equ.c @@ -0,0 +1,31 @@ + +// 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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-proto-vars.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-proto-vars.c new file mode 100644 index 00000000..e1dd71ff --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-proto-vars.c @@ -0,0 +1,12 @@ +int 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); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-proto.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-proto.c new file mode 100644 index 00000000..64dfce00 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-proto.c @@ -0,0 +1,4 @@ +unsigned int align_here(); +int this_works(int x); +int bug(int); // BUG: left-aligned + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-string.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-string.c new file mode 100644 index 00000000..f652e88f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-string.c @@ -0,0 +1,14 @@ + +// 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"); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-struct-init.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-struct-init.c new file mode 100644 index 00000000..084994ff --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-struct-init.c @@ -0,0 +1,48 @@ + +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 }, +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-typedef.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-typedef.c new file mode 100644 index 00000000..ae17eb4d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-typedef.c @@ -0,0 +1,11 @@ + +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; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-var.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-var.c new file mode 100644 index 00000000..adbf8a98 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align-var.c @@ -0,0 +1,52 @@ +struct 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); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_attr.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_attr.c new file mode 100644 index 00000000..0f4cfee1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_attr.c @@ -0,0 +1,4 @@ + +char test[3] _PREPROCESSOR_SOMETHING; +int numberThatIsReallyCool _PREPROCESSOR_SOMETHING; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_keep_extra.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_keep_extra.c new file mode 100644 index 00000000..2bc0f532 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_keep_extra.c @@ -0,0 +1,5 @@ +void f() +{ + int x= 3; + int b = 4; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_span_418.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_span_418.c new file mode 100644 index 00000000..421b9547 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_span_418.c @@ -0,0 +1,7 @@ +int main(int argc, char const *argv[]) +{ + align_prams( param1 + param1, param2, param3 ); + + + align_prams( p4, p5, p6 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_span_419.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_span_419.c new file mode 100644 index 00000000..421b9547 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_span_419.c @@ -0,0 +1,7 @@ +int main(int argc, char const *argv[]) +{ + align_prams( param1 + param1, param2, param3 ); + + + align_prams( p4, p5, p6 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_thresh_416.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_thresh_416.c new file mode 100644 index 00000000..f4f6606e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_thresh_416.c @@ -0,0 +1,5 @@ +int main(int argc, char const *argv[]) +{ + align_prams( param1 + longParamToWhichLargeIndentToAlignFor, param2, param3 ); + align_prams( p4, p5, p6 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_thresh_417.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_thresh_417.c new file mode 100644 index 00000000..c3c881eb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_sf_call_thresh_417.c @@ -0,0 +1,5 @@ +int main(int argc, char const *argv[]) +{ + align_prams( param1 + longParamToWhichLargeIndentToAlignFor, param2, param3 ); + align_prams( p4, p5, p6 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_stack.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_stack.c new file mode 100644 index 00000000..0f88df06 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/align_stack.c @@ -0,0 +1,5 @@ +static int idx; +static const char **tmp; + +static int** tmp; +static char buf[64]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/asm.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/asm.c new file mode 100644 index 00000000..1fb5015c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/asm.c @@ -0,0 +1,9 @@ +void foo(void) +{ + asm __volatile__ ( + "subl %2,%0\n\t" + "sbbl %3,%1" + :"=a" (l), "=d" (h) + :"g" (sl), "g" (sh), + "0" (l), "1" (h)); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/attribute.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/attribute.c new file mode 100644 index 00000000..babe229f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/attribute.c @@ -0,0 +1,4 @@ +__attribute__((visibility("default"))) int* i; +__attribute__((visibility("default"))) FooString* i; + +#define DEFINE_NOTIFICATION(name) extern "C" __attribute__((visibility ("default"))) FooString* const name = #name; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/backslash-newline-lex.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/backslash-newline-lex.c new file mode 100644 index 00000000..0f20388c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/backslash-newline-lex.c @@ -0,0 +1,4 @@ +void f () { g ("\ +"); + g ("\n", stdout); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/beautifier-off.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/beautifier-off.c new file mode 100644 index 00000000..033179cb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/beautifier-off.c @@ -0,0 +1,32 @@ + + +#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"); + +int main(int argc, char *argv[]) +{ +/* *INDENT-OFF* */ + + int a, b; +a = 1; // stupid comment \ +b = 2; + +/* *INDENT-ON* */ +return(a+b); +} + +/* *INDENT-OFF* */ +int a; +/* *INDENT-ON* */ + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bits.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bits.c new file mode 100644 index 00000000..9a12f484 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bits.c @@ -0,0 +1,7 @@ +struct foo { + unsigned long bar; + u_int ndots : 4, +nsort: 4, +: 0; +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bool-pos.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bool-pos.c new file mode 100644 index 00000000..d6887223 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bool-pos.c @@ -0,0 +1,61 @@ +void 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); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/br_cmt.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/br_cmt.c new file mode 100644 index 00000000..4e57d2de --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/br_cmt.c @@ -0,0 +1,14 @@ +int main() +{ + if( foo == bar ) + { /* this works */ + a; + }else + if( ranz != bar ) + { /* this works too */ + b; + }else + { /* this is broken */ + c; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove.c new file mode 100644 index 00000000..c62506e3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove.c @@ -0,0 +1,78 @@ + +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 +} + +int main() +{ + while (1) { + if (0) + break; + switch (1) { + case 1: + break; + } + } + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove2.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove2.c new file mode 100644 index 00000000..e5b73723 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove2.c @@ -0,0 +1,52 @@ +/* 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; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove3.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove3.c new file mode 100644 index 00000000..9cde8bbd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace-remove3.c @@ -0,0 +1,31 @@ +void foo() +{ +if(myBoolean) { +#ifdef DEBUG +printf("ACK"); +#endif +} +return true; +} + +void foo2() +{ + if (m_errno == ERR_NONE) { + function1(variables); + function2(variables); + } else { + function1(varialbes); + } + //MyComment1 + //MyComment2 +} + +void foo3() +{ + if (statment) + if (statment) { + condition; + return true; + } + return false; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace.c new file mode 100644 index 00000000..31f3b42b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/brace.c @@ -0,0 +1,13 @@ +
+
+
+int function(int arg) {
+ int i;
+ for (i=0;i<5;i++){
+ /* Do something... */
+ }
+ if(i<0){
+ /*Do something else...*/ }
+
+ return 0;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-2.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-2.c new file mode 100644 index 00000000..a34d73d8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-2.c @@ -0,0 +1,14 @@ +while (a >= 0) +{ + if (b) + for (j = 0; j < 10; j++) + { + if (j == b) + { + return; + } + a++; + } + b--; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-3.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-3.c new file mode 100644 index 00000000..1f1a2066 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-3.c @@ -0,0 +1,9 @@ +{ + list_for_each(k) { + if (a) + if (b) + { + c++; + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-4.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-4.c new file mode 100644 index 00000000..385f4a8e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-4.c @@ -0,0 +1,12 @@ +int foo(int bar) +{ +#ifndef CONFIG_1 + bar -= 3; +#else + for (j = 0; j < NR_CPUS; j++) + if (cpu_online(j)) + bar++; +#endif + return 0; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-5.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-5.c new file mode 100644 index 00000000..c77cc912 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces-5.c @@ -0,0 +1,20 @@ +/** + * 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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces.c new file mode 100644 index 00000000..20733afc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/braces.c @@ -0,0 +1,79 @@ + +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() {} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bsnl.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bsnl.c new file mode 100644 index 00000000..b2b38b8e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bsnl.c @@ -0,0 +1,5 @@ +# define SOME_MACRO \ + bool has_err; \ + bool is_comp;\ + struct some_stream ostream + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1041.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1041.c new file mode 100644 index 00000000..193c750b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1041.c @@ -0,0 +1,6 @@ +void (*g_func_table[32])(void) = { + [0 ... 31] = func_dummy, + [0] = func_0, + [1] = func_1, + [2] = func_2, +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1196.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1196.c new file mode 100644 index 00000000..9fdabca6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1196.c @@ -0,0 +1,9 @@ +#ifdef __cplusplus
+extern "C" {
+#endif
+
+void foo(void);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1702.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1702.c new file mode 100644 index 00000000..bf74c8bd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1702.c @@ -0,0 +1,29 @@ +extern struct device device_list[]; +extern struct device device_list_end[]; + +static int +device_probe(struct device *dev) +{ + int err; +} + +/* ===================== */ +struct scpi_mem { + struct scpi_msg tx_msg; /**< The reply to be sent to a client. */ + struct scpi_msg rx_msg; /**< The request received from a client. */ +}; + +struct scpi_buffer { + struct scpi_mem mem; /**< Memory for the request/reply messages. */ + uint8_t client; /**< Client that should receive the reply. */ + bool busy; /**< Flag telling if this buffer is in use. */ +}; + +static void +scpi_receive_message(struct device *dev __unused, uint8_t client, uint32_t msg) +{ + struct scpi_buffer *buffer; + struct scpi_msg *rx_msg = &SCPI_MEM_AREA(client).rx_msg; + + assert(dev == scpi_msgbox); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1718.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1718.c new file mode 100644 index 00000000..eaddc974 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_1718.c @@ -0,0 +1,8 @@ +switch (code) +{ +case A: +#ifdef XXX + func(code); +#endif + break; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_2331.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_2331.c new file mode 100644 index 00000000..f30c53d3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_2331.c @@ -0,0 +1,11 @@ +#define SET_STACK(stack) \ + do { \ + __asm__ __volatile__ ( \ + "mov S, %[oper]" \ + : \ + : [oper] "r" (stack) \ + : "S" \ + ); \ + } while (0) + +int somearray [10]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_489.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_489.c new file mode 100644 index 00000000..e83d351b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_489.c @@ -0,0 +1,6 @@ +#define UHI_AOA { \
+ .install = uhi_aoa_install, \
+ .enable = uhi_aoa_enable, \
+ .uninstall = uhi_aoa_uninstall, \
+ .sof_notify = NULL, \
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_671.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_671.c new file mode 100644 index 00000000..01a3b02b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_671.c @@ -0,0 +1,15 @@ +#define FOO_MAX 10 + +bool foo[FOO_MAX]; + +void +foo_bar( int a, + int* b, + bool foo[FOO_MAX] ); + +void A() +{ + int a; + int *b; + foo_bar( a, b, foo); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_222.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_222.c new file mode 100644 index 00000000..4f0ded31 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_222.c @@ -0,0 +1,6 @@ +whatever *find_node_for_address(whatever2 *foo, + thingy *bar, + whatever3 *(func_ptr)( + whatever4 *foo2, + thingy2 *bar2)); +//3456789=123456789=123456789=123456789=123456789=12 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_771.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_771.c new file mode 100644 index 00000000..c933487d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_771.c @@ -0,0 +1,17 @@ +typedef struct Foo_s { + int a; + int *b; + float **c; + bool *******d; + FooBar ***A; + FoBar ***B; +}FooS; + +typedef struct Foo_a { + int a; + int *b; + float **c; + bool *******d; + FooBar ***A; + FoBar ***B; +}FooA; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_876.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_876.c new file mode 100644 index 00000000..ab2a05db --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bug_i_876.c @@ -0,0 +1 @@ +#define A 1 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-1.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-1.c new file mode 100644 index 00000000..39050c07 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-1.c @@ -0,0 +1,52 @@ +int 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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-2.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-2.c new file mode 100644 index 00000000..42bed259 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-2.c @@ -0,0 +1,22 @@ +static 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++; + } + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-3.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-3.c new file mode 100644 index 00000000..4f85044a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-3.c @@ -0,0 +1,48 @@ + +#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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-4.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-4.c new file mode 100644 index 00000000..e01c2c32 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-4.c @@ -0,0 +1,26 @@ + +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 +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-5.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-5.c new file mode 100644 index 00000000..626eb7e6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-5.c @@ -0,0 +1,13 @@ + +static void log_roll_file(log_output_t *plo) +{ + INT32 retcode; + const CHAR *name_save; + const CHAR *name_temp; + + if (plo->pfile != NULL) + { + + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-6.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-6.c new file mode 100644 index 00000000..99ebbdda --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-6.c @@ -0,0 +1,19 @@ +/*=-------------------------------------------------------------------------=*\ +* +| 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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-7.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-7.c new file mode 100644 index 00000000..a879aa17 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-7.c @@ -0,0 +1,25 @@ + +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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-8.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-8.c new file mode 100644 index 00000000..8870a663 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs-8.c @@ -0,0 +1,7 @@ + +void foo(void) +{ +p[0].x = x + (rx * cos(rs)); +p[0].y = y - (ry * sin(rs)); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs.c new file mode 100644 index 00000000..d75a4782 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/bugs.c @@ -0,0 +1,35 @@ +typedef 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; + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/case-nl_before_return.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/case-nl_before_return.c new file mode 100644 index 00000000..67adaddd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/case-nl_before_return.c @@ -0,0 +1,77 @@ +int foo(int arg) +{ + switch (arg) + { + case 0: return 1; + case 1: + return 2; + case 2: + printf("Hello world!\n"); + return 3; + case 3: + { + int a = 4; + return a; + } + case 4: + + return 5; + case 5: + printf("Hello world!\n"); + + return 6; + case 6: + { + int a = 7; + + return a; + } + case 7: /* comment */ return 8; + case 8: + /* C-style comment */ + return 9; + case 9: /* trailing comment */ + return 10; + case 10: /* trailing comment */ + /* C-style comment */ + return 11; + case 11: + // C++-style comment + return 12; + case 12: + // Multi-line + // C++-style comment + return 13; + case 13: // trailing comment + // Multi-line + // C++-style comment + return 14; + case 14: + + // Multi-line + // C++-style comment + return 15; + case 15: + + /* C-style comment */ + return 16; + case 16: + /* + * Multi-line C-style comment + */ + return 17; + case 17: + /*--------------------*/ + /* Multi-part comment */ + /*--------------------*/ + return 18; + case 18: + /*---------------------*/ + // Mixed-style comment + /*---------------------*/ + return 19; + default: + return arg++; + } + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/case.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/case.c new file mode 100644 index 00000000..ffceda0e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/case.c @@ -0,0 +1,69 @@ +void 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); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cast_brace.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cast_brace.c new file mode 100644 index 00000000..7ec7f67a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cast_brace.c @@ -0,0 +1,6 @@ +// +void disappearing_semicolon(void) +{ +r = (recordtypecast){a, b, c}; //<-- +p = Table_put(t,a,&r); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/casts.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/casts.c new file mode 100644 index 00000000..f09f5c5e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/casts.c @@ -0,0 +1,89 @@ + +#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); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/clang-has_include.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/clang-has_include.h new file mode 100644 index 00000000..d153e70a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/clang-has_include.h @@ -0,0 +1,6 @@ +#if __has_include (<tr1/unordered_set>) +# include <tr1/unordered_set> +#endif +#if __has_include("unordered_set.h") || __has_include_next (<tr1/unordered_set>) +# include <tr1/unordered_set> +#endif diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt-align.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt-align.c new file mode 100644 index 00000000..658bac4d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt-align.c @@ -0,0 +1,20 @@ +#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 */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_multi.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_multi.c new file mode 100644 index 00000000..8e01c5fc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_multi.c @@ -0,0 +1,17 @@ +/************************************************ + * 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
+****************************************************************************/
+ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_multi_utf8.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_multi_utf8.c new file mode 100644 index 00000000..05b01f84 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_multi_utf8.c @@ -0,0 +1,2 @@ +/* This is a multiline comment with a UTF8 character: á + */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_nl_end.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_nl_end.c new file mode 100644 index 00000000..48929d07 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_nl_end.c @@ -0,0 +1,12 @@ +int do_this
+(
+ int x,
+ int y
+)
+{
+ x += y; // x = x + y
+ if(x == 3)
+ x++; // x plus 1
+
+ return (x)
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_right_align.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_right_align.c new file mode 100644 index 00000000..b707f0bb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cmt_right_align.c @@ -0,0 +1,47 @@ +
+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 */
+ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/code_width.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/code_width.c new file mode 100644 index 00000000..1b2fbbaa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/code_width.c @@ -0,0 +1,51 @@ + +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; +} + +typedef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyyy; + +typedef some_return_value (*some_function_type)(another_type parameter1, another_type parameter2); + +typedef struct xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +{ + int yyyyyyyyyyyyyyyyyyyyyy; +} x_t; + +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" ); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/colon-asm.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/colon-asm.c new file mode 100644 index 00000000..5125af19 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/colon-asm.c @@ -0,0 +1,19 @@ +static 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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/comment-convert.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/comment-convert.c new file mode 100644 index 00000000..4282ab0b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/comment-convert.c @@ -0,0 +1,27 @@ +// 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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/comment-indent.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/comment-indent.c new file mode 100644 index 00000000..d5295d6e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/comment-indent.c @@ -0,0 +1,40 @@ +/** + * 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(); + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cond.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cond.c new file mode 100644 index 00000000..aec2f0a3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/cond.c @@ -0,0 +1,10 @@ + +int foo1(bool b, int tv, int fv) +{ + return b ? tv : fv; +} + +int foo2(bool b, int tv, int fv) +{ + return b?tv:fv; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/custom_types_ssl.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/custom_types_ssl.c new file mode 100644 index 00000000..0454f81d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/custom_types_ssl.c @@ -0,0 +1,133 @@ +#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); + + +} + + +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); + } + } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/define-if-indent.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/define-if-indent.c new file mode 100644 index 00000000..1ef47273 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/define-if-indent.c @@ -0,0 +1,9 @@ + +#define foobar(x) \ +{ \ +for (i=0; i < x; i++) \ +{ \ +junk(i,x); \ +} \ +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/deref.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/deref.c new file mode 100644 index 00000000..100464fb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/deref.c @@ -0,0 +1,14 @@ +void 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) + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/directfb.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/directfb.h new file mode 100644 index 00000000..3531fa21 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/directfb.h @@ -0,0 +1,1596 @@ +typedef unsigned int size_t; +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; +__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; +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; +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; +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; +typedef __time_t time_t; +typedef __clockid_t clockid_t; +typedef __timer_t timer_t; +typedef unsigned long int ulong; +typedef unsigned short int ushort; +typedef unsigned int uint; +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__))); +typedef int __sig_atomic_t; +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +typedef __sigset_t sigset_t; +struct timespec + { + __time_t tv_sec; + long int tv_nsec; + }; +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +typedef __suseconds_t suseconds_t; +typedef long int __fd_mask; +typedef struct + { + __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))]; + } fd_set; +typedef __fd_mask fd_mask; +extern int select (int __nfds, fd_set *__restrict __readfds, + fd_set *__restrict __writefds, + fd_set *__restrict __exceptfds, + struct timeval *__restrict __timeout); +__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)); +} +typedef __blkcnt_t blkcnt_t; +typedef __fsblkcnt_t fsblkcnt_t; +typedef __fsfilcnt_t fsfilcnt_t; +struct __sched_param + { + int __sched_priority; + }; +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; +typedef unsigned long int pthread_t; +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; +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; +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; +typedef __u16 __le16; +typedef __u16 __be16; +typedef __u32 __le32; +typedef __u32 __be32; +typedef __u64 __le64; +typedef __u64 __be64; +struct timezone + { + int tz_minuteswest; + int tz_dsttime; + }; +typedef struct timezone *__restrict __timezone_ptr_t; +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__)); +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; +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; +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; +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; +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; +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; +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; +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; +typedef struct { + DFBFontDescriptionFlags flags; + DFBFontAttributes attributes; + int height; + int width; + unsigned int index; + int fixed_advance; +} DFBFontDescription; +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; +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; +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; +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 ); }; +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; +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 ); }; +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 ); }; +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; +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 ); }; +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 ); }; +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; +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 ); }; +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; +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 ); }; +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; +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 ); }; +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 ); }; +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); +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 ); }; +typedef int (*DVFrameCallback)(void *ctx); +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 ); }; +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 ); }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/dos.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/dos.c new file mode 100644 index 00000000..108c3b1c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/dos.c @@ -0,0 +1,33 @@ +/**
+ * 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
+*/
+
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/doxy-comment.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/doxy-comment.c new file mode 100644 index 00000000..ef0414ac --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/doxy-comment.c @@ -0,0 +1,5 @@ +int a; //a +int a; ///a +int a; ///<a +int a; //!a +int a; //!<a diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/else-if.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/else-if.c new file mode 100644 index 00000000..06cc37f2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/else-if.c @@ -0,0 +1,29 @@ +int 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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/empty-for.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/empty-for.c new file mode 100644 index 00000000..d9fb686a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/empty-for.c @@ -0,0 +1,6 @@ +void foo(void) +{ + for (;x<2;x++) + { + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/endif.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/endif.c new file mode 100644 index 00000000..fd621299 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/endif.c @@ -0,0 +1,30 @@ +int 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)
+}
+
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum-struct-init.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum-struct-init.c new file mode 100644 index 00000000..6660e4a4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum-struct-init.c @@ -0,0 +1,31 @@ + +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} }, + +}; + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum_comma_ifdef.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum_comma_ifdef.c new file mode 100644 index 00000000..aa80cf48 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum_comma_ifdef.c @@ -0,0 +1,7 @@ +enum A { + a, + b, +#ifdef __clang__ + c +#endif +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum_gallery.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum_gallery.c new file mode 100644 index 00000000..2be93194 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/enum_gallery.c @@ -0,0 +1,28 @@ +enum one { liner }; + +enum not { + +a, one, + +liner }; + +enum foo { bar, baz, quux }; + +/* + * In some tests, the following line remains longer than 80 + * characters. Perhaps a bug? +*/ +enum longer_enum_that { will, not, all, fit, on, one, line, as, longg, as, the, cutoff, is, reasonable, because, this, is, a, very, very, wide, line }; + +enum q { w, +e,r, +t, + + +y + + +} + + +;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/extern.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/extern.c new file mode 100644 index 00000000..3bcfcbe5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/extern.c @@ -0,0 +1,4 @@ +extern "C" int* i; +extern "C" { int* i; } +extern "C" FooString* i; +extern "C" { FooString* i; }
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_indent.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_indent.c new file mode 100644 index 00000000..ff9f812b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_indent.c @@ -0,0 +1,35 @@ +int 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 const char * pu8_t; + +typedef short (*hello1)(char coolParam, + ushort *, + unsigned int anotherone); + +typedef const unsigned char * (getfcn_t)( +int idx, ulong op); + +short (*hello2)(char coolParam, + ulong *, + uchar, + unsigned int anotherone); + +const unsigned char * (*getstr) ( +int idx, +ulong op); + +short hello3 (char coolParam, + ushort *, + unsigned int anotherone); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_indent_func_def_col1.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_indent_func_def_col1.c new file mode 100644 index 00000000..235731c2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_indent_func_def_col1.c @@ -0,0 +1,54 @@ +#if A +/* dfsdsdfd */ +int X; +#endif + +#if A +void func1_1(void); +#endif + +#if A +#if A +int X1; +void func1_1(void) +{ +#if A +/* ttiti */ +if (B) +{ +#if A +/* dsfdf */ +a=5; +#endif +} +#endif +} +int Y1; + + void func1_2(void) + { + } + int Z1; +#endif +#endif + +#if A +#if A +int X2; +/* fsdsfd */ +void func2_1(void) +{ +#if A +/* ttiti */ +if (B) +{ +#if A +/* dsfdf */ +a=5; +#endif +} +#endif +} + int Y2; +#endif +#endif diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_type.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_type.c new file mode 100644 index 00000000..d49d381d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/fcn_type.c @@ -0,0 +1,38 @@ +typedef 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) +{ + double AAA=1.e-3,BBB=0.016,CCC=2*DDD*sqrt(EEE); + a = 4; + ( * ABC )(); + return SMUIFY(a); +} + +typedef struct { + void (*newObject)(const object_info * info, const IObject * *interface, struct object_h* instance); +} IObjectFactory; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/for-space.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/for-space.c new file mode 100644 index 00000000..1064d493 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/for-space.c @@ -0,0 +1,17 @@ +void 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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/freebsd.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/freebsd.c new file mode 100644 index 00000000..c9ef164f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/freebsd.c @@ -0,0 +1,136 @@ +/* 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. */ + { + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_call_user.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_call_user.c new file mode 100644 index 00000000..275d8c5e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_call_user.c @@ -0,0 +1,7 @@ +int func(n) +{ + int a = foo (); + char *a = _("some text"); + char *str = N_("other text"); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_call_user2.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_call_user2.c new file mode 100644 index 00000000..38ecb232 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_call_user2.c @@ -0,0 +1,16 @@ +#include <stdio.h> + +#define CMD_CHECK(expr) do { { expr; } CMDAssert(); } while (0) +#define INTERNAL(expr) do { internalUse = 1; { expr; } internalUse = 0; } while (0) + +int func(n) { + CMD_CHECK(fflush(stdout);); + CMD_CHECK(fflush(stdout)); + CMD_CHECK(fflush(stdout) ); + CMD_CHECK( fflush(stdout) ); + CMD_CHECK( fflush(stdout)); + CMD_CHECK( fflush(stdout);); + CMD_CHECK( fflush(stdout); ); + CMD_CHECK( INTERNAL(fflush(stdout)) ); + CMD_CHECK( INTERNAL(fflush(stdout) ); ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_wrap.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_wrap.c new file mode 100644 index 00000000..7589d03b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/func_wrap.c @@ -0,0 +1,3 @@ + +void FSUB(MPI_Foo)(MPI_Fint* sendcount); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/funcfunc.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/funcfunc.c new file mode 100644 index 00000000..ee717abc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/funcfunc.c @@ -0,0 +1,5 @@ +int main() +{ + mWriter( "class Clst_"c )( cluster.getChild( HO_SHORT_NAME ).getText() )( " : Cluster {"c ).newline; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/function-def.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/function-def.c new file mode 100644 index 00000000..778d121f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/function-def.c @@ -0,0 +1,24 @@ +void 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); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/gh399.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/gh399.c new file mode 100644 index 00000000..00f868a3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/gh399.c @@ -0,0 +1,8 @@ + + +void foo() +{ + for(i = 0; i * i < n; i++) + { + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/global-vars.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/global-vars.c new file mode 100644 index 00000000..9576341b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/global-vars.c @@ -0,0 +1,7 @@ + +static int another_try; +struct something yup; +align_me_t please; +const char *name = "hello"; +static nothing really; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/hello.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/hello.c new file mode 100644 index 00000000..5849783c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/hello.c @@ -0,0 +1,13 @@ +#include <stdio.h>
+
+void HelloWorld(char* pString)
+{
+ printf("%s\n", pString);
+} /* HelloWorld */
+
+int main()
+{
+ HelloWorld("Hello world");
+
+ return 0;
+} /* main */
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1270.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1270.c new file mode 100644 index 00000000..4831a47a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1270.c @@ -0,0 +1,3 @@ +#ifdef asm +#endif +/* comment should stay */
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1413.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1413.c new file mode 100644 index 00000000..4287ca86 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1413.c @@ -0,0 +1 @@ +#
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1564.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1564.c new file mode 100644 index 00000000..c906ef9b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i1564.c @@ -0,0 +1,13 @@ +void f(){ + return f(p0, + p1); +} + +typedef enum +{ + xxx = 0x00 /* comment */ + , yyy = 0x01 /* comment */ + , zzz = 0x02 /* comment */ + , ttt = 0x03 /* comment */ + , rrr = 0x04 /* comment */ +}some_label;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i2c-core.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i2c-core.c new file mode 100644 index 00000000..29bdb584 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/i2c-core.c @@ -0,0 +1,1234 @@ +/* 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 <kmalkki@cc.hut.fi>. + All SMBus-related things are written by Frodo Looijaard <frodol@dds.nl> + SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/slab.h> +#include <linux/i2c.h> +#include <linux/init.h> +#include <linux/idr.h> +#include <linux/seq_file.h> +#include <asm/uaccess.h> + + +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 <simon@tk.uni-linz.ac.at>"); +MODULE_DESCRIPTION("I2C-Bus main module"); +MODULE_LICENSE("GPL"); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/if_chain.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/if_chain.c new file mode 100644 index 00000000..948492dd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/if_chain.c @@ -0,0 +1,82 @@ +void 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(); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/ifdef-indent.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/ifdef-indent.c new file mode 100644 index 00000000..5043c01f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/ifdef-indent.c @@ -0,0 +1,43 @@ +#ifdef foo +#include <foo1.h> +#else +#include <foo2.h> +#endif + +#ifdef foo +/* Commentary for func1() */ +void func1(); + +/* Commentary for func2() */ +void func2(); +#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++; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/ifdef-nest.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/ifdef-nest.c new file mode 100644 index 00000000..68baf1fc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/ifdef-nest.c @@ -0,0 +1,15 @@ + +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 + } + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/include_define.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/include_define.h new file mode 100644 index 00000000..13380cac --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/include_define.h @@ -0,0 +1,5 @@ +#define MY_HEADER <foo/inc.h> + +#include MY_HEADER + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-assign.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-assign.c new file mode 100644 index 00000000..58ed9c52 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-assign.c @@ -0,0 +1,13 @@ +void foo(void) +{ + int a; + junk(a = 3); +} + +void f() +{ + int x = size_t(1.0) + + 2; + int y = (size_t(1.0) + + 5); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-macro-brace.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-macro-brace.c new file mode 100644 index 00000000..8c3f9941 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-macro-brace.c @@ -0,0 +1,8 @@ +#define X do {\ +a; \ +b; \ +} while (0) + +#define X\ +y; \ +z diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-off-after-assign.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-off-after-assign.c new file mode 100644 index 00000000..d01f58c0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-off-after-assign.c @@ -0,0 +1,29 @@ +void foo(void) +{ + int a; + int b = + veryLongMethodCall( + arg1, + longMethodCall( + arg2, + methodCall( + arg3, arg4 + ) + ) + ); + junk(a = + 3); +} + +void f() +{ + int x = size_t(1.0) + + 2; + int y = (size_t(1.0) + + 5); + + int z = + size_t(1.0) + + 5 + + size_t(2.0); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-vbrace.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-vbrace.c new file mode 100644 index 00000000..8b48e235 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent-vbrace.c @@ -0,0 +1,6 @@ + +void x(void) +{ +if (a>b) +b=a; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_first_bool_expr.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_first_bool_expr.c new file mode 100644 index 00000000..ec68ac3a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_first_bool_expr.c @@ -0,0 +1,22 @@ +void 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++;}
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_ternary-1.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_ternary-1.c new file mode 100644 index 00000000..b76e375b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_ternary-1.c @@ -0,0 +1,34 @@ +void foo(void) +{ + int a = x ? y : + z, + b = x ? (y) : + (z), + c = x ? *y : + *z, + d = x ? &y : + &z; + + + if (x ? y : + z) + { + baz; + } + if (x ? (y) : + (z)) + { + baz; + } + if (x ? *y : + *z) + { + baz; + } + if (x ? &y : + &z) + { + baz; + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_ternary-2.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_ternary-2.c new file mode 100644 index 00000000..20f1df64 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/indent_ternary-2.c @@ -0,0 +1,34 @@ +void foo(void) +{ + int a = x ? y + : z, + b = x ? (y) + : (z), + c = x ? *y + : *z, + d = x ? &y + : &z; + + + if (x ? y + : z) + { + baz; + } + if (x ? (y) + : (z)) + { + baz; + } + if (x ? *y + : *z) + { + baz; + } + if (x ? &y + : &z) + { + baz; + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/kw_subst.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/kw_subst.c new file mode 100644 index 00000000..5d37f823 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/kw_subst.c @@ -0,0 +1,22 @@ +#include <string> + +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) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/lvalue.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/lvalue.c new file mode 100644 index 00000000..2f2cc17d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/lvalue.c @@ -0,0 +1,5 @@ +void foo() +{ + if (c * ssize < initialCapacity); + if (Item* item=nextItem()); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mac.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mac.c new file mode 100644 index 00000000..ce4e7937 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mac.c @@ -0,0 +1 @@ +/**
* 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
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/macro-returns.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/macro-returns.c new file mode 100644 index 00000000..0febb263 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/macro-returns.c @@ -0,0 +1,15 @@ +#define foo1 return x + \ + y + +#define foo2 return (x + \ + y) + +#define foo3 return \ + 0 + +#define foo4 return \ + (0) + +#define foo5 return /* empty */ + +#define foo6 return \ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/minus-minus.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/minus-minus.c new file mode 100644 index 00000000..4eb69237 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/minus-minus.c @@ -0,0 +1,33 @@ +int 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 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/misc.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/misc.c new file mode 100644 index 00000000..cd948007 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/misc.c @@ -0,0 +1,32 @@ +/********************/ +/* 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() + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mod-paren.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mod-paren.c new file mode 100644 index 00000000..14bb9836 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mod-paren.c @@ -0,0 +1,79 @@ + +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; + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mod_case_brace.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mod_case_brace.c new file mode 100644 index 00000000..4bd9abde --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/mod_case_brace.c @@ -0,0 +1,57 @@ +int 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); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/multi.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/multi.h new file mode 100644 index 00000000..33acea34 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/multi.h @@ -0,0 +1,12 @@ +/* +This is a multiline +comment that should +not be indented +*/ +{ + /* + No trailing spaces + + in this comment + */ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/my_infile.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/my_infile.c new file mode 100644 index 00000000..8b8cd113 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/my_infile.c @@ -0,0 +1,161 @@ +#include <stdlib.h> /* exit */ +#include <unistd.h> /* _exit */ + +int foo(int); + +extern int baz; + +int foo(int bar) +{ +/* Switch blocks: */ + switch( c ) { + case 1: + case 2: + bar+=2; + break; + + case 3: + bar++; + baz++; + case 4: + break; + default: + break; + } + + switch (bar) { + case 0: + bar++; + break; + case 1: + bar++; + return bar; + case 2: + bar++; + goto x; + case 3: + bar++; + /*FALLTHROUGH*/ + case 4: + bar++; + exit(bar); + /*NOTREACHED*/ + case 5: + bar++; + _exit(bar); + /*NOTREACHED*/ + case 6: + bar++; + if (baz > 2) + break; /* inside if statement; don't align with case */ + else + return baz; /* inside if statement; don't align with case */ + /*NOTREACHED*/ + case 7: + switch (baz) { + case 0: /* do nothing */ + break; + case 1: + return baz; + case 2: + baz--; + goto x; + case 3: + exit(baz); + /*NOTREACHED*/ + case 4: + _exit(baz); + /*NOTREACHED*/ + case 5: + baz--; + /*FALLTHROUGH*/ + default: + for (; baz > 0; baz--) + if (baz == bar) + break; /* break out of for loop, unrelated to switch statement */ + else + bar++; + break; + } + break; + default: + bar++; + break; + } + + +switch (a) +{ + case 0: + // code + break; +} + + +switch ( a ) { + case 0: + if ( k > 0 ) + break; + z = 1; + break; + case 1: + if ( k < 0 ) + break; + z = 2; + case 2: + z = 3; + break; +} + + + return bar; +} + + +int foo2(int op) + { + switch (op) + { + case 1: + do_something(); + break; + case 2: + do_something_else(); + case 3: + do_something_different(); + do_something_more(); + break; + } + return -1; + } + +int foo3(int op) + { + for(int nnn = op; nnn <= 100; nnn++) + { + switch (nnn) + { + case 1: + do_something(); + break; + case 2: + do_something_else(); + case 3: + if (do_something_different()) + { + do_this(); + break; + } + do_something_more(); + break; + + default: + ; // nothing + break; + + } + } + return -1; + } + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/negative_value.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/negative_value.c new file mode 100644 index 00000000..6399fbef --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/negative_value.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int main(void) { + int i = -1; + int j = 30 * -1; + + int frames = 127; + frames = ((frames + 15) & -16); + return 0; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/newline_after_endif.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/newline_after_endif.c new file mode 100644 index 00000000..2a0cbe62 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/newline_after_endif.c @@ -0,0 +1,53 @@ +int 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 */
+
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-comment.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-comment.c new file mode 100644 index 00000000..70c49200 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-comment.c @@ -0,0 +1,60 @@ +/** + * 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; + switch (res) + { + case 1: + // C++-style comment + res++; + break; + case 2: + /* C-style comment */ + res--; + break; + case 3: + /* Multi-line comment + */ + res = 0; + break; + case 4: + + // C++-style comment + res++; + break; + case 5: + + /* C-style comment */ + res--; + break; + default: + + /* Multi-line comment + */ + res = 0; + break; + } + + 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 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-cont.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-cont.c new file mode 100644 index 00000000..9f87950f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-cont.c @@ -0,0 +1,21 @@ +
+#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);
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-cont2.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-cont2.c new file mode 100644 index 00000000..b3f079e3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-cont2.c @@ -0,0 +1,16 @@ +
+#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);
+}
+
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-semicolon.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-semicolon.c new file mode 100644 index 00000000..8e0f59d3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-semicolon.c @@ -0,0 +1,21 @@ +void 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(); +} +; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-ver-def.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-ver-def.c new file mode 100644 index 00000000..9684ed27 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl-ver-def.c @@ -0,0 +1,9 @@ +void foo(void) +{ + int a; + int b;// comment + + /* comment */ + a = b; + return; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_assign.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_assign.c new file mode 100644 index 00000000..b2495c13 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_assign.c @@ -0,0 +1,19 @@ + +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; + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_before_return.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_before_return.c new file mode 100644 index 00000000..da5ed3eb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_before_return.c @@ -0,0 +1,173 @@ +int foo1(int arg) +{ + if (arg == 0) return 1; + if (arg == 1) /* comment */ return 2; + if (arg == 2) + /* C-style comment */ + return 3; + if (arg == 3) /* trailing comment */ + return 4; + if (arg == 4) /* trailing comment */ + /* C-style comment */ + return 5; + if (arg == 5) + // C++-style comment + return 6; + if (arg == 6) + // Multi-line + // C++-style comment + return 7; + if (arg == 7) // trailing comment + // Multi-line + // C++-style comment + return 8; + if (arg == 8) + /* + * Multi-line C-style comment + */ + return 9; + if (arg == 9) + /*--------------------*/ + /* Multi-part comment */ + /*--------------------*/ + return 10; + if (arg == 10) + //----------------------- + /* + * Mixed-style comment + */ + //----------------------- + return 11; + if (arg == 11) + /* comment */ return 12; + if (arg == 12) + + // C++-style comment + return 13; + return arg + 1; +} + +int foo2(int arg) +{ + if (arg == 0) { return 1; } + if (arg == 1) { /* comment */ return 2; } + if (arg == 2) { + /* C-style comment */ + return 3; + } + if (arg == 3) { /* trailing comment */ + return 4; + } + if (arg == 4) { /* trailing comment */ + /* C-style comment */ + return 5; + } + if (arg == 5) { + // C++-style comment + return 6; + } + if (arg == 6) { + // Multi-line + // C++-style comment + return 7; + } + if (arg == 7) { // trailing comment + // Multi-line + // C++-style comment + return 8; + } + if (arg == 8) { + /* + * Multi-line C-style comment + */ + return 9; + } + if (arg == 9) + { + /*--------------------*/ + /* Multi-part comment */ + /*--------------------*/ + return 10; + } + if (arg == 10) + { + //----------------------- + /* Mixed-style comment */ + //----------------------- + return 11; + } + if (arg == 11) + { + /* comment */ return 12; + } + if (arg == 12) { + + /* C-style comment */ + return 13; + } + return arg + 1; +} + +int foo2(int arg) +{ + if (arg == 0) { int a = 1; return a; } + if (arg == 1) { int a = 2; /* comment */ return a; } + if (arg == 2) { + int a = 3; + /* C-style comment */ + return a; + } + if (arg == 3) { + int a = 4; /* trailing comment */ + return a; + } + if (arg == 4) { + int a = 5; /* trailing comment */ + /* C-style comment */ + return a; + } + if (arg == 5) { + int a = 6; + // C++-style comment + return a; + } + if (arg == 6) { + int a = 7; + // Multi-line + // C++-style comment + return a; + } + if (arg == 7) { + int a = 8; // trailing comment + // Multi-line + // C++-style comment + return a; + } + if (arg == 8) { + int a = 9; + /*--------------------*/ + /* Multi-part comment */ + /*--------------------*/ + return a; + } + if (arg == 9) { + int a = 10; + /*---------------------*/ + // Mixed-style comment + /*---------------------*/ + return a; + } + if (arg == 11) + { + int a = 12; + /* comment */ return a; + } + if (arg == 12) { + int a = 13; + /* + * Multi-line C-style comment + */ + return a; + } + return arg + 1; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_create_one_liner.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_create_one_liner.c new file mode 100644 index 00000000..16887eca --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_create_one_liner.c @@ -0,0 +1,17 @@ +void 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); + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_ds_struct_enum.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_ds_struct_enum.c new file mode 100644 index 00000000..d19964ae --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_ds_struct_enum.c @@ -0,0 +1,21 @@ +struct 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 }; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_endif.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_endif.c new file mode 100644 index 00000000..d738d74a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_endif.c @@ -0,0 +1,13 @@ +int main
+(
+)
+{
+ #ifdef useJPLvelocity +
+ for(i = 0; i < x; i++)
+ y++;
+ #endif
+
+ return (0);
+} /* main */
+
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_proto_endif.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_proto_endif.c new file mode 100644 index 00000000..f50766b8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_proto_endif.c @@ -0,0 +1,10 @@ + +#include <stdio.h> + +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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_return_expr.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_return_expr.c new file mode 100644 index 00000000..e917e399 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/nl_return_expr.c @@ -0,0 +1,26 @@ + +int foo1(void) +{ + bar(); + return NewClass(1); +} + +int foo2(void) +{ + return + NewClass(2); +} + +int foo3(void) +{ + bar(none); + // comment + return(3); +} + +int foo4(void) +{ + return + (4); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/one-liner-define.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/one-liner-define.c new file mode 100644 index 00000000..fdb02e31 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/one-liner-define.c @@ -0,0 +1,4 @@ +// + +#define LOG_FMT(sev, args...) \ + do { foo(); } while (0) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/one-liner-init.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/one-liner-init.c new file mode 100644 index 00000000..91d92d55 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/one-liner-init.c @@ -0,0 +1,23 @@ + +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++; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/paren-indent.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/paren-indent.c new file mode 100644 index 00000000..df5b1c14 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/paren-indent.c @@ -0,0 +1,46 @@ +static 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 */ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/paren_indent.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/paren_indent.c new file mode 100644 index 00000000..4b0ff447 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/paren_indent.c @@ -0,0 +1,12 @@ +function1 +(something1); + +function2 + (something2); + +x = (float) +(number); + +x = (float) + (number); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pascal_ptr.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pascal_ptr.c new file mode 100644 index 00000000..5b0116ba --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pascal_ptr.c @@ -0,0 +1,13 @@ +foobar_t* a; +int *b; +int * c; +something no; + +char * main() +{ + int i = (5*3)+2; +} + +void foo(int* a, int *b, int * c) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pos_compare.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pos_compare.c new file mode 100644 index 00000000..b0942de0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pos_compare.c @@ -0,0 +1,11 @@ +void foo(void) +{ + if ((a_really_long_number > + another_really_long_number) + || + (some_really_long_bool + != another_really_long_bool)) + { + foo2(); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pos_conditional.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pos_conditional.c new file mode 100644 index 00000000..100545e5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pos_conditional.c @@ -0,0 +1,14 @@ +void foo(void) +{ + // conditional colon + a = bar() ? 2 : + 3; + a = bar() ? 2 + : 3; + + // conditional question + a = bar() ? + 2 : 3; + a = bar() + ? 2 : 3; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-before-func-def.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-before-func-def.c new file mode 100644 index 00000000..948ce135 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-before-func-def.c @@ -0,0 +1,3 @@ + +#define m_new(type, num) ((type *)(m_malloc(sizeof(type) * (num)))) +void *m_malloc(size_t num_bytes); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-if-indent.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-if-indent.c new file mode 100644 index 00000000..cd9d6c4d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-if-indent.c @@ -0,0 +1,119 @@ +/* this is a comment */ + +/* should be in a H file but put in this file to avoid multiplying the number of test files */ +#ifndef COMSTACK_TYPES_H +#define COMSTACK_TYPES_H + +#include "STD_TYPES.h" +#ifdef COMINL_coENABLE_1 +#ifdef COMINL_coENABLE_2 +#include "def.h" +#endif +#endif + +#if (COMINL_coMINIMUM_DELAY_TIME_1 == COMINL_coENABLE) +#if (COMINL_coMINIMUM_DELAY_TIME_2 == COMINL_coENABLE) +#include "def1.h" +#define COMINL_coMINIMUM_DELAY_TIME_1 +#include "def2.h" +#endif +#endif + +/* no indentation */ +#if COMINL_coMINIMUM_DELAY_TIME == COMINL_coENABLE +#include "MEMSRV.h" +#endif + +/* already well indented */ +#ifndef COMINL_coAPPLI_TX_CONFIRMATION + #error "Define COMINL_coAPPLI_TX_CONFIRMATION is undefined" +#endif + +/* bad indentation */ +#ifndef COMINL_coENABLE + #error "Define COMINL_coENABLE is undefined" +#endif + + +#ifdef COMINL_coENABLE_3 +typedef enum +{ + BUFREQ_OK =0, + BUFREQ_E_NOT_OK = 1, + BUFREQ_E_BUSY=2, +BUFREQ_E_OVFL =3 +} +BufReq_ReturnType; +#endif + + + +#if COMINL_coSTART_STOP_PERIODIC == COMINL_coENABLE +void COMINL_vidInit(void) +{ + uint8 u8LocalMsgIdx; + + if (COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtDeadlineMonTimer < COMINL_udtNB_MESSAGES_RX) + { + u8LocalMsgIdx = E_OK; + } + else + { + u8LocalMsgIdx = E_NOT_OK; + } + +/* nested #if...already well indented */ + #if COMINL_coRX_MESSAGE_VAR == COMINL_coENABLE + /*!Trace to: VEES_R_11_04044_004.01*/ + for(u8LocalMsgIdx = 0; u8LocalMsgIdx < COMINL_udtNB_MESSAGES_RX; u8LocalMsgIdx++) + { + #if COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE + COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtDeadlineMonTimer = 0; + #else /* COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE */ + COMINL_kastrVarReceiveMsg[u8LocalMsgIdx].udtINMDeadlineMonTimer = 0; + #endif /* COMINL_coRX_DEADLINE_MONITORING == COMINL_coENABLE */ + } + #endif /* COMINL_coRX_MESSAGE_VAR == COMINL_coENABLE */ + + + +/* nested #if... no indentation */ +#if COMINL_coTX_MESSAGE_VAR == COMINL_coENABLE + /*!Trace to: VEES_R_11_04044_004.01*/ + for(u8LocalMsgIdx = 0; u8LocalMsgIdx < COMINL_udtNB_MESSAGES_TX; u8LocalMsgIdx++) + { +#if COMINL_coTX_DEADLINE_MONITORING == COMINL_coENABLE + COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtDeadlineMonTimer = 0; + COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].bDeadlineMonEnable = FALSE; +#endif /* COMINL_coTX_DEADLINE_MONITORING == COMINL_coENABLE */ +#if COMINL_coTX_INM_DEADLINE_MONITORING == COMINL_coENABLE + COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtINMDeadlineMonTimer = 0; +#else /* COMINL_coTX_INM_DEADLINE_MONITORING == COMINL_coENABLE */ + COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtMDTTimer = 0; + COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].bMDTMsgToSend = FALSE; +#endif /*COMINL_coMINIMUM_DELAY_TIME == COMINL_coENABLE*/ +#if COMINL_coMIXED_MODE != COMINL_coDISABLE + COMINL_kastrVarTransmitMsg[u8LocalMsgIdx].udtPeriodicTimer = 0; +#endif + } +#endif /* COMINL_coTX_MESSAGE_VAR == COMINL_coENABLE */ +} +#endif + + +void myfunction(void) +{ +int i; +#ifdef COMINL_coTX_MESSAGE_VAR +#ifndef COMINL_coMIXED_MODE +#pragma MyPragma +int j; +#endif +#endif +int k; +} + + +#endif /* COMSTACK_TYPES_H */ + +/*------------------------------- end of file --------------------------------*/ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-nest.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-nest.c new file mode 100644 index 00000000..b602471b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-nest.c @@ -0,0 +1,15 @@ +#if AA +int foo() { + #if BB +#else + #if CC + #else + #endif + #endif +} + #endif + +int bar() +{ +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-space.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-space.c new file mode 100644 index 00000000..67cf3e55 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp-space.c @@ -0,0 +1,30 @@ +/** + * 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 <stdint.h> +#elif defined HAVE_INTTYPES_H +#include <inttypes.h> +#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 */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp_concat_asn1.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp_concat_asn1.h new file mode 100644 index 00000000..9874cf04 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp_concat_asn1.h @@ -0,0 +1,296 @@ +#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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp_ret.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp_ret.c new file mode 100644 index 00000000..c35e4294 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pp_ret.c @@ -0,0 +1,14 @@ +#if 0 +int +#else +unsigned +#endif +f() +{ +return 0; +} + +#ifdef FOO +#define BAR . +#endif + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pragma.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pragma.c new file mode 100644 index 00000000..a0dcd975 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pragma.c @@ -0,0 +1,13 @@ + +#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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pragma_asm.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pragma_asm.c new file mode 100644 index 00000000..a7834613 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/pragma_asm.c @@ -0,0 +1,100 @@ +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + int a = 1; + int very_long = 2; + printf("Hello, World!\n"); + printf("a is %d and very_long is %d\n",a,very_long); + return 0; +} + +#pragma asm + XREF _my_var + + PUSH #LOW(my_func) + PUSH #HIGH(my_func) + +#pragma dummyendasm + + PUSH _my_var+2 + PUSH _my_var+1 + PUSH _my_var+0 + RETF + App_CallEnd: +#pragma endasm + +int main2(int argc, char *argv[]) +{ + int a = 1; + int very_long = 2; + printf("Hello, World!\n"); + printf("a is %d and very_long is %d\n",a,very_long); + return 0; +} + +#pragma asm + XREF _my_var + + PUSH #LOW(my_func) + PUSH #HIGH(my_func) + +#pragma dummyendasm + + PUSH _my_var+2 + PUSH _my_var+1 + PUSH _my_var+0 + RETF + App_CallEnd: +#pragma endasm + +int main3(int argc, char *argv[]) +{ + int a = 1; + int very_long = 2; + printf("Hello, World!\n"); + printf("a is %d and very_long is %d\n",a,very_long); + return 0; +} + +#pragma asm + XREF _my_var + + PUSH #LOW(my_func) + PUSH #HIGH(my_func) + +#pragma dummyendasm + + PUSH _my_var+2 + PUSH _my_var+1 + PUSH _my_var+0 + RETF + App_CallEnd: +#pragma endasm + +int main3(int argc, char *argv[]) +{ + int a = 1; + int very_long = 2; + printf("Hello, World!\n"); + printf("a is %d and very_long is %d\n",a,very_long); + return 0; +} + +#asm + sll a ; 3 + jrc sub_1f ; 3 subtract $1f if A.x has a degree 8 + ret +sub_1f: + xor a,#$1f ; 2 +#endasm + +int main3(int argc, char *argv[]) +{ + int a = 1; + int very_long = 2; + printf("Hello, World!\n"); + printf("a is %d and very_long is %d\n",a,very_long); + return 0; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/preproc-if.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/preproc-if.c new file mode 100644 index 00000000..71fbf792 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/preproc-if.c @@ -0,0 +1,35 @@ + +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--); +} + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/return-compound-literal.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/return-compound-literal.c new file mode 100644 index 00000000..8547c3a7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/return-compound-literal.c @@ -0,0 +1,5 @@ +struct f z(void) { +return (struct f){ +.z = 1, +}; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/return-multi.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/return-multi.c new file mode 100644 index 00000000..846ca21c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/return-multi.c @@ -0,0 +1,46 @@ + +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); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/semicolons.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/semicolons.c new file mode 100644 index 00000000..d7e2379a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/semicolons.c @@ -0,0 +1,75 @@ + +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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sf588.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sf588.c new file mode 100644 index 00000000..d1c5f1cc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sf588.c @@ -0,0 +1,2 @@ +#define APPEND_TO_STREAM(VAR0) << #VAR0 +#define APPEND_TO_STREAM(VAR0, VAR1) << #VAR0 << ", " << #VAR1 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sf594.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sf594.c new file mode 100644 index 00000000..cd08cce6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sf594.c @@ -0,0 +1,6 @@ +void foo() +{ +if (x < d >> 1) +{ +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sort_include.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sort_include.c new file mode 100644 index 00000000..0f1956d2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sort_include.c @@ -0,0 +1,22 @@ +// 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" + +// should be a, aa +#include "aa" +#include "a" + +// should be a, aa +#include <aa> +#include <a> + +// should be b, a +#include <a> +#include "b" diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_after_sparen.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_after_sparen.c new file mode 100644 index 00000000..8a86dd25 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_after_sparen.c @@ -0,0 +1,16 @@ +// test for bug # 637 +void foo(void) +{ +while (1); + while (1); + while (1) ; + while (1) ; + while (1); + if (n) { + while (1); + while (1); + while (1) ; + while (1) ; + while (1); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_cmt_cpp_start.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_cmt_cpp_start.c new file mode 100644 index 00000000..b9b07287 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_cmt_cpp_start.c @@ -0,0 +1,11 @@ + +//zero +// one +// two +// three +void foo(void); + +////four +//// five +//// six +void bar(void); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_embed_comment.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_embed_comment.c new file mode 100644 index 00000000..88a54dff --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_embed_comment.c @@ -0,0 +1,8 @@ +void f(); +void g(int); +void h() +{ +f(/*foo*/); +g(42/*foo*/); +g(/*foo*/42); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_func_call_user_inside_fparen.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_func_call_user_inside_fparen.c new file mode 100644 index 00000000..ba921b9f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sp_func_call_user_inside_fparen.c @@ -0,0 +1 @@ +USER(foo[0]); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sparen-indent.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sparen-indent.c new file mode 100644 index 00000000..fe770681 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/sparen-indent.c @@ -0,0 +1,19 @@ +void f(void) { + +if (a +&& b) { +h(); +} + +for (a = b; +c; +d++) { +h(); +} + +while (z +&& w) { +h(); +} + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/string_prefixes.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/string_prefixes.c new file mode 100644 index 00000000..e901c9ac --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/string_prefixes.c @@ -0,0 +1,23 @@ +void 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."; + +const char c1 = u8'1'; +const char16_t c2 = u'2'; +const char32_t c3 = U'4'; +const wchar_t c4 = L'w'; +const char16_t u = u'\u007f'; + +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
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/string_utf8.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/string_utf8.c new file mode 100644 index 00000000..a473e1bf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/string_utf8.c @@ -0,0 +1 @@ +char* x = "ä¸å›½èªž (ç¹ä½“)"; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/struct-brace.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/struct-brace.c new file mode 100644 index 00000000..7d08b4ca --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/struct-brace.c @@ -0,0 +1,17 @@ +struct 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 }; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/switch-case.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/switch-case.c new file mode 100644 index 00000000..add9fcfa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/switch-case.c @@ -0,0 +1,117 @@ + +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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/switch.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/switch.c new file mode 100644 index 00000000..5b760363 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/switch.c @@ -0,0 +1,29 @@ + +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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/t3.in.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/t3.in.c new file mode 100644 index 00000000..e352f736 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/t3.in.c @@ -0,0 +1,10 @@ +extern /*@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 + ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/type-cast.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/type-cast.c new file mode 100644 index 00000000..5760b466 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/type-cast.c @@ -0,0 +1,14 @@ + +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]; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/type_wrap.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/type_wrap.c new file mode 100644 index 00000000..13b74455 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/type_wrap.c @@ -0,0 +1,4 @@ +void foo(void) +{ + STACK_OF(X509) * st=sk_X509_new_null(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/utf8-identifiers.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/utf8-identifiers.c new file mode 100644 index 00000000..e3281aac --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/utf8-identifiers.c @@ -0,0 +1,13 @@ +void FooUtf8Сhar(void) // C is encoded in UTF-8 +{ +} + +struct テスト // Japanese 'test' +{ + void トスト() {} // Japanese 'toast' +}; + +int main() { + テスト パン; // Japanese パン 'bread' + パン.トスト(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vardefcol.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vardefcol.c new file mode 100644 index 00000000..bdb40e8f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vardefcol.c @@ -0,0 +1,14 @@ +static string foo, +bar; + +void f() +{ +SomeNamedType *var1, + * var2; +} + +void b() +{ +AnotherType var1, +var2; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/various_colons.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/various_colons.c new file mode 100644 index 00000000..516a5a72 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/various_colons.c @@ -0,0 +1,21 @@ +struct foo { + unsigned int a:4;int b : 4; +}; + +int bar(int x) +{ + switch (x){ case 1: return 2; case 4: return 4; + case + 6 + : + return + 8; + case 10: + return 19; + }return 0; + +} + + +int main(void){bar(10); +foo: bar(-9); bar(9);baz:return 0;} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-do.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-do.c new file mode 100644 index 00000000..1cefd1df --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-do.c @@ -0,0 +1,22 @@ + +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--); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-pp.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-pp.c new file mode 100644 index 00000000..5ea209c5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-pp.c @@ -0,0 +1,35 @@ + +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; +} +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-while.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-while.c new file mode 100644 index 00000000..22291748 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/vb-while.c @@ -0,0 +1,41 @@ +unsigned 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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/whole_file_ifdef.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/whole_file_ifdef.c new file mode 100644 index 00000000..bb16e116 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/whole_file_ifdef.c @@ -0,0 +1,5 @@ +/* Header */ +#ifdef WHOLE_FILE +void foo(); +#endif /* WHOLE_FILE */ +/* Footer */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/xml.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/xml.c new file mode 100644 index 00000000..fe7afdf4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/c/xml.c @@ -0,0 +1,9 @@ +void foo(void) +{ +const char *a= "<xml>" +"<data Parent=\"%d\" Name=\"%s\">" +"<Child Id=\"%d\"/>" +"</data>" +"</xml>"; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2138.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2138.cpp new file mode 100644 index 00000000..e0379b43 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2138.cpp @@ -0,0 +1 @@ +int i = 0; /* a b *//* a b */ int b = 0; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2185.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2185.cpp new file mode 100644 index 00000000..6f874926 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2185.cpp @@ -0,0 +1,13 @@ +typedef enum { + HAL_USART_ENABLED = 64, ///< Requested task impossible while + ///< peripheral in question is + ///< enabled + HAL_USART_DISABLED, ///< Requested task impossible while + ///< peripheral in question is + ///< disabled + HAL_USART_GPIO_ERROR, ///< GPIO tied with USART peripheral + ///< returned error state + HAL_USART_BUFFER_DEPLETED, ///< Not enough data to be read + HAL_USART_BUFFER_FULL ///< Data requested to be written + ///< didn't fit into buffer +} hal_usart_errors_t; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2203.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2203.cpp new file mode 100644 index 00000000..4a2c05fa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/2203.cpp @@ -0,0 +1 @@ +using Foo = std::function<void (const bool)>; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/621_this-spacing.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/621_this-spacing.cpp new file mode 100644 index 00000000..bd28a5e8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/621_this-spacing.cpp @@ -0,0 +1,2 @@ +result = (Foo)this;
+result = (Foo)foo;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/622_ifdef-indentation.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/622_ifdef-indentation.cpp new file mode 100644 index 00000000..a6aface7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/622_ifdef-indentation.cpp @@ -0,0 +1,16 @@ +f()
+{
+ {
+ {
+ {
+# if 1
+ return 0;
+# endif
+
+ #if 1
+ return 0;
+ #endif
+ }
+ }
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/623_caret-spacing.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/623_caret-spacing.cpp new file mode 100644 index 00000000..ad1ed6f7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/623_caret-spacing.cpp @@ -0,0 +1,3 @@ +Foo^ foo = dynamic_cast<Bar^>(bar);
+Foo* foo = dynamic_cast<Bar*>(bar);
+x = a^b;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/633_decl-in-func-typedef.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/633_decl-in-func-typedef.cpp new file mode 100644 index 00000000..4e18c597 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/633_decl-in-func-typedef.cpp @@ -0,0 +1,5 @@ +typedef void (*func)(); +typedef void (__stdcall *func)(); + +typedef std::vector<string *> * (* Finder )(std::string *); +typedef vector<std::string *> * (* Handler )(std::map< std::string * , vector *> *); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/634_extern-c-no-block.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/634_extern-c-no-block.cpp new file mode 100644 index 00000000..bb6b14fb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/634_extern-c-no-block.cpp @@ -0,0 +1,9 @@ +extern "C" int* i;
+extern "C" { int* i; }
+int* i;
+extern "C" NSString* i;
+extern "C" { NSString* i; }
+NSString* i;
+
+__attribute__((visibility ("default"))) int* i;
+__attribute__((visibility ("default"))) NSString* i;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DB.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DB.cpp new file mode 100644 index 00000000..1b8f4bc8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DB.cpp @@ -0,0 +1,5 @@ +void AkonadiServer::createDatabase() +{ + DbConfig::configuredDatabase()->apply(db); + db.setDatabaseName(DbConfig::configuredDatabase()->databaseName()); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DefaultAndDelete.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DefaultAndDelete.cpp new file mode 100644 index 00000000..3c4f3b9e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DefaultAndDelete.cpp @@ -0,0 +1,12 @@ +class Foo +{ + public: + Foo( int bar)=0; + Foo( int bar = 777 ); + Foo( const Foo & ) = delete; + Foo( int boo ) =default; + Foo( unsigned int ) =default; + Foo( unsigned int boo=999 ); + Foo &operator= ( const Foo & ) = delete; + ~Foo(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DoxygenComments.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DoxygenComments.cpp new file mode 100644 index 00000000..dfa5a906 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/DoxygenComments.cpp @@ -0,0 +1,2 @@ + //a cpp comment + ///<a Doygen comment diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Example.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Example.h new file mode 100644 index 00000000..deede79a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Example.h @@ -0,0 +1,10 @@ +class Example
+{
+
+ Example()
+ : member(0)
+ {}
+
+ int member;
+
+};
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-1.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-1.cpp new file mode 100644 index 00000000..365df31f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-1.cpp @@ -0,0 +1 @@ +::some::very::looong::_and::complicated::name::MyType & a;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-2.cpp new file mode 100644 index 00000000..c3765ce4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-2.cpp @@ -0,0 +1,7 @@ +class MyClass +{ +public: + void foo(::some::very::looong::_and::complicated::name::MyType& a, + ::some::very::looong::_and::complicated::name::MyType& b, + some::very::looong::_and::complicated::name::MyType& c); +};
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-3.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-3.cpp new file mode 100644 index 00000000..6c48cb63 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I1112-3.cpp @@ -0,0 +1,5 @@ +class MyClass +{ +public: + ::some::name * foo; +};
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I2102.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I2102.cpp new file mode 100644 index 00000000..d8cf883a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I2102.cpp @@ -0,0 +1,2 @@ +unsigned __int32 b = 1ui32; +unsigned __int64 b = 1ui64; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I2103.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I2103.cpp new file mode 100644 index 00000000..ba6386dd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/I2103.cpp @@ -0,0 +1,2 @@ +int i1 = EEnumType::a & EEnumType::b; +int i2 = a & b; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1052.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1052.cpp new file mode 100644 index 00000000..19461b71 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1052.cpp @@ -0,0 +1,3 @@ +ut8 u32s[sizeof (ut32)] = { +0 +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1167.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1167.cpp new file mode 100644 index 00000000..6a9042c2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1167.cpp @@ -0,0 +1 @@ +typedef ::foo::moon::extra::common::super::VeryLongClassName <::foo::moon::extra::common::super::ISuperNice, ::foo::moon::extra::common::super::NiceStoryAboutTheSea, ::foo::moon::extra::common::super::TheVeryLastParameter> AVeryLongNameForDemonstration; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1184.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1184.cpp new file mode 100644 index 00000000..7c69e7fb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1184.cpp @@ -0,0 +1,4 @@ +char buf [2000]; + +buf [0] = 5; +buf [1] = 6; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1460.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1460.h new file mode 100644 index 00000000..63787999 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1460.h @@ -0,0 +1,5 @@ +#define MGT_TYPE_WINDOW (mgt_window_get_type ()) + +G_DECLARE_FINAL_TYPE (MgtWindow, mgt_window, MGT, WINDOW, GtkApplicationWindow) + +MgtWindow *mgt_window_new (MgtApplication *app); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1511.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1511.cpp new file mode 100644 index 00000000..2583c0e3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1511.cpp @@ -0,0 +1 @@ +int getFoo() { return foo; } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1692.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1692.cpp new file mode 100644 index 00000000..4a2c97b5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1692.cpp @@ -0,0 +1,6 @@ +switch (a) +{ + case 0: + // code + break; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1703.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1703.cpp new file mode 100644 index 00000000..bca40664 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1703.cpp @@ -0,0 +1 @@ +#define NUM_LPM_TESTS (sizeof(tests) / sizeof(tests[0])) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1704.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1704.cpp new file mode 100644 index 00000000..90cb2049 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1704.cpp @@ -0,0 +1 @@ +#define INC_REF_COUNT(ref_count) ++ref_count diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1733.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1733.cpp new file mode 100644 index 00000000..10be5586 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1733.cpp @@ -0,0 +1,14 @@ +class X15 +{ +enum Enum +{ + e1 +}; + +operator Enum(); +}; + +::X15::operator ::X15::Enum() +{ + return e1; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1734.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1734.cpp new file mode 100644 index 00000000..31d08c29 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1734.cpp @@ -0,0 +1,14 @@ +class X16 +{ +public: +X16(); +}; + +// https://en.cppreference.com/w/cpp/language/function-try-block +X16::X16() +try +{ +} +catch (...) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1737.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1737.cpp new file mode 100644 index 00000000..fd8b1384 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1737.cpp @@ -0,0 +1,11 @@ +template<class T> +class foo +{ +public: + T x; + foo<T>(int a): x(a) + { + int y = a; + int z = 13; + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1753.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1753.cpp new file mode 100644 index 00000000..bf5530c3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1753.cpp @@ -0,0 +1,9 @@ +void x() +{ + a = c0*d0(); + a = b?c+d:e; + a = b?c*d:e; + a = b?c+d():e; + a = b1?c1*d1():e1; + a = b2?c2()*d2:e2; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813-2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813-2.cpp new file mode 100644 index 00000000..9c02605a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813-2.cpp @@ -0,0 +1,11 @@ +namespace n1 { + namespace n2 { + + void func() { + another_func([]() { + return 42; + }); + } + + } + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813-3.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813-3.cpp new file mode 100644 index 00000000..93e0799c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813-3.cpp @@ -0,0 +1,13 @@ +namespace n1 { + namespace n2 { + namespace n3 { + + void func() { + another_func([]() { + return 42; + }); + } + + } + } + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813.cpp new file mode 100644 index 00000000..0c07555d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1813.cpp @@ -0,0 +1,29 @@ +namespace ns1 +{ +namespace ns2 +{ +void func0() +{ +functionThatTakesALambda( [&] () -> void +{ +lambdaBody; +}); +functionThatTakesALambda( [&] __device__ () -> void +{ +lambdaBody; +}); +functionThatTakesALambda( [&] __host__ __device__ () -> void +{ +lambdaBody; +}); +functionThatTakesALambda( [&] DEVICE_LAMBDA_CONTEXT () -> void +{ +lambdaBody; +}); +functionThatTakesALambda( [&] HOST_DEVICE_LAMBDA_CONTEXT () -> void +{ +lambdaBody; +}); +} +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1923.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1923.cpp new file mode 100644 index 00000000..e5b3ceeb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1923.cpp @@ -0,0 +1,5 @@ +int x1 = 0; +foobar long_x2 = 0; +foo<int> x3 = 0; +int x4[] = {1, 2, 3}; +decltype(x1) x5 = 0; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1966.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1966.cpp new file mode 100644 index 00000000..80b7ddc7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_1966.cpp @@ -0,0 +1,2 @@ +#define FLAG1 0x101 /* struct foo should not be used. +The struct is unsafe */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2020.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2020.cpp new file mode 100644 index 00000000..94d0aa28 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2020.cpp @@ -0,0 +1,20 @@ +class X21 +{ +public: +void f( +int p1, int p2); +}; + +void +X21::f( +int p1, int p2) +{ +} + +void +n1() +{ + X21 x21; + x21.f( +111, 122); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2045.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2045.cpp new file mode 100644 index 00000000..627eba3f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2045.cpp @@ -0,0 +1,12 @@ +void wpa_smk_send_error(struct wpa_authenticator *wpa_auth, + struct wpa_state_machine *sm, const u8 *peer, + u16 mui, u16 error_type) +{ + u8 kde[2 + RSN_SELECTOR_LEN + ETH_ALEN + + 2 + RSN_SELECTOR_LEN + sizeof(struct rsn_error_kde)]; + u8 *pos; + struct rsn_error_kde error; + + wpa_auth_logger(wpa_auth, sm->addr, LOGGER_DEBUG, + "Sending SMK Error"); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2085.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2085.cpp new file mode 100644 index 00000000..581f4db4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2085.cpp @@ -0,0 +1 @@ +typedef std::function<size_t (int arg)> Fail; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2091.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2091.cpp new file mode 100644 index 00000000..6e32d683 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2091.cpp @@ -0,0 +1,5 @@ +#include <AClass.h> +#include <SomeClass.h> +#include <TheClass.h> +#include <iostream> +#include <vector> diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2099.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2099.cpp new file mode 100644 index 00000000..4726f44b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2099.cpp @@ -0,0 +1,2 @@ +void GoAbsolutePosition( /* [in1] */ double arg1_, + /* [in2] */ double arg2_ ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2101.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2101.cpp new file mode 100644 index 00000000..3e07c686 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2101.cpp @@ -0,0 +1,5 @@ +void Test() +{ + aaaaaa = condition ? FunctionWithVeryLongName( andWithVeryLongArgumentsToo1, andWithVeryLongArgumentsToo2 ) + : FunctionWithVeryLongName( andWithVeryLongArgumentsToo2, andWithVeryLongArgumentsToo1 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2138.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2138.cpp new file mode 100644 index 00000000..ad53fa57 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2138.cpp @@ -0,0 +1,2 @@ +void funcName() const; +void ncName() override; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2149.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2149.cpp new file mode 100644 index 00000000..88fb2249 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2149.cpp @@ -0,0 +1,7 @@ +namespace +{ + enum EnumValue + { + EnumValue1 = 1 << 1 + }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2150.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2150.cpp new file mode 100644 index 00000000..1e4d6bf5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2150.cpp @@ -0,0 +1,17 @@ +int f( int a ) +{ + switch ( a ) + { + case 1: + { + return a; + } + case 2: +#if 1 + case 3: +#endif + { + return a; + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2151.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2151.cpp new file mode 100644 index 00000000..dce02df3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2151.cpp @@ -0,0 +1,5 @@ +void f( int a ) +{ + namespace C { enum { Value }; } + const bool ok = ( a & C::Value ) && true; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2163.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2163.cpp new file mode 100644 index 00000000..543b9827 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2163.cpp @@ -0,0 +1,15 @@ +/* + * m + */ +void +m(){ return 0; } +/* + * n + */ +void +n(){ return 0; } +/* + * n + */ +int& +n( int& x ){ return x; } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2166.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2166.cpp new file mode 100644 index 00000000..d9ac55c7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2166.cpp @@ -0,0 +1,7 @@ +void f1() +{ + int a; + int b; + auto lambda1 = [ &a ](){ return true; }; + auto lambda2 = [ &a = b ](){ return true; }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2170.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2170.cpp new file mode 100644 index 00000000..beeffc7e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2170.cpp @@ -0,0 +1,8 @@ +class Foo +{ + public: + Foo( int bar = 1 ); + Foo( const Foo & ) = delete; + Foo &operator= ( const Foo & ) = delete; + ~Foo(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2186.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2186.cpp new file mode 100644 index 00000000..c9cbacda --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2186.cpp @@ -0,0 +1,14 @@ +using namespace std; + +namespace ui { class CClass; } // Expected to stay as-is +namespace ui::dlg { class CClassDlg; } // Expected to stay as-is (new in C++17) + +namespace ui { // Brace should be on the next line +class CClass1; // Should be indented +class CClass2; +class CClass3; +class CClass4; +class CClass5; +class CClass6; +class CClass7; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2195.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2195.cpp new file mode 100644 index 00000000..3573b20d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2195.cpp @@ -0,0 +1,44 @@ +void Launcher::signal(int code) +{ + /* + 1 HUP 2 INT 3 QUIT 4 ILL 5 TRAP 6 ABRT 7 BUS + 8 FPE 9 KILL 10 USR1 11 SEGV 12 USR2 13 PIPE 14 ALRM + 15 TERM 16 STKFLT 17 CHLD 18 CONT 19 STOP 20 TSTP 21 TTIN + 22 TTOU 23 URG 24 XCPU 25 XFSZ 26 VTALRM 27 PROF 28 WINCH + 29 POLL 30 PWR 31 SYS + + + Operation WinCode NixCode + Status 128 1 (HUP) + Terminate N/A 2 (INT) Linux or macOS uses this for CTRL-C. + 129 3 + 130 4 + 131 5 + 132 6 + 133 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + Terminate N/A 15 (TERM) Linux or macOS uses this for CTRL-C. + 16 + N/A 17 (CHILD) Child process exited. + N/A 28 WINCH, window changed size. + */ + + // Convert to lower range + if (code >= 128) + { + code -= 127; + } + + + + + + + event_queue.push(code); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2219.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2219.cpp new file mode 100644 index 00000000..cb6e24bf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2219.cpp @@ -0,0 +1,5 @@ +void foo() +{ +for(int i = 0;i < 1;i++) {return (false);} +float g = 0.13; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2224.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2224.cpp new file mode 100644 index 00000000..65382eb9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2224.cpp @@ -0,0 +1,6 @@ +static void GPUFailedMsgA(const long long int error, const char* file, int line) +{ +if (GPUFailedMsgAI(error, file, line)) { +throw std::runtime_error("Failure"); +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2229.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2229.cpp new file mode 100644 index 00000000..9f575dc1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2229.cpp @@ -0,0 +1,6 @@ +int foo() +{ +if (false) {return 1;} +if (true) {return 2;} +float a = 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2232.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2232.cpp new file mode 100644 index 00000000..7632ed27 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2232.cpp @@ -0,0 +1,7 @@ +void main() +{ +if (true) { return;} + +mInitialized = true; +return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2236.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2236.cpp new file mode 100644 index 00000000..5dbc4fbe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2236.cpp @@ -0,0 +1,8 @@ +class A +{ +public: + virtual void f11111111( int a, int b, int c ) = 0; + virtual void f2( int* ptr2 = nullptr ) = 0; + virtual void f2333( int* ptr3 = 3 ) = delete; + void f244444( int* ptr4 = 4 ) = default; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2250.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2250.cpp new file mode 100644 index 00000000..9268c2e3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2250.cpp @@ -0,0 +1,9 @@ +SettingsDelta::SettingsDelta( + const LastEffectiveContextData& lastEffCtxData) + : Member2(lastEffCtxData.member2()) + , Member3(lastEffCtxData.member3().c_str()) + , Functor([this](const int& num) { Callback(num); }) + , Member4(lastEffCtxData.member4().c_str()) + , Member5(lastEffCtxData.member5()) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2281.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2281.cpp new file mode 100644 index 00000000..44b9e75f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2281.cpp @@ -0,0 +1,24 @@ +int foo(int op) +{ + switch (op) + { + case 1: + do_something(); + break; + case 2: + do_something_else(); + case 3: + if (do_something_different()) + { + do_this(); + break; // this should be indented like the surrounding code + } + do_something_more(); + break; + } + return -1; + for (;;) + { + break; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2302.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2302.cpp new file mode 100644 index 00000000..4763c574 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2302.cpp @@ -0,0 +1,6 @@ +template<class T> +class Foo<T>::Baz { + Baz() noexcept + : i(0) + {} +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2305.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2305.cpp new file mode 100644 index 00000000..1b35ac11 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2305.cpp @@ -0,0 +1,6 @@ +template<class T> +class Foo<T>::Bar { + void + Bar(int iii) : iii(0) + {} +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2319.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2319.cpp new file mode 100644 index 00000000..8c0ae3e9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2319.cpp @@ -0,0 +1,2 @@ +using AbstractLinkPtr = AbstractLink*; +using AbstractLinkPtrPtr = AbstractLink**; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2332.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2332.cpp new file mode 100644 index 00000000..0bc9cf8f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2332.cpp @@ -0,0 +1,6 @@ +CPoint GetPoint() +{ + return { obj_.GetCoordinateXFromObject(), + obj_.GetCoordinateYFromObject(), + obj_.GetCoordinateZFromObject() }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2343.cfg b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2343.cfg new file mode 100644 index 00000000..955a1f9a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2343.cfg @@ -0,0 +1,17 @@ +output_tab_size = 4 +indent_columns = 4 +indent_with_tabs = 0 +indent_cmt_with_tabs = false +indent_class_on_colon = true +indent_constr_colon = true +indent_relative_single_line_comments = true +indent_access_spec_body = true +nl_func_leave_one_liners = true +nl_end_of_file = force +nl_end_of_file_min = 4 +nl_before_opening_brace_func_class_def = force +nl_class_colon = add +pos_class_colon = lead +align_var_class_span = 3 +align_var_struct_span = 3 +pp_if_indent_code = true diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2343.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2343.cpp new file mode 100644 index 00000000..837b0506 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2343.cpp @@ -0,0 +1,143 @@ +class Capteur { + public: + Capteur (); + public: + float val_num; + float val_num_prec; // La valeur précédente pour la comparaison + String tendance; // La variable text récupérée du flux Internet + String val_texte; // La variable text récupérée du flux Internet +}; + +class Capteur_CO2 : public Capteur { + public: + Capteur_CO2() : + un_membre_en_plus ( 0 ) {} + public: + int un_membre_en_plus; +}; + + +class Salon { + public: + Capteur temperature; + Capteur humidite; + Capteur pression; + Capteur_CO2 CO2; +}; + + +typedef struct Exterieur Exterieur; +struct Exterieur { // Structure qui regroupe toutes les variables de la station météo + float temp_num; + float temp_num_prec; // La valeur précédente pour la comparaison + int humidite; + int humidite_prec; // La valeur précédente pour la comparaison + String temp_tendance; // La variable text récupérée du flux Internet + String temp_texte; // La variable text récupérée du flux Internet + String humidite_texte; // La variable text récupérée du flux Internet + Exterieur () : + temp_num ( -99.9 ), + temp_num_prec ( -99.9 ), + humidite ( 0 ), + humidite_prec ( 0 ), + temp_tendance ( "up" ), + temp_texte ( "" ), + humidite_texte ( "" ) {} +}; + + + +for ( int i = 3; i < 42; i++ ) { + Serial.print ( "TEXTE(AC" ); + Serial.print ( i ); + Serial.print ( ";\"0\");\",\";" ); +} +#define OLIVE 0x7BE0 +#define LIGHTGREY 0xC618 +#ifndef _NETATMO_FONCTIONS_WIFI_h + #define _NETATMO_FONCTIONS_WIFI_h + #if defined ( ARDUINO ) && ARDUINO >= 100 + #include "arduino.h" + #if defined ( RORO ) + #define qsijnqsijdn 1323 + // asbdsqhbdsqibd + #endif + #define qsijnqsijdn 1323 + + #else + #define qsijnqsijdn 1323 + + #include "WProgram.h" + #endif // if defined ( ARDUINO ) && ARDUINO >= 100 + #define qsijnqsijdn 1323 + +#endif // ifndef _NETATMO_FONCTIONS_WIFI_h + +// Essaie de signe=se+szde/szz-sszzd%zdzd +zzez = { 1, 2, 3 }; +toto += 1 + 2 / 9 - 3 / 2; + +int fonction ( ( int *zeze ), ( ss ) ) { ksjbshjdbshjdb = 1;} +fonction ( ( &zeze ), ( ss ) ); +fonction (); +// Définition des structures de données +typedef struct Exterieur Exterieur; +struct Exterieur { // Structure qui regroupe toutes les variables de la station météo + float temp_num; + float temp_num_prec; // La valeur précédente pour la comparaison + int humidite; + int humidite_prec; // La valeur précédente pour la comparaison + String temp_tendance; // La variable text récupérée du flux Internet +}; +Exterieur tototot = { -99, -99, -99, -99, 99 }; + +// Température Extérieure +float _Temp_Ext = -99.9; +float _Temp_Ext_Precedente = -99.9; // La valeur précédente pour la comparaison +String _Temp_Ext_Tendance = "up"; + +UTFT myGLCD ( SSD1963_800 = 1, 38, 39, 40, 41 ); // (byte model, int RS, int WR, int CS, int RST, int SER) +UTFT_Geometry geo_myGLCD ( &myGLCD ); + +const char *jour_semaine[[1], [2]] = { + "\0", + "Vendredi\0", + "Dimanche\0" +}; + +void Centrer_Nombre_Int_dans_Zone ( int _nbr, int Y, int X1, int X2, int COULEUR ); +void Centrer_Nombre_Float_dans_Zone ( float _nbr, int Y, int X1, int X2, int COULEUR ); + +void Centrer_Nombre_Int_dans_Zone ( int _nbr, int Y, int X1, int X2, int COULEUR ) { + toto = 1 + 2 / 9 - 3 / 2; + String _texte = String ( _nbr, 1 ); + if ( X2 > X1 ) { + X = X1 + ( X2 - X1 + 1 - _texte.length () * myGLCD.getFontXsize () ) / 2; + } + else { + X = X2 + ( X1 - X2 - myGLCD.getFontXsize () ) / 2; + } + if ( X <= 0 ) { + Serial.print ( F ( "-- Erreur dans le fonction Centrer_Nombre_Int_dans_Zone : la valeur calculée de X est négative ou nulle, elle vaut :" ) ); + Serial.println ( X ); + Serial.print ( F ( "Le texte qui génère cette erreur est : " ) ); + Serial.println ( _texte ); + } + else { + myGLCD.setColor ( COULEUR ); + myGLCD.printNumI ( _nbr, X, Y ); + } +} + +void Texte_Bonjour () { + myGLCD.setColor ( VGA_AQUA ); + myGLCD.setBackColor ( VGA_TRANSPARENT ); + + + + myGLCD.setFont ( Grotesk32x64 ); + myGLCD.print ( F ( "BONJOUR" ), CENTER, 20 ); + myGLCD.setFont ( BigFont ); + myGLCD.print ( F ( "*** NETATMO AFFICHAGE DEPORTE ***" ), CENTER, 100 ); + myGLCD.print ( F ( "Debut : Mai 2019 / MAJ : Juillet 2019" ), CENTER, 120 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2345-3.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2345-3.cpp new file mode 100644 index 00000000..787ce29b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2345-3.cpp @@ -0,0 +1,5 @@ +namespace fooD { + void a(); + void b(); + void c(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2345-4.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2345-4.cpp new file mode 100644 index 00000000..9478d63e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2345-4.cpp @@ -0,0 +1,6 @@ +namespace fooD { + void a(); + void b(); + void c(); + void d(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2368.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2368.cpp new file mode 100644 index 00000000..08d0556b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2368.cpp @@ -0,0 +1,10 @@ +void Func1() +{ + OtherFunc( 5, b ); +} + +void Func2() +{ + Func3( p1, p2, p3 ); + Func3( p111, p222, p333 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2383.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2383.cpp new file mode 100644 index 00000000..356fd9af --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2383.cpp @@ -0,0 +1,7 @@ +// Smooth +// Copyright (C) 2017 Per +// +// 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 3 of the License, or +// (at your option) any later version. diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2386.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2386.cpp new file mode 100644 index 00000000..ac0b1dd4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2386.cpp @@ -0,0 +1,19 @@ +// A + + +std::string getText() +{ + return "Hello World"; +} + +int main(int argc, char *argv[]) +{ + std::cout << getText() << std::endl; + return 0; +} +// This is Hello World with a function call and + +// form feed characters in it for emacs page-break-lines extension +// which draws a horizontal line for each FF char it finds. +// +// this file contains two single h. lines and two consecutive h. lines diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2387.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2387.cpp new file mode 100644 index 00000000..af00e16e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2387.cpp @@ -0,0 +1,14 @@ +namespace bar +{ +void none(); +}; + +void foo() +{ + namespace // does not + x // start a + = // namespace + bar; + + x::none(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2428.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2428.cpp new file mode 100644 index 00000000..c919d5a5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2428.cpp @@ -0,0 +1,5 @@ +void test() +{ + int { 0 }; + int abcdef { 0 }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2437.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2437.cpp new file mode 100644 index 00000000..2a64bd8f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2437.cpp @@ -0,0 +1,2 @@ +void timer_cb1(struct timer_node *n); +typedef void timer_cb (struct timer_node *n); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2440.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2440.cpp new file mode 100644 index 00000000..c52c30da --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2440.cpp @@ -0,0 +1,2 @@ +#pragma region +#pragma endregion diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2440_nl.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2440_nl.cpp new file mode 100644 index 00000000..c52c30da --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2440_nl.cpp @@ -0,0 +1,2 @@ +#pragma region +#pragma endregion diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2478.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2478.cpp new file mode 100644 index 00000000..fbcfec1f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2478.cpp @@ -0,0 +1,41 @@ +//example file +typedef int X35GlobalT1; +typedef int X35T2; + +void fooX35a() +{ + ::X35GlobalT1 a1; + X35T2 a2; + + ::X35GlobalT1 a3 = 1; + X35T2 a4 = 1; +} + +void fooX35b() +{ + X35GlobalT1 a1; + X35T2 a2; + + X35GlobalT1 a3 = 1; + X35T2 a4 = 1; +} + +class X35_1a +{ + private: + ::X35GlobalT1 a1; + X35T2 a2; + + ::X35GlobalT1 a3 = 1; + X35T2 a4 = 1; +}; + +class X35_1b +{ + private: + X35GlobalT1 a1; + X35T2 a2; + + X35GlobalT1 a3= 1; + X35T2 a4 = 1; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2561.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2561.cpp new file mode 100644 index 00000000..15232fc4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2561.cpp @@ -0,0 +1,10 @@ +#include <stdio.h> + +int getFoo() { return foo; } + +int main (int argc, char *argv[]) +{ + printf("hello world!\n"); + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2565.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2565.cpp new file mode 100644 index 00000000..721d4d78 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2565.cpp @@ -0,0 +1,3 @@ +template +<bool = (sizeof(unsigned long) >= sizeof(size_t))> +struct LongFitsIntoSizeTMinusOne { ... } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2570.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2570.cpp new file mode 100644 index 00000000..44373e77 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2570.cpp @@ -0,0 +1,3 @@ +class [[nodiscard]] CClass final +{ +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2574.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2574.cpp new file mode 100644 index 00000000..fc79cd0d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2574.cpp @@ -0,0 +1,13 @@ +#include <pybind11/pybind11.h> +namespace py = pybind11; +PYBIND11_MODULE(example, m) +{ + py::class_<Pet>(m, "Pet").def(py::init<const std::string&>()).def( + "setName_T", + &Pet::setName).def("getName", &Pet::getName); +} + +auto three()->int +{ + return 3; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2582.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2582.cpp new file mode 100644 index 00000000..adf9bfe9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2582.cpp @@ -0,0 +1,3 @@ +int fail = doSomething( + argument +).doNotIndentMe(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2591.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2591.cpp new file mode 100644 index 00000000..01ed232e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2591.cpp @@ -0,0 +1,3 @@ +const auto lambda = [this](int arg) { + doSomething(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2594.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2594.cpp new file mode 100644 index 00000000..798a719a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2594.cpp @@ -0,0 +1,16 @@ +int GPUReconstructionOCL2Backend::GetOCLPrograms() +{ + +#ifdef OPENCL2_ENABLED_SPIRV // clang-format off + if (ver >= 2.2) { + mInternals->program = clCreateProgramWithIL(mInternals->context, _makefile_opencl_program_Base_opencl_GPUReconstructionOCL2_cl_spirv, _makefile_opencl_program_Base_opencl_GPUReconstructionOCL2_cl_spirv_size, &ocl_error); + } else + { + size_t program_sizes[1] = {_makefile_opencl_program_Base_opencl_GPUReconstructionOCL2_cl_src_size}; + char* programs_sources[1] = {_makefile_opencl_program_Base_opencl_GPUReconstructionOCL2_cl_src}; + mInternals->program = clCreateProgramWithSource(mInternals->context, (cl_uint) 1, (const char**) &programs_sources, program_sizes, &ocl_error); + } +#endif // clang-format on + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2596.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2596.cpp new file mode 100644 index 00000000..d2517e8b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2596.cpp @@ -0,0 +1,5 @@ +void function(void) { + int a = 0; + int b = (a==1)?1:2; + int c = (a==1) ? 1 : 2; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2604.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2604.cpp new file mode 100644 index 00000000..e73c67a8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2604.cpp @@ -0,0 +1,15 @@ +void funcPROTO( int parameter1, int parameter2, + int parameter3, int parameter4, + int parameter5, int parameter6, + int parameter7); + +void funcDEF( int parameter1, int parameter2, + int parameter3, int parameter4, + int parameter5, int parameter6, + int parameter7) +{ +funcCALL( parameter1, parameter2, + parameter3, parameter4, + parameter5, parameter6, + parameter7 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2668.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2668.cpp new file mode 100644 index 00000000..1e2f5d02 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2668.cpp @@ -0,0 +1,9 @@ +class SubClass2 : public SuperClass +{ +bool variable; +int abcde; +SubClass2() + : SuperClass() +{ +} +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2672-a.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2672-a.cpp new file mode 100644 index 00000000..d29d2c47 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2672-a.cpp @@ -0,0 +1,10 @@ +struct Point2D +{ + float x; + float y; +}; + +struct : Point2D +{ + float z; +} point; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2672-b.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2672-b.cpp new file mode 100644 index 00000000..f484d4ff --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2672-b.cpp @@ -0,0 +1,2 @@ +struct BaseStruct {}; +struct : BaseStruct {}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2689.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2689.cpp new file mode 100644 index 00000000..ef3b5a4b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2689.cpp @@ -0,0 +1,5 @@ +class C +{ +public: + size_t f4 : 8 * sizeof(size_t) - 2; // <-- this star is treated a pointer token +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2692.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2692.cpp new file mode 100644 index 00000000..4173ad5d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2692.cpp @@ -0,0 +1,5 @@ +class Class +{ +std::mutex* a; +int* b; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2703.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2703.cpp new file mode 100644 index 00000000..ec4554e9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2703.cpp @@ -0,0 +1,14 @@ +#define DEFINE_OPERATORS(classT, flagsT) \ + inline classT::flagsT \ + operator&(const classT::flagsT& lh1, \ + const classT::flagsT::EnumType rh1) \ + { \ + return classT::flagsT(lhs) &= rhs; \ + } \ + \ + inline classT::flagsT \ + operator&(const classT::flagsT::EnumType lh2, \ + const classT::flagsT& rh2) \ + { \ + return classT::flagsT(lhs) &= rhs; \ + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2726.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2726.cpp new file mode 100644 index 00000000..7b76eb43 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2726.cpp @@ -0,0 +1,13 @@ +VIEW_CONTROLLER_MACRO(ThreadButton) +UIViewController * MSGCreate(MBAMailbox * mailbox, NSNumber * threadKey); + + +NS_SWIFT_NAME(Create(String)) +Controller * create(NSString * str); + + +MACRO_FUNCTION +Object * create( NSString * str, NSDictionary<NSString *, NSArray *> * data, string ** str) +{ + return nullptr; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2734.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2734.cpp new file mode 100644 index 00000000..7b85c0ec --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2734.cpp @@ -0,0 +1 @@ +connect(server, SIGNAL(newConnection()), this, SLOT(ok())); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2735.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2735.cpp new file mode 100644 index 00000000..f83e3536 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2735.cpp @@ -0,0 +1,24 @@ +void func(int a){ + switch (a) + { + case 1: + ; + break; + + case 2: + ; + break; + + case 3: + { + int b = 3; + } + break; + + case 4: + { + float f = 4.0; + } + break; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2752.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2752.cpp new file mode 100644 index 00000000..237c8ce1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2752.cpp @@ -0,0 +1 @@ +int main() {} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2757.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2757.cpp new file mode 100644 index 00000000..3c84969b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2757.cpp @@ -0,0 +1,5 @@ +void +foo(map< int, int >& aaa, +int bbb) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2758.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2758.cpp new file mode 100644 index 00000000..1ac9a86e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2758.cpp @@ -0,0 +1,2 @@ +// a function call: +int a = b(5); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2771.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2771.cpp new file mode 100644 index 00000000..ab7c285f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2771.cpp @@ -0,0 +1,4 @@ +class CDiagnostic +{ + CDiagnostic& operator<<( int value_ ) { return ns::operator<<( *this, value_ ); } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2795.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2795.cpp new file mode 100644 index 00000000..6cb7e112 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2795.cpp @@ -0,0 +1,3 @@ +void SnRequestTracefork::onCurlTestError(QProcess::ProcessError _error) { + myerror(QString("Curl process failed with error %1").arg(_error)); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2831.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2831.cpp new file mode 100644 index 00000000..f2dc1717 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2831.cpp @@ -0,0 +1,8 @@ +class Test { +public: + void funca() + { + static_cast<A>(funcb(static_cast<B>( + info))); + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2873.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2873.cpp new file mode 100644 index 00000000..af3020d3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2873.cpp @@ -0,0 +1,22 @@ +class Capteur_CO2 + : public Capteur + , aabc + , def +{ +public: + Capteur_CO2() + : un ( 1 ) + , deux(2) { + } +}; +class Capteur_CO3 + : public Capteur, + aabc, + def +{ +public: + Capteur_CO3() + : un ( 1 ), + deux(2) { + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2879.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2879.cpp new file mode 100644 index 00000000..294c5e85 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2879.cpp @@ -0,0 +1,7 @@ +class CObject +{ +void f() +{ + CObject obj( b1 && c1, b2 && c2 ); +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2890.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2890.cpp new file mode 100644 index 00000000..cea47724 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2890.cpp @@ -0,0 +1,45 @@ +#include <iostream> +#include <sstream> +#include <string> + +struct StringBuilder +{ + template <typename T> + StringBuilder& append(const T& thing) + { + ss << thing; + return *this; + } + std::string build() + { + return ss.str(); + } + std::stringstream ss; +}; + +int main() +{ + std::string my_____String = StringBuilder().append(7).append(" + ").append(21).append(" = ").append(7 + 21).build(); + std::string my_____String = StringBuilder() + .append(7) + .append(" + ") + .append(21) + .append(" = ") + .append(7 + 21) + .build(); + + std::cout << my___String << std::endl; +} + +void function() +{ + auto response = ResponseBuilder_1(1) + .setStatus_1(status) + .finish_1(); + + ResponseBuilder_2(request) + .setStatus_2(status) + .finish_2(); + + return ResponseBuilder_3(request).setStatus_3(status).finish_3(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2902.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2902.cpp new file mode 100644 index 00000000..ae10d5a9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2902.cpp @@ -0,0 +1 @@ +enum empty {}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2907.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2907.cpp new file mode 100644 index 00000000..9d42a72d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2907.cpp @@ -0,0 +1,7 @@ +template< typename Enum > class Flags +{ + public: + constexpr Flags() : value{ 0 } {} + constexpr Flags( Enum f ) : value( static_cast< value_t >( f ) ) {} + constexpr Flags( Flags const& ) = default; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2910.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2910.cpp new file mode 100644 index 00000000..82c2bec9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2910.cpp @@ -0,0 +1,4 @@ +auto foo() -> decltype(0) +{ + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2914.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2914.cpp new file mode 100644 index 00000000..c2cd8b59 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2914.cpp @@ -0,0 +1,6 @@ +void f() +{ + CallFunction( //-V556: Warning disabled because blablabla + param1, + param2 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2921.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2921.cpp new file mode 100644 index 00000000..43e19e96 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2921.cpp @@ -0,0 +1,34 @@ +namespace Namespace1 +{ + namespace Namespace2 + { + namespace Namespace3 + { + namespace Namespace4 + { + namespace Namespace5 + { + namespace Namespace6 + { + namespace Namespace7 + { + namespace Namespace8 + { + class ClassName + { + public: + ClassName(int a, + int b); + + private: + int a; + int b; + }; + } + } + } + } + } + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2930.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2930.cpp new file mode 100644 index 00000000..9b130982 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2930.cpp @@ -0,0 +1,3 @@ +int main(int argc, char** argv) { + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2942.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2942.cpp new file mode 100644 index 00000000..e5bc781f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2942.cpp @@ -0,0 +1 @@ +if (p == b); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2949.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2949.cpp new file mode 100644 index 00000000..d37d7ac3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_2949.cpp @@ -0,0 +1,7 @@ +int index = -1; + +int main(void) +{ + const int x = 2; + int y = index < -x ? 1 : index > x ? 2 : 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_931.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_931.cpp new file mode 100644 index 00000000..90084874 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_931.cpp @@ -0,0 +1,7 @@ +//we manually indented continuation here to prevent 'reallyLongArgumentName' from crossing +//our line length limit +void ReallyLongClassName::ReallyLongMethondName(int arg1, + int reallyLongArgumentName) + +void LongClassName::LongMethondName(int arg1, + int reallyLongArgumentName) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_995-do.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_995-do.cpp new file mode 100644 index 00000000..05eca611 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Issue_995-do.cpp @@ -0,0 +1,3 @@ + do { + xxx = _error; + }while(0) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/NewLine.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/NewLine.cpp new file mode 100644 index 00000000..9c7f1ee9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/NewLine.cpp @@ -0,0 +1,9 @@ + + +{ + /* + * test for new lines, everywhere + */ +} + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/NewLine0.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/NewLine0.cpp new file mode 100644 index 00000000..01e7cc97 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/NewLine0.cpp @@ -0,0 +1,5 @@ +{ + /* + * test for new lines, everywhere + */ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/PR326_invalid-backslash-eol-csharp.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/PR326_invalid-backslash-eol-csharp.cpp new file mode 100644 index 00000000..b0e13d6a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/PR326_invalid-backslash-eol-csharp.cpp @@ -0,0 +1,2 @@ +// test \
+blah()
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_2.cpp new file mode 100644 index 00000000..ee6239f9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_2.cpp @@ -0,0 +1,10 @@ +bool AkonadiServer::quit() +{ + QTimer::singleShot( 0, this, SLOT ( doQuit( ) ) ); +} + +void AkonadiServer::incomingConnection(quintptr socketDescriptor) +{ + QPointer<ConnectionThread> thread = new ConnectionThread(socketDescriptor, this); + connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_EMIT.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_EMIT.cpp new file mode 100644 index 00000000..d3ef9396 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_EMIT.cpp @@ -0,0 +1,5 @@ +bool Handler::failureResponse(const QByteArray &failureMessage) +{ + response.setString(failureMessage); + Q_EMIT responseAvailable(response); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_FOREACH.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_FOREACH.cpp new file mode 100644 index 00000000..37156618 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_FOREACH.cpp @@ -0,0 +1,6 @@ +void Cache::collection() +{ + Q_FOREACH(QString partName, lParts) { + a = 5; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_FOREVER.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_FOREVER.cpp new file mode 100644 index 00000000..a0fb07d5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_FOREVER.cpp @@ -0,0 +1,6 @@ +void Cache::collection() +{ + Q_FOREVER{ + a = 5; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_SIGNAL_SLOT.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_SIGNAL_SLOT.cpp new file mode 100644 index 00000000..5a4c8e7d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Q_SIGNAL_SLOT.cpp @@ -0,0 +1,23 @@ +bool AkonadiServer :: init () +{ + connect ( watcher , SIGNAL( serviceOwnerChanged ( QString, QString,QString ) ), + this, SLOT(serviceOwnerChanged(QString,QString, QString))); + return true; +} + +connect(&mapper, SIGNAL(mapped(Q1 &)), this, SLOT(onSomeEvent(const Q2 &))); + +connect(&mapper, + SIGNAL(mapped(Q1 &)), + this, + SLOT(onSomeEvent(const Q2 &))); + +connect(&mapper, + SIGNAL(emitted(Q1 *)), + this, + SLOT(accept(const Q2 *))); + +connect(&mapper, + SIGNAL(emitted(X< int >)), + this, + SLOT(accept(X< int >))); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/STUCK_macro-difficulties.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/STUCK_macro-difficulties.cpp new file mode 100644 index 00000000..ea1c724e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/STUCK_macro-difficulties.cpp @@ -0,0 +1,5 @@ +#define inline_2 __forceinline
+#define inline(i) inline_##i
+inline(2) f()
+{
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Timestamp.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Timestamp.h new file mode 100644 index 00000000..60dc3791 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/Timestamp.h @@ -0,0 +1,169 @@ +/**
+ * @file Timestamp.h
+ * Definition of class example::Timestamp.
+ */
+
+#ifndef __Timestamp_h_
+#define __Timestamp_h_
+
+#include <string>
+
+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_
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-10496.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-10496.cpp new file mode 100644 index 00000000..3228cf2a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-10496.cpp @@ -0,0 +1,11 @@ +friend class :: GameObject;
+void GameObject :: Foo();
+
+auto x = :: GlobalFunc();
+
+friend void ::testing:: PrintDebugInformationForFakesInUse();
+
+template<class TransferFunction>
+void ::DateTime :: Transfer(TransferFunction & transfer)
+{
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-12046.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-12046.cpp new file mode 100755 index 00000000..9cc7b13f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-12046.cpp @@ -0,0 +1,2 @@ +//The space shouldn't be removed. This is a STRUCT +struct ALIGN_TYPE(16) StructName;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1288.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1288.cpp new file mode 100644 index 00000000..38ded76c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1288.cpp @@ -0,0 +1,10 @@ +if (Application.platform == RuntimePlatform.LinuxEditor) +{ + return new ProcessStartInfo("smthg") + { + Arguments = string.Format ("-9 --ss -S aa \"{0}\"", file), + WorkingDirectory = Directory.GetCurrentDirectory(), + UseShellExecute = false, + CreateNoWindow = true + }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1334.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1334.cpp new file mode 100644 index 00000000..278cd1a2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1334.cpp @@ -0,0 +1,7 @@ +// This should not be screwing with the trailing backslash and indentation of contents!
+// unless it's on the first line where it's controlled by sp_before_nl_cont which we have set on add.
+// Devs should expect misalignment of the nl_cont tokens because we're not messing with the nl_cont from the define body.
+
+#define MY_DEFINE(param1, param2)\
+ my_long_foo_function(param1);\
+ bar(param2);
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1335.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1335.cpp new file mode 100644 index 00000000..2f3ad2a2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1335.cpp @@ -0,0 +1,9 @@ +// Change in Configuration\UnityConfigure.h:
+
+ #define FOO_MACRO 0 /////@TODO: COMMENT?????
+ // ^^^ space removed after 0
+
+// Foo\Bar\Baz\Fizz\Test.cpp
+
+ #define BAR_MACRO FOO_BAR_MACRO //FOO_BAR_BAZ_NONE
+ // ^^^ space removed after _MACRO
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1337.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1337.cpp new file mode 100644 index 00000000..59635c19 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1337.cpp @@ -0,0 +1,9 @@ +// Runtime\Allocator\BucketAllocator.cpp
+
+void foo()
+{
+ void* p1 = new(ptr) Block(bucketsSize);
+ // becomes...
+ void* p1 = new(ptr)Block(bucketsSize);
+ // missing space after ')'
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1339.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1339.cpp new file mode 100644 index 00000000..255db223 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1339.cpp @@ -0,0 +1,2 @@ +auto c = a < b >> 1;
+auto c = a < b;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1340.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1340.cpp new file mode 100644 index 00000000..2f743294 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1340.cpp @@ -0,0 +1,4 @@ +namespace dudeNamespace { class ForwardFooClass; }
+
+namespace dudeNamespace
+{ class ForwardFooClass; }
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1344.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1344.cpp new file mode 100644 index 00000000..c898df76 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1344.cpp @@ -0,0 +1,20 @@ +// Asm blocks have their own special indentation where lables must remain at indent 0 relative to __asm__ block.
+// They few ways of being opened and closed depending on the compiler.
+// For now, we can at least detect and ignore the contents, including alignment.
+
+// Workaround: can always fall back on disable/enable_processing_cmt.
+
+void foo()
+{
+ int head, bar;
+ __asm__ __volatile__
+ (
+ "movq %0,%%xmm0\n\t" /* asm template */
+ "0:\n\t"
+ "bar %0, [%4]\n\t" // in template
+ "1:\n\t"
+ : "=a", (bar)
+ : "=&b", (&head), "+m", (bar)
+ : "cc"
+ );
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1346.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1346.cpp new file mode 100644 index 00000000..0261a306 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1346.cpp @@ -0,0 +1,24 @@ +// Fix doxygen support to include member groups
+
+// See http://www.stack.nl/~dimitri/doxygen/manual/grouping.html#memgroup
+
+// Note that the spec says three slashes, but their example has only two slashes.
+
+// Once this is done, we can try turning on sp_cmt_cpp_start in Uncrustify.Common-CStyle.cfg.
+
+/// Bucket allocator is used for allocations up to 64 bytes of memory.
+/// It is represented by 4 blocks of a fixed-size "buckets" (for allocations of 16/32/48/64 bytes of memory).
+/// Allocation is lockless, blocks are only growable.
+class Class
+{
+public:
+ ///@{ Doxygen group 1
+ virtual void* Foo();
+ virtual void* Bar();
+ ///@}
+
+ //@{ Doxygen group 2
+ virtual void* Foo();
+ virtual void* Bar();
+ //@}
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1347.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1347.cpp new file mode 100644 index 00000000..ac2184f0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1347.cpp @@ -0,0 +1,10 @@ +// Extern "C" blocks need an alignment option somehow. I can do a "set NAMESPACE extern" in the cfg but that will probably screw other stuff up.
+
+// See External\Audio\NativePluginDemo\NativeCode\TeleportLib.h for an example. Yeah it's in external (so have to force-format it) but it's a good case.
+
+// (Actually it's in https://bitbucket.org/Unity-Technologies/nativeaudioplugins, but just published here to external)
+
+extern "C"
+{
+typedef EXPORT_API int (*Foo)(int arg);
+};
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1350.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1350.cpp new file mode 100644 index 00000000..7353e915 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1350.cpp @@ -0,0 +1,5 @@ +// Can't set sp_inside_braces_struct=add otherwise Uncrustify starts applying it to initializers combined with old-C-style struct usage.
+
+struct in_addr addr = {0};
+// ... --> ...
+struct in_addr addr = { 0 };
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1356.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1356.cpp new file mode 100644 index 00000000..8a1aab54 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1356.cpp @@ -0,0 +1,27 @@ +// Hi,
+// When using "space only" and "indent continue", I notice a wrong indentation in C language (at least)
+// function call when the retrun value is assigned to a variable and the call is split in two or more line.
+// In that case the indent is twice the indent set in "indent_continue"
+// This only appears when "indent_with_tabs" is set to 0 "space only" and 1
+// "indent with tabs to brace level, align with spaces"
+// Version tested:
+// 0.59: good indentation
+// 0.60: wrong indentation
+// master (sha1 fc5228e): wrong indentation
+// Here are some details about thats issue:
+// orignal code
+// The long line are manually split and not indented to test uncrustify indent
+
+int main (int argc, char *argv[])
+{
+ double a_very_long_variable = test (foobar1, foobar2, foobar3, foobar4,
+ foobar5, foobar6);
+
+ double a_other_very_long = asdfasdfasdfasdfasdf + asdfasfafasdfa +
+ asdfasdfasdf - asdfasdf + 56598;
+
+ testadsfa (dfasdf, fdssaf, dsfasdf, sadfa, sadfas, fsadfa,
+ aaafsdfa, afsd, asfdas, asdfa, asfasdfa, afsda, asfdasfds, asdfasf);
+
+ return 0;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1358.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1358.cpp new file mode 100644 index 00000000..770bf0c1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1358.cpp @@ -0,0 +1,15 @@ +// MIDL_INTERFACE includes 'class' in its definition but is not tokenised as such
+// A pretty common pattern would be nice to have proper formatting.
+
+EXTERN_C const IID IID_IFileDialogEvents;
+
+MIDL_INTERFACE("973510db-7d7f-452b-8975-74a85828d354")
+IFileDialogEvents : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE OnStuff(
+ /* [in] */ __RPC__in_opt IFileDialog *pfd,
+ /* [in] */ __RPC__in_opt IShellItem *psi,
+ /* [out] */ __RPC__out FDE_SHAREVIOLATION_RESPONSE *pGoodResponse,
+ /* [out] */ __RPC__out FDE_OVERWRITE_RESPONSE *pBadResponse) = 0;
+};
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-16283.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-16283.cpp new file mode 100644 index 00000000..7f042642 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-16283.cpp @@ -0,0 +1,5 @@ +// It is deleting the space after the pointer marker +void foo() +{ + extern void BillboardRenderer_RenderMultiple(const RenderBatchedData& renderData, ShaderChannelMask channels); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-18439.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-18439.cpp new file mode 100644 index 00000000..0c40e831 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-18439.cpp @@ -0,0 +1,12 @@ +floatNx3 randomRotationMatrices[3]; +if (rotationRandomnessX > epsilon() || rotationRandomnessY > epsilon()) +{ +// Parameters are being double indented. + floatNx3 rotationEuler = floatNx3( + (GenerateRandom(randomSeed + intN(kParticleSystemExternalForcesRotationRandomnessXId)) * 2 - 1) * rotationRandomnessX, + (GenerateRandom(randomSeed + intN(kParticleSystemExternalForcesRotationRandomnessYId)) * 2 - 1) * rotationRandomnessY, + floatN(ZERO)); + eulerToMatrix(rotationEuler, randomRotationMatrices); + + toForce = mul(randomRotationMatrices, toForce); +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-18777.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-18777.cpp new file mode 100644 index 00000000..0f177fdc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-18777.cpp @@ -0,0 +1,9 @@ +// I want to keeep the function call indented +Thingy + .Select() + .ToList(); + +// it works with a var +var x = Thingy + .Select() + .ToList(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1980.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1980.cpp new file mode 100644 index 00000000..97940716 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1980.cpp @@ -0,0 +1,8 @@ +// First: scan more FAKE_FUNCTION diffs and see how common this problem is.
+
+// The & should be attached to RefType because it's in a function prototype. Most likely being detected as ARITH.
+
+// We need to figure out how to support this with some setting in our cpp cfg for uncrustify.
+
+FAKE_FUNCTION(Boo, RefType& (void));
+FAKE_FUNCTION(Foo, (MyAwesomeType* (void)));
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1981.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1981.cpp new file mode 100644 index 00000000..a20f4c43 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1981.cpp @@ -0,0 +1,16 @@ +#if DOXYGEN
+class Class
+#else
+struct Struct
+#endif
+{
+ UInt32 m_myAwesomeMember1 : kEnumValue
+ UInt32 m_myAwesomeMember11 : kEnumValue
+ UInt32 m_myAwesomeMember111 : 1;
+ UInt32 m_myAwesomeMember1111 : 1;
+ UInt32 m_myAwesomeMember11111 : 1;
+ UInt32 m_myAwesomeMember111111 : 1;
+ UInt32 m_myAwesomeMember1111111 : 1;
+ UInt32 m_myAwesomeMember11111111 : kEnumValue
+ UInt32 m_myAwesomeMember11111111 : kEnumValue
+};
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1983.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1983.cpp new file mode 100644 index 00000000..e7d9de6d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-1983.cpp @@ -0,0 +1 @@ +typedef HRESULT (WINAPI *Foo)(const void* pData, SIZE_T size, UINT flags, const char* szStr, D3D10BlobHack** ppBlob);
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-19894.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-19894.cpp new file mode 100644 index 00000000..ef5fe7cf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-19894.cpp @@ -0,0 +1,16 @@ +//It is applying double indentation +m_ApplicationView = AppC::ApplicationView::GetForCurrentView(); +m_ViewConsolidateEvtToken = m_ApplicationView->Consolidated += + ref new AppC::TypedEventHandler<AppC::ApplicationView^, AppC::ApplicationViewConsolidatedEventArgs^>(this, &FrameworkView::InternalOnViewConsolidated); + +m_WindowActivatedEvtToken = m_CoreWindow->Activated += + ref new AppC::TypedEventHandler<AppC::CoreWindow^, AppC::WindowActivatedEventArgs^>(this, &FrameworkView::InternalOnWindowActivated); + +m_SizeChangedEvtToken = m_CoreWindow->SizeChanged += + ref new AppC::TypedEventHandler<AppC::CoreWindow^, AppC::WindowSizeChangedEventArgs^>(this, &FrameworkView::InternalOnWindowSizeChanged); + +m_VisibilityChangedEvtToken = m_CoreWindow->VisibilityChanged += + ref new AppC::TypedEventHandler<AppC::CoreWindow^, AppC::VisibilityChangedEventArgs^>(this, &FrameworkView::InternalOnWindowVisibilityChanged); + +m_WindowClosedEvtToken = m_CoreWindow->Closed += + ref new AppC::TypedEventHandler<AppC::CoreWindow^, AppC::CoreWindowEventArgs^>(this, &FrameworkView::InternalOnWindowClosed);
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2049.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2049.cpp new file mode 100644 index 00000000..7c64f76a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2049.cpp @@ -0,0 +1,8 @@ +// Pointer mark should be formatted (WINAPI* SetXX) +typedef DWORD (WINAPI *SetDllDirectory) (LPCSTR); +// Pointer mark should be formatted (EXCEPTION_POINTERS* pExt) +static LONG WINAPI CustomUnhandledExceptionFilter(EXCEPTION_POINTERS * pExInfo) +{ + if (EXCEPTION_BREAKPOINT == pExInfo->ExceptionRecord->ExceptionCode) // Breakpoint. Don't treat this as a normal crash. + return EXCEPTION_CONTINUE_SEARCH; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21506.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21506.cpp new file mode 100644 index 00000000..a8c5f2df --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21506.cpp @@ -0,0 +1,13 @@ +struct bar
+{
+ void (Namespace::*method)(Class& param);
+};
+
+void Class::Foo(void (*callback)(const Class& entry))
+{
+}
+
+void foo()
+{
+ int a = 1; // if you comment this out, the bug stops reproducing
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21509.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21509.cpp new file mode 100644 index 00000000..bde48ee7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21509.cpp @@ -0,0 +1,15 @@ +void (*foo)(int);
+static bar(void (*foo)(int))
+{
+}
+
+bool (*comp_func)(const TypeA*const a, const TypeB& value) = NULL;
+static foo(bool (*comp_func)(const TypeA*const a, const TypeB& value));
+static foo(bool (*comp_func)(const TypeA*const a, const TypeB& value) = NULL)
+{
+}
+
+void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const TypeA* lhs, const TypeB& rhs));
+void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const TypeA* lhs, const TypeB& rhs) = NULL)
+{
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21510.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21510.cpp new file mode 100644 index 00000000..ea406fbe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21510.cpp @@ -0,0 +1 @@ +typedef std::pair<Type* const, TypeB> Object;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21727.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21727.cpp new file mode 100644 index 00000000..991d2631 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21727.cpp @@ -0,0 +1,18 @@ +void foo()
+{
+ int error = 0;
+#if defined(SUPPORT_FEATURE)
+ error = feature_bar();
+#else // feature not supported
+ // we call bar otherwise
+ error = bar();
+#endif // SUPPORT_FEATURE
+ // continue with function logic
+ if (error != 0)
+ {
+#if 0 // TODO: this is disabled
+ // call final bar
+ error_bar(error);
+#endif
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21728.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21728.cpp new file mode 100644 index 00000000..658fba68 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21728.cpp @@ -0,0 +1 @@ +friend std::ostream& operator<<(std::ostream& os, const ScriptingObjectPtr& o);
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21729.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21729.cpp new file mode 100644 index 00000000..4b8d1d59 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-21729.cpp @@ -0,0 +1,3 @@ +extern "C" void __declspec(dllexport) GetAccountNameAndDomain(HWND /*hwndParent*/, int string_size, TCHAR * variables, stack_t** stacktop, extra_parameters* /*extra*/)
+{
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2650.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2650.cpp new file mode 100644 index 00000000..b9ced773 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2650.cpp @@ -0,0 +1,13 @@ +MergeJSFiles(new string[] { + GetDecompressor(), + Paths.Combine(buildToolsDir, "UnityConfig"), + Paths.Combine(args.stagingAreaData, kOutputFileLoaderFileName), +}, unityLoader +); + + +throw new System.Exception( + "'Fast Rebuild' option requires prebuilt JavaScript version of Unity engine. The following files are missing: " + + (!File.Exists(UnityNativeJs) ? "\n" + UnityNativeJs : "") + + (!File.Exists(UnityNativeJs + ".mem") ? "\n" + UnityNativeJs + ".mem" : "") +); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2680.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2680.cpp new file mode 100644 index 00000000..b6aa5bd7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2680.cpp @@ -0,0 +1,3 @@ +A(B(C( + D(a | + b | c)))); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2683.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2683.cpp new file mode 100755 index 00000000..5da60d3f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-2683.cpp @@ -0,0 +1,2 @@ +// It shouldn't add a space after Unity::Type +static Object* Produce(const Unity::Type* type, InstanceID instanceID = InstanceID_None, MemLabelId = kMemBaseObject, ObjectCreationMode mode = kCreateObjectDefault);
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-29935.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-29935.cpp new file mode 100644 index 00000000..a6cf3fc5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-29935.cpp @@ -0,0 +1,6 @@ +void Foo1(BarType& x, void BarFunc()); + +void Bar() +{ + void BarFunc2(BarType& x); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-30088.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-30088.cpp new file mode 100644 index 00000000..1fd5c1fe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-30088.cpp @@ -0,0 +1,9 @@ +void Foo(int value)
+{
+ m_Foo[0].prop
+ = m_Foo[1].prop
+ = m_Foo[2].prop
+ = m_Foo[3].prop
+ = m_Foo[4].prop
+ = m_Foo[5].prop = value;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-30628.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-30628.cpp new file mode 100644 index 00000000..ffa60026 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-30628.cpp @@ -0,0 +1,7 @@ +// Regression 1 FAKE_METHOD expands to a function prototype. Could possibly use PROTO_WRAP like for FAKE_FUNCTION
+class Foo
+{
+ FAKE_FUNCTION(Bar, GetBarInfo, const BarInfo &());
+ FAKE_METHOD(Bar, GetBarInfo, const BarInfo &());
+ FAKE_FUNCTION_WITH_LOCAL_NAME(FakeGetCommonScriptingClasses, GetCommonScriptingClasses, const CommonScriptingClasses &());
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-32657.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-32657.cpp new file mode 100644 index 00000000..9151231a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-32657.cpp @@ -0,0 +1,10 @@ +void UNITY_INTERFACE_API XREnvironment::DepthSetNumberOfPointsImpl(
+ IUnityXRDepthDataAllocator* allocator,
+ size_t numPoints)
+{
+}
+
+UnityXRRaycastHit* (UNITY_INTERFACE_API* Raycast_SetNumberOfHits)(
+ IUnityXRRaycastAllocator* allocator,
+ size_t numHits);
+
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-38381.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-38381.cpp new file mode 100644 index 00000000..701b55b2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-38381.cpp @@ -0,0 +1,5 @@ +#if UNITY_DEFER_GRAPHICS_JOBS_SCHEDULE +void GfxDevice::ScheduleAsyncJob(AsyncCommandJobFunc* jobFunc, GfxDeviceAsyncCommand* cmd, const JobFence& depends, JobBatchDispatcher& dispatcher) +#else +JobFence& GfxDevice::ScheduleAsyncJob(AsyncCommandJobFunc* jobFunc, GfxDeviceAsyncCommand* cmd, const JobFence& depends, JobBatchDispatcher& dispatcher) +#endif // #if UNITY_DEFER_GRAPHICS_JOBS_SCHEDULE diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-64325.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-64325.cpp new file mode 100644 index 00000000..c4005d7c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-64325.cpp @@ -0,0 +1,13 @@ +class function_ref +{ +public: + template<typename CallableT> + function_ref(CallableT &&t) noexcept + : m_Ptr((void *)std::addressof(t)) + , m_ErasedFn([](void *ptr, Args... args) -> ReturnValue + { + // Type erasure lambda: cast ptr back to original type and dispatch the call + return (*reinterpret_cast<std::add_pointer_t<CallableT>>(ptr))(std::forward<Args>(args)...); + }) + {} +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-9650.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-9650.cpp new file mode 100644 index 00000000..f6dba01b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/UNI-9650.cpp @@ -0,0 +1,7 @@ +// make sure that we ignore sp_inside_angle=remove if it will cause a digraph to be created
+
+ops.pProgressCallback = reinterpret_cast< ::ProgressCallback* >( progressCallback);
+ops.pProgressCallback = reinterpret_cast< ::ProgressCallback*>(progressCallback);
+ops.pProgressCallback = reinterpret_cast<::ProgressCallback*>(progressCallback);
+ops.pProgressCallback = reinterpret_cast<ProgressCallback*>(progressCallback);
+ops.pProgressCallback = reinterpret_cast< ProgressCallback*>(progressCallback);
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/al.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/al.cpp new file mode 100644 index 00000000..3c232dec --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/al.cpp @@ -0,0 +1,28 @@ +/* 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 + }; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-330.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-330.cpp new file mode 100644 index 00000000..0ba91720 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-330.cpp @@ -0,0 +1,6 @@ +\ +#define CTOR(i, _) : \ + T(X()), \ + y() \ +{ } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-assign-mixed.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-assign-mixed.cpp new file mode 100644 index 00000000..2e55d59d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-assign-mixed.cpp @@ -0,0 +1,11 @@ +class X16 +{ +X16() = delete; +public: +void z(int x = 0); +virtual void f(int x, int y) = 0; +int hhi = 9; +void g(int x = 0); +int i = 9; +void x(int ggs = 0); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-star-amp-pos.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-star-amp-pos.cpp new file mode 100644 index 00000000..29a7a23a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align-star-amp-pos.cpp @@ -0,0 +1,47 @@ + +/** 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 const char *(*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); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_across_braces.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_across_braces.cpp new file mode 100644 index 00000000..f47f0c80 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_across_braces.cpp @@ -0,0 +1,7 @@ +enum foo // comment +{ + long_enum_value, // these comments should be aligned + another_value, // with each other, but not + shorter, // with the first line +}; // this comment should start a new group +void bar(); // this one should align with the previous line diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_assign_func_proto.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_assign_func_proto.cpp new file mode 100644 index 00000000..0c816099 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_assign_func_proto.cpp @@ -0,0 +1,7 @@ +const int *ptr const = 0;
+ virtual void f1()= 0;
+ virtual void f2()= 0;
+ virtual void f3() const = 0;
+ virtual void f4() const = 0;
+ virtual void f5() = 0;
+ virtual void f6()= 0;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_asterisk_after_type_cast.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_asterisk_after_type_cast.cpp new file mode 100644 index 00000000..4b325b1e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_asterisk_after_type_cast.cpp @@ -0,0 +1,30 @@ +#define MEM_ASSERT1(x) if (!(x)) * (volatile int *)0 = 1 +#define MEM_ASSERT2(x) if (!(x))*(volatile int*)0 = 1 +#define MEM_ASSERT3(x) if (!(x)) * (volatile int *)0 = 1; +#define MEM_ASSERT4(x) if (!(x))*(volatile int*)0 = 1; +#define MEM_ASSERT5(x) if (!(x)) { * (volatile int *)0 = 1; } +#define MEM_ASSERT6(x) if (!(x)) { *(volatile int*)0 = 1; } + +#define FOO1(x) while (!(x)) { * (volatile int*)0 = 1; } +#define FOO2(x) while (!(x)) * (volatile int*)0 = 1; +#define FOO3(x) { * (volatile int*)0 = 1; } +#define FOO4(x) * (volatile int*)0 = 1; +#define FOO5(x) for(;;) (!(x)) { * (volatile int*)0 = 1; } +#define FOO6(x) for(;;) (!(x)) * (volatile int*)0 = 1; +#define FOO7(x) do { * (volatile int*)0 = 1; } while (false); + +void foo1(int x) { + if (!(x)) * (volatile int *)0 = 1; +} + +void foo2(int x) { + if (!(x))*(volatile int*)0 = 1; +} + +void foo3(int x) { + if (!(x)) { * (volatile int *)0 = 1; } +} + +void foo4(int x) { + if (!(x)) { *(volatile int*)0 = 1; } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_class-constr.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_class-constr.cpp new file mode 100644 index 00000000..2be3c8e8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_class-constr.cpp @@ -0,0 +1,6 @@ +class foo : public my_Class +{ + void bar_c(int tttt, int uu, int abc, int defxx) : tttt(4444) +, uu(22) , abc(333) , defxx(55555) + {} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_class.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_class.cpp new file mode 100644 index 00000000..d47e77bb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_class.cpp @@ -0,0 +1,14 @@ +//---------------------------------------------------------------------------
+// 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;
+
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_constr.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_constr.cpp new file mode 100644 index 00000000..1a22f6d9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_constr.cpp @@ -0,0 +1,16 @@ +struct TelegramIndex +{ +TelegramIndex(const char* pN, unsigned long nI) : +pTelName(pN), +nTelIndex(n) +{ +} + +~TelegramIndex() +{ +} + +const char* const pTelName; +unsigned long nTelIndex; +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_continuation_left_shift.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_continuation_left_shift.cpp new file mode 100644 index 00000000..c0c066b8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_continuation_left_shift.cpp @@ -0,0 +1,25 @@ +std::string foo(struct tm* local) { + std::stringstream timestamp; + timestamp << + (local->tm_year + 1900) << "." << + (local->tm_mon + 1) << "." << + local->tm_mday << "-" << + local->tm_hour << "." << + local->tm_min << "." << + local->tm_sec; + return timestamp.str(); +} + +std::string foo2(struct tm* local) { + std::stringstream timestamp; + int year = local->tm_year + 1900; + int mon = local->tm_mon + 1; + timestamp << + year << "." << + mon << "." << + local->tm_mday << "-" << + local->tm_hour << "." << + local->tm_min << "." << + local->tm_sec; + return timestamp.str(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_default_after_override.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_default_after_override.cpp new file mode 100644 index 00000000..de21686c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_default_after_override.cpp @@ -0,0 +1,28 @@ +class B +{ +public: +B() = default; +virtual ~B() = default; +}; + +class D1 : public B +{ +public: +D1() = default; +~D1() = default; +D1(const D1&) = delete; +D1(D1&&) = delete; +D1& operator=(const D1&) = delete; +D1& operator=(const D1&&) = delete; +}; + +class D2 : public B +{ +public: +D2() = default; +~D2() override = default; +D2(const D2&) = delete; +D2(D2&&) = delete; +D2& operator=(const D2&) = delete; +D2& operator=(D2&&) = delete; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_fcall.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_fcall.cpp new file mode 100644 index 00000000..c27ed9d1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_fcall.cpp @@ -0,0 +1,18 @@ +void 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); +while (1) +{ +brat("foo",2000,3000); +brat("question",2,-42); +brat("a",-22, 1); +} +brat("foo",2000,3000); +brat("a",-22, 1); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_params.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_params.cpp new file mode 100644 index 00000000..a90155fd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_params.cpp @@ -0,0 +1,111 @@ +class SomeClass +{ + public: + // Short parameters + TYPE_EXPORT method1(int a, + float b); + + TYPE_EXPORT method2(int& d, + float e); + + TYPE_EXPORT method3(int* f, + float g); + + // Parameters with '&' and '*' + 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); + + // Single short and long parameters + void method10(int a); + void method11(float & a); + void method12(SomeLongNamespace::SomeLongType long_parameter_name); + void method13(double * a); + void method14(SomeLongType long_parameter_name); + + // Long parameters + void method20(int * int_param, + SomeLongNamespace::SomeLongType long_parameter_name, + float & float_param); + + // Possible bug: different aligning in method21 and method22 + // align_func_params_span = 1, align_func_params_thresh = 8 + void method21(SomeLoooooooooooooongType long_param_1, + const string& string_param_1, + const TimePoint& time_param, + double double_param_1, + double double_param_2, + const string& string_param_2, + SomeLoooooooooooooongType long_param_2 ); + void method22(SomeLoooooooooooooongType long_param_1, + const string& string_param_1, + double double_param_1, + double double_param_2, + const TimePoint& time_param, + const string& string_param_2, + SomeLoooooooooooooongType long_param_2 ); + + void method23(int int_param, + int * int_ptr_param, + float float_param, + float & float_ref_param, + SomeLongNamespace::SomeLongType long_parameter_name, + int * other_int_param, + SomeLooooongType long_parameter_name, + SomeLoooooooooongType looong_parameter_name, + SomeLongNamespace::OtherLongNamespace::SomeLongType very_long_parameter_name, + int * int_ptr_param, + float float_param, + float & float_ref_param, + double & double_param, + SomeLongNamespace::SomeLongType long_parameter_name, + int * other_int_param); + + // Don't align several parameters in one line + void method30(int* f, char foo, + float g); + + // Short parameters in method definition + void method40(int a, + float b) + { + int c; + + if ( true ) callProc; + // do stuff. + } + + // Long parameters in method definition + void method50(int int_param, + SomeLongNamespace::OtherLongNamespace::SomeLongType long_parameter_name, + float float_param, + double double_param, + const string & string_param) + { + doSomething(); + } + + void method51( + int int_param, + SomeLongNamespace::OtherLongNamespace::SomeLongType long_parameter_name, + float float_param, + double double_param, + const string & string_param) + { + doSomething(); + } + void increasing_length( + int int_param, + float float_param, + double double_param, + ah_long_t & string_param, + very_long_type t_param, + even_longer_type l_param) + { + doSomething(); + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_proto_thresh.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_proto_thresh.cpp new file mode 100644 index 00000000..df6b4dca --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_proto_thresh.cpp @@ -0,0 +1,15 @@ +class AlignFuncProtoTest { + public: + void test1(); + void test2(); + SomeLongType findSomeLongType(); + void* test3(); + void test4(){ a=1;} + double test5(); + void test6(); + SomeLongNamespace::OtherLongNamespace::SomeLongType findSomeLongType(); + void test7(); + void test8(); + void test9(); + SomeLongNamespace::SomeLongType long_var; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_proto_thresh2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_proto_thresh2.cpp new file mode 100644 index 00000000..b0960a11 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_func_proto_thresh2.cpp @@ -0,0 +1,19 @@ +class AlignFuncProtoTest { + public: + virtual void test1(std::wstring & name, std::pair<Space1::Space2::SomeType, Space1::Space2::otherType> param1) = 0; + virtual SomeLongType findSomeLongType()= 0; + virtual Some::Type test2() = 0; + virtual SomeNameSpace::TypeA test3()= 0; + virtual SomeNameSpace::SubNameSpace1::TypeA test4()= 0; + virtual SomeNameSpace::SubNameSpace1::SubNameSpace2::TypeB test5()= 0; + virtual SomeNameSpace::SubNameSpace1::SubNameSpace2::SubNameSpace3::TypeC test6()= 0; + virtual SomeNameSpace::SubNameSpace1::SubNameSpace2::SubNameSpace3::SubNameSpace4::TypeD test7()= 0; + double test5(); + void test6(); + SomeLongNamespace::OtherLongNamespace::SomeLongType findSomeLongType(); + void test7(); + void test8(); + void test9(); + SomeLongNamespace::SomeLongType long_var; + SomeNameSpace::SubNameSpace1::SubNameSpace2::SubNameSpace3::SubNameSpace4::SubNameSpace5::TypeE test7(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_left_shift.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_left_shift.cpp new file mode 100644 index 00000000..3cf7a744 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_left_shift.cpp @@ -0,0 +1,41 @@ +#include <iostream> +#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]; + std::cout << +X << +Y; + std::cout +<< X +<< Y; + std::cout +<< +X +<< +Y; +} + +#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); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_left_shift2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_left_shift2.cpp new file mode 100644 index 00000000..c90ae71f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_left_shift2.cpp @@ -0,0 +1,32 @@ +void g() +{ + RLOGD(m_log) + << "str1" + << var; + + if (something) + cout << "blah"; + +} + +void f() +{ + cout << something( + arg); + cout + << "something"; + cout << + "something"; + + RLOGD(m_log) + << "WriteReqSize()"; + + RLOGD(m_log) << + base::sprintfT( + "something %u ", + m_pendingAccepts); + + RLOGDD(m_log) << sprintfT( + "something id=%u", + newSocket->GetId()); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_right_comment.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_right_comment.cpp new file mode 100644 index 00000000..43a2a70f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_right_comment.cpp @@ -0,0 +1,29 @@ +namespace A +{ +namespace B +{ +namespace C +{ + + +struct D +{ + int a; // a. + int b; + int c; +}; // struct D + + +} // namespace C + + +struct E {}; + + +} // namespace B + + +struct F {}; + + +} // namespace C diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_var_def_thresh.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_var_def_thresh.cpp new file mode 100644 index 00000000..3942f227 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/align_var_def_thresh.cpp @@ -0,0 +1,64 @@ +void testShortTypes() +{ +// No stars +float a; +double b; + +// All stars +float& a; +double& b; + +float * a; +double * b; + +float &a; +double &b; + +// One star before +double& a; +float b; + +double & a; +float b; + +double &a; +float b; + +// One star after +float b; +double& a; + +float b; +double & a; + +float b; +double &a; +} + +void testLongTypes() +{ +int int_var; +int * int_ptr_var; +int *int_ptr_var; +float float_var; +float &float_ref_var; +float & float_ref_var; +double & double_var; +long_type little_long_var; + SomeLongNamespace::SomeLongType long_var; + int * other_int_var; + SomeLooooongType long_var; + SomeLoooooooooongType looong_var; + int int_var; + SomeLongNamespace::OtherLongNamespace::SomeLongType very_long_var; +int * int_ptr_var; +float float_var; +float & float_ref_var; +double & double_var; + SomeLongNamespace::SomeLongType long_var; +float float_var; + int * other_int_var; + int other_int_var; + int *other_int_var; + int& other_int_var; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/alt_tokens.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/alt_tokens.cpp new file mode 100644 index 00000000..fcaf1392 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/alt_tokens.cpp @@ -0,0 +1,7 @@ +// how to use digraps: +// https://en.wikipedia.org/wiki/Digraphs_and_trigraphs + +int main(int argc, char *argv[]) <% // { +int array<:10:>; // int array[10]; +%> // } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/anonymous_enum.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/anonymous_enum.cpp new file mode 100644 index 00000000..0cf8426d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/anonymous_enum.cpp @@ -0,0 +1,37 @@ +enum { + E11=0, + E12=1, + E13=2 +}; + +enum Enum1 { + E21=0, + E22=1, + E23=2 +}; + +enum Enum2:int { + E31=0, + E32=1, + E33=2 +}; + +enum Enum3 +:int { + E41=0, + E42=1, + E43=2 +}; + +enum:int { + E51=0, + E52=1, + E53=2 +}; + +enum +:int { + E61=0, + E62=1, + E63=2 +};
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/attribute_specifier_seqs.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/attribute_specifier_seqs.cpp new file mode 100644 index 00000000..744b3404 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/attribute_specifier_seqs.cpp @@ -0,0 +1,112 @@ +void asd(void) +{ + a < up_lim() ? do_hi() : do_low; + a[ a<b>c] = d; +} + +[[nodiscard]] inline static CFErrorRef _Nullable CreateErrorIfError(CFStringRef const inDomain, CFIndex const inCode, CFDictionaryRef const inInformation) { +[[maybe_unused]] auto const [iterator, inserted]{ super_type::insert(ioFileReference) }; +if (inCode == 0) { +return nullptr; +} +return ::CFErrorCreate(kCFAllocatorDefault, inDomain, inCode, inInformation); +} + +[[gnu::always_inline]] [[gnu::hot]] [[gnu::const]] [[nodiscard]] +inline int f(); +[[gnu::always_inline, gnu::const, gnu::hot, nodiscard]] +int f(); +[[using gnu : const, always_inline, hot]] [[nodiscard]] +int f[[gnu::always_inline]](); + +int f(int i) [[expects: i > 0]] [[ensures audit x: x < 1]]; + +void f() { +int i [[cats::meow([[]])]]; +int x [[unused]] = f(); +} + +int f(int i) [[deprecated]] { +switch(i) { +case 1: [[fallthrough]]; +[[likely]] case 2: return 1; +} +return 2; +} + +[[ +unused, deprecated("keeping for reference only") +]] +void f() +{ +} + +[[noreturn]] void f() [[deprecated("because")]] { +throw "error"; +} + +void print2(int * [[carries_dependency]] val) +{ +std::cout<<*p<<std::endl; +} + +class X { +public: +int v() const { return x; } +int g() [[expects: v() > 0]]; +private: +int k() [[expects: x > 0]]; +int x; +}; + +class [[foo, bar("baz")]] /**/ Y :private Foo, Bar { +public: +int v(int &x) { return x; } +}; + +class +[[foo]] +[[bar("baz")]] +Z:Foo, public Bar { +public: +int v(int * x) { return *x; } +}; + +int g(int* p) [[ensures: p != nullptr]] +{ +*p = 42; +} + +bool meow(const int&) { return true; } +void i(int& x) [[ensures: meow(x)]] +{ +++x; +} + +enum Enum { +a, b }; +enum class [[foo]] Enum { +a, b }; +enum struct [[foo]] /**/ [[bar("baz")]] Enum { +a, b }; +enum [[foo]] +Enum { +a, b }; +enum class [[foo]] // +[[bar("baz")]] Enum { +a, b }; +enum struct // +[[bar("baz")]] Enum { +a, b }; +enum +[[foo]] [[bar("baz")]] /**/ Enum { +a, b }; +enum class /**/ [[foo]] [[bar("baz")]] +Enum { +a, b }; +enum // +struct +[[foo]] +[[bar("baz")]] +Enum { +a, b }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/av.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/av.h new file mode 100644 index 00000000..7a90197c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/av.h @@ -0,0 +1,49 @@ +/* +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<T>* buffer; +//AFTER: + Buffer<T>*buffer; + + +/* +4) Inside of casts the types are not formatted as outside. +*/ +//BEFORE: +T* t = dynamic_cast<T*>(obj); +//AFTER: +T* t = dynamic_cast<T *>(obj); + +/* +5) Inside some template-stuff the spacing goes weird. Multiple spaces +are inserted, although the configuration (should) say otherwise. +*/ +//BEFORE: +for (std::map<Key, Value*>::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); +} + } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bit-colon.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bit-colon.cpp new file mode 100644 index 00000000..b593255b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bit-colon.cpp @@ -0,0 +1,21 @@ +class C +{ +public: + size_t f1 : 1; + size_t f1:1; + size_t f2 : sizeof(size_t) - 1; + +Q_SIGNALS: + void somesignal(); +}; + +struct S +{ +private: + size_t f1 : 1; + size_t f1:1; + size_t f2 : sizeof(size_t) - 1; + +Q_SIGNALS: + void somesignal(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/block_pointer.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/block_pointer.cpp new file mode 100644 index 00000000..9c7ac70b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/block_pointer.cpp @@ -0,0 +1,16 @@ +__block __weak void (^ weak_recurseTreeNodes)(int a); +void (^ strong_recurseTreeNodes)(int a) = ^ (int a) { +}; + +the result file: +Foo^ foo = dynamic_cast<Bar^>(bar); +Foo* foo = dynamic_cast<Bar*>(bar); +x = a ^ b; +int main(Platform::Array<Platform::String^>^ /*args*/) +{ +} + +void (*fun_ptr)(int) = &fun; + +typedef void (*foo)(void); +void (*foo)(void); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bom.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bom.cpp new file mode 100644 index 00000000..7ee7e7e6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bom.cpp @@ -0,0 +1,3 @@ +// the file is UTF-8 Unicode (with BOM) +// Euro character +€; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bool.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bool.cpp new file mode 100644 index 00000000..30d4cb29 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bool.cpp @@ -0,0 +1,11 @@ +bool foo(char c) +{ + if (c == 'a') + { + return true; + } + else + { + return false; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/brace_brace_init_lst.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/brace_brace_init_lst.cpp new file mode 100644 index 00000000..ef8b96ed --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/brace_brace_init_lst.cpp @@ -0,0 +1,22 @@ +int main() +{ + int a0[][] = {{ 1 }}; + unknown_type b0 = {{ 2 }}; + auto c0 = unknown_type {{ 3 }}; + auto d0 = func( {{ 3 }} ); + auto e0 = func( unknown_type {{ 3 }} ); + + int a1[][] = { {1} }; + unknown_type b1 = { {2} }; + auto c1 = unknown_type{ {3} }; + auto d1 = func({ {3} }); + auto e1 = func(unknown_type{ {3} }); + + int a2[][] = {{1}}; + unknown_type b2 = {{2}}; + auto c2 = unknown_type{{3}}; + auto d2 = func({{3}}); + auto e2 = func(unknown_type{{3}}); + + return 1; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braced_init_list.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braced_init_list.cpp new file mode 100644 index 00000000..e245f34c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braced_init_list.cpp @@ -0,0 +1,260 @@ +#include <vector> +#include <algorithm> + +using some_type = int; +namespace Ns { +using some_type = int; +} + +class BracedInitListBase { +public: +BracedInitListBase() + : a{int{1}}, + b(int(some_type(1))), + c(int{some_type(1)}), + d{int(some_type(1))}, + e{some_type{some_type{a}}} +{ +} + +virtual int getA() const { + return a; +} +private: +int a{}; +int b{1}; +int c = {1}; +int d = int{1}; +some_type e{1}; +some_type f = {1}; +some_type g = some_type{1}; +std::vector<some_type> h{some_type{4}, 5}; +::std::vector<some_type> i = ::std::vector<some_type>{4, some_type{5}}; +some_type j = ::std::vector<some_type>{4, some_type{5}}[1]; +some_type k[2]{1, 2}; +some_type l[2] = {1, 2}; + +union SomeUnion { +int a; +some_type b{}; +}; +}; + +class BracedInitListDerived : public BracedInitListBase { +public: +int getA() const override { + return BracedInitListBase::getA(); +} +}; + +some_type inc(some_type a) +{ + return some_type{++a}; +} + +some_type sum(some_type a, some_type b = some_type{1}) +{ + return a + inc(some_type{b - some_type{1}}); +} + +void braced_init_list_int() +{ + { + int a{}; + int b = {}; + int c = int{}; + int d = int{int{}}; + int{}; + int{int{}}; + } + { + int a{1}; + int b = {1}; + int c = int{1}; + int d = int{int{1}}; + int{1}; + int{int{1}}; + } +} + +void braced_init_list_some_type() +{ + { + some_type a{}; + some_type b = {}; + some_type c = some_type{}; + some_type d = some_type{some_type{}}; + some_type{}; + some_type{some_type{}}; + } + { + some_type a{1}; + some_type b = {1}; + some_type c = some_type{1}; + some_type d = some_type{some_type{1}}; + some_type{1}; + some_type{some_type{1}}; + } + { + ::some_type a{1}; + ::some_type b = {1}; + ::some_type c = ::some_type{1}; + ::some_type d = ::some_type{::some_type{1}}; + ::some_type{1}; + ::some_type{::some_type{1}}; + } + { + Ns::some_type a{1}; + Ns::some_type b = {1}; + Ns::some_type c = Ns::some_type{1}; + Ns::some_type d = Ns::some_type{Ns::some_type{1}}; + Ns::some_type{1}; + Ns::some_type{Ns::some_type{1}}; + } + { + ::Ns::some_type a{1}; + ::Ns::some_type b = {1}; + ::Ns::some_type c = ::Ns::some_type{1}; + ::Ns::some_type d = ::Ns::some_type{::Ns::some_type{1}}; + ::Ns::some_type{1}; + ::Ns::some_type{::Ns::some_type{1}}; + } +} + +void braced_init_list_some_type_auto() +{ + { + auto b = some_type{}; + auto c = some_type{some_type{}}; + } + { + auto a = {1}; + auto b = some_type{1}; + auto c = some_type{some_type{1}}; + } + { + auto b = ::some_type{1}; + auto c = ::some_type{::some_type{1}}; + } + { + auto b = Ns::some_type{1}; + auto c = Ns::some_type{Ns::some_type{1}}; + } + { + auto b = ::Ns::some_type{1}; + auto c = ::Ns::some_type{::Ns::some_type{1}}; + } +} + +void braced_init_list_function_call() +{ + { + some_type a{sum(some_type{}, some_type{})}; + some_type b = sum(some_type{}, some_type{}); + some_type c = some_type{sum(some_type{}, some_type{})}; + some_type{sum(some_type{}, some_type{})}; + some_type{some_type{sum(some_type{}, some_type{})}}; + } + { + some_type a{sum(some_type{1}, some_type{1})}; + some_type b = sum(some_type{1}, some_type{1}); + some_type c = some_type{sum(some_type{1}, some_type{1})}; + some_type{sum(some_type{a}, some_type{b})}; + some_type{some_type{sum(some_type{a}, some_type{b})}}; + } + { + ::some_type a{sum(::some_type{1}, ::some_type{1})}; + ::some_type b = sum(::some_type{1}, ::some_type{1}); + ::some_type c = ::some_type{sum(::some_type{1}, ::some_type{1})}; + ::some_type{sum(::some_type{a}, ::some_type{b})}; + ::some_type{::some_type{sum(::some_type{a}, ::some_type{b})}}; + } + { + Ns::some_type a{sum(Ns::some_type{1}, Ns::some_type{1})}; + Ns::some_type b = sum(Ns::some_type{1}, Ns::some_type{1}); + Ns::some_type c = Ns::some_type{sum(Ns::some_type{1}, Ns::some_type{1})}; + Ns::some_type{sum(Ns::some_type{a}, Ns::some_type{b})}; + Ns::some_type{Ns::some_type{sum(Ns::some_type{a}, Ns::some_type{b})}}; + } + { + ::Ns::some_type a{sum(::Ns::some_type{1}, ::Ns::some_type{1})}; + ::Ns::some_type b = sum(::Ns::some_type{1}, ::Ns::some_type{1}); + ::Ns::some_type c = ::Ns::some_type{sum(::Ns::some_type{1}, ::Ns::some_type{1})}; + ::Ns::some_type{sum(::Ns::some_type{a}, ::Ns::some_type{b})}; + ::Ns::some_type{::Ns::some_type{sum(::Ns::some_type{a}, ::Ns::some_type{b})}}; + } +} + +void braced_init_list_function_call_newline() +{ + { + some_type a{ + sum(some_type{}, + some_type{} + ) + }; + some_type b = sum( + some_type{}, some_type{}); + some_type c = some_type{ + sum( + some_type{}, some_type{})}; + some_type + {sum + (some_type{}, + some_type{} + ) + }; + some_type + {some_type{sum + (some_type{}, some_type{})}}; + } +} + +void braced_init_list_array() +{ + { + some_type a[]{}; + some_type b[] = {}; + some_type c[] = {{}, {}}; + } + { + some_type a[]{1, 2}; + some_type b[] = {1, 2}; + some_type c[] = {some_type{1}, some_type{2}}; + } +} + +void braced_init_list_template() +{ + { + std::vector<some_type> a{}; + std::vector<some_type> b = {}; + std::vector<some_type> c = {{}, {}}; + std::vector<some_type> d = std::vector<some_type>{}; + std::vector<some_type> e = std::vector<some_type>{{}, {}}; + std::vector<some_type> f = std::vector<some_type>{some_type{}, some_type{}}; + std::vector<some_type>{}; + std::vector<some_type>{{}, {}}; + std::vector<some_type>{some_type{}, some_type{}}; + } + { + std::vector<some_type> a{1, 2}; + std::vector<some_type> b = {1, 2}; + std::vector<some_type> c = std::vector<some_type>{1, 2}; + std::vector<some_type> d = std::vector<some_type>{some_type{1}, some_type{2}}; + std::vector<some_type>{1, 2}; + std::vector<some_type>{some_type{1}, some_type{2}}; + } +} + +void braced_init_list_lambda() +{ + std::vector<some_type> a{1, 2}; + some_type b{2}; + + auto c = []{return true;}; + auto d = [](){return true;}; + + std::find_if(a.begin(), a.end(), [&b](const some_type &v){return v == b;}); + std::find_if(a.begin(), a.end(), [](const some_type &v){some_type b{2}; return v == b;}); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braced_init_template_decltype.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braced_init_template_decltype.cpp new file mode 100644 index 00000000..bfd5ef86 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braced_init_template_decltype.cpp @@ -0,0 +1,8 @@ +#include <algorithm> +#include <type_traits> + +template<typename Arg, typename ... Args, typename std::enable_if <!std::is_same<Arg, decltype (std::make_index_sequence<5> { })>::value, int>::type = 0> +void foo(Arg &&arg, Args && ... args) +{ + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braces_align.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braces_align.cpp new file mode 100644 index 00000000..ca99edc6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braces_align.cpp @@ -0,0 +1,13 @@ +char *array_assign[2][4]=
+{
+ {
+ // foo
+ {"foo"},
+ {"foo@1"},{"foo@2"},{"foo@3"}
+ },
+ {
+ // bar
+ {"bar"},
+ {"bar@1"},{"bar@2"},{"bar@3"}
+ }
+};
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braces_empty.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braces_empty.cpp new file mode 100644 index 00000000..583c7fa1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/braces_empty.cpp @@ -0,0 +1,9 @@ +class Parser::ParserPrivate { }; + +template <typename T> class to { }; + +my $all = { }; + +enum FocusEffect { }; + +struct error { }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1001.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1001.cpp new file mode 100644 index 00000000..b0ce9a06 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1001.cpp @@ -0,0 +1,4 @@ +template< > +struct Bar< false > : Foo +{ +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1002.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1002.cpp new file mode 100644 index 00000000..713018e4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1002.cpp @@ -0,0 +1,8 @@ +template< class B1 = void, class B2 = void > +struct conjunction : bool_constant<B1::value1 && B2::value2> +{ +}; +template< class B1 = void, class B2 = void > +struct conjunction : bool_constant<B1::value1&&B2::value2> +{ +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1003.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1003.cpp new file mode 100644 index 00000000..7495b93d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1003.cpp @@ -0,0 +1,33 @@ +class Foo +{ +public: + Foo( + int x_, + int y_ + ) : x(x_), y(y_) + { + } +private: + int x; + int y; +}; + +class Bar +{ +public: + // Splits 3,5 onto newlines + Bar() : Bar(3, 5) + { + } + + // No split here + Bar( + int x, + int y + ) : foo(x, y) + { + } + + Foo foo; +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1004.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1004.cpp new file mode 100644 index 00000000..3287be1c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1004.cpp @@ -0,0 +1,14 @@ +int main() +{ + int b = 3; + int* p = &b; + + // Should stay as b * *p + int a = b * *p; + + // Correctly formats as a * b; + int c = b*a; + + // Correctly formats as d = *p; + int d = * p; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1005.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1005.cpp new file mode 100644 index 00000000..01a457d0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1005.cpp @@ -0,0 +1 @@ +friend void ::test::swap< >(future< T >&, future< T >&); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1020.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1020.cpp new file mode 100644 index 00000000..ec80e915 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1020.cpp @@ -0,0 +1,4 @@ +void HouseNumberData(Translation const & trans = Translation { }, Orientation const & orient = Orientation { }, CategoryIds const & cats = CategoryIds(), std::string const & txt = std::string { }, bool active = false); + +void HouseNumberData(Translation const & trans______________, Orientation const & orient______________________, CategoryIds const & cats_____________________, std::string const & txt___________________, bool active_________); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1027.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1027.cpp new file mode 100644 index 00000000..5ccafd2b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1027.cpp @@ -0,0 +1,5 @@ +int * fn1(); +mytype * fn2(); +myttype<float> * fn3(); +myttype<float> * myclass::fn4(); +myttype * myclass::fn5(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1032.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1032.cpp new file mode 100644 index 00000000..80078efe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1032.cpp @@ -0,0 +1 @@ +int variable1 = items_array[index<int>()]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1068.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1068.cpp new file mode 100644 index 00000000..74fbc8e7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1068.cpp @@ -0,0 +1,55 @@ +// No extra line added +void test1() +{ + if ( i == 10 ) + i++; +} + +// No extra line added +void test2() +{ + if ( i == 10 ) + { + i++; + } +} + +// No extra line added +void test3() +{ + if ( i == 10 ) + { + if ( j == 10 ) + { + i++; + } + } +} + +// No extra line added +void test4() +{ + if ( i == 10 ) + { + if ( j == 10 ) + i++; + } +} + +// Extra line added (after Uncrustify) +void test5() +{ + if ( i == 10 ) + if ( j == 10 ) + { + i++; + } +} + +// Extra line added (after Uncrustify) +void test6() +{ + if ( i == 10 ) + if ( j == 10 ) + i++; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1108.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1108.cpp new file mode 100644 index 00000000..573a9810 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1108.cpp @@ -0,0 +1,8 @@ +int foo() + { + const std::map<std::string, int> bar = + { + { "abcXYZ", -13 }, + }; + return 5; + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1112.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1112.cpp new file mode 100644 index 00000000..e6537641 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1112.cpp @@ -0,0 +1,2 @@ +::std::vector<int> & foo(); +std::vector<int> & bar(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1127.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1127.cpp new file mode 100644 index 00000000..9ee98743 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1127.cpp @@ -0,0 +1,20 @@ +#include <iostream> + +template<size_t T> +class MyFoo +{ +public: + MyFoo() + { + std::cout << T << std::endl; + } +}; + +int main() +{ + const size_t mySize = INT8_MAX* 2; + MyFoo<mySize * 2> foo1; + MyFoo<mySize/2> foo2; + MyFoo<2*mySize> foo1; + MyFoo<2/mySize> foo2; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1134.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1134.cpp new file mode 100644 index 00000000..369b70f1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1134.cpp @@ -0,0 +1,2 @@ +#define ABC 123 // Start trailing comment.. + // ..end with aligned comment. diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1139.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1139.cpp new file mode 100644 index 00000000..47463232 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1139.cpp @@ -0,0 +1,42 @@ +void a() +{ + if((tmp == nullptr) || + ((tmp->type != CT_NUMBER) && + (tmp->type != CT_SIZEOF) && + !(tmp->flags & (PCF_IN_STRUCT | PCF_IN_CLASS))) || + (tmp->type == CT_NEWLINE) + ) + { + set_chunk_type(next, CT_LABEL_COLON); + } +else if ((tmp == nullptr) || + ((tmp->type != CT_NUMBER) && + (tmp->type != CT_SIZEOF) && + !(tmp->flags & (PCF_IN_STRUCT | PCF_IN_CLASS))) || + (tmp->type == CT_NEWLINE) + ) + { + set_chunk_type(next, CT_LABEL_COLON); + } + + + if ((tmp == nullptr) || + ((tmp->type != CT_NUMBER) && + (tmp->type != CT_SIZEOF) && + !(tmp->flags & (PCF_IN_STRUCT | PCF_IN_CLASS))) || + (tmp->type == CT_NEWLINE)) + { + set_chunk_type(next, CT_LABEL_COLON); + } + + if ((tmp == nullptr) || + ((tmp->type != CT_NUMBER) && + (tmp->type != CT_SIZEOF) && + !(tmp->flags & (PCF_IN_STRUCT | PCF_IN_CLASS))) || + (tmp->type == CT_NEWLINE) + +) + { + set_chunk_type(next, CT_LABEL_COLON); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1158.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1158.cpp new file mode 100644 index 00000000..e92da160 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1158.cpp @@ -0,0 +1,4 @@ +void Class1::Func(void) +{ + while (Next()) ; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1160.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1160.cpp new file mode 100644 index 00000000..8dc7a9d1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1160.cpp @@ -0,0 +1,7 @@ +template<typename T1> +class Class1 +{ +public: + status.time_count = duration_cast<::milliseconds> + (steady_clock::now().time_since_epoch()).count(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1161.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1161.cpp new file mode 100644 index 00000000..535c3be7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1161.cpp @@ -0,0 +1,54 @@ +// Use case from issue #1161 +class test +{ + // comment 1 (gets methods) + public: + // get 1 + int get1(); + // get 2 + int get2(); + + + + + // comment 2 (sets methods) + public: + // set 1 + int set1(); + // set2 + int set2(); + +}; + +// Use cases from issue #2704 +class Foo +{ +public: + /// @name Constructors + /// @{ + + Foo(int value) : value_(value) + {} + + /// @} + +private: + int value_; +}; + +class Bar +{ +public: + /*! + * @name Constructors + * @{ + */ + + Bar(int value) : value_(value) + {} + + /*! @} */ + +private: + int value_; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1169.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1169.cpp new file mode 100644 index 00000000..aa56008a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1169.cpp @@ -0,0 +1,24 @@ +class MyClass +{ + public: + virtual void f1ooooooooooooooo(const int bar); + virtual void f2oooooooooooooooo(const int bar); + virtual void f3ooooooooooooooooo(const int bar); + virtual void f4oooooooooooooooooo(const int bar); + virtual void f5ooooooooooooooooooo(const int bar); +}; + +virtual void f1oooooooooooooooooo(const int bar); +virtual void f2ooooooooooooooooooo(const int bar); +virtual void f3oooooooooooooooooooo(const int bar); +virtual void f4ooooooooooooooooooooo(const int bar); +virtual void f5oooooooooooooooooooooo(const int bar); + +void foo() +{ + std::string s1 = "f1oooooooooooooooooooooooo"; + std::string s2 = "f2ooooooooooooooooooooooooo"; + std::string s3 = "f3oooooooooooooooooooooooooo"; + std::string s4 = "f4ooooooooooooooooooooooooooo"; + std::string s5 = "f5oooooooooooooooooooooooooooo"; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1170.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1170.cpp new file mode 100644 index 00000000..35dd772f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1170.cpp @@ -0,0 +1,6 @@ +template<class CLASS_PARAMETER_0, class CLASS_PARAMETER_1, class CLASS_PARAMETER_2, class CLASS_PARAMETER_3, class CLASS_PARAMETER_4, class CLASS_PARAMETER_5> +class MyTemplateClass +{ +public: + MyTemplateClass<my::super::cool::_and::fancy::type, my::super::cool::_and::fancy::type, my::super::cool::_and::fancy::type, my::super::cool::_and::fancy::type, my::super::cool::_and::fancy::type, my::super::cool::_and::fancy::type> foo(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1235.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1235.cpp new file mode 100644 index 00000000..b9ff78a1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1235.cpp @@ -0,0 +1 @@ +namespace dudeNamespace { class ForwardFooClass; } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1236.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1236.cpp new file mode 100644 index 00000000..8acaaed2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1236.cpp @@ -0,0 +1,14 @@ +void foo() +{ + int head, bar; + __asm__ __volatile__ + ( + "movq %0,%%xmm0\n\t" /* asm template */ + "0:\n\t" + "bar\t%0, [%4]\n\t" // in template + "1:\n\t" + : "=a", (bar) + : "=&b", (&head), "+m", (bar) + : "cc" + ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1249.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1249.cpp new file mode 100644 index 00000000..975dc82c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1249.cpp @@ -0,0 +1,11 @@ +friend class :: GameObject; +void GameObject :: Foo(); + +auto x = :: GlobalFunc(); + +friend void ::testing:: PrintDebugInformationForFakesInUse(); + +template<class TransferFunction> +void ::DateTime :: Transfer(TransferFunction & transfer) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1288.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1288.cpp new file mode 100644 index 00000000..94444cf9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1288.cpp @@ -0,0 +1 @@ +friend std::ostream& operator<<(std::ostream& os, const ScriptingObjectPtr& o); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1289.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1289.cpp new file mode 100644 index 00000000..42663477 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1289.cpp @@ -0,0 +1,3 @@ +extern "C" void __declspec(dllexport) GetAccountNameAndDomain(HWND /*hwndParent*/, int string_size, TCHAR * variables, stack_t** stacktop, extra_parameters* /*extra*/) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1296.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1296.cpp new file mode 100644 index 00000000..699025fc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1296.cpp @@ -0,0 +1,7 @@ +int main() +{ + auto lambda2 = [&]() + { + code(); + }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1315.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1315.cpp new file mode 100644 index 00000000..080c9233 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1315.cpp @@ -0,0 +1,17 @@ +dookie::wookie << "asd" + << "bag" + << "sag"; + +typedef enum +{ + A = 0, + B = 1 << 0, + C = 1 << 1 +}; + +enum +{ + A = 0, + B = 1 << 0, + C = 1 << 1 +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1321.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1321.cpp new file mode 100644 index 00000000..c381f91c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1321.cpp @@ -0,0 +1,6 @@ +#include <utility> + +template <typename Fun, typename ... Args> +inline decltype(auto) Invoke(Fun&& f, Args&&... args) + noexcept(noexcept(std::forward<Fun>(f)(std::forward<Args>(args) ...))) +{ return std::forward<Fun>(f)(std::forward<Args>(args) ...); } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1324.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1324.cpp new file mode 100644 index 00000000..5df154f3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1324.cpp @@ -0,0 +1,10 @@ +{ + for (i = 0; i < 10; i++) + { + b = i + 1; + } + for (;;) + { + b = b + 1; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1338.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1338.cpp new file mode 100644 index 00000000..04b4cd8a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1338.cpp @@ -0,0 +1,6 @@ +/* *INDENT-OFF* */ +printf("Hello World!\n"); + + +//test +/* *INDENT-ON* */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1340.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1340.cpp new file mode 100644 index 00000000..680d6d51 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1340.cpp @@ -0,0 +1,20 @@ +double t = 111; +double t1 = 222; +double t123 = 333; + + +auto f = [](double x) -> double + { + double t = 1111; + double t1 = 1222; + double t123 = 1333; + }; + + +std::transform(v1.begin(), v1.end(), v2.begin(), + [](double x) -> double + { + double t = 2111; + double t1 = 2222; + double t123 = 2333; + }; ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1346.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1346.h new file mode 100644 index 00000000..21fe1c44 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1346.h @@ -0,0 +1,10 @@ +typename std::enable_if<!std::is_void<T>::value, QVector<T> >::type dummy(const std::function<T*(const S&)>& pFunc, const QVector<S>& pItems) +{ + return QVector<T>(); +} + + +typename std::enable_if<!std::is_void<T>::value, QVector<T> >::type filter(const std::function<bool(const T&)>& pFunc, const QVector<T>& pItems) +{ + return QVector<T>(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1349.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1349.cpp new file mode 100644 index 00000000..aa1938e8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1349.cpp @@ -0,0 +1,6 @@ +uint8_t a[][8]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}; +uint8_t b[][8]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}; +uint8_t c[][8]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}; +uint8_t d[][8]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}; +uint8_t e[][8]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}; +uint8_t f[][8]={{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1395.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1395.cpp new file mode 100644 index 00000000..00694ce9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1395.cpp @@ -0,0 +1,5 @@ +Type tmp = call_function(getObj().x, + getObj().y, + getObj().z, + getObj().w); +getObj().result = tmp; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1402.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1402.cpp new file mode 100644 index 00000000..44a8ec74 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1402.cpp @@ -0,0 +1,6 @@ +namespace Constants +{ +double PI = 3.14; +} +int factor = 41; +double result = Constants::PI * factor; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1403.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1403.cpp new file mode 100644 index 00000000..71f67f75 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1403.cpp @@ -0,0 +1,6 @@ +int main() +{ +float x; +float y; +float result(1 + x*y); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1432.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1432.cpp new file mode 100644 index 00000000..575a21c8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1432.cpp @@ -0,0 +1,2 @@ +void set(); +vector<int> get(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1439.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1439.cpp new file mode 100644 index 00000000..d560522b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1439.cpp @@ -0,0 +1,2 @@ +struct A; +struct B; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1452.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1452.cpp new file mode 100755 index 00000000..d7fcf753 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1452.cpp @@ -0,0 +1,6 @@ +struct foobar { + char *foobarz() { return "foobar"; } + char *foo_bar() { return "foo_bar"; } + + int foo; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1462.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1462.cpp new file mode 100644 index 00000000..5170b9a9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1462.cpp @@ -0,0 +1,26 @@ +#include <type_traits> + +template < + typename... Args, + typename E = typename std::enable_if<(sizeof...(Args) >= 1), bool>::type +> +void fun1(Args&& ...args) +{ +} + +template < + typename... Args, + typename E = typename std::enable_if<(sizeof...(Args) > 1), bool>::type +> +void fun2(Args&& ...args) +{ +} + +template < + typename... Args, + typename E = typename std::enable_if<(sizeof...(Args) < 3), bool>::type +> +void fun3(Args&& ...args) +{ +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1607.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1607.cpp new file mode 100644 index 00000000..9e4e47d3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1607.cpp @@ -0,0 +1,2 @@ +decltype(i * d) prod = i * d; +decltype(i + d) sum; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1649.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1649.cpp new file mode 100644 index 00000000..4ab5eea8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1649.cpp @@ -0,0 +1,3 @@ +Foo() +noexcept () +{} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1689.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1689.cpp new file mode 100644 index 00000000..795bb572 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1689.cpp @@ -0,0 +1,3 @@ +using value_type = int; +using reference = value_type &; +using const_reference = const value_type &; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1691.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1691.cpp new file mode 100644 index 00000000..2d5d1204 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1691.cpp @@ -0,0 +1,14 @@ +#include <string> + +std::string foo() +{ + return std::string{"abc"}; +} +int main() +{ + const std::string&& name1 = foo(); + std::string&& name2 = foo(); + + const auto&& name3 = foo(); + auto&& name4 = foo(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1717.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1717.cpp new file mode 100644 index 00000000..a1adcf5f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1717.cpp @@ -0,0 +1,10 @@ +class X14 +{ +public: +X14(); +~X14() = default; +X14(const X14& rhs) = default; +X14& operator=(const X14& rhs) = default; +X14(X14&& rhs) = delete; +X14& operator=(X14&& rhs) = delete; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1758-f.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1758-f.cpp new file mode 100644 index 00000000..b324fbda --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1758-f.cpp @@ -0,0 +1,10 @@ +int main() +{ + +for(int f=0; f < 1; f++) +{ + auto a = int{1}; +} + +return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1758.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1758.cpp new file mode 100644 index 00000000..b0f35107 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1758.cpp @@ -0,0 +1,12 @@ +for(int f=0; f<(Element::nf)*2; f++) +{ + if (f%2==1) p = p-1; + { + this->pInterpolation[i]=p; + this->cInterpolation[i]=0.; + this->dofInterpolation[i]=e+f; + this->coefInterpolation[i]=1.; + i++; + p++; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1854.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1854.cpp new file mode 100644 index 00000000..29cc2774 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1854.cpp @@ -0,0 +1 @@ +while (*p++ = ' ') ; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1862.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1862.cpp new file mode 100644 index 00000000..78958bb1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_1862.cpp @@ -0,0 +1,11 @@ +#if _MSC_VER < 1300 +#define __func__ "???" +#else /* comment 1 */ +#define __func__ __FUNCTION__ +#endif /* comment 2 */ + +#if _MSC_VER < 1300 +#define __func__ "???" +#else // comment 1 +#define __func__ __FUNCTION__ +#endif // comment 2 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2285.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2285.cpp new file mode 100644 index 00000000..14a85090 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2285.cpp @@ -0,0 +1,11 @@ +class __attribute__ ((visibility ("default"))) Test +{ +public: +Test() : member1(), member2() +{ +} + +private: +int member1; +int member2; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2322.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2322.cpp new file mode 100644 index 00000000..f9768c40 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2322.cpp @@ -0,0 +1,12 @@ +void main() +{ + if (foo()) { bar(); } + else if (baz({ rick, morty })) { anime(); } + else if (a) while (true) { amime2(); } + else if (b) do { amime3(); } while(false); + else if (c) for(;;) { amime5(); } + else if (d) while(true) {} + else if (e) do {} while(false); + else if (f) for(;;) {} + else { amime6(); } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2371.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2371.cpp new file mode 100644 index 00000000..26444ad3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2371.cpp @@ -0,0 +1,101 @@ +class CMyClass +{ + CMyClass( int a = 0, int b = 0 ); +}; + +class CMyClass2 +{ + CMyClass2( int a = 0, int b = 0 ); + CMyClass2( int a = 0 ); +}; + +class CMyClass3 +{ + CMyClass3( int a, int b = 0 ); + CMyClass3( int a = 0 ); +}; + +class CMyClass4 +{ + CMyClass4( int a = 0, int b = 0 ); + CMyClass4( short aa = 0, char * p = 0 ); +}; + +class CMyClass5 +{ + CMyClass5() = default; + CMyClass5( int a = 0, int b = 0 ); + CMyClass5( short aa = 0, char * p = 0 ); +}; + +class CMyClass6 +{ + CMyClass6( const CMyClass6& ) = default; + CMyClass6( int a = 0, int b = 0 ); + CMyClass6( short aa = 0, char * p = 0 ); +}; + +class CMyClass7 +{ + virtual void foo( const void* p = nullptr ) = 0; + CMyClass7( int a = 0, int b = 0 ); + CMyClass7( short aa = 0, char * p = 0 ); +}; + +class CMyClass8 +{ + CMyClass8( int a = 0, int b = 0 ); + CMyClass8( short aa = 0, char * p = 0 ); + virtual void foo( const void* p = nullptr ) = 0; +}; + +class CMyClass9 +{ + CMyClass9( int a = 0, int b = 0 ); + CMyClass9( short aa = 0, char * p = 0 ); + virtual void foo( const void* = nullptr ) = 0; +}; + +class CMyClassA +{ + CMyClassA( int a = 0, int b = 0 ); + CMyClassA( short aa = 0, char * p = 0 ); + virtual void foo( const void* /* p */ = nullptr ) = 0; +}; + +class CMyClassB +{ + CMyClassB( int a = 0, int b = 0 ); + CMyClassB( short aa = 0, char * p = 0 ); + virtual void foo( const void* /* p */ = NULL ) = 0; +}; + +#define UNUSED(x) + +class CMyClassC +{ + CMyClassC( int a = 0, int b = 0 ); + CMyClassC( short aa = 0, char * p = 0 ); + virtual void foo( const void* UNUSED(p) = NULL ) = 0; +}; + +class CMyClassD +{ + CMyClassD( int a = 0, int b = 0 ); + CMyClassD( short aa = 0, char * p = 0 ); + virtual void foo( const std::string s = "" ) = 0; +}; + +class CMyClassE +{ + CMyClassE( int a = 0, int b = 0 ); + CMyClassE( short aa = 0, char * p = 0 ); + virtual void foo( const std::string s = std::string() ) = 0; +}; + +class CMyClassF +{ + CMyClassF( int a = 0, int b = 0 ); + CMyClassF( short aa = 0, char * p = 0 ); + virtual void foo( const CString& s = _T( "" ) ) = 0; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2402.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2402.cpp new file mode 100644 index 00000000..92731c19 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2402.cpp @@ -0,0 +1,8 @@ +void +h1(const int a) +{ + switch (a) + { + case 1: {callFunction(a); break;} + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2433_1.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2433_1.cpp new file mode 100644 index 00000000..d19718f5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2433_1.cpp @@ -0,0 +1,8 @@ +namespace A { +namespace S { +class C +{ +}; +} // namespace S +}; // namespace A + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2433_2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2433_2.cpp new file mode 100644 index 00000000..9da12944 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_2433_2.cpp @@ -0,0 +1,22 @@ +void f(); +namespace A { +void f2(); +namespace S { +void f3(); +class C +{ +}; +void f4(); +} // namespace S +void f5(); +} // namespace A +void f6(); +namespace E +{ +void f7(); +class D +{ +};; +void f9(); +}; +void f10(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_33056.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_33056.cpp new file mode 100644 index 00000000..1339ede1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_33056.cpp @@ -0,0 +1,7 @@ +inline T* * someFunc(foo** p, bar&& q) +{ +} + +inline T && someFunc(foo * *p, bar && q) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_472.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_472.cpp new file mode 100644 index 00000000..753d9519 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_472.cpp @@ -0,0 +1,3 @@ +// comment + void +func( dbgTrace, (void) ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_481.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_481.cpp new file mode 100644 index 00000000..03c4a828 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_481.cpp @@ -0,0 +1,2 @@ +//comment +void argvInter( int argc, char* argv[], Config * config ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_484.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_484.cpp new file mode 100644 index 00000000..4c582e86 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_484.cpp @@ -0,0 +1,6 @@ + TestId::TestId( char* name ) : + n_( ( char* )name ) + { + n_( (char*)name ); + } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_485.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_485.cpp new file mode 100644 index 00000000..4865da64 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_485.cpp @@ -0,0 +1,20 @@ +void Tst::test( Msg* message_p ) + { + switch (message_p) + { + case A: + { + const table* entry2 = findMsg( message_p ); + table* entry3 = findMsg( message_p ); + } + break; + + case B: + const table* entry2 = findMsg( message_p ); + table* entry3 = findMsg( message_p ); + break; + + default: + break; + } + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_488.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_488.cpp new file mode 100644 index 00000000..382beced --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_488.cpp @@ -0,0 +1,12 @@ +void baz() +{ + foobar= bar[a + b + (c + + d)]; + + foobar = bar(a + b + (c + + + d)); + + foo = bar[a] + b + qux(c + + + d); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_495.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_495.cpp new file mode 100644 index 00000000..f356c302 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_495.cpp @@ -0,0 +1,9 @@ +void f() +{ +toto +foo1(int); +toto +foo2(bar); +int +foo3; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_612.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_612.cpp new file mode 100644 index 00000000..38253f15 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_612.cpp @@ -0,0 +1,23 @@ +void foo(void) +{ +int a = 0, b = 0; +char chvar = 0, var = 0; + +a = 0; +b = 0; +chvar = 0; +var = 0; +} + +void bar(void) +{ +int a = 0; +int b = 0; +char chvar = 0; +char var = 0; + +a = 0; +b = 0; +chvar = 0; +var = 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_631.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_631.cpp new file mode 100644 index 00000000..e110d383 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_631.cpp @@ -0,0 +1,4 @@ +static inline auto myFunc(MyType const& myValue) +->std::string + +static inline std::string myFunc(MyType const& myValue) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_633.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_633.cpp new file mode 100644 index 00000000..5b672b47 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_633.cpp @@ -0,0 +1,29 @@ +typedef void (*func)(); +typedef void (__stdcall *func)(); + +class CDataObject : public IDataObject +{ +public: + // IUnknown members + HRESULT __stdcall QueryInterface(REFIID iid, void ** ppvObject); + ULONG __stdcall AddRef(void); + ULONG __stdcall Release(void); + + // IDataObject members + HRESULT __stdcall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); + HRESULT __stdcall GetDataHere(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); + HRESULT __stdcall QueryGetData(FORMATETC *pFormatEtc); + HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut); + HRESULT __stdcall SetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease); + HRESULT __stdcall EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc); + HRESULT __stdcall DAdvise(FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *, DWORD *); + HRESULT __stdcall DUnadvise(DWORD dwConnection); + HRESULT __stdcall EnumDAdvise(IEnumSTATDATA **ppEnumAdvise); + + // exercise others + HRESULT __cdecl GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); + HRESULT __clrcall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); + HRESULT __fastcall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); + HRESULT __thiscall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); + HRESULT __vectorcall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_634.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_634.cpp new file mode 100644 index 00000000..febbf7b3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_634.cpp @@ -0,0 +1,2 @@ +__attribute__((visibility ("default"))) NSString* i; +extern "C" NSString* i; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_643.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_643.cpp new file mode 100644 index 00000000..55e3e309 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_643.cpp @@ -0,0 +1,6 @@ +class test_Dummy + : public QObject +{ + Q_OBJECT + test_Dummy* settings = nullptr; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_651.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_651.cpp new file mode 100644 index 00000000..b36e182a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_651.cpp @@ -0,0 +1,16 @@ +int a () +{ + double a_very_long_variable = test (foobar1, + foobar5); + + double a_other_very_long = asdfasdfasdfasdfasdf + asdfasfafasdfa + + asdfasdfasdf - asdfasdf + 56598; + + a_other_very_long = asdfasdfasdfasdfasdf + asdfasfafasdfa + + asdfasdfasdf - asdfasdf + 56598; + + testadsfa (dfasdf, + aaafsdfa); + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_653.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_653.cpp new file mode 100644 index 00000000..1bf853d6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_653.cpp @@ -0,0 +1,4 @@ +/* + * + **Some comment + */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_654.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_654.cpp new file mode 100644 index 00000000..8baaeb1c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_654.cpp @@ -0,0 +1,7 @@ +A( b, c, d); +connect(&mapper, SIGNAL(mapped(Q1 &)), this, SLOT(onSomeEvent(const Q2 &))); +connect(&mapper, + SIGNAL(mapped(Q1 &)), + this, + SLOT(onSomeEvent(const Q2 &))); +A( b, c, d); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_657.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_657.cpp new file mode 100644 index 00000000..230b96b3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_657.cpp @@ -0,0 +1 @@ +class NewClass: public OldClass/*somecomment*/, public SomeClass; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_662.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_662.cpp new file mode 100644 index 00000000..f8b0f8a8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_662.cpp @@ -0,0 +1,13 @@ +///foo +///<foo +//!foo +//!<foo + +//@{ +//@} + +///@{ +///@} + +//!@{ +//!@} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_663.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_663.cpp new file mode 100644 index 00000000..869320c0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_663.cpp @@ -0,0 +1,11 @@ +#define SOME_MACRO TemplateClass<T> +int i; +#if defined(_MSC_VER) + #if _MSC_VER < 1300 + #define __func__ "unknown function" + #else + #define __func__ __FUNCTION__ + #endif /* _MSC_VER < 1300 */ +#endif /* defined(_MSC_VER) */ + +#define bug_demo (1 > 2) ? (1 : 2) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_664.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_664.cpp new file mode 100644 index 00000000..148201b0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_664.cpp @@ -0,0 +1,6 @@ +bool dllInit = + []() +//34567890 +{ +}(); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_666.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_666.cpp new file mode 100644 index 00000000..00adec83 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_666.cpp @@ -0,0 +1,12 @@ +bool test() +{ + if ( true ) + { + i = 10; + } + else + if ( true ) + { + i = 10; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_670.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_670.cpp new file mode 100644 index 00000000..e9229a8e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_670.cpp @@ -0,0 +1,5 @@ +//3456789=123456789=123456789=123456789=123456789=123456789=12 +std::map<int, std::string> FOO::foo(int key, std::string value) +{ + return std::map<int, std::string>(key, value); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_670.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_670.h new file mode 100644 index 00000000..ea503b10 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_670.h @@ -0,0 +1,2 @@ +//3456789=123456789=123456789=123456789=123456789=123456789=12 +std::map<int, std::string> FOO::foo(int key, std::string value); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_671.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_671.h new file mode 100644 index 00000000..8ff7bfca --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_671.h @@ -0,0 +1,8 @@ +#define FOO_MAX 10 + +bool foo[FOO_MAX]; + +void +foo_bar( int a, + int* b, + bool foo[FOO_MAX] ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_858.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_858.cpp new file mode 100644 index 00000000..512d2e45 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_858.cpp @@ -0,0 +1,16 @@ +enum { + item1=123, + item2 // comment 2 +} + +enum +{ + item3, + item4, // comment 4 +} +enum { x, y }; +enum { x, y=0 }; +enum { x, y=0 /*comment*/ }; +enum { x, y,}; +enum { x, y=0,}; +enum { x, y=0,/*comment*/ }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_902.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_902.cpp new file mode 100644 index 00000000..eb51f587 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_902.cpp @@ -0,0 +1,65 @@ +// 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'"); + + +void detect_options(void) +{ + detect_space_options(); +} + +int i = 0; + +//a +void a(){ return 0; } + +//0 +/*b*/ +void b(){ return 0; } + +/*0*/ +//c +void c(){ return 0; } + + +//d +//d +//d +void d(){ return 0; } + +//0 + +//h +//h +void h(){ return 0; } + +/*0*/ +/*e*/ +void e(){ return 0; } + +void f(){ return 0; } + +int i = 0; +void g(){ return 0; } + +void i(){ return 0; } +void j(){ return 0; } +void k(){ return 0; } + +//0 + +void l(){ return 0; } + +/* + * 0 + */ + +void m(){ return 0; } + +/* + * n + * n + * n + */ +void n(){ return 0; } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_1000.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_1000.cpp new file mode 100644 index 00000000..06da6b3e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_1000.cpp @@ -0,0 +1,7 @@ +int main() +{ + // Newline inserted between '}' and ')' + v.push_back({ 2, 3.0 }); + v.push_back({ 2, 3.0 } + ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_197.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_197.cpp new file mode 100644 index 00000000..e86698fd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_197.cpp @@ -0,0 +1 @@ +struct A {int a;}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_322.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_322.cpp new file mode 100644 index 00000000..bc7e687f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_322.cpp @@ -0,0 +1,4 @@ +class STDMETHOD +{ +STDMETHOD(GetValues)(BSTR bsName, REFDATA** pData); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_323.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_323.cpp new file mode 100644 index 00000000..ea141156 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_323.cpp @@ -0,0 +1,4 @@ +class ATL_NO_VTABLE CProxy : + public ATL::CComCoClass<CProxy, &CLSID_Proxy> +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_359.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_359.cpp new file mode 100644 index 00000000..294e3afb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_359.cpp @@ -0,0 +1,14 @@ +int main() +{ + int foo = 42; + switch (foo) { + case 1: + std::cout << "1" << std::endl; + break; + case 2: + std::cout << "2" << std::endl; + break; + default: + std::cout << "Neither 1 nor 2." << std::endl; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_405.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_405.cpp new file mode 100644 index 00000000..eda9b0dd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_405.cpp @@ -0,0 +1,12 @@ +namespace shark { + template<class Closure> + struct indexed_iterator { + typedef typename boost::mpl::if_< + boost::is_const< + Closure + >, + typename Closure::const_reference, + typename Closure::reference + >::type reference; + }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_409.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_409.cpp new file mode 100644 index 00000000..b3b51488 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_409.cpp @@ -0,0 +1,11 @@ +if(X == Y) X = Z; +if(Y == Z) + Y = X; + +for (i=0; i<5; i++) foo(i); +for (i=0; i<5; i++) + foo(i); + +while (i<5) foo(i++); +while (i<5) + foo(i++); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_411.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_411.cpp new file mode 100644 index 00000000..647570f2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_411.cpp @@ -0,0 +1,10 @@ +class settings final +{ +public: +settings(); +~settings( ); +settings(const settings&); +settings & operator=(const settings&); +void set_something(const std::string& p_settings_name); +void set_another_setting(const std::string& p_settings_name); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_478.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_478.cpp new file mode 100644 index 00000000..857d48f7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_478.cpp @@ -0,0 +1,24 @@ +{ +QString fileName = QFileDialog::getOpenFileName(this, +tr("Choose Configuration File"), ui->leStrategyFile->text(), +tr("Configuration Files (*.cfg);; All Files (*.*)"), 0); + +pSettings = new QSettings(QCoreApplication::applicationDirPath() + "/" + +QCoreApplication::applicationName() + ".ini", +QSettings::IniFormat); +} +int a () +{ + double a_very_long_variable = test (foobar1, + foobar5); + + double a_other_very_long = asdfasdfasdfasdfasdf + asdfasfafasdfa + + asdfasdfasdf - asdfasdf + 56598; + + a_other_very_long = asdfasdfasdfasdfasdf + asdfasfafasdfa + + asdfasdfasdf - asdfasdf + 56598; + + testadsfa (dfasdf, + aaafsdfa); + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_481.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_481.cpp new file mode 100644 index 00000000..2a4e6b8f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_481.cpp @@ -0,0 +1,3 @@ +{ + connect( timer, SIGNAL( timeout( ) ), this, SLOT( timeoutImage( ) ) ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_503.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_503.cpp new file mode 100644 index 00000000..3c5951a8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_503.cpp @@ -0,0 +1,8 @@ +0B8h +__asm +{ + mov al, 0B8h + mov al, 2 + mov dx, 0xD007 + out dx, al +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_512.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_512.cpp new file mode 100644 index 00000000..3b4de434 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_512.cpp @@ -0,0 +1,4 @@ +template<typename TType> +class TTypeSpecialization1<TType> +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_525.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_525.cpp new file mode 100644 index 00000000..d0773475 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_525.cpp @@ -0,0 +1,13 @@ +EXEC SQL BEGIN DECLARE SECTION; + static char *tbuf; +EXEC SQL END DECLARE SECTION; + +void myfunc1() +{ + exec sql execute immediate :tbuf; +} + +void myfunc2() +{ + EXEC SQL EXECUTE IMMEDIATE :tbuf; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_552.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_552.cpp new file mode 100644 index 00000000..5a0704de --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_552.cpp @@ -0,0 +1,13 @@ +char *array_assign[2][4]= +{ + { + // foo + {"foo"}, + {"foo@1"},{"foo@2"},{"foo@3"} + }, + { + // bar + {"bar"}, + {"bar@1"},{"bar@2"},{"bar@3"} + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_568.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_568.cpp new file mode 100644 index 00000000..7b93e223 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_568.cpp @@ -0,0 +1,23 @@ +enum { // Keep this line as it is. It's a regression test for checking pc->prev->prev-> on CT_BRACE_OPEN. + kEnumValue = 5, +}; + +struct foo +{ + int bar : kEnumValue; + int pad : 3; +}; + +class cls +{ + int bar : kEnumValue; + int pad : 3; + + void func() + { + goto end; + bar = 1; + end: + pad = 2; + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_575.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_575.cpp new file mode 100644 index 00000000..3ef21f1f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_575.cpp @@ -0,0 +1,8 @@ +void Foo::doo() +{ + m_stackCache[m_currentStackNr]->operator [](0) = new QStandardItem(QString::number(m_currentStackNr)); + m_stackCache[m_currentStackNr]->operator [](1) = new QStandardItem(tr("OK")); + m_stackCache[m_currentStackNr]->operator [](2) = new QStandardItem("0"); + m_stackCache[m_currentStackNr]->operator [](3) = new QStandardItem("0"); + m_stackCache[m_currentStackNr]->operator [](4) = new QStandardItem(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_596.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_596.cpp new file mode 100644 index 00000000..88f77e34 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_596.cpp @@ -0,0 +1,10 @@ +#include "child.h" +int main(int argc, char*argv[]) { + (void)argc; + (void)argv; + Child child; + for (auto &attribute : * child.GetAttributes()) { + std::cout << attribute << std::endl; + } + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_646.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_646.cpp new file mode 100644 index 00000000..f89b6416 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_646.cpp @@ -0,0 +1 @@ +friend class ::MultiLabelMeshPipeline; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_663.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_663.cpp new file mode 100644 index 00000000..2a473bc7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_663.cpp @@ -0,0 +1,19 @@ +void test() +{ + switch ( n ) + { + case 1: + std::cout << "1"; + break; + + case 2: + { + std::cout << "2"; + } + break; + + case 3: + { std::cout << "3"; } + break; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_666.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_666.cpp new file mode 100644 index 00000000..00adec83 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_666.cpp @@ -0,0 +1,12 @@ +bool test() +{ + if ( true ) + { + i = 10; + } + else + if ( true ) + { + i = 10; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_682.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_682.h new file mode 100644 index 00000000..8f1fc31f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_682.h @@ -0,0 +1,4 @@ +void foo()
+{
+ return [=](T* t) { };
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_687.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_687.cpp new file mode 100644 index 00000000..0f9e8155 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_687.cpp @@ -0,0 +1,3 @@ +struct S { static if (false) void bar() { }; } + +struct S { static if (false) { void bar() { }; } } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_752.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_752.cpp new file mode 100644 index 00000000..b0b77452 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_752.cpp @@ -0,0 +1,14 @@ +int a() +{ + for(QStringList::const_iterator codesIt = _codes.constBegin(); codesIt != _codes.constEnd(); ++codesIt) { + if( // Current codes enough to compare: + ( ( *codesIt ).size() <= strId ) || + // Character on this slot was not readable: + ( ( *codesIt ).at( strId ) == m_wildcard ) || + // This character is matching: + ( code.at( strId ) == ( *codesIt ).at( strId ) ) ) { + // Ignore this slot: + continue; + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_753.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_753.cpp new file mode 100644 index 00000000..07cc31fe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_753.cpp @@ -0,0 +1,9 @@ +void Test::init() +{ + connect( m_ppcCom, + SIGNAL( sigReceivedBundle(QString) ), + SLOT( doProcessBundle(QString) ) ); + connect( m_ppcCom, + SIGNAL( sigReceivedBundle ), + SLOT( doProcessBundle ) ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_793.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_793.cpp new file mode 100644 index 00000000..6777bfa5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_793.cpp @@ -0,0 +1,4 @@ +static void h() +{ + typedef int IntGroup; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_825.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_825.cpp new file mode 100644 index 00000000..d3f89db7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_825.cpp @@ -0,0 +1,5 @@ +void a() +{ + int i = 0; + int h = 0h; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_889.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_889.cpp new file mode 100644 index 00000000..270f0695 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_889.cpp @@ -0,0 +1,8 @@ +a::b c() +{ +mapped_file_source abc((int) CW1A(sTemp)); +mapped_file_source abc((int) ::CW2A(sTemp)); +mapped_file_source abc((int) A::CW3A(sTemp)); +} + +boost::iostreams::mapped_file_source pdf((LPSTR) ATL::CW2A(sTemp)); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_928.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_928.cpp new file mode 100644 index 00000000..d2878656 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_928.cpp @@ -0,0 +1,12 @@ +namespace Test1 { namespace Test { + +CodeConstructor::CodeConstructor() +{ +} + +CodeConstructor::getSomething() +{ + return 0; +} + +}} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_938.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_938.h new file mode 100644 index 00000000..b13997a6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_938.h @@ -0,0 +1,2 @@ + +void function(void); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_999.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_999.cpp new file mode 100644 index 00000000..2a5d64a4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_999.cpp @@ -0,0 +1,2 @@ +template< class T, unsigned N = 0 > +constexpr unsigned long extent_v = extent< T, N >::value; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_width.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_width.cpp new file mode 100644 index 00000000..08f7888e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/bug_i_width.cpp @@ -0,0 +1,4 @@ +{ + // test if no split is possible + aaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccddddddddddddd; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref-2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref-2.cpp new file mode 100644 index 00000000..4666e464 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref-2.cpp @@ -0,0 +1,6 @@ +int&aa(int&x,int&b); // Sp Before Byref Func, Sp After Byref Func, Sp Before Byref, Sp After Byref +int aa(int&x,int&) // Sp Before Byref, Sp Before Unnamed Byref, Sp After Byref +{ + b = aa(x,b); + c = aa(&y,&d); // Sp Addr +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref-3.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref-3.cpp new file mode 100644 index 00000000..28da2d74 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref-3.cpp @@ -0,0 +1,11 @@ +void test(void) { + auto const ic = 1; + auto iv = 1; + auto const & ric = ic; + auto & riv = iv; + const auto & ric2 = ic; + if (auto const & r(ric); r > 0) { + } + if (auto & r(riv); r > 0) { + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref.cpp new file mode 100644 index 00000000..85669bc6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/byref.cpp @@ -0,0 +1,46 @@ +bool 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(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/case-brace-remove.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/case-brace-remove.cpp new file mode 100644 index 00000000..421ff658 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/case-brace-remove.cpp @@ -0,0 +1,22 @@ +int SomeClass::method() +{ + switch (1) { + case 0: + { + double v; + break; + } + + case 1: + { + double v; + v = this->mat.operator()(0, 0); + break; + } + + case 2: + { + foo(); + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cast.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cast.cpp new file mode 100644 index 00000000..d558e7f6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cast.cpp @@ -0,0 +1,4 @@ +{ + a = ( int)5.6; + b = int (5.6 ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/casts.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/casts.cpp new file mode 100644 index 00000000..0bcab0d9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/casts.cpp @@ -0,0 +1,6 @@ +void f() +{ + uint32 x = (uint8)b; + uint32 x = (uint16)f(a, b); + uint32 x = (uint32)std::distance(a, b); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-addr.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-addr.h new file mode 100644 index 00000000..ea539afa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-addr.h @@ -0,0 +1,11 @@ +class C +{ +public: +A* B; +C& D; +const C& D; +static C& D; +public C& D; +E=c& D; +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-implementation.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-implementation.cpp new file mode 100644 index 00000000..05eb69cf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-implementation.cpp @@ -0,0 +1,25 @@ +template<class T> +class TestTemp +{ +public: + TestTemp(); + void SetValue( T obj_i ); + T Getalue(); +private: + T m_Obj; +}; + +template <class T> +TestTemp<T>::TestTemp() +{ +} +template <class T> +void TestTemp<T>::SetValue( T obj_i ) +{ +} + +template <class T> +T TestTemp<T>::Getalue() +{ + return m_Obj; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-init.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-init.cpp new file mode 100644 index 00000000..af06e31a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class-init.cpp @@ -0,0 +1,62 @@ + +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) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class.h new file mode 100644 index 00000000..0048604d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/class.h @@ -0,0 +1,52 @@ +#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_ */ + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt-cpp-cont.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt-cpp-cont.cpp new file mode 100644 index 00000000..8885e36b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt-cpp-cont.cpp @@ -0,0 +1,17 @@ +#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] + //-------------------------------------------------------------------------- +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt-reflow.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt-reflow.cpp new file mode 100644 index 00000000..adb5a6ab --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt-reflow.cpp @@ -0,0 +1,43 @@ + +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 */ + +int cnt; /* This is a counter variable with a long comment. this should cause the comment to be wrapped. */ + +/** + * Multi-line comment + */ +void foo(void) +{ +/** + * Multi-line comment + */ + int idx; + /** + * Multi-line comment + */ +} + +/* Start Change #95 */ +/*INITIALIZE Variable(contExtnElgInd); /# Change #61 #/ */ +/*/# Start Change #35 #/ */ + +/** + * OneBigWordThatCannotBeSplitYetExceedsTheCommentWidthSettingSoThatWrappingShouldBeAttempted. + */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_backslash_eol.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_backslash_eol.cpp new file mode 100644 index 00000000..e56aec25 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_backslash_eol.cpp @@ -0,0 +1,4 @@ +foo(); +// test \ +blah(); +bar(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_convert_tab_to_spaces.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_convert_tab_to_spaces.cpp new file mode 100644 index 00000000..32ff32d3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_convert_tab_to_spaces.cpp @@ -0,0 +1,5 @@ +void f() { + /* Comment with <TAB> here + * and here again + */ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_indent.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_indent.cpp new file mode 100644 index 00000000..542a0fd2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_indent.cpp @@ -0,0 +1,32 @@ +namespace { + + /* 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); + + }; + +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_indent_pp.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_indent_pp.h new file mode 100644 index 00000000..25253f09 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_indent_pp.h @@ -0,0 +1,8 @@ +class MyClass : public BaseClass +{ + //@{ BaseClass interface +#if VERY_LONG_AND_COMPLICATED_DEFINE + void foo(); +#endif // VERY_LONG_AND_COMPLICATED_DEFINE + //@} +};
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_insert.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_insert.cpp new file mode 100644 index 00000000..a5ae87d5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_insert.cpp @@ -0,0 +1,45 @@ +#include <string> + +class CFoo +{ +CFoo(int arg); +CFoo(char arg) { +} +~CFoo(); +int foo1(int arg); +int foo2(); +int foo3(char ch, int xx) +{ +} +}; + +CFoo::CFoo(int arg) { +} + +CFoo::~CFoo() { +} + +int CFoo::foo1(int arg, int arg2) +{ +} + +int CFoo::foo2() +{ +} + +int CFoo::operator +() +{ +} + +map<string, int> func() +{ + // some codes +} + +int some_func(void) +{ +} + +class some_class_declaration; + +int some_func_declaration(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_right.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_right.cpp new file mode 100644 index 00000000..121ea044 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cmt_right.cpp @@ -0,0 +1,26 @@ +class 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) + { } + }; +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/comment-align-multiline.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/comment-align-multiline.cpp new file mode 100644 index 00000000..73dab5ec --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/comment-align-multiline.cpp @@ -0,0 +1,13 @@ +#include <stdio.h> + +void function() +{ + printf( "Hello World\n" ); + /* + output_comment_multi_simple to test replacement of \r\n to \n keep the + following \r:
+ //test + /// Another comment +//end test +*/ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/comment-align.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/comment-align.cpp new file mode 100644 index 00000000..403bf773 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/comment-align.cpp @@ -0,0 +1,34 @@ +template <class T> +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(); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/const_throw.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/const_throw.cpp new file mode 100644 index 00000000..f0d1773d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/const_throw.cpp @@ -0,0 +1,13 @@ +void GetFoo(void) +const + { return (m_Foo); } + +int GetFoo(void) + throw (std::bad_alloc) + { return (m_Foo); } + +class foo{ + void bar(void) + const; +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/constr_colon.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/constr_colon.cpp new file mode 100644 index 00000000..6c0706e5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/constr_colon.cpp @@ -0,0 +1,9 @@ +class foo +{ + void bar_c(int t, int u) + : t(222) + , u(88) + { + // code + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/constructor.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/constructor.cpp new file mode 100644 index 00000000..46abf36a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/constructor.cpp @@ -0,0 +1,31 @@ + +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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/conversion_operator.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/conversion_operator.cpp new file mode 100644 index 00000000..27b52dac --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/conversion_operator.cpp @@ -0,0 +1,5 @@ +template< class T > +operator T*() const +{ + return 0; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cout.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cout.cpp new file mode 100644 index 00000000..c3c9366d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cout.cpp @@ -0,0 +1,17 @@ +void 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); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cpp17.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cpp17.cpp new file mode 100644 index 00000000..ba463284 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cpp17.cpp @@ -0,0 +1,8 @@ +bool CompareGenomeByFeatureResults::clickOnLink(std::string const& inLink) { + auto const[sequence, type, firstPosition, lastPosition] = parseLink(inLink); + if (sequence.empty()) { + return true; + } + return showFeature(statistics.nameDocumentA, type, firstPosition, lastPosition); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cpp_move.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cpp_move.cpp new file mode 100644 index 00000000..cec9beb8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/cpp_move.cpp @@ -0,0 +1,2 @@ + +void Test(X&& val1, Y* val2); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ctor-var.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ctor-var.cpp new file mode 100644 index 00000000..2551d8bd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ctor-var.cpp @@ -0,0 +1,4 @@ +int foo() +{ + TextBody textbody(GetBody().GetText()); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/custom-open-2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/custom-open-2.cpp new file mode 100644 index 00000000..422cb1bf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/custom-open-2.cpp @@ -0,0 +1,46 @@ + + +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; + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/custom-open.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/custom-open.cpp new file mode 100644 index 00000000..1544fd74 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/custom-open.cpp @@ -0,0 +1,26 @@ + +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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/define-indentation.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/define-indentation.cpp new file mode 100644 index 00000000..69e924ee --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/define-indentation.cpp @@ -0,0 +1,2 @@ + #define EXTRACTX360ACHIEVEMENT X360Achievement_INTERNAL& mapping = ExtractMonoObjectData<X360Achievement_INTERNAL>(self); /*huh?*/ \
+ const XACHIEVEMENT_DETAILS* achievement = xenon::Achievements::GetDetails(mapping.m_index);
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/delete.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/delete.cpp new file mode 100644 index 00000000..fff916e3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/delete.cpp @@ -0,0 +1,10 @@ + +void x(int **d) { +delete *d; +} + +void x(int& d) { +delete &d; +} + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/deref.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/deref.cpp new file mode 100644 index 00000000..abfb70c7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/deref.cpp @@ -0,0 +1,15 @@ + +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); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/digraph.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/digraph.cpp new file mode 100644 index 00000000..57cfddf5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/digraph.cpp @@ -0,0 +1,5 @@ +x = reinterpret_cast< ::Symbol*>();
+
+int b() {
+ char f <: 32 :> = <% 0 %>;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/disable_macro.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/disable_macro.cpp new file mode 100644 index 00000000..cb9fc307 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/disable_macro.cpp @@ -0,0 +1,24 @@ +#include <stdio.h> + +// this macro should NOT be modified ... +#define CHK(...) \ + do \ + { \ + a+=1; \ + a=b=0; \ + c<<1; \ + } while (0+0) + + +// ... whereas this should be indented and formatted +int main() +{ + int a,b,c=0; + if (a<c) + { + c+=1; + } + a=b=0; + c<<1; + CHK; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/dont-detab-strings.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/dont-detab-strings.cpp new file mode 100644 index 00000000..fd622c3c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/dont-detab-strings.cpp @@ -0,0 +1,6 @@ +void f() {
+ auto x = " test\t ... ???";
+// *INDENT-OFF*
+ auto x = " test\t ... ???";
+// *INDENT-ON*
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/dont-process-defines.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/dont-process-defines.cpp new file mode 100644 index 00000000..a0a58f85 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/dont-process-defines.cpp @@ -0,0 +1,6 @@ +#define inline_2 __forceinline
+#define inline(i) inline_##i
+#define foo(x) inline(2) x()
+#define PLD(reg,offset) pld [reg, offset] \
+ pld [reg, offset] \
+ pld [reg, offset]
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/eigen.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/eigen.cpp new file mode 100644 index 00000000..4e228311 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/eigen.cpp @@ -0,0 +1,7 @@ +void foo() +{ + transform << 0, 1, 0, 0, + 1, 0, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum.cpp new file mode 100644 index 00000000..7f87591e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum.cpp @@ -0,0 +1,207 @@ + enum + class + angle_state_e + : + unsigned +int { + NONE=0, OPEN=1, //'<' found +CLOSE = 2 , //'>' found +}; + +// align.cpp +enum class comment_align_e : unsigned int +{ + REGULAR, + BRACE, + ENDIF, +}; + +// chunk_list.h +enum class scope_e : unsigned int +{ + ALL, /**< search in all kind of chunks */ + PREPROC, /**< search only in preprocessor chunks */ +}; + +// chunk_list.cpp +enum class direction_e : unsigned int +{ + FORWARD, + BACKWARD +}; + +// combine.cpp +{ + enum class angle_state_e : unsigned int + { + NONE = 0, + OPEN = 1, // '<' found + CLOSE = 2, // '>' found + }; +} + +// indent.cpp +enum class align_mode_e : unsigned int +{ + SHIFT, /* shift relative to the current column */ + KEEP_ABS, /* try to keep the original absolute column */ + KEEP_REL, /* try to keep the original gap */ +}; + +// align_stack.h +{ + enum StarStyle + { + SS_IGNORE, // don't look for prev stars + SS_INCLUDE, // include prev * before add + SS_DANGLE // include prev * after add + }; +} + +// log_levels.h +enum log_sev_t +{ + 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 */ + LCONTTEXT = 83, /* comment cont_text set */ + LANNOT = 84, /* Java annotation */ + LOCBLK = 85, /* OC Block stuff */ + LFLPAREN = 86, /* Flag paren */ + LOCMSGD = 87, /* OC Message declaration */ + LINDENTAG = 88, /* indent again */ + LNFD = 89, /* newline-function-def */ + LJDBI = 90, /* Java Double Brace Init */ + LSETPAR = 91, /* set_chunk_parent() */ + LSETTYP = 92, /* set_chunk_type() */ + LSETFLG = 93, /* set_chunk_flags() */ + LNLFUNCT = 94, /* newlines before function */ + LCHUNK = 95, /* Add or del chunk */ + LGUY98 = 98, /* for guy-test */ + LGUY = 99, /* for guy-test */ +}; + +// options.h +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 */ + AT_UNUM, /**< unsigned Number */ +}; + +enum argval_t +{ + AV_IGNORE = 0, + AV_ADD = 1, + AV_REMOVE = 2, + AV_FORCE = 3, /**< remove + add */ + AV_NOT_DEFINED = 4 /* to be used with QT, SIGNAL SLOT macros */ +}; + +enum lineends_e +{ + LE_LF, /* "\n" */ + LE_CRLF, /* "\r\n" */ + LE_CR, /* "\r" */ + + LE_AUTO, /* keep last */ +}; + +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), + TP_JOIN = 16, /* remove newlines on both sides */ +}; + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_class.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_class.h new file mode 100644 index 00000000..2ba9933f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_class.h @@ -0,0 +1,21 @@ +enum class A +{ +a, +b +} + +enum struct D +{ +a, +b +} + +class B { +private: + int x; +} +enum C +{ +a, +b +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_comma.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_comma.h new file mode 100644 index 00000000..42ce2c53 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_comma.h @@ -0,0 +1,8 @@ + +void function(int a, int b, int c); + +enum Test { + A, B + , C, + D, E +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_comment_wrap.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_comment_wrap.cpp new file mode 100644 index 00000000..736e6718 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_comment_wrap.cpp @@ -0,0 +1,7 @@ +enum class Eee +{ + Foo, + AnotherFoo, // comment + Bar, + DifferentBar +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_shr.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_shr.cpp new file mode 100644 index 00000000..8bde6273 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/enum_shr.cpp @@ -0,0 +1,7 @@ +enum MyEnum { + kOne = 0, + kTwo = 1 << 0, + kThree = 1 << 1, + kFour = 1 << 2 +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/exception.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/exception.cpp new file mode 100644 index 00000000..7f29676e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/exception.cpp @@ -0,0 +1,33 @@ + #include <iostream> + + +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'; + } +} + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/extern_c.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/extern_c.h new file mode 100644 index 00000000..e4943e50 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/extern_c.h @@ -0,0 +1,33 @@ +#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); + +} +#endif + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/extern_func.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/extern_func.cpp new file mode 100644 index 00000000..24e90a37 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/extern_func.cpp @@ -0,0 +1,7 @@ +void foo(); +// hello +extern "C" +BAR_EXPORT +void bar() +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/first_len_minimum.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/first_len_minimum.cpp new file mode 100644 index 00000000..0a729f01 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/first_len_minimum.cpp @@ -0,0 +1,4 @@ +/* + a + b + */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/fix_for_relational_operators.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/fix_for_relational_operators.cpp new file mode 100644 index 00000000..0014b110 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/fix_for_relational_operators.cpp @@ -0,0 +1,8 @@ +void foo() +{ +while (a < b && c > d) +i++; + +for ( ;a < b && c > d; ) +i++; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_auto.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_auto.cpp new file mode 100644 index 00000000..c62548f8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_auto.cpp @@ -0,0 +1,16 @@ +void foo() +{ + for (auto const& item : list) + bar(item); + for (const auto& item : list) + bar(item); + for (auto& item : list) + bar(item); + + auto* var = bar(); + auto& var = bar(); + auto var = bar(); + auto const* var = bar(); + auto const& var = bar(); + auto const var = bar(); +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_long.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_long.cpp new file mode 100644 index 00000000..7685f614 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_long.cpp @@ -0,0 +1,8 @@ +void foo() +{ +for(std::map<std::string, std::string>::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); +} +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_loop_head.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_loop_head.cpp new file mode 100644 index 00000000..cbfacf62 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/for_loop_head.cpp @@ -0,0 +1,10 @@ +for(int i = 1, + j = 2, + k = 3, + ; (i != 1 + && j != 2 + && k != 2) + ; i++, j++, k++ ) +{ +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/foreach.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/foreach.cpp new file mode 100644 index 00000000..cfbe7963 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/foreach.cpp @@ -0,0 +1,4 @@ +void foo()
+{
+ for_each(it.begin(), it.end(), func);
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/friends.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/friends.cpp new file mode 100644 index 00000000..1b073b45 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/friends.cpp @@ -0,0 +1,6 @@ +class foo +{ +friend void bar(); +friend void none(); +template <typename T> friend vector<T> vec(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func-param-wrap-oc.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func-param-wrap-oc.mm new file mode 100644 index 00000000..16f98ce9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func-param-wrap-oc.mm @@ -0,0 +1,5 @@ + if(progress <= 0)
+ {
+ [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(NSMinX(pieRect)+stroke,NSMinY(pieRect)+stroke,
+ NSWidth(pieRect)-2*stroke,NSHeight(pieRect)-2*stroke)] fill];
+ }
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_call.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_call.cpp new file mode 100644 index 00000000..6467560f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_call.cpp @@ -0,0 +1,14 @@ +void f() +{ + auto x = func1( + arg, + arg); +} + +void f() +{ + return func2( + arg, + arg); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_call_chain.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_call_chain.cpp new file mode 100644 index 00000000..7e2f3931 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_call_chain.cpp @@ -0,0 +1,7 @@ +void f() +{ + m_complete.back().m_replicas.clear(); + + m_complete.back().m_replicas.push_back(serverId); + m_pending.front().m_replicas.erase(r); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_class.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_class.cpp new file mode 100644 index 00000000..64a11509 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_class.cpp @@ -0,0 +1,27 @@ +/** + * Reverse the bytes in 32-bit chunks. + */ +void MD5::reverse_u32(UINT8 *buf, int n_u32) +{ + UINT8 tmp; +} + +MD5::MD5() +{ + m_buf[0] = 0x01020304; +} + +class AlignStack +{ +public: + bool m_skip_first; + AlignStack() + { + } + ~ AlignStack() + { + } + void End() + { + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_class.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_class.h new file mode 100644 index 00000000..168b0b3d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_class.h @@ -0,0 +1,16 @@ +void MD5::reverse_u32(UINT8 *buf, int n_u32); + +MD5::MD5(); + +class AlignStack +{ +public: + bool m_skip_first; + + AlignStack(); + + + ~ AlignStack(); + + void End(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_param.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_param.cpp new file mode 100644 index 00000000..24b187c1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_param.cpp @@ -0,0 +1,18 @@ +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); + +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)[] ); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_param_indent_leading_comma.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_param_indent_leading_comma.cpp new file mode 100644 index 00000000..8c62d49b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/func_param_indent_leading_comma.cpp @@ -0,0 +1,7 @@ +uint32_t foo ( uint8_t param1 + , some_datatype param2 + , datatype param3 + , another_datatype *param4 + , uint16_t param5 + , uint32_t *param6 + );
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/function-def.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/function-def.cpp new file mode 100644 index 00000000..7f5e05c4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/function-def.cpp @@ -0,0 +1,74 @@ +int &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"); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/functype_param.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/functype_param.cpp new file mode 100644 index 00000000..5d2ff4fe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/functype_param.cpp @@ -0,0 +1,2 @@ +void foo(int * (*f)(int)); +void foo(int & (*f)(int)); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/gcc_case_ellipsis.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/gcc_case_ellipsis.cpp new file mode 100644 index 00000000..b188c210 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/gcc_case_ellipsis.cpp @@ -0,0 +1,15 @@ +void f(int i) +{ + switch(i) + { + case 1 ... 2: + { + break; + } + case 3 ... 5: + break; + + default: + break + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/gh555.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/gh555.cpp new file mode 100644 index 00000000..feb059d3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/gh555.cpp @@ -0,0 +1,8 @@ +class \u005FClass // underscore character +{ +}; + +int main() +{ + string IdentifierContainingTwoUCNCharacters\u1234\U00001234 = "\u005FClass"; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/goto.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/goto.cpp new file mode 100644 index 00000000..0f50d182 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/goto.cpp @@ -0,0 +1,11 @@ +#define x struct z
+#define max(a, b) ((a) > (b) ? (a) : (b))
+
+void f()
+{
+ goto p;
+p:
+ goto q;
+q:
+ goto p;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1082.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1082.cpp new file mode 100644 index 00000000..06680c0e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1082.cpp @@ -0,0 +1,4 @@ +// there should be no break ups caused by suffix or separator +auto n2 = 1'000; +auto m1 = 0b0010'1010LL; +auto m2 = 0xfa'afUll;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1165.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1165.cpp new file mode 100644 index 00000000..c3123b59 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1165.cpp @@ -0,0 +1,14 @@ +#include <functional> + +int main() +{ + typedef std::function<void ()> C; + C callback = + [] () + { + C f([]() + { + int i; + }); + }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1181.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1181.cpp new file mode 100644 index 00000000..1a959d34 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1181.cpp @@ -0,0 +1,6 @@ +int main() +{ + if(true) {return 1;} + else if(true) {return 1;} + else {return 1;} +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1207.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1207.cpp new file mode 100644 index 00000000..0c8e1c92 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1207.cpp @@ -0,0 +1,10 @@ +#include <vector> +std::vector<int> f() +{; +return std::vector<int>{1}; +}; + +int main() +{; + return f()[0];;;;; +};
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1218.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1218.cpp new file mode 100644 index 00000000..d4d05106 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1218.cpp @@ -0,0 +1,8 @@ +// Do not add a new line because of the vbrace close that is above col 25 +// after return 1; +int main() +{ + if(1) + return 1; + return 0; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1464.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1464.cpp new file mode 100644 index 00000000..e4005841 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1464.cpp @@ -0,0 +1 @@ +auto p = std::make_pair(r * cos(a), r * sin(a)); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1466.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1466.cpp new file mode 100644 index 00000000..912488b3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1466.cpp @@ -0,0 +1 @@ +A a = {this->r * cos(b)};
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1509.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1509.cpp new file mode 100644 index 00000000..d3e79ff6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1509.cpp @@ -0,0 +1,5 @@ +void f() +{ + int i = A::B::C::bar(); + int ii = A::B::C::bar(); +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1509_bug_1112_correction.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1509_bug_1112_correction.cpp new file mode 100644 index 00000000..1470d613 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1509_bug_1112_correction.cpp @@ -0,0 +1,26 @@ +void f() +{ +int i = A::B::C::bar(); +int ii = A::B::C::bar(); +} + +int A::foo() +{ +return 1; +} +int A::B::foo() +{ +return A::foo(); +} +int A::B::C::foo() +{ +return A::B::foo(); +} +int A::B::C::D::foo() +{ +return A::B::C::foo(); +} +int A::B::C::D::E::foo() +{ +return A::B::C::D::foo(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1516.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1516.cpp new file mode 100644 index 00000000..dda01437 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1516.cpp @@ -0,0 +1,15 @@ +void myClass::foo() { + int bar; + std::string str; + DbConfig::configuredDatabase()->apply(db); + std::string str2; + + std::string str2; + f(); + DbConfig::configuredDatabase()->apply(db); + int bar; + std::string str; + + std::string str2; + f(); +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1536.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1536.cpp new file mode 100644 index 00000000..2c33ec58 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1536.cpp @@ -0,0 +1,7 @@ +void FuncA(void) +{ +} + +void FuncB(void) +{ +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1565.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1565.cpp new file mode 100644 index 00000000..5cb66589 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1565.cpp @@ -0,0 +1,9 @@ +namespace ns1 { +namespace ns2 { + + #define SOME_MACRO() \ + if(true) { \ + } + +} +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1617.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1617.cpp new file mode 100644 index 00000000..1901e3db --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1617.cpp @@ -0,0 +1,5 @@ +namespace +{ +void f(){ +}; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1768.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1768.cpp new file mode 100644 index 00000000..7fa82285 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i1768.cpp @@ -0,0 +1,6 @@ +void f(int a, int b); + +void g() +{ + f(1, 2); +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i2033.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i2033.cpp new file mode 100644 index 00000000..fd27cf6d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i2033.cpp @@ -0,0 +1,7 @@ +/* *INDENT-OFF* */ +enum E_SUNSENSOR { + EXAMPLE1, + EXAMPLE2, + SN005 +}; +/* *INDENT-ON* */ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i2116.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i2116.cpp new file mode 100644 index 00000000..8011f572 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i2116.cpp @@ -0,0 +1,2 @@ +void f() +{} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i683.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i683.cpp new file mode 100644 index 00000000..4d95c7ce --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/i683.cpp @@ -0,0 +1,42 @@ +#define concat0(a0,a1) a0 ??=??=a1 // trigraph ## +#define concat1(a0,a1) a0 %:%:a1 // digraph ## + + +#define STRINGIFY0(s) ??= s // trigraph # +#define STRINGIFY1(s) %: s // digraph # + +#define msg0(x) printf("%c: %d\n", ??=@ x, x) // trigraph #@ +#define msg1(x) printf("%c: %d\n", %:@ x, x) // digraph #@ + +// trigraph { +void x() ??< + + // trigraph [] + char a ??(??) = "a"; + // diigraph [] + char b <::> = "b"; + + bool f, g, h; + f = g = h = true; + + // trigraph || + f = g ??!??! h; + // trigraph |= + f ??!= g; + // trigraph | + f = g ??! h; + // trigraph ^= + f ??'= g; + // trigraph ^ + f = g ??' h; + + // trigraph [, ] + int m ??(5??); + // digraph [, ] + int n <:5:>; + +// trigraph } +return; ??> + +// digraph {, } +int y() <% return 1; %>
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if-constexpr.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if-constexpr.cpp new file mode 100644 index 00000000..76f37f92 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if-constexpr.cpp @@ -0,0 +1,7 @@ +int foo() +{ + if constexpr (a == 0) { + return 1; + } + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if_chain_braces.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if_chain_braces.cpp new file mode 100644 index 00000000..b544f2bf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if_chain_braces.cpp @@ -0,0 +1,33 @@ + +int foo() { + if ( a ) + return 1; + else if ( b ) + return 2; + + if ( a ) + return 3; + else if ( b ) + return 4; + else { + a = 5; + return 5; + } + + if ( a ) + return 6; + else + return 7; + + if ( a ) + return 8; + + if ( b ) { + return 9; + } + + if ( b ) { + { b = 5; } + return 9; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if_constexpr.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if_constexpr.cpp new file mode 100644 index 00000000..032f74ec --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/if_constexpr.cpp @@ -0,0 +1,8 @@ +static constexpr int test{ + if constexpr (condition_1) + return 1; + else if constexpr (condition_2) + return 2; + else + return 3; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ifcomment.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ifcomment.cpp new file mode 100644 index 00000000..52f508f6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ifcomment.cpp @@ -0,0 +1,7 @@ +if (true) // indent_relative_single_line_comments = false
+ return;
+if ( foo ) { // true
+ bar(1); // action 1
+} else { // false
+ bar(2); // action 2
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-c.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-c.cpp new file mode 100644 index 00000000..6157444b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-c.cpp @@ -0,0 +1,1084 @@ +/** + * @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 <cstdio> +#include <cstdlib> +#include <cstring> +#include <cerrno> +#include <cctype> + + +/** + * 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); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-inside-ternary-operator.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-inside-ternary-operator.cpp new file mode 100644 index 00000000..6cd779a3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-inside-ternary-operator.cpp @@ -0,0 +1,125 @@ +(tmp + ? chunk_is_newline(tmp) +? "newline" + : chunk_is_comment(tmp) + ? "comment" + : "other" + : chunk_is_newline(tmp) + ? "newline" + : chunk_is_comment(tmp) + ? "comment" + : "other"); + +a +? b + + c + : d + + e; + + return + outerFlag + ? RadioButton + : innerFlag + ? Badge + : nil; + +x = outerFlag + ? RadioButton( + arg1 + ) + : Checkbutton + .arg2; + + Builder + .child( + outerFlag + ? RadioButton( + buttonArg + ) + : innerFlag + ? Badge + .component( + LabelText) + : nil + ); + + +accessoryType + ? ConKSC1{} + : flag == false + ? ConKSC2{} + .build() + : flag == true + ? ConKSC3{} + .build() + : ConKSC4{} + .build(); + +options.meta == nil + ? metaCmpnt + : CBuilder() +.spacing(4) + .subCmpnt( + CBuilder() + .build()); + +options.meta == nil + ? CBuilder() + .spacing(4) +.subCmpnt( + CBuilder() +.build() +) +: Builder + .spacing; + + options == nil ? CBuilder() + .spacing(6) +: Builder + .spacing; + + options == nil ? CBuilder() + .spacing(6) : Builder + .spacing; + +flag + ? isChild + ? TypeBack +: TypeCancel + : nil; + + +func something() { + if (flag) { + x == flag + ? Builder + .spacing + : Builder + .spacing; + } +} + + +flag1 +? ( flag2 + ? ( flag3 + ? result1 + : result2 ) + : ( result3 ) + ) + : ( flag5 + ? ( flag + ? result4 + : result5) + : ( flag6 + ? result6 + : ( result7 ) + ) + ); + + +flag1 +? result1 + : ( + flag5 + ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-misc.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-misc.cpp new file mode 100644 index 00000000..78a924f4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-misc.cpp @@ -0,0 +1,59 @@ +struct 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 + ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-off.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-off.cpp new file mode 100644 index 00000000..79a7ad65 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent-off.cpp @@ -0,0 +1,25 @@ +struct X { +void operator-(int); +void operator+(int); +void operator()(); +}; +/* *INDENT-OFF* */ + struct Y { + void operator-(int){} + + + void operator+(int){} \ + void operator()(){} + + void func() { + auto x = " test\t ... ???";} + }; +/* *INDENT-ON* */ +struct Y { +void operator-(int){} +void operator+(int){} +void operator()(){} + void func() { + auto x = " test\t ... ???";} +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent.cpp new file mode 100644 index 00000000..a8c4a514 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent.cpp @@ -0,0 +1,20 @@ +int a () +{ + double a_very_long_variable = test (foobar1, + foobar5); +//3456789=123456789=123456789=123456789= + + double a_other_very_long = asdfasdfasdfasdfasdf + asdfasfafasdfa + + asdfasdfasdf - asdfasdf + 56598; +//3456789=123456789=123456789=123456789= + + a_other_very_long = asdfasdfasdfasdfasdf + asdfasfafasdfa + + asdfasdfasdf - asdfasdf + 56598; +//3456789=123456789=123456789=123456789= + + testadsfa (dfasdf, + aaafsdfa); +//3456789=123456789=123456789=123456789= + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_braces_no.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_braces_no.h new file mode 100644 index 00000000..c5b39b37 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_braces_no.h @@ -0,0 +1,24 @@ + + +class MyClass +{ +public: + +struct something +{ +int one; +int two; +} + +MyClass() +{ +} + +void oneFunction() +{ +if (1 == 0) +{ +instructions; +} +} +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_comment_align_thresh.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_comment_align_thresh.cpp new file mode 100644 index 00000000..7ddfacbf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_comment_align_thresh.cpp @@ -0,0 +1,153 @@ +// First comment + // Second comment + + // First comment +// Second comment + +// Issue #1134 +class MyClass : public BaseClass +{ + //@{ BaseClass interface +#if VERY_LONG_AND_COMPLICATED_DEFINE + void foo(); +#endif // VERY_LONG_AND_COMPLICATED_DEFINE + //@} +}; + +// Issue #1287 +void foo() +{ +#if defined(SUPPORT_FEATURE) + bar(); +#endif // SUPPORT_FEATURE + // Handle error + if (error != 0) + { + } + +#if defined(SUPPORT_FEATURE) + bar(); +#endif // SUPPORT_FEATURE + // Handle error + // Handle error + if (error != 0) + { + } + +# if defined(SUPPORT_FEATURE) + bar(); +# endif // SUPPORT_FEATURE + // SUPPORT_FEATURE + // Handle error + // Handle error + if (error != 0) + { + } + +# if defined(SUPPORT_FEATURE) + bar(); +# endif // SUPPORT_FEATURE + // SUPPORT_FEATURE + // Handle error + // Handle error + if (error != 0) + { + } + + #if defined(SUPPORT_FEATURE) + bar(); + #endif /* SUPPORT_FEATURE + SUPPORT_FEATURE */ + // Handle error + // Handle error + if (error != 0) + { + } +} + +// ----- Some namespace scope -------------------------------------------------- +// ----- FooNamespace scope ---------------------------------------------------- +namespace FooNamespace +{ +// ----- Some classes scope ---------------------------------------------------- +// ----- FooClass scope -------------------------------------------------------- +class FooClass +{ + using FooUsing = FooTemplate< + param1, + param2 + >; // FooTemplate + // Foo description + void foo() + { + if (a == b) + { +// Col1 comment + // Col1 comment + // Col1 comment + // Baz description + baz(); // Baz trailing comment begin + // Baz trailing comment ... + // Baz trailing comment end + } // if (a == b) + // Bar description begin + // Bar description ... + // Bar description end + bar( + a, + b + ); // bar trailing comment begin + // bar trailing comment ... + // Baz trailing comment end + /*! Baz description begin + *Baz description ... + * Baz description end */ + baz(a, + b); /* Baz trailing comment begin + Baz trailing comment ... + Baz trailing comment end */ + // Bar description + bar(); // bar trailing comment begin + // bar trailing comment ... + // Baz trailing comment end + + // Baz description + baz(); + } + void bar(); + // Many methods + void baz(); +}; // FooClass +// ----- FooClass scope -------------------------------------------------------- + +// Many classes + // Many classes + // Many classes + +class BazClass +{ + void foo(); + +// Many methods + // Many methods + // Many methods + +// Overrides + // Overrides + //Overrides +protected: + // Bar description + void baz(); + //Overrides +}; // BazClass trailing comment begin + // BazClass trailing comment ... + // BazClass trailing comment end +// ----- Some classes scope ---------------------------------------------------- +} // FooNamespace trailing comment begin + // FooNamespace trailing comment end +// ----- FooNamespace scope ---------------------------------------------------- +// BarNamespace description +namespace BarNamespace +{ +} // namespace BarNamespace +// ----- Some namespace scope -------------------------------------------------- diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_ctor_init.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_ctor_init.cpp new file mode 100644 index 00000000..d9fefe24 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_ctor_init.cpp @@ -0,0 +1,12 @@ +struct MyClass : public Foo, + private Bar { + MyClass(int a, int b, int c) + : m_a(a), m_b(b), + m_c(c) {} +private : + int m_a, m_b, m_c; +}; + +struct TheirClass +: public Foo, +private Bar {}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_ctor_members_twice.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_ctor_members_twice.cpp new file mode 100644 index 00000000..4fbd1b4c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_ctor_members_twice.cpp @@ -0,0 +1,5 @@ +Foo::Foo() : + Base(12), + mValue(24) { + func(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace.h new file mode 100644 index 00000000..f97bd324 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace.h @@ -0,0 +1,32 @@ +namespace 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; + }; + +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace2.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace2.h new file mode 100644 index 00000000..db2ce47d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace2.h @@ -0,0 +1,13 @@ +namespace ns1 { +namespace ns2 { +namespace ns3{ + + using namespace foo::os; + + class foo2 + { + int i2; + }; + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace_single_indent.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace_single_indent.h new file mode 100644 index 00000000..97d57444 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_namespace_single_indent.h @@ -0,0 +1,100 @@ +namespace ns1 { + namespace ns2 { + namespace ns3 { + void a(); + } + } +} + +extern "C" { + namespace ns1 { + namespace ns2 { + namespace ns3 { + void b(); + } + } + } +} + +namespace ns1 { + extern "C" { + namespace ns2 { + namespace ns3 { + void c(); + } + } + } +} + +namespace ns1 { + namespace ns2 { + extern "C" { + namespace ns3 { + void d(); + } + } + } +} + +namespace ns1 { + namespace ns2 { + namespace ns3 { + extern "C" { + void e(); + } + } + } +} + +#define M1(ns1, ns2, ns3, f) \ + namespace ns1 { \ + namespace ns2 { \ + namespace ns3 { \ + void f(); \ + } \ + } \ + } + +#define M2(ns1, ns2, ns3, f) \ + extern "C" { \ + namespace ns1 { \ + namespace ns2 { \ + namespace ns3 { \ + void b(); \ + } \ + } \ + } \ + } + +#define M3(ns1, ns2, ns3, f) \ + namespace ns1 { \ + extern "C" { \ + namespace ns2 { \ + namespace ns3 { \ + void c(); \ + } \ + } \ + } \ + } + +#define M4(ns1, ns2, ns3, f) \ + namespace ns1 { \ + namespace ns2 { \ + extern "C" { \ + namespace ns3 { \ + void d(); \ + } \ + } \ + } \ + } + +#define M5(ns1, ns2, ns3, f) \ + namespace ns1 { \ + namespace ns2 { \ + namespace ns3 { \ + extern "C" { \ + void e(); \ + } \ + } \ + } \ + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_off_after_return.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_off_after_return.cpp new file mode 100644 index 00000000..534d0ebe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_off_after_return.cpp @@ -0,0 +1,38 @@ +int foo1() +{ + return std::pair<int, int>{ + 1, 2 + }.first; +} + +int foo2() +{ + return + int{3} & 2; +} + +int foo3() +{ + constexpr static int x = 3; + return + decltype(x){x} & 2; +} + +int foo4() +{ + return + new Type(); +} + +int foo5() +{ + return + veryLongMethodCall( + arg1, + longMethodCall( + methodCall( + arg2, arg3 + ), arg4 + ) + ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_param.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_param.cpp new file mode 100644 index 00000000..c194141b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_param.cpp @@ -0,0 +1,4 @@ +extern int select(int __nfds, fd_set * __restrict __readfds, + fd_set * __restrict __writefds, + fd_set * __restrict __exceptfds, + struct timeval * __restrict __timeout); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_call.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_call.cpp new file mode 100644 index 00000000..96b38fba --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_call.cpp @@ -0,0 +1,8 @@ +SomeClass::SomeClass()
+{
+ SomeFunction
+ (
+ aTest,
+ aResult
+ );
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_decl.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_decl.cpp new file mode 100644 index 00000000..ff8c3e44 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_decl.cpp @@ -0,0 +1,8 @@ +class SomeClass {
+public:
+void SomeFunction
+(
+ int const aTest,
+ int const aResult
+);
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_def.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_def.cpp new file mode 100644 index 00000000..703e0422 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_paren_after_func_def.cpp @@ -0,0 +1,12 @@ +class SomeClass
+{
+public:
+void SomeFunction
+(
+ int const aTest,
+ int const aResult
+)
+{
+ DoSomeStuff();
+}
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_shift.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_shift.cpp new file mode 100644 index 00000000..54684fa7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_shift.cpp @@ -0,0 +1,139 @@ +// We want simple 4-space indentation for each nesting "level". + +// cannot find a way to tell uncrustify to indent the line with parenthesis +int case2() { + + if (condition) { + // some code here + } + + std::out << + "hello " << "world " << + (who ? "and " : "or ") << + "all " << + "others" << ";" << std::endl; + + // and + + if (condition) { + // some code here + } + + std::out << + "hello " << "world " << + ("and ") << + "all " << + "others" << ";" << std::endl; + + if (cond) + std::out << "hi"; + +if (cond) +std::out +<< "hi" +<< "and" +<< "more" +; + +switch (var) { + case 0: +log() << 5 +<< 5; + break; +} + +#if 0 + out + << 5; +#endif + + return log + >> var + >> second + ; +} + + +// uncrustify aligns (with the << on the first line) instead of indenting +void case3() +{ + + if (condition1) { + + if (condition2) { + + std::out << "hello " + << "world " + << (who ? "and " : "or ") + << "all " + << "others" << ";" << std::endl; + + } + } + + // this often works better, but has problems with parentheses: + + if (condition1) { + if (condition2) { + std::out << "hello " << + "world " << + (who ? "and " : "or ") << + "all " << + "others" << ";" << std::endl; + } + } +} + +// uncrustify does not indent >> at all! +void case4() +{ + if (condition) { + // some code here + } + + std::in >> a + >> b + >> (who ? c : d) >> + >> e; + + // and + + if (condition1) { + + if (condition2) { + std::in >> a >> + b >> + (who ? c : d) >> + e; + } + } +} + +void foo() { + + if (head()) + os << "HEAD,"; + else + if (tail()) + os << "TAIL,"; + + if (a >= 0 && + b <= 0) + cerr << "it is"; +} + +int list[] = { + 1, +2, + 1 << 5, + 1 << 6 +}; + +void check() { + ostream &os = Comment(1) << "error: " << workerName << + " terminated by signal " << WTERMSIG(exitStatus); + + return theAddr.addrN().family() == AF_INET6 ? + (theAddr.octet(idx * 2) << 8) + theAddr.octet(idx * 2 + 1) : + theAddr.octet(idx); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_switch_pp.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_switch_pp.cpp new file mode 100644 index 00000000..1b76e218 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_switch_pp.cpp @@ -0,0 +1,20 @@ +// Example for not indenting preprocesser statements inside switch statements
+switch(...)
+{
+case 1:
+case 2:
+{
+int v;
+...
+}
+break;
+
+#if (USE_FIVE)
+case 3:
+doFive();
+break;
+#endif
+
+default:
+break;
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_var_def.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_var_def.cpp new file mode 100644 index 00000000..394cfb63 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_var_def.cpp @@ -0,0 +1,7 @@ +void function(){ +int n; +float f; +anotherFunction(); +char foo; +somethingelse(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_var_def_cont.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_var_def_cont.cpp new file mode 100644 index 00000000..d273ae52 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/indent_var_def_cont.cpp @@ -0,0 +1,16 @@ +int +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 }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/init-list-call.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/init-list-call.cpp new file mode 100644 index 00000000..70451ac4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/init-list-call.cpp @@ -0,0 +1 @@ +auto x = foo{0}(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/init_align.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/init_align.h new file mode 100644 index 00000000..ff1dcc9b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/init_align.h @@ -0,0 +1,22 @@ +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 }, + { ".sqc", "", LANG_C }, // embedded SQL +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/initlist_leading_commas.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/initlist_leading_commas.cpp new file mode 100644 index 00000000..83188d77 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/initlist_leading_commas.cpp @@ -0,0 +1,5 @@ +MyClass::MyClass(Type *var1, Type *var2) : + BaseClass(parent) + , mVar1(var1) + , mVar2(var2) { +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/interface-keyword-in-cpp.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/interface-keyword-in-cpp.cpp new file mode 100644 index 00000000..bc039e18 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/interface-keyword-in-cpp.cpp @@ -0,0 +1,62 @@ +#include "sdkconfig.h" + +#include <fs/nvs_storage.hpp> +#include <network/interface.hpp> + +extern "C" void app_main (void) { + fs::nvs_storage ::initialize (); + network::interface ::initialize (); +} + +#include "sdkconfig.h" +#include "esp_wifi.h" +#include "network/interface.hpp" + + +using namespace network; +void interface ::initialize () { + tcpip_adapter_init (); +} + +// ---------------------------------------- + +namespace A { + class interface { + public: + interface() { + } + + ~interface() { + } + + void foo() {} + }; +} + +namespace B { + class interface { + public: + interface(); + ~interface(); + void foo(); + }; + + inline interface :: interface() {} + inline interface :: ~interface() {} + inline void interface :: foo() {} +} + +namespace C { + class interface { + public: + interface(); + ~interface(); + void foo(); + }; + + interface :: interface() {} + interface :: ~interface() {} + void interface :: foo() {} +} + +interface :: external_iterface; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1752.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1752.cpp new file mode 100644 index 00000000..e3be4d50 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1752.cpp @@ -0,0 +1,3 @@ +#define WARN_IF(EXP) \ + do { if (EXP) \ + fprintf (stderr, "Warning: " #EXP "\n"); } \ diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1778.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1778.cpp new file mode 100644 index 00000000..4eea46e0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1778.cpp @@ -0,0 +1,7 @@ +using x = Foo::foo_t; + +using a1 = decltype( &Foo::operator() ); +using a2 = Bar<decltype( &Foo::operator() )>; + +using b1 = decltype( *Foo::y ); +using b2 = Bar<decltype( *Foo::y )>; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1782.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1782.cpp new file mode 100644 index 00000000..c12b83d0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1782.cpp @@ -0,0 +1,20 @@ +using a1 = decltype(bar()); +using b1 = decltype(bar<int>()); +using c1 = decltype(foo::bar<int>()); +using d1 = decltype(*(bar<int>())); +using e1 = decltype(*(foo::bar<int>())); + +using a2 = decltype( bar ( ) ); +using b2 = decltype( bar < int > ( ) ); +using c2 = decltype( foo::bar < int > ( ) ); +using d2 = decltype( *( bar < int > ( ) ) ); +using e2 = decltype( *( foo::bar < int > ( ) ) ); + +using a3 = decltype( bar ( 0 ) ); +using b3 = decltype( bar < int > ( 0 ) ); +using c3 = decltype( foo::bar < int > ( 0 ) ); +using d3 = decltype( *( bar < int > ( 0 ) ) ); +using e3 = decltype( *( foo::bar < int > ( 0 ) ) ); + +using x1 = decltype((0)); +using x2 = decltype( ( 0 ) ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1804.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1804.cpp new file mode 100644 index 00000000..2923a4a2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1804.cpp @@ -0,0 +1,2 @@ +void foo1(int(&x)[2]); +void foo2( int ( & x ) [ 2 ] ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1916.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1916.cpp new file mode 100644 index 00000000..4c819605 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1916.cpp @@ -0,0 +1,8 @@ +int x; + +decltype (x) y; +decltype (x) z = 5; + +decltype (char{5}) a = 'a'; + +using x_t = decltype (x) ; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1919.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1919.cpp new file mode 100644 index 00000000..187065d6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1919.cpp @@ -0,0 +1,15 @@ +void foo() +{ + int a; + vector<unsigned> b; + long c; + decltype(a) d; +} + +void bar() +{ + int a; + std::vector<unsigned> b; + long c; + decltype(a) d; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1946.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1946.cpp new file mode 100644 index 00000000..9682da68 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1946.cpp @@ -0,0 +1,5 @@ +namespace foo +{ +long_type_name_t &foo1(); +foo_t &foo2(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1985.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1985.cpp new file mode 100644 index 00000000..4e5685a1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_1985.cpp @@ -0,0 +1,44 @@ +// Don't break a prototype followed by a one-liner +class foo1 +{ +foo1(); +foo1(int) {} +int bar(); +int bar(int) { return 0; } +foo1(long); +foo1(short) {} +int x; +}; + +// Don't break a one-liner followed by a prototype +class foo2 +{ +foo2(int) {} +foo2(); +int bar(int) { return 0; } +int bar(); +foo2(short) {} +foo2(long); +int x; +}; + +// Do break a prototype followed by a multi-line definition +class foo3 +{ +foo3(); +foo3(int) +{ + x = 0; +} +int bar(); +int bar(int) +{ + return 0; +} +foo3(long); +foo3(short) +{ + x = 0; +} +int x; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2000.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2000.cpp new file mode 100644 index 00000000..aa324f2e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2000.cpp @@ -0,0 +1,14 @@ +int bar; +// blank line should be inserted before this comment +vector<int> foo() +{ + return {}; +} +// blank line should be inserted before this comment, not after +template<> +volatile +int x:: +foo() +{ + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2001.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2001.cpp new file mode 100644 index 00000000..39b9446d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2001.cpp @@ -0,0 +1,2 @@ +extern int foo(); +extern int foo(size_t); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2124-1.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2124-1.cpp new file mode 100644 index 00000000..8c582cf9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2124-1.cpp @@ -0,0 +1,48 @@ +if(x)[[likely]]{} +if(x) +[[unlikely]] +{} + +g(); + +if(x)[[likely]]l(); +if(x) +[[unlikely]] +l(); + +g(); + +if(x) +[[unlikely]] +l1(); +else +l2(); + +g(); + +if(x) +#if __has_cpp_attribute(likely) +[[likely]] +#endif + return false; +else + return true; + +g(); + +while(true)[[likely]]{break;} +while(true) +[[unlikely]] +{break;} + +g(); + +if(x) + [[likely]] +{ + if(y) + [[likely]] + {} +} + +g();
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2124-2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2124-2.cpp new file mode 100644 index 00000000..8c582cf9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2124-2.cpp @@ -0,0 +1,48 @@ +if(x)[[likely]]{} +if(x) +[[unlikely]] +{} + +g(); + +if(x)[[likely]]l(); +if(x) +[[unlikely]] +l(); + +g(); + +if(x) +[[unlikely]] +l1(); +else +l2(); + +g(); + +if(x) +#if __has_cpp_attribute(likely) +[[likely]] +#endif + return false; +else + return true; + +g(); + +while(true)[[likely]]{break;} +while(true) +[[unlikely]] +{break;} + +g(); + +if(x) + [[likely]] +{ + if(y) + [[likely]] + {} +} + +g();
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2209-1.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2209-1.cpp new file mode 100644 index 00000000..a1ebb1a7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2209-1.cpp @@ -0,0 +1,8 @@ +namespace +{ + +void g(int a1234567890123456, int b1234567890123456, int c1234567890123456) +{ +} + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2209-2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2209-2.cpp new file mode 100644 index 00000000..5725d3d7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2209-2.cpp @@ -0,0 +1,10 @@ +namespace +{ + +int f = 0; + +} + +void g(int a1234567890123456, int b1234567890123456, int c1234567890123456) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2623.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2623.cpp new file mode 100644 index 00000000..5834e4b3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_2623.cpp @@ -0,0 +1,30 @@ +void child() { + static_cast< id<Mountable >> ( object); +} + +assert(x<0 && y>=3); +assert(y <0&&z> 2); +assert(a>>1); + +std::unique_ptr<Interface< T >> GetProjectionAdapter(const std::string& model_name); + +auto c = a< b>>c; +auto c = a << b >>c; + +if (Something<a> == c) { +} + +if (id< Something<a >> == c) { +} + +const std::vector< Eigen::Matrix<T, A, B >> & P_c; + +const unsigned int wl = w>> lvl; + +using Poly = Model<P, Poly<Dx,Dy, Dz>>; + +void Compute( + Image<E::Matrix< SType, Dim,Int >> const& src, + Image< E::Matrix< TType,Dim, std::string> >& dst); + +Opt<std::vector < std::unordered_set<FrameId> >> partition; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_523.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_523.cpp new file mode 100644 index 00000000..d203e398 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_523.cpp @@ -0,0 +1,4 @@ + +#define MACRO(templ_type) template <typename T> class Abc<templ_type<T> > { } + +template<typename T> class Foo<Bar<T> > { }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_547_for_each.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_547_for_each.cpp new file mode 100644 index 00000000..cfbe7963 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_547_for_each.cpp @@ -0,0 +1,4 @@ +void foo()
+{
+ for_each(it.begin(), it.end(), func);
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_564.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_564.cpp new file mode 100644 index 00000000..0c289a8a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_564.cpp @@ -0,0 +1,3 @@ +CGPathMoveToPoint (bottomArrow, NULL, round(aPoint.x) + .5/self.contentsScale -3, aPoint.y - aLength+1 +4);
+CGPathAddLineToPoint(bottomArrow, NULL, round(aPoint.x) + .5/self.contentsScale , aPoint.y - aLength+1 );
+CGPathAddLineToPoint(bottomArrow, NULL, round(aPoint.x) + .5/self.contentsScale +3, aPoint.y - aLength+1 +4);
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_574.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_574.cpp new file mode 100644 index 00000000..18995f7b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_574.cpp @@ -0,0 +1,12 @@ +class A {
+// crash (two parameter, 2nd string parameter has space)
+void check( const QObject* object, const QStringList& strList = QStringList(QString(QLatin1String("one two"))));
+// no crash (two parameter, 2nd string parameter has no space)
+void check( const QObject* object, const QStringList& strList = QStringList(QString(QLatin1String("one"))));
+// no crash (removed QLatin1String)
+void check( const QObject* object, const QStringList& strList = QStringList(QString(("one two"))));
+// no crash (removed QString(QLatin1String))
+void check( const QObject* object, const QStringList& strList = QStringList());
+// no crash (removed 1st parameter only)
+void check( const QStringList& strList = QStringList(QString(QLatin1String("one two"))) );
+};
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_624_angle.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_624_angle.cpp new file mode 100644 index 00000000..255db223 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_624_angle.cpp @@ -0,0 +1,2 @@ +auto c = a < b >> 1;
+auto c = a < b;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_633_typename.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_633_typename.cpp new file mode 100644 index 00000000..e99742ef --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_633_typename.cpp @@ -0,0 +1,24 @@ +template < typename TImage > +class MorphologicalContourInterpolator: + public ImageToImageFilter< TImage, TImage > +{ + template < typename T > + friend class MorphologicalContourInterpolatorParallelInvoker; + friend class ::MultiLabelMeshPipeline; + +public: + /** Standard class typedefs. */ + typedef MorphologicalContourInterpolator Self; + +protected: + MorphologicalContourInterpolator(); + ~MorphologicalContourInterpolator() {} + typename TImage::PixelType m_Label; + int m_Axis; + bool m_HeuristicAlignment; + +private: + MorphologicalContourInterpolator( const Self& ) ITK_DELETE_FUNCTION; + void + operator=( const Self& ) ITK_DELETE_FUNCTION; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_672.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_672.cpp new file mode 100644 index 00000000..6d8dde90 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/issue_672.cpp @@ -0,0 +1,8 @@ +class +MyClass +{ +public: + void f123(MyType1 AAAAAAAAAAAAAA, MyType2 BBBBBBBBBBBB, int XXXXXXXXXXXXXXX); + void foo(::some::very::looong::_and::complicated::name::MyType& a, ::some::very::looong::_and::complicated::name::MyType& b, + some::very::looong::_and::complicated::name::MyType& c); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/kw_subst.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/kw_subst.cpp new file mode 100644 index 00000000..e57868e2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/kw_subst.cpp @@ -0,0 +1,32 @@ +#include <string> + +class CFoo +{ +int foo1(int arg); +int foo2(); +int foo3(char ch, int xx) +{ +} +}; + +int CFoo::foo1(int arg, int arg2) +{ +} + +int CFoo::foo2() +{ +} + +int CFoo::operator +() +{ +} + +map<string, int> func() +{ + // some codes +} + +int some_func(void) +{ +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/kw_subst2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/kw_subst2.cpp new file mode 100644 index 00000000..d167cc1c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/kw_subst2.cpp @@ -0,0 +1,36 @@ +#include <string> + +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<string, int> func() +{ + // some codes +} + +int some_func(void) +{ +} + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda.cpp new file mode 100644 index 00000000..bdc499a6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda.cpp @@ -0,0 +1,77 @@ +void f1() +{ + auto a = + [=](int *a, Something & b) + { + std::cout << "blah: " << *a; + }; +} + +void f1a() +{ + std::for_each(a, b, + [](Something & b) + { + std::cout << "blah: " << *a; + }); +} + +void f1b() +{ + std::for_each(a, b, + [](int & b) -> foo + { + b += 3; + return b; + }); +} + +void f2() +{ + Invoke(a, b, + [&one, two](int *a, Something & b) + { + std::cout << "blah: " << *a; + }); +} + +void f3a() +{ + auto a = [] {}; + auto b = []{return true;}; +} + +void f3b() +{ + Invoke(a, b, + [&one, two] + { + std::cout << "blah: " << one << two; + }); +} + +void f3c() +{ + int a[]{}; +} + +void g1() +{ + auto a = [ = ](int* a, Something &b) { std::cout << "blah: " << *a; }; +} + +void g1a() +{ + std::for_each(a, b, [](Something& b){std::cout<<"blah: "<<* a;}); +} + +void g1b() +{ + std::for_each(a, b, [] (int& b)->foo{ b+=3; return(b); }); +} + +void g2() +{ + Invoke(a, b, + [&one, two] (int *a, Something&b){ std::cout << "blah: " << *a; }); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda2.cpp new file mode 100644 index 00000000..d641c281 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda2.cpp @@ -0,0 +1,82 @@ +void f1() +{ + auto a = + [=](int *a, Something & b) + { + std::cout << "blah: " << *a; + }; +} + +void f1a() +{ + std::for_each(a, b, + [](Something & b) + { + std::cout << "blah: " << *a; + } + ); +} + +void f1b() +{ + std::for_each(a, b, + [](int & b) -> foo + { + b += 3; + return b; + } + ); +} + +void f2() +{ + Invoke(a, b, + [&one, two](int *a, Something & b) + { + std::cout << "blah: " << *a; + } + ); +} + +void f3a() +{ + auto a = [] {}; + auto b = []{return true;}; +} + +void f3b() +{ + Invoke(a, b, + [&one, two] + { + std::cout << "blah: " << one << two; + } + ); +} + +void f3c() +{ + int a[]{}; +} + +void g1() +{ + auto a = [ = ](int* a, Something &b) { std::cout << "blah: " << *a; }; +} + +void g1a() +{ + std::for_each(a, b, [](Something& b){std::cout<<"blah: "<<* a;}); +} + +void g1b() +{ + std::for_each(a, b, [] (int& b)->foo{ b+=3; return(b); }); +} + +void g2() +{ + Invoke(a, b, + [&one, two] (int *a, Something&b){ std::cout << "blah: " << *a; }); + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda_in_one_liner.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda_in_one_liner.cpp new file mode 100644 index 00000000..c740c4bd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda_in_one_liner.cpp @@ -0,0 +1,6 @@ +void bar(); + +struct foo +{ + foo() { []{ bar(); }(); } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda_selfcalling.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda_selfcalling.cpp new file mode 100644 index 00000000..543290fa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lambda_selfcalling.cpp @@ -0,0 +1,12 @@ +void f(){ + int i = 0; + const auto j = [](int k){ + return k+2; + } + (i); + + const auto l = ([](int k){ + return k+2; + }) + (i); +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Mac.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Mac.cpp new file mode 100644 index 00000000..608952c0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Mac.cpp @@ -0,0 +1 @@ +int main ()
{
a = 5;
bbbb = 6.0;
int a = 5;
float bbbb = 6.0;
bbbb = 1.0
}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Unix.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Unix.cpp new file mode 100644 index 00000000..cdbf7653 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Unix.cpp @@ -0,0 +1,9 @@ +int main () +{ + a = 5; + bbbb = 6.0; + int a = 5; + float bbbb = 6.0; + + bbbb = 1.0 +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Win.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Win.cpp new file mode 100644 index 00000000..20fa083a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/lineEndings-Win.cpp @@ -0,0 +1,9 @@ +int main ()
+{
+ a = 5;
+ bbbb = 6.0;
+ int a = 5;
+ float bbbb = 6.0;
+
+ bbbb = 1.0
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/long_br_cmt.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/long_br_cmt.cpp new file mode 100644 index 00000000..a7638876 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/long_br_cmt.cpp @@ -0,0 +1,59 @@ + +namespace a::b +{ +void foo::bar(int xx) +{ +switch(xx) +{ + +case 1: + // filler + while (true) +{ +if (something) +{ +do_something(); + + + +} +else if (something_else) +{ +do_something_else(); +} +else +{ +dont_do_anything(); +break; +} + +} +break; + +case 2: + handle_two(); + +default: + handle_the_rest(); + break; +} +} + +class long_class +{ +private: + +int m_a; +int m_name; + +public: +long_class(int a) {} + +void f1() {} + +void f2() {} + +void f3() {} + +}; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/long_namespace.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/long_namespace.cpp new file mode 100644 index 00000000..89fe4435 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/long_namespace.cpp @@ -0,0 +1,15 @@ +namespace boo3 {
+int Fun1()
+{
+ return 42;
+}
+}
+
+namespace boo4 {
+ int Fun2()
+ {
+ int a = 7;
+ int b = 8;
+ return a+b;
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/macro_spaces.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/macro_spaces.cpp new file mode 100644 index 00000000..c27c6b5d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/macro_spaces.cpp @@ -0,0 +1,2 @@ +#if (WINVER < 0x0601)
+#endif
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc.cpp new file mode 100644 index 00000000..8a73b431 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc.cpp @@ -0,0 +1,60 @@ + +/* 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; + + ::asdasda::adasd:: + 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 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc2.cpp new file mode 100644 index 00000000..f1be4478 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc2.cpp @@ -0,0 +1,59 @@ +/* +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<T>* > (other); +// expected: +//myvar = dynamic_cast<MyClass<T>*>(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<StreamedData *>::iterator iterator; +//typedef std::list<StreamedData *>::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<byte>bob = new List<byte> (); + + /* 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); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc3.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc3.cpp new file mode 100644 index 00000000..c7c10d6c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc3.cpp @@ -0,0 +1,25 @@ +// 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<MyClass& >(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); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc4.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc4.cpp new file mode 100644 index 00000000..725fa160 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc4.cpp @@ -0,0 +1,28 @@ +struct 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)); + } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc5.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc5.cpp new file mode 100644 index 00000000..570a4a76 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc5.cpp @@ -0,0 +1,13 @@ +typedef std::list<StreamedData*>::iterator iterator; +double foo() +{ + if (a<bar()> c) +{ +throw int(); +return(double()); +} + call_a_function(42, + double(-1), + "charray"); +return(foo(n)); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc6.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc6.cpp new file mode 100644 index 00000000..95cc0383 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/misc6.cpp @@ -0,0 +1,3 @@ +#include <vector> +void f(std::vector<int> * vip, std::vector<int> & vir); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/mod_remove_empty_return-2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/mod_remove_empty_return-2.cpp new file mode 100644 index 00000000..eb949c45 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/mod_remove_empty_return-2.cpp @@ -0,0 +1,10 @@ +namespace ComponentSpec { +void build(Context c) +{ + if (index == NSNotFound) { + return; + } + + invokeUpdateInvitees(c, invitees); +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/mod_remove_empty_return.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/mod_remove_empty_return.cpp new file mode 100644 index 00000000..ca3105da --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/mod_remove_empty_return.cpp @@ -0,0 +1,4 @@ +void a() +{ + return; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ms-style-ref.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ms-style-ref.cpp new file mode 100644 index 00000000..213393b9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ms-style-ref.cpp @@ -0,0 +1,9 @@ +Foo^ foo = dynamic_cast<Bar^>(bar); +Foo* foo = dynamic_cast<Bar*>(bar); +x = a^b; + +int main(Platform::Array<Platform::String^>^ /*args*/) +{ +} + +Platform::Array<unsigned char>^ a; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/multi_line.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/multi_line.cpp new file mode 100644 index 00000000..df5f3a84 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/multi_line.cpp @@ -0,0 +1,43 @@ + +void func_a ( int a, string b, char c ); + +void func_b ( int a, + string b, char c ); + +void func_c ( int a, string b, char c + ); + +void func_d ( int aaaaaaaaaaaaaa, string bbbbbbbbbbbbbb, char cccccccccccccccccc ); + +void func_a ( int a, string b, char c ) +{ + return; +} + +void func_b ( int a, + string b, char c ) +{ + return; +} + +void func_c ( int a, string b, char c + ) +{ + return; +} + +void func_d ( int aaaaaaaaaaaaaa, string bbbbbbbbbbbbbb, char cccccccccccccccccc ) +{ + return; +} + +void func_call() +{ + func_a ( 1, 2, 3); + func_b ( 4, + 5, 6 ); + func_c ( 7, 8, 9 + ); + + func_d ( "aaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbb", "cccccccccccccccccccccc" ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/namespace_namespace.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/namespace_namespace.cpp new file mode 100644 index 00000000..cf6f921e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/namespace_namespace.cpp @@ -0,0 +1,6 @@ +namespace hw { namespace stm32 { + +class RTC { +}; + +}} // namespace hw::stm32 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/new_op.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/new_op.cpp new file mode 100644 index 00000000..828215e8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/new_op.cpp @@ -0,0 +1,9 @@ +Foo* foo = new Foo(a,v); + +Foo* foo = new(ptr,std::nothrow)Foo[]; +Foo* foo = new(ptr)Foo(); +Foo* foo = new(FOO(ptr))Foo(); + +Foo* foo = new ( ptr,std::nothrow ) Foo[]; +Foo* foo = new ( ptr ) Foo(); +Foo* foo = new ( FOO(ptr) ) Foo(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl-class.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl-class.h new file mode 100644 index 00000000..128974b7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl-class.h @@ -0,0 +1,59 @@ +#ifndef NL_CLASS_H_INCLUDED +#define NL_CLASS_H_INCLUDED + +#include <string> + +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 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl-namespace.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl-namespace.h new file mode 100644 index 00000000..a436fcb7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl-namespace.h @@ -0,0 +1,15 @@ +namespace ns1 { + + void *foo(void); + void bar(void); + +} + +namespace ns2 +{ + + void *foo(void); + void bar(void); + +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_assign_leave_one_liners.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_assign_leave_one_liners.cpp new file mode 100644 index 00000000..cf3325f0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_assign_leave_one_liners.cpp @@ -0,0 +1 @@ +int q[] = { 3, 4 }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_before_after.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_before_after.h new file mode 100644 index 00000000..34c42d45 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_before_after.h @@ -0,0 +1,76 @@ +namespace A { +namespace S { +class C +{ +public: + virtual ~C() + { + } + + virtual void addSearch(const int &col) = 0; + + virtual void removeSearch(int id) = 0; +}; +} // namespace S +} // namespace A + +namespace B { +// This is a comment! +class D +{ +public: + D(); +}; +} // namespace B + +// This is also a comment! +class E +{ +public: + E(); +}; +namespace F { +} +void foo(); +class G +{ +}; +void bar(); + +void foo2(); +namespace E +{ +} +void bar2(); + +void foo3(); +namespace F +{ +} + +void bar3(); + +void foo4(); +class I +{ +}; + +void bar4(); +/* multiline test comment + before class */ +template<typename ... Args> +// test comment between template specification and associated class +class H +{ + // nested class +template<typename ...> +friend class I; +friend class J; + // nested class K +template<typename T> +class K +{ + // double-nested class L +class L { }; +}; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_before_func_body_def.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_before_func_body_def.cpp new file mode 100644 index 00000000..c7cab4c7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_before_func_body_def.cpp @@ -0,0 +1,60 @@ +lass A +{ + void f0(void); + template<typename T, typename U> + void g(T s, U t) + { + return; + } + void f1(void); + template + <typename T, + typename U> + void h(T s, U t) + { + return; + } + void f2(void); + template + <typename T, + typename U> + void + i(T s, U t) + { + return; + } + void f3(void); + template + <typename T, + typename U> + void + j + (T s, U t) + { + return; + } + void f4(void); + template + <typename T, + typename U> + void + k + ( + T s, U t) + { + return; + } + void f5(void); + template + <typename T, + typename U> + void + l + ( + T s, + U t + ) + { + return; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_brace_brace.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_brace_brace.cpp new file mode 100644 index 00000000..b698546a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_brace_brace.cpp @@ -0,0 +1,18 @@ + +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, +} +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-f.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-f.cpp new file mode 100644 index 00000000..6250d752 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-f.cpp @@ -0,0 +1,17 @@ +void f(){} +void f() +{} + +void f()const{} +void f()const +{} + +void f()noexcept(){} +void f()noexcept() +{} + +void f()/**/{} +void f()/**/ +{} +void f()// +{}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-fr.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-fr.cpp new file mode 100644 index 00000000..6250d752 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-fr.cpp @@ -0,0 +1,17 @@ +void f(){} +void f() +{} + +void f()const{} +void f()const +{} + +void f()noexcept(){} +void f()noexcept() +{} + +void f()/**/{} +void f()/**/ +{} +void f()// +{}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-r.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-r.cpp new file mode 100644 index 00000000..6250d752 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-r.cpp @@ -0,0 +1,17 @@ +void f(){} +void f() +{} + +void f()const{} +void f()const +{} + +void f()noexcept(){} +void f()noexcept() +{} + +void f()/**/{} +void f()/**/ +{} +void f()// +{}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-rf.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-rf.cpp new file mode 100644 index 00000000..6250d752 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_fdef_brace_cond-rf.cpp @@ -0,0 +1,17 @@ +void f(){} +void f() +{} + +void f()const{} +void f()const +{} + +void f()noexcept(){} +void f()noexcept() +{} + +void f()/**/{} +void f()/**/ +{} +void f()// +{}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_for_leave_one_liners.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_for_leave_one_liners.cpp new file mode 100644 index 00000000..382d2815 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_for_leave_one_liners.cpp @@ -0,0 +1 @@ +for (int i = 0; i < 10; ++i) i++;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func.cpp new file mode 100644 index 00000000..e27d7e55 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func.cpp @@ -0,0 +1,23 @@ +class 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(); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_args_multi_line_ignore_closures.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_args_multi_line_ignore_closures.cpp new file mode 100644 index 00000000..96cd4826 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_args_multi_line_ignore_closures.cpp @@ -0,0 +1,58 @@ +methodCall([] { + Log(); + }); + +funcCall(match ( [ & ]( const ContentProps &props) { + return PairingCmpnt() + })); + +match( [ & ]( const ContentProps &props) { + return PairingCmpnt() + }); + + +outerMethodCall(methodCall(^{ + // action +}, x) +); + +outerMethodCall(x, methodCall(^{ + // action +}, y)); + +options({ + .cornerRadius = CGFLOAT_MAX, + }); + +mapToPtr([&](const LeftAddOn::Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr(x, [&](const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr([&](const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +methodCall(arg1, arg2, +arg3); + +methodCall(arg1, arg2, arg3); + +methodCall(arg1, []{ + variant.action.send(Cmpnt); + }, arg3); + +methodCall(arg1, { + .x = 10, + }, arg3); + +methodCall({ + .x = 10, + }, arg3); + +methodCall(arg1, { + .x = 10, + }); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_empty.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_empty.cpp new file mode 100644 index 00000000..6678ee18 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_empty.cpp @@ -0,0 +1,3 @@ +SomeFunction
+(
+);
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_paren.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_paren.cpp new file mode 100644 index 00000000..309a65a9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_paren.cpp @@ -0,0 +1,4 @@ +SomeFunction(
+ someVar,
+ someOtherVar,
+ );
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_paren_empty.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_paren_empty.cpp new file mode 100644 index 00000000..6678ee18 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_call_paren_empty.cpp @@ -0,0 +1,3 @@ +SomeFunction
+(
+);
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_decl.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_decl.cpp new file mode 100644 index 00000000..91a7184f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_decl.cpp @@ -0,0 +1,31 @@ + +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 +) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_def_paren_empty.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_def_paren_empty.cpp new file mode 100644 index 00000000..f1ba8607 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_def_paren_empty.cpp @@ -0,0 +1,21 @@ +void LocalClass::LocalClass()
+{
+ int Function
+ (
+ )
+ {
+ return 0;
+ }
+
+ int Function(
+ )
+ {
+ return 0;
+ }
+
+ int Function
+ ()
+ {
+ return 0;
+ }
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_paren_empty.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_paren_empty.cpp new file mode 100644 index 00000000..19965aac --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_paren_empty.cpp @@ -0,0 +1,9 @@ +int Function
+ (
+ );
+
+int Function(
+ );
+
+int Function
+ ();
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_scope_name.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_scope_name.cpp new file mode 100644 index 00000000..d221e974 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_scope_name.cpp @@ -0,0 +1,2 @@ +void A::f() +{} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_type_name.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_type_name.cpp new file mode 100644 index 00000000..26e49663 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_func_type_name.cpp @@ -0,0 +1,73 @@ + +//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: +explicit A(int); +int aFunct() { return a; } +int bFunc(); +}; + +// Another file +int +A::bFunc() +{ +// some code +} + +template<typename T> +typename Foo<T>::Type Foo<T>::Func() +{ +} + +void Foo::bar() {} + +namespace foo { +Foo::Foo() {} +} + +Foo::~Foo() {} + +class Object +{ + ~Object(void); +}; + +template <class T> +void SampleClassTemplate<T>::connect() +{ +} + +template <> +inline void bar<MyType>(MyType r) +{ + foo(r); +} + +template <T> +inline void baz<>(T r) +{ + foo(r); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_inside_namespace.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_inside_namespace.cpp new file mode 100644 index 00000000..4bdcb394 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_inside_namespace.cpp @@ -0,0 +1,37 @@ +namespace cats +{ // rule + + +int count; +void meow(); + + +} + +namespace dogs { // drool + + +int count; +void bark(); + + +} + +namespace pigs { + + +int count; +void oink(); + + +} + +namespace owls +{ + + +int count; +void hoot(); + + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_max_blank_in_func.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_max_blank_in_func.cpp new file mode 100644 index 00000000..c87e6e68 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/nl_max_blank_in_func.cpp @@ -0,0 +1,142 @@ +//regular function +void func0() +{ + + + + + return; +} +// ======================================================================== +//member function +void cls::func1() +{ + + + + + return; +} +// ======================================================================== +//lambda function +const auto l = [](){ + + + + + return 1; +}; +// ======================================================================== +//regular function in class +class cls +{ +public: + + + + +void func0() +{ + + + + + return; +} + + + + +} +// ======================================================================== +//member function in class + +// ======================================================================== +//lambda function in class +class cls +{ +pubic: + + + + +const auto l = [](){ + + + + + return 1; +}; + + + + +} +// ======================================================================== +//regular function in class in namespace +namespace ns +{ + + + + +class cls +{ +public: + + + + +void func0() +{ + + + + + return; +} + + + + +} + + + + +} +// ======================================================================== +//member function in class in namespace + +// ======================================================================== +//lambda function in class in namespace +namespace ns +{ + + + + +class cls +{ +pubic: + + + + +const auto l = [](){ + + + + + return 1; +}; + + + + +} + + + + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/noexcept.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/noexcept.cpp new file mode 100644 index 00000000..e6ea9116 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/noexcept.cpp @@ -0,0 +1 @@ +foo()noexcept; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/not_lambda.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/not_lambda.cpp new file mode 100644 index 00000000..a9c65439 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/not_lambda.cpp @@ -0,0 +1,8 @@ +int ff() +{ + // not a lambda fcn so don't surround "->" by spaces + f()[0]->size(); + if(true) { + return 1; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/op_sym_empty.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/op_sym_empty.cpp new file mode 100644 index 00000000..4b79ca9e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/op_sym_empty.cpp @@ -0,0 +1,5 @@ +class Foo +{ +bool operator ==( const Foo & other ) const; +Bar & operator * ( ) const; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/operator.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/operator.cpp new file mode 100644 index 00000000..6f2a7f03 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/operator.cpp @@ -0,0 +1,88 @@ + +struct bar; +struct foo +{ +operator bar*(); +auto operator <=> (const foo& rhs) const = default; +}; + +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(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/operator_proto.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/operator_proto.cpp new file mode 100644 index 00000000..b14935ee --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/operator_proto.cpp @@ -0,0 +1,65 @@ +/* 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 +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&(); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/out-668.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/out-668.cpp new file mode 100644 index 00000000..0dac74c3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/out-668.cpp @@ -0,0 +1,4 @@ +int b() +{ + int abcde= 13; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/output.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/output.cpp new file mode 100644 index 00000000..4563c43b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/output.cpp @@ -0,0 +1,657 @@ +/** + * @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 <cstring> +#include <cstdlib> + + + +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; + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/override_virtual.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/override_virtual.cpp new file mode 100644 index 00000000..537454b1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/override_virtual.cpp @@ -0,0 +1,16 @@ +struct A +{ + virtual void foo(); + virtual void bar() = 0; + virtual void baz() const { + } +}; + +struct B : public A +{ + virtual void foo() override; + void bar() override { + } + void baz() const override { + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/parameter-packs.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/parameter-packs.cpp new file mode 100644 index 00000000..6d734b1f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/parameter-packs.cpp @@ -0,0 +1,77 @@ +template<typename...A, int...B> +struct foo1:foo1<A..., (sizeof...(A)+B)...> +{ + foo1() { + int x = sizeof...(A); + } +}; + +template<int...X> int bar1() +{ + auto s = sizeof...(X); + chomp(X)...; + return X+...; +} + +template<class R, typename...Args> +void call1v(R(*fp)(Args...)); + +template<class R, typename...Args> +void call1p(R(*fp)(Args*...)); + +template<class R, typename...Args> +void call1r(R(*fp)(Args&&...)); + +template<class R, typename...Args> +struct invoke1v : invoke<R(*)(Args...)> +{ +}; + +template<class R, typename...Args> +struct invoke1p : invoke<R(*)(Args*...)> +{ +}; + +template<class R, typename...Args> +struct invoke1r : invoke<R(*)(Args&&...)> +{ +}; + +template < typename ... A , int ... B > +struct foo2 : foo2 < A ... , ( sizeof ... ( A ) + B ) ... > +{ + foo2() { + int x = sizeof ... ( A ); + } +}; + +template < int ... X > int bar2() +{ + auto s = sizeof ... ( X ); + chomp( X ) ...; + return X + ...; +} + +template < class R , typename ... Args > +void call2v( R ( *fp ) ( Args ... ) ); + +template < class R , typename ... Args > +void call2p( R ( *fp ) ( Args * ... ) ); + +template < class R , typename ... Args > +void call2r( R ( *fp ) ( Args && ... ) ); + +template < class R , typename ... Args > +struct invoke2v : invoke < R ( * ) ( Args ... ) > +{ +}; + +template < class R , typename ... Args > +struct invoke2p : invoke < R ( * ) ( Args * ... ) > +{ +}; + +template < class R , typename ... Args > +struct invoke2r : invoke < R ( * ) ( Args && ... ) > +{ +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/patch_32.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/patch_32.cpp new file mode 100644 index 00000000..8d9e222e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/patch_32.cpp @@ -0,0 +1 @@ +//! test diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pos_bool_in_template.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pos_bool_in_template.h new file mode 100644 index 00000000..ef01470e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pos_bool_in_template.h @@ -0,0 +1,7 @@ +#include <type_traits>
+
+template<typename U, typename V, typename = std::enable_if_t<!std::is_convertible<U, V>::value && !std::is_same<U, V>::value>>
+void foo(U &&u, V &&v)
+{
+
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pos_shift.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pos_shift.cpp new file mode 100644 index 00000000..4d55a541 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pos_shift.cpp @@ -0,0 +1,16 @@ +void foo() +{ + // Ensure non-shift operators aren't changed + x = 1 + + 2; + x = 1 + + 2; + x = 1 + 2; + + // Test position of shift operator + cout << x + << y; + cout << x << + y; + cout << x << y; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp-define-indent.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp-define-indent.cpp new file mode 100644 index 00000000..8ec5657f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp-define-indent.cpp @@ -0,0 +1,35 @@ + +#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 +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp-pragma.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp-pragma.cpp new file mode 100644 index 00000000..75b3c46d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp-pragma.cpp @@ -0,0 +1,21 @@ +#include <stdio.h> +int main(int argc, char** argv) +{ +#ifdef DEBUG +#define FORMAT "argc=%d\n" +std::printf(FORMAT,argc); +#undef FORMAT +#endif DEBUG +#ifdef _OPENMP +#pragma omp parallel +{ +printf("Hello from thread!\n"); +} +#endif + +#pragma CoverageScanner(cov-off) +__pragma ( CoverageScanner(cov-off) ) +_Pragma ( CoverageScanner(cov-off) ) + +return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_brace.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_brace.cpp new file mode 100644 index 00000000..86ed0a8f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_brace.cpp @@ -0,0 +1,24 @@ +// Example for preprocessor statement in a function definition
+// Config uses more than tested option, uses:
+// pp_if_indent_code = true to enable preprocesser indent
+// pp_indent_brace = false to override preprocessor indent for braces
+MyClass::MyClass()
+{
+ if(isSomething)
+ {
+ DoSomething();
+ }
+
+#if (USE_FIVE)
+ {
+ DoSomethingAlso();
+ }
+#endif
+
+#if (USE_SIX)
+ {
+ Six mySix;
+ DoSomethingWithSix(mySix);
+ }
+#endif
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_case.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_case.cpp new file mode 100644 index 00000000..da61641a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_case.cpp @@ -0,0 +1,23 @@ +// Example for case in a preprocesser statement
+// Config uses more than tested option, uses:
+// pp_if_indent_code = true to enable preprocesser indent
+// pp_indent_case = false to override preprocessor indent for case blocks
+switch(...)
+{
+case 1:
+case 2:
+{
+ int v;
+ ...
+}
+break;
+
+#if (USE_FIVE)
+ case 3:
+ doFive();
+ break;
+#endif
+
+default:
+ break;
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_extern.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_extern.cpp new file mode 100644 index 00000000..76cfc4bf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_extern.cpp @@ -0,0 +1,14 @@ +// Example for extern "C" blocks inside preprocessor statements
+// Config uses more than tested option, uses:
+// pp_if_indent_code = true to enable preprocesser indent
+// pp_indent_extern = false to override preprocessor indent for braces
+int x = 1;
+#ifdef __cplusplus
+ extern "C" {
+
+ void some_c_function
+ (
+ void
+ );
+ }
+#endif
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_func_def.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_func_def.cpp new file mode 100644 index 00000000..7a0bcecf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_indent_func_def.cpp @@ -0,0 +1,11 @@ +// Example of function definitions inside of preprocessor statements
+// Config uses more than tested option, uses:
+// pp_if_indent_code = true to enable preprocesser indent
+// pp_indent_func_def = false to override preprocessor indent for function definitions
+int x = 1;
+#if (USE_AWESOME_FUNCTIONS)
+ void MyClass::SomeAwesomeFunction()
+ {
+ DoSomethingInAFunction();
+ }
+#endif
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_multi_comment.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_multi_comment.cpp new file mode 100644 index 00000000..98418c46 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/pp_multi_comment.cpp @@ -0,0 +1,11 @@ +#define CTOR(i, _) : \ + T(X()), \ +/* + * multi + */ \ +\ + y() \ +{ } +main() +{ } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/proto-wrap.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/proto-wrap.cpp new file mode 100644 index 00000000..35e8bea3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/proto-wrap.cpp @@ -0,0 +1,4 @@ +WRAP_FUNCTION(Foo, Bar& (void)); +WRAP_FUNCTION(Foo, Bar* (void)); +WRAP_FUNCTION(Foo, (Bar& (void))); +WRAP_FUNCTION(Foo, (Bar* (void))); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ptr-star.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ptr-star.cpp new file mode 100644 index 00000000..ff0ab369 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/ptr-star.cpp @@ -0,0 +1,70 @@ +int 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<char*>(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 +} +}; + +int *const i; +int *static i; + +static auto Func1(Model *model) -> Color*; +static auto Func1(Model *model) -> Color* { + return nullptr; +} + +auto Func2(Model *model) -> Color* const; +auto Func2(Model *model) -> Color* const { + return nullptr; +} + +auto Func3(Model *model) -> Color**; +auto Func3(Model *model) -> Color** { + return nullptr; +} + +auto Func4(Model *model) -> Color** const; +auto Func4(Model *model) -> Color** const { + return nullptr; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/qt-1.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/qt-1.cpp new file mode 100644 index 00000000..e318c1aa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/qt-1.cpp @@ -0,0 +1,35 @@ +class 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;enum e{A,B};private:}; + +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;}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/qtargs.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/qtargs.cpp new file mode 100644 index 00000000..5037d792 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/qtargs.cpp @@ -0,0 +1,13 @@ +void foo()
+{
+ QObject::connect (m_NetworkReply,
+ SIGNAL (error(QNetworkReply::NetworkError)),
+ this,
+ SLOT (NetworkReplyError(QNetworkReply::NetworkError)));
+ QObject::connect (m_NetworkReply,
+ SIGNAL (uploadProgress(qint64, qint64)),
+ this,
+ SLOT (NetworkReplyUploadProgress(qint64, qint64)));
+ connect(&m_SendReportThread, SIGNAL(ProgressChanged(size_t, size_t)),
+ SLOT(OnReportProgressChanged(size_t, size_t)));
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/region.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/region.cpp new file mode 100644 index 00000000..28447084 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/region.cpp @@ -0,0 +1,20 @@ +class 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 + } + +} + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/return_braced_init.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/return_braced_init.cpp new file mode 100644 index 00000000..cf86baeb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/return_braced_init.cpp @@ -0,0 +1,18 @@ +int foo1() +{ + // should not have newline before '.' + return std::pair<int, int>{1, 2}.first; +} + +int foo2() +{ + // should be ARITH, not ADDR + return int{3} & 2; +} + +int foo3() +{ + // should be ARITH, not ADDR + constexpr static int x = 3; + return decltype(x){x} & 2; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/return_init_list.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/return_init_list.cpp new file mode 100644 index 00000000..f58dfee5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/return_init_list.cpp @@ -0,0 +1,30 @@ +inline static std::tuple<bool, std::string> foo(void) { +// should remain a one liner +return{true, ""s}; +} +inline static std::tuple<bool, std::string, std::string> foo(void) { +if (condition) { +// should remain a one liner +return{true, ""s, ""s}; +} +// should remain a one liner +return{false, ""s, ""s}; +} +inline static std::tuple<bool, std::string> foo(void) { +// should indent one level +return{ +true, ""s +}; +} +inline static std::tuple<bool, std::string> foo(void) { +// should indent one level on new line +return +{ true, ""s }; +} +inline static std::tuple<bool, std::string> foo(void) { +// should indent one level for braces and another level for values +return +{ +true, ""s +}; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/returns.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/returns.cpp new file mode 100644 index 00000000..85ab1a70 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/returns.cpp @@ -0,0 +1,30 @@ +#define foo1(x) { return x; } +#define foo2(x) { return(x); } +#define foo3(x) { return (x); } +#define foo4(x) { return{x}; } +#define foo5(x) { return {x}; } + +#define case1(x) return x +#define case2(x) return(x) +#define case3(x) return (x) +#define case4(x) return{x} +#define case5(x) return {x} + +void foo(int x) +{ + switch (x) + { + case 1: + return 1; + case 2: + return(2); + case 3: + return (3); + case 4: + return{4}; + case 5: + return {5}; + default: + return; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sef.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sef.cpp new file mode 100644 index 00000000..add2fc4a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sef.cpp @@ -0,0 +1,6 @@ +CFoo::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) +{ +} + +// this_comment_has_a_first_word_that_is_too_long_to_fit_into_a_line_without_wrapping and should not start with a blank comment line. diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/semicolon-removal-after-ternary-operator.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/semicolon-removal-after-ternary-operator.cpp new file mode 100644 index 00000000..a344480b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/semicolon-removal-after-ternary-operator.cpp @@ -0,0 +1,9 @@ +std::string StrGet() +{ + return IsConnected() ? "Connected" : {}; +} + +std::string StrGet2() +{ + return !IsConnected() ? {} : "Connected"; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/semicolons.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/semicolons.cpp new file mode 100644 index 00000000..52796f75 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/semicolons.cpp @@ -0,0 +1,106 @@ +static 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 + { + }; +} + +void deallocate2(S **s_ptr) +{ + { + void *stopper_for_apply = (int[]){0}; + void **list_for_apply = (void *[]){(*s_ptr)->arr, *s_ptr, stopper_for_apply}; + for (int i = 0; list_for_apply[i] != stopper_for_apply; i++) { + saferFree((void *) & (list_for_apply[i])); + } + }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.2886991.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.2886991.cpp new file mode 100644 index 00000000..97dfe0cf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.2886991.cpp @@ -0,0 +1,12 @@ + +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) + +void foo() +{ +try {} +catch (...) // <== HERE +{} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.3266678.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.3266678.cpp new file mode 100644 index 00000000..69f877ed --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.3266678.cpp @@ -0,0 +1,5 @@ +void CMyClass::myFunction() +{ +CMyReferencePointer & tmpPointer = (CMyReferencePointer & )getMyValue(); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.3315874.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.3315874.h new file mode 100644 index 00000000..58921bc5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf.3315874.h @@ -0,0 +1,47 @@ +#undef dot +#undef cross + +extern "C" { +#include "data_types.h" +} + vec_ operator+(const vec_&, const vec_&); /* v = v1 + v2 */ + vec_ operator-(const vec_&, const vec_&); /* v = v1 - v2 */ + mat_ operator+(const mat_&, const mat_&); /* m = m1 + m2 */ + mat_ operator-(const mat_&, const mat_&); /* m = m1 - m2 */ + vec_& operator+=(vec_&, const vec_&); /* v += v2 */ + mat_& operator+=(mat_&, const mat_&); /* m += m2 */ + vec_& operator-=(vec_&, const vec_&); /* v -= v2 */ + mat_& operator-=(mat_&, const mat_&); /* m -= m2 */ + vec_ operator*(double, const vec_&); /* v = a * v1 */ + mat_ operator*(double, const mat_&); /* m = a * m1 */ + vec_ operator*(const vec_&, double); /* v = v1 * a */ + mat_ operator*(const mat_&, double); /* m = m1 * a */ + vec_ operator/(const vec_&, double); /* v = v1 / a */ + mat_ operator/(const mat_&, double); /* m = m1 / a */ + vec_ operator*=(vec_&, const double a); /* v *= a */ + vec_ operator/=(vec_&, const double a); /* v /= a */ + vec_ operator*(const mat_&, const vec_&); /* v = m1 * v1 */ + mat_ operator*(const mat_&, const mat_&); /* m = m1 * m2 */ + quat_ operator*(const quat_&, const quat_&); /* q = q1 * q2 */ + quat_ operator*(double, const quat_&); /* q = a * q1 */ + quat_ operator*(const quat_&, double); /* q = q1 * a */ + quat_ operator/(const quat_&, double); /* q = q1 / a */ + vec_ operator-(const vec_&); /* v = - v1 */ + vec_ operator+(const vec_&); /* v = + v1 */ + mat_ operator-(const mat_&); /* m = - m1 */ + mat_ operator+(const mat_&); /* m = + m1 */ + quat_ operator+(const quat_&); /* q = + q */ + quat_ operator-(const quat_&); /* q = - q */ + quat_& operator*=(quat_&, const quat_&); /* q1 *= q2; */ + quat_& operator+=(quat_&, const quat_&); /* q1 += q2; */ + quat_& operator*=(quat_&, const double a); /* q1 *= a; */ + quat_ operator+(const quat_& q1, const quat_& q2); /* q3 = q1 + q2 */ + vec_ unit(const vec_&); /* unitize vec */ + quat_ unit(const quat_&); /* unitize quat */ + mat_ trans(const mat_&); /* transpose matrix */ + quat_ trans(const quat_&); /* transpose quat */ + double dot(const vec_, const vec_); /* vector dot product */ + vec_ cross(const vec_, const vec_); /* vector cross product */ + + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf557.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf557.cpp new file mode 100644 index 00000000..c7ba93cc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf557.cpp @@ -0,0 +1,4 @@ +//test.cpp +void test_fun(std::size_t a, + std :: size_t /* b */); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf562.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf562.cpp new file mode 100644 index 00000000..15ee8e79 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf562.cpp @@ -0,0 +1,9 @@ +#include "bar.h" + +class Foo : public Bar { + int foo(int bar) const { + while (true) { + baz(&operator[](bar)); + } + } +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf567.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf567.cpp new file mode 100644 index 00000000..0c1d5fc9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf567.cpp @@ -0,0 +1,16 @@ +package com.temp.test; + +public class Database +{ + private Database(String fileName) + { + readConfig(fileName, "asdfasdf", 1); + readConfig(ame, "aasdf", 1); + + Database::readConfig(fileName, "asdfasdf", 1); + Database::readConfig(ame, "aasdf", 1); + + ::readConfig(fileName, "asdfasdf", 1); + ::readConfig(ame, "aasdf", 1); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf574.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf574.cpp new file mode 100644 index 00000000..3f5a98d4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf574.cpp @@ -0,0 +1,13 @@ + +class A : public B +{ +A& operator=(const A& other){ +if (this == &other)return *this; +B::operator=(other); +if (this == &other)return *this; +B::opera(other); +copy(other); +return *this; +} + +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf583.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf583.cpp new file mode 100644 index 00000000..8eba4d1e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf583.cpp @@ -0,0 +1,6 @@ +#include <utility> + +std::pair<int, int> make_pair(int first, int second) +{ + return {first, second}; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf593.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf593.cpp new file mode 100644 index 00000000..1fc0ded8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sf593.cpp @@ -0,0 +1,11 @@ +typedef boost::shared_ptr < RatherLongClassName > sp_RatherLongClassName_t; +int main() +{ + int argument = 1; + sp_RatherLongClassName_t ratherLongVariableName1(new RatherLongClassName(argument, + argument, argument)); + + int the_result = a_very_long_function_name_taking_most_of_the_line(argument, + argument, argument); + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sim.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sim.h new file mode 100644 index 00000000..29c52879 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sim.h @@ -0,0 +1,50 @@ +namespace ns { + +template<typename T, template<typename> class TOtherClass> class Example +{ + int foo; +} + +} + +template<class T> 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 V> +class Example +{ + + Vector2<V>() + : x(1), + y(1) + {} + + Vector2<double>() + : x(1.0), + y(1.0) + {} + + Vector2<float>() + : x(1.0f), + y(1.0f) + {} + + V x; + V y; + +}; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_angle.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_angle.cpp new file mode 100644 index 00000000..7710171e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_angle.cpp @@ -0,0 +1,6 @@ +template <typename T> +struct foo {}; + +Q_DECLARE_METATYPE(foo<int> ) + +int bar(foo<int> ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_constr_colon.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_constr_colon.cpp new file mode 100644 index 00000000..caea467a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_constr_colon.cpp @@ -0,0 +1,6 @@ +struct MyClass : public Foo { + MyClass(int a, + int b, + int c) + : m_a(a), m_b(b), m_c(c) {} +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_decltype.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_decltype.cpp new file mode 100644 index 00000000..18448555 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_decltype.cpp @@ -0,0 +1,8 @@ +int x; +char y; +auto x1 = decltype(x) {0}; +auto y1 = decltype(y) {'a'}; + +unsigned rows; +for (auto row = decltype(rows){0}; row < rows; ++row) { +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_type.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_type.cpp new file mode 100644 index 00000000..6f235d22 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_after_type.cpp @@ -0,0 +1,13 @@ +static int x1; +unsigned long int y1 = (unsigned short)0; +const int foo1(int x); + +foo((const int*)0); +static_cast<long long>(0); + +static int x2; +unsigned long int y2 = ( unsigned short ) 0 ; +const int foo2 ( int x ); + +foo ( ( const int * ) 0 ); +static_cast < long long > ( 0 ) ; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_angle_paren.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_angle_paren.cpp new file mode 100644 index 00000000..911aa53b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_angle_paren.cpp @@ -0,0 +1,5 @@ +void foo() +{ + bar<T> (); + bar<T>(a); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_arith_additive.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_arith_additive.cpp new file mode 100644 index 00000000..ab2096c8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_arith_additive.cpp @@ -0,0 +1,2 @@ +int i = 0 + 3 - 4 * 3 % 3; +int ii = 0+3-4*3%3;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_balance_nested_parens.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_balance_nested_parens.cpp new file mode 100644 index 00000000..dc5f5e8e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_balance_nested_parens.cpp @@ -0,0 +1,6 @@ +void MainWindow::createView() +{ + a = B((c) + (d)); + a = B( (c) + (d)); + a = B( (c) + (d) ); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_byref_func.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_byref_func.cpp new file mode 100644 index 00000000..7dd9c14a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_byref_func.cpp @@ -0,0 +1,8 @@ +const Foo & Foo::operator ==(Foo& me){ + ::sockaddr* ptr = (::sockaddr*)&host; + return me; +} + +MyType& MyClass::myMethode() { + const MyType& t = getSomewhere(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_constr_colon.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_constr_colon.cpp new file mode 100644 index 00000000..796522c7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_constr_colon.cpp @@ -0,0 +1,4 @@ +struct MyClass : public Foo { + MyClass(int a, int b, int c) : + m_a(a), m_b(b), m_c(c) {} +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_tr_emb_cmt_input.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_tr_emb_cmt_input.cpp new file mode 100644 index 00000000..45ffb335 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_before_tr_emb_cmt_input.cpp @@ -0,0 +1,13 @@ +/* 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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_brace_brace.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_brace_brace.cpp new file mode 100644 index 00000000..bb730d61 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_brace_brace.cpp @@ -0,0 +1,14 @@ +template<std::size_t _N, typename _Type, _Type... _Nums> +std::array<uint8_t, _N - 1> constexpr crypt_helper(uint8_t const inSeed, char const(&inString)[_N], std::integer_sequence<_Type, _Nums...>) { +return { {crypt(_Nums, inSeed, static_cast<uint8_t>(inString[_Nums]))...} }; +} +static std::array<double_t, Homology::kNumberOfStats> const m{ { +0.3, +0.6, +1.0 +} }; +static std::array<double_t, Homology::kNumberOfStats> const m = { +0.3, +0.6, +1.0 +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cmt_cpp_start.cc b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cmt_cpp_start.cc new file mode 100644 index 00000000..6a9b203b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cmt_cpp_start.cc @@ -0,0 +1,3 @@ +int main() { + return 0; //Just return from the function. +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cparen_oparen.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cparen_oparen.cpp new file mode 100644 index 00000000..83c60dd4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cparen_oparen.cpp @@ -0,0 +1,5 @@ +class STDMETHOD +{ + STDMETHOD(GetValues)(BSTR bsName, REFDATA** pData); + STDMETHOD(GetValues) (BSTR bsName, REFDATA** pData); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cpp_lambda_fparen.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cpp_lambda_fparen.cpp new file mode 100644 index 00000000..e25d0496 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_cpp_lambda_fparen.cpp @@ -0,0 +1,24 @@ +void test() +{ + []{}(); + []{ foo(); }(); + [x]{ foo(x); }(); + [](int x){ foo(x); }(42); + [y](int x){ foo(x, y); }(42); + bar([]{ return 1; }()); + bar([]{ return foo(); }()); + bar([x]{ return foo(x); }(42)); + bar([](int x){ return foo(x); }(42)); + bar([y](int x){ return foo(x, y); }(42)); + + [] {} (); + [] { foo(); } (); + [x] { foo(x); } (); + [] (int x){ foo(x); } (42); + [y] (int x){ foo(x, y); } (42); + bar([] { return 1; } ()); + bar([] { return foo(); } ()); + bar([x] { return foo(x); } (42)); + bar([] (int x){ return foo(x); } (42)); + bar([y] (int x){ return foo(x, y); } (42)); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_decltype.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_decltype.cpp new file mode 100644 index 00000000..3e2f7e47 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_decltype.cpp @@ -0,0 +1,2 @@ +#define foo(expr) (expr) +using x = decltype foo(int); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_paren_comma.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_paren_comma.cpp new file mode 100644 index 00000000..1d687146 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_paren_comma.cpp @@ -0,0 +1 @@ +a( , 1); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_skip_vbrace_tokens.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_skip_vbrace_tokens.cpp new file mode 100644 index 00000000..fff4aff4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_skip_vbrace_tokens.cpp @@ -0,0 +1,10 @@ +void foo()
+{
+ if (data) go = new ClassA();
+ else go = new ClassB();
+
+ if (evt.alt) modifiers += "Alt+";
+ if (evt.command) modifiers += "Cmd+";
+ if (evt.control) modifiers += "Ctrl+";
+ if (evt.shift) modifiers += "Shift+";
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_throw_paren.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_throw_paren.cpp new file mode 100644 index 00000000..f45f1a9a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_throw_paren.cpp @@ -0,0 +1,7 @@ + +void foo() +{ + throw(x); + throw (y); + throw (z); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_type_func.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_type_func.cpp new file mode 100644 index 00000000..30e058e7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/sp_type_func.cpp @@ -0,0 +1,11 @@ +int foo1() +{ +} + +int* foo2() +{ +} + +int& foo3() +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/squeeze_ifdef.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/squeeze_ifdef.cpp new file mode 100644 index 00000000..42699d1d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/squeeze_ifdef.cpp @@ -0,0 +1,44 @@ + +#if defined(A) + +// Comment +extern int ax; +void fa(); + +#elif defined(B) + +extern int bx; +void fb(); + +#else + +extern int cx; +void fc(); + +#endif + +int foo() +{ +#if defined(A) + + int a = ax; + +#elif defined(B) + + // Comment + int b = bx; + +#else + + int c = cx; + +#endif +#if defined(A) + return a; +#elif defined(B) + return b; +#else + // Comment + return c; +#endif +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/static.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/static.h new file mode 100644 index 00000000..8121fef1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/static.h @@ -0,0 +1,25 @@ +#ifndef AKONADISERVER_H +#define AKONADISERVER_H + +#include <QtCore/QPointer> +#include <QtCore/QVector> + +#include <QtNetwork/QLocalServer> + +class QProcess; + +namespace Akonadi { +namespace Server { + +class AkonadiServer : public QLocalServer +{ + Q_OBJECT + +public: + ~AkonadiServer(); + static AkonadiServer *instance(); +}; + +} // namespace Server +} // namespace Akonadi +#endif diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/stdcall.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/stdcall.cpp new file mode 100644 index 00000000..a2353599 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/stdcall.cpp @@ -0,0 +1,3 @@ +// test for bug # 633 +typedef void (*func)(); +typedef void (__stdcall *func)(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/string_replace_tab_chars.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/string_replace_tab_chars.cpp new file mode 100644 index 00000000..3534461b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/string_replace_tab_chars.cpp @@ -0,0 +1,3 @@ +void f() { + auto x = " test\t ... ???"; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/strings.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/strings.cpp new file mode 100644 index 00000000..1cfea449 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/strings.cpp @@ -0,0 +1,58 @@ +void 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."; + +const char c1 = u8'1'; +const char16_t c2 = u'2'; +const char32_t c3 = U'4'; +const wchar_t c4 = L'w'; +const char16_t u = u'\u007f'; + +/* 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); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/tab-0.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/tab-0.cpp new file mode 100644 index 00000000..474aba08 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/tab-0.cpp @@ -0,0 +1,9 @@ +/* test of + * indent_with_tabs = 0 + * indent_columns = 11 + * the source has many <TAB> + */ +{ + int a; + int b; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/tab-1.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/tab-1.cpp new file mode 100644 index 00000000..dc7a65c4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/tab-1.cpp @@ -0,0 +1,9 @@ +/* test of + * indent_with_tabs = 1 + * indent_columns = 11 + * the source has NO <TAB> + */ +{ + int x; + int y; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templ_class.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templ_class.h new file mode 100644 index 00000000..0f102244 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templ_class.h @@ -0,0 +1,16 @@ +template<typename T, template<typename> class SpecialClass> +class Example +{ + // Copy constructor with other variants of Example + template<template<typename> class OtherSpecialClass> + Example(const Example<T, OtherSpecialClass>& other) + { + // do something useful here + } + + /** The normal member var based on the template arguments */ + SpecialClass<T> memberVar; + +}; + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates.cpp new file mode 100644 index 00000000..137205d0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates.cpp @@ -0,0 +1,185 @@ +#include <list> +#include <map> +#include <vector> + +#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 (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<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 <vector> +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 <vector> +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; +bool X = j<3>>1; + +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<X<1> > x3;". +Y<X<(6>>1)>> x4; + + +template <typename T> +int +myFunc1(typename T::Subtype val); + +int +myFunc2(T::Subtype val); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates2.cpp new file mode 100644 index 00000000..46d41560 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates2.cpp @@ -0,0 +1,54 @@ +void 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<int, +int, +int> +(42); +call_a_template_function<int, +int, +int +> +(42); +call_a_template_function<int, +int, +int>(42); +call_a_template_function<int, +int, +int>( +42 +); +call_a_template_function< +int, +int, +int +> +(42); +} +template<class T, +class U> +class W; +template<class T, +class U +> +class X; +template< +class T, +class U> +class Y; +template< +class T, +class U +> +class Z; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates3.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates3.cpp new file mode 100644 index 00000000..55b11d26 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates3.cpp @@ -0,0 +1,26 @@ +template <bool a> +struct T { + typedef int result; +}; +template <bool a, bool b> +struct X { + typedef typename T<a || b>::result result; +}; + +template <class T> +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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates4.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates4.cpp new file mode 100644 index 00000000..10b96e4a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/templates4.cpp @@ -0,0 +1,17 @@ +#define FOO(X) \ +template <unsigned _blk_sz, typename _run_type, class __pos_type> \ +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 <unsigned _blk_sz, typename _run_type, class __pos_type> \ +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; \ +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/toggle_processing_cmt.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/toggle_processing_cmt.cpp new file mode 100644 index 00000000..304f0eae --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/toggle_processing_cmt.cpp @@ -0,0 +1,7 @@ +void func() { } + +// **ABC** +void func() { } +// *INDENT-ON* + +void func() { } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/toggle_processing_cmt2.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/toggle_processing_cmt2.cpp new file mode 100644 index 00000000..6b4a0a39 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/toggle_processing_cmt2.cpp @@ -0,0 +1,7 @@ +void func() { } + +// *INDENT-OFF* +void func() { } +// ??DEF?? + +void func() { } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/trailing_return.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/trailing_return.cpp new file mode 100644 index 00000000..de061955 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/trailing_return.cpp @@ -0,0 +1,44 @@ +auto f0(int a, int b) -> int; + +struct Foo +{ + auto f01() -> bool; + auto f02() noexcept -> bool; + auto f03() noexcept(true) -> bool; + auto f04() noexcept(false) -> bool; + auto f05() noexcept -> bool = delete; + auto f06() noexcept(true) -> bool = delete; + auto f07() noexcept(false) -> bool = delete; + + auto f11() const -> bool; + auto f12() const noexcept -> bool; + auto f13() const noexcept(true) -> bool; + auto f14() const noexcept(false) -> bool; + auto f15() const noexcept -> bool = delete; + auto f16() const noexcept(true) -> bool = delete; + auto f17() const noexcept(false) -> bool = delete; + + auto f21() throw() -> bool; + auto f22() throw() -> bool = delete; + auto f23() const throw() -> bool; + auto f24() const throw() -> bool = delete; +}; + +struct Bar +{ + Bar() : m_func([](void*) -> result_t{ return magic; }) {} +}; + +void foo() +{ + auto l = [](int n) -> x_t{ return n + 5; }; + x([](int n) -> x_t{ return n + 5; }); +} + +static auto f25() -> bool { + return true; +} + +static auto f26() const noexcept(true) -> bool { + return true; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/try-catch-nl.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/try-catch-nl.cpp new file mode 100644 index 00000000..447f3cbd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/try-catch-nl.cpp @@ -0,0 +1,10 @@ +int foo() +{ +try { foo(bar); } catch (int *e) { return 0; } + +if (false) try { throw int(); } catch(...){} + +if (a) { return 1; } else { return 0; } +return 1; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/type_brace_init_lst.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/type_brace_init_lst.cpp new file mode 100644 index 00000000..53e74de2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/type_brace_init_lst.cpp @@ -0,0 +1,87 @@ +// Uncrustify does not process the intention of an using alias, +// unknown_kw will therefore no be parsed as known keyword +using unknown_kw = int; + +int main() +{ + // 'int' is a known c++ keyword + auto a0 = int { 1 }; + auto b0 = unknown_kw { 2 }; + auto c0 = ::unknown_kw { 3 }; + auto d0 = (int) unknown_kw { 4 }; + auto e0 = (int) ::unknown_kw { 5 }; + auto f0 = static_cast<int>(unknown_kw { 6 }); + auto g0 = static_cast<int>(::unknown_kw { 7 }); + + auto a1 = int{1}; + auto b1 = unknown_kw{2}; + auto c1 = ::unknown_kw{3}; + auto d1 = (int) unknown_kw{4}; + auto e1 = (int) ::unknown_kw{5}; + auto f1 = static_cast<int>(unknown_kw{6}); + auto g1 = static_cast<int>(::unknown_kw{7}); + + + + auto a2 = int + + {1}; + auto b2 = unknown_kw + + {2}; + auto c2 = ::unknown_kw + + {3}; + auto d2 = (int) unknown_kw + + {4}; + auto e2 = (int) ::unknown_kw + + {5}; + auto f2 = static_cast<int>(unknown_kw + + {6}); + auto g2 = static_cast<int>(::unknown_kw + + {7}); + + + + auto a1 = int{ + + 1 + + }; + auto b1 = unknown_kw{ + + 2 + + }; + auto c1 = ::unknown_kw { + + 3 + + }; + auto d1 = (int) unknown_kw { + + 4 + + }; + auto e1 = (int) ::unknown_kw { + + 5 + + }; + auto f1 = static_cast<int>(unknown_kw { + + 6 + + }); + auto g1 = static_cast<int>(::unknown_kw { + + 7 + + }); + + return 1; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/uniform_initialization.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/uniform_initialization.cpp new file mode 100644 index 00000000..37a131e0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/uniform_initialization.cpp @@ -0,0 +1,9 @@ +void whatever() { + SomeStruct a = SomeStruct{1, 2, 3}; + + someFuncCall(SomeStruct{4, 5, 6}); + } + +namespace foo { + int bar(); +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/using-alias-in-define.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/using-alias-in-define.cpp new file mode 100644 index 00000000..82854287 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/using-alias-in-define.cpp @@ -0,0 +1,6 @@ +#define UNC_DECLARE_FLAGS(flag_type, enum_type) \ + using flag_type = flags<enum_type> + +#define UNC_DECLARE_OPERATORS_FOR_FLAGS(flag_type) \ + inline flag_type operator&(flag_type::enum_t f1, flag_type::enum_t f2) \ + { return(flag_type { f1 } & f2); } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/var_def_gap.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/var_def_gap.cpp new file mode 100644 index 00000000..0cca962b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/var_def_gap.cpp @@ -0,0 +1,27 @@ +#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); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/variadic-template.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/variadic-template.h new file mode 100644 index 00000000..f522097c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/variadic-template.h @@ -0,0 +1,10 @@ +template<int __i, int... _Indexes, typename _IdxHolder, typename... +_Elements> +struct __index_holder_impl<__i, __index_holder<_Indexes...>, +_IdxHolder, _Elements...> +{ +typedef typename __index_holder_impl<__i + 1, +__index_holder<_Indexes..., +__i>, +_Elements...>::type type; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/wacky-template.cpp b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/wacky-template.cpp new file mode 100644 index 00000000..99e01b6e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cpp/wacky-template.cpp @@ -0,0 +1,12 @@ +template<typename flt_t> +template<typename gamma_t, typename gamma2_t, typename alpha_t, typename +beta_t, typename tail_extrinsic_t, typename rec_tail_t> + +void turbo_dec_1_15<flt_t>::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) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/1822.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/1822.cs new file mode 100644 index 00000000..a4269bd9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/1822.cs @@ -0,0 +1,2 @@ + foreach (Cat c in * cats) + System.Console.WriteLine(c.Name); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/615_nested-usings.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/615_nested-usings.cs new file mode 100644 index 00000000..14a31507 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/615_nested-usings.cs @@ -0,0 +1,9 @@ +using (var x = X()) +using (var y = Y()) +{ +} + +using (var x = X()) + using (var y = Y()) + { + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/620_getset-brace.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/620_getset-brace.cs new file mode 100644 index 00000000..f6ee6342 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/620_getset-brace.cs @@ -0,0 +1,7 @@ +class C
+{
+ float V {
+ get {
+ return _v; }
+ set { _v = value; } }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/621_this-spacing.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/621_this-spacing.cs new file mode 100644 index 00000000..bd28a5e8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/621_this-spacing.cs @@ -0,0 +1,2 @@ +result = (Foo)this;
+result = (Foo)foo;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/625_where-constraints.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/625_where-constraints.cs new file mode 100644 index 00000000..09274ab9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/625_where-constraints.cs @@ -0,0 +1,36 @@ +interface D { } interface E { }
+
+class C<T1, T2, TX, T3, T4, T5>
+: IDisposable, IEnumerable<T1>
+ where T1 : class,D ,E ,new()
+ where T2 : IDictionary<D, Dictionary< string, float > >
+where TX : struct, IDisposable
+where T3: class
+ where T4: D where T5:E
+{
+ void F<T3, T4, T5, TX, T6>() where T3 : D, new()
+ where T4 : D
+ where T5: D
+ where TX : new()
+ where T6: D
+ {
+ }
+
+ class C2<T1, T2, TX, T3, T4, T5>
+: IDisposable, IEnumerable<T1>
+ where T1 : class,D ,E,new()
+ where T2 : IDictionary<D, Dictionary< string, float > >
+where TX : struct, IDisposable
+ where T3: class
+ where T4: D where T5:E
+ {
+ void F2<T3, T4, T5, TX, T6>()
+ where T3 : D, new()
+ where T4 : D
+ where T5: D
+ where TX : new()
+ where T6: D
+ {
+ }
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/630_bad-new-init-semicolon-removal.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/630_bad-new-init-semicolon-removal.cs new file mode 100644 index 00000000..2e6d5a98 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/630_bad-new-init-semicolon-removal.cs @@ -0,0 +1,7 @@ +var dude = "Dude";
+var dude2 = new { Name = "Dude", Age = 30, };
+var dude3 = new { Name = "Dude", Age = 30, Kids = new { Name = "LittleDude" } };
+var dude4 = new { Name = "Dude", Age = 30, Kids = new[] { "LittleDude" } };
+var dude5 = new { Name = "Dude", Age = 30, Kids = new[] { new { Name = "LittleDude" } } };
+Action y = () => { };
+Func<int, float, bool> z = (a, b) => { var z = new { a, b }; return z == null; };
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/Issue_2705.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/Issue_2705.cs new file mode 100644 index 00000000..9a1b3172 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/Issue_2705.cs @@ -0,0 +1,16 @@ +//example file +public class A +{ +public void A(string a) +{ + if (a == null) + { + return; + } + + fixed(char* ptr = a) + { + a = a + a; + } +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11095.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11095.mm new file mode 100755 index 00000000..34ed4050 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11095.mm @@ -0,0 +1,19 @@ +// Create oneliners + +extern "C" NSBundle* UnityGetMetalBundle() { + return _MetalBundle; +} +extern "C" MTLDeviceRef UnityGetMetalDevice() { return _MetalDevice; } +extern "C" MTLCommandQueueRef UnityGetMetalCommandQueue() { return ((UnityDisplaySurfaceMTL*)GetMainDisplaySurface())->commandQueue; } + +extern "C" EAGLContext* UnityGetDataContextEAGL() { + return _GlesContext; +} + +// Keep oneliners + +extern "C" NSBundle* UnityGetMetalBundle() { return _MetalBundle; } +extern "C" MTLDeviceRef UnityGetMetalDevice() { return _MetalDevice; } +extern "C" MTLCommandQueueRef UnityGetMetalCommandQueue() { return ((UnityDisplaySurfaceMTL*)GetMainDisplaySurface())->commandQueue; } + +extern "C" EAGLContext* UnityGetDataContextEAGL() { return _GlesContext; }
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11662.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11662.cs new file mode 100755 index 00000000..9a49fdba --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11662.cs @@ -0,0 +1,10 @@ +namespace Unity +{ + public class Class + { + // doesn't work because ; gets removed but + public static readonly Class A = new Class() { name = "A", id = 1 }; + // works and ; doesn't get removed + public static readonly Class B = new Class { name = "B", id = 2 }; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11993.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11993.cs new file mode 100644 index 00000000..6bc6529a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-11993.cs @@ -0,0 +1,12 @@ +namespace Namespace
+{
+ public class Class
+ {
+ #if DEBUG
+ public statc foo()
+ {
+ }
+ #endif
+ }
+}
+
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-12303.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-12303.cs new file mode 100755 index 00000000..01be8291 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-12303.cs @@ -0,0 +1,4 @@ +//This gets a double indentation +devicePositions[device] = rect = new Rect( + Vector2.Lerp(rect.position, target.position, 0.1f), + Vector2.Lerp(rect.size, target.size, 0.1f)); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1288.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1288.cs new file mode 100644 index 00000000..70554a02 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1288.cs @@ -0,0 +1,77 @@ +public class Class
+{
+ public Foo GetFoo()
+ {
+ return new Foo
+ {
+ enabled = false,
+ };
+ }
+
+ public override Bar GetBar()
+ {
+ return new Bar()
+ {
+ m_Name = TestPropertyName
+ };
+ return new
+ AA();
+ return new AA<Type>
+ {
+
+ };
+ }
+
+ //It appears uncrustify is adding double-indentation no matter what, to the initializer block.
+ // Both of the above examples start out at a different level of indentation, and both get double-indented past original.
+}
+
+// The following code consolidates examples from the topic.
+class ObjInitializers
+{
+ class Cat
+ {
+ // Auto-implemented properties.
+ public int Age { get; set; }
+ public string Name { get; set; }
+ }
+
+ static void Main()
+ {
+ Cat cat = new Cat { Age = 10, Name = "Fluffy" };
+
+ List<Cat> cats = new List<Cat>
+ {
+ new Cat(){ Name = "Sylvester", Age=8 },
+ new Cat(){ Name = "Whiskers", Age=2 },
+ new Cat(){ Name = "Sasha", Age=14 }
+ };
+
+ List<Cat> moreCats = new List<Cat>
+ {
+ new Cat(){ Name = "Furrytail", Age=5 },
+ new Cat(){ Name = "Peaches", Age=4 },
+ null
+ };
+
+ // Display results.
+ System.Console.WriteLine(cat.Name);
+
+ foreach (Cat c in cats)
+ System.Console.WriteLine(c.Name);
+
+ foreach (Cat c in moreCats)
+ if (c != null)
+ System.Console.WriteLine(c.Name);
+ else
+ System.Console.WriteLine("List element has null value.");
+ }
+ // Output:
+ //Fluffy
+ //Sylvester
+ //Whiskers
+ //Sasha
+ //Furrytail
+ //Peaches
+ //List element has null value.
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1333.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1333.mm new file mode 100644 index 00000000..5c91693c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1333.mm @@ -0,0 +1,15 @@ +// Test if Uncrustify properly handles `@synchronized` keyword for ObjC
+
+// In keywords.cpp there is no @synchronized keyword listed and from what I've seen synchronized is only regarded as a keyword in other languages
+// { "synchronized", CT_QUALIFIER, LANG_D | LANG_JAVA | LANG_ECMA },
+
+- (void)foo
+{
+ @synchronized(self)
+ {
+ if (bar)
+ {
+ bar = false;
+ }
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1338.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1338.cs new file mode 100644 index 00000000..d10b4893 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1338.cs @@ -0,0 +1,30 @@ +// *Single line functions*
+
+public class Class
+{
+ public string foo {get; set;}
+ public string foo { get; set; }
+
+ bool HasBar() {return m_HasBar != 0;}
+ bool HasBar() { return m_HasBar != 0; }
+
+ public Bar prop {get {return m_bar;} set {m_bar = value;}}
+ public Bar prop { get { return m_bar; } set { m_bar = value; } }
+
+// This seems to happen with no spaces on the interior. Opening brace doesn't get one, closing brace does.
+
+// Turning on sp_inside_braces=add fixes it, but also changes a lot of initializer code we don't want to touch (like x = {1}). May need special support, or perhaps there's a bug..
+
+// *Initializers*
+
+// Not sure if this is what we want..
+
+ public void foo()
+ {
+ sas.Foo("bar", new Dictionary<string, object>(){ { "k1", "v1" }, { "k2", "v2" } });
+ // ... --> ...
+ sas.Foo("bar", new Dictionary<string, object>() { { "k3", "v3" }, { "k4", "v4" } });
+ }
+
+// Second line adds a space before the initializer {. Is that what we want for C#?
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1343.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1343.cs new file mode 100644 index 00000000..852fe640 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1343.cs @@ -0,0 +1,22 @@ +// Need to...
+
+// * Deal with the newline-after-opening and brace arrangement thing (eat_blanks_after_open_brace etc - see note in Uncrustify.Cpp.cfg)
+// * Terminate with //namespace if greater than x lines (like with #ifdef)
+
+namespace Unity
+{
+ public static void foo1()
+ {
+
+ }
+
+ public static void foo2()
+ {
+
+ }
+
+ public static void foo3()
+ {
+
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1345.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1345.cs new file mode 100644 index 00000000..e218e6a2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1345.cs @@ -0,0 +1,15 @@ +public class Class
+{
+ public void foo()
+ {
+ data.Sort(
+ delegate(InputData lhs, InputData rhs)
+ {
+ return lhs.m_Name.CompareTo(rhs.m_Name);
+ });
+ }
+}
+
+// Want the braces aligning with the delegate keyword.
+
+// Probably also an issue with lambda style delegates.
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-13955.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-13955.cs new file mode 100755 index 00000000..940aa89b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-13955.cs @@ -0,0 +1,16 @@ +if (m_Preview.GetExpanded()) +{ + m_EventSearchString = EditorGUI.TextField(searchRect, m_EventSearchString, Styles.toolbarSearchField); + if (GUILayout.Button( + GUIContent.none, + m_EventSearchString == string.Empty ? Styles.toolbarSearchFieldCancelEmpty : Styles.toolbarSearchFieldCancel)) + { + } +} + +// The closing parenthesis is being indented twice. +bool success = GenerateSecondaryUVSet( + &mesh.vertices[0].x, mesh.vertices.size(), + &triUV[0].x, &triList[0], triSrcPoly.size() ? &triSrcPoly[0] : 0, triCount, + &outUV[0].x, param, errorBuffer, bufferSize +); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-14131.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-14131.cs new file mode 100755 index 00000000..c8c3c918 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-14131.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +class C +{ + public void S() + { + Action localMethod = () => { + SomeClass.OtherMethod(new Dictionary<string, string> + { + {"a", "one"}, + {"b", "two"}, + {"c", "three"} + }); + }; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-17253.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-17253.cs new file mode 100644 index 00000000..7342d82c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-17253.cs @@ -0,0 +1,58 @@ +// Extra test cases for # 1257 +switch (sometext) +{ + case "a": + return 0; + case "b": + Console.WrieLine("hello world\n"); + return 0; + case "c": + { + Console.WrieLine("hello world\n"); + return 0; + } + case "d": + Console.WrieLine("hello world\n"); + + if (hello) + return 0; + else + return 1; + + case "e": + Console.WrieLine("hello world\n"); + + if (hello) + { + int a; + int b; + return 0; + } + + case "f": + { + return 0; + } + case "g": + + return 0; + + case "h": + for (i = 0; i < 10 i++) + { + a += i; + return 0; + } + case "i": + + if (hello) + { + int a; + int b; + return 0; + } + + return 1; + default: + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18437.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18437.cs new file mode 100644 index 00000000..aab6c498 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18437.cs @@ -0,0 +1,22 @@ +private static Type[] GetAllVisualElementTypes() +{ + return typeof(VisualElement).Assembly.GetTypes() + .Where(t => t != typeof(VisualElement) && + t != typeof(Panel) && + !t.IsAbstract && + !typeof(IMElement).IsAssignableFrom(t) && + !typeof(IMContainer).IsAssignableFrom(t) && + typeof(VisualElement).IsAssignableFrom(t)).ToArray(); +} + +// to this +private static Type[] GetAllVisualElementAssetTypes() +{ + return typeof(VisualElement).Assembly.GetTypes() + .Where(t => t != typeof(VisualElement) && + t != typeof(Panel) && + !t.IsAbstract && + !typeof(IMElement).IsAssignableFrom(t) && + !typeof(IMContainer).IsAssignableFrom(t) && + typeof(VisualElement).IsAssignableFrom(t)).ToArray(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18777.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18777.cs new file mode 100644 index 00000000..198d5be3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18777.cs @@ -0,0 +1,9 @@ +// I want to keeep the function call indented +Thingy + .Select(x => x > 2) + .ToList(); + +// it works with a var +var x = Thingy + .Select(x => x > 2) + .ToList(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18780.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18780.cs new file mode 100755 index 00000000..0eea713e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18780.cs @@ -0,0 +1,7 @@ +// note that this only happens with positive int literals. if i use a float with a decimal, or 'c' or "abc" or whatever, or even `(-5)`, it's ok. +5.Clamp(2, 10).ShouldBe(5); +5.Clamp(-5, 10).ShouldBe(5); +5.Clamp("a", 10).ShouldBe(5); + +"4".Clamp(2, 10).ShouldBe(5); +(-5).Clamp(2, 10).ShouldBe(5); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18829.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18829.cs new file mode 100755 index 00000000..62c9f8fb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-18829.cs @@ -0,0 +1,22 @@ +// It shouldn't detele the space after the tuple definition +public static (bool updated, Warnings warnings) UpdateIncludesInFile( + string fileToUpdate, string oldIncludeFile, string newIncludeFile) +{ + // ... +} + +// It shouldn't detele the space after the tuple definition +public static (int, string) UpdateIncludesInFile( + string fileToUpdate, string oldIncludeFile, string newIncludeFile) +{ + // ... +} + +// It shouldn't detele the space after the tuple definition and updated, warnings should be tokenized as types +public static (updated, warnings) UpdateIncludesInFile( + string fileToUpdate, string oldIncludeFile, string newIncludeFile) +{ + // ... +} + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1919.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1919.cs new file mode 100644 index 00000000..956fd0f8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1919.cs @@ -0,0 +1,17 @@ +// this
+
+Func(
+ "stuff",
+ foo =>
+ {
+ bar();
+ });
+
+// formats to this
+
+Func(
+ "stuff",
+ foo =>
+{
+ bar();
+});
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-19644.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-19644.cs new file mode 100644 index 00000000..da76bfbc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-19644.cs @@ -0,0 +1,7 @@ +//It deletes the space after { +class Foo +{ + extern internal bool canAccess { [NativeMethod(Name = "CanAccessFromScript")] get; } + + extern public int subMeshCount { get; [NativeMethod(Name = "CanAccessFromScript")] set; } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1975.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1975.cs new file mode 100644 index 00000000..af678a93 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1975.cs @@ -0,0 +1,23 @@ +// typeof(Dictionary<, >)
+
+// is getting changed to
+
+// typeof(Dictionary<, >)
+
+// (space added after comma)
+
+// Definitely not typical for C#. Needs special handling.
+
+public class Class
+{
+ public void foo(Type type)
+ {
+ if (type == typeof(List<>))
+ {
+ }
+ else if (type == typeof(Dictionary<,>))
+ {
+ var bar = typeof(Dictionary<,>).Bar();
+ }
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1977.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1977.cs new file mode 100644 index 00000000..e4b1b375 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1977.cs @@ -0,0 +1,18 @@ +// We specifically avoid our own tab-space in GenericFormat because of the @"" issue.
+// So we must rely on Uncrustify getting it right, and it nearly does - except for the
+// "Layout has changed, bail out now" where it does not replace the tab preceding the comment.
+
+namespace Namespace
+{
+ class Class
+ {
+ public void Foo()
+ {
+ if (bar)
+ {
+ // Layout has changed, bail out now.
+ bar = false;
+ }
+ }
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1978.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1978.cs new file mode 100644 index 00000000..14cbdc7d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-1978.cs @@ -0,0 +1,17 @@ +// `new[] {` on colors12345636 should have brace on following line
+
+namespace Namepsace
+{
+ internal static class Colors
+ {
+ static Color[] colors12345636 = new[] {
+ new Color(123/123f, 123/123f, 0/123f),
+ new Color(123/123f, 123/123f, 4/123f),
+ new Color(123/123f, 75/123f, 36/123f),
+ new Color(123/123f, 97/123f, 136/123f),
+ new Color(123/123f, 123/123f, 136/123f),
+ new Color( 13/123f, 123/123f, 136/123f),
+ new Color( 0/123f, 123/123f, 136/123f),
+ new Color(123/123f, 123/123f, 1/123f)};
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-19895.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-19895.cs new file mode 100644 index 00000000..a22c6fa8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-19895.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using UnityEngine; +using UnityEngine.Serialization; +namespace UnityEngine.Experimental.Input +{ + public class ActionMap : ScriptableObject, IControlDomainSource + { + public List<InputControl> BuildControlsList() + { + ControlSetup controlsSetup = new ControlSetup(); + for (int i = 0; i < actions.Count; i++) + { + var action = actions[i]; +// This line is kept with 71 spaces. + SupportedControl supportedControl = (SupportedControl)(typeof(SupportedControl) + .GetMethod("Get") + .MakeGenericMethod(actions[i].controlType) + .Invoke(null, new object[] { actions[i].name })); + action.controlIndex = controlsSetup.AddControl(supportedControl).index; + } + return controlsSetup.controls; + } + } +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2007.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2007.cs new file mode 100644 index 00000000..2e9f163a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2007.cs @@ -0,0 +1,34 @@ +public class MyGenericClass<T> where T:IComparable { } + +class MyClass<T, U> + where T : class + where U : struct +{ } + +public class MyGenericClass<T> where T : IComparable, new() +{ + // The following line is not possible without new() constraint: + T item = new T(); +} + +interface IMyInterface +{ +} + +class Dictionary<TKey, TVal> + where TKey : IComparable, IEnumerable + where TVal : IMyInterface +{ + public void Add(TKey key, TVal val) + { + } +} + +class List<T> +{ + void Add<U>(List<U> items) where U: T { /*...*/ } + void Add<U>(List<U> items) where U : T { /*...*/ } +} + +extern T GetNodeFromGuid<T>(Guid guid) where T : INode; +extern T GetNodeFromGuid<T>(Guid guid) where T: INode; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2008.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2008.cs new file mode 100644 index 00000000..eeb649dd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2008.cs @@ -0,0 +1,2 @@ +Utils.Curve attribute = (Utils.Curve)base.attribute;
+Utils.Curve attribute = (Utils.Curve) base.attribute;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2020.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2020.cs new file mode 100644 index 00000000..37d9ef23 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2020.cs @@ -0,0 +1,45 @@ +// As discussed with unity updating the test case
+
+{
+ var a = @"asdasda";
+
+ var d =
+@"asdasda";
+
+ var d =
+ @"asdasda";
+
+ var b = @"
+line1
+line2";
+
+ var c = Very(Long(Nested(Function(
+@"line1
+line2"))));
+
+var c = Very(Long(Nested(Function(
+ @"line1
+line2"))));
+
+ var c = Function(
+ hey,
+ you,
+@"line1
+line2", fubar,
+ hmm);
+
+var c = Function(
+ hey,
+ you,
+ @"line1
+line2", fubar,
+ hmm);
+
+ var c = Function(
+ hey,
+ you,
+@"line1
+line2",
+ fubar,
+ hmm);
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2021.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2021.cs new file mode 100644 index 00000000..2b08fafe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2021.cs @@ -0,0 +1,29 @@ +// updating the testcase for 1247
+// concluded that we need to convert all the 4,3,2 liners to one liner based on the option
+int fun ()
+{
+return 0;
+}
+
+int fun() {return 0; }
+
+int fun() {
+return 0;
+}
+
+int fun() {
+return 0; }
+
+int fun()
+{return 0; }
+
+int fun() { return 0;
+}
+
+int fun()
+{
+return 0; }
+
+int fun()
+{ return 0;
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-21730.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-21730.cs new file mode 100644 index 00000000..6fcb8c16 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-21730.cs @@ -0,0 +1,5 @@ +private void Foo()
+{
+ Action<UnityPlayerBaseStartInfo, GraphicsTestRunConfiguration, Action<string, Bitmap, long>, RenderingBackend, DX11FeatureLevel? , string> playerRunnerImageCallback
+ = (playerStartInfo, description, incomingScreenshotCallback, configuration, dx11Featurelevel, graphicsDriverType) => incomingScreenshotCallback(filename, new Bitmap(1, 1), 42);
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2505.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2505.cs new file mode 100644 index 00000000..a17e6a5e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2505.cs @@ -0,0 +1,2 @@ +public class Class : Base
+{}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2506.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2506.cs new file mode 100644 index 00000000..7bdbb81a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2506.cs @@ -0,0 +1,12 @@ +public class Class
+{
+ public int property
+ {
+ get
+ {
+ return !IsModeActive(Mode.None)
+ && !IsModeActive(Mode.Foo)
+ && !IsModeActive(Mode.Bar);
+ }
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2684.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2684.cs new file mode 100644 index 00000000..0c91b081 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2684.cs @@ -0,0 +1,4 @@ +EditorApplication.CallDelayed(() => { + foreach (CollabToolbarWindow window in Resources.FindObjectsOfTypeAll<CollabToolbarWindow>()) + window.Close(); +}, 1f);
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2685.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2685.cs new file mode 100644 index 00000000..4c11f20b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-2685.cs @@ -0,0 +1,9 @@ +func(a, b, c, d, + (float a, int b, Foo bar) => + { + test(); + }); +(float a, int b, Foo bar) => + { + test(); + });
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-29933.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-29933.cs new file mode 100644 index 00000000..ed96bc87 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-29933.cs @@ -0,0 +1,27 @@ +void Foo1()
+{
+ switch (foo)
+ {
+ case 1:
+ _bar = new Bar(x, y,
+ z, a);
+ break;
+ case 2:
+ _bar = new Bar(x, y,
+ z, a);
+ break;
+ case 3:
+ _bar = foo.bar;
+ break;
+ case 4:
+ foo.bar = Bar.BarFunc(x, (x == y)
+ ? foo.x
+ : foo.y);
+ break;
+ case 5:
+ foo.bar = Bar.BarFunc(x, (x == y)
+ ? foo.x
+ : foo.y);
+ break;
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-30498_2.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-30498_2.cs new file mode 100644 index 00000000..ba0d8515 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-30498_2.cs @@ -0,0 +1,39 @@ +class Foo
+{
+ public static IEnumerable<NPath> RuntimeIncludes { get; }
+ = new[]
+ {
+ new NPath("Projects/PrecompiledHeaders")
+ };
+
+ void Foo(string file)
+ {
+ var type = Path.GetFileNameWithoutExtension(file);
+ switch (Path.GetExtension(file))
+ {
+ case ".cs":
+ resource = new Bar(string.Format("test output",
+ type));
+ break;
+ case ".baz":
+ resource = new Baz(type,
+ string.Format(@"test output
+with multiple
+lines
+",
+ type));
+ break;
+ }
+ }
+}
+
+public class Bar
+{
+ private static FooBar Baz { get; }
+ = new FooBar()
+ .WithPath("foo/bar/baz")
+ .WithSource("qux/quux/quuz")
+ .WithPrebuiltReference(FooBar.Baz)
+ .WithBaz("2")
+ .Complete();
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-3083.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-3083.cs new file mode 100644 index 00000000..5209dc72 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-3083.cs @@ -0,0 +1,15 @@ +class ClassWithCtorICall +{ + public ClassWithCtorICall() + { + DoICall(); + } + + //It shouldn't add an extra space before 0x1000 + [MethodImpl((MethodImplOptions)0x1000)] + static extern void DoICall(); + + //It shouldn't add an extra space before 1000 + [MethodImpl((MethodImplOptions)1000)] + static extern void DoICall(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-32658.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-32658.cs new file mode 100644 index 00000000..145da65f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-32658.cs @@ -0,0 +1,36 @@ +//TestCase-001
+internal struct MyStruct<T>
+ where T : struct, IPrepareFrameJob
+{
+}
+
+//TestCase-002
+class MyClass<T, U>
+ where T : class
+ where U : struct
+{
+}
+
+//TestCase-003
+interface IMyInterface
+{
+}
+
+class Dictionary<TKey, TVal>
+ where TKey : IComparable, IEnumerable
+ where TVal : IMyInterface
+{
+ public void Add(TKey key, TVal val) {}
+}
+
+long DeviceCommand<TCommand>(int deviceId, ref TCommand command)
+ where TCommand : struct, IInputDeviceCommandInfo;
+
+public virtual long OnDeviceCommand<TCommand>(ref TCommand command)
+ where TCommand : struct, IInputDeviceCommandInfo;
+
+long DeviceCommand<TCommand>(int deviceId, ref TCommand command)
+ where TCommand : struct, IInputDeviceCommandInfo
+
+public virtual long OnDeviceCommand<TCommand>(ref TCommand command)
+ where TCommand : struct, IInputDeviceCommandInfo
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-3484.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-3484.cs new file mode 100644 index 00000000..1235aa91 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-3484.cs @@ -0,0 +1,57 @@ +// various combos from unity
+
+contents.Append( "#include \"{file.GetBoundPath ()}\"" );
+contents.Append( $"#include \"{file.GetBoundPath ()}\"" );
+contents.Append( $"#include \"{file.GetBoundPath ("abc def")}\"" );
+
+contents.Append(
+ $"#include \"{file.GetBoundPath()}\"");
+
+contents.Append( $@"#include
+""{file.GetBoundPath($@"abc
+ def")}""" );
+
+contents.Append(
+ $@"#include
+""{file.GetBoundPath(@"abc
+ def ghi")}""" );
+
+contents. Append( @"#include
+""{file.GetBoundPath ()}""" );
+
+// fun with nesting
+
+$@"{$"\\\"abc{$@" \""def\"" {"{ghi}"} {jkl} {{mno}}"}\\\""
+}".Dump();
+
+$@"{$@"\""abc{$@" def {"{ghi}"}
+ {jkl} {{mno}}\"""}"
+}".Dump();
+
+// ensure we didn't break @for etc
+
+var @for = @base + @this - $@"{@while}" ;
+
+// from roslyn's InterpolationTests.cs
+
+Console.WriteLine($"{number}");
+
+Console.WriteLine($"{number}{number}");
+Console.WriteLine($"Jenny don\'t change your number { number :###-####} { number :###-####}.");
+Console.WriteLine($"jenny { ((Func<int>)(() => { return number; })).Invoke() :(408) ###-####}");
+Console.WriteLine( $"{hello}, { world }." );
+
+Console.WriteLine( $@"{
+ hello
+ },
+{
+ world }." );
+
+System.Console.Write($"{{ x }}");
+var s = $@"{$@""{1}""}";
+
+Console.WriteLine($"{ await hello }, { await world }!");
+
+Console.WriteLine($"X = { 123 , -(3+4) }.");
+
+var s1 = $"X = { 1 } ";
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-36862.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-36862.cs new file mode 100644 index 00000000..cb3cb448 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-36862.cs @@ -0,0 +1,10 @@ +public unsafe struct QueryKeyNameCommand : IInputDeviceCommandInfo
+{
+ public string ReadKeyName()
+ {
+ fixed(QueryKeyNameCommand* thisPtr = &this)
+ {
+ return StringHelpers.ReadStringFromBuffer(new IntPtr(thisPtr->nameBuffer), kMaxNameLength);
+ }
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-37241.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-37241.cs new file mode 100644 index 00000000..b2097c4f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-37241.cs @@ -0,0 +1,5 @@ +public double TotalPurchases { get; set; }
+protected IEnumerable<string> Defines { get; } =
+TargetPlatformRules.Elements
+ .Append("LINUX")
+ .Append("_RAKNET_LIB");
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-40685.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-40685.cs new file mode 100644 index 00000000..a2f37547 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-40685.cs @@ -0,0 +1,29 @@ +namespace Namespace
+{
+ public static class Class
+ {
+ public static void Foo()
+ {
+ Tests = Bar(
+ A,
+ cp =>
+ cp.Foo(new Bar
+ {
+ Identifier = "ID",
+ PathToEmbed = "VAL"
+ })
+ .WithPrebuiltReference(Moq),
+ Core);
+
+ var Test = FooBar(
+ B,
+ cp => cp.WithB(Bar).WithSource("Path/File.ext"),
+ new[] {
+ A,
+ B,
+ C
+ }
+ );
+ }
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-58354.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-58354.cs new file mode 100644 index 00000000..6c77de40 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-58354.cs @@ -0,0 +1,4 @@ +public static class Extensions +{ + public static FluentXboxOneSdk VS2017(this FluentPlatform<XboxOnePlatform> _) => new FluentXboxOneSdk {MsvcVersion = new Version(15, 0)}; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-9917.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-9917.cs new file mode 100755 index 00000000..5bd9dc64 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/UNI-9917.cs @@ -0,0 +1,45 @@ +// 1. Formatting the first produces the second. + +namespace Unity.IL2CPP.IntegrationTests.ILTests.Tests +{ + public class GlobalsWithBoxOptimizationAndBrTrueOpcodeTest : BoxTestsBase { public GlobalsWithBoxOptimizationAndBrTrueOpcodeTest() : base(OpCodes.Brtrue) { } } + public class GlobalsWithBoxOptimizationAndBrTrueSOpcodeTest : BoxTestsBase { public GlobalsWithBoxOptimizationAndBrTrueSOpcodeTest() : base(OpCodes.Brtrue_S) { } } + public class GlobalsWithBoxOptimizationAndBrFalseOpcodeTest : BoxTestsBase { public GlobalsWithBoxOptimizationAndBrFalseOpcodeTest() : base(OpCodes.Brfalse) { } } + public class GlobalsWithBoxOptimizationAndBrFalseSOpcodeTest : BoxTestsBase { public GlobalsWithBoxOptimizationAndBrFalseSOpcodeTest() : base(OpCodes.Brfalse_S) { } } +} + +// 2. And formatting this produces the third. + +namespace Unity.IL2CPP.IntegrationTests.ILTests.Tests +{ + public class GlobalsWithBoxOptimizationAndBrTrueOpcodeTest : BoxTestsBase { public GlobalsWithBoxOptimizationAndBrTrueOpcodeTest() : base(OpCodes.Brtrue) {} + } + public class GlobalsWithBoxOptimizationAndBrTrueSOpcodeTest : BoxTestsBase { public GlobalsWithBoxOptimizationAndBrTrueSOpcodeTest() : base(OpCodes.Brtrue_S) {} + } + public class GlobalsWithBoxOptimizationAndBrFalseOpcodeTest : BoxTestsBase { public GlobalsWithBoxOptimizationAndBrFalseOpcodeTest() : base(OpCodes.Brfalse) {} + } + public class GlobalsWithBoxOptimizationAndBrFalseSOpcodeTest : BoxTestsBase { public GlobalsWithBoxOptimizationAndBrFalseSOpcodeTest() : base(OpCodes.Brfalse_S) {} + } +} + +// 3. This doesn't changes when formatted. + +namespace Unity.IL2CPP.IntegrationTests.ILTests.Tests +{ + public class GlobalsWithBoxOptimizationAndBrTrueOpcodeTest : BoxTestsBase + { + public GlobalsWithBoxOptimizationAndBrTrueOpcodeTest() : base(OpCodes.Brtrue) { } + } + public class GlobalsWithBoxOptimizationAndBrTrueSOpcodeTest : BoxTestsBase + { + public GlobalsWithBoxOptimizationAndBrTrueSOpcodeTest() : base(OpCodes.Brtrue_S) { } + } + public class GlobalsWithBoxOptimizationAndBrFalseOpcodeTest : BoxTestsBase + { + public GlobalsWithBoxOptimizationAndBrFalseOpcodeTest() : base(OpCodes.Brfalse) { } + } + public class GlobalsWithBoxOptimizationAndBrFalseSOpcodeTest : BoxTestsBase + { + public GlobalsWithBoxOptimizationAndBrFalseSOpcodeTest() : base(OpCodes.Brfalse_S) { } + } +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/add-nl-before-namespace.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/add-nl-before-namespace.cs new file mode 100644 index 00000000..93a2cf04 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/add-nl-before-namespace.cs @@ -0,0 +1,10 @@ +using System; +namespace MyNamespace +{ +namespace MyNamespace2 +{ +class A +{ +} +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/argtypes.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/argtypes.mm new file mode 100644 index 00000000..fd2ff142 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/argtypes.mm @@ -0,0 +1,3 @@ +static void WriteArrayToDrag (NSArray* array, NSPasteboard* pboard, NSString* pboardType);
+static OSStatus FindProcess (const FSRef* appRef, ProcessSerialNumber *pPSN, NSString* application, bool permissiveSearching);
+NSString* MakeNSString(const std::string& string);
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/asm.h.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/asm.h.mm new file mode 100644 index 00000000..97c0edd3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/asm.h.mm @@ -0,0 +1,21 @@ +static inline void atomic_retain(volatile int *p)
+{
+#if defined(_MSC_VER)
+ _InterlockedIncrement ((LONG volatile *) p);
+#else
+ __asm__ (
+ "lock incl %0\n\t"
+ : "+m" (*p)
+ :
+ : "cc", "memory"
+ );
+#endif
+}
+
+static inline void atomic_thread_fence (memory_order_release_t)
+{
+ __asm__ __volatile__
+ (
+ ASM_LWSYNC : : : "memory"
+ );
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1591.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1591.cs new file mode 100644 index 00000000..ac62df9e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1591.cs @@ -0,0 +1 @@ +byte[] utf8Str = new byte[] { 197, 170, 110, 196, 173, 099, 197, 141, 100, 101, 204, 189 }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1620.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1620.cs new file mode 100644 index 00000000..0c9d4eb9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1620.cs @@ -0,0 +1,67 @@ +new WaveformStreamer(s_sweepedClip, 0, s_sweepedClip.length, 1,
+ (streamer, floats, remaining) =>
+ {
+ return false;
+ }
+ );
+
+using System.Collections.Generic;
+
+class C
+{
+ public void S()
+ {
+ Action localMethod = () => {
+ SomeClass.OtherMethod(new Dictionary<string, string>
+{
+ {"a", "one"},
+ {"b", "two"},
+ {"c", "three"}
+ });
+ };
+ m_Mixers.Add(
+ new WeightInfo
+ {
+ parentMixer = parent,
+ mixer = node,
+ port = port,
+ modulate = (type == typeof(AnimationLayerMixerPlayable))
+ }
+ );
+ }
+}
+
+MergeJSFiles(new string[] {
+ GetDecompressor(),
+ Paths.Combine(buildToolsDir, "UnityConfig"),
+ Paths.Combine(args.stagingAreaData, kOutputFileLoaderFileName),
+ }, unityLoader
+);
+
+public void GeneratesCorrectVisualStudioProjectFile()
+{
+ GenerateProjectsAndCompareWithTemplates(
+ runInJam: InJamCreateTestProject,
+ generatedPath: TestRoot.Combine("Solution"),
+ templatesPath: "Tools/Unity.BuildSystem/Unity.BuildSystem.VisualStudio.Tests/Templates",
+ templates: new[] {
+ "TestProjectGeneration_CApplication.sln",
+ "Projects/TestProjectGeneration_CApplication.vcxproj",
+ "Projects/TestProjectGeneration_CApplication.vcxproj.filters"
+ });
+}
+
+public void GeneratesCorrectVisualStudioProjectFile()
+{
+ GenerateProjectsAndCompareWithTemplates(
+ runInJam: InJamCreateTestProject,
+ generatedPath: TestRoot.Combine("Solution"),
+ templatesPath: "Tools/Unity.BuildSystem/Unity.BuildSystem.VisualStudio.Tests/Templates",
+ templates: new[]
+ {
+ "TestProjectGeneration_CApplication.sln",
+ "Projects/TestProjectGeneration_CApplication.vcxproj",
+ "Projects/TestProjectGeneration_CApplication.vcxproj.filters"
+ }
+ );
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1637.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1637.cs new file mode 100644 index 00000000..1f46d1bc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1637.cs @@ -0,0 +1,2 @@ +//Test Case-001
+inline double GetAudioBitrateForQuality(double f) { return (56000 + 200000 * (f)); }
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1650.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1650.cs new file mode 100644 index 00000000..5c52aece --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_1650.cs @@ -0,0 +1,46 @@ +public string Foo =>
+ "bar";
+public string Foo
+ => "bar";
+
+public static T WithAdditionalFlags<T>(this T _this, IEnumerable<string> flags) where T : ObjectFileLinker
+ => _this.WithLinkerSetting(l => l.Flags = l.Flags.Concat(flags));
+
+public static T WithAdditionalFlags<T>(this T _this, IEnumerable<string> flags) where T : ObjectFileLinker =>
+ _this.WithLinkerSetting(l => l.Flags = l.Flags.Concat(flags));
+
+ public static T WithAdditionalFlags<T>(this T _this, IEnumerable<string> flags) where T : ObjectFileLinker
+ => _this.WithLinkerSetting(
+ l => l.Flags =
+ l.Flags.Concat(flags));
+
+public static T WithAdditionalFlags<T>(this T _this, IEnumerable<string> flags) where T : ObjectFileLinker => _this.WithLinkerSetting(
+ l => l.Flags =
+ l.Flags.Concat(flags));
+
+public static T WithAdditionalFlags<T>(this T _this, IEnumerable<string> flags) where T : ObjectFileLinker
+ => _this.WithLinkerSetting(l =>
+ l.Flags = l.Flags.Concat(flags));
+
+public static T WithAdditionalFlags<T>(this T _this, IEnumerable<string> flags) where T : ObjectFileLinker =>
+ _this.WithLinkerSetting(l
+ => l.Flags = l.Flags.Concat(flags));
+
+var islands = EditorCompilationInterface.GetAllMonoIslands().Select(i => new Island
+{
+ MonoIsland = i,
+ Name = Path.GetFileNameWithoutExtension(i._output),
+ References = i._references.ToList()
+}).ToList();
+
+var projectEntries = islands.Select(i => string.Format(
+ DefaultSynchronizationSettings.SolutionProjectEntryTemplate,
+ SolutionGuid(i), _projectName, Path.GetFileName(ProjectFile(i)), ProjectGuid(i._output)
+ ));
+
+
+Func<IEnumerable<IMemberDefinition>, IEnumerable<IMemberDefinition>> filterMembersWithObsoleteAttr = members => members.Where(m =>
+ !m.IsRuntimeSpecialName
+ && !m.IsSpecialName
+ && !blackList.Contains(m.FullName)
+ && CheckCustomAttributes(m));
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_600.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_600.cs new file mode 100644 index 00000000..3d93d861 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_600.cs @@ -0,0 +1,14 @@ +Vector2 ? a; +Vector2 b; + +void G() +{ + int ? x = true ? null : (int ?)2; + var q = x == null ? y : z; + var q2 = x == q ? y : z; + var q3 = x == null ? (y = new Y()) : z; + var q4 = x == q ? (y = new Y()) : z; + + var q5 = x == null ? y = new Y() : z; + var q6 = x == q ? y = new Y() : z; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_620.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_620.cs new file mode 100644 index 00000000..f6ee6342 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_620.cs @@ -0,0 +1,7 @@ +class C
+{
+ float V {
+ get {
+ return _v; }
+ set { _v = value; } }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_i_679.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_i_679.cs new file mode 100644 index 00000000..199ad7e6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_i_679.cs @@ -0,0 +1,4 @@ +using (var x = X()) +using (var y = Y()) +{ +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_i_935.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_i_935.cs new file mode 100644 index 00000000..d2c8ec95 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/bug_i_935.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using Syst; +using System2; +using System; + +using b.ddd.A; +using b; +using b.ddd; +using b.fff; +using b.eee; +using b.a; +using b.A; + +void foo(); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/casting.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/casting.mm new file mode 100644 index 00000000..c8022c7b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/casting.mm @@ -0,0 +1 @@ +videoViewController.videoGravity = (NSString*)videoGravity;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/cmt_backslash_eol.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/cmt_backslash_eol.cs new file mode 100644 index 00000000..e56aec25 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/cmt_backslash_eol.cs @@ -0,0 +1,4 @@ +foo(); +// test \ +blah(); +bar(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/definesalign.h.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/definesalign.h.mm new file mode 100644 index 00000000..a249d1aa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/definesalign.h.mm @@ -0,0 +1,5 @@ + #define SOUNDMANAGERWATCHDOG()\
+ SoundManagerWatchDog watchdog
+
+ #define CompileTimeAssert(expression, message) \
+ enum{ CT_ASSERT_HACK_JOIN(ct_assert_, __LINE__) = sizeof(CompileTimeAssertImpl<(expression)>) }
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/delegate.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/delegate.cs new file mode 100644 index 00000000..3a4b103c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/delegate.cs @@ -0,0 +1,29 @@ +void foo() +{ +obj.cb += () => { }; + +funcwithverylongname(() => +{ +func(); +}); +} + +Func( + "stuff", + foo => + { + bar(); + }); + +Func( + "stuff", + foo => +{ + bar(); +}); + +data.Sort( + delegate(InputData lhs, InputData rhs) +{ + return lhs.m_Name.CompareTo(rhs.m_Name); +}); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/delete-space-oc.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/delete-space-oc.mm new file mode 100644 index 00000000..66e24dc8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/delete-space-oc.mm @@ -0,0 +1,69 @@ +/* EditorApplication */
+
+#include <string>
+
+#ifdef __OBJC__
+#import <Cocoa/Cocoa.h>
+
+class HierarchyState;
+@interface EditorApplication : NSObject
+{
+ IBOutlet id m_MainWindow;
+ IBOutlet id m_PaneController;
+ id m_RenderTimer;
+
+ IBOutlet id m_CutItem;
+ IBOutlet id m_CopyItem;
+ IBOutlet id m_PasteItem;
+
+ IBOutlet id m_DuplicateItem;
+ IBOutlet id m_DeleteItem;
+
+ IBOutlet id m_FrameSelectedItem;
+ IBOutlet id m_FindItem;
+ IBOutlet id m_SelectAllItem;
+}
+
+- (IBAction)SaveAssets:(id)sender;
+- (IBAction)CloseScene:(id)sender;
+- (IBAction)NewProject:(id)sender;
+- (IBAction)OpenProject:(id)sender;
+
+- (IBAction)SaveAsSceneToDisk:(id)sender;
+
+- (IBAction)EnterSerialNumber:(id)sender;
+- (IBAction)ReturnLicense:(id)sender;
+- (IBAction)CompileScene:(id)sender;
+- (IBAction)CompileSceneAutomatic:(id)sender;
+
+- (IBAction)saveDocument:(id)sender;
+
+- (IBAction)LoadSceneFromDisk:(id)sender;
+
+- (void)RemoveDisplayTimer;
+- (void)RegisterUpdateTimer:(int)frequency;
+
+- (void)refreshModifiedFile:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+- (void)closeFile:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+
+- (IBAction)ShowAboutDialog:(id)sender;
+- (IBAction)ShowPreferences:(id)sender;
+- (IBAction)ShowPackageManager:(id)sender;
+
+- (IBAction) delete:(id)sender;
+- (IBAction) copy:(id)action;
+- (IBAction)paste:(id)action;
+- (IBAction)duplicate:(id)action;
+- (IBAction)cut:(id)action;
+- (IBAction)selectAll:(id)action;
+- (IBAction)find:(id)action;
+- (IBAction)frameSelected:(id)action;
+- (IBAction)frameSelectedWithLock:(id)action;
+
+// Assetstore protocol handler and registration
+- (void)registerAssetStoreURLProtocol;
+- (void)getUrl:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+
+@end
+
+#endif
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/exception-filters.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/exception-filters.cs new file mode 100644 index 00000000..1e3abca3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/exception-filters.cs @@ -0,0 +1,30 @@ +using System; +class Test +{ +void TestExceptionFilter() +{ +var when = new Object(); +try { + int i = 0; +} catch (Exception e) +{ + int j = -1; +} +try { + int i = 0; +} catch +{ + int j = -1; +} +try { + int i = 0; +} catch when (DateTime.Now.DayOfWeek == DayOfWeek.Saturday) +{ + int j = -1; +} +try { + int a = (int)when.foo(); +} catch (Exception e)when (DateTime.Now.DayOfWeek == DayOfWeek.Saturday) +{ + string b = ((int)when.prop).ToString(); +}}} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/fncall_as_ctor_in_attr.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/fncall_as_ctor_in_attr.cs new file mode 100644 index 00000000..cf52b46f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/fncall_as_ctor_in_attr.cs @@ -0,0 +1,5 @@ +public class ClassName
+{
+ [Namespace.ClassName("Array")]
+ public int[] Array = { 10 };
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/func-param-wrap-oc.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/func-param-wrap-oc.mm new file mode 100644 index 00000000..16f98ce9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/func-param-wrap-oc.mm @@ -0,0 +1,5 @@ + if(progress <= 0)
+ {
+ [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(NSMinX(pieRect)+stroke,NSMinY(pieRect)+stroke,
+ NSWidth(pieRect)-2*stroke,NSHeight(pieRect)-2*stroke)] fill];
+ }
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/generics.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/generics.cs new file mode 100644 index 00000000..7bbe04c7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/generics.cs @@ -0,0 +1,11 @@ + +int foo() +{ +a.b<c, d>(); +a.b<c, e<d>>(); +a.b < c, d > (); +a.b < c, e < d > > (); +a.b < c, e < d > > (); + +return default (T); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/getset.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/getset.cs new file mode 100644 index 00000000..59aaa5bc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/getset.cs @@ -0,0 +1,14 @@ +public bool Enabled +{ +get { return enabled; } +} + + +public bool Enabled +{ +get +{ +return enabled; +} +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/gs.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/gs.cs new file mode 100644 index 00000000..16adc604 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/gs.cs @@ -0,0 +1,30 @@ +private string s = ""; +public int Amount +{ +get +{ +; +} +set +{ +; +} +} +public EventHandler MyCustomEventHandler +{ +add +{ +; +} +remove +{ +; +} +} +public this[string index] +{ +get; +set; +} +private string s2 = ""; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/ifcolalign.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/ifcolalign.cs new file mode 100644 index 00000000..d2e40c78 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/ifcolalign.cs @@ -0,0 +1,16 @@ +namespace Unity
+{
+internal class Class
+{
+ public void Foo()
+ {
+ if (data) go = new ClassA();
+ else go = new ClassB();
+
+ if (evt.alt) modifiers += "Alt+";
+ if (evt.command) modifiers += "Cmd+";
+ if (evt.control) modifiers += "Ctrl+";
+ if (evt.shift) modifiers += "Shift+";
+ }
+}
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/ifcomment.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/ifcomment.cs new file mode 100644 index 00000000..6663a6ca --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/ifcomment.cs @@ -0,0 +1,57 @@ +#define RENDER_POINTS_USING_MESH + +namespace UnityEditor +{ + internal class CurveWrapper + { + private void DoIconAndName (Rect rect, AnimationWindowHierarchyNode node, bool selected, bool focused, float indent) + { + EditorGUIUtility.SetIconSize (new Vector2 (13, 13)); // If not set we see icons scaling down if text is being cropped + } + public void foo() + { + if (this) + { + if (b) + { + // Now draw + for (int i = 0; i < ticks.Length; i++) + { + ticksPos[i] /= axisUiScalars.y; + if (ticksPos[i] < vRangeMin || ticksPos[i] > vRangeMax) + continue; + + Vector2 pos = DrawingToViewTransformPoint(new Vector2(0, ticksPos[i])); + // Important to take floor of positions of GUI stuff to get pixel correct alignment of + // stuff drawn with both GUI and Handles/GL. Otherwise things are off by one pixel half the time. + pos = new Vector2(pos.x, Mathf.Floor(pos.y)); + + float uiValue = ticks[i]; + Rect labelRect; + if (settings.vTickStyle.centerLabel) + labelRect = new Rect(0, pos.y - 8, leftmargin - 4, 16); // text expands to the left starting from where grid starts (leftmargin size must ensure text is visible) + else + labelRect = new Rect(0, pos.y - 13, labelSize, 16); // text expands to the right starting from left side of window + + GUI.Label(labelRect, uiValue.ToString(format) + settings.vTickStyle.unit, ms_Styles.labelTickMarksY); + } + } + } + // Cleanup + GUI.color = tempCol; + + GUI.EndClip(); + } + } +} // namespace + +namespace UnityEditor +{ +internal class TreeView +{ + public System.Action<int[]> selectionChangedCallback { get; set; } // ids + public System.Action<int> itemDoubleClickedCallback { get; set; } // id + public System.Action<int[], bool> dragEndedCallback { get; set; } // dragged ids, if null then drag was not allowed, bool == true if dragging tree view items from own treeview, false if drag was started outside + public System.Action<int> contextClickItemCallback { get; set; } // clicked item id +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/indent-multistring-coulmn1.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/indent-multistring-coulmn1.cs new file mode 100644 index 00000000..56bdf473 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/indent-multistring-coulmn1.cs @@ -0,0 +1,16 @@ +//This +var a = hello( + @"world" +); + +//should stay the same. +//But this +var a = hello( + @"world +"); + +//should get formatted to this +var a = hello( +@"world +"); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/inttypes.h.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/inttypes.h.mm new file mode 100644 index 00000000..6e093789 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/inttypes.h.mm @@ -0,0 +1,3 @@ +static int32_t level_and_name_to_system(SocketOptionLevel level, SocketOptionName name, int32_t *system_level, int32_t *system_name)
+
+WaitStatus SendTo (uint8_t address[ipv6AddressSize], uint32_t scope, uint16_t port, const uint8_t *data, int32_t count, os::SocketFlags flags, int32_t *len);
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/logger.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/logger.cs new file mode 100644 index 00000000..defede8a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/logger.cs @@ -0,0 +1,4 @@ +// Turning on sp_inside_braces=add fixes it, but also changes a lot of initializer code we don't want to touch (like x = {1}). May need special support, or perhaps there's a bug..
+// long comment line(s), such as here, might be too long to produce a correct LOG-file such as
+// with the use of option -L A
+// in such a case, the output of the log will be cut.
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mdarray_space.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mdarray_space.cs new file mode 100644 index 00000000..e5338c11 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mdarray_space.cs @@ -0,0 +1,2 @@ +int[,,] x;
+var y = new int[2,3];
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/misc-failures.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/misc-failures.cs new file mode 100644 index 00000000..857c06f9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/misc-failures.cs @@ -0,0 +1,33 @@ +void Func() +{ + OtherFunc( +@"multi +line"); +} + +variablex = o.Func( + variabley); +variablex = o.Func2(a, b, + variabley); +o.Func( + variabley); +o.Func2(a, b, + variabley); + + + + AnimatorStateMachine rootStateMachine = syncedIndex == -1 + ? animatorController.layers[selectedLayerIndex].stateMachine + : animatorController.layers[syncedIndex].stateMachine; + + + m_ActiveStateMachine = AnimatorControllerTool.tool ? m_Type == TransitionType.eAnyState ? + AnimatorControllerTool.tool.stateMachineGraph.rootStateMachine : + AnimatorControllerTool.tool.stateMachineGraph.activeStateMachine : null; + + public GUIStyle[] inSlots = { + FindStyle("flow shader in 0"), FindStyle("flow shader in 1"), FindStyle("flow shader in 2"), FindStyle("flow shader in 3"), FindStyle("flow shader in 4"), FindStyle("flow shader in 5"), + }; + + + public GUIStyle[] inSlots = { 1, 2, 3 }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mod_full_brace_nl_block_rem_mlcond.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mod_full_brace_nl_block_rem_mlcond.cs new file mode 100644 index 00000000..f8db4f0b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mod_full_brace_nl_block_rem_mlcond.cs @@ -0,0 +1,81 @@ +// mod_full_brace_nl_block_rem_mlcond should block brace removal here +if( a == true + && b == false ) +{ + return 1; +} +else if( a == true + && b == false) +{ + return 2; +} +// except here as there are no parenthesis +else +{ + return 3; +} + + +if( a == true; + b == true; + c == true) +{ + return 1; +} + +for( a = true; + a < 9; + a++) +{ + return 1; +} + +while( a == true + && b == true + && c == true) +{ + return 1; +} + +using (Foo bar = + new Foo()) +{ + return 1; +} + + + +// mod_full_brace_nl_block_rem_mlcond should not block brace removal here +if( a == true && b == false ) +{ + return 1; +} +else if( a == true && b == false) +{ + return 2; +} +else +{ + return 3; +} + + +if( a == true; b == true; c == true) +{ + return 1; +} + +for( a = true; a < 9; a++) +{ + return 1; +} + +while( a == true && b == true && c == true) +{ + return 1; +} + +using (Foo bar = new Foo()) +{ + return 1; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mod_full_paren_if_bool.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mod_full_paren_if_bool.cs new file mode 100644 index 00000000..6bcd9201 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/mod_full_paren_if_bool.cs @@ -0,0 +1,5 @@ +List<int> list = new List<int>(); +if (list.All(i0 => i1 > 5 && i2 < 9)) +{ + return; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/new-constraint-paren-space.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/new-constraint-paren-space.cs new file mode 100644 index 00000000..209f2721 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/new-constraint-paren-space.cs @@ -0,0 +1,5 @@ +// same as 10130-sp_between_new_paren.cs
+T F<T>() where T : new()
+{
+ return new T();
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/newlines.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/newlines.mm new file mode 100644 index 00000000..31a46376 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/newlines.mm @@ -0,0 +1,34 @@ +NSString* GetXcodePath()
+{
+ return [[NSWorkspace sharedWorkspace]absolutePathForAppBundleWithIdentifier:kXCodeBundleId];
+}
+
+
+extern "C" EXPORTDLL void LaunchXCode()
+{
+ NSString* curApp = GetXcodePath();
+ [[NSWorkspace sharedWorkspace] launchApplication:curApp];
+
+ NSArray *selectedApps =
+ [NSRunningApplication runningApplicationsWithBundleIdentifier:kXCodeBundleId];
+
+ for (int i = 0; i < [selectedApps count]; i++)
+ {
+ NSRunningApplication *app = [selectedApps objectAtIndex:i];
+ int count = 0;
+ NSLog(@"Checking %@\n", app);
+ while (![app isFinishedLaunching] && count++ < 300)
+ [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 1.0f]];
+ }
+}
+
+
+NSString* MakeNSString (const std::string& string)
+{
+ return MakeNSString(string.c_str());
+}
+NSString* MakeNSString (const char* string)
+{
+ NSString* ret = string ? [NSString stringWithUTF8String:string] : nil;
+ return ret ? ret : @"";
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/nullable_prop.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/nullable_prop.cs new file mode 100644 index 00000000..21c4f7b0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/nullable_prop.cs @@ -0,0 +1,18 @@ + +namespace Foo +{ + +public class Bar +{ +public int? Val; + +public int? Prop +{ + get + { + return 1; + } +} +} +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/objc.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/objc.mm new file mode 100644 index 00000000..7f0e706a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/objc.mm @@ -0,0 +1,8 @@ +void foo()
+{
+ if(key)
+ ret.key = [NSString stringWithCharacters:&key length:1];
+
+ [gUndoMenu->m_UndoItem setTitle:[NSString stringWithFormat:[NSString stringWithUTF8String:localizedUndo], undoName.c_str()]];
+ [gUndoMenu->m_RedoItem setTitle:[NSString stringWithFormat:[NSString stringWithUTF8String:localizedRedo], redoName.c_str()]];
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/oneline_property.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/oneline_property.cs new file mode 100644 index 00000000..1d7a2c26 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/oneline_property.cs @@ -0,0 +1,9 @@ +public class Class +{ + public float prop { get; set; } + public float prop { get { return m; } } + public float prop { set { m = value; } } + public float prop { get { return m; } set { m = value; } } + internal int prop { get { return m; } } +}; +public class Container { public int prop { get; set; } }; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/operator-null-conditional.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/operator-null-conditional.cs new file mode 100644 index 00000000..530bdd27 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/operator-null-conditional.cs @@ -0,0 +1,13 @@ +public class test +{ +public static void TestOfNullConditionalOperator() +{ +string s="Test"; +if (s?.Length > 0) +{ +s="Test"; +} +if (System.Reflection.Assembly.GetEntryAssembly()?.GetName() != null) +{ +s="Test"; +}}} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/operator_null-coalescing-assignment.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/operator_null-coalescing-assignment.cs new file mode 100644 index 00000000..416e6afc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/operator_null-coalescing-assignment.cs @@ -0,0 +1,8 @@ +public class Program
+{
+public static void Main()
+{
+ var thing = new int?();
+ thing ??= new int?();
+}
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/pp-ignore.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/pp-ignore.mm new file mode 100644 index 00000000..2673008c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/pp-ignore.mm @@ -0,0 +1,29 @@ +#define a z \
+ x
+
+#define a(b) z \
+ x
+
+#define ab(b) z \
+ x
+
+#define abc(b) z \
+ x
+
+#define abcd(b) z \
+ x
+
+
+#if FOO
+# define D(a, ...) B(FOO(a, __LINE__, __VA_ARGS__))
+# define C(msg) \
+ PP_WRAP_CODE( \
+ if (!msg) \
+ { \
+ BAR(); \
+ BARBAR(); \
+ BARBARBAR();\
+ })
+#else
+# define C(msg, ...) EMPTY
+#endif
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/preserveTabs.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/preserveTabs.cs new file mode 100644 index 00000000..c9583dcd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/preserveTabs.cs @@ -0,0 +1,3 @@ +/// <summary> +/// Event handler. +/// </summary> diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/property.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/property.cs new file mode 100644 index 00000000..85e08bae --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/property.cs @@ -0,0 +1,3 @@ +#define X 1 // comment to check tokenizing of URL +#property URL "http://www.google.com" +#define Y 2 // comment diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/region.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/region.cs new file mode 100644 index 00000000..4f8667f2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/region.cs @@ -0,0 +1,20 @@ +class 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 + } + +} + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/remove_semi.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/remove_semi.cs new file mode 100644 index 00000000..2e6d5a98 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/remove_semi.cs @@ -0,0 +1,7 @@ +var dude = "Dude";
+var dude2 = new { Name = "Dude", Age = 30, };
+var dude3 = new { Name = "Dude", Age = 30, Kids = new { Name = "LittleDude" } };
+var dude4 = new { Name = "Dude", Age = 30, Kids = new[] { "LittleDude" } };
+var dude5 = new { Name = "Dude", Age = 30, Kids = new[] { new { Name = "LittleDude" } } };
+Action y = () => { };
+Func<int, float, bool> z = (a, b) => { var z = new { a, b }; return z == null; };
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sf607.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sf607.cs new file mode 100644 index 00000000..f0617c19 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sf607.cs @@ -0,0 +1,4 @@ +int P {
+ get {
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sf628.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sf628.cs new file mode 100644 index 00000000..803c9962 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sf628.cs @@ -0,0 +1,11 @@ +void foo()
+{
+obj.cb += () => { };
+func();
+obj.cb += (p0) => { };
+func();
+obj.cb += (p0, p1) => { };
+func();
+Action a = delegate { };
+func();
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/simple.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/simple.cs new file mode 100644 index 00000000..30acd134 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/simple.cs @@ -0,0 +1,114 @@ +class 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); + } + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sort_using.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sort_using.cs new file mode 100644 index 00000000..881b4d5b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sort_using.cs @@ -0,0 +1,18 @@ +// 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(); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sort_using_categ.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sort_using_categ.cs new file mode 100644 index 00000000..173e42bb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sort_using_categ.cs @@ -0,0 +1,12 @@ +using Client.Common; +using LeopotamGroup.Common; +using LeopotamGroup.Serialization; +using System; +using UnityEngine.EventSystems; +using UnityEngine.Events; +using UnityEngine; + +using NameSpace; +using NameSpacEveryday; +using nameSpace; +using Namespace; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sp_between_new_paren.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sp_between_new_paren.cs new file mode 100644 index 00000000..f5d8381d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/sp_between_new_paren.cs @@ -0,0 +1,4 @@ +T F<T>() where T : new ()
+{
+ return new T();
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/squeeze-paren-close-Option.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/squeeze-paren-close-Option.cs new file mode 100644 index 00000000..37203f4a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/squeeze-paren-close-Option.cs @@ -0,0 +1,34 @@ +bool success(GenerateSecondaryUVSet(test(
+ &mesh.vertices[0].x, mesh.vertices.size(),
+ &triUV[0].x, &triList[0], triSrcPoly.size() ? &triSrcPoly[0] : 0, triCount,
+ &outUV[0].x, param, errorBuffer, bufferSize
+ )
+));
+
+int m = aaaaaaaaaaabaaaaaaaaaa(caaaaaaaaaa(
+ eaaaaaaaaaa(gaaaaaaaaaaa(haaaaaaaaaaaaa(
+ iaaaaaaaaaaaaaaaaaaaaaa(kaaaaaaaaaaaaaaaaaaaa)
+ )
+ )
+ )
+ )
+);
+
+int m = aaaaaaaaaaabaaaaaaaaaa(caaaaaaaaaa(
+ eaaaaaaaaaa(gaaaaaaaaaaa(haaaaaaaaaaaaa(
+ iaaaaaaaaaaaaaaaaaaaaaa(kaaaaaaaaaaaaaaaaaaaa)
+ ))
+ ))
+);
+
+int m = aaaaaaaaaaabaaaaaaaaaa(
+ caaaaaaaaaa(
+ eaaaaaaaaaa(
+ gaaaaaaaaaaa(
+ haaaaaaaaaaaaa(
+ iaaaaaaaaaaaaaaaaaaaaaa(kaaaaaaaaaaaaaaaaaaaa)
+ )
+ )
+ )
+ )
+);
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/string_multi.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/string_multi.cs new file mode 100644 index 00000000..9e715e51 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/string_multi.cs @@ -0,0 +1,13 @@ +public class C +{ + public void F() + { + var x = @" +abc"; + var y = @" +abc" + "def"; + var z = "" + +@" +"; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/strings.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/strings.cs new file mode 100644 index 00000000..6794e762 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/strings.cs @@ -0,0 +1,8 @@ +void foo() +{ + string s1 = L"C:\\foo\\bar"; + string s2 = S"C:\\foo\\bar"; + string s3 = "This is a \"test\""; + string s4 = "C:\\"; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/tcf.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/tcf.cs new file mode 100644 index 00000000..f3ac3664 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/tcf.cs @@ -0,0 +1,32 @@ +void foo() +{ +try +{ +; +} +catch (Exception e) +{ +; +} +finally { +; +} +bar(); + +try +{ +; +} +catch (Exception e) +{ +; +} +catch (Exception e) +{ +; +} +finally { +; +} +bar(); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/unsafe.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/unsafe.cs new file mode 100644 index 00000000..5dc90cb4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/unsafe.cs @@ -0,0 +1,7 @@ +public class Class1 +{ + public unsafe bool GetValue () + { + return true; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16be.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16be.cs Binary files differnew file mode 100644 index 00000000..13da3090 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16be.cs diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16be_no_bom.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16be_no_bom.cs Binary files differnew file mode 100644 index 00000000..33587b97 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16be_no_bom.cs diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16le.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16le.cs Binary files differnew file mode 100644 index 00000000..3f16b9d0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16le.cs diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16le_no_bom.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16le_no_bom.cs Binary files differnew file mode 100644 index 00000000..4a7f9ccc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/utf16le_no_bom.cs diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/var-member.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/var-member.cs new file mode 100644 index 00000000..0f7ffb23 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/var-member.cs @@ -0,0 +1,24 @@ +namespace Foo.Man.Chu +{ + /// <summary> + /// Summary description for MainForm. + /// </summary> + 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 + + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/verbatim_strings.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/verbatim_strings.cs new file mode 100644 index 00000000..47c3ed4c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/verbatim_strings.cs @@ -0,0 +1,7 @@ +class Class +{ + public string s1 = " Foo"; + public string s2 = @" + Foo +"; +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/when.cs b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/when.cs new file mode 100644 index 00000000..2785b894 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/cs/when.cs @@ -0,0 +1,17 @@ +private static string GenerateHash()
+{
+ try {
+ int i = 0;
+ } catch when (DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
+ {
+ int j = -1;
+ }
+ try {
+ int i = 0;
+ } catch (Exception e) when (DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
+ {
+ var when = DateTime.Now;
+ ulong kind = (ulong)(int)when.Kind;
+ return ((kind << 62) | (ulong)when.Ticks).ToString();
+ }
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/1438.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/1438.d new file mode 100644 index 00000000..10a43753 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/1438.d @@ -0,0 +1 @@ +invariant (1 <= day && day <= 31); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/HashMap.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/HashMap.d new file mode 100644 index 00000000..618b3e59 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/HashMap.d @@ -0,0 +1,1059 @@ +/******************************************************************************* + + @file HashMap.d + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for damages + of any kind arising from the use of this software. + + Permission is hereby granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and/or + redistribute it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment within documentation of + said product would be appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any distribution + of the source. + + 4. Derivative works are permitted, but they must carry this notice + in full and credit the original source. + + + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + Written by Doug Lea with assistance from members of JCP JSR-166 + Expert Group and released to the public domain, as explained at + http://creativecommons.org/licenses/publicdomain + + @version Initial version, July 2004 + @author Doug Lea; ported/modified by Kris + +*******************************************************************************/ + +module mango.cache.HashMap; + +/****************************************************************************** + +******************************************************************************/ + +extern (C) +{ + int memcmp (char *, char *, uint); +} + + +/** + * A hash table supporting full concurrency of retrievals and + * adjustable expected concurrency for updates. This class obeys the + * same functional specification as {@link java.util.Hashtable}, and + * includes versions of methods corresponding to each method of + * <tt>Hashtable</tt>. However, even though all operations are + * thread-safe, retrieval operations do <em>not</em> entail locking, + * and there is <em>not</em> any support for locking the entire table + * in a way that prevents all access. This class is fully + * interoperable with <tt>Hashtable</tt> in programs that rely on its + * thread safety but not on its synchronization details. + * + * <p> Retrieval operations (including <tt>get</tt>) generally do not + * block, so may overlap with update operations (including + * <tt>put</tt> and <tt>remove</tt>). Retrievals reflect the results + * of the most recently <em>completed</em> update operations holding + * upon their onset. For aggregate operations such as <tt>putAll</tt> + * and <tt>clear</tt>, concurrent retrievals may reflect insertion or + * removal of only some entries. Similarly, Iterators and + * Enumerations return elements reflecting the state of the hash table + * at some point at or since the creation of the iterator/enumeration. + * They do <em>not</em> throw + * {@link ConcurrentModificationException}. However, iterators are + * designed to be used by only one thread at a time. + * + * <p> The allowed concurrency among update operations is guided by + * the optional <tt>concurrencyLevel</tt> constructor argument + * (default 16), which is used as a hint for internal sizing. The + * table is internally partitioned to try to permit the indicated + * number of concurrent updates without contention. Because placement + * in hash tables is essentially random, the actual concurrency will + * vary. Ideally, you should choose a value to accommodate as many + * threads as will ever concurrently modify the table. Using a + * significantly higher value than you need can waste space and time, + * and a significantly lower value can lead to thread contention. But + * overestimates and underestimates within an order of magnitude do + * not usually have much noticeable impact. A value of one is + * appropriate when it is known that only one thread will modify and + * all others will only read. Also, resizing this or any other kind of + * hash table is a relatively slow operation, so, when possible, it is + * a good idea to provide estimates of expected table sizes in + * constructors. + * + * <p>This class and its views and iterators implement all of the + * <em>optional</em> methods of the {@link Map} and {@link Iterator} + * interfaces. + * + * <p> Like {@link java.util.Hashtable} but unlike {@link + * java.util.HashMap}, this class does NOT allow <tt>null</tt> to be + * used as a key or value. + * + * <p>This class is a member of the + * <a href="{@docRoot}/../guide/collections/index.html"> + * Java Collections Framework</a>. + * + * @since 1.5 + * @author Doug Lea + * @param <K> the type of keys maintained by this map + * @param <V> 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<n; ++i) h = hash( k[i], len[i], h); + * + * By Bob Jenkins, 1996. bob_jenkins@burtleburtle.net. You may use this + * code any way you wish, private, educational, or commercial. It's free. + * + * See http://burlteburtle.net/bob/hash/evahash.html + * Use for hash table lookup, or anything where one collision in 2^32 is + * acceptable. Do NOT use for cryptographic purposes. + */ + + static final uint jhash (K x) + { + ubyte* k; + uint a, + b, + c, + len; + + len = x.length; + k = cast(ubyte *) x; + a = b = 0x9e3779b9; + + // the previous hash value + c = 0; + + // handle most of the key + while (len >= 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<K,V> 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; + * <tt>null</tt> if the key is not mapped to any value in + * this table. + * @throws NullPointerException if the key is + * <tt>null</tt>. + */ + 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 <tt>true</tt> if and only if the specified object + * is a key in this table, as determined by the + * <tt>equals</tt> method; <tt>false</tt> otherwise. + * @throws NullPointerException if the key is + * <tt>null</tt>. + */ + public bool containsKey (K key) + { + uint hash = hash(key); // throws NullPointerException if key null + return segmentFor(hash).containsKey(key, hash); + } + + /** + * Maps the specified <tt>key</tt> to the specified + * <tt>value</tt> in this table. Neither the key nor the + * value can be <tt>null</tt>. + * + * <p> The value can be retrieved by calling the <tt>get</tt> 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 <tt>null</tt> if it did not have one. + * @throws NullPointerException if the key or value is + * <tt>null</tt>. + */ + 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 + * <pre> + * if (!map.containsKey(key)) + * return map.put(key, value); + * else + * return map.get(key); + * </pre> + * 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 <tt>null</tt> + * if there was no mapping for key. + * @throws NullPointerException if the specified key or value is + * <tt>null</tt>. + */ + 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 <tt>null</tt> if the key did not have a mapping. + * @throws NullPointerException if the key is + * <tt>null</tt>. + */ + 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 + * <pre> + * if (map.get(key).equals(value)) { + * map.remove(key); + * return true; + * } else return false; + * </pre> + * 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 + * <tt>null</tt>. + */ + 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 + * <pre> + * if ((map.containsKey(key)) { + * return map.put(key, value); + * } else return null; + * </pre> + * 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 <tt>null</tt> + * if there was no mapping for key. + * @throws NullPointerException if the specified key or value is + * <tt>null</tt>. + */ + 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; } + } + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/Lexer.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/Lexer.d new file mode 100644 index 00000000..004d9d8a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/Lexer.d @@ -0,0 +1,2335 @@ +/+
+ 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_identifier;
+ p++;
+ case '`':
+ t.value = wysiwygStringConstant(t, *p);
+ return;
+
+ case 'x':
+// debug writefln( " hex string" );
+ if( p[1] != '"')
+ goto case_identifier;
+ 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_identifier:
+ {
+// 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.identifier = 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.identifier.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_identifier;
+
+ 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.identifier != 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.identifier.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
++/
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/bug-indent.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/bug-indent.d new file mode 100644 index 00000000..321ab6f1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/bug-indent.d @@ -0,0 +1,34 @@ +class TemplatedClass(T) {} +class TemplatedClass2(T,U) {} + +class Axxxxxxxxxxxxxxxx { +alias A = int*; +void f(){ +} +} + +class C +{ + //--------------| <= (1) - non first col comment -> indent +Axxxxxxxxxxxxxxxx.A createAssignment() +{ + return(null); +} +void func2(Axxxxxxxxxxxxxxxx[] container){ + foreach (v; container) { + v.f(); + } +} + + // | <= (2) +void func3(TemplatedClass!int aValue) +{ +} + +void func4(TemplatedClass2!(int, int) b){ +} +} + +int main(){ + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/casts.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/casts.d new file mode 100644 index 00000000..42d54916 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/casts.d @@ -0,0 +1,13 @@ +void 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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/const.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/const.d new file mode 100644 index 00000000..778957fd --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/const.d @@ -0,0 +1,9 @@ +// hello +A b() { + return null; +} + +const(C) d() { + return null; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/d_sp_paren.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/d_sp_paren.d new file mode 100644 index 00000000..2b28a7f1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/d_sp_paren.d @@ -0,0 +1,23 @@ +version(unittest) { +import foo; +} + +void main() { +scope(exit) { +foo(); +} + +scope(success) suckit(); + +scope f = new Foo(); +if(foo) +{ +} + +try { +throw(e); +} +catch(Exception e) { +} +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/delegate.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/delegate.d new file mode 100644 index 00000000..0115ae00 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/delegate.d @@ -0,0 +1,20 @@ +module 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 ); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/enum.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/enum.d new file mode 100644 index 00000000..804ef27c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/enum.d @@ -0,0 +1,6 @@ +/* sized enum like in C# */ +enum Metrics : int { +SM_CXSCREEN = 0, +SM_CYSCREEN, +SM_CXVSCROLL, +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/extern_.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/extern_.d new file mode 100644 index 00000000..a583b08e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/extern_.d @@ -0,0 +1,6 @@ +extern(D): void func(); + +void x() +{ + int xx; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/funcfunc.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/funcfunc.d new file mode 100644 index 00000000..ee717abc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/funcfunc.d @@ -0,0 +1,5 @@ +int main() +{ + mWriter( "class Clst_"c )( cluster.getChild( HO_SHORT_NAME ).getText() )( " : Cluster {"c ).newline; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/imports.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/imports.d new file mode 100644 index 00000000..758fefb7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/imports.d @@ -0,0 +1,8 @@ + +private import mango.cache.Payload; + +private import mango.io.Exception, + mango.io.PickleRegistry; + +public import mango.cluster.model.ICluster; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/invariant.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/invariant.d new file mode 100644 index 00000000..46a8efdc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/invariant.d @@ -0,0 +1 @@ +invariant (C) c; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/numbers.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/numbers.d new file mode 100644 index 00000000..e51bf8ac --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/numbers.d @@ -0,0 +1,45 @@ + +/* 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]); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/sort_import.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/sort_import.d new file mode 100644 index 00000000..d929f8e8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/sort_import.d @@ -0,0 +1,19 @@ +// 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(); + + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/square_indent_tab.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/square_indent_tab.d new file mode 100644 index 00000000..1dee3a17 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/square_indent_tab.d @@ -0,0 +1,24 @@ +auto getOperatorsMap() { + return [ + "/" : TokenType.Slash, + "/=" : TokenType.SlashAssign, + "." : TokenType.Dot, + ".." : TokenType.DoubleDot, + "..." : TokenType.TripleDot, + "&" : TokenType.Ampersand, + "&=" : TokenType.AmpersandAssign, + "&&" : TokenType.DoubleAmpersand, + "|" : TokenType.Pipe, + "|=" : TokenType.PipeAssign, + "||" : TokenType.DoublePipe, + "-" : TokenType.Minus, + "-=" : TokenType.MinusAssign, + "--" : TokenType.DoubleMinus, + "+" : TokenType.Plus, + "+=" : TokenType.PlusAssign, + "++" : TokenType.DoublePlus, + "<" : TokenType.Less, + "<=" : TokenType.LessAssign, + "<<" : TokenType.DoubleLess + ]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/static_if.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/static_if.d new file mode 100644 index 00000000..24e6eaba --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/static_if.d @@ -0,0 +1,14 @@ +ClLinearExpression opBinary(string op) (double constant) + { + static if (op == "+") + return new ClLinearExpression(this, 1, constant); + else + static if (op == "-") + return new ClLinearExpression(this, 1, -constant); + else + static if (op == "*") + return new ClLinearExpression(this, constant, 0); + else + static if (op == "/") + return new ClLinearExpression(this, 1.0 / constant, 0); + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/static_if_in_struct.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/static_if_in_struct.d new file mode 100644 index 00000000..be936335 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/static_if_in_struct.d @@ -0,0 +1,5 @@ +struct Widget {
+ static if (true)
+ void fun() {
+ }
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/strings.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/strings.d new file mode 100644 index 00000000..a62adec3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/strings.d @@ -0,0 +1,32 @@ + +/* 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"; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template.d new file mode 100644 index 00000000..ba03e617 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template.d @@ -0,0 +1,28 @@ + +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; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_spacing000.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_spacing000.d new file mode 100644 index 00000000..627ca266 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_spacing000.d @@ -0,0 +1,12 @@ +void fun() {
+ if (something(a1, a2))
+ return;
+ if (something!a1)
+ return;
+ if (something!(a1, a2) )
+ return;
+ if (something!(a1, a2).Ptr)
+ return;
+ if (something!a1.Ptr)
+ return;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_spacing001.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_spacing001.d new file mode 100644 index 00000000..745e5b36 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_spacing001.d @@ -0,0 +1,9 @@ +void func0(TemplatedClass2!(int, int) b){
+}
+
+void func1(TemplatedClass2!(int, int)b){
+}
+
+
+void func2(TemplatedClass!int b){
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_use.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_use.d new file mode 100644 index 00000000..94cdbf6b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/template_use.d @@ -0,0 +1,2 @@ +auto x = a!"23" + a!`23` + a!`2 +3` + a!23 + a!23.23; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst01.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst01.d new file mode 100644 index 00000000..3a3728f2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst01.d @@ -0,0 +1,23 @@ +package 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 +} +// diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst02.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst02.d new file mode 100644 index 00000000..0b428d60 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst02.d @@ -0,0 +1,30 @@ + 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); + } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst03.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst03.d new file mode 100644 index 00000000..611f12f9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/tst03.d @@ -0,0 +1,145 @@ +import 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]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/type_spacing000.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/type_spacing000.d new file mode 100644 index 00000000..e11e545b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/type_spacing000.d @@ -0,0 +1,2 @@ +alias jhash hash;
+alias Foo!(int, char) f;
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces000.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces000.d new file mode 100644 index 00000000..d2f1b642 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces000.d @@ -0,0 +1,12 @@ +struct A
+{
+ static if (true)
+ void f() { }
+}
+struct B
+{
+ static if(true)
+ int a;
+ else
+ int e;
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces001.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces001.d new file mode 100644 index 00000000..a59ab020 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces001.d @@ -0,0 +1,9 @@ +module x;
+static if (1)
+ void fun()
+ {
+ }
+static if (1)
+ void gun()
+ {
+ }
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces002.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces002.d new file mode 100644 index 00000000..5e45e999 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/vbraces002.d @@ -0,0 +1,19 @@ +int super_fun(bool a, bool b, bool c, bool d)
+{
+ int i = 6;
+ static if (true)
+ while (true)
+ if(b)
+ return 1;
+ else if (c)
+ while (true)
+ if(d)
+ return 2;
+ else
+ while (true)
+ if(a)
+ return 3;
+ while (d)
+ return 4;
+ return 1;
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-1.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-1.d new file mode 100644 index 00000000..c9f41d3f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-1.d @@ -0,0 +1,10 @@ +{ + while (a) + { + volatile if (b) + { + b--; + break; + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-2.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-2.d new file mode 100644 index 00000000..bc5a0de4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-2.d @@ -0,0 +1,8 @@ +{ + if (e) + volatile + { + a++; + } + return oldValue; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-3.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-3.d new file mode 100644 index 00000000..039f788a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile-3.d @@ -0,0 +1,7 @@ +{ + if (e) + { + if (!value) + volatile e.value = value; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile.d new file mode 100644 index 00000000..c42d1893 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/volatile.d @@ -0,0 +1,27 @@ +void 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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/wysiwyg_strings.d b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/wysiwyg_strings.d new file mode 100644 index 00000000..cfdec32a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/d/wysiwyg_strings.d @@ -0,0 +1,9 @@ +auto s = `\`; +auto t = `\a +b +`; + +auto u = r"\"; +auto v = r"\a +b +";
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/ecma/example-1.es b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/ecma/example-1.es new file mode 100644 index 00000000..0bc9b775 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/ecma/example-1.es @@ -0,0 +1,10 @@ +x = 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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1122.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1122.java new file mode 100644 index 00000000..5712f9ee --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1122.java @@ -0,0 +1,2 @@ +private void save() throws IOException { +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1124.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1124.java new file mode 100644 index 00000000..dcea4172 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1124.java @@ -0,0 +1,4 @@ +new URL(url) +. +openConnection(); +new URL(url).openConnection(); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1845.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1845.java new file mode 100644 index 00000000..cc7656ba --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_1845.java @@ -0,0 +1,7 @@ +public class Version implements Comparable<Version> { + + @Override + public int compareTo(@NonNull Version that) { + return 0; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_670.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_670.java new file mode 100644 index 00000000..52d64f1e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Issue_670.java @@ -0,0 +1,3 @@ +Class definition: +public class A_Really_Really_Long_Class_Name extends Another_Really_Long_Class_Name { +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Java8DoubleColon.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Java8DoubleColon.java new file mode 100644 index 00000000..ec594909 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/Java8DoubleColon.java @@ -0,0 +1,10 @@ +import java.util.Objects; +import java.util.function.Predicate; + +public class Java8DoubleColon { +public static void main(String[] args) { + Predicate<Object> p = Objects::nonNull; + System.out.println(false == p.test(null)); + System.out.println(true == p.test(p)); +} +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation1.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation1.java new file mode 100644 index 00000000..d7417542 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation1.java @@ -0,0 +1,24 @@ +package com.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE,ElementType.METHOD, + ElementType.CONSTRUCTOR,ElementType.ANNOTATION_TYPE, + ElementType.PACKAGE,ElementType.FIELD,ElementType.LOCAL_VARIABLE}) +@Inherited + +public @interface Unfinished { + public enum Priority { LOW, MEDIUM, HIGH } + String value(); + String[] changedBy() default ""; + String[] lastChangedBy() default ""; + Priority priority() default Priority.MEDIUM; + String createdBy() default "James Gosling"; + String lastChanged() default "08/07/2011"; +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation2.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation2.java new file mode 100644 index 00000000..596c2562 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation2.java @@ -0,0 +1 @@ +public class Foo {private Runnable bar=new Runnable(){@Override @SuppressWarnings("baz") public void run(){ quux();}};} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation3.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation3.java new file mode 100644 index 00000000..3d84c04c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/annotation3.java @@ -0,0 +1,10 @@ +public class LocalTests extends IosTest { + /** + * Check that app started up correctly. Then check that app continually runs for 5 seconds. + * Then wait up to 20 seconds for the splash screen disappear. + * @throws InterruptedException + */ + @Test(groups = {"testdroid", "local"}) + public void checkAppForCrash() throws InterruptedException { + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/assert.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/assert.java new file mode 100644 index 00000000..8076663b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/assert.java @@ -0,0 +1,9 @@ +public class JavaClass { + + public static void main(String[] args) { + /* assert EXPRESSION1 ; */ + assert ( a != null ) && ( b != null ); + /* assert EXPRESSION1 : EXPRESSION2 ; */ + assert ( a != null ) && ( b != null ) : "Message"; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/cast.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/cast.java new file mode 100644 index 00000000..8f2d983b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/cast.java @@ -0,0 +1,24 @@ +public class JavaClass { + private boolean isButtonHit(ImageView imageView, int x, int y) { + if (imageView != null) { + RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams)imageView.getLayoutParams(); + Rect buttonRect = new Rect((int) (layoutParams.leftMargin - buttonExtraMargin), + (int) (layoutParams.topMargin - buttonExtraMargin), + (int) (layoutParams.leftMargin + imageView.getWidth() + buttonExtraMargin), + (int) (layoutParams.topMargin + imageView.getHeight() + buttonExtraMargin)); + + if (buttonRect.contains(x, y)) { + return true; + } + } + + Map< ? , ? > map = (Map< ? , ? >)object; + + return false; + } + + @SuppressWarnings("unchecked") + public static List<Object> fromJSON(JSONArray obj) { + return (List<Object>)fromJSON((Object) obj); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/double_brace.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/double_brace.java new file mode 100644 index 00000000..8ba15c47 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/double_brace.java @@ -0,0 +1,22 @@ +member.func(new List() {{ + add("Text"); + add("Text", + "Hello"); +}}); + + +private static final Set<String> VALID_CODES = new HashSet<String>() +{{ + add("XZ13s"); + add("AB21/X"); + add("YYLEX"); + add("AR2D"); + }}; + +add(new JPanel(){{ + setLayout(...); + setBorder(...); + add(new JLabel(...)); + add(new JSpinner(...)); + }}); + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/foreach.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/foreach.java new file mode 100644 index 00000000..e475dc29 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/foreach.java @@ -0,0 +1,11 @@ + + +public class Foo { + + public static void main(String[] args) { + for (ProcessDefinition processDefinition : allOfTheDefinitions.getData()) { +doit(processDefinition); + } + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics.java new file mode 100644 index 00000000..729013ce --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics.java @@ -0,0 +1,30 @@ +// Note: Some tests running on this _input_ file rely upon that the tripple +// closing '>' are not separated by spaces or anything else! +public class TestClass { +private static void initMap(void) { + HashMap < String, HashMap < String, List < Track >>> resolutionTracks = new HashMap < String, HashMap < String, List < Track >>> (); +} + +private static void addTrackToMap(String resolution, Track track, HashMap < String, HashMap < String, List < Track >>> resolutionTracks) { + HashMap<String, List<Track> > tracks = null; + + if (resolutionTracks.containsKey(resolution)) { + tracks = resolutionTracks.get(resolution); + } else { + tracks = new HashMap<String, List<Track> >(); + tracks.put("soun", new LinkedList<Track>()); + tracks.put("vide", new LinkedList<Track>()); + resolutionTracks.put(resolution, tracks); + } + + if (track.getHandler() != null) { + if (track.getHandler().equals("soun")) { + List<Track> audioTracks = tracks.get("soun"); + audioTracks.add(track); + } else if (track.getHandler().equals("vide")) { + List<Track> videoTracks = tracks.get("vide"); + videoTracks.add(track); + } + } +} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics_return_type.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics_return_type.java new file mode 100644 index 00000000..818ac721 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics_return_type.java @@ -0,0 +1,8 @@ +public class TestClass { + public static < T > void executeRequest(final HttpUriRequest request, final ITestClassAPIResponseListener<T> responseListener) { + } + + public <T extends YourType> T mymethod(T type) { + return type; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics_wildcard.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics_wildcard.java new file mode 100644 index 00000000..358e333b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/generics_wildcard.java @@ -0,0 +1,25 @@ +public class TestClass { + private Map< ? , ? > map1 = null; + private Map< ? , ? > map2 = null; + private Map< ? , ? > map3 = null; + + public static HttpUriRequest getHttpUriRequest(TestClassAPIRequestMethod method, String apiPath) { + switch (method) { + case BOTTOM_LEFT: + break; + case GET: + req = new HttpGet(url); + break; + case POST: + req = new HttpPost(url); + break; + case PUT: + req = new HttpPut(url); + break; + case DELETE: + req = new HttpDelete(url); + break; + } + return req; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/i1121.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/i1121.java new file mode 100644 index 00000000..18567ec3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/i1121.java @@ -0,0 +1,7 @@ +public class Test { +public static void main() { + btn.addActionListener(e->{ + System.exit(0); + }); +} +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/issue_672.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/issue_672.java new file mode 100644 index 00000000..2f632625 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/issue_672.java @@ -0,0 +1,2 @@ +public abstract class KeyValueItemWriter<K, V> implements ItemWriter<V>, InitializingBean {} +//3456789=123456789=12 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/leading-tabs-for-java-lambda.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/leading-tabs-for-java-lambda.java new file mode 100644 index 00000000..19b6df0f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/leading-tabs-for-java-lambda.java @@ -0,0 +1,29 @@ +class MyClass { + void foo(List<Integer> arr) { + arr.forEach(n -> { + // Okay: This line will be indented with only tabs. + if (cond1) { // Okay + // BAD1: This line will be indented with tabs up to lambda brace level, then spaces for the rest. + if (cond2) // BAD2 + // Okay + bar(); // Okay + if (cond3) // BAD3 + { // BAD4 + // BAD5 + bar(); // BAD6 + } // Okay + } // Okay + if (cond4) { // Okay + /* + BAD7: C-style comments will also be affected on all lines. + */ + } // Okay + if (cond5) // Okay + { // Okay + bar(); // BAD8 + } // Okay + if (cond6) // Okay + bar; // Okay + }); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/long_cl_cmt.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/long_cl_cmt.java new file mode 100644 index 00000000..45e5252b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/long_cl_cmt.java @@ -0,0 +1,5 @@ +public class Cls +{ +public void f(); +} +// no class end semicolon
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sf567.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sf567.java new file mode 100644 index 00000000..68a63221 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sf567.java @@ -0,0 +1,14 @@ +package com.temp.test; + +public class Database +{ + private Database(String fileName) + { + readConfig(fileName, "asdfasdf", 1); + readConfig(ame, "aasdf", 1); + + Database.readConfig(fileName, "asdfasdf", 1); + Database.readConfig(ame, "aasdf", 1); + } + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_after_angle.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_after_angle.java new file mode 100644 index 00000000..1e11c4c9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_after_angle.java @@ -0,0 +1,4 @@ +public class TestClassPrefetchData implements ITestClassAPIInputStreamResponseListener{ + private class TestClassPrefetchDataWrite extends AsyncTask<Void, Void, Void>{ + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_after_for_colon.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_after_for_colon.java new file mode 100644 index 00000000..fecd1833 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_after_for_colon.java @@ -0,0 +1 @@ +for (Type var : expr) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_before_byref.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_before_byref.java new file mode 100644 index 00000000..7927ee89 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_before_byref.java @@ -0,0 +1,5 @@ +public static void method() { + if (argA != null && argB != null) { + } + return (argA != null && argB != null); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_this_paren.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_this_paren.java new file mode 100644 index 00000000..628b327f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/sp_this_paren.java @@ -0,0 +1,9 @@ +public class JavaClass { + public JavaClass() { + this(1); + } + + public JavaClass(int i) { + super(i); + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/synchronized.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/synchronized.java new file mode 100644 index 00000000..369394b8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/synchronized.java @@ -0,0 +1,6 @@ +public class A{ + private synchronized static void g(){int x=1;} + synchronized A f(){return null;} + public void foo(){ + g(); synchronized(this){g();}g();synchronized(this){synchronized(this){synchronized(this){g();}}g();}synchronized(this){g();}} +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/try.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/try.java new file mode 100644 index 00000000..aea6a7f3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/try.java @@ -0,0 +1,6 @@ +public static void main(String[] args) { + try (File file = new File("filename.txt")) + { + doit(processDefinition); + } + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/variable_aligns.java b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/variable_aligns.java new file mode 100644 index 00000000..76c6131c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/java/variable_aligns.java @@ -0,0 +1,35 @@ +class Aligns { +final int SZF = 4; +final int SZ2F = 4; +final int aBarF; +final int someIntsF[]; +final int someIntsSzdF[4]; +final int[] someMoreIntsF; +final int lotsOfIntsF[][][][][][]; +final int[][][][] lotsMoreIntsF; +final Tem<Plate> edVarF; +final int aBarSetF=null; +final int someIntsSetF[]=null; +final int someIntsSzdSetF[4]=null; +final int[] someMoreIntsSetF=null; +final int lotsOfIntsSetF[][][][][][]=null; +final int[][][][] lotsMoreIntsSetF=null; +final Tem<Plate> edVarF=null; +int SZ = 4; +int SZ2 = 4; +int aBar; +int someInts[]; +int someIntsSzd[4]; +int spacer; +int[] someMoreInts; +int lotsOfInts[][][][][][]; +int[][][][] lotsMoreInts; +Tem<Plate> edVar; +int aBarSet=null; +int someIntsSet[]=null; +int someIntsSzdSet[4]=null; +int[] someMoreIntsSet=null; +int lotsOfIntsSet[][][][][][]=null; +int[][][][] lotsMoreIntsSet=null; +Tem<Plate> edVar=null; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/1927.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/1927.m new file mode 100644 index 00000000..9f8d7a7b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/1927.m @@ -0,0 +1,17 @@ +- (void) foo:(NSString*) inString +{ + @try { + }@catch(NSException* const inException) + { + } +} + +- (void) bar:(NSString*) inString +{ + @try { + } + @catch (NSException* const inException){ + } + @finally { + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Declarations.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Declarations.h new file mode 100644 index 00000000..e1ad3c6b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Declarations.h @@ -0,0 +1,22 @@ + +@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 <TestProtocol> { +} +-(void)aMessage:(id)arg; +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Fraction.h b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Fraction.h new file mode 100644 index 00000000..364b1de8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Fraction.h @@ -0,0 +1,14 @@ +#import <Foundation/NSObject.h> + +@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 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Fraction.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Fraction.m new file mode 100644 index 00000000..20994f34 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Fraction.m @@ -0,0 +1,24 @@ +#import "Fraction.h" +#import <stdio.h> + +@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 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_2172.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_2172.m new file mode 100644 index 00000000..02584e91 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_2172.m @@ -0,0 +1,10 @@ +if (YES) { + NSString *sqlStr = [NSString stringWithFormat:@"INSERT INTO %@ (%@ , %@) VALUES + ('%@','%@')" + , ContactsRemark_Table + , ContactsRemark_FollowId + , ContactsRemark_MarkName +, followId + , markName + ]; + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_2289.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_2289.m new file mode 100644 index 00000000..c046cb1e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_2289.m @@ -0,0 +1,5 @@ ++ (void)foo:(bar)block { + for (int i = 0; i < 5; i++) @autoreleasepool { + // stuff + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_681.oc b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_681.oc new file mode 100644 index 00000000..fb4c6685 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/Issue_681.oc @@ -0,0 +1,15 @@ +int q; +@interface MyClass () +@property (nonatomic, weak) UIView someView; +@property (nonatomic, weak) UIView anotherView; +@end +@implementation MyClass +- (void)someKindOfFunction +{ +some code; +} +- (void)anotherOfFunction +{ +some code; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/align-objc-like-xcode.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/align-objc-like-xcode.m new file mode 100644 index 00000000..6852ac12 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/align-objc-like-xcode.m @@ -0,0 +1,8 @@ +- (void)foo { +[self dismissWithReason:DismissReason::Auto animated:TRUE]; +[self dismissWithReason:DismissReason::Auto +animated:TRUE]; +[self +dismissWithReason:DismissReason::Auto +animated:TRUE]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/attribute_specifier_seqs.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/attribute_specifier_seqs.mm new file mode 100644 index 00000000..c9b6f24d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/attribute_specifier_seqs.mm @@ -0,0 +1,19 @@ +int w1[1]; +int w2 [[maybe_unused]] = 0; +int w3 [[foo(w1[0])]]; // unknown attribute foo +int w4 [[foo((w1[0]))]]; // unknown attribute foo +int w5 [[foo(w1[0] [[maybe_unused]])]]; // unknown attribute foo +int w6 [[foo(w1[0] [[maybe_unused]]), [[deprecated]]]]; // expected ] before [[deprecated +int w7 [[w1[0]]] = 0; // expected ] before [ in w1[ +int w8 [[ [[maybe_unused]] ]]; // expected ] before [[maybe_unused +int w9 [ [ foo ] ] = 0; + +@implementation Foo +- (void) message { +Foo* foo = [[Foo alloc] init]; +} +@end + +Foo* foo = [[Foo alloc] init]; + +[[Foo sharedInstance] broadcast:[world hello]]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/available.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/available.m new file mode 100644 index 00000000..8216d17f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/available.m @@ -0,0 +1,12 @@ +-(void) test{ + if (@available(macOS 10.12.2, *)) { + self.automaticTextCompletionEnabled = YES; + self.allowsCharacterPickerTouchBarItem = NO; + } + + if (@available( macOS 10.12,*)) { + self.automaticTextCompletionEnabled = YES; + self.allowsCharacterPickerTouchBarItem = NO; + } + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/block_in_method.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/block_in_method.m new file mode 100644 index 00000000..e0dfcd76 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/block_in_method.m @@ -0,0 +1,66 @@ + +void Events1(NSString * identifier, void (^handler)()); + +void Events2(NSString * identifier, void (^)()); + +@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; +} + +- (void)each:(void (^)(id object))block { + [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + block(obj); + }]; +} + +// 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 + +nestedMethodCall(methodCall( ^ BOOL * (id item) { + NSLog(@"methodCall") +})); + +nestedMethodCall( + arg1, + methodCall( ^ NSString * (id item) { + NSLog(@"methodCall") + })); + +nestedMethodCall( + arg1, + methodCall( ^ { + NSLog(@"methodCall") + }, + arg2) +); + +nestedMethodCall( + methodCall( ^ { + NSLog(@"methodCall") + }) +); + +// 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 optional diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/block_literal_protocol.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/block_literal_protocol.m new file mode 100644 index 00000000..02d1cfca --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/block_literal_protocol.m @@ -0,0 +1,19 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void)drawSomething:(id<MTLCommandBuffer>)commandBuffer { + [renderPass performDrawBlock:^(id<MTLRenderCommandEncoder> renderCommandEncoder) { + screenBlitObject.texture = src; + + // Make sure the pipeline state pixelformat is the same as destination pixel format + [screenBlitObject updatePipelineState:dst.pixelFormat]; + + [screenBlitObject drawWithRenderCommandEncoder:renderCommandEncoder]; + } withTargetTexture:dst andCommandBuffer:commandBuffer]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks.m new file mode 100644 index 00000000..617e0b78 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks.m @@ -0,0 +1,15 @@ +int* ( ^ 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;
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks_align.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks_align.m new file mode 100644 index 00000000..2ddf75c6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks_align.m @@ -0,0 +1,14 @@ +[[HRNewsService sharedInstance] unregisterPushToken:data + success:^{ + self.notificationsEnabled = NO; + if (data.param) { + self.loudNotifications = YES; + } + } + fail:^{ + self.notificationsEnabled = NO; + if (data.param) { + self.loudNotifications = YES; + } + } +]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks_align2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks_align2.m new file mode 100644 index 00000000..f4e875c9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/blocks_align2.m @@ -0,0 +1,89 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void) method1 { + [session mergeCommonMovieItems:^(NSURL *exportURL, NSError *exportError) { + NSDictionary *settings = [self getSettings]; + + [session postSessionWithCallback:^(NSError *error, id d) { + if (error == nil) { + [session uploadSessionWithCallback:^(NSError *error, id d) { + NSLog(@"OK"); + }]; + } else { + NSLog(@"Something went wrong: %@", error); + return; + } + }]; + }]; +} + +- (void)postSelection:(NSString *)testName + selection:(NSString *)selection { + dispatch_async(dispatch_get_main_queue(), ^{ + [self warmup:^{ + [self setReady]; + }]; + }); + + dispatch_after(retryTime, dispatch_get_main_queue(), ^(void) { + [self postSelection:testName selection:selection]; + }); + + [TestClassRequest performMethod:TestClassRequestMethodPOST + responseHandler:^(NSURLResponse *response) { + dispatch_after(retryTime, dispatch_get_main_queue(), ^(void) { + [self postSelection:testName selection:selection]; + }); + }]; + + [UIView transitionWithView:self.view.window duration:0.75 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{ + [self presentViewController:viewController animated:NO completion:nil]; + } complete:^{}]; +} + +- (void)closeEditor { + dispatch_async(dispatch_get_main_queue(), ^{ + if ([[TestClass sharedInstance] TestClassController] != nil && [[[TestClass sharedInstance] TestClassController] isKindOfClass:[TestClassSocialViewController class]]) { + [[TestClass sharedInstance].TestClassTransitionController transitionToViewController:[[TestClass sharedInstance] TestClassController] withCompletitionHandler:^{ + [[TestClass sharedInstance] setTestClassVideoPlayerViewController:nil]; + }]; + } else if ([[TestClass sharedInstance] TestClassController] != nil && [[[TestClass sharedInstance] TestClassController] isKindOfClass:[TestClassModalViewController class]]) { + [[TestClass sharedInstance].TestClassTransitionController transitionToViewController:nil withCompletitionHandler:^{ + [[TestClass sharedInstance] setTestClassVideoPlayerViewController:nil]; + }]; + } else { + [[TestClass sharedInstance] hideTestClass]; + } + }); +} + +- (void)testMethodWrapper { + SEL testMethodForSelectorSel = @selector(testMethod:); + __block void *testMethodForSelectorBlock = TestFunction(encoderTest, testMethodForSelectorSel, ^id (__typeof (encoderTest) self, SEL aSelector) { + NSLog(@"OK"); + }); +} + +- (void) method2 { + [TestClassRequest performMethod:TestClassRequestMethodPOST + responseHandler:^(NSURLResponse *response, NSData *responseData, NSError *error) { + [self checkPermissions:connection withCallback:^(NSError *error, id data) { + [self bar]; + }]; + }]; +} + +- (void) method3 { + [TestClassRequest performMethod:TestClassRequestMethodPOST responseHandler:^(NSURLResponse *response, NSData *responseData, NSError *error) { + [self checkPermissions:connection withCallback:^(NSError *error, id data) { + [self bar]; + }]; + }]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/box.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/box.m new file mode 100644 index 00000000..98a3516a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/box.m @@ -0,0 +1,12 @@ +NSArray *test = @[]; +NSNumber *test = @ (42 * 2); +NSNumber *test = @4.0; +NSDictionary *test = @{@"foo":@"bar"}; + +@implementation UrlTemplateTest +- (void)test { + NSString *test = @""; + NSString *string = [[NSMutableString alloc] initWithString:@""]; + STAssertEqualObjects(string, @"", nil); +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/boxed_receiver.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/boxed_receiver.m new file mode 100644 index 00000000..3460b920 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/boxed_receiver.m @@ -0,0 +1,37 @@ +#import <Foundation/Foundation.h> + +@implementation TestClass + +- (NSDictionary *)constructUploadHeaders { + NSDictionary *headers; + + headers = @{ + @"Content-Length":[@(contentLength)stringValue], + @"Content-Length2": [contentLength stringValue], + @"Content-Disposition": [NSString stringWithFormat:@"name=\"%@\"; filename=\"%@\"", @"asset_data", identifier], + @"Content-Type": @"application/octet-stream", + @"ETag": uploadEtag + }; + + return headers; +} + +- (BOOL)isStrimmed { + if ([(TestClassVideoEditorView *) (self.parentComponentsView.superview)isTrimmed]) { + return YES; + } + if ([((TestClassVideoEditorView *) self.parentComponentsView.superview)isTrimmed]) { + return YES; + } + return NO; +} + +- (void)session { + TestCaseSessionInstance *session = ((TestClassVideoEditorView *) self.parentComponentsView.superview).session; + + [(TestClassVideoEditorView *) ( self.parentComponentsView.superview) closeEditor]; + + [menubutton.badge setBadgeText:[@(count + 1) stringValue]]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1366.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1366.m new file mode 100644 index 00000000..5e81ed4a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1366.m @@ -0,0 +1,14 @@ +@implementation UCTestClass + +- (void) test{ + + switch (test) { + case "longlonglonglong":{ + i = 1; + } + break; + } +} + +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_167.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_167.m new file mode 100644 index 00000000..e404e2aa --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_167.m @@ -0,0 +1,7 @@ +- (void)dealloc { + [self closeFile]; + + [self setData:nil]; + + [super dealloc]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1674.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1674.m new file mode 100644 index 00000000..82c20161 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1674.m @@ -0,0 +1,4 @@ +- (void) test{ +[test handleOpenURL:url + sourceApplication:sourceApplication] +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1683.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1683.m new file mode 100644 index 00000000..3ee562c0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_1683.m @@ -0,0 +1 @@ +[mutString addAttributes:@{ NSParagraphStyleAttributeName : style } range:range]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_340.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_340.m new file mode 100644 index 00000000..ea9f8201 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_340.m @@ -0,0 +1,13 @@ +#import <Cocoa/Cocoa.h> + +@implementation MyDocument +- (void) locationManager: (CLLocationManager*) manager didFailWithError:(NSError *)error { + + [UIAlertView showError: error + withTitle: NSLocalizedString(@"Your location cannot be determined", + @"The location of the user cannot be guessed") + message: NSLocalizedString(@"You can try again by pressing the refresh button", + @"Recovery suggestion when the location cannot be found")]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_404.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_404.m new file mode 100644 index 00000000..3ecb87f0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_404.m @@ -0,0 +1,6 @@ +@interface Test1 : Test2 +@end + + +@interface Test<T1: id<T3>> : Test2<P1> +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_497.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_497.m new file mode 100644 index 00000000..a976d43d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_497.m @@ -0,0 +1,13 @@ +NSArray *array = @[@1, + @2, + @3, + @4]; + +NSArray *array = @{ @1: @1, + @2: @2, + @3: @3, + @4: @4 }; + +int i = 1 ++ 1 ++ 2; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_841.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_841.m new file mode 100644 index 00000000..dea826d2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_841.m @@ -0,0 +1,4 @@ +- (void)myMethod { + NSInteger rowCount = [sectionProvider collectionView:self.collectionView + numberOfRowsInSection:section]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_125-412.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_125-412.m new file mode 100644 index 00000000..c92d2e66 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_125-412.m @@ -0,0 +1,7 @@ +[[NSFileManager defaultManager] createFileAtPath:path contents:data attributes:nil] + +[self.myProperty setObject:obj forKey:key]; + +NSString *newValue = [@"my string" stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceCharacterSet]; + +NSString *newValue = [myStrings[0] stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceCharacterSet]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_408.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_408.m new file mode 100644 index 00000000..c8a3a450 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_408.m @@ -0,0 +1 @@ + CGFloat fontSize = floorf([font pointSize] * [self tileContentScale] + 0.5); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_477.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_477.m new file mode 100644 index 00000000..a1a81749 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/bug_i_477.m @@ -0,0 +1,3 @@ + [dataArray enumerateObjectsUsingBlock:^(dataType *data, NSUInteger idx, BOOL *stop) { + // Do stuff! + }]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/c-cpp-oc-wrapper.c b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/c-cpp-oc-wrapper.c new file mode 100644 index 00000000..663a4cc8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/c-cpp-oc-wrapper.c @@ -0,0 +1,300 @@ +// C/C++/Obj-C/Obj-C++ wrapper that exports C functions +// +// As an example, distributed with .c suffix, +// but depending on extension needs, can be +// compiled as C, C++, Obj-C or Obj-C++ + +#include <stdio.h> +#include <unistd.h> +#include "TestClassNativeHelper.h" + +#undef NDEBUG + +#if defined(__ANDROID__) + +#define TCH_LOGI(...) __android_log_print(ANDROID_LOG_INFO, "TestClassNativeHelper", __VA_ARGS__) +#define TCH_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "TestClassNativeHelper", __VA_ARGS__) + +#ifndef NDEBUG +#define TCH_LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, "TestClassNativeHelper", __VA_ARGS__) +#else +#define TCH_LOGV(...) +#endif + +#define TCH_ELOG TCH_LOGV("%s", __FUNCTION__) + +void TCH_onTestClassUploadDidProgress(C_JNIEnv *env, jobject thiz, jint videoId, jdouble progress) { + TCH_ELOG; +} + +#ifndef TCH_NELEM +#define TCH_NELEM(x) ((int)(sizeof(x) / sizeof((x)[0]))) +#endif + +static const char *kTCHTestClassClass = "com/testclass/TestClass/TestClass"; +static const char *kTCHTestClassLoader = "com.testclass.TestClass.TestClass"; + +static const char *kTCHTestClassNativeListenerClass = "com/testclass/TestClass/communication/TestClassNativeListener"; +static const char *kTCHTestClassNativeListenerLoader = "com.testclass.TestClass.communication.TestClassNativeListener"; + +static JavaVM *TCH_vm = NULL; + +static JNINativeMethod TCH_listenerMethods[] = { + { "onTestClassUploadDidProgress", "(ID)V", (void *)TCH_onTestClassUploadDidProgress }, +}; + +static C_JNIEnv *TCH_getEnv() { + C_JNIEnv *ret = NULL; + + if (TCH_vm == NULL) { + TCH_LOGE("TCH_getEnv failed, no JVM"); + return NULL; + } + +#if defined(__cplusplus) + JNIEnv *env = NULL; + + if (TCH_vm->GetEnv((void **)&env, JNI_VERSION_1_6) != JNI_OK) { + JavaVMAttachArgs args; + args.version = JNI_VERSION_1_6; + args.name = NULL; + args.group = NULL; + + int attachStatus; + if ((attachStatus = TCH_vm->AttachCurrentThread(&env, &args)) < 0) { + TCH_LOGE("TCH_getEnv failed"); + } + } + ret = (C_JNIEnv *)env; +#else + JNIEnv *env = NULL; + + if ((*TCH_vm)->GetEnv(TCH_vm, (void **)&env, JNI_VERSION_1_6) != JNI_OK) { + JavaVMAttachArgs args; + args.version = JNI_VERSION_1_6; + args.name = NULL; + args.group = NULL; + + int attachStatus; + if ((attachStatus = (*TCH_vm)->AttachCurrentThread(TCH_vm, &env, &args)) < 0) { + TCH_LOGE("TCH_getEnv failed"); + } + } + ret = env; +#endif /* if defined(__cplusplus) */ + return ret; +} + +static jclass TCH_loadClass(C_JNIEnv *env, jobject activity, const char *className) { + jclass cls_Activity = (*env)->GetObjectClass((JNIEnv *)env, activity); + jmethodID mid_getClassLoader = (*env)->GetMethodID((JNIEnv *)env, cls_Activity, "getClassLoader", "()Ljava/lang/ClassLoader;"); + jobject obj_classLoader = (*env)->CallObjectMethod((JNIEnv *)env, activity, mid_getClassLoader); + + jclass cls_classLoader = (*env)->GetObjectClass((JNIEnv *)env, obj_classLoader); + jmethodID mid_loadClass = (*env)->GetMethodID((JNIEnv *)env, cls_classLoader, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;"); + + jstring _className = (*env)->NewStringUTF((JNIEnv *)env, className); + jclass cls = (jclass)(*env)->CallObjectMethod((JNIEnv *)env, obj_classLoader, mid_loadClass, _className); + + (*env)->DeleteLocalRef((JNIEnv *)env, _className); + + if (!cls) { + TCH_LOGE("Couldn't find class %s", className); + } + + return cls; +} + +#define TCH_str2(x) # x +#define TCH_str(x) TCH_str2(x) + +#define TCH_CLASS(_class) tchClass_ ## _class + +#define TCH_LOCAL_CLASS(_class) local_tchClass_ ## _class + +#define TCH_REGISTER_CLASS(_class) \ + jclass TCH_CLASS(_class) = NULL; + +#define TCH_EXTERN_CLASS(_class) \ + jclass TCH_CLASS(_class); + +#define TCH_METHOD(_method) tchMethod_ ## _method + +#define TCH_REGISTER_METHOD(_method) \ + jmethodID TCH_METHOD(_method) = NULL; + +#define TCH_EXTERN_METHOD(_method) \ + jmethodID TCH_METHOD(_method); + +#define TCH_REGISTER_NATIVES(_env, _class, methods) \ + if ((*_env)->RegisterNatives((JNIEnv *)_env, TCH_CLASS(_class), methods, TCH_NELEM(methods)) < 0) { \ + TCH_LOGE("RegisterNatives failed for %s\n", TCH_str(_class)); \ + } + +#define TCH_FIND_CLASS(_env, _class, _className) \ + jclass TCH_LOCAL_CLASS(_class) = (*_env)->FindClass((JNIEnv *)_env, _className); \ + if (TCH_LOCAL_CLASS(_class) == NULL) { \ + TCH_LOGE("Unable to find class %s\n", _className); \ + } else { \ + TCH_CLASS(_class) = (jclass)(*_env)->NewGlobalRef((JNIEnv *)_env, TCH_LOCAL_CLASS(_class)); \ + } + +#define TCH_FIND_STATIC_METHOD(_env, _class, _method, _prototype) \ + TCH_METHOD(_method) = (*_env)->GetStaticMethodID((JNIEnv *)_env, TCH_CLASS(_class), TCH_str(_method), _prototype); \ + if (TCH_METHOD(_method) == NULL) { \ + TCH_LOGE("Unable to find method %s", TCH_str(_method)); \ + } + +#define TCH_FIND_STATIC_METHOD2(_env, _class, _method, _symbol, _prototype) \ + TCH_METHOD(_method) = (*_env)->GetStaticMethodID((JNIEnv *)_env, TCH_CLASS(_class), TCH_str(_symbol), _prototype); \ + if (TCH_METHOD(_method) == NULL) { \ + TCH_LOGE("Unable to find method %s", TCH_str(_method)); \ + } + +#define TCH_CALL_STATIC_METHOD_ARGS(_env, _class, _method, ...) \ + (*_env)->CallStaticVoidMethod((JNIEnv *)_env, TCH_CLASS(_class), TCH_METHOD(_method), __VA_ARGS__); + +#define TCH_CALL_STATIC_METHOD_BOOL(_env, _class, _method) \ + (*_env)->CallStaticBooleanMethod((JNIEnv *)_env, TCH_CLASS(_class), TCH_METHOD(_method)); + +TCH_REGISTER_CLASS(testclassClass); +TCH_REGISTER_METHOD(testclassConstructor); +static jobject TCH_testclassInstance = NULL; + +TCH_REGISTER_CLASS(testclassNativeListenerClass); +TCH_REGISTER_METHOD(testclassNativeListenerConstructor); +static jobject TCH_testclassNativeListenerInstance = NULL; + +TCH_REGISTER_METHOD(isSupported); +TCH_REGISTER_METHOD(initTestClass); + +static void TCH_preload(C_JNIEnv *env) { + TCH_ELOG; + + if (TCH_CLASS(testclassClass) == NULL) { + TCH_FIND_CLASS(env, testclassClass, kTCHTestClassClass); + } + + // Class really not found or not loaded, bail + if (TCH_CLASS(testclassClass) == NULL) { + return; + } + + if (TCH_CLASS(testclassClass) != NULL && TCH_METHOD(isSupported) == NULL) { + TCH_FIND_STATIC_METHOD(env, testclassClass, isSupported, "()Z"); + TCH_FIND_STATIC_METHOD(env, testclassClass, initTestClass, "(Lcom/testclass/TestClass/ITestClassListener;Landroid/app/Activity;)Z"); + + if (TCH_CLASS(testclassClass) != NULL) { + TCH_METHOD(testclassConstructor) = (*env)->GetMethodID((JNIEnv *)env, TCH_CLASS(testclassClass), "<init>", "()V"); + jobject constructor = (*env)->NewObject((JNIEnv *)env, TCH_CLASS(testclassClass), TCH_METHOD(testclassConstructor)); + TCH_testclassInstance = (*env)->NewGlobalRef((JNIEnv *)env, constructor); + } + + if (TCH_CLASS(testclassNativeListenerClass) == NULL) { + TCH_FIND_CLASS(env, testclassNativeListenerClass, kTCHTestClassNativeListenerClass); + } + + if (TCH_CLASS(testclassNativeListenerClass) != NULL) { + TCH_METHOD(testclassNativeListenerConstructor) = (*env)->GetMethodID((JNIEnv *)env, TCH_CLASS(testclassNativeListenerClass), "<init>", "()V"); + jobject listener = (*env)->NewObject((JNIEnv *)env, TCH_CLASS(testclassNativeListenerClass), TCH_METHOD(testclassNativeListenerConstructor)); + TCH_testclassNativeListenerInstance = (*env)->NewGlobalRef((JNIEnv *)env, listener); + TCH_REGISTER_NATIVES(env, testclassNativeListenerClass, TCH_listenerMethods); + TCH_LOGV("Initializing built-in listener"); + } + } +} + +#elif defined(__APPLE__) + +#ifndef NDEBUG +#define TCH_LOGV(...) NSLog(__VA_ARGS__) +#else +#define TCH_LOGV(...) +#endif + +#define TCH_ELOG TCH_LOGV(@"%s", __FUNCTION__) + +#if defined(__cplusplus) +#define TCH_NS(_class) ::_class +#else +#define TCH_NS(_class) _class +#endif + +@interface TCH_delegateHandler : NSObject <TestClassDelegate> +@end + +@implementation TCH_delegateHandler +- (void)testclassUploadDidProgress:(NSNumber *)videoId progress:(NSNumber *)progress { + TCH_ELOG; +} + +@end + +static TCH_delegateHandler *TCH_builtInHandler = nil; + +#endif /* if defined(__ANDROID__) */ + +#if defined(__ANDROID__) + +void TCH_initTestClass(JNIEnv *env, jobject activity, jobject listener) { + TCH_ELOG; + + C_JNIEnv *cenv = NULL; +#if defined(__cplusplus) + cenv = (C_JNIEnv *)env; +#else + cenv = env; +#endif + + if (TCH_vm == NULL) { + int status = (*cenv)->GetJavaVM((JNIEnv *)cenv, &TCH_vm); + if (status != 0) { + TCH_LOGE("GetJavaVM failed"); + return; + } + } + + TCH_CLASS(testclassClass) = TCH_loadClass(cenv, activity, kTCHTestClassLoader); + TCH_CLASS(testclassNativeListenerClass) = TCH_loadClass(cenv, activity, kTCHTestClassNativeListenerLoader); + TCH_preload(cenv); + + jobject listenerRef = listener; + if (listenerRef == NULL) { + TCH_LOGV("Using built-in listener"); + listenerRef = TCH_testclassNativeListenerInstance; + } + + TCH_CALL_STATIC_METHOD_ARGS(cenv, testclassClass, initTestClass, listenerRef, activity); +} + +#elif defined(__APPLE__) + +void TCH_initTestClass(UIViewController *viewController, id <TestClassDelegate>testclassDelegate) { + TCH_ELOG; + + id <TestClassDelegate>testclassDelegateRef = testclassDelegate; + if (testclassDelegateRef == nil) { + TCH_builtInHandler = [[TCH_delegateHandler alloc] init]; + testclassDelegateRef = TCH_builtInHandler; + } + + [TCH_NS(TestClass) initWithDelegate : testclassDelegateRef andParentViewController : viewController]; +} + +#endif /* if defined(__ANDROID__) */ + +bool TCH_isSupported(void) { + TCH_ELOG; + bool ret = false; + +#if defined(__ANDROID__) + C_JNIEnv *env = TCH_getEnv(); + if (env && TCH_CLASS(testclassClass)) { + ret = (bool)TCH_CALL_STATIC_METHOD_BOOL(env, testclassClass, isSupported); + } +#elif defined(__APPLE__) + ret = (bool) [TCH_NS(TestClass) isSupported]; +#endif + + return ret; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cast.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cast.m new file mode 100644 index 00000000..daa9cb6d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cast.m @@ -0,0 +1,13 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void) foo +{ + previewViewController.previewControllerDelegate = (id<TestClassDelegate>)[TestClass sharedInstance]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type1.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type1.m new file mode 100644 index 00000000..fb9bb4e1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type1.m @@ -0,0 +1,23 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void)uploadWithClientData:(NSMutableDictionary *)data withCallback:(TestClassCallback)callback { + TestClassSessionInstance *session = [[TestClassSession sharedInstance] currentOrLastSession]; + + if (session == nil || data == nil) { + if (callback != nil) + return callback(nil, nil); + return; + } + [session mergeCommonMovieItems:^(NSURL *exportURL, NSError *exportError) { + if (exportError != nil) + return callback(exportError, nil); + NSDictionary *settings = [self getSettings]; + }]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type2.m new file mode 100644 index 00000000..27e31cdc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type2.m @@ -0,0 +1,32 @@ +#import <Foundation/Foundation.h> + +#define TESTCLASS_SINGLETON_FOR_CLASS(classname, accessorname) \ + static classname *shared##classname = nil; + +#define PUSH_CONTEXT(contextArg) \ + EAGLContext *oldContext = [EAGLContext currentContext]; \ + if (oldContext != contextArg) { \ + [EAGLContext setCurrentContext:contextArg]; \ + } + +#define POP_CONTEXT(contextArg) \ + if (oldContext != contextArg) { \ + [EAGLContext setCurrentContext:oldContext]; \ + } + +#define CURRENT_CONTEXT \ + NSOpenGLContext *currentContext = [NSOpenGLContext currentContext]; + +@interface TestClass : NSObject +@end + +@implementation TestClass + +TESTCLASS_SINGLETON_FOR_CLASS(TestClass, sharedInstance); + +- (void) drawSomething { + PUSH_CONTEXT(_context); + POP_CONTEXT(_context); +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type3.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type3.m new file mode 100644 index 00000000..8d8676c8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type3.m @@ -0,0 +1,11 @@ +#import <Foundation/Foundation.h> + +#define MACRO(foo) \ + if (_##foo == NULL) { \ + Log("do %s", str(foo)); \ + _##foo = (foo##_t *)process(PR_FLAG, str(foo)); \ + } + +#define OVERLOAD(base, foo) \ + foo##_override_t * foo##_bar = (foo##_override_t *)process(base##_bar, str(foo)); \ + _##foo##_override = (foo##_override_t *)process(base##_cache, str(foo)); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type4.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type4.m new file mode 100644 index 00000000..dd4d55fe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/chunk_ends_type4.m @@ -0,0 +1,48 @@ +#import <Foundation/Foundation.h> + +@interface TestClass : NSObject +@end + +@implementation TestClass + +- (void)session_thumbnail_url:(NSDictionary *)data { + [session mergeCommonMovieItems:^(NSURL *exportURL, NSError *error) { +#if 0 + [response setValue:[thumbnailUrl absoluteString] forKey:@"thumbnail_url"]; +#else + NSString *extension = [thumbnailUrl pathExtension]; + NSData *imageData = [NSData dataWithContentsOfURL:thumbnailUrl]; + NSString *base64EncodedImage = [TestClassCommon Base64Encode:imageData]; + + NSString *base64Image = nil; + if ([extension isEqualToString:@"jpg"] == YES) { + base64Image = [NSString stringWithFormat:@"data:image/jpg;base64, %@", base64EncodedImage]; + } else { + base64Image = [NSString stringWithFormat:@"data:image/png;base64, %@", base64EncodedImage]; + } + [response setValue:base64Image forKey:@"thumbnail_url"]; +#endif + + [TestClassWebViewController sendEvent:[NSString stringWithFormat:@"session_thumbnail:%@", sessionId] withArgs:response]; + }]; +} + +- (void)addFoo:(NSDictionary *)postData { + [TestClassRequest performMethod:TestClassRequestMethodPOST + onResource:resource + usingParameters:postData + withAccount:[TestClass account] + sendingProgressHandler:nil + responseHandler:^(NSURLResponse *response, NSData *responseData, NSError *error) { + NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response; + if ([httpResponse statusCode] == 200) { +#if DEBUG + NSString *rsp = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; + TestClassLog(@"TOGGLE CONNECTION ADDED response:%li responseData:%@ error:%@", (long) [((NSHTTPURLResponse *) response) statusCode], rsp, [error localizedDescription]); +#endif + NSJSONSerialization *jsonConnection = [responseData TestClassJSONObject]; + } + }]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cmt_insert.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cmt_insert.m new file mode 100644 index 00000000..58a4c894 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cmt_insert.m @@ -0,0 +1,53 @@ +@protocol spacingProtocol + +@property NSInteger spacing; + +@end + +@interface cmt_insert + ++ (cmt_insert*) shareInstance; + +@property (readonly) BOOL isAvailable; + +@property (copy) NSArray<NSString*>* contents; + +- (void) updateContents:(NSArray<NSString*>*) inContents andRefresh:(BOOL) inRefresh; + +@end + +@implementation cmt_insert + ++ (cmt_insert*) sharedInstance { +return nil; +} + +- (BOOL) isAvailable { +return YES; +} + +- (NSArray<NSString*>*) contents { +return @[]; +} + +- (void) setContents:(NSArray<NSString*>*) inContents { +} + +- (void) updateContents:(NSArray<NSString*>*) inContents andRefresh:(BOOL) inRefresh { +} + +@end + +@interface cmt_insert_with_protocol (spacingProtocol) +@end + +@implementation cmt_insert_with_protocol (spacingProtocol) + +- (NSInteger) spacing { +return 0; +} + +- (void) setSpacing:(NSInteger) inSpacing { +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cmt_insert2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cmt_insert2.m new file mode 100644 index 00000000..4a31e975 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/cmt_insert2.m @@ -0,0 +1,24 @@ + +NSURLResourceKey const NSURLCanonicalPathKey API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +@interface foo () + +@property BOOL usesStrongWriteBarrier API_DEPRECATED("Garbage collection no longer supported", macosx(10.5, 10.12), ios(2.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0)); + +static const NSWindowStyleMask NSResizableWindowMask API_DEPRECATED_WITH_REPLACEMENT("NSWindowStyleMaskResizable", macosx(10.0, 10.12)) = NSWindowStyleMaskResizable; + +- (NSString*) extensionForType:(NSString*) inFileType API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +@end + +@implementation foo + +- (NSString*) filePromiseProvider:(NSFilePromiseProvider*) inFilePromiseProvider fileNameForType:(NSString*) inFileType API_AVAILABLE(macos(10.12)) { +} +- (NSString*) filePromiseProvider:(NSFilePromiseProvider*) inFilePromiseProvider fileNameForType:(NSString*) inFileType API_DEPRECATED_WITH_REPLACEMENT(macos(10.12)) +{ +} +- (NSString*) filePromiseProvider:(NSFilePromiseProvider*) inFilePromiseProvider fileNameForType:(NSString*) inFileType API_UNAVAILABLE(macos(10.12)) { +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/code_placeholder.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/code_placeholder.m new file mode 100644 index 00000000..6245bfa4 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/code_placeholder.m @@ -0,0 +1,5 @@ +double delayInSeconds = 2.0; +dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); +dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ + <#code to be executed on the main queue after delay#> +}); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/complex_method.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/complex_method.m new file mode 100644 index 00000000..b22c34b6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/complex_method.m @@ -0,0 +1,30 @@ +// 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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/delete-space-oc.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/delete-space-oc.mm new file mode 100644 index 00000000..66e24dc8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/delete-space-oc.mm @@ -0,0 +1,69 @@ +/* EditorApplication */
+
+#include <string>
+
+#ifdef __OBJC__
+#import <Cocoa/Cocoa.h>
+
+class HierarchyState;
+@interface EditorApplication : NSObject
+{
+ IBOutlet id m_MainWindow;
+ IBOutlet id m_PaneController;
+ id m_RenderTimer;
+
+ IBOutlet id m_CutItem;
+ IBOutlet id m_CopyItem;
+ IBOutlet id m_PasteItem;
+
+ IBOutlet id m_DuplicateItem;
+ IBOutlet id m_DeleteItem;
+
+ IBOutlet id m_FrameSelectedItem;
+ IBOutlet id m_FindItem;
+ IBOutlet id m_SelectAllItem;
+}
+
+- (IBAction)SaveAssets:(id)sender;
+- (IBAction)CloseScene:(id)sender;
+- (IBAction)NewProject:(id)sender;
+- (IBAction)OpenProject:(id)sender;
+
+- (IBAction)SaveAsSceneToDisk:(id)sender;
+
+- (IBAction)EnterSerialNumber:(id)sender;
+- (IBAction)ReturnLicense:(id)sender;
+- (IBAction)CompileScene:(id)sender;
+- (IBAction)CompileSceneAutomatic:(id)sender;
+
+- (IBAction)saveDocument:(id)sender;
+
+- (IBAction)LoadSceneFromDisk:(id)sender;
+
+- (void)RemoveDisplayTimer;
+- (void)RegisterUpdateTimer:(int)frequency;
+
+- (void)refreshModifiedFile:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+- (void)closeFile:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+
+- (IBAction)ShowAboutDialog:(id)sender;
+- (IBAction)ShowPreferences:(id)sender;
+- (IBAction)ShowPackageManager:(id)sender;
+
+- (IBAction) delete:(id)sender;
+- (IBAction) copy:(id)action;
+- (IBAction)paste:(id)action;
+- (IBAction)duplicate:(id)action;
+- (IBAction)cut:(id)action;
+- (IBAction)selectAll:(id)action;
+- (IBAction)find:(id)action;
+- (IBAction)frameSelected:(id)action;
+- (IBAction)frameSelectedWithLock:(id)action;
+
+// Assetstore protocol handler and registration
+- (void)registerAssetStoreURLProtocol;
+- (void)getUrl:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent;
+
+@end
+
+#endif
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/double-indent-objc-dict.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/double-indent-objc-dict.m new file mode 100644 index 00000000..f94e5105 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/double-indent-objc-dict.m @@ -0,0 +1,17 @@ +id a = @{ + @"a": @1, + @"b": @2, +}; + +struct foo_t b = { + 1, + 2, +}; + +SomeObject *build() +{ + return @{ + @"a": @1, + @"b": @2, + }; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/double_angle_space.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/double_angle_space.m new file mode 100644 index 00000000..f7164498 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/double_angle_space.m @@ -0,0 +1,25 @@ +static const NSArray< id< NSObject> > **controllers = nil; + +NSArray< id< BlockController> > *someMethod(); + +@interface Fraction : NSObject +void Compute( + Image< E::Matrix<SType, Dim,1> > const& src, + Image<E::Matrix<TType,Dim,1> >& dst); +@end +@implementation SomeClass +- (void)initializeControllers:( NSArray< id< BlockController> > *)hybridContollers { + if (index < children.count) { + const unsigned int wl = w>>lvl; + + assert(x<0 && y>=3); +assert(y <0&&z> 2); +assert(a>>1); +assert(b >>1); + + return static_cast< id <CKMountable>>(children[index]); + } + +NSArray<id< BlockController> > *controllers = hybridContollers; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/exceptions.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/exceptions.m new file mode 100644 index 00000000..c8d6f6f2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/exceptions.m @@ -0,0 +1,23 @@ + +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"); + } + + @throw [NSException exceptionWithName:@"foo" reason:@"bar" userInfo:nil]; + +NSException *exception = [NSException exceptionWithName: @"HotTeaException" + reason: @"The tea is too hot" + userInfo: nil]; + +@throw exception; + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/extern-c-attribute.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/extern-c-attribute.m new file mode 100644 index 00000000..fb84ce73 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/extern-c-attribute.m @@ -0,0 +1,16 @@ +struct +{ + int foo; +} bar; + +extern "C" int* i; +extern "C" { int* i; } +int *i; +extern "C" NSString* i; +extern "C" { NSString* i; } +NSString* i; + +__attribute__((visibility("default"))) int* i; +__attribute__((visibility("default"))) NSString* i; + +#define DEFINE_NOTIFICATION(name) extern "C" __attribute__((visibility ("default"))) NSString* const name = @#name; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/for.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/for.m new file mode 100644 index 00000000..fc159fc6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/for.m @@ -0,0 +1,12 @@ +[[HRNewsService sharedInstance] fetchBreakingNewsItemWithId:self.breakingNewsId success:^(id responseObject) { + NSDictionary * thing; + for (NSArray * dictionary in photos) { + } +} failure:^(NSError *error) { + // Failure? +}]; + +// We also need to consider cases where a non-pointer type (or, a pointer without the star) is declared in ObjC. +for (id obj in someDictionary) { + NSLog(@"This could be anything! Objective-C really needs parametrized collections."); +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/for2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/for2.m new file mode 100644 index 00000000..535bc50b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/for2.m @@ -0,0 +1,2 @@ +for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) { +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/func-param-wrap-oc.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/func-param-wrap-oc.mm new file mode 100644 index 00000000..16f98ce9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/func-param-wrap-oc.mm @@ -0,0 +1,5 @@ + if(progress <= 0)
+ {
+ [[NSBezierPath bezierPathWithOvalInRect:NSMakeRect(NSMinX(pieRect)+stroke,NSMinY(pieRect)+stroke,
+ NSWidth(pieRect)-2*stroke,NSHeight(pieRect)-2*stroke)] fill];
+ }
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/func_def.mm b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/func_def.mm new file mode 100644 index 00000000..b3655728 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/func_def.mm @@ -0,0 +1,13 @@ +#import <Foundation/Foundation.h> + +extern "C" void function1(void *self, uint32_t *arg2, uint32_t * arg3); + +MACRO1(void, function2, type1 arg1, type2 arg2, const type1 * arg3); + +MACRO2(status_t, function3, + void *arg1, + const sp<IFoo>&arg2) { +} + +MACRO2(type4, function4, const void **arg1, type1 arg2, const type3 * arg3, type4 arg4, type4 arg5, bool arg6) { +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh137.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh137.m new file mode 100644 index 00000000..779e0f2f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh137.m @@ -0,0 +1,18 @@ +[UIView animateWithDuration:0.2f delay:0.f options:UIViewAnimationCurveEaseInOut animations: ^{ + self.transform = CGAffineTransformMakeScale(1.05f, 1.05f); +} completion: ^(BOOL finished) { + [UIView animateWithDuration:0.08f delay:0.f options:UIViewAnimationOptionCurveEaseInOut animations: ^{ + self.transform = CGAffineTransformIdentity; + [UIView animateWithDuration:1 delay:0 options:0 animations:^ { + // blah + } completion:nil]; + }]; +}]; + +dispatch_async(foo, ^{ + dispatch_async(bar, ^{ + dispatch_async(qux, ^{ + quz(); + }); + }); +}) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh293.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh293.m new file mode 100644 index 00000000..bb4cb52c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh293.m @@ -0,0 +1,15 @@ +self.someErrorView = ({ + UIView *view = [[UIView alloc] init]; + view.backgroundColor = [UIColor redColor]; + [view addSubview:({ + self.someErrorLabel = ({ + UILabel *label = [[UILabel alloc] init]; + label.textAlignment = NSTextAlignmentCenter; + label.backgroundColor = [UIColor clearColor]; + label; + }); + })]; + view; +}); +[self.view addSubview:self.someErrorView]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh511.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh511.m new file mode 100644 index 00000000..cee32794 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/gh511.m @@ -0,0 +1,3 @@ +BOOL valid = YES; +NSDictionary *p = valid ? @{@"Test": @"Example"} : nil; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/i1213.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/i1213.m new file mode 100644 index 00000000..f47e5964 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/i1213.m @@ -0,0 +1,9 @@ +int main (int argc, const char * argv[]) +{ + switch (argc) + { + case 0 ... 1: + return 1; + } + return 0; +}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent-inside-ternary-operator.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent-inside-ternary-operator.m new file mode 100644 index 00000000..ff979acf --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent-inside-ternary-operator.m @@ -0,0 +1,102 @@ +flag + ? [Cmpnt Cmpnt:(isChildActionSheet ? TypeBack : TypeCancel)] + : nil; + + +[[BottomSheetItem alloc] + iconName:selected + ? g.re + .at + : g + .re + .at + builder:nil + handler:^{ + } +] + + +[[BottomSheetItem alloc] + iconName:selected + ? iconName : g + .re + .at + builder:nil + handler:^{ + } +] + +(event + ? [FSBottomSheetActionCellItemVariant + action:AKAction<> :: actionFromSenderlessBlock(^{ + auto const strongSelf = weakSelf; +})] + : nil); + + +[[ViewController alloc] strategy: (strategy + ? [QuestionMarkStmt new] + : [ColonStmt new]) +toolbox: _one]; + +[[ViewController alloc] strategy: (strategy + ?: [SourceStrategy new]) +toolbox: _two]; + + + +flag1 +? ( flag2 + ? ( flag3 + ? [ViewController selector1:^{ + NSLog(@"selector1"); +}] + : [ViewController selector2:^(){ + NSLog(@"selector2"); +}] ) + : ( result3 ) + ) + : ( flag5 + ? ( flag + ? result4 + : [ViewController preSelector:flag selector3:{ + .x = 10, + }]) + : ( flag6 + ? [ViewController preSelector:flag selector3:^{ + NSLog(@"selector3"); + }] + : ( result7 ) + ) + ); + + +flag1 +? result1 + : ( + flag5 + ); + + + +showButton ? Action<>::actionFromBlock(^(Component *component) { + return nil; + }) : nil; + +showButton +? Action<>::actionFromBlock(^(Component *component) { + return nil; + }) + : nil; + + showButton +? Action<>::actionFromBlock(^(Component *component) { + return nil; + }) : nil; + + +showButton + ? Action<>::actionFromBlock([](Component *component) { + return nil; + }) + : nil; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent-objc-block.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent-objc-block.m new file mode 100644 index 00000000..b882abf5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent-objc-block.m @@ -0,0 +1,149 @@ +const auto c = + [FDSTapTargetComponent + accessibilityContext:{ + .accessibilityLabel = ^{ + return [AccessibilityLabelBuilder build]; + } + }]; + +methodCall1(^{ + send(component1); +}, + x); + +methodCall2( ^ { + send(component2); + }); + +[array block:^ (id obj, NSUInteger idx, BOOL *stop) { + NSLog(@"Object at index %lu is %@", idx, obj); + }]; + + + [UIView animateWithDuration:3.0f animation:^{ + LOG(@"animate"); + } + completion:^(BOOL finished){ + LOG(@"finished"); + }]; + +[UIView + animationBlock: ^ { + [[Log alloc] callback:^NSString *(NSString *result){ + return @"log"; + }]; + } + completion:^(BOOL finished){ + LOG(@"finished"); + }]; + + +methodCall3(x, ^KSC::ActionCell::Item (Item item) { + variant.action.send(component); + }); + +methodCall4( x, ^ id (Component *c) { + NSLog(@"methodCall4"); + }); + +methodCall5( ^ id (Component *c) { + NSLog(@"methodCall5"); + }); + +methodCall6( ^(NSString *)(Component *c) { + return @"methodCall6"; + }); + +methodCall7(^ (Component *c) { + NSLog(@"methodCall7"); + }, y); + + methodCall8(x, ^(Component *c) { + NSLog(@"methodCall8"); + }, y); + + + [Object callMethod:xArg + block:^id (Component *c) { + NSLog(@"methodCall4"); + }]; + +[Object callMethod:xArg + block:^id (Component *c) { + NSLog(@"methodCall5"); + }]; + +[Object callMethod:xArg block:^(NSString *)(Component *c) { + return @"methodCall6"; + }]; + + +[Object callMethod:xArg + block:^ (Component *c) { + NSLog(@"methodCall7"); + } + yMethod:yArg]; + + [Object callMethod:xArg + block:^(Component *c) { + NSLog(@"methodCall8"); + } + yMethod:yArg]; + +[Object callMethod:xArg +block:^(NSString *)(Component *c1) { + [Object callMethod:xArg block:^(Component *c) { + NSLog(@"methodCal9"); + } + yMethod:yArg]; + } + anotherBlock:^(NSString *)(Component *c2) { + return @"methodCall10"; + } + yetAnotherBlock:^(NSString *)(Component *c3) { + return @"methodCall11"; + }]; + +[dialog + dismissWithCompletion:^{ + _deleteConversation( + strongSelf->_session, + ^{ + if (auto const innerStrongSelf = weakSelf) { + [NavigationCoordinator(innerStrongSelf) + dismissViewController:innerStrongSelf + completion:nil]; + } + }); + }]; + + + [FlexboxComponent +newWithView:{ + { + .accessibilityLabel = ^{ + return + [[[[AccessibilityLabelBuilder builder] + appendPhrase:title] + appendPhrase:body] + getResult]; + }, + } + }]; + + +MainComponent( + .builder = ^{ + return + value; +}, +param1, +param2, + ); + +KSC::map( + _items, + ^ ActionCell::Item (Item item) { + return x; + } +); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_boxed.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_boxed.m new file mode 100644 index 00000000..c7df968f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_boxed.m @@ -0,0 +1,74 @@ + +- (IBAction) copy:(nullable id) inSender { +NSPasteboard* const pasteboard = NSPasteboard.generalPasteboard; +[pasteboard clearContents]; +[pasteboard writeObjects:@[ +[NSPasteboardItem pasteboardItemWithProvider:self forTypes:@[ NSPasteboardTypePDF ] +andData:@[ kNSUTIExportedAgaroseGel, +[NSKeyedArchiver archivedDataWithRootObject:self.selectedIndexes.count != 0 ? [self.gels objectsAtIndexes:self.selectedIndexes] : self.gels] +]] +]]; +} + +- (IBAction) copy:(nullable id) inSender { +NSPasteboard* const pasteboard = NSPasteboard.generalPasteboard; +[pasteboard clearContents]; +[pasteboard writeObjects:@[[NSPasteboardItem pasteboardItemWithProvider:self forTypes:@[ NSPasteboardTypePDF ] andData:@[ +kNSUTIExportedAgaroseGel, [NSKeyedArchiver archivedDataWithRootObject:self.selectedIndexes.count != 0 ? [self.gels objectsAtIndexes:self.selectedIndexes] : self.gels] +]] ]]; + +NSArray* a = @[]; +NSArray* b = @[@1,@2,@3]; +NSArray* c = @[ +@1, @2, @3 +]; +NSArray* d = @[@[@1], @[@2], @[@3]]; +NSArray* e = @[ +@[@1], @[@2], @[@3] +]; +NSMutableArray* f = [NSMutableArray arrayWithArray:@[@[@1], @[@2], @[@3]]]; +NSMutableArray* g = [NSMutableArray arrayWithArray:@[ +@[@1], @[@2], @[@3] +]]; +NSMutableDictionary* d1 = [NSMutableDictionary dictionaryWithDictionary:@{ +@"Keys":@[ +@{@"A": @1}, +@{@"B": @2}. +@{@"C": @3} +] +}]; +} + +inline static void installGelMarkers(void) { +[NSOperationQueue.mainQueue addOperationWithBlock:^{ +[accessoryView.textStorage setAttributedString:[[NSAttributedString alloc] initWithString:error.localizedDescription attributes:@{ NSFontAttributeName: [NSFont systemFontOfSize:NSFont.systemFontSize] }]]; +NSAlert *alert = [[NSAlert alloc] init]; +}]; +} + +[[NSAttributedString alloc] initWithString:inJunction.reverseName attributes:@{ +NSFontAttributeName: font, +NSForegroundColorAttributeName: inJunction.reverseColor +}]; +@{ +NSFontAttributeName: self.font, +NSForegroundColorAttributeName: inJunction.forwardColor +} +[[NSAttributedString alloc] initWithString:inJunction.reverseName attributes:@{ NSFontAttributeName: font, NSForegroundColorAttributeName: inJunction.reverseColor }]; +[[NSAttributedString alloc] initWithString:inJunction.reverseName +attributes:@{ NSFontAttributeName: font, NSForegroundColorAttributeName: inJunction.reverseColor }]; +- (void) drawReversePrimerForJunction:(GibsonJunction*) inJunction bounds:(NSRect) inBounds { +NSString* const string1 = nil, +string2 = nil, +string3 = nil; +//does not compile but does test shift operator formatting +std::ostringstream ostream; +ostream << "hello" +<< ' ' +<< "world"; +NSString* const string = inJunction.reversePrimer; +[attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:[string substringToIndex:range.location] attributes:@{ +NSFontAttributeName: self.font, +NSForegroundColorAttributeName: inJunction.forwardColor +}]]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_oc_inside_msg_sel.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_oc_inside_msg_sel.m new file mode 100644 index 00000000..f20cd048 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_oc_inside_msg_sel.m @@ -0,0 +1,71 @@ +[NSPasteboardItem pasteboardItemWithProvider:self + forTypes:@[ NSPasteboardTypePDF ] + andData:@[ + kNSUTIExportedAgaroseGel, + [NSKeyedArchiver archivedDataWithRootObject:self.selectedIndexes.count != 0 ?[self.gels objectsAtIndexes:self.selectedIndexes] : self.gels] + ]]; + +[ViewController simple_First:firstArg +simple_Two:secondArg +simple_3:thirdArg]; + + +[ViewController preFirst:( + pre_1_arg + )]; + +[ViewController firstSelectorOne:arg1 preFirst:( + pre_1_arg + )]; + +[ViewController preFirst:^{ + return arg4; + } + firstSelectorOne:arg1]; + +[ViewController firstSelectorOne:arg1 preFirst:^{ + return arg4; +}]; + +[ViewController firstSelectorOne:(flag + ? arg5_1 + : arg5_2 + ) toolbox:_toolbox]; + +[ViewController preFirst:( + pre_1_arg + ) + firstSelectorOne: + arg1 + selector_two:( + arg2 + ) + Selector_3:{ + .arg3 = 1 + } + fourth_Selector:^{ + return arg4; + } + selector_number_5:(flag + ? arg5_1 + : arg5_2 + ) + selector_number_5:(flag + ? arg5_1 + : arg5_2 + ) + sixSel:(flag + ?: arg6_1) + seventh_selector:( + arg7 + ) + toolboxSel:toolboxArg]; + +[[ViewController alloc] strategy:(strategy + ? [QuestionMarkStmt new] + : [ColonStmt new]) + toolbox:_one]; + +[[ViewController alloc] strategy:(strategy + ?: [SourceStrategy new]) + toolbox:_two]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_single_newline.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_single_newline.m new file mode 100644 index 00000000..27e79e8a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/indent_single_newline.m @@ -0,0 +1,15 @@ + +- (BOOL)isSomethingTrue:(BOOL) something{ + + if (something){ + //Yes it's true + + return YES; + } + else { + //No it's false + + return NO; + } + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2629.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2629.m new file mode 100644 index 00000000..e690ea58 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2629.m @@ -0,0 +1,20 @@ +@implementation SomeClass +- (void)someMethod +{ + enumerateItems ( + ^( NSInteger section) { + } ); +} + +- (void)someOtherMethod +{ + items.enumerateItems ( + ^(NSInteger section, NSInteger index, id<NSObject> object, BOOL *stop) { + enumerator(index, object, TypeInsert); + }, + nil, + some_param + ); +} +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2631.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2631.m new file mode 100644 index 00000000..7989b020 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2631.m @@ -0,0 +1,17 @@ +@protocol SomeProtocol +Props Method(const Contents &options = {}); +@end + +@interface SomeClass +Props Method1(const Contents &options = {}); +@end + + +@implementation SomeClass +Props Method1(const Contents options = {}); +@end + +void Method2(const Contents options = {}) { +} + +void Method3(const Contents &options = { .text = 10 }); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2675.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2675.m new file mode 100644 index 00000000..1d4cafe2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2675.m @@ -0,0 +1,66 @@ +@interface Example1 : NSObject + typedef ObjectType0 X; +typedef ObjectType1 _Nullable (^Handler1)(id<Fragment> fragment); +typedef ObjectType2 _Nullable (^Handler2)(id<Fragment> fragment); +@end + +@interface Example2 : NSObject + typedef ObjectType1 _Nullable (^Handler1)(id<Fragment> fragment); +typedef ObjectType2 _Nullable (^Handler2)(id<Fragment> fragment); +@end + +@interface AnotherExample1 : NSObject + SOME_MACRO_OPEN +- (instancetype)init; + +SOME_MACRO_CLOSE +@end + +SOME_MACRO_OPEN +@interface AnotherExample2 : NSObject +SOME_MACRO_CLOSE +- (instancetype)init; + +@end + +@interface SomeInterface : NSObject + + // Some comment goes here +@end + +@interface YetAnotherExample : NSObject + + // What about this comment + // here +- (instancetype)init; +@end + +@interface YetOneAnotherExample : NSObject + +/// What about this comment +/// here +- (instancetype)init; +@end + +@interface YetOneOtherExample : NSObject + + /// What about this comment + /// here +- (instancetype)init; +@end + + +@interface YetOneMoreExample : NSObject + + /* Different comment pattern */ +- (instancetype)init; +@end + + +@interface YetOneMoreOtherExample : NSObject + + /* Multiline + Comments + */ +- (instancetype)init; +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2722.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2722.m new file mode 100644 index 00000000..65dcb131 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2722.m @@ -0,0 +1,4 @@ +// Pointer inside OC message +[*messageClass.rlock () paramName : argValue]; +[*messageClass1 paramName1 : argValue1]; +[*someClass->var sendMessage:@"message"]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2724.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2724.m new file mode 100644 index 00000000..51c90671 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2724.m @@ -0,0 +1,19 @@ +// OC mesg inside array/dictionary +_sections1 = @[ +[ SectionModel resultsWithContacts:contacts] +]; + +_sections2 = @[ +[[SectionModel mesg] resultsWithContacts1: contacts1], +[[SectionModel mesg] resultsWithContacts2: contacts2] +]; + +_sections3 = @[[SectionModel resultsWithContacts:contacts]]; + +@[ + something + ]; + +@[ + [something mesg] + ]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2727.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2727.m new file mode 100644 index 00000000..f15542f1 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/issue_2727.m @@ -0,0 +1,2 @@ +typedef NSArray<NSString *> * (^ Finder )(NSArray *); +typedef NSArray< NSString * > * (^ Handler )( NSDictionary< NSString * , NSArray * > *); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/kw.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/kw.m new file mode 100644 index 00000000..a4d25624 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/kw.m @@ -0,0 +1,31 @@ +#include <stdio.h> +#include <objc/Object.h> + +@protocol Job +- do; +@end + +@interface MyJob: Object<Job> +- do; +@end +@implementation MyJob +- do +{ + printf("Doing Job\n"); + return self; +} +@end + +@interface JobExecutor: Object +- doWith: (id<Job>) job for: (int) count; +@end + +@implementation JobExecutor +- doWith: (id<Job>) job for: (int) count +{ + for (int i = 0; i < count; ++i) { + [job do]; + } + return self; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/literals.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/literals.m new file mode 100644 index 00000000..0f4d004c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/literals.m @@ -0,0 +1,36 @@ + +NSDictionary *dictionary = @{@0: @"red", @1: @"green", @2: @"blue"}; + +NSArray *array = @[@0, @1, @2, @YES, @'Z', @42U]; + +NSArray *multilineArray = @[ +@0, @1, @2, @YES, +@'Z', @42U +]; + +void main(int argc, const char *argv[]) { + // character literals. + NSNumber *theLetterZ = @'Z'; // equivalent to [NSNumber numberWithChar:'Z'] + + // integral literals. + NSNumber *fortyTwo = @42; // equivalent to [NSNumber numberWithInt:42] + NSNumber *fortyTwoUnsigned = @42U; // equivalent to [NSNumber numberWithUnsignedInt:42U] + NSNumber *fortyTwoLong = @42L; // equivalent to [NSNumber numberWithLong:42L] + NSNumber *fortyTwoLongLong = @42LL; // equivalent to [NSNumber numberWithLongLong:42LL] + + // floating point literals. + NSNumber *piFloat = @3.141592654F; // equivalent to [NSNumber numberWithFloat:3.141592654F] + NSNumber *piDouble = @3.1415926535; // equivalent to [NSNumber numberWithDouble:3.1415926535] + + // BOOL literals. + NSNumber *yesNumber = @YES; // equivalent to [NSNumber numberWithBool:YES] + NSNumber *noNumber = @NO; // equivalent to [NSNumber numberWithBool:NO] + + // Raw string literals + NSString *rawString = [NSString stringWithFormat:@R"(embedded "quotes")"]; + +#ifdef __cplusplus + NSNumber *trueNumber = @true; // equivalent to [NSNumber numberWithBool:(BOOL)true] + NSNumber *falseNumber = @false; // equivalent to [NSNumber numberWithBool:(BOOL)false] +#endif +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/macro-close-brace.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/macro-close-brace.m new file mode 100644 index 00000000..0eb3fa81 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/macro-close-brace.m @@ -0,0 +1,18 @@ +#import <Foundation/Foundation.h> + +#if TARGET_RT_BIG_ENDIAN +#define FourCC2Str(fourcc) (const char[]) { *((char *) &fourcc), *(((char *) &fourcc) + 1), *(((char *) &fourcc) + 2), *(((char *) &fourcc) + 3), 0} +#else +#define FourCC2Str(fourcc) (const char[]) { *(((char *) &fourcc) + 3), *(((char *) &fourcc) + 2), *(((char *) &fourcc) + 1), *(((char *) &fourcc) + 0), 0} +#endif + +#if 1 +#define SYNCHRONIZED_BEGIN(x) @synchronized(x) { +#define SYNCHRONIZED_END } +#else +#define SYNCHRONIZED_BEGIN(x) +#define SYNCHRONIZED_END +#endif + +#define AUTORELEASEPOOL_BEGIN @autoreleasepool { +#define AUTORELEASEPOOL_END } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/main.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/main.m new file mode 100644 index 00000000..f2fdf16a --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/main.m @@ -0,0 +1,21 @@ +#import <stdio.h> +#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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/method_ends_semicolon.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/method_ends_semicolon.m new file mode 100644 index 00000000..e3c5637e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/method_ends_semicolon.m @@ -0,0 +1,18 @@ +#import <Foundation/Foundation.h> + +@interface TestClass + ++ (void)cancelRequest:(id)request; + +@end + +@implementation TestClass + +// Occasionally there will be user errors where someone will +// copy the interface method declaration to implementation +// and leaves the semicolon ++ (void)cancelRequest:(id)request; +{ +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/misc.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/misc.m new file mode 100644 index 00000000..5038a14c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/misc.m @@ -0,0 +1,27 @@ +- (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]]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/more_blocks.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/more_blocks.m new file mode 100644 index 00000000..eab01db0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/more_blocks.m @@ -0,0 +1,53 @@ +int (^myBlock)(int) = ^(int num) { return num * multiplier; }; +// for comparison +int (*fcnptr)(int); + +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 optional diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/more_blocks_2.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/more_blocks_2.m new file mode 100644 index 00000000..55636ae5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/more_blocks_2.m @@ -0,0 +1,18 @@ +// Test a case where blocks wrapped by parentheses were causing the parser to crash +int (^myBlock)(int) = ( ^(int num) { + return num * multiplier; +}); + +dispatch_async(thread, (^{ + dispatch_async(thread, ^{ + dispatch_async(thread, ^{ + NSLog(@"Hooray for dispatch_async!"); + }); + }); +})); + +// Example of a unit test using Kiwi +beforeAll(^{ + NSString *serviceURL = [NSURL URLWithString:@"http://TEST_URL"]; + NSLog(serviceURL); +}); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/msg.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/msg.m new file mode 100644 index 00000000..cca460f9 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/msg.m @@ -0,0 +1,3 @@ +[obj doSomething:0 withArgs:@""]; +[@"" doSomething:0 withArgs:@""]; +NSString *result = (id)[obj arg:param value:3]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/msg_align.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/msg_align.m new file mode 100644 index 00000000..3b61a051 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/msg_align.m @@ -0,0 +1,56 @@ + +BOOL immediatlyReady = [self ensureResource:mutableResources[0] + existsInDirectoryAtPath:mutablePaths[0] + queueMode:mode + completionHandler:completionHandler + errorHandler:errorHandler]; + +[myObject doFooWith1:arg1 name1:arg2 // some lines with >1 arg + error1:arg3]; + +[myObject doFooWith2:arg4 + name2:arg5 error2:arg6]; + +[myObject doFooWith3:arg7 + name3:arg8 // aligning keywords instead of colons + error3:arg9]; + +[myObject doithereguysA:argA + reallylongargname:argB another:argC]; + + int foo() +{ +[UIView transitionWithView:self.window + duration:0.3 + options:UIViewAnimationOptionTransitionCrossDissolve + animations:^{ + BOOL oldState = [UIView areAnimationsEnabled]; + [UIView setAnimationsEnabled:NO]; + self.window.rootViewController = self.viewController; + [UIView setAnimationsEnabled:oldState]; + } + completion:^(BOOL finished) { + +BOOL foo; + }]; +} + + int foo2() +{ +[UIView transitionWithView:self.window duration:0.3 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ + BOOL oldState = [UIView areAnimationsEnabled]; + [UIView setAnimationsEnabled:NO]; + self.window.rootViewController = self.viewController; + [UIView setAnimationsEnabled:oldState]; + } + completion:^(BOOL finished) { + +BOOL foo; + }]; + + [[HRNewsService sharedInstance] registerPushToken:deviceToken success:^{ + DLog(@"Finished Registering Push Token!"); + self.notificationsEnabled = YES; + } fail:nil]; + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/negative_value.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/negative_value.m new file mode 100644 index 00000000..9aa4dc80 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/negative_value.m @@ -0,0 +1,12 @@ +#import <Foundation/Foundation.h> + +int main(void) { + int i = -1; + NSNumber *foo1 = @-1; + NSNumber *foo2 = @(-1); + NSNumber *foo3 = @1; + NSNumber *foo4 = @(1); + NSNumber *foo5 = @(i); + + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/nelem.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/nelem.m new file mode 100644 index 00000000..d42ce3b6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/nelem.m @@ -0,0 +1,10 @@ +#import <Foundation/Foundation.h> + +/* get #of elements in a static array */ +#ifndef NELEM +#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) +#endif + +int main(void) { + return 0; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/nl_func_call_args_multi_line_ignore_closures.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/nl_func_call_args_multi_line_ignore_closures.m new file mode 100644 index 00000000..ea132bab --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/nl_func_call_args_multi_line_ignore_closures.m @@ -0,0 +1,85 @@ +mapToPtr(^(const LeftAddOn::Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr( x, ^ (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr( ^ (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr( arg1, ^ ( NSString * ) (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}, arg2); + +mapToPtr(arg1, ^ ( NSString *) (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}); + +mapToPtr( ^() (const Props &addOnProps) { + FSTheme *const theme = AK::getTheme(); +}, arg2); + + + +methodCall(^{ + variant.action.send(Cmpnt); + }); + + methodCall( + ^{ + variant.action.send(Cmpnt); + }, x); + + +methodCall( x, ^id (Cmpnt *c) { + NSLog(@"Something"); + }); + +methodCall( ^id (Cmpnt *c) { + NSLog(@"Something"); + }); + +methodCall( ^(Cmpnt *c) { + NSLog(@"Something"); + }); + +methodCall( + ^ (Cmpnt *c) { + NSLog(@"Something"); + }, y); + + methodCall(x, ^(Cmpnt *c) { + NSLog(@"Something"); + }, y); + + +methodCall(arg1, +arg2, arg3); + +methodCall(arg1, arg2, arg3); + +methodCall(arg1, arg2, { + .x = 10, +}); + +methodCall(arg1, { + .x = 10, +}, arg2); + +methodCall({ + .x = 10, +}, arg2); + + +outerMethodCall(methodCall(^{ + // action +}, + x)); + +outerMethodCall(methodCall(^{ + variant.action.send(Cmpnt); +}, + x)); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/ns_enum.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/ns_enum.m new file mode 100644 index 00000000..cdd729d8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/ns_enum.m @@ -0,0 +1,27 @@ +// The semicolons at the end of these declarations are not superfluous. +typedef NS_ENUM (NSUInteger, MyEnum) {MyValue1, MyValue2, MyValue3}; +typedef NS_OPTIONS (NSUInteger, MyBitmask) {MyBit1, MyBit2, MyBit3}; + +// NS_ENUM specifies the type and name of the enum. +typedef enum { +MyValue1, +MyValue2, +MyValue3 +} MyEnum; +typedef NS_ENUM (NSUInteger, MyEnum) { +MyValue1, +MyValue2, +MyValue3 +}; + +// NS_OPTIONS is equivalent to NS_ENUM, but semantically used for bitmask enums. +typedef enum { +MyBit1 = (1u << 0), +MyBit2Longer = (1u << 1), +MyBit3ThatIsConsiderablyMoreVerbose = (1u << 2) +} MyBitmask; +typedef NS_OPTIONS (NSUInteger, MyBitmask) { +MyBit1 = (1u << 0), +MyBit2Longer = (1u << 1), +MyBit3ThatIsConsiderablyMoreVerbose = (1u << 2) +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc-split.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc-split.m new file mode 100644 index 00000000..3b656bfc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc-split.m @@ -0,0 +1,10 @@ +[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]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc_cond_colon.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc_cond_colon.m new file mode 100644 index 00000000..50cf56b5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc_cond_colon.m @@ -0,0 +1,9 @@ +[self.vendorID_TextField setStringValue:string ? string : @""]; + +x = [NSString str:path]; +x = [NSString strFormat:@"Data/%s", path]; +x = path[0] == '/' ? path : "abc"; +x = path[0] == '/' ? [NSString str:path] : [NSString strFormat:@"Data/%s", path]; + +id<MTLBuffer> buf = data ? [metal::g_Device newBufferWithBytes:data length:len options:MTLResourceOptionCPUCacheModeDefault] + : [metal::g_Device newBufferWithLength:len options:MTLResourceOptionCPUCacheModeDefault]; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc_msg_in_pp.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc_msg_in_pp.m new file mode 100644 index 00000000..8496973b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/oc_msg_in_pp.m @@ -0,0 +1,18 @@ +#import <Foundation/Foundation.h> + +#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float) ((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float) ((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float) (rgbValue & 0xFF)) / 255.0 alpha:1.0] + +#if TARGET_OS_IPHONE +#define GL_CONTEXT_ALLOC(parentContext) [[EAGLContext alloc] initWithAPI:GL_CONTEXT_VERSION(parentContext) sharegroup:[parentContext sharegroup]] +#else +#define GL_CONTEXT_ALLOC(parentContext) [[NSOpenGLContext alloc] initWithFormat:[[NSOpenGLPixelFormat alloc] initWithCGLPixelFormatObj:CGLGetPixelFormat([parentContext CGLContextObj])] shareContext:parentContext] +#endif + +#define NSLocalizedString(key, comment) \ + [TestClassBundle localizedStringForKey:(key) value:@"" table:nil] + +@interface TestClass : NSObject +@end + +@implementation TestClass +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/pp_bool.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/pp_bool.m new file mode 100644 index 00000000..b1bf896c --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/pp_bool.m @@ -0,0 +1,5 @@ +#import <Foundation/Foundation.h> + +#if TARGET_OS_MAC && !TARGET_OS_IPHONE +#import <AppKit/AppKit.h> +#endif diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/properties.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/properties.m new file mode 100644 index 00000000..4de60057 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/properties.m @@ -0,0 +1,12 @@ +#define nonnull_strong nonnull, strong +#define myatomic nonatomic +@interface UCTestClass () + +@property (nonatomic, strong, null_unspecified, readonly) NSString* test1; +@property (strong, readonly, nonatomic, nullable) NSString* test2; +@property (strong, readonly, getter=test2Getter, nonatomic, nonnull) NSString* test3; +@property (strong, readonly, getter=test2Getter, nonatomic, setter=test2Setter:, null_resettable) NSString* test4; +@property (class, readonly, getter=test5Getter, nonatomic, nonnull, assign) NSString* test5; +@property (class, assign, getter=test5Getter, myatomic, nonnull_strong) NSString* test6; + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/protocol.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/protocol.m new file mode 100644 index 00000000..31a8b86f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/protocol.m @@ -0,0 +1,30 @@ + +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 <B>)anObject; +@end + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/react_native.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/react_native.m new file mode 100644 index 00000000..eadf314f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/react_native.m @@ -0,0 +1,42 @@ +#import "FOOAddressBookManager.h" +#import <React/RCTBridge.h> +#import <React/RCTEventDispatcher.h> + +/* + * #define RCT_EXPORT_METHOD(method) \ + * - (void)__rct_export__##method { \ + * __attribute__((used, section("__DATA,RCTExport"))) \ + * static const char *__rct_export_entry__[] = { __func__, #method }; \ + * } \ + * - (void)method \ + */ + +@interface FOOAddressBook:NSObject +@end + +@implementation FOOAddressBookManager + +RCT_EXPORT_MODULE(FOOAddressBook) + +RCT_EXPORT_METHOD(getAddresses: (NSDictionary*) data callback:(RCTResponseSenderBlock) callback) +{ + NSMutableArray* addresses = [[FOOAddressBook sharedInstance] getAddresses:data]; + if (addresses != nil) + callback(@[[NSNull null], addresses]); + else + callback(@[@"getAddresses returned nil."]); +} + +RCT_EXPORT_METHOD(getStatus : (RCTResponseSenderBlock) callback) +{ + callback(@[[NSNull null], [[FOOAddressBook sharedInstance] getStatus]]); +} + +RCT_EXPORT_METHOD(requestAccess : (RCTResponseSenderBlock) callback) +{ + [[FOOAddressBook sharedInstance] requestAccess:^(NSString* status) { + callback(@[[NSNull null], status]); + }]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/real_world_file.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/real_world_file.m new file mode 100644 index 00000000..26ec3cb2 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/real_world_file.m @@ -0,0 +1,225 @@ +/* + 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 + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/receiver.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/receiver.m new file mode 100644 index 00000000..274d4130 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/receiver.m @@ -0,0 +1,10 @@ +#import <Cocoa/Cocoa.h> + +@implementation MyDocument + +- (NSString*) appPath { + [ AClass AFunc ]; + return [NSSearchPathForDirectoriesInDomains ( NSDocumentDirectory, NSUserDomainMask, YES ) lastObject]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/return_type.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/return_type.m new file mode 100644 index 00000000..62a5c246 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/return_type.m @@ -0,0 +1,36 @@ +#import <Foundation/NSObject.h> +#import <stdio.h> + +@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 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/selector.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/selector.m new file mode 100644 index 00000000..a5a89475 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/selector.m @@ -0,0 +1,7 @@ +@selector(methodNameWithArg:); +@selector (methodNameNoArg); +@selector (methodNameArg1:arg2: ); + +NSArray *sortedTZs = [ [ NSTimeZone knownTimeZoneNames ] +sortedArrayUsingSelector : @selector ( compare: ) ]; + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sort_import.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sort_import.m new file mode 100644 index 00000000..1a227b7e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sort_import.m @@ -0,0 +1,32 @@ +// should be ddd, eee, fff +#import "ddd" +#import "fff" +#import "eee" + +#import "ccc" +#import "aaa" +// should be just bbb +#import "bbb" + +#import "sort_import.h" +#import "sort_import+internal.h" +#import "sort_import+public.h" + +#import "Action+Internal.h" +#import "Action+Public.h" +#import <UIKit/UIKit.h> +#import "Action.h" + +#include "Test+Internal.h" +#include "Test.h" + +#import "Something_Internal.h" +#import "Something_Public.h" +#import "Something.h" + +#import "AAA" +#import "BBB.h" +#include "DDD" +#import "EEE.h" +#import <KKK> +#include "CCC.h" diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sort_import_group.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sort_import_group.m new file mode 100644 index 00000000..9e14f0fc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sort_import_group.m @@ -0,0 +1,48 @@ +#import "ddd" +#import "fff" +#import "eee" + +#import "ccc" +#import "aaa" +#import "bbb" + +#import "Action+Public.h" + + + +#import "sort_import.h" +#import "sort_import+internal.h" + +#import "sort_import+public.h" +#import <Foundation/Foundation.h> + +#import "Action+Internal.h" +#import "Action+Internal.hpp" +#import "Action+Public.h" +#import <UIKit/UIKit.h> +#import "Action.h" + +#include "Test+Internal.h" +#include "Test.h" + +#import "DDD.h" +#import "BBB.h" + +#import "Something_Internal.h" +#import "Something_Public.h" +#import "Something.h" + +#import "AAA" +#import "BBB.h" +#import <SSS> +#import "AAABBB" +#import "AAA" +#include "DDD" + +#import "EEE.h" +#import <KKK> +#import <KKK> // Duplicate with comment +#import <SSS> +#include "CCC.h" + +#include "Test.h" diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_after_angle.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_after_angle.m new file mode 100644 index 00000000..259d2011 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_after_angle.m @@ -0,0 +1,21 @@ +#import <Foundation/Foundation.h> + +@interface TestClass2 : TestClassNavigationViewController{ + BOOL foo; +} + +@implementation TestClass2 + +@end + +@interface TestClass : TestClassNavigationViewController<UIWebViewDelegate, UIActionSheetDelegate>{ + NSURL *webpageUrl; + UIWebView *webView; + BOOL toolbarVisible; + BOOL loading; + NSString *endPrefix; +} + +@implementation TestClass + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_after_oc_msg_receiver.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_after_oc_msg_receiver.m new file mode 100644 index 00000000..aad36be5 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_after_oc_msg_receiver.m @@ -0,0 +1,11 @@ +#import <Foundation/Foundation.h> + +@implementation TestClass + +- (void)testMethod { + NSData *jsonData = [self dataUsingEncoding:NSUTF8StringEncoding]; + id jsonParsedObj = [jsonSerializationClass JSONObjectWithData:jsonData options:0 error:&jsonError]; + NSString *ret = [[TestClass sharedInstance] testString]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_before_oc_proto_list.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_before_oc_proto_list.m new file mode 100644 index 00000000..c0d96bdb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_before_oc_proto_list.m @@ -0,0 +1,25 @@ +@protocol ControllerDelegate<NSObject, Controller> +@end + +@protocol Controller <NSObject> +@end + +@interface CollectionViewController () <DataSource> { +} +@end + +@interface CollectionViewController (Flow)<FlowDelegate> : NSObject +{ + NSDictionary <NSString *, NSString *> dict; +} +@end + +@interface MyClass : NSObject <Protocol_A, Protocol_B> + +@end + +@implementation ViewController +- (void)someMethod { + auto const *dict = [NSMutableDictionary < NSString *, NSString * > new]; +} +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_inside_braces_oc_dict.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_inside_braces_oc_dict.m new file mode 100644 index 00000000..272a2f28 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_inside_braces_oc_dict.m @@ -0,0 +1,7 @@ +#import <Foundation/Foundation> + +int main(void) { + NSDictionary *productParameters = @{ @"id": appStoreID }; + NSDictionary *options = @{ AVURLAssetPreferPreciseDurationAndTimingKey: @YES }; + NSDictionary *baz = @{foo : bar}; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_boxed.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_boxed.m new file mode 100644 index 00000000..0c6948c0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_boxed.m @@ -0,0 +1,9 @@ + +- (void) foo { + NSArray* a = @[]; + NSDictionary* b = @{}; + NSArray<NSString*>* array = @[@"hello", @"world"]; + NSDictionary<NSString*, NSString*>* dictionary = @{@"foo":@"bar", @"foo2":@"bar2"}; + + NSString* const type = [pasteboard availableTypeFromArray:@[NSPasteboardTypeString]]; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_catch.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_catch.m new file mode 100644 index 00000000..a5354dfe --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_catch.m @@ -0,0 +1,18 @@ + +- (void) foo:(NSString*) inString +{ + @try { + }@catch(NSException* const inException) + { + } +} + +- (void) bar:(NSString*) inString +{ + @try { + } + @catch (NSException* const inException){ + } + @finally { + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_classname_paren-r.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_classname_paren-r.m new file mode 100644 index 00000000..1076bbb3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_classname_paren-r.m @@ -0,0 +1,2 @@ +@interface TestObject(categoryName) <ProtocolName> : BaseClass +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_synchronized.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_synchronized.m new file mode 100644 index 00000000..e4de748b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/sp_oc_synchronized.m @@ -0,0 +1,11 @@ +- (void) unobserveAllKeyPaths { +@synchronized(self){ +} +} +#if 1 +#define SYNCHRONIZED_BEGIN(x) @synchronized(x) { +#define SYNCHRONIZED_END } +#else +#define SYNCHRONIZED_BEGIN(x) +#define SYNCHRONIZED_END +#endif diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/string.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/string.m new file mode 100644 index 00000000..f3fca80f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/string.m @@ -0,0 +1,11 @@ + +- (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); +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/ternary.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/ternary.m new file mode 100644 index 00000000..3fdddd93 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/ternary.m @@ -0,0 +1,5 @@ +NSString *str = (otherString ?: @"this is the placeholder"); +NSString *str2 = (str ? otherString : @"this is the other placeholder"); +NSString *str3 = str ? [[NSString alloc] initWithString:str] : @"this is the third placeholder"; +id str4 = str ? [self methodWithParameter1:@{@"bla": ({[self anotherMethod:@{@"id": @1}];})} + andParameter2:@{@"dict_key": @{@"nested_dict_key_1": @(1), @"nested_dict_key_2": @"colon:in:string"}}] : [self anotherMethod:str? @1 : @2];
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/typeof.m b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/typeof.m new file mode 100644 index 00000000..d5183a1d --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/oc/typeof.m @@ -0,0 +1,12 @@ +#import <Foundation/Foundation.m> + +@implementation MyViewController + +- (void)method1 { + __weak __typeof(self)weakSelf1 = self; + __weak typeof(self)weakSelf2 = self; + __weak MyViewController *weakSelf3 = self; + NSString* srcStr = [[NSString alloc] initWithBytes: kShaderSource length: sizeof(kShaderSource) encoding: NSASCIIStringEncoding]; +} + +@end diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/Issue_2586.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/Issue_2586.pawn new file mode 100644 index 00000000..89558691 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/Issue_2586.pawn @@ -0,0 +1,5 @@ +static stock const data[][] = +{ + {0b00000011001111000010011100000000, 0b00000011001111000010011100000000}, + {0b00000011001111000010011100000000, 0b00000011001111000010011100000000} +}; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/comment.p b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/comment.p new file mode 100644 index 00000000..785521ac --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/comment.p @@ -0,0 +1,38 @@ +/* parse C comments interactively, using events and a state machine */ +main() + state plain +@keypressed(key) <plain> + { + state (key == '/') slash + if (key != '/') + echo key + } +@keypressed(key) <slash> + { + state (key != '/') plain + state (key == '*') comment + echo '/' /* print '/' held back from previous state */ + if (key != '/') + echo key + } +@keypressed(key) <comment> + { + echo key + state (key == '*') star + } +@keypressed(key) <star> + { + echo key + state (key != '*') comment + state (key == '/') plain + } +echo(key) <plain, slash> + printchar key, yellow +echo(key) <comment, star> + printchar key, green +printchar(ch, colour) + { + setattr .foreground = colour + printf "%c", ch + } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/crusty_ex-1.sma b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/crusty_ex-1.sma new file mode 100644 index 00000000..35ee0515 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/crusty_ex-1.sma @@ -0,0 +1,26 @@ +public 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 +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/enum.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/enum.pawn new file mode 100644 index 00000000..588efc35 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/enum.pawn @@ -0,0 +1,82 @@ + +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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/functions.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/functions.pawn new file mode 100644 index 00000000..cdda5e05 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/functions.pawn @@ -0,0 +1,23 @@ + +// 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() +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/gh419.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/gh419.pawn new file mode 100644 index 00000000..9db7b08f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/gh419.pawn @@ -0,0 +1,8 @@ +#if AMXX_VERSION_NUM < 183 +public client_disconnect( player_id ) +#else +public client_disconnected( player_id ) +#endif +{ + +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/preproc.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/preproc.pawn new file mode 100644 index 00000000..e15d360e --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/preproc.pawn @@ -0,0 +1,7 @@ +#define SetTeleType(%1,%2) set_pev( %1, pev_iuser1, %2 ) +#define SetTeleMate(%1,%2) set_pev( %1, pev_iuser2, %2*7) + +#define x(%0,%1)\ + y(%1,%0) + +#emit CONST.pri 1911 diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/rpn_calc.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/rpn_calc.pawn new file mode 100644 index 00000000..2965d9c7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/rpn_calc.pawn @@ -0,0 +1,71 @@ +/* main rpn parser and lexical analysis, part of the RPN calculator */ +#include <rational> +#include <string> +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 + } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/str-escape.p b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/str-escape.p new file mode 100644 index 00000000..5600eae3 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/str-escape.p @@ -0,0 +1,6 @@ +main() +{ + printf "This is a testof the ^" alternate escape char, value 0x5e" + printf "If ^" it doesn't work, there ^"should be some errors" +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/switch-vsemi.sma b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/switch-vsemi.sma new file mode 100644 index 00000000..c2efacfb --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/switch-vsemi.sma @@ -0,0 +1,16 @@ +public plugin_init()
+{
+ new i=5
+
+ switch(i){
+ case 3: return false
+ case 5:
+ {
+ i = 6
+ return true
+ }
+ default: {
+ return true
+ }
+ }
+}
\ No newline at end of file diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/tags.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/tags.pawn new file mode 100644 index 00000000..4193b2a7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/tags.pawn @@ -0,0 +1,63 @@ + +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) diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/test1.pawn b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/test1.pawn new file mode 100644 index 00000000..ecefe6e0 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/test1.pawn @@ -0,0 +1,59 @@ + +#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++ + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/traffic.p b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/traffic.p new file mode 100644 index 00000000..f5cf0f7f --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/traffic.p @@ -0,0 +1,28 @@ +/* traffic light synchronizer, using states in an event-driven model */ +#include <time> +main() state green_wait +@keypressed(key) <green_wait> state yellow_wait +@keypressed(key) <red_walk, red_wait> state red_walk +@keypressed(key) <> {} /* fallback */ +@timer() <yellow_wait> state red_walk +@timer() <red_walk> state red_wait +@timer() <red_wait> state green_wait +@timer() <> {} /* fallback */ +entry() <green_wait> + print "Green / Don't walk\n" +entry() <yellow_wait> + { + print "Yellow / Don't walk\n" + settimer 2000 + } +entry() <red_walk> + { + print "Red / Walk\n" + settimer 5000 + } +entry() <red_wait> + { + print "Red / Don't walk\n" + settimer 2000 + } + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/unbraced.p b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/unbraced.p new file mode 100644 index 00000000..10c41663 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/pawn/unbraced.p @@ -0,0 +1,10 @@ + +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, _ }: ... ); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/issue_527.sqc b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/issue_527.sqc new file mode 100644 index 00000000..5514ff31 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/issue_527.sqc @@ -0,0 +1,17 @@ +void myfunc1()
+{
+ EXEC SQL create or replace
+ function my_func (in_str IN varchar2)
+ return date
+ IS
+ x date;
+ BEGIN
+ IF in_str IS NULL THEN
+ x: = NULL;
+ ELSIF substr(in_str, 5, 1) = '-' THEN
+ x := to_date(in_str, 'YYYY-MM-DD HH24:MI:SS');
+ END IF;
+ return x;
+ END my_func;
+ END-EXEC;
+}
diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/mysql.sqc b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/mysql.sqc new file mode 100644 index 00000000..197c2847 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/mysql.sqc @@ -0,0 +1,53 @@ +#include <stdlib.h> +#include <stdio.h> + +/*----------------------------------------------------------------*/ +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; + +/* dollar sign notation */ +$DECLARE cursorName CURSOR for + SELECT + a, + b + INTO + $struct->a, + $struct->b + FROM table; + +/*----------------------------------------------------------------*/ +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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/sta-select.sqc b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/sta-select.sqc new file mode 100644 index 00000000..863edf5b --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/sql/sta-select.sqc @@ -0,0 +1,74 @@ +/******************************************************* +** +** 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 <stdio.h> + +/* 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; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/Issue_2090.vala b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/Issue_2090.vala new file mode 100644 index 00000000..22698792 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/Issue_2090.vala @@ -0,0 +1 @@ +int? some_int = null; diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/Issue_2270.vala b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/Issue_2270.vala new file mode 100644 index 00000000..7bb897d8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/Issue_2270.vala @@ -0,0 +1 @@ +new Gtk.Label (_("Label text")); diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/advanced.vala b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/advanced.vala new file mode 100644 index 00000000..2b85c031 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/advanced.vala @@ -0,0 +1,26 @@ +/* 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; + } +} + diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/gh287.vala b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/gh287.vala new file mode 100644 index 00000000..fcb6fca6 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/gh287.vala @@ -0,0 +1,32 @@ +int main () { + key_press_event.connect ((e) => { + switch (e.keyval) { + case Gdk.Key.@0: + if ((e.state & Gdk.ModifierType.CONTROL_MASK) != 0) { + action_zoom_default_font (); + return true; + } + + break; + case Gdk.Key.@1: //alt+[1-8] + case Gdk.Key.@7: + case Gdk.Key.@8: + if (((e.state & Gdk.ModifierType.MOD1_MASK) != 0) && settings.alt_changes_tab) { + var i = e.keyval - 49; + if (i > notebook.n_tabs - 1) + return false; + + notebook.current = notebook.get_tab_by_index ((int) i); + return true; + } + + break; + default: + assert_not_reached () ; + } + + return false; + }); + + return 0 ; + } diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/list.vala b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/list.vala new file mode 100644 index 00000000..e9b48acc --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/list.vala @@ -0,0 +1,20 @@ + + +using GLib; + +public class GListTest : Object +{ + public GListTest { } + + static int main (string[] args) { + List<string> 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); + } + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/preproc.vala b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/preproc.vala new file mode 100644 index 00000000..3ab2ccc8 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/preproc.vala @@ -0,0 +1,10 @@ +int main () { +#if WANT_TO_COMPILE_THIS +gtkwidget.clicked.connect( (widdget) => { message ("Clicked" ) ; }) ; +#else +gtkwidget.enabled.connect( (widdget) => { +message ("Clicked" ) ; +}) ; +#endif +return 0 ; +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/verbatim_str.vala b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/verbatim_str.vala new file mode 100644 index 00000000..11f19c01 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/verbatim_str.vala @@ -0,0 +1,31 @@ +/* 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) { + string sql = """ SELECT name "my_name" + FROM table + WHERE id='4' + """ ; + var where = """ WHERE name LIKE '%blah% + """ ; + 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; + } +} diff --git a/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/verbatim_str2.vala b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/verbatim_str2.vala new file mode 100644 index 00000000..9d8798b7 --- /dev/null +++ b/debian/uncrustify-trinity/uncrustify-trinity-0.72.0/tests/input/vala/verbatim_str2.vala @@ -0,0 +1,34 @@ +/* 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) { + string sql = """SELECT name "my_name" + FROM table + WHERE id='4' +""" ; + var where = """ WHERE name LIKE '%blah% + """ ; + foreach (string arg in args) { + var sample = new Sample (arg); + sample.run (); + /* Object will automatically be freed + * at the end of the block + * a tab b + * c tab d + */ + } + return 0; + } +} |