Kaynağa Gözat

add more api declations

ruki 2 ay önce
ebeveyn
işleme
fbdb8df03f

+ 424 - 10
docs/api/scripts/extension-modules/lib/detect.md

@@ -11,6 +11,30 @@ The interface of this module is spread across multiple module directories, try t
 
 - Find files
 
+#### Function Prototype
+
+::: tip API
+```lua
+find_file(file: <string>, paths: <table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| file | Required. File name or path |
+| paths | Required. Search path list |
+| opt | Optional. Option parameters, supports the following:<br>- `suffixes` - Subdirectory suffix list |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| string | Returns file path if found, nil if not found |
+
+#### Usage
+
 This interface provides a more powerful project than [os.files](/api/scripts/builtin-modules/os#os-files),
 which can specify multiple search directories at the same time, and can also specify additional subdirectories for each directory to match the pattern lookup,
 which is equivalent to an enhanced version of [os.files](/api/scripts/builtin-modules/os#os-files).
@@ -68,6 +92,30 @@ We can also quickly call and test this interface with the `xmake lua` plugin: `x
 
 - Find the path
 
+#### Function Prototype
+
+::: tip API
+```lua
+find_path(file: <string>, paths: <table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| file | Required. File or directory path |
+| paths | Required. Search path list |
+| opt | Optional. Option parameters, supports the following:<br>- `suffixes` - Subdirectory suffix |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| string | Returns path if found, nil if not found |
+
+#### Usage
+
 The usage of this interface is similar to [lib.detect.find_file](#detect-find_file), the only difference is that the returned results are different.
 After the interface finds the incoming file path, it returns the corresponding search path, not the file path itself. It is generally used to find the parent directory location corresponding to the file.
 
@@ -95,6 +143,30 @@ local p = find_path("include/*.h", { "/usr", "/usr/local/**"}, {suffixes = "/sub
 
 - Find library files
 
+#### Function Prototype
+
+::: tip API
+```lua
+find_library(name: <string>, paths: <table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| name | Required. Library name |
+| paths | Required. Search path list |
+| opt | Optional. Option parameters, supports the following:<br>- `kind` - Library type, static or shared<br>- `suffixes` - Subdirectory suffix |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| table | Returns library info table (contains filename, linkdir, link, kind), nil if not found |
+
+#### Usage
+
 This interface is used to find library files (static libraries, dynamic libraries) in the specified search directory, for example:
 
 ```lua
@@ -132,6 +204,29 @@ local library = find_library("cryp*", {"/usr", "/usr/local"}, {suffixes = "/lib"
 
 - Find executable programs
 
+#### Function Prototype
+
+::: tip API
+```lua
+find_program(name: <string>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| name | Required. Program name |
+| opt | Optional. Option parameters, supports the following:<br>- `paths` - Search path list<br>- `check` - Check command or function |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| string | Returns program path if found, nil if not found |
+
+#### Usage
+
 This interface is more primitive than [lib.detect.find_tool](#detect-find_tool), looking for executables through the specified parameter directory.
 
 ```lua
@@ -174,6 +269,28 @@ We can also test quickly with `xmake lua lib.detect.find_program ccache`.
 
 - Find the executable version number
 
+#### Function Prototype
+
+::: tip API
+```lua
+find_programver(name: <string>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| name | Required. Program name |
+| opt | Optional. Option parameters, supports the following:<br>- `command` - Version command or function<br>- `parse` - Version parsing rule or function |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| string | Returns version number if found, nil if not found |
+
+#### Usage
 
 ```lua
 import("lib.detect.find_programver")
@@ -212,16 +329,38 @@ We can also test quickly with `xmake lua lib.detect.find_programver ccache`.
 
 - Find package files
 
+::: warning NOTE
 After 2.6.x this interface is not recommended for direct use (internal use only), for library integration, please use `add_requires()` and `add_packages()` as much as possible.
+:::
 
 ## detect.find_tool
 
 - Find tool
 
-This interface is also used to find executable programs, but more
-advanced than [lib.detect.find_program](#detect-find_program), the
-function is also more powerful, it encapsulates the executable
-program, providing the concept of tools:
+#### Function Prototype
+
+::: tip API
+```lua
+find_tool(toolname: <string>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| toolname | Required. Tool name |
+| opt | Optional. Option parameters, supports the following:<br>- `program` - Program command<br>- `version` - Whether to get version<br>- `paths` - Search paths<br>- `check` - Check command or function |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| table | Returns tool info table (contains name, program, version), nil if not found |
+
+#### Usage
+
+This interface is also used to find executable programs, but more advanced than [lib.detect.find_program](#detect-find_program), the function is also more powerful, it encapsulates the executable program, providing the concept of tools:
 
 * toolname: tool name, short for executable program, used to mark a
 * tool, for example: `gcc`, `clang`, etc.  program: executable program
@@ -349,8 +488,29 @@ We can also test quickly with `xmake lua lib.detect.find_tool clang`.
 
 - Find tool name
 
-Match the corresponding tool name with the program command, for
-example:
+#### Function Prototype
+
+::: tip API
+```lua
+find_toolname(program: <string>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| program | Required. Program command or path |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| string | Returns tool name |
+
+#### Usage
+
+Match the corresponding tool name with the program command, for example:
 
 | program | toolname |
 | ------------------------- | ---------- |
@@ -367,6 +527,28 @@ Compared with program, toolname can uniquely mark a tool, and it is also conveni
 
 - Find CUDA devices of the host
 
+#### Function Prototype
+
+::: tip API
+```lua
+find_cudadevices(opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| opt | Optional. Option parameters, supports the following:<br>- `skip_compute_mode_prohibited` - Skip compute mode prohibited devices<br>- `min_sm_arch` - Minimum SM architecture<br>- `order_by_flops` - Order by performance |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| table | Returns CUDA device list |
+
+#### Usage
+
 Enumerate CUDA devices through the CUDA Runtime API and query theirs properties.
 
 ```lua
@@ -385,6 +567,29 @@ Please refer to [CUDA Toolkit Documentation](https://docs.nvidia.com/cuda/cuda-r
 
 - Get all the features of the specified tool
 
+#### Function Prototype
+
+::: tip API
+```lua
+features(toolname: <string>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| toolname | Required. Tool name |
+| opt | Optional. Option parameters, supports the following:<br>- `flags` - Flag list<br>- `program` - Program command |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| table | Returns feature list |
+
+#### Usage
+
 This interface is similar to [compiler.features](/api/scripts/extension-modules/core/tool/compiler#compiler-features). The difference is that this interface is more primitive. The passed argument is the actual tool name toolname.
 
 And this interface not only can get the characteristics of the compiler, the characteristics of any tool can be obtained, so it is more versatile.
@@ -405,6 +610,30 @@ A list of all compiler features can be found at [compiler.features](/api/scripts
 
 - Determine if the specified feature is supported
 
+#### Function Prototype
+
+::: tip API
+```lua
+has_features(toolname: <string>, features: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| toolname | Required. Tool name |
+| features | Required. Feature name or feature list |
+| opt | Optional. Option parameters, supports the following:<br>- `flags` - Flag list<br>- `program` - Program command |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean\|table | Returns boolean for single feature, returns supported feature sublist for list |
+
+#### Usage
+
 This interface is similar to [compiler.has_features](/api/scripts/extension-modules/core/tool/compiler#compiler-has_features), but more primitive, the passed argument is the actual tool name toolname.
 
 And this interface can not only judge the characteristics of the compiler, but the characteristics of any tool can be judged, so it is more versatile.
@@ -425,6 +654,30 @@ A list of all compiler features can be found at [compiler.features](/api/scripts
 
 - Determine if the specified parameter option is supported
 
+#### Function Prototype
+
+::: tip API
+```lua
+has_flags(toolname: <string>, flags: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| toolname | Required. Tool name |
+| flags | Required. Flag or flag list |
+| opt | Optional. Option parameters, supports the following:<br>- `program` - Program command<br>- `toolkind` - Tool type |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true if supported, false otherwise |
+
+#### Usage
+
 This interface is similar to [compiler.has_flags](/api/scripts/extension-modules/core/tool/compiler#compiler-has_flags), but more primitive, the passed argument is the actual tool name toolname.
 
 ```lua
@@ -443,6 +696,29 @@ The detection of this interface has been optimized. Except for the cache mechani
 
 - Determine if the specified c function exists
 
+#### Function Prototype
+
+::: tip API
+```lua
+has_cfuncs(funcs: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| funcs | Required. Function name or function list |
+| opt | Optional. Option parameters, supports the following:<br>- `includes` - Include file list<br>- `configs` - Config options<br>- `target` - Target object<br>- `verbose` - Whether to output verbosely |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true if exists, false otherwise |
+
+#### Usage
+
 This interface is a simplified version of [lib.detect.check_cxsnippets](#detect-check_cxsnippets) and is only used to detect functions.
 
 ```lua
@@ -472,12 +748,58 @@ The verbose is used to echo the detection information, the target is used to app
 
 - Determine if the specified c++ function exists
 
+#### Function Prototype
+
+::: tip API
+```lua
+has_cxxfuncs(funcs: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| funcs | Required. Function name or function list |
+| opt | Optional. Option parameters, supports the following:<br>- `includes` - Include file list<br>- `configs` - Config options<br>- `target` - Target object<br>- `verbose` - Whether to output verbosely |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true if exists, false otherwise |
+
+#### Usage
+
 This interface is similar to [lib.detect.has_cfuncs](#detect-has_cfuncs), please refer to its instructions for use. The only difference is that this interface is used to detect c++ functions.
 
 ## detect.has_cincludes
 
 - Determine if the specified c header file exists
 
+#### Function Prototype
+
+::: tip API
+```lua
+has_cincludes(includes: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| includes | Required. Include file name or include file list |
+| opt | Optional. Option parameters, supports the following:<br>- `target` - Target object<br>- `configs` - Config options |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true if exists, false otherwise |
+
+#### Usage
+
 This interface is a simplified version of [lib.detect.check_cxsnippets](#detect-check_cxsnippets) and is only used to detect header files.
 
 ```lua
@@ -492,13 +814,59 @@ local ok = has_cincludes({"stdio.h", "stdlib.h"}, {configs = {defines = "_GNU_SO
 
 - Determine if the specified c++ header file exists
 
-This interface is similar to [lib.detect.has_cincludess](#detect-has_cincludes), please refer to its instructions for use. The only difference is that this interface is used to detect c++ header files.
+#### Function Prototype
+
+::: tip API
+```lua
+has_cxxincludes(includes: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| includes | Required. Include file name or include file list |
+| opt | Optional. Option parameters, supports the following:<br>- `target` - Target object<br>- `configs` - Config options |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true if exists, false otherwise |
+
+#### Usage
+
+This interface is similar to [lib.detect.has_cincludes](#detect-has_cincludes), please refer to its instructions for use. The only difference is that this interface is used to detect c++ header files.
 
 ## detect.has_ctypes
 
 - Determine if the specified c type exists
 
-This interface is a simplified version of [lib.detect.check_cxsnippets](#detect-check_cxsnippets) and is only used to detect functions.
+#### Function Prototype
+
+::: tip API
+```lua
+has_ctypes(types: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| types | Required. Type name or type list |
+| opt | Optional. Option parameters, supports the following:<br>- `includes` - Include file list<br>- `configs` - Config options |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true if exists, false otherwise |
+
+#### Usage
+
+This interface is a simplified version of [lib.detect.check_cxsnippets](#detect-check_cxsnippets) and is only used to detect types.
 
 ```lua
 import("lib.detect.has_ctypes")
@@ -512,13 +880,59 @@ local ok = has_ctypes("wchar_t", {includes = {"stdio.h", "stdlib.h"}, configs =
 
 - Determine if the specified c++ type exists
 
-This interface is similar to [lib.detect.has_ctypess](#detect-has_ctypes). Please refer to its instructions for use. The only difference is that this interface is used to detect c++ types.
+#### Function Prototype
+
+::: tip API
+```lua
+has_cxxtypes(types: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| types | Required. Type name or type list |
+| opt | Optional. Option parameters, supports the following:<br>- `includes` - Include file list<br>- `configs` - Config options |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true if exists, false otherwise |
+
+#### Usage
+
+This interface is similar to [lib.detect.has_ctypes](#detect-has_ctypes). Please refer to its instructions for use. The only difference is that this interface is used to detect c++ types.
 
 ## detect.check_cxsnippets
 
 - Check if the c/c++ code snippet can be compiled
 
-The generic c/c++ code snippet detection interface, by passing in a list of multiple code snippets, it will automatically generate a compiled file, and then common sense to compile it, if the compilation pass returns true.
+#### Function Prototype
+
+::: tip API
+```lua
+check_cxsnippets(snippets: <string|table>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| snippets | Required. Code snippet or code snippet list |
+| opt | Optional. Option parameters, supports the following:<br>- `types` - Type list<br>- `includes` - Include file list<br>- `funcs` - Function list<br>- `links` - Link library list<br>- `target` - Target object<br>- `sourcekind` - Source file type |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true if compilation passes, false otherwise |
+
+#### Usage
+
+The generic c/c++ code snippet detection interface, by passing in a list of multiple code snippets, it will automatically generate a compiled file, and then try to compile it, if the compilation pass returns true.
 
 For some complex compiler features, even if [compiler.has_features](/api/scripts/extension-modules/core/tool/compiler#compiler-has_features) can't detect it,
 you can detect it by trying to compile through this interface.

+ 24 - 0
docs/api/scripts/extension-modules/net/http.md

@@ -6,6 +6,30 @@ This module provides various operational support for http. The currently availab
 
 - Download http file
 
+#### Function Prototype
+
+::: tip API
+```lua
+http.download(url: <string>, outputfile: <string>, opt: <table>)
+```
+:::
+
+#### Parameter Description
+
+| Parameter | Description |
+|-----------|-------------|
+| url | Required. URL to download |
+| outputfile | Required. Output file path |
+| opt | Optional. Option parameters, supports the following:<br>- `headers` - HTTP headers<br>- `timeout` - Timeout duration<br>- `useragent` - User agent |
+
+#### Return Value
+
+| Type | Description |
+|------|-------------|
+| boolean | Returns true on success, false on failure |
+
+#### Usage
+
 This interface is relatively simple, is simply download files.
 
 ```lua

+ 423 - 4
docs/zh/api/scripts/extension-modules/lib/detect.md

@@ -11,6 +11,30 @@
 
 - 查找文件
 
+#### 函数原型
+
+::: tip API
+```lua
+find_file(file: <string>, paths: <table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| file | 必需。文件名或路径 |
+| paths | 必需。搜索路径列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `suffixes` - 子目录后缀列表 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| string | 找到文件返回文件路径,未找到返回 nil |
+
+#### 用法说明
+
 这个接口提供了比[os.files](/zh/api/scripts/builtin-modules/os#os-files)更加强大的工程, 可以同时指定多个搜索目录,并且还能对每个目录指定附加的子目录,
 来模式匹配查找,相当于是[os.files](/zh/api/scripts/builtin-modules/os#os-files)的增强版。
 
@@ -67,6 +91,30 @@ local file = find_file("test.h", { "/usr", "/usr/local"}, {suffixes = {"/include
 
 - 查找路径
 
+#### 函数原型
+
+::: tip API
+```lua
+find_path(file: <string>, paths: <table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| file | 必需。文件或目录路径 |
+| paths | 必需。搜索路径列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `suffixes` - 子目录后缀 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| string | 找到返回路径,未找到返回 nil |
+
+#### 用法说明
+
 这个接口的用法跟[lib.detect.find_file](#detect-find_file)类似,唯一的区别是返回的结果不同。
 此接口查找到传入的文件路径后,返回的是对应的搜索路径,而不是文件路径本身,一般用于查找文件对应的父目录位置。
 
@@ -94,6 +142,30 @@ local p = find_path("include/*.h", { "/usr", "/usr/local/**"}, {suffixes = "/sub
 
 - 查找库文件
 
+#### 函数原型
+
+::: tip API
+```lua
+find_library(name: <string>, paths: <table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| name | 必需。库名称 |
+| paths | 必需。搜索路径列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `kind` - 库类型,static 或 shared<br>- `suffixes` - 子目录后缀 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| table | 返回库信息表(包含 filename, linkdir, link, kind),未找到返回 nil |
+
+#### 用法说明
+
 此接口用于指定的搜索目录中查找库文件(静态库,动态库),例如:
 
 ```lua
@@ -131,6 +203,29 @@ local library = find_library("cryp*", {"/usr", "/usr/local"}, {suffixes = "/lib"
 
 - 查找可执行程序
 
+#### 函数原型
+
+::: tip API
+```lua
+find_program(name: <string>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| name | 必需。程序名称 |
+| opt | 可选。选项参数,支持以下选项:<br>- `paths` - 搜索路径列表<br>- `check` - 检查命令或函数 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| string | 找到返回程序路径,未找到返回 nil |
+
+#### 用法说明
+
 这个接口比[lib.detect.find_tool](#detect-find_tool)较为原始底层,通过指定的参数目录来查找可执行程序。
 
 ```lua
@@ -173,6 +268,28 @@ local program = find_program("ccache", {paths = {"$(env PATH)", function () retu
 
 - 查找可执行程序版本号
 
+#### 函数原型
+
+::: tip API
+```lua
+find_programver(name: <string>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| name | 必需。程序名称 |
+| opt | 可选。选项参数,支持以下选项:<br>- `command` - 版本命令或函数<br>- `parse` - 版本解析规则或函数 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| string | 找到返回版本号,未找到返回 nil |
+
+#### 用法说明
 
 ```lua
 import("lib.detect.find_programver")
@@ -211,12 +328,37 @@ local version = find_programver("ccache", {command = "--version", parse = functi
 
 - 查找包文件
 
+::: warning 注意
 2.6.x 之后,这个接口不推荐直接使用(仅供内部使用),库集成,请尽量使用 `add_requires()` 和 `add_packages()`。
+:::
 
 ## detect.find_tool
 
 - 查找工具
 
+#### 函数原型
+
+::: tip API
+```lua
+find_tool(toolname: <string>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| toolname | 必需。工具名称 |
+| opt | 可选。选项参数,支持以下选项:<br>- `program` - 程序命令<br>- `version` - 是否获取版本<br>- `paths` - 搜索路径<br>- `check` - 检查命令或函数 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| table | 返回工具信息表(包含 name, program, version),未找到返回 nil |
+
+#### 用法说明
+
 此接口也是用于查找可执行程序,不过比[lib.detect.find_program](#detect-find_program)更加的高级,功能也更加强大,它对可执行程序进行了封装,提供了工具这个概念:
 
 * toolname: 工具名,可执行程序的简称,用于标示某个工具,例如:`gcc`, `clang`等
@@ -323,6 +465,28 @@ end
 
 - 查找工具名
 
+#### 函数原型
+
+::: tip API
+```lua
+find_toolname(program: <string>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| program | 必需。程序命令或路径 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| string | 返回工具名 |
+
+#### 用法说明
+
 通过program命令匹配对应的工具名,例如:
 
 | program                   | toolname   |
@@ -340,6 +504,28 @@ toolname相比program,更能唯一标示某个工具,也方便查找和加
 
 - 查找本机的 CUDA 设备
 
+#### 函数原型
+
+::: tip API
+```lua
+find_cudadevices(opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| opt | 可选。选项参数,支持以下选项:<br>- `skip_compute_mode_prohibited` - 跳过计算模式禁止的设备<br>- `min_sm_arch` - 最小SM架构<br>- `order_by_flops` - 按性能排序 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| table | 返回CUDA设备列表 |
+
+#### 用法说明
+
 通过 CUDA Runtime API 枚举本机的 CUDA 设备,并查询其属性。
 
 ```lua
@@ -357,6 +543,29 @@ local devices = find_cudadevices({ min_sm_arch = 35, order_by_flops = true })
 
 - 获取指定工具的所有特性
 
+#### 函数原型
+
+::: tip API
+```lua
+features(toolname: <string>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| toolname | 必需。工具名称 |
+| opt | 可选。选项参数,支持以下选项:<br>- `flags` - 标志列表<br>- `program` - 程序命令 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| table | 返回特性列表 |
+
+#### 用法说明
+
 此接口跟[compiler.features](/zh/api/scripts/extension-modules/core/tool/compiler#compiler-features)类似,区别就是此接口更加的原始,传入的参数是实际的工具名toolname。
 
 并且此接口不仅能够获取编译器的特性,任何工具的特性都可以获取,因此更加通用。
@@ -377,6 +586,30 @@ local features = features("clang", {flags = {"-g", "-O0", "-std=c++11"}})
 
 - 判断指定特性是否支持
 
+#### 函数原型
+
+::: tip API
+```lua
+has_features(toolname: <string>, features: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| toolname | 必需。工具名称 |
+| features | 必需。特性名或特性列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `flags` - 标志列表<br>- `program` - 程序命令 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean\|table | 如果传入单个特性返回boolean,传入列表返回支持的特性子列表 |
+
+#### 用法说明
+
 此接口跟[compiler.has_features](/zh/api/scripts/extension-modules/core/tool/compiler#compiler-has_features)类似,但是更加原始,传入的参数是实际的工具名toolname。
 
 并且此接口不仅能够判断编译器的特性,任何工具的特性都可以判断,因此更加通用。
@@ -397,6 +630,30 @@ local features = has_features("clang", {"cxx_constexpr", "c_static_assert"}, {fl
 
 - 判断指定参数选项是否支持
 
+#### 函数原型
+
+::: tip API
+```lua
+has_flags(toolname: <string>, flags: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| toolname | 必需。工具名称 |
+| flags | 必需。标志或标志列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `program` - 程序命令<br>- `toolkind` - 工具类型 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 支持返回 true,否则返回 false |
+
+#### 用法说明
+
 此接口跟[compiler.has_flags](/zh/api/scripts/extension-modules/core/tool/compiler#compiler-has_flags)类似,但是更加原始,传入的参数是实际的工具名toolname。
 
 ```lua
@@ -415,6 +672,29 @@ local ok = has_flags("clang", "-g -O0", {toolkind = "cxx"})
 
 - 判断指定c函数是否存在
 
+#### 函数原型
+
+::: tip API
+```lua
+has_cfuncs(funcs: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| funcs | 必需。函数名或函数列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `includes` - 头文件列表<br>- `configs` - 配置选项<br>- `target` - 目标对象<br>- `verbose` - 是否详细输出 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 存在返回 true,否则返回 false |
+
+#### 用法说明
+
 此接口是[lib.detect.check_cxsnippets](#detect-check_cxsnippets)的简化版本,仅用于检测函数。
 
 ```lua
@@ -444,12 +724,58 @@ local ok = has_cfuncs({"sigsetjmp((void*)0, 0)", "setjmp"}, {includes = "setjmp.
 
 - 判断指定c++函数是否存在
 
+#### 函数原型
+
+::: tip API
+```lua
+has_cxxfuncs(funcs: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| funcs | 必需。函数名或函数列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `includes` - 头文件列表<br>- `configs` - 配置选项<br>- `target` - 目标对象<br>- `verbose` - 是否详细输出 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 存在返回 true,否则返回 false |
+
+#### 用法说明
+
 此接口跟[lib.detect.has_cfuncs](#detect-has_cfuncs)类似,请直接参考它的使用说明,唯一区别是这个接口用于检测c++函数。
 
 ## detect.has_cincludes
 
 - 判断指定c头文件是否存在
 
+#### 函数原型
+
+::: tip API
+```lua
+has_cincludes(includes: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| includes | 必需。头文件名或头文件列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `target` - 目标对象<br>- `configs` - 配置选项 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 存在返回 true,否则返回 false |
+
+#### 用法说明
+
 此接口是[lib.detect.check_cxsnippets](#detect-check_cxsnippets)的简化版本,仅用于检测头文件。
 
 ```lua
@@ -464,13 +790,59 @@ local ok = has_cincludes({"stdio.h", "stdlib.h"}, {configs = {defines = "_GNU_SO
 
 - 判断指定c++头文件是否存在
 
-此接口跟[lib.detect.has_cincludess](#detect-has_cincludes)类似,请直接参考它的使用说明,唯一区别是这个接口用于检测c++头文件。
+#### 函数原型
+
+::: tip API
+```lua
+has_cxxincludes(includes: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| includes | 必需。头文件名或头文件列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `target` - 目标对象<br>- `configs` - 配置选项 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 存在返回 true,否则返回 false |
+
+#### 用法说明
+
+此接口跟[lib.detect.has_cincludes](#detect-has_cincludes)类似,请直接参考它的使用说明,唯一区别是这个接口用于检测c++头文件。
 
 ## detect.has_ctypes
 
 - 判断指定c类型是否存在
 
-此接口是[lib.detect.check_cxsnippets](#detect-check_cxsnippets)的简化版本,仅用于检测函数。
+#### 函数原型
+
+::: tip API
+```lua
+has_ctypes(types: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| types | 必需。类型名或类型列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `includes` - 头文件列表<br>- `configs` - 配置选项 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 存在返回 true,否则返回 false |
+
+#### 用法说明
+
+此接口是[lib.detect.check_cxsnippets](#detect-check_cxsnippets)的简化版本,仅用于检测类型。
 
 ```lua
 import("lib.detect.has_ctypes")
@@ -484,13 +856,60 @@ local ok = has_ctypes("wchar_t", {includes = {"stdio.h", "stdlib.h"}, configs =
 
 - 判断指定c++类型是否存在
 
-此接口跟[lib.detect.has_ctypess](#detect-has_ctypes)类似,请直接参考它的使用说明,唯一区别是这个接口用于检测c++类型。
+#### 函数原型
+
+::: tip API
+```lua
+has_cxxtypes(types: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| types | 必需。类型名或类型列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `includes` - 头文件列表<br>- `configs` - 配置选项 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 存在返回 true,否则返回 false |
+
+#### 用法说明
+
+此接口跟[lib.detect.has_ctypes](#detect-has_ctypes)类似,请直接参考它的使用说明,唯一区别是这个接口用于检测c++类型。
 
 ## detect.check_cxsnippets
 
 - 检测c/c++代码片段是否能够编译通过
 
-通用的c/c++代码片段检测接口,通过传入多个代码片段列表,它会自动生成一个编译文件,然后常识对它进行编译,如果编译通过返回true。
+#### 函数原型
+
+::: tip API
+```lua
+check_cxsnippets(snippets: <string|table>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| snippets | 必需。代码片段或代码片段列表 |
+| opt | 可选。选项参数,支持以下选项:<br>- `types` - 类型列表<br>- `includes` - 头文件列表<br>- `funcs` - 函数列表<br>- `links` - 链接库列表<br>- `target` - 目标对象<br>- `sourcekind` - 源文件类型 |
+| | |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 编译通过返回 true,否则返回 false |
+
+#### 用法说明
+
+通用的c/c++代码片段检测接口,通过传入多个代码片段列表,它会自动生成一个编译文件,然后尝试对它进行编译,如果编译通过返回true。
 
 对于一些复杂的编译器特性,连[compiler.has_features](/zh/api/scripts/extension-modules/core/tool/compiler#compiler-has_features)都无法检测到的时候,可以通过此接口通过尝试编译来检测它。
 

+ 24 - 0
docs/zh/api/scripts/extension-modules/net/http.md

@@ -6,6 +6,30 @@
 
 - 下载http文件
 
+#### 函数原型
+
+::: tip API
+```lua
+http.download(url: <string>, outputfile: <string>, opt: <table>)
+```
+:::
+
+#### 参数说明
+
+| 参数 | 描述 |
+|------|------|
+| url | 必需。要下载的URL地址 |
+| outputfile | 必需。输出文件路径 |
+| opt | 可选。选项参数,支持以下选项:<br>- `headers` - HTTP头信息<br>- `timeout` - 超时时间<br>- `useragent` - 用户代理 |
+
+#### 返回值说明
+
+| 类型 | 描述 |
+|------|------|
+| boolean | 下载成功返回 true,失败返回 false |
+
+#### 用法说明
+
 这个接口比较简单,就是单纯的下载文件。
 
 ```lua