SonolusHaniwa
  • 1. 概述
  • 2. ハニプレ
  • 3. ユメステ
  • 4. Stellarity
  • 5. Phigros
  • 首页

    • 1. 概述
  • 玩家

    • 2. 安装服务
    • 3. 配置文件标准
    • 4. 服务使用方法
  • 开发者

    • 5. 自定义搜索函数
    • 6. 自定义资源创建接口
    • 7. 插件开发标准
  • 其他

    • 8. 更新日志
    • 9. 关于 srp 资源包
  • 1. 搭建开发环境
  • 2. Sonolus 基础
  • 3. 配置项目信息
  • 4. 基本数据类型
  • 5. 函数与语句块
  • 6. 注意事项
  • 1. 游玩模式基础
  • Index

    • 1. Introduce
  • Basics

    • 1. Index
    • 2. Types
    • 3. Statements
    • 4. Resources
    • 5. Projects
    • 6. Commands
  • API

    • Index
    • Macros
    • Builtins
    • Engine Options
    • Engine UI
    • Play Mode
    • Tutorial Mode
    • Preview Mode
    • Watch Mode
  • 1. 概述
  • 2. ハニプレ
  • 3. ユメステ
  • 4. Stellarity
  • 5. Phigros
  • 首页

    • 1. 概述
  • 玩家

    • 2. 安装服务
    • 3. 配置文件标准
    • 4. 服务使用方法
  • 开发者

    • 5. 自定义搜索函数
    • 6. 自定义资源创建接口
    • 7. 插件开发标准
  • 其他

    • 8. 更新日志
    • 9. 关于 srp 资源包
  • 1. 搭建开发环境
  • 2. Sonolus 基础
  • 3. 配置项目信息
  • 4. 基本数据类型
  • 5. 函数与语句块
  • 6. 注意事项
  • 1. 游玩模式基础
  • Index

    • 1. Introduce
  • Basics

    • 1. Index
    • 2. Types
    • 3. Statements
    • 4. Resources
    • 5. Projects
    • 6. Commands
  • API

    • Index
    • Macros
    • Builtins
    • Engine Options
    • Engine UI
    • Play Mode
    • Tutorial Mode
    • Preview Mode
    • Watch Mode
  • Index

    • 1. Introduce
  • Basics

    • 1. Index
    • 2. Types
    • 3. Statements
    • 4. Resources
    • 5. Projects
    • 6. Commands
  • API

    • Index
    • Macros
    • Builtins
    • Engine Options
    • Engine UI
    • Play Mode
    • Tutorial Mode
    • Preview Mode
    • Watch Mode

Builtins

function printStack

Description: Prints the current call stack to the standard error stream for debugging purposes.

function SonolusAssert

Description: A macro used to perform assertions during compilation. If the condition is false, it logs an error message and aborts the program.

Parameters:

ParameterTypeDefaultDescription
exprexpressionrequiredThe condition to assert.
...format argumentsrequiredVariable arguments for the error message.

function createNodeContainer

Description: Initializes a new node container for storing function nodes. Optionally controls whether a block counter should be added.

Parameters:

ParameterTypeDefaultDescription
addbooltrueIf true, the block counter is pushed onto the stack. If false, the current block counter is updated.

function mergeNodeContainer

Description: Merges the current node container into a single block node and updates the block counter accordingly.

Returns:

TypeDescription
FuncNodeA merged FuncNode representing a block of executed nodes. If the container is empty, returns a block with a single 0 node.

function SonolusRun

Description: Executes the provided FuncNode and adds it to the current node container.

Parameters:

ParameterTypeDefaultDescription
codeFuncNoderequiredThe function node to be executed and added to the current node container.

function SizeOf

Description: Measures the Sonolus memory size of an object of type T.

Returns:

TypeDescription
map<int, int>A map representing the memory size of the object. The key is the block id, and the value is the size.

JSON library

function json_encode

Description: Converts a Json::Value object into a JSON string using the Json::FastWriter to produce a compact representation.

Parameters:

ParameterTypeDefaultDescription
valJson::ValuerequiredThe JSON value object to be encoded into a string.

Returns:

TypeDescription
stringA compact JSON string representation of val.

function json_pretty_encode

Description: Converts a Json::Value object into a JSON string using the Json::StyledWriter to produce a formatted and human-readable representation.

Parameters:

ParameterTypeDefaultDescription
valJson::ValuerequiredThe JSON value object to be encoded into a pretty string.

Returns:

TypeDescription
stringA pretty-printed JSON string representation of val.

function json_decode

Description: Parses a JSON string into a Json::Value object using the Json::Reader.

Parameters:

ParameterTypeDefaultDescription
jsonstringrequiredThe JSON string to be parsed into a Json::Value object.
resJson::Value&requiredReference to the Json::Value object where the parsed result will be stored.

Returns:

TypeDescription
boolReturns true if parsing is successful, otherwise false.

function json_decode

Description: Parses a JSON string into a Json::Value object using the Json::Reader and returns the result directly.

Parameters:

ParameterTypeDefaultDescription
jsonstringrequiredThe JSON string to be parsed into a Json::Value object.

Returns:

TypeDescription
Json::ValueThe parsed JSON value object from the input string.

GZip library

function compress_gzip

Description: Compresses a string using the GZIP compression method via zlib.

Parameters:

ParameterTypeDefaultDescription
strstringrequiredThe input string to be compressed.
compressionlevelintZ_BEST_COMPRESSIONThe compression level to use. Valid values are from Z_NO_COMPRESSION to Z_BEST_COMPRESSION.

Returns:

TypeDescription
stringThe compressed output string in GZIP format.

function compress_deflate

Description: Compresses a string using the DEFLATE compression method via zlib.

Parameters:

ParameterTypeDefaultDescription
strstringrequiredThe input string to be compressed.
compressionlevelintZ_BEST_COMPRESSIONThe compression level to use. Valid values are from Z_NO_COMPRESSION to Z_BEST_COMPRESSION.

Returns:

TypeDescription
stringThe compressed output string in DEFLATE format.

function decompress_deflate

Description: Decompresses a string that was compressed using the DEFLATE method via zlib.

Parameters:

ParameterTypeDefaultDescription
strstringrequiredThe input string to be decompressed.

Returns:

TypeDescription
stringThe decompressed output string in plain text.

function decompress_gzip

Description: Decompresses a string that was compressed using the GZIP method via zlib.

Parameters:

ParameterTypeDefaultDescription
strstringrequiredThe input string to be decompressed.

Returns:

TypeDescription
stringThe decompressed output string in plain text.
最近更新: 2025/8/1 15:21
Contributors: LittleYang0531
Prev
Macros
Next
Engine Options