### Compile libecc Examples Source: https://github.com/freebsd/pkg/blob/main/external/libecc/README.md Navigate to the examples directory and use 'make' to compile the provided user examples. ```bash $ cd src/examples $ make ``` -------------------------------- ### Install and Initialize pkgng Source: https://github.com/freebsd/pkg/blob/main/FAQ.md Steps to install pkgng and register existing packages into the new database. Ensure you have the necessary permissions. ```bash # make -C /usr/ports/ports-mgmt/pkg install clean # echo "WITH_PKGNG=yes" >> /etc/make.conf # pkg2ng ``` -------------------------------- ### Install UCL Library and Headers Source: https://github.com/freebsd/pkg/blob/main/external/libucl/CMakeLists.txt Installs the 'ucl' library and its public headers to the appropriate system directories. ```cmake INSTALL(TARGETS ucl EXPORT uclConfig DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ``` -------------------------------- ### JSON Configuration Example Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md Represents the same configuration as the nginx-like example, but in strict JSON format, highlighting array creation for duplicate keys. ```json { "param": "value", "section": { "param": "value", "param1": "value1", "flag": true, "number": 10000, "time": "0.2s", "string": "something", "subsection": { "host": [ { "host": "hostname", "port": 900 }, { "host": "hostname", "port": 901 } ] } } } ``` -------------------------------- ### Install Hardware Driver Source: https://github.com/freebsd/pkg/blob/main/external/libecc/README.md Fetch and install the dedicated driver for the IPECC hardware accelerator from its repository. ```bash make install_hw_driver ``` -------------------------------- ### Example UCL File for Alternatives Configuration Source: https://github.com/freebsd/pkg/blob/main/TODO.md This example shows the structure of a UCL file used for defining package alternatives. It includes symlink mappings and optional execution scripts for cache regeneration or other tasks. ```json Description: "yeah baby" symlinks { file1: target1 file2: target2 file3: target3 } exec: { type = lua; script: ... }, exec: { type = shell; script: ...} ``` -------------------------------- ### Install CMake Configuration File Source: https://github.com/freebsd/pkg/blob/main/external/libucl/CMakeLists.txt Installs the 'ucl-config.cmake' file, which is used by other projects to find and use the libucl library. ```cmake install(EXPORT uclConfig FILE ucl-config.cmake NAMESPACE ucl:: DESTINATION "share/ucl") ``` -------------------------------- ### UCL Named Keys Hierarchy Example 2 Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md Demonstrates a more complex named keys hierarchy with multiple levels of nesting. ```nginx section "blah" "foo" { key = value; } ``` -------------------------------- ### Nginx-like Configuration Example Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md Demonstrates a configuration structure similar to nginx, using key-value pairs, nested sections, and boolean/numeric values with multipliers. ```nginx param = value; section { param = value; param1 = value1; flag = true; number = 10k; time = 0.2s; string = "something"; subsection { host = { host = "hostname"; port = 900; } host = { host = "hostname"; port = 901; } } } ``` -------------------------------- ### UCL Named Keys Hierarchy Example 1 Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md Illustrates how UCL organizes named keys into a hierarchical object structure. ```nginx section "blah" { key = value; } section foo { key = value; } ``` -------------------------------- ### Lua Table Constructor Example Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Demonstrates the creation of a table with various field initializations, including computed keys, string keys, and sequential integer keys. ```lua a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 } ``` -------------------------------- ### Install Coccinelle via Package Source: https://github.com/freebsd/pkg/blob/main/tests/cocci/README.md Use this command to install Coccinelle if you are using the FreeBSD package management system. ```shell # pkg install coccinelle ``` -------------------------------- ### Install Coccinelle via Ports Source: https://github.com/freebsd/pkg/blob/main/tests/cocci/README.md Use this command to install Coccinelle if you are managing packages through the FreeBSD ports system. ```shell # make -C /usr/ports/devel/coccinelle install clean ``` -------------------------------- ### Configure libecc with Meson Options Source: https://github.com/freebsd/pkg/blob/main/external/libecc/README.md Example of setting specific compilation options like word size and debug mode when setting up the Meson build directory. ```bash meson setup -Dwith_wordsize=32 -Dwith_debug=true builddir && cd builddir && meson dist ``` -------------------------------- ### Lua Table Constructor Expansion Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Shows the expanded equivalent of the complex table constructor example, illustrating how different field syntaxes are translated. ```lua do local t = {} t[f(1)] = g t[1] = "x" t[2] = "y" t.x = 1 t[3] = f(x) t[30] = 23 t[4] = 45 a = t end ``` -------------------------------- ### Lua Coroutine Example Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Demonstrates the creation and step-by-step execution of a Lua coroutine, showing how values are passed and returned between the coroutine body and the main thread. ```lua function foo (a) print("foo", a) return coroutine.yield(2*a) end co = coroutine.create(function (a,b) print("co-body", a, b) local r = foo(a+1) print("co-body", r) local r, s = coroutine.yield(a+b, a-b) print("co-body", r, s) return b, "end" end) print("main", coroutine.resume(co, 1, 10)) print("main", coroutine.resume(co, "r")) print("main", coroutine.resume(co, "x", "y")) print("main", coroutine.resume(co, "x", "y")) ``` -------------------------------- ### Configure Pkgng with Portupgrade - Shell Source: https://github.com/freebsd/pkg/blob/main/FAQ.md Instructions for using pkgng with portupgrade. Install the latest version of portupgrade or portupgrade-devel, update ports, and configure make.conf. ```shell # portsnap fetch update # portupgrade ports-mgmt/portupgrade # echo "WITH_PKGNG=yes" >> /etc/make.conf # pkg2ng ``` -------------------------------- ### Lua Multi-Result Expression Examples Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Demonstrates various scenarios of using multi-result expressions and vararg arguments in Lua, including how results are adjusted or truncated. ```lua print(x, f()) ``` ```lua print(x, (f())) ``` ```lua print(f(), x) ``` ```lua print(1 + f()) ``` ```lua local x = ... ``` ```lua x,y = ... ``` ```lua x,y,z = w, f() ``` ```lua x,y,z = f() ``` ```lua x,y,z = f(), g() ``` ```lua x,y,z = (f()) ``` ```lua return f() ``` ```lua return x, ... ``` ```lua return x,y,f() ``` ```lua {f()} ``` ```lua {...} ``` ```lua {f(), 5} ``` -------------------------------- ### io.popen Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Starts a program in a separate process and returns a file handle for reading from or writing to the program's standard input/output. This function is system-dependent. ```APIDOC ## io.popen (prog [, mode]) ### Description This function is system dependent and is not available on all platforms. Starts the program `prog` in a separated process and returns a file handle that you can use to read data from this program (if `mode` is `"r"`, the default) or to write data to this program (if `mode` is `"w"`). ### Method `io.popen` ``` -------------------------------- ### Example of Dep Formula Syntax Source: https://github.com/freebsd/pkg/blob/main/TODO.md This demonstrates the syntax for defining dependency formulas, including version constraints, alternatives, and optional features. It allows for complex package requirement definitions. ```plaintext name1 = 1.0 | name2 != 1.0, name3 > 1.0 < 2.0 != 1.5, name4 +opt1 -opt2 ``` -------------------------------- ### Lua Multiple Assignment Example Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Demonstrates multiple assignments in Lua, including swapping values and cyclic permutations, ensuring correct evaluation order. ```lua i = 3 i, a[i] = i+1, 20 ``` ```lua x, y = y, x ``` ```lua x, y, z = y, z, x ``` -------------------------------- ### Parser Usage Example: Reading from Stdin Source: https://github.com/freebsd/pkg/blob/main/external/libucl/doc/api.md Demonstrates loading, parsing, and extracting a UCL object from standard input using libucl functions. Includes error handling and resource cleanup. ```C char inbuf[8192]; struct ucl_parser *parser = NULL; int ret = 0, r = 0; ucl_object_t *obj = NULL; FILE *in; in = stdin; parser = ucl_parser_new (0); while (!feof (in) && r < (int)sizeof (inbuf)) { r += fread (inbuf + r, 1, sizeof (inbuf) - r, in); } ucl_parser_add_chunk (parser, inbuf, r); close (in); if (ucl_parser_get_error (parser)) { printf ("Error occurred: %s\n", ucl_parser_get_error (parser)); ret = 1; } else { obj = ucl_parser_get_object (parser); } if (parser != NULL) { ucl_parser_free (parser); } if (obj != NULL) { ucl_object_unref (obj); } return ret; ``` -------------------------------- ### Lua Empty Statement Example Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Demonstrates the use of empty statements (semicolons) for separating statements or creating empty blocks in Lua. ```lua ; ``` -------------------------------- ### Multiline String Example Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md Demonstrates how to define multiline strings in UCL using a heredoc-like syntax. The terminator must be in capital letters and adhere to specific newline rules. ```ucl key = < "hello" string.sub("hello world", -5) --> "world" ``` ``` -------------------------------- ### debug.traceback Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Generates a traceback of the call stack. An optional message can be prepended, and the starting level of the traceback can be specified. ```APIDOC ## debug.traceback ### Description Generates a string with a traceback of the call stack. An optional message string is appended at the beginning of the traceback. An optional level number tells at which level to start the traceback. ### Parameters - `thread` (thread) - Optional - The thread to get the traceback from. - `message` (string | nil) - Optional - A message to prepend to the traceback. - `level` (number) - Optional - The level at which to start the traceback (default is 1). ### Returns - `string` - The formatted traceback string. ``` -------------------------------- ### UCL Comments: Single Line Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md Shows the syntax for single-line comments in UCL, starting with a hash symbol. ```c # single line ``` -------------------------------- ### Lua string.gmatch() Word Iteration Example Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Iterates over all sequences of alphabetic characters (words) in a string, printing each one. ```lua s = "hello world from Lua" for w in string.gmatch(s, "%a+") do print(w) end ``` -------------------------------- ### Remove Unused Packages with pkgng Source: https://github.com/freebsd/pkg/blob/main/FAQ.md Use `pkg autoremove` to remove packages that are no longer required by any installed package. ```bash pkg autoremove ``` -------------------------------- ### Lua Ambiguity Resolution with Semicolon Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Illustrates how to resolve grammatical ambiguity when a statement starts with a parenthesis by preceding it with a semicolon. ```lua ;(print or io.write)('done') ``` -------------------------------- ### Macros with Arguments Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md Macros can accept arguments, which are parsed as UCL objects. This allows for parameterized macro behavior and passing configuration options. ```nginx .macro_name(param=value) "something"; ``` ```nginx .macro_name(param={key=value}) "something"; ``` ```nginx .macro_name(.include "params.conf") "something"; ``` ```nginx .macro_name(#this is multiline macro param = [value1, value2]) "something"; ``` ```nginx .macro_name(key="()") "something"; ``` -------------------------------- ### lua_createtable Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Creates a new empty table and pushes it onto the stack. Hints for sequence and record elements can be provided for preallocation. ```APIDOC ## lua_createtable ### Description Creates a new empty table and pushes it onto the stack. Parameter `narr` is a hint for how many elements the table will have as a sequence; parameter `nrec` is a hint for how many other elements the table will have. Lua may use these hints to preallocate memory for the new table. ### Parameters * `L` (lua_State *) - The Lua state. * `narr` (int) - Hint for the number of elements in the sequence part of the table. * `nrec` (int) - Hint for the number of elements in the record part of the table. ``` -------------------------------- ### Extract Substring with string.sub Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Returns a substring of the given string, starting at index i and ending at index j. Indices can be negative. ```lua string.sub("hello world", 1, 5) --> "hello" ``` ```lua string.sub("hello world", -5) --> "world" ``` -------------------------------- ### Get String Length with string.len Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Returns the length of a given string. Embedded null characters are counted towards the length. ```lua string.len("a\000bc\000") --> 5 ``` -------------------------------- ### require Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Loads a module by searching for it using predefined paths and loaders. ```APIDOC ## require (modname) ### Description Loads the given module. It checks `package.loaded` first. If the module is not found, it searches for a loader using `package.searchers`, which consults `package.preload`, `package.path`, `package.cpath`, and an all-in-one loader. If a loader is found, it's called with the module name and loader data. The result is stored in `package.loaded` and returned. ### Parameters #### Parameters - **modname** (string) - The name of the module to load. ### Returns - `any`: The loaded module. - `any`: Loader data indicating how the module was found. ``` -------------------------------- ### Delete Package and Check Dependencies - Shell Source: https://github.com/freebsd/pkg/blob/main/FAQ.md Demonstrates forcibly deleting a package and the subsequent check for missing dependencies. 'pkg check' can help identify and reinstall them. ```shell # pkg delete -f pkg check will detect missing dependency packages and reinstall as required. ``` -------------------------------- ### Configure libecc: Custom Algorithm Support Source: https://github.com/freebsd/pkg/blob/main/external/libecc/README.md Example of configuring libecc to support only ECFDSA with SHA3-256 on BrainpoolP256R1 by defining the necessary macros. ```c #define WITH_SIG_ECFSDSA #define WITH_HASH_SHA3_256 #define WITH_CURVE_BRAINPOOLP256R1 ``` -------------------------------- ### Configure libecc: Remove Curve Support Source: https://github.com/freebsd/pkg/blob/main/external/libecc/README.md Example of how to disable support for a specific curve (FRP256V1) by commenting out its define in the configuration header. ```c /* Supported curves */ /* #define WITH_CURVE_FRP256V1 */ /* REMOVING FRP256V1 */ #define WITH_CURVE_SECP192R1 #define WITH_CURVE_SECP224R1 #define WITH_CURVE_SECP256R1 #define WITH_CURVE_SECP384R1 #define WITH_CURVE_SECP521R1 #define WITH_CURVE_BRAINPOOLP224R1 #define WITH_CURVE_BRAINPOOLP256R1 #define WITH_CURVE_BRAINPOOLP384R1 #define WITH_CURVE_BRAINPOOLP512R1 #define WITH_CURVE_GOST256 #define WITH_CURVE_GOST512 ... ``` -------------------------------- ### Define Compile Definitions Source: https://github.com/freebsd/pkg/blob/main/external/libucl/CMakeLists.txt Sets up compile definitions based on found features like HAVE_FETCH_H, CURL_FOUND, HAVE_OPENSSL, and HAVE_ATOMIC_BUILTINS. ```cmake SET(UCL_COMPILE_DEFS) IF(HAVE_FETCH_H) LIST(APPEND UCL_COMPILE_DEFS -DHAVE_FETCH_H=1) ENDIF(HAVE_FETCH_H) IF(CURL_FOUND) LIST(APPEND UCL_COMPILE_DEFS -DCURL_FOUND=1) ENDIF(CURL_FOUND) IF(HAVE_OPENSSL) LIST(APPEND UCL_COMPILE_DEFS -DHAVE_OPENSSL=1) ENDIF(HAVE_OPENSSL) IF(HAVE_ATOMIC_BUILTINS) LIST(APPEND UCL_COMPILE_DEFS -DHAVE_ATOMIC_BUILTINS=1) ENDIF(HAVE_ATOMIC_BUILTINS) ``` -------------------------------- ### table.pack Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Collects all given arguments into a new table with numeric keys starting from 1 and adds a 'n' field for the total count. ```APIDOC ## table.pack (···) ### Description Returns a new table with all arguments stored into keys 1, 2, etc. and with a field "`n`" with the total number of arguments. Note that the resulting table may not be a sequence, if some arguments are **nil**. ### Parameters * `···` (any) - Variable number of arguments to pack into a table. ### Returns * (table) - A new table containing the arguments with numeric keys and an 'n' field. ``` -------------------------------- ### Handle Missing Pkgng Library - Shell Source: https://github.com/freebsd/pkg/blob/main/FAQ.md This command is used to resolve issues with missing libraries like libpkg.so.0 after upgrading the system. It helps clean up old libraries. ```shell make delete-old-libs ``` -------------------------------- ### Linking libsign.a Static Library Source: https://github.com/freebsd/pkg/blob/main/external/libecc/README.md This lists the object files required to build the libsign.a static library, including arithmetic, curve, and hashing/signature object files. ```makefile libsign.a: src/fp/fp_rand.o src/fp/fp_mul.o src/fp/fp_montgomery.o src/fp/fp_mul_redc1.o src/fp/fp_add.o src/fp/fp.o src/fp/fp_pow.o src/nn/nn_mul.o src/nn/nn_mul_redc1.o src/nn/nn_logical.o src/nn/nn.o src/nn/nn_modinv.o src/nn/nn_add.o src/nn/nn_rand.o src/nn/nn_div.o src/utils/print_nn.o src/utils/print_fp.o src/utils/print_keys.o src/utils/print_curves.o src/utils/utils.o src/curves/prj_pt.o src/curves/curves.o src/curves/aff_pt.o src/curves/prj_pt_monty.o src/curves/ec_shortw.o src/curves/ec_params.o src/hash/sha384.o src/hash/sha3-512.o src/hash/sha512.o src/hash/sha3-256.o src/hash/sha3-224.o src/hash/sha3.o src/hash/sha256.o src/hash/sha3-384.o src/hash/sha224.o src/hash/hash_algs.o src/sig/ecsdsa.o src/sig/ecdsa.o src/sig/ecrdsa.o src/sig/ecosdsa.o src/sig/ecfsdsa.o src/sig/eckcdsa.o src/sig/ecgdsa.o src/sig/ecsdsa_common.o src/sig/sig_algs.o src/sig/ec_key.o ``` -------------------------------- ### coroutine.resume Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Starts or continues the execution of a coroutine. Returns true plus results on success, false plus error message on failure. ```APIDOC ## coroutine.resume (co [, val1, ...]) ### Description Starts or continues the execution of coroutine `co`. The first time you resume a coroutine, it starts running its body. The values `val1`, ... are passed as the arguments to the body function. If the coroutine has yielded, `resume` restarts it; the values `val1`, ... are passed as the results from the yield. If the coroutine runs without any errors, `resume` returns **true** plus any values passed to `yield` (when the coroutine yields) or any values returned by the body function (when the coroutine terminates). If there is any error, `resume` returns **false** plus the error message. ``` -------------------------------- ### Sign a File with ec_utils Source: https://github.com/freebsd/pkg/blob/main/external/libecc/README.md Use the `ec_utils sign` command to sign a binary file using a specified curve, algorithm, hash function, private key, and output signature file. ```bash ./build/ec_utils sign BRAINPOOLP512R1 ECKCDSA SHA3_512 myfile mykeypair_private_key.bin sig.bin ``` -------------------------------- ### Define Library Source and Header Files Source: https://github.com/freebsd/pkg/blob/main/external/libucl/CMakeLists.txt Lists the source files for the main UCL library and its header files. ```cmake SET(UCLSRC src/ucl_util.c src/ucl_parser.c src/ucl_emitter.c src/ucl_emitter_streamline.c src/ucl_emitter_utils.c src/ucl_hash.c src/ucl_schema.c src/ucl_msgpack.c src/ucl_sexp.c) SET(UCLHDR include/ucl.h include/ucl++.h) ``` -------------------------------- ### io.open Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Opens a file with the specified filename and mode. Returns a file handle upon success. Supported modes include read ('r'), write ('w'), append ('a'), and update variants ('r+', 'w+', 'a+'), with an optional binary mode ('b'). ```APIDOC ## io.open (filename [, mode]) ### Description This function opens a file, in the mode specified in the string `mode`. In case of success, it returns a new file handle. The `mode` string can be any of the following: * **"`r`":** read mode (the default); * **"`w`":** write mode; * **"`a`":** append mode; * **"`r+`":** update mode, all previous data is preserved; * **"`w+`":** update mode, all previous data is erased; * **"`a+`":** append update mode, previous data is preserved, writing is only allowed at the end of file. The `mode` string can also have a '`b`' at the end, which is needed in some systems to open the file in binary mode. ### Method `io.open` ``` -------------------------------- ### Display Python Script Help Source: https://github.com/freebsd/pkg/blob/main/external/libecc/README.md View the help message for the `expand_libecc.py` script to understand its functionalities and options. ```bash python scripts/expand_libecc.py -h ``` -------------------------------- ### Run spatch for Code Transformation Source: https://github.com/freebsd/pkg/blob/main/tests/cocci/README.md This command applies a Coccinelle SmPL script to C code within the pkg source tree. Ensure you are in the pkg's source root and replace `$DIR` with the appropriate source directory (e.g., `_libpkg_` or `src`). `$TESTFILE.cocci` should be replaced with the actual Coccinelle script file name. ```shell % spatch -I . -I /usr/include -I /usr/local/include -I libpkg -I src \ -I external/blake2 -I external/yxml -I external/include \ -I external/libelf -I external/libfetch \ -I external/libsbuf -I external/libucl/include -I external/linenoise \ -I external/picosat -I external/sqlite \ -in_place -sp_file ./tests/cocci/$TESTFILE.cocci -dir $DIR ``` -------------------------------- ### lua_newstate Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Creates a new Lua state from scratch and returns a pointer to the main thread within that new state. This is the entry point for initializing a Lua environment. ```APIDOC ## lua_newstate ### Description Creates a new Lua state and returns a pointer to its main thread. ### Function Signature `lua_State* lua_newstate (lua_Alloc f, void *ud);` ### Parameters - **`f`** (lua_Alloc) - Memory-allocating function. - **`ud`** (void*) - User data for the memory-allocating function. ### Returns A pointer to the main thread of the newly created Lua state, or NULL in case of memory allocation errors. ``` -------------------------------- ### Lua string.char() Example Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Converts integer arguments into a string where each character's code corresponds to an argument. Note that numeric codes are not portable across platforms. ```lua string.char(97, 98, 99) ``` -------------------------------- ### Include Files by URL Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md When built with URL support, UCL can include configuration directly from HTTP or HTTPS URLs. This requires libcurl or libfetch. ```nginx .include "http://example.com/file.conf" ``` -------------------------------- ### Pack Data with string.pack Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Serializes values into a binary string according to a specified format string. ```lua string.pack("i4", 10) --> "\010\000\000\000" ``` -------------------------------- ### Lua Syntactic Sugar for Function Definitions Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Demonstrates syntactic sugar for defining functions, including regular functions, methods, and local functions. ```lua function t.a.b.c.f () _body_ end ``` ```lua local function f () _body_ end ``` -------------------------------- ### Lua Integer Constants Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Examples of valid integer constants in Lua, including decimal and hexadecimal formats. Hexadecimal constants wrap around if their value overflows. ```lua 3 345 0xff 0xBEBADA ``` -------------------------------- ### utf8.codepoint Source: https://github.com/freebsd/pkg/blob/main/external/lua/doc/manual.html Returns the code points (as integers) from all characters in a string that start within a specified byte range. It raises an error if it encounters invalid byte sequences. ```APIDOC ## utf8.codepoint (s [, i [, j [, lax]]]) ### Description Returns the code points (as integers) from all characters in `s` that start between byte position `i` and `j` (both included). The default for `i` is 1 and for `j` is `i`. It raises an error if it meets any invalid byte sequence. ### Parameters * `s` (string) - The input string. * `i` (integer, optional) - The starting byte position (inclusive). Defaults to 1. * `j` (integer, optional) - The ending byte position (inclusive). Defaults to `i`. * `lax` (boolean, optional) - If true, invalid sequences are ignored. (Note: The source text implies an error is raised, so this parameter's behavior might be inferred or not fully detailed in the source.) ### Returns * (integer) - The code points of the characters within the specified range. ``` -------------------------------- ### Include Macro Options Source: https://github.com/freebsd/pkg/blob/main/external/libucl/README.md The .include macro supports various options to control its behavior, such as error handling (try), signature verification (sign), pattern matching (glob), and URL handling (url). ```nginx .include(try=true) "optional_file.conf" ``` ```nginx .include(sign=true) "signed_file.conf" ``` ```nginx .include(glob=true) "*.conf" ``` ```nginx .include(url=false) "local_file.conf" ``` ```nginx .include(path=[/etc/ucl, /usr/local/etc]) "app.conf" ``` ```nginx .include(prefix=true, key="my_config") "config.conf" ``` ```nginx .include(prefix=true, key="my_list", target="array") "list.conf" ``` ```nginx .include(priority=10) "high_priority.conf" ``` ```nginx .include(duplicate="merge") "merge_config.conf" ``` -------------------------------- ### Get Parser Error String Source: https://github.com/freebsd/pkg/blob/main/external/libucl/doc/api.md Retrieves the error message string from the parser. Returns NULL if no error occurred. The returned string should not be modified or freed by the caller. ```C const char *ucl_parser_get_error(struct ucl_parser *parser); ```