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 | #include "triodef.h" |
30 | |
31 | #include <stdlib.h> |
32 | #if defined(TRIO_COMPILER_ANCIENT) |
33 | # include <varargs.h> |
34 | #else |
35 | # include <stdarg.h> |
36 | #endif |
37 | |
38 | #ifdef __cplusplus |
39 | extern "C" { |
40 | #endif |
41 | |
42 | #ifndef TRIO_C99 |
43 | # define TRIO_C99 1 |
44 | #endif |
45 | #ifndef TRIO_BSD |
46 | # define TRIO_BSD 1 |
47 | #endif |
48 | #ifndef TRIO_GNU |
49 | # define TRIO_GNU 1 |
50 | #endif |
51 | #ifndef TRIO_MISC |
52 | # define TRIO_MISC 1 |
53 | #endif |
54 | #ifndef TRIO_UNIX98 |
55 | # define TRIO_UNIX98 1 |
56 | #endif |
57 | #ifndef TRIO_MICROSOFT |
58 | # define TRIO_MICROSOFT 1 |
59 | #endif |
60 | #ifndef TRIO_EXTENSION |
61 | # define TRIO_EXTENSION 1 |
62 | #endif |
63 | #ifndef TRIO_WIDECHAR /* Does not work yet. Do not enable */ |
64 | # define TRIO_WIDECHAR 0 |
65 | #endif |
66 | #ifndef TRIO_ERRORS |
67 | # define TRIO_ERRORS 1 |
68 | #endif |
69 | |
70 | #ifndef TRIO_MALLOC |
71 | # define TRIO_MALLOC(n) malloc(n) |
72 | #endif |
73 | #ifndef TRIO_REALLOC |
74 | # define TRIO_REALLOC(x,n) realloc((x),(n)) |
75 | #endif |
76 | #ifndef TRIO_FREE |
77 | # define TRIO_FREE(x) free(x) |
78 | #endif |
79 | |
80 | |
81 | /************************************************************************* |
82 | * User-defined specifiers |
83 | */ |
84 | |
85 | typedef int (*trio_callback_t) TRIO_PROTO((trio_pointer_t)); |
86 | |
87 | trio_pointer_t trio_register TRIO_PROTO((trio_callback_t callback, const char *name)); |
88 | void trio_unregister TRIO_PROTO((trio_pointer_t handle)); |
89 | |
90 | TRIO_CONST char *trio_get_format TRIO_PROTO((trio_pointer_t ref)); |
91 | trio_pointer_t trio_get_argument TRIO_PROTO((trio_pointer_t ref)); |
92 | |
93 | /* Modifiers */ |
94 | int trio_get_width TRIO_PROTO((trio_pointer_t ref)); |
95 | void trio_set_width TRIO_PROTO((trio_pointer_t ref, int width)); |
96 | int trio_get_precision TRIO_PROTO((trio_pointer_t ref)); |
97 | void trio_set_precision TRIO_PROTO((trio_pointer_t ref, int precision)); |
98 | int trio_get_base TRIO_PROTO((trio_pointer_t ref)); |
99 | void trio_set_base TRIO_PROTO((trio_pointer_t ref, int base)); |
100 | int trio_get_padding TRIO_PROTO((trio_pointer_t ref)); |
101 | void trio_set_padding TRIO_PROTO((trio_pointer_t ref, int is_padding)); |
102 | int trio_get_short TRIO_PROTO((trio_pointer_t ref)); /* h */ |
103 | void trio_set_shortshort TRIO_PROTO((trio_pointer_t ref, int is_shortshort)); |
104 | int trio_get_shortshort TRIO_PROTO((trio_pointer_t ref)); /* hh */ |
105 | void trio_set_short TRIO_PROTO((trio_pointer_t ref, int is_short)); |
106 | int trio_get_long TRIO_PROTO((trio_pointer_t ref)); /* l */ |
107 | void trio_set_long TRIO_PROTO((trio_pointer_t ref, int is_long)); |
108 | int trio_get_longlong TRIO_PROTO((trio_pointer_t ref)); /* ll */ |
109 | void trio_set_longlong TRIO_PROTO((trio_pointer_t ref, int is_longlong)); |
110 | int trio_get_longdouble TRIO_PROTO((trio_pointer_t ref)); /* L */ |
111 | void trio_set_longdouble TRIO_PROTO((trio_pointer_t ref, int is_longdouble)); |
112 | int trio_get_alternative TRIO_PROTO((trio_pointer_t ref)); /* # */ |
113 | void trio_set_alternative TRIO_PROTO((trio_pointer_t ref, int is_alternative)); |
114 | int trio_get_alignment TRIO_PROTO((trio_pointer_t ref)); /* - */ |
115 | void trio_set_alignment TRIO_PROTO((trio_pointer_t ref, int is_leftaligned)); |
116 | int trio_get_spacing TRIO_PROTO((trio_pointer_t ref)); /* TRIO_PROTO((space) */ |
117 | void trio_set_spacing TRIO_PROTO((trio_pointer_t ref, int is_space)); |
118 | int trio_get_sign TRIO_PROTO((trio_pointer_t ref)); /* + */ |
119 | void trio_set_sign TRIO_PROTO((trio_pointer_t ref, int is_showsign)); |
120 | int trio_get_quote TRIO_PROTO((trio_pointer_t ref)); /* ' */ |
121 | void trio_set_quote TRIO_PROTO((trio_pointer_t ref, int is_quote)); |
122 | int trio_get_upper TRIO_PROTO((trio_pointer_t ref)); |
123 | void trio_set_upper TRIO_PROTO((trio_pointer_t ref, int is_upper)); |
124 | #if TRIO_C99 |
125 | int trio_get_largest TRIO_PROTO((trio_pointer_t ref)); /* j */ |
126 | void trio_set_largest TRIO_PROTO((trio_pointer_t ref, int is_largest)); |
127 | int trio_get_ptrdiff TRIO_PROTO((trio_pointer_t ref)); /* t */ |
128 | void trio_set_ptrdiff TRIO_PROTO((trio_pointer_t ref, int is_ptrdiff)); |
129 | int trio_get_size TRIO_PROTO((trio_pointer_t ref)); /* z / Z */ |
130 | void trio_set_size TRIO_PROTO((trio_pointer_t ref, int is_size)); |
131 | #endif |
132 | |
133 | /* Printing */ |
134 | int trio_print_ref TRIO_PROTO((trio_pointer_t ref, const char *format, ...)); |
135 | int trio_vprint_ref TRIO_PROTO((trio_pointer_t ref, const char *format, va_list args)); |
136 | int trio_printv_ref TRIO_PROTO((trio_pointer_t ref, const char *format, trio_pointer_t *args)); |
137 | |
138 | void trio_print_int TRIO_PROTO((trio_pointer_t ref, int number)); |
139 | void trio_print_uint TRIO_PROTO((trio_pointer_t ref, unsigned int number)); |
140 | /* void trio_print_long TRIO_PROTO((trio_pointer_t ref, long number)); */ |
141 | /* void trio_print_ulong TRIO_PROTO((trio_pointer_t ref, unsigned long number)); */ |
142 | void trio_print_double TRIO_PROTO((trio_pointer_t ref, double number)); |
143 | void trio_print_string TRIO_PROTO((trio_pointer_t ref, char *string)); |
144 | void trio_print_pointer TRIO_PROTO((trio_pointer_t ref, trio_pointer_t pointer)); |
145 | |
146 | #ifdef __cplusplus |
147 | } /* extern "C" */ |
148 | #endif |
149 | |
150 | #endif /* TRIO_TRIOP_H */ |
151 | |