|
| 1 | +#pragma once |
| 2 | +#include<stdio.h> |
| 3 | +//This is only for C11 for better type safety. However. macro is dangerous. Use at your own risk |
| 4 | + |
| 5 | +#ifdef __cplusplus |
| 6 | +extern "C" |
| 7 | +{ |
| 8 | +#endif |
| 9 | + |
| 10 | +void cxx_fast_io_fp_print_char(FILE*,char); |
| 11 | +void cxx_fast_io_fp_println_char(FILE*,char); |
| 12 | +void cxx_fast_io_fp_unlocked_print_char(FILE*,char); |
| 13 | +void cxx_fast_io_fp_unlocked_println_char(FILE*,char); |
| 14 | +void cxx_fast_io_fp_print_short(FILE*,short); |
| 15 | +void cxx_fast_io_fp_println_short(FILE*,short); |
| 16 | +void cxx_fast_io_fp_unlocked_print_short(FILE*,short); |
| 17 | +void cxx_fast_io_fp_unlocked_println_short(FILE*,short); |
| 18 | +void cxx_fast_io_fp_print_int(FILE*,int); |
| 19 | +void cxx_fast_io_fp_println_int(FILE*,int); |
| 20 | +void cxx_fast_io_fp_unlocked_print_int(FILE*,int); |
| 21 | +void cxx_fast_io_fp_unlocked_println_int(FILE*,int); |
| 22 | +void cxx_fast_io_fp_print_long(FILE*,long); |
| 23 | +void cxx_fast_io_fp_println_long(FILE*,long); |
| 24 | +void cxx_fast_io_fp_unlocked_print_long(FILE*,long); |
| 25 | +void cxx_fast_io_fp_unlocked_println_long(FILE*,long); |
| 26 | +void cxx_fast_io_fp_print_long_long(FILE*,long long); |
| 27 | +void cxx_fast_io_fp_println_long_long(FILE*,long long); |
| 28 | +void cxx_fast_io_fp_unlocked_print_long_long(FILE*,long long); |
| 29 | +void cxx_fast_io_fp_unlocked_println_long_long(FILE*,long long); |
| 30 | +void cxx_fast_io_fp_print_char_unsigned(FILE*,char unsigned); |
| 31 | +void cxx_fast_io_fp_println_char_unsigned(FILE*,char unsigned); |
| 32 | +void cxx_fast_io_fp_unlocked_print_char_unsigned(FILE*,char unsigned); |
| 33 | +void cxx_fast_io_fp_unlocked_println_char_unsigned(FILE*,char unsigned); |
| 34 | +void cxx_fast_io_fp_print_short_unsigned(FILE*,short unsigned); |
| 35 | +void cxx_fast_io_fp_println_short_unsigned(FILE*,short unsigned); |
| 36 | +void cxx_fast_io_fp_unlocked_print_short_unsigned(FILE*,short unsigned); |
| 37 | +void cxx_fast_io_fp_unlocked_println_short_unsigned(FILE*,short unsigned); |
| 38 | +void cxx_fast_io_fp_print_int_unsigned(FILE*,int unsigned); |
| 39 | +void cxx_fast_io_fp_println_int_unsigned(FILE*,int unsigned); |
| 40 | +void cxx_fast_io_fp_unlocked_print_int_unsigned(FILE*,int unsigned); |
| 41 | +void cxx_fast_io_fp_unlocked_println_int_unsigned(FILE*,int unsigned); |
| 42 | +void cxx_fast_io_fp_print_long_unsigned(FILE*,long unsigned); |
| 43 | +void cxx_fast_io_fp_println_long_unsigned(FILE*,long unsigned); |
| 44 | +void cxx_fast_io_fp_unlocked_print_long_unsigned(FILE*,long unsigned); |
| 45 | +void cxx_fast_io_fp_unlocked_println_long_unsigned(FILE*,long unsigned); |
| 46 | +void cxx_fast_io_fp_print_long_long_unsigned(FILE*,long long unsigned); |
| 47 | +void cxx_fast_io_fp_println_long_long_unsigned(FILE*,long long unsigned); |
| 48 | +void cxx_fast_io_fp_unlocked_print_long_long_unsigned(FILE*,long long unsigned); |
| 49 | +void cxx_fast_io_fp_unlocked_println_long_long_unsigned(FILE*,long long unsigned); |
| 50 | +void cxx_fast_io_fp_print_double(FILE*,double); |
| 51 | +void cxx_fast_io_fp_println_double(FILE*,double); |
| 52 | +void cxx_fast_io_fp_unlocked_print_double(FILE*,double); |
| 53 | +void cxx_fast_io_fp_unlocked_println_double(FILE*,double); |
| 54 | +void cxx_fast_io_fp_print_c_str(FILE*,char const*); |
| 55 | +void cxx_fast_io_fp_println_c_str(FILE*,char const*); |
| 56 | +void cxx_fast_io_fp_unlocked_print_c_str(FILE*,char const*); |
| 57 | +void cxx_fast_io_fp_unlocked_println_c_str(FILE*,char const*); |
| 58 | + |
| 59 | + |
| 60 | +#ifdef __cplusplus |
| 61 | +} |
| 62 | +#else |
| 63 | + |
| 64 | +#define PRINT(fp,x) _Generic((x) ,char:cxx_fast_io_fp_print_char\ |
| 65 | +,short:cxx_fast_io_fp_print_short\ |
| 66 | +,int:cxx_fast_io_fp_print_int\ |
| 67 | +,long:cxx_fast_io_fp_print_long\ |
| 68 | +,long long:cxx_fast_io_fp_print_long_long\ |
| 69 | +,char unsigned:cxx_fast_io_fp_print_char_unsigned\ |
| 70 | +,short unsigned:cxx_fast_io_fp_print_short_unsigned\ |
| 71 | +,int unsigned:cxx_fast_io_fp_print_int_unsigned\ |
| 72 | +,long unsigned:cxx_fast_io_fp_print_long_unsigned\ |
| 73 | +,long long unsigned:cxx_fast_io_fp_print_long_long_unsigned\ |
| 74 | +,double:cxx_fast_io_fp_print_double\ |
| 75 | +,char*:cxx_fast_io_fp_print_c_str)(fp,x) |
| 76 | + |
| 77 | +#define PRINTLN(fp,x) _Generic((x) ,char:cxx_fast_io_fp_println_char\ |
| 78 | +,short:cxx_fast_io_fp_println_short\ |
| 79 | +,int:cxx_fast_io_fp_println_int\ |
| 80 | +,long:cxx_fast_io_fp_println_long\ |
| 81 | +,long long:cxx_fast_io_fp_println_long_long\ |
| 82 | +,char unsigned:cxx_fast_io_fp_println_char_unsigned\ |
| 83 | +,short unsigned:cxx_fast_io_fp_println_short_unsigned\ |
| 84 | +,int unsigned:cxx_fast_io_fp_println_int_unsigned\ |
| 85 | +,long unsigned:cxx_fast_io_fp_println_long_unsigned\ |
| 86 | +,long long unsigned:cxx_fast_io_fp_println_long_long_unsigned\ |
| 87 | +,double:cxx_fast_io_fp_println_double\ |
| 88 | +,char*:cxx_fast_io_fp_println_c_str)(fp,x) |
| 89 | + |
| 90 | +#define PRINT_UNLOCKED(fp,x) _Generic((x) ,char:cxx_fast_io_fp_print_unlocked_char\ |
| 91 | +,short:cxx_fast_io_fp_print_unlocked_short\ |
| 92 | +,int:cxx_fast_io_fp_print_unlocked_int\ |
| 93 | +,long:cxx_fast_io_fp_print_unlocked_long\ |
| 94 | +,long long:cxx_fast_io_fp_print_unlocked_long_long\ |
| 95 | +,char unsigned:cxx_fast_io_fp_print_unlocked_char_unsigned\ |
| 96 | +,short unsigned:cxx_fast_io_fp_print_unlocked_short_unsigned\ |
| 97 | +,int unsigned:cxx_fast_io_fp_print_unlocked_int_unsigned\ |
| 98 | +,long unsigned:cxx_fast_io_fp_print_unlocked_long_unsigned\ |
| 99 | +,long long unsigned:cxx_fast_io_fp_print_unlocked_long_long_unsigned\ |
| 100 | +,double:cxx_fast_io_fp_print_unlocked_double\ |
| 101 | +,char*:cxx_fast_io_fp_print_unlocked_c_str)(fp,x) |
| 102 | + |
| 103 | +#define PRINTLN_UNLOCKED(fp,x) _Generic((x) ,char:cxx_fast_io_fp_unlocked_println_char\ |
| 104 | +,short:cxx_fast_io_fp_unlocked_println_short\ |
| 105 | +,int:cxx_fast_io_fp_unlocked_println_int\ |
| 106 | +,long:cxx_fast_io_fp_unlocked_println_long\ |
| 107 | +,long long:cxx_fast_io_fp_unlocked_println_long_long\ |
| 108 | +,char unsigned:cxx_fast_io_fp_unlocked_println_char_unsigned\ |
| 109 | +,short unsigned:cxx_fast_io_fp_unlocked_println_short_unsigned\ |
| 110 | +,int unsigned:cxx_fast_io_fp_unlocked_println_int_unsigned\ |
| 111 | +,long unsigned:cxx_fast_io_fp_unlocked_println_long_unsigned\ |
| 112 | +,long long unsigned:cxx_fast_io_fp_unlocked_println_long_long_unsigned\ |
| 113 | +,double:cxx_fast_io_fp_unlocked_println_double\ |
| 114 | +,char*:cxx_fast_io_fp_unlocked_println_c_str)(fp,x) |
| 115 | +#endif |
0 commit comments