C Standard Library Extensions  1.2
cxutils.h
1 /* $Id: cxutils.h,v 1.6 2011-02-21 14:15:31 rpalsa Exp $
2  *
3  * This file is part of the ESO C Extension Library
4  * Copyright (C) 2001-2011 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: rpalsa $
23  * $Date: 2011-02-21 14:15:31 $
24  * $Revision: 1.6 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifndef CX_UTILS_H
29 #define CX_UTILS_H
30 
31 #include <stdarg.h>
32 #include <cxtypes.h>
33 
34 
35 CX_BEGIN_DECLS
36 
37 /*
38  * Static information retrieval
39  */
40 
41 const cxchar *cx_program_get_name(void);
42 void cx_program_set_name(const cxchar *);
43 
44 cxlong cx_line_max(void);
45 
46 
47 /*
48  * Bit tests
49  */
50 
51 cxint cx_bits_find(cxuint32, cxint);
52 cxint cx_bits_rfind(cxuint32, cxint);
53 
54 
55 /*
56  * Miscellaneous utility functions
57  */
58 
59 cxint cx_snprintf(cxchar *, cxsize,
60  const cxchar *, ...) CX_GNUC_PRINTF(3, 4);
61 cxint cx_vsnprintf(cxchar *, cxsize,
62  const cxchar *, va_list) CX_GNUC_PRINTF(3, 0);
63 cxint cx_asprintf(cxchar **, const cxchar *, ...) CX_GNUC_PRINTF(2, 3);
64 cxint cx_vasprintf(cxchar **, const cxchar *, va_list) CX_GNUC_PRINTF(2, 0);
65 
66 cxchar *cx_line_alloc(void);
67 
68 CX_END_DECLS
69 
70 #endif /* CX_UTILS_H */
cxint cx_vsnprintf(cxchar *string, cxsize n, const cxchar *format, va_list args)
Safe version of vsprintf().
Definition: cxutils.c:293
const cxchar * cx_program_get_name(void)
Get the name of the application.
Definition: cxutils.c:105
cxlong cx_line_max(void)
Get the maximum length of a line supported by the system.
Definition: cxutils.c:478
cxint cx_asprintf(cxchar **string, const cxchar *format,...)
Write formatted output to a newly allocated string.
Definition: cxutils.c:344
cxint cx_bits_rfind(cxuint32, cxint)
Get the position of the first bit set, searching from right to left.
Definition: cxutils.c:200
cxint cx_bits_find(cxuint32, cxint)
Get the position of the first bit set, searching from left to right.
Definition: cxutils.c:164
cxint cxint cxint cxint cxchar * cx_line_alloc(void)
Allocate a line buffer with the maximum size supported by the system.
Definition: cxutils.c:505
void cx_program_set_name(const cxchar *)
Set the name of the application.
Definition: cxutils.c:133
cxint cx_snprintf(cxchar *string, cxsize n, const cxchar *format,...)
Safe version of sprintf().
Definition: cxutils.c:248
cxint cx_vasprintf(cxchar **string, const cxchar *format, va_list args)
Write formatted output to a newly allocated string with a variable-length argument list...
Definition: cxutils.c:388