DLL Callback Functions: Difference between revisions

From Planimate Knowledge Base
Jump to navigation Jump to search
(Created page with "A DLL written for Planimate to call (in a routine) has a number of callback functions available to it. These give access to advanced services. === Reallocate Table Rows === Thi...")
 
No edit summary
 
Line 1: Line 1:
A DLL written for Planimate to call (in a routine) has a number of callback functions available to it. These give access to advanced services.
A DLL written for Planimate to call (in a routine) has a number of callback functions available to it. These give access to advanced services.  


=== Reallocate Table Rows ===
=== Reallocate Table Rows ===


This enables changing the memory allocation in a table direct parameter (PL_DLLPARAM_TABLEDIRECT) and is useful when the DLL&nbsp;needs an output table to grow to hold more rows. Existing row data in the table is retained, the new rows are not initialised. This only affects the table memory allocation, not the current table rows in use.<br>
This enables changing the memory allocation in a table direct parameter (PL_DLLPARAM_TABLEDIRECT) and is useful when the DLL&nbsp;needs an output table to grow to hold more rows. Existing row data in the table is retained, the new rows are not initialised. This only affects the table memory allocation, not the current table rows in use.<br>  
<pre>typedef int CALLBACK tPL_ReallocateTDTable(PLDLLHandle * pl_handle,
<pre>typedef int CALLBACK tPL_ReallocateTDTable(PLDLLHandle * pl_handle,
                                          PLRoutineInfo *,
PLRoutineInfo *,
                                          int which_input,
int which_input,
                                          int new_rows);
int new_rows);</pre>
=== Generate Breakpoint  ===


This enables a DLL to display text in the breakpoint/debugging dialog.
<pre>typedef int CALLBACK tPL_Breakpoint(PLDLLHandle * pl_handle,
const char * msg);</pre>
=== Pop Up Message  ===


This enables a DLL To pop up a MessageBox.
<pre>typedef int CALLBACK tPL_Message(PLDLLHandle * pl_handle,&lt;br&gt; const char * msg);</pre>
=== Real Time Broadcast  ===


This enables a DLL to trigger a real time broadcast. The callback will occur after interval (in milliseconds).
<pre>typedef int CALLBACK tPL_RealTimeBC(PLDLLHandle * pl_handle,
int interval);</pre>
=== Read System Integer  ===


</pre>
This enables reading of integer system properties, as defined in the accompanying enum.  
=== Generate Breakpoint ===
<pre>enum
This enables a DLL to display text in the breakpoint/debugging dialog.
<pre>typedef int CALLBACK tPL_Breakpoint(PLDLLHandle * pl_handle,
                                    const char * msg);</pre>
=== Pop Up Message ===
This enables a DLL To pop up a MessageBox.
<pre>typedef int CALLBACK tPL_Message(PLDLLHandle * pl_handle,<br> const char * msg);</pre>
 
=== Real Time Broadcast ===
This enables a DLL to trigger a real time broadcast. The callback will occur after interval (in milliseconds).
<pre>typedef int CALLBACK tPL_RealTimeBC(PLDLLHandle * pl_handle,
                                        int interval);</pre>
=== Read System Integer ===
This enables reading of integer system properties, as defined in the accompanying enum.
<pre>
enum
{
{
PLRSI_ENGINESTATE,
PLRSI_ENGINESTATE,
PLRSI_CURRENTPENDING,
PLRSI_CURRENTPENDING,
PLRSI_PLMDLVERSION
PLRSI_PLMDLVERSION
};  
};


typedef int CALLBACK tPL_ReadSystemInt(PLDLLHandle * pl_handle,
typedef int CALLBACK tPL_ReadSystemInt(PLDLLHandle * pl_handle,
                                      int ordinal);</pre>
int ordinal);</pre>  
=== Read System Double  ===


=== Read System Double ===
This enables reading of double-precision system properties, including the model clock.  
This enables reading of double-precision system properties, including the model clock.
<pre>enum
 
<pre>
enum
{
{
PLRSD_CLOCK,
PLRSD_CLOCK,
PLRSD_ADVANCETOTIME
PLRSD_ADVANCETOTIME
};
};


typedef double CALLBACK tPL_ReadSystemDouble(PLDLLHandle * pl_handle,
typedef double CALLBACK tPL_ReadSystemDouble(PLDLLHandle * pl_handle,
                                            int ordinal);</pre>
int ordinal);</pre>  
=== Parse Text To Value  ===


=== Parse Text To Value ===
This enables using Planimate's text parsing services to convert formatted text to a number. UNITS.HPP contains the valid units. Label Lists and Text formats are not supported. Planimate will use its current active Run Start Date for the 0-epoch for calendar dates.  
This enables using Planimate's text parsing services to convert formatted text to a number. UNITS.HPP contains the valid units. Label Lists and Text formats are not supported.
<pre>typedef int CALLBACK tPL_Parse(const char * text,<br> int units,<br> double &amp; result);</pre>
Planimate will use its current active Run Start Date for the 0-epoch for calendar dates.
=== Format Value To Text ===
 
<pre>
typedef int CALLBACK tPL_Parse(const char * text,<br> int units,<br> double &amp; result);
typedef int CALLBACK tPL_Format(double value,
 
                                int   units,
typedef int CALLBACK tPL_Format(double value,<br> int units,<br> char * into_buf,<br> int into_buf_size);
                                char * into_buf,
 
                                int into_buf_size);</pre>
