Add an introduction to the std.json documentation, fix some mistakes in std.curl and replace broken links in std.stdio (#8724)

* Fix some mistakes in curl.d

* Add an introduction for std.json

* Fix more documentation in curl.d

* Fix broken links in std.stdio documentation
This commit is contained in:
Jeremy 2023-03-21 22:01:15 +13:00 committed by GitHub
parent 91308f2f64
commit 3c74c2b88a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 33 deletions

View file

@ -1,7 +1,10 @@
// Written in the D programming language.
/**
JavaScript Object Notation
Implements functionality to read and write JavaScript Object Notation values.
JavaScript Object Notation is a lightweight data interchange format commonly used in web services and configuration files.
It's easy for humans to read and write, and it's easy for machines to parse and generate.
Copyright: Copyright Jeremie Pelletier 2008 - 2009.
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).

View file

@ -23,7 +23,7 @@ SMTP) )
)
Note:
You may need to link to the $(B curl) library, e.g. by adding $(D "libs": ["curl"])
You may need to link with the $(B curl) library, e.g. by adding $(D "libs": ["curl"])
to your $(B dub.json) file if you are using $(LINK2 http://code.dlang.org, DUB).
Windows x86 note:
@ -32,20 +32,19 @@ $(LINK2 https://downloads.dlang.org/other/index.html, download archive page).
This module is not available for iOS, tvOS or watchOS.
Compared to using libcurl directly this module allows simpler client code for
Compared to using libcurl directly, this module allows simpler client code for
common uses, requires no unsafe operations, and integrates better with the rest
of the language. Futhermore it provides $(MREF_ALTTEXT range, std,range)
of the language. Furthermore it provides $(MREF_ALTTEXT range, std,range)
access to protocols supported by libcurl both synchronously and asynchronously.
A high level and a low level API are available. The high level API is built
entirely on top of the low level one.
The high level API is for commonly used functionality such as HTTP/FTP get. The
$(LREF byLineAsync) and $(LREF byChunkAsync) provides asynchronous
$(MREF_ALTTEXT range, std,range) that performs the request in another
thread while handling a line/chunk in the current thread.
$(LREF byLineAsync) and $(LREF byChunkAsync) functions asynchronously
perform the request given, outputting the fetched content into a $(MREF_ALTTEXT range, std,range).
The low level API allows for streaming and other advanced features.
The low level API allows for streaming, setting request headers and cookies, and other advanced features.
$(BOOKTABLE Cheat Sheet,
$(TR $(TH Function Name) $(TH Description)
@ -79,18 +78,18 @@ byChunk("dlang.org", 10)) returns a range of ubyte[10] containing the
dlang.org web page.)
)
$(TR $(TDNW $(LREF byLineAsync)) $(TD $(D
byLineAsync("dlang.org")) returns a range of char[] containing the dlang.org web
page asynchronously.)
byLineAsync("dlang.org")) asynchronously returns a range of char[] containing the dlang.org web
page.)
)
$(TR $(TDNW $(LREF byChunkAsync)) $(TD $(D
byChunkAsync("dlang.org", 10)) returns a range of ubyte[10] containing the
dlang.org web page asynchronously.)
byChunkAsync("dlang.org", 10)) asynchronously returns a range of ubyte[10] containing the
dlang.org web page.)
)
$(LEADINGROW Low level
)
$(TR $(TDNW $(LREF HTTP)) $(TD `HTTP` struct for advanced usage))
$(TR $(TDNW $(LREF FTP)) $(TD `FTP` struct for advanced usage))
$(TR $(TDNW $(LREF SMTP)) $(TD `SMTP` struct for advanced usage))
$(TR $(TDNW $(LREF HTTP)) $(TD Struct for advanced HTTP usage))
$(TR $(TDNW $(LREF FTP)) $(TD Struct for advanced FTP usage))
$(TR $(TDNW $(LREF SMTP)) $(TD Struct for advanced SMTP usage))
)
@ -135,10 +134,10 @@ http.perform();
First, an instance of the reference-counted HTTP struct is created. Then the
custom delegates are set. These will be called whenever the HTTP instance
receives a header and a data buffer, respectively. In this simple example, the
headers are written to stdout and the data is ignored. If the request should be
headers are written to stdout and the data is ignored. If the request is
stopped before it has finished then return something less than data.length from
the onReceive callback. See $(LREF onReceiveHeader)/$(LREF onReceive) for more
information. Finally the HTTP request is effected by calling perform(), which is
information. Finally, the HTTP request is performed by calling perform(), which is
synchronous.
Source: $(PHOBOSSRC std/net/curl.d)
@ -147,8 +146,8 @@ Copyright: Copyright Jonas Drewsen 2011-2012
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: Jonas Drewsen. Some of the SMTP code contributed by Jimmy Cao.
Credits: The functionally is based on $(HTTP curl.haxx.se/libcurl, libcurl).
LibCurl is licensed under an MIT/X derivative license.
Credits: The functionality is based on $(HTTP curl.haxx.se/libcurl, libcurl).
libcurl is licensed under an MIT/X derivative license.
*/
/*
Copyright Jonas Drewsen 2011 - 2012.

View file

@ -534,7 +534,7 @@ Params:
name = range or string representing the file _name
stdioOpenmode = range or string represting the open mode
(with the same semantics as in the C standard library
$(HTTP cplusplus.com/reference/clibrary/cstdio/fopen.html, fopen)
$(HTTP cplusplus.com/reference/cstdio/fopen, fopen)
function)
Throws: `ErrnoException` if the file could not be opened.
@ -619,7 +619,7 @@ file.
Detaches from the current file (throwing on failure), and then attempts to
_open file `name` with mode `stdioOpenmode`. The mode has the
same semantics as in the C standard library $(HTTP
cplusplus.com/reference/clibrary/cstdio/fopen.html, fopen) function.
cplusplus.com/reference/cstdio/fopen, fopen) function.
Throws: `ErrnoException` in case of error.
*/
@ -933,7 +933,7 @@ Throws: `ErrnoException` in case of error.
/**
Returns `true` if the file is at end (see $(HTTP
cplusplus.com/reference/clibrary/cstdio/feof.html, feof)).
cplusplus.com/reference/cstdio/feof, feof)).
Throws: `Exception` if the file is not opened.
*/
@ -961,7 +961,7 @@ Throws: `Exception` if the file is not opened.
/**
If the file is closed or not yet opened, returns `true`. Otherwise, returns
$(HTTP cplusplus.com/reference/clibrary/cstdio/ferror.html, ferror) for
$(HTTP cplusplus.com/reference/cstdio/ferror, ferror) for
the file handle.
*/
@property bool error() const @trusted pure nothrow
@ -1018,7 +1018,7 @@ Throws: `ErrnoException` on failure if closing the file.
/**
If the file was closed or not yet opened, succeeds vacuously. Otherwise
closes the file (by calling $(HTTP
cplusplus.com/reference/clibrary/cstdio/fclose.html, fclose)),
cplusplus.com/reference/cstdio/fclose, fclose)),
throwing on error. Even if an exception is thrown, afterwards the $(D
File) object is empty. This is different from `detach` in that it
always closes the file; consequently, all other `File` objects
@ -1046,7 +1046,7 @@ Throws: `ErrnoException` on error.
/**
If the file is closed or not yet opened, succeeds vacuously. Otherwise, returns
$(HTTP cplusplus.com/reference/clibrary/cstdio/_clearerr.html,
$(HTTP cplusplus.com/reference/cstdio/clearerr,
_clearerr) for the file handle.
*/
void clearerr() @safe pure nothrow
@ -1058,7 +1058,7 @@ _clearerr) for the file handle.
/**
Flushes the C `FILE` buffers.
Calls $(HTTP cplusplus.com/reference/clibrary/cstdio/_fflush.html, _fflush)
Calls $(HTTP cplusplus.com/reference/cstdio/fflush, _fflush)
for the file handle.
Throws: `Exception` if the file is not opened or if the call to `fflush` fails.
@ -1125,7 +1125,7 @@ Throws: `Exception` if the file is not opened or if the OS call fails.
}
/**
Calls $(HTTP cplusplus.com/reference/clibrary/cstdio/fread.html, fread) for the
Calls $(HTTP cplusplus.com/reference/cstdio/fread, fread) for the
file handle. The number of items to read and the size of
each item is inferred from the size and type of the input array, respectively.
@ -1220,7 +1220,7 @@ Throws: `ErrnoException` if the file is not opened or the call to `fread` fails.
}
/**
Calls $(HTTP cplusplus.com/reference/clibrary/cstdio/fwrite.html, fwrite) for the file
Calls $(HTTP cplusplus.com/reference/cstdio/fwrite, fwrite) for the file
handle. The number of items to write and the size of each
item is inferred from the size and type of the input array, respectively. An
error is thrown if the buffer could not be written in its entirety.
@ -1290,7 +1290,7 @@ Throws: `ErrnoException` if the file is not opened or if the call to `fwrite` fa
}
/**
Calls $(HTTP cplusplus.com/reference/clibrary/cstdio/fseek.html, fseek)
Calls $(HTTP cplusplus.com/reference/cstdio/fseek, fseek)
for the file handle to move its position indicator.
Params:
@ -1420,7 +1420,7 @@ Throws: `Exception` if the file is not opened.
}
/**
Calls $(HTTP cplusplus.com/reference/clibrary/cstdio/_rewind.html, _rewind)
Calls $(HTTP cplusplus.com/reference/cstdio/rewind, _rewind)
for the file handle.
Throws: `Exception` if the file is not opened.
@ -1434,7 +1434,7 @@ Throws: `Exception` if the file is not opened.
}
/**
Calls $(HTTP cplusplus.com/reference/clibrary/cstdio/_setvbuf.html, _setvbuf) for
Calls $(HTTP cplusplus.com/reference/cstdio/setvbuf, _setvbuf) for
the file handle.
Throws: `Exception` if the file is not opened.
@ -1450,7 +1450,7 @@ Throws: `Exception` if the file is not opened.
}
/**
Calls $(HTTP cplusplus.com/reference/clibrary/cstdio/_setvbuf.html,
Calls $(HTTP cplusplus.com/reference/cstdio/setvbuf,
_setvbuf) for the file handle.
Throws: `Exception` if the file is not opened.
@ -2253,7 +2253,7 @@ $(CONSOLE
/**
Returns a temporary file by calling
$(HTTP cplusplus.com/reference/clibrary/cstdio/_tmpfile.html, _tmpfile).
$(HTTP cplusplus.com/reference/cstdio/tmpfile, _tmpfile).
Note that the created file has no $(LREF name).*/
static File tmpfile() @safe
{