diff options
author | Sven Gothel <[email protected]> | 2023-08-04 11:56:46 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-08-04 11:56:46 +0200 |
commit | 9b0335ea91c39469b586b4005dfae35d4b2cc84b (patch) | |
tree | 7a463a36f8cbb215d6ea227b4b30db703d3f3a89 | |
parent | 927bbc7160a812bb29c0e7120d4a3009bfb13bbf (diff) |
doc/GlueGen_Mapping.md: Shorten UserParamIndex '<0' to disable 'UserParam' and produce html page
-rw-r--r-- | doc/GlueGen_Mapping.html | 65 | ||||
-rw-r--r-- | doc/GlueGen_Mapping.md | 4 |
2 files changed, 65 insertions, 4 deletions
diff --git a/doc/GlueGen_Mapping.html b/doc/GlueGen_Mapping.html index 50bae2f..43f9219 100644 --- a/doc/GlueGen_Mapping.html +++ b/doc/GlueGen_Mapping.html @@ -476,6 +476,8 @@ <li><a href="#javacallback-example-11b-heterogeneous-pointerstruct-type">JavaCallback Example 11b (<em>Heterogeneous Pointer/Struct Type</em>)</a></li> + <li><a href="#javacallback-example-12-without-userparam">JavaCallback + Example 12 (Without UserParam)</a></li> </ul></li> <li><a href="#misc-configurations">Misc Configurations</a> <ul> @@ -2048,7 +2050,8 @@ use the same <code>CallbackFunctionType</code>.</p> <li><code>SetCallbackFunction</code>: <code>SetCallbackFunction</code> name of the native toolkit API responsible to set the callback</li> <li><code>SetCallback-UserParamIndex</code>: <code>UserParam</code> -parameter-index of the <code>SetCallbackFunction</code></li> +parameter-index of the <code>SetCallbackFunction</code> or +<code><0</code> to disable <code>UserParam</code></li> <li><code>CallbackFunctionType</code>: The native toolkit API typedef-name of the function-pointer-type, aka the callback type name</li> @@ -2056,7 +2059,8 @@ name</li> <code>userParam</code> parameter-index of the <code>CallbackFunctionType</code>, which allows to <a href="#struct-type-user-param-heterogeneous">indicate a heterogeneous -<code>UserParam</code></a></li> +<code>UserParam</code></a> or <code><0</code> to disable +<code>UserParam</code></li> <li><code>Callback-UserParamClass</code>: Optional <a href="#custom-callback-userparamclass">custom <em>UserParamClass</em></a> overriding the default <code>Object</code> @@ -2618,6 +2622,63 @@ users' <code>void*</code> pointer with the /** Entry point (through function pointer) to C language function: <br> <code>void MessageCallback11bInject(size_t id, long val)</code><br> */ public void MessageCallback11bInject(long id, long val);</code></pre> +<h3 id="javacallback-example-12-without-userparam">JavaCallback Example +12 (Without UserParam)</h3> +<p>This example demonstrates a JavaCallBack without user param and only +a global key.</p> +<p>The callback <code>T2_CallbackFunc12</code> is managed by the toolkit +and passed to the callback function, while user passes JavaCallback to +the registration method <code>SetLogCallBack(..)</code>.</p> +<p>C-API Header snipped</p> +<pre><code> typedef enum { + LOG_Off = 0, + LOG_Fatal = 100, + LOG_Error = 200, + LOG_Warning = 300, + LOG_Info = 400, + LOG_Verbose = 500, + LOG_VeryVerbose = 600 + } LogLevel; + + typedef struct { + const char* Category; + const char* Message; + LogLevel Level; + } LogMessage; + + typedef void ( * T2_CallbackFunc12)(const LogMessage* usrParam); + + void SetLogCallBack(T2_CallbackFunc12 cbFunc); + void LogCallBackInject(const LogMessage* message);</code></pre> +<p>and the following GlueGen configuration</p> +<pre><code> ReturnsStringOnly LogMessage.Category + ReturnsStringOnly LogMessage.Message + + JavaCallbackDef SetLogCallBack -1 T2_CallbackFunc12 -1</code></pre> +<p>leading to the following interface</p> +<pre><code> + /** JavaCallback interface: T2_CallbackFunc12 -> void (*T2_CallbackFunc12)(const LogMessage * usrParam) */ + public static interface T2_CallbackFunc12 { + /** Interface to C language function: <br> <code>void callback(const LogMessage * usrParam)</code><br>Alias for: <code>T2_CallbackFunc12</code> */ + public void callback(LogMessage usrParam); + } + + ... + + /** Returns if callback is mapped for <br> <code> void SetLogCallBack(T2_CallbackFunc12 cbFunc)</code> */ + public boolean isSetLogCallBackMapped(); + + /** Returns T2_CallbackFunc12 callback for <br> <code> void SetLogCallBack(T2_CallbackFunc12 cbFunc)</code> */ + public T2_CallbackFunc12 getSetLogCallBack(); + + /** Releases callback data skipping toolkit API. Favor passing `null` callback ref to <br> <code> void SetLogCallBack(T2_CallbackFunc12 cbFunc)</code> */ + public void releaseSetLogCallBack(); + + /** Entry point (through function pointer) to C language function: <br> <code>void SetLogCallBack(T2_CallbackFunc12 cbFunc)</code><br> */ + public void SetLogCallBack(T2_CallbackFunc12 cbFunc); + + /** Entry point (through function pointer) to C language function: <br> <code>void LogCallBackInject(const LogMessage * message)</code><br> */ + public void LogCallBackInject(LogMessage message);</code></pre> <p><em>TODO: Enhance documentation</em></p> <h2 id="misc-configurations">Misc Configurations</h2> <h3 diff --git a/doc/GlueGen_Mapping.md b/doc/GlueGen_Mapping.md index 2dd425f..1262082 100644 --- a/doc/GlueGen_Mapping.md +++ b/doc/GlueGen_Mapping.md @@ -826,9 +826,9 @@ as it is core to the semantic mapping of all resources. They also have to use th `JavaCallbackDef` attributes: - `SetCallbackFunction`: `SetCallbackFunction` name of the native toolkit API responsible to set the callback -- `SetCallback-UserParamIndex`: `UserParam` parameter-index of the `SetCallbackFunction` or negative index to disable UserParam management +- `SetCallback-UserParamIndex`: `UserParam` parameter-index of the `SetCallbackFunction` or `<0` to disable `UserParam` - `CallbackFunctionType`: The native toolkit API typedef-name of the function-pointer-type, aka the callback type name -- `CallbackFunction-UserParamIndex`: The `userParam` parameter-index of the `CallbackFunctionType`, which allows to [indicate a heterogeneous `UserParam`](#struct-type-user-param-heterogeneous) or negative index to disable UserParam management +- `CallbackFunction-UserParamIndex`: The `userParam` parameter-index of the `CallbackFunctionType`, which allows to [indicate a heterogeneous `UserParam`](#struct-type-user-param-heterogeneous) or `<0` to disable `UserParam` - `Callback-UserParamClass`: Optional [custom *UserParamClass*](#custom-callback-userparamclass) overriding the default `Object` for non-compound `UserParam` types. - `Callback-KeyClass`: Optional [custom *KeyClass*](#custom-callback-keyclass), providing the hash-map-key. |