Added documentation example

May be used as-is or put in the code in the future.
I'm not sure yet, and I'll vibe code something since the PB tool for doc has "issues"...
This commit is contained in:
2026-10-24 08:28:43 +02:00
parent c177dbf142
commit d04e0821d1
3 changed files with 176 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
# _MsgPack_ErrorCodes
## Values
<table>
<thead>
<th>Name</th>
<th>Details</th>
</thead>
<tbody>
<tr>
<td><code>#MsgPack_Error_Success</code></td>
<td>???</td>
</tr>
<tr></tr>
<tr>
<td><code>#MsgPack_Error_NullPointerGiven</code></td>
<td>Returned whenever a function receives a <code>#Null</code> pointer to/for a [???] structure.</td>
</tr>
<tr>
<td><code>#MsgPack_Error_BufferTooSmall</code></td>
<td>???</td>
</tr>
<tr>
<td><code>#MsgPack_Error_FailedToGrowBuffer</code></td>
<td>???</td>
</tr>
<tr>
<td><code>#MsgPack_Error_AtOrPastTheEndOfBuffer</code></td>
<td>???</td>
</tr>
<tr>
<td><code>#MsgPack_Error_ReadPastEndOfBuffer</code></td>
<td>???</td>
</tr>
<tr>
<td><code>#MsgPack_Error_InvalidFormatCode</code></td>
<td>???</td>
</tr>
<tr></tr>
<tr>
<td><code>#MsgPack_Error_BinaryDataSizeIsNegative</code></td>
<td>???</td>
</tr>
<tr>
<td><code>#MsgPack_Error_BinaryDataSizeIsTooBig</code></td>
<td>???</td>
</tr>
<tr></tr>
<tr>
<td><code>#MsgPack_Error_CannotGrowBufferDueToConfig</code></td>
<td>???</td>
</tr>
</tbody>
</table>
@@ -0,0 +1,46 @@
# MsgPackWriteNull
## Syntax
```purebasic
Result.MsgPack_ErrorCode = MsgPackWriteNull(*MsgPackData.MsgPackData)
```
## Description
Writes a null field in the given MessagePack at its current offset.
The offset may be grown if required, and if ´MsgPackData\Flags´ has ´???´ unset. \
The offset may be incremented if the ´MsgPackData\Flags´ has ´???´ set.
## Parameters
## Return value
Returns `#MsgPack_Error_Success` on success.
Returns other error constants on failure:
* `#MsgPack_Error_NullPointerGiven` if `MsgPackData` parameter is `#Null`
* ???
* ???
In all cases, except for ´#MsgPack_Error_NullPointerGiven´, the value of ´MsgPackData\LastError´ will contains the returned code.
## Supports
### Compiler
* PureBasic 5.70+
* PureBasic 6.xx - ASM
* PureBasic 6.xx - GCC
### OS
* Windows
* Linux
* MacOS *(Untested)*
### CPU
* x86
* x64
* arm64
@@ -0,0 +1,74 @@
# MsgPackData
## Overview
Obscure structure that
## Structure
```purebasic
Structure MsgPackData
; Offset used when reading or writing.
BufferOffset.i
; Used in place of `MemorySize()` to reduce syscalls.
BufferSize.i
; Temp mechanism for buffer growth.
BufferGrowthIncrements.i
; IteratorSizeLeft, or snoething like this.
; LastError code
LastError.MsgPack_ErrorCode
; TODO
DataFlags.MsgPack_DataFlag
; Pointer to a data buffer.
; Can be freed by the caller or this module.
*Buffer
EndStructure
```
## Fields
<table>
<thead>
<th>Name</th>
<th>Type</th>
<th>Details</th>
</thead>
<tbody>
<tr>
<td><code>BufferOffset</code></td>
<td><code>.i</code></td>
<td>Internal offset into **Buffer*</td>
</tr>
<tr>
<td><code>BufferSize</code></td>
<td><code>.i</code></td>
<td>...</td>
</tr>
<tr>
<td><code>BufferGrowthIncrements</code></td>
<td><code>.i</code></td>
<td>...</td>
</tr>
<tr>
<td><code>LastError</code></td>
<td><code>.MsgPack_ErrorCode</code></td>
<td>...</td>
</tr>
<tr>
<td><code>DataFlags</code></td>
<td><code>.MsgPack_DataFlag</code></td>
<td>...</td>
</tr>
<tr>
<td><code>Buffer</code></td>
<td><i>Pointer</i></td>
<td>...</td>
</tr>
</tbody>
</table>