Changeset d16fc78 in mainline
- Timestamp:
- 2010-11-26T01:07:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 855e0d8
- Parents:
- 1e27d85
- Files:
-
- 4 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/generic/include/printf.h
r1e27d85 rd16fc78 36 36 #include <stdarg.h> 37 37 38 #ifndef NVERIFY_PRINTF 39 40 #define PRINTF_ATTRIBUTE(start, end) \ 41 __attribute__((format(gnu_printf, start, end))) 42 43 #else /* NVERIFY_PRINTF */ 44 45 #define PRINTF_ATTRIBUTE(start, end) 46 47 #endif /* NVERIFY_PRINTF */ 48 38 49 #define EOF (-1) 39 50 40 51 extern int puts(const char *); 41 extern int printf(const char *, ...); 52 extern int printf(const char *, ...) 53 PRINTF_ATTRIBUTE(1, 2); 42 54 extern int vprintf(const char *, va_list); 43 55 -
kernel/generic/include/print.h
r1e27d85 rd16fc78 39 39 #include <stdarg.h> 40 40 41 #ifndef NVERIFY_PRINTF 42 43 #define PRINTF_ATTRIBUTE(start, end) \ 44 __attribute__((format(gnu_printf, start, end))) 45 46 #else /* NVERIFY_PRINTF */ 47 48 #define PRINTF_ATTRIBUTE(start, end) 49 50 #endif /* NVERIFY_PRINTF */ 51 41 52 #define EOF (-1) 42 53 43 54 extern int puts(const char *s); 44 extern int printf(const char *fmt, ...); 45 extern int snprintf(char *str, size_t size, const char *fmt, ...); 55 extern int printf(const char *fmt, ...) 56 PRINTF_ATTRIBUTE(1, 2); 57 extern int snprintf(char *str, size_t size, const char *fmt, ...) 58 PRINTF_ATTRIBUTE(3, 4); 46 59 47 60 extern int vprintf(const char *fmt, va_list ap); -
kernel/test/print/print1.c
r1e27d85 rd16fc78 48 48 TPRINTF("Real output: \"%8.10s\"\n\n", "very long text"); 49 49 50 TPRINTF("Testing printf(\"%%s\", NULL):\n");51 TPRINTF("Expected output: \"(NULL)\"\n");52 TPRINTF("Real output: \"%s\"\n\n", NULL);53 54 50 return NULL; 55 51 } -
kernel/test/print/print2.c
r1e27d85 rd16fc78 32 32 const char *test_print2(void) 33 33 { 34 TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");35 TPRINTF("Expected output: [a] [ b] [c ] [ d] [e ]\n");36 TPRINTF("Real output: [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');34 TPRINTF("Testing printf(\"%%c\", 'a'):\n"); 35 TPRINTF("Expected output: [a]\n"); 36 TPRINTF("Real output: [%c]\n\n", 'a'); 37 37 38 38 TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n"); … … 48 48 TPRINTF("Real output: [%#x] [%#5.3x] [%#-5.3x] [%#3.5x] [%#-3.5x]\n\n", 17, 18, 19, 20, 21); 49 49 50 unative_t nat = 0x12345678u;50 unative_t nat = UINTN_C(0x12345678); 51 51 52 TPRINTF("Testing printf(\"%%#" PRIx64 " %%#" PRIx32 " %%#" PRIx16 " %%#" PRIx8 " %%#" PRIxn " %%#" PRIx64 " %%s\", 0x1234567887654321ll, 0x12345678, 0x1234, 0x12, nat, 0x1234567887654321ull, \"Lovely string\"):\n");52 TPRINTF("Testing printf(\"%%#" PRIx64 " %%#" PRIx32 " %%#" PRIx16 " %%#" PRIx8 " %%#" PRIxn " %%#" PRIx64 " %%s\", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), \"Lovely string\"):\n"); 53 53 TPRINTF("Expected output: [0x1234567887654321] [0x12345678] [0x1234] [0x12] [0x12345678] [0x1234567887654321] \"Lovely string\"\n"); 54 TPRINTF("Real output: [%#" PRIx64 "] [%#" PRIx32 "] [%#" PRIx16 "] [%#" PRIx8 "] [%#" PRIxn "] [%#" PRIx64 "] \"%s\"\n\n", 0x1234567887654321ll, 0x12345678, 0x1234, 0x12, nat, 0x1234567887654321ull, "Lovely string");54 TPRINTF("Real output: [%#" PRIx64 "] [%#" PRIx32 "] [%#" PRIx16 "] [%#" PRIx8 "] [%#" PRIxn "] [%#" PRIx64 "] \"%s\"\n\n", (uint64_t) UINT64_C(0x1234567887654321), (uint32_t) UINT32_C(0x12345678), (uint16_t) UINT16_C(0x1234), (uint8_t) UINT8_C(0x12), nat, (uint64_t) UINT64_C(0x1234567887654321), "Lovely string"); 55 55 56 56 return NULL; -
kernel/test/print/print4.c
r1e27d85 rd16fc78 44 44 TPRINTF(" "); 45 45 for (index = 0; index < 32; index++) 46 TPRINTF("%lc", (w char_t) ((group << 5) + index));46 TPRINTF("%lc", (wint_t) ((group << 5) + index)); 47 47 48 48 TPRINTF("\n"); … … 56 56 uint8_t index; 57 57 for (index = 0; index < 32; index++) 58 TPRINTF("%lc", (w char_t) ((group << 5) + index));58 TPRINTF("%lc", (wint_t) ((group << 5) + index)); 59 59 60 60 TPRINTF("\n"); -
uspace/app/tester/print/print1.c
r1e27d85 rd16fc78 49 49 TPRINTF("Real output: \"%8.10s\"\n\n", "very long text"); 50 50 51 TPRINTF("Testing printf(\"%%s\", NULL):\n");52 TPRINTF("Expected output: \"(NULL)\"\n");53 TPRINTF("Real output: \"%s\"\n\n", NULL);54 55 51 return NULL; 56 52 } -
uspace/app/tester/print/print2.c
r1e27d85 rd16fc78 33 33 const char *test_print2(void) 34 34 { 35 TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");36 TPRINTF("Expected output: [a] [ b] [c ] [ d] [e ]\n");37 TPRINTF("Real output: [%c] [%3.2c] [%-3.2c] [%2.3c] [%-2.3c]\n\n", 'a', 'b', 'c', 'd', 'e');35 TPRINTF("Testing printf(\"%%c\", 'a'):\n"); 36 TPRINTF("Expected output: [a]\n"); 37 TPRINTF("Real output: [%c]\n\n", 'a'); 38 38 39 39 TPRINTF("Testing printf(\"%%d %%3.2d %%-3.2d %%2.3d %%-2.3d\", 1, 2, 3, 4, 5):\n"); -
uspace/app/tester/print/print4.c
r1e27d85 rd16fc78 45 45 TPRINTF(" "); 46 46 for (index = 0; index < 32; index++) 47 TPRINTF("%lc", (w char_t) ((group << 5) + index));47 TPRINTF("%lc", (wint_t) ((group << 5) + index)); 48 48 49 49 TPRINTF("\n"); … … 57 57 uint8_t index; 58 58 for (index = 0; index < 32; index++) 59 TPRINTF("%lc", (w char_t) ((group << 5) + index));59 TPRINTF("%lc", (wint_t) ((group << 5) + index)); 60 60 61 61 TPRINTF("\n");
Note:
See TracChangeset
for help on using the changeset viewer.