1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- // C source file with the BASIC_TYPES.h function implementations
- // print_byte_dec()
- umax print_byte_dec(byte * src, umax size)
- {
- // check params
- if (src == NULL || size < BYTE_SIZE)
- return 0;
- printf("%u", *src);
- return BYTE_SIZE;
- }
- // print_byte_hex()
- umax print_byte_hex(byte * src, umax size)
- {
- // check params
- if (src == NULL || size < BYTE_SIZE)
- return 0;
- printf("%02X", *src);
- return BYTE_SIZE;
- }
- // print_char()
- umax print_char(byte * src, umax size)
- {
- // check params
- if (src == NULL || size < CHAR_SIZE)
- return 0;
- printf("%c", (char) *src);
- return CHAR_SIZE;
- }
- // print_umax_dec()
- umax print_umax_dec(byte * src, umax size)
- {
- // check params
- if (src == NULL || size < UMAX_SIZE)
- return 0;
- printf("%llu", *((umax *) src));
- return UMAX_SIZE;
- }
- // print_umax_hex()
- umax print_umax_hex(byte * src, umax size)
- {
- // check params
- if (src == NULL || size < UMAX_SIZE)
- return 0;
- printf("%llX", *((umax *) src));
- return UMAX_SIZE;
- }
- // print_smax()
- umax print_smax(byte * src, umax size)
- {
- // check params
- if (src == NULL || size < SMAX_SIZE)
- return 0;
- printf("%lld", *((smax *) src));
- return SMAX_SIZE;
- }
- // print_fmax()
- umax print_fmax(byte * src, umax size)
- {
- // check params
- if (src == NULL || size < FMAX_SIZE)
- return 0;
- printf("%lf", *((fmax *) src));
- return FMAX_SIZE;
- }
- // print_bool()
- umax print_bool(byte * src, umax size)
- {
- // check params
- if (src == NULL || size < BOOL_SIZE)
- return 0;
- printf("%d", *((bool *) src));
- return BOOL_SIZE;
- }
|