typedef int CALLBACK tPL_GetColumnName(PLTableHandle * t,<br> int c,<br> char * into_buf,<br> int into_buf_size);
=== Get Column Name ===
 
This enables the name of a Table Direct table column to be read by the DLL.
typedef int CALLBACK tPL_SetTDCell(PLTableHandle * t,<br> int r,<br> int c,<br> const char * to);
<pre>
 
typedef int CALLBACK tPL_GetColumnName(PLTableHandle * t,
typedef int CALLBACK tPL_GetTDCell(PLTableHandle * t,<br> int r,<br> int c,<br> char * into_buf,<br> int into_buf_size);
                                      int   c,
                                      char * into_buf,
                                      int   into_buf_size);</pre>
=== Set Table Direct Cell ===
This enables setting a table cell through Planimate's table formatting services. It will parse the "to" text using the column's format. "Text" formatted columns are supported. Label formatted columns are supported for existing labels only.
<pre>
typedef int CALLBACK tPL_SetTDCell(PLTableHandle * t,
                                  int         r,
                                  int         c,
                                  const char * to);</pre>
=== Get Table Direct Cell ===
This enables reading a table cell in its text formatted form. It supports all format types including Label List and Text formatted columns.
<pre>
typedef int CALLBACK tPL_GetTDCell(PLTableHandle * t,
                                  int   r,
                                  int   c,
                                  char * into_buf,
                                  int    into_buf_size); </pre>
=== Find Table Column ===
This returns the 0-based column index of a table with a matching column name. It returns -1 if no column found.
<pre>
typedef int CALLBACK tPL_FindTDColumn(PLTableHandle * t,
                                      const char    * column_name);</pre>


<br> typedef int CALLBACK tPL_FindTDColumn(PLTableHandle * t,<br> const char * column_name);<br><br>
[[Category:DLL]]

Latest revision as of 12:05, 7 November 2011

A DLL written for Planimate to call (in a routine) has a number of callback functions available to it. These give access to advanced services.

Reallocate Table Rows

This enables changing the memory allocation in a table direct parameter (PL_DLLPARAM_TABLEDIRECT) and is useful when the DLL needs an output table to grow to hold more rows. Existing row data in the table is retained, the new rows are not initialised. This only affects the table memory allocation, not the current table rows in use.

typedef int CALLBACK tPL_ReallocateTDTable(PLDLLHandle * pl_handle,
PLRoutineInfo *,
int which_input,
int new_rows);

Generate Breakpoint

This enables a DLL to display text in the breakpoint/debugging dialog.

typedef int CALLBACK tPL_Breakpoint(PLDLLHandle * pl_handle,
const char * msg);

Pop Up Message

This enables a DLL To pop up a MessageBox.

typedef int CALLBACK tPL_Message(PLDLLHandle * pl_handle,<br> const char * msg);

Real Time Broadcast

This enables a DLL to trigger a real time broadcast. The callback will occur after interval (in milliseconds).

typedef int CALLBACK tPL_RealTimeBC(PLDLLHandle * pl_handle,
int interval);

Read System Integer

This enables reading of integer system properties, as defined in the accompanying enum.

enum
{
PLRSI_ENGINESTATE,
PLRSI_CURRENTPENDING,
PLRSI_PLMDLVERSION
};

typedef int CALLBACK tPL_ReadSystemInt(PLDLLHandle * pl_handle,
int ordinal);

Read System Double

This enables reading of double-precision system properties, including the model clock.

enum
{
PLRSD_CLOCK,
PLRSD_ADVANCETOTIME
};

typedef double CALLBACK tPL_ReadSystemDouble(PLDLLHandle * pl_handle,
int ordinal);

Parse Text To Value

This enables using Planimate's text parsing services to convert formatted text to a number. UNITS.HPP contains the valid units. Label Lists and Text formats are not supported. Planimate will use its current active Run Start Date for the 0-epoch for calendar dates.

typedef int CALLBACK tPL_Parse(const char * text,<br> int units,<br> double & result);

Format Value To Text

typedef int CALLBACK tPL_Format(double value,
                                int    units,
                                char * into_buf,
                                int into_buf_size);

Get Column Name

This enables the name of a Table Direct table column to be read by the DLL.

typedef int CALLBACK tPL_GetColumnName(PLTableHandle * t,
                                       int    c,
                                       char * into_buf,
                                       int    into_buf_size);

Set Table Direct Cell

This enables setting a table cell through Planimate's table formatting services. It will parse the "to" text using the column's format. "Text" formatted columns are supported. Label formatted columns are supported for existing labels only.

typedef int CALLBACK tPL_SetTDCell(PLTableHandle * t,
                                   int          r,
                                   int          c,
                                   const char * to);

Get Table Direct Cell

This enables reading a table cell in its text formatted form. It supports all format types including Label List and Text formatted columns.

typedef int CALLBACK tPL_GetTDCell(PLTableHandle * t,
                                   int    r,
                                   int    c,
                                   char * into_buf,
                                   int    into_buf_size); 

Find Table Column

This returns the 0-based column index of a table with a matching column name. It returns -1 if no column found.

typedef int CALLBACK tPL_FindTDColumn(PLTableHandle * t,
                                      const char    * column_name);