Bjorn Reese | 70a9da5 | 2001-04-21 16:57:29 +0000 | [diff] [blame] | 1 | /************************************************************************* |
| 2 | * |
| 3 | * $Id$ |
| 4 | * |
| 5 | * Copyright (C) 2000 Bjorn Reese and Daniel Stenberg. |
| 6 | * |
| 7 | * Permission to use, copy, modify, and distribute this software for any |
| 8 | * purpose with or without fee is hereby granted, provided that the above |
| 9 | * copyright notice and this permission notice appear in all copies. |
| 10 | * |
| 11 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED |
| 12 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
| 13 | * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND |
| 14 | * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. |
| 15 | * |
| 16 | ************************************************************************ |
| 17 | * |
| 18 | * Private functions, types, etc. used for callback functions. |
| 19 | * |
| 20 | * The ref pointer is an opaque type and should remain as such. |
| 21 | * Private data must only be accessible through the getter and |
| 22 | * setter functions. |
| 23 | * |
| 24 | ************************************************************************/ |
| 25 | |
| 26 | #ifndef TRIO_TRIOP_H |
| 27 | #define TRIO_TRIOP_H |
| 28 | |
| 29 | #if defined(__STDC__) && (__STDC_VERSION__ >= 199901L) |
| 30 | # define TRIO_C99 |
| 31 | #endif |
| 32 | #define TRIO_BSD |
| 33 | #define TRIO_GNU |
| 34 | #define TRIO_MISC |
| 35 | #define TRIO_UNIX98 |
| 36 | #define TRIO_EXTENSION |
| 37 | #define TRIO_ERRORS |
| 38 | |
| 39 | |
| 40 | typedef int (*trio_callback_t)(void *ref); |
| 41 | |
| 42 | void *trio_register(trio_callback_t callback, const char *name); |
| 43 | void trio_unregister(void *handle); |
| 44 | |
| 45 | const char *trio_get_format(void *ref); |
| 46 | void *trio_get_argument(void *ref); |
| 47 | |
| 48 | /* Modifiers */ |
| 49 | int trio_get_width(void *ref); |
| 50 | void trio_set_width(void *ref, int width); |
| 51 | int trio_get_precision(void *ref); |
| 52 | void trio_set_precision(void *ref, int precision); |
| 53 | int trio_get_base(void *ref); |
| 54 | void trio_set_base(void *ref, int base); |
| 55 | int trio_get_padding(void *ref); |
| 56 | void trio_set_padding(void *ref, int is_padding); |
| 57 | int trio_get_short(void *ref); /* h */ |
| 58 | void trio_set_shortshort(void *ref, int is_shortshort); |
| 59 | int trio_get_shortshort(void *ref); /* hh */ |
| 60 | void trio_set_short(void *ref, int is_short); |
| 61 | int trio_get_long(void *ref); /* l */ |
| 62 | void trio_set_long(void *ref, int is_long); |
| 63 | int trio_get_longlong(void *ref); /* ll */ |
| 64 | void trio_set_longlong(void *ref, int is_longlong); |
| 65 | int trio_get_longdouble(void *ref); /* L */ |
| 66 | void trio_set_longdouble(void *ref, int is_longdouble); |
| 67 | int trio_get_alternative(void *ref); /* # */ |
| 68 | void trio_set_alternative(void *ref, int is_alternative); |
| 69 | int trio_get_alignment(void *ref); /* - */ |
| 70 | void trio_set_alignment(void *ref, int is_leftaligned); |
| 71 | int trio_get_spacing(void *ref); /* (space) */ |
| 72 | void trio_set_spacing(void *ref, int is_space); |
| 73 | int trio_get_sign(void *ref); /* + */ |
| 74 | void trio_set_sign(void *ref, int is_showsign); |
| 75 | int trio_get_quote(void *ref); /* ' */ |
| 76 | void trio_set_quote(void *ref, int is_quote); |
| 77 | int trio_get_upper(void *ref); |
| 78 | void trio_set_upper(void *ref, int is_upper); |
| 79 | #if defined(TRIO_C99) |
| 80 | int trio_get_largest(void *ref); /* j */ |
| 81 | void trio_set_largest(void *ref, int is_largest); |
| 82 | int trio_get_ptrdiff(void *ref); /* t */ |
| 83 | void trio_set_ptrdiff(void *ref, int is_ptrdiff); |
| 84 | int trio_get_size(void *ref); /* z / Z */ |
| 85 | void trio_set_size(void *ref, int is_size); |
| 86 | #endif |
| 87 | |
| 88 | /* Printing */ |
| 89 | int trio_print_ref(void *ref, const char *format, ...); |
| 90 | int trio_vprint_ref(void *ref, const char *format, va_list args); |
| 91 | int trio_printv_ref(void *ref, const char *format, void **args); |
| 92 | |
| 93 | void trio_print_int(void *ref, int number); |
| 94 | void trio_print_uint(void *ref, unsigned int number); |
| 95 | /* void trio_print_long(void *ref, long number); */ |
| 96 | /* void trio_print_ulong(void *ref, unsigned long number); */ |
| 97 | void trio_print_double(void *ref, double number); |
| 98 | void trio_print_string(void *ref, char *string); |
| 99 | void trio_print_pointer(void *ref, void *pointer); |
| 100 | |
| 101 | #endif /* TRIO_TRIOP_H */ |