3
.\" Copyright (c) 2020 Kristaps Dzonsons <kristaps@bsd.lv>
5
.\" Permission to use, copy, modify, and distribute this software for any
6
.\" purpose with or without fee is hereby granted, provided that the above
7
.\" copyright notice and this permission notice appear in all copies.
9
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
.Nm kjson_string_putdouble
24
.Nd put floating point content for kcgijson
35
.Fa "struct kjsonreq *req"
40
.Fa "struct kjsonreq *req"
45
.Fo kjson_string_putdouble
46
.Fa "struct kjsonreq *req"
50
Write a double-precision floating point
56
This formats the value using the
62
does not classify as normal, subnormal, or zero, it is output as
67
form is for array scopes,
70
.Fn kjson_string_putdouble
79
is equivalent to calling
84
indicating the error state.
87
Success (not an error).
89
Internal memory allocation failure.
91
The output connection has been terminated.
92
For FastCGI connections, the current connection should be released with
94
and parse loop reentered.
96
The connection is still expecting headers with
100
did not return with success or was not invoked.
101
For FastCGI connections, the current connection should be released with
103
and parse loop reentered.
105
Internal system error writing to the output stream.
107
The incorrect form was used for the current scope, for example, an
108
array-type write within an object.
111
The following outputs a simple JSON document.
117
For brevity, it does not do any error checking.
118
.Bd -literal -offset indent
119
khttp_head(r, kresps[KRESP_STATUS],
120
"%s", khttps[KHTTP_200]);
121
khttp_head(r, kresps[KRESP_CONTENT_TYPE],
122
"%s", kmimetypes[KMIME_APP_JSON]);
126
kjson_putdoublep(&req, "bar", 0.12345);
127
kjson_arrayp_open(&req, "baz");
128
kjson_putdouble(&req, (1.0 / 0.0)); /* null */
135
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .