Mercurial > trustbridge > nss-cmake-static
comparison nspr/pr/include/prprf.h @ 0:1e5118fa0cb1
This is NSS with a Cmake Buildsyste
To compile a static NSS library for Windows we've used the
Chromium-NSS fork and added a Cmake buildsystem to compile
it statically for Windows. See README.chromium for chromium
changes and README.trustbridge for our modifications.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 28 Jul 2014 10:47:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1e5118fa0cb1 |
---|---|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | |
2 /* This Source Code Form is subject to the terms of the Mozilla Public | |
3 * License, v. 2.0. If a copy of the MPL was not distributed with this | |
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
5 | |
6 #ifndef prprf_h___ | |
7 #define prprf_h___ | |
8 | |
9 /* | |
10 ** API for PR printf like routines. Supports the following formats | |
11 ** %d - decimal | |
12 ** %u - unsigned decimal | |
13 ** %x - unsigned hex | |
14 ** %X - unsigned uppercase hex | |
15 ** %o - unsigned octal | |
16 ** %hd, %hu, %hx, %hX, %ho - 16-bit versions of above | |
17 ** %ld, %lu, %lx, %lX, %lo - 32-bit versions of above | |
18 ** %lld, %llu, %llx, %llX, %llo - 64 bit versions of above | |
19 ** %s - string | |
20 ** %c - character | |
21 ** %p - pointer (deals with machine dependent pointer size) | |
22 ** %f - float | |
23 ** %g - float | |
24 */ | |
25 #include "prtypes.h" | |
26 #include "prio.h" | |
27 #include <stdio.h> | |
28 #include <stdarg.h> | |
29 | |
30 PR_BEGIN_EXTERN_C | |
31 | |
32 /* | |
33 ** sprintf into a fixed size buffer. Guarantees that a NUL is at the end | |
34 ** of the buffer. Returns the length of the written output, NOT including | |
35 ** the NUL, or (PRUint32)-1 if an error occurs. | |
36 */ | |
37 NSPR_API(PRUint32) PR_snprintf(char *out, PRUint32 outlen, const char *fmt, ...); | |
38 | |
39 /* | |
40 ** sprintf into a PR_MALLOC'd buffer. Return a pointer to the malloc'd | |
41 ** buffer on success, NULL on failure. Call "PR_smprintf_free" to release | |
42 ** the memory returned. | |
43 */ | |
44 NSPR_API(char*) PR_smprintf(const char *fmt, ...); | |
45 | |
46 /* | |
47 ** Free the memory allocated, for the caller, by PR_smprintf | |
48 */ | |
49 NSPR_API(void) PR_smprintf_free(char *mem); | |
50 | |
51 /* | |
52 ** "append" sprintf into a PR_MALLOC'd buffer. "last" is the last value of | |
53 ** the PR_MALLOC'd buffer. sprintf will append data to the end of last, | |
54 ** growing it as necessary using realloc. If last is NULL, PR_sprintf_append | |
55 ** will allocate the initial string. The return value is the new value of | |
56 ** last for subsequent calls, or NULL if there is a malloc failure. | |
57 */ | |
58 NSPR_API(char*) PR_sprintf_append(char *last, const char *fmt, ...); | |
59 | |
60 /* | |
61 ** sprintf into a function. The function "f" is called with a string to | |
62 ** place into the output. "arg" is an opaque pointer used by the stuff | |
63 ** function to hold any state needed to do the storage of the output | |
64 ** data. The return value is a count of the number of characters fed to | |
65 ** the stuff function, or (PRUint32)-1 if an error occurs. | |
66 */ | |
67 typedef PRIntn (*PRStuffFunc)(void *arg, const char *s, PRUint32 slen); | |
68 | |
69 NSPR_API(PRUint32) PR_sxprintf(PRStuffFunc f, void *arg, const char *fmt, ...); | |
70 | |
71 /* | |
72 ** fprintf to a PRFileDesc | |
73 */ | |
74 NSPR_API(PRUint32) PR_fprintf(struct PRFileDesc* fd, const char *fmt, ...); | |
75 | |
76 /* | |
77 ** va_list forms of the above. | |
78 */ | |
79 NSPR_API(PRUint32) PR_vsnprintf(char *out, PRUint32 outlen, const char *fmt, va_list ap); | |
80 NSPR_API(char*) PR_vsmprintf(const char *fmt, va_list ap); | |
81 NSPR_API(char*) PR_vsprintf_append(char *last, const char *fmt, va_list ap); | |
82 NSPR_API(PRUint32) PR_vsxprintf(PRStuffFunc f, void *arg, const char *fmt, va_list ap); | |
83 NSPR_API(PRUint32) PR_vfprintf(struct PRFileDesc* fd, const char *fmt, va_list ap); | |
84 | |
85 /* | |
86 *************************************************************************** | |
87 ** FUNCTION: PR_sscanf | |
88 ** DESCRIPTION: | |
89 ** PR_sscanf() scans the input character string, performs data | |
90 ** conversions, and stores the converted values in the data objects | |
91 ** pointed to by its arguments according to the format control | |
92 ** string. | |
93 ** | |
94 ** PR_sscanf() behaves the same way as the sscanf() function in the | |
95 ** Standard C Library (stdio.h), with the following exceptions: | |
96 ** - PR_sscanf() handles the NSPR integer and floating point types, | |
97 ** such as PRInt16, PRInt32, PRInt64, and PRFloat64, whereas | |
98 ** sscanf() handles the standard C types like short, int, long, | |
99 ** and double. | |
100 ** - PR_sscanf() has no multibyte character support, while sscanf() | |
101 ** does. | |
102 ** INPUTS: | |
103 ** const char *buf | |
104 ** a character string holding the input to scan | |
105 ** const char *fmt | |
106 ** the format control string for the conversions | |
107 ** ... | |
108 ** variable number of arguments, each of them is a pointer to | |
109 ** a data object in which the converted value will be stored | |
110 ** OUTPUTS: none | |
111 ** RETURNS: PRInt32 | |
112 ** The number of values converted and stored. | |
113 ** RESTRICTIONS: | |
114 ** Multibyte characters in 'buf' or 'fmt' are not allowed. | |
115 *************************************************************************** | |
116 */ | |
117 | |
118 NSPR_API(PRInt32) PR_sscanf(const char *buf, const char *fmt, ...); | |
119 | |
120 PR_END_EXTERN_C | |
121 | |
122 #endif /* prprf_h___ */ |