diff options
| author | Tyge Løvset <[email protected]> | 2021-01-21 08:26:54 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-01-21 08:26:54 +0100 |
| commit | 50da396d04714a18fa087ebbd1f2316958dbd6bd (patch) | |
| tree | 0349909bf35183e2eced05ca0d3ce909f700c23e /docs | |
| parent | 9473eae780011ef520066ddcd36bb555e8e616e4 (diff) | |
| download | STC-modified-50da396d04714a18fa087ebbd1f2316958dbd6bd.tar.gz STC-modified-50da396d04714a18fa087ebbd1f2316958dbd6bd.zip | |
Reverted namings: crand to crandom, and copt to coption.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/coption_api.md (renamed from docs/copt_api.md) | 30 | ||||
| -rw-r--r-- | docs/cpque_api.md | 2 | ||||
| -rw-r--r-- | docs/crandom_api.md (renamed from docs/crand_api.md) | 8 |
3 files changed, 20 insertions, 20 deletions
diff --git a/docs/copt_api.md b/docs/coption_api.md index df49f66d..66038b38 100644 --- a/docs/copt_api.md +++ b/docs/coption_api.md @@ -1,6 +1,6 @@ -# STC Module [copt](../stc/copt.h): Command line argument parsing +# STC Module [copt](../stc/coption.h): Command line argument parsing -This describes the API of the *copt_get()* function for command line argument parsing. +This describes the API of the *coption_get()* function for command line argument parsing. See [getopt_long](https://www.freebsd.org/cgi/man.cgi?getopt_long(3)) for a similar posix function. ## Types @@ -12,39 +12,39 @@ enum { copt_optional_argument = 2 }; typedef struct { - int ind; /* equivalent to optind */ - int opt; /* equivalent to optopt */ - const char *arg; /* equivalent to optarg */ + int ind; /* equivalent to posix optind */ + int opt; /* equivalent to posix optopt */ + const char *arg; /* equivalent to posix optarg */ const char *faulty; /* points to the faulty option, if any */ int longindex; /* index of long option; or -1 if short */ ... -} copt_t; +} coption; typedef struct { const char *name; int has_arg; int val; -} copt_long_t; +} coption_long; -const copt_t copt_inits; +const coption coption_inits; ``` ## Methods ```c -copt_t copt_init(void); -int copt_get(copt_t *opt, int argc, char *argv[], - const char *shortopts, const copt_long_t *longopts); +coption coption_init(void); +int coption_get(coption *opt, int argc, char *argv[], + const char *shortopts, const coption_long *longopts); ``` ## Example ```c #include <stdio.h> -#include "stc/copt.h" +#include "stc/coption.h" int main(int argc, char *argv[]) { - static copt_long_t long_options[] = { + static coption_long long_options[] = { {"verbose", copt_no_argument, 'V'}, {"help", copt_no_argument, 'H'}, {"add", copt_no_argument, 'a'}, @@ -54,9 +54,9 @@ int main(int argc, char *argv[]) { {"file", copt_required_argument, 'f'}, {NULL} }; - copt_t opt = copt_inits; + coption opt = coption_init(); int c; - while ((c = copt_get(&opt, argc, argv, ":if:lr", long_options)) != -1) { + while ((c = coption_get(&opt, argc, argv, ":if:lr", long_options)) != -1) { switch (c) { case 'V': case 'H': case 'a': case 'b': diff --git a/docs/cpque_api.md b/docs/cpque_api.md index 59203a63..080d580e 100644 --- a/docs/cpque_api.md +++ b/docs/cpque_api.md @@ -60,7 +60,7 @@ cpque_X_value_t cpque_X_value_clone(cpque_X_value_t val); ```c #include <stdio.h> #include "stc/cpque.h" -#include "stc/crand.h" +#include "stc/crandom.h" using_cvec(i, int64_t); using_cpque(i, cvec_i, >); // adaptor type, '>' = min-heap diff --git a/docs/crand_api.md b/docs/crandom_api.md index 995c5fa0..c8ad34ff 100644 --- a/docs/crand_api.md +++ b/docs/crandom_api.md @@ -1,7 +1,7 @@ -# STC Module [crand](../stc/crand.h): Pseudo Random Number Generators +# STC Module [crandom](../stc/crandom.h): Pseudo Random Number Generators  -This describes the API of module **crand**. It contains **stc64**, a *64-bit PRNG*, and can generate +This describes the API of module **crandom**. It contains **stc64**, a *64-bit PRNG*, and can generate bounded uniform and normal distributed random numbers. See [random](https://en.cppreference.com/w/cpp/header/random) for similar c++ functionality. @@ -34,7 +34,7 @@ xoshiro and pcg (Vigna/O'Neill) PRNGs: https://www.pcg-random.org/posts/on-vigna All cstr definitions and prototypes may be included in your C source file by including a single header file. ```c -#include "stc/crand.h" +#include "stc/crandom.h" ``` ## Methods @@ -67,7 +67,7 @@ RNG, around 68% of the values fall within the range [*mean* - *stddev*, *mean* + #include <stdio.h> #include <time.h> #include <math.h> -#include "stc/crand.h" +#include "stc/crandom.h" #include "stc/cstr.h" #include "stc/cmap.h" #include "stc/cvec.h" |
