|
|
1.1 root 1: /* xpprintf.h */
2:
3: /* Deuce's vs[n]printf() replacement */
4:
5: /* $Id: xpprintf.h,v 1.12 2006/12/21 21:26:31 deuce Exp $ */
6:
7: /****************************************************************************
8: * @format.tab-size 4 (Plain Text/Source Code File Header) *
9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
10: * *
11: * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
12: * *
13: * This library is free software; you can redistribute it and/or *
14: * modify it under the terms of the GNU Lesser General Public License *
15: * as published by the Free Software Foundation; either version 2 *
16: * of the License, or (at your option) any later version. *
17: * See the GNU Lesser General Public License for more details: lgpl.txt or *
18: * http://www.fsf.org/copyleft/lesser.html *
19: * *
20: * Anonymous FTP access to the most recent released source is available at *
21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
22: * *
23: * Anonymous CVS access to the development source and modification history *
24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
26: * (just hit return, no password is necessary) *
27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
28: * *
29: * For Synchronet coding style and modification guidelines, see *
30: * http://www.synchro.net/source.html *
31: * *
32: * You are encouraged to submit any modifications (preferably in Unix diff *
33: * format) via e-mail to [email protected] *
34: * *
35: * Note: If this box doesn't appear square, then you need to fix your tabs. *
36: ****************************************************************************/
37:
38:
39: #ifndef _XPPRINTF_H_
40: #define _XPPRINTF_H_
41:
42: #include <stdarg.h>
43:
44: /* Supported printf argument types */
45: #define XP_PRINTF_TYPE_AUTO 0
46: #define XP_PRINTF_TYPE_INT 1
47: #define XP_PRINTF_TYPE_UINT 2
48: #define XP_PRINTF_TYPE_CHAR 3 /* Assumes a signed char */
49: #define XP_PRINTF_TYPE_SCHAR XP_PRINTF_TYPE_INT
50: #define XP_PRINTF_TYPE_UCHAR XP_PRINTF_TYPE_UINT
51: #define XP_PRINTF_TYPE_SHORT XP_PRINTF_TYPE_INT
52: #define XP_PRINTF_TYPE_USHORT XP_PRINTF_TYPE_UINT
53: #define XP_PRINTF_TYPE_LONG 4
54: #define XP_PRINTF_TYPE_ULONG 5
55: #if !defined(_MSC_VER) && !defined(__BORLANDC__)
56: #define XP_PRINTF_TYPE_LONGLONG 6
57: #define XP_PRINTF_TYPE_ULONGLONG 7
58: #endif
59: #define XP_PRINTF_TYPE_CHARP 8
60: #define XP_PRINTF_TYPE_DOUBLE 9
61: #define XP_PRINTF_TYPE_FLOAT XP_PRINTF_TYPE_DOUBLE /* Floats are promoted to doubles */
62: #define XP_PRINTF_TYPE_LONGDOUBLE 10
63: #define XP_PRINTF_TYPE_VOIDP 11
64: #define XP_PRINTF_TYPE_INTMAX 12 /* Not currently implemented */
65: #define XP_PRINTF_TYPE_UINTMAX 13 /* Not currently implemented */
66: #define XP_PRINTF_TYPE_PTRDIFF 14 /* Not currently implemented */
67: #define XP_PRINTF_TYPE_SIZET 15
68:
69: #define XP_PRINTF_CONVERT (1<<31) /* OR with type to request a conversion - Not implemented */
70:
71: #if defined(__cplusplus)
72: extern "C" {
73: #endif
74: void xp_asprintf_free(char *format);
75: char *xp_asprintf_start(const char *format);
76: char *xp_asprintf_next(char *format, int type, ...);
77: char *xp_asprintf_end(char *format, size_t *endlen);
78: char *xp_asprintf(const char *format, ...);
79: char *xp_vasprintf(const char *format, va_list va);
80: int xp_printf_get_type(const char *format);
81: #if defined(__cplusplus)
82: }
83: #endif
84:
85: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.