libacfutils
A general purpose library of utility functions designed to make it easier to develop addons for the X-Plane flight simulator.
|
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <XPLMDataAccess.h>
#include "helpers.h"
#include "log.h"
#include "types.h"
Go to the source code of this file.
Data Structures | |
struct | dr_t |
struct | dr_cfg_t |
Macros | |
#define | DR_MAX_NAME_LEN 128 |
#define | DR_EXT_DEPRECATED DEPRECATED_ATTR |
#define | fdr_find(dr, ...) |
#define | DR_DEBUG(__varstr) log_basename(__FILE__), __LINE__, __varstr |
#define | DR_DEBUG_VARS const char *filename, int line, const char *varname |
#define | dr_geti(__dr) dr_geti_impl((__dr), DR_DEBUG(#__dr)) |
#define | dr_seti(__dr, __i) dr_seti_impl((__dr), DR_DEBUG(#__dr), (__i)) |
#define | dr_getf(__dr) dr_getf_impl((__dr), DR_DEBUG(#__dr)) |
#define | dr_setf(__dr, __f) dr_setf_impl((__dr), DR_DEBUG(#__dr), (__f)) |
#define | dr_getf_prot(__dr) dr_getf_prot_impl((__dr), DR_DEBUG(#__dr)) |
#define | dr_getvi(__dr, __i, __off, __num) dr_getvi_impl((__dr), DR_DEBUG(#__dr), (__i), (__off), (__num)) |
#define | dr_setvi(__dr, __i, __off, __num) dr_setvi_impl((__dr), DR_DEBUG(#__dr), (__i), (__off), (__num)) |
#define | dr_getvf(__dr, __df, __off, __num) dr_getvf_impl((__dr), DR_DEBUG(#__dr), (__df), (__off), (__num)) |
#define | dr_setvf(__dr, __df, __off, __num) dr_setvf_impl((__dr), DR_DEBUG(#__dr), (__df), (__off), (__num)) |
#define | dr_getvf32(__dr, __ff, __off, __num) dr_getvf32_impl((__dr), DR_DEBUG(#__dr), (__ff), (__off), (__num)) |
#define | dr_setvf32(__dr, __ff, __off, __num) dr_setvf32_impl((__dr), DR_DEBUG(#__dr), (__ff), (__off), (__num)) |
#define | dr_gets(__dr, __str, __cap) dr_gets_impl((__dr), DR_DEBUG(#__dr), (__str), (__cap)) |
#define | dr_sets(__dr, __str) dr_sets_impl((__dr), DR_DEBUG(#__dr), (__str)) |
#define | dr_getbytes(__dr, __data, __off, __num) dr_getbytes_impl((__dr), DR_DEBUG(#__dr), (__data), (__off), (__num)) |
#define | dr_setbytes(__dr, __data, __off, __num) dr_setbytes_impl((__dr), DR_DEBUG(#__dr), (__data), (__off), (__num)) |
Functions | |
bool_t | dr_find (dr_t *dr, const char *fmt,...) |
bool_t | dr_writable (dr_t *dr) |
int | dr_geti_impl (const dr_t *dr, const char *filename, int line, const char *varname) |
void | dr_seti_impl (const dr_t *dr, const char *filename, int line, const char *varname, int i) |
double | dr_getf_impl (const dr_t *dr, const char *filename, int line, const char *varname) |
void | dr_setf_impl (const dr_t *dr, const char *filename, int line, const char *varname, double f) |
static double | dr_getf_prot_impl (const dr_t *dr, const char *filename, int line, const char *varname) |
int | dr_getvi_impl (const dr_t *dr, const char *filename, int line, const char *varname, int *i, unsigned off, unsigned num) |
void | dr_setvi_impl (const dr_t *dr, const char *filename, int line, const char *varname, int *i, unsigned off, unsigned num) |
int | dr_getvf_impl (const dr_t *dr, const char *filename, int line, const char *varname, double *df, unsigned off, unsigned num) |
void | dr_setvf_impl (const dr_t *dr, const char *filename, int line, const char *varname, double *df, unsigned off, unsigned num) |
int | dr_getvf32_impl (const dr_t *dr, const char *filename, int line, const char *varname, float *ff, unsigned off, unsigned num) |
void | dr_setvf32_impl (const dr_t *dr, const char *filename, int line, const char *varname, float *ff, unsigned off, unsigned num) |
int | dr_gets_impl (const dr_t *dr, const char *filename, int line, const char *varname, char *str, size_t cap) |
void | dr_sets_impl (const dr_t *dr, const char *filename, int line, const char *varname, char *str) |
int | dr_getbytes_impl (const dr_t *dr, const char *filename, int line, const char *varname, void *data, unsigned off, unsigned num) |
void | dr_setbytes_impl (const dr_t *dr, const char *filename, int line, const char *varname, void *data, unsigned off, unsigned num) |
void | dr_create_i (dr_t *dr, int *value, bool_t writable, const char *fmt,...) |
void | dr_create_i_cfg (dr_t *dr, int *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_f (dr_t *dr, float *value, bool_t writable, const char *fmt,...) |
void | dr_create_f_cfg (dr_t *dr, float *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_f64 (dr_t *dr, double *value, bool_t writable, const char *fmt,...) |
void | dr_create_f64_cfg (dr_t *dr, double *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_vi (dr_t *dr, int *value, size_t n, bool_t writable, const char *fmt,...) |
void | dr_create_vi_cfg (dr_t *dr, int *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_vf (dr_t *dr, float *value, size_t n, bool_t writable, const char *fmt,...) |
void | dr_create_vf_cfg (dr_t *dr, float *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_vf64 (dr_t *dr, double *value, size_t n, bool_t writable, const char *fmt,...) |
void | dr_create_vf64_cfg (dr_t *dr, double *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_vi_autoscalar (dr_t *dr, int *value, size_t n, bool_t writable, const char *fmt,...) |
void | dr_create_vi_autoscalar_cfg (dr_t *dr, int *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_vf_autoscalar (dr_t *dr, float *value, size_t n, bool_t writable, const char *fmt,...) |
void | dr_create_vf_autoscalar_cfg (dr_t *dr, float *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_vf64_autoscalar (dr_t *dr, double *value, size_t n, bool_t writable, const char *fmt,...) |
void | dr_create_vf64_autoscalar_cfg (dr_t *dr, double *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_create_b (dr_t *dr, void *value, size_t n, bool_t writable, const char *fmt,...) |
void | dr_create_b_cfg (dr_t *dr, void *value, dr_cfg_t cfg, const char *fmt,...) |
void | dr_array_set_stride (dr_t *dr, size_t stride) |
void | dr_delete (dr_t *dr) |
void * | dr_get_cb_userinfo (const dr_t *dr) |
This file provides a facility for more conveniently interacting with X-Plane's dataref system. Rather than having to write accessors for every piece of data you wish to expose, this subsystem takes care of most of the heavy lifting, while providing a much neater and easier-to-use interface.
If you want to expose your internal data as datarefs, you will register the datarefs using the dr_create_*
family of functions. Please note that the returned dr_t
object doesn't actually contain the data. Instead, you pass the dr_create_*
functions a pointer to your data, and they simply reference it.
To access foreign datarefs, use either dr_find() or fdr_find(). The returned dr_t
object can then be passed to the various dr_get*
and dr_set*
family of macros to access the data exposed through those datarefs. The macros take care of automatically converting types as appropriate, so you don't have to worry about always matching the data type of the dataref. The only exception to these are the dr_gets(), dr_sets(), dr_getbytes() and dr_setbytes() macros, which must only ever be used with datarefs of type xplmType_Data
.
Definition in file dr.h.
#define DR_DEBUG | ( | __varstr | ) | log_basename(__FILE__), __LINE__, __varstr |
#define DR_DEBUG_VARS const char *filename, int line, const char *varname |
#define dr_getbytes | ( | __dr, | |
__data, | |||
__off, | |||
__num | |||
) | dr_getbytes_impl((__dr), DR_DEBUG(#__dr), (__data), (__off), (__num)) |
Reads a byte array dataref. This function cannot be invoked on anything other than a dataref that is of type xplmType_Data
. This function doesn't support automatic type conversion from different dataref types.
__dr | The dataref to be read. Must be a dr_t * obtained using dr_find() and be of type xplmType_Data . |
__data | A void * buffer to hold the data to be read. This must be allocated by the caller to have sufficient capacity to hold at least __num bytes. |
__off | Byte offset in the dataref (NOT the __data buffer) from where the read should be performed. |
__num | Number of bytes to read in the dataref at offset __off . |
__num
). By convention in the X-Plane SDK, if you pass NULL
for the __data
pointer and 0 for both __off
and __num
, this will make the dr_getbytes() macro return the actual number of bytes available to be read in the dataref.Example of how to read the entire contents of a dataref of unknown length:
#define dr_getf | ( | __dr | ) | dr_getf_impl((__dr), DR_DEBUG(#__dr)) |
#define dr_getf_prot | ( | __dr | ) | dr_getf_prot_impl((__dr), DR_DEBUG(#__dr)) |
#define dr_geti | ( | __dr | ) | dr_geti_impl((__dr), DR_DEBUG(#__dr)) |
Reads an integer dataref. If the dataref is not an integer, this function automatically converts the types as necessary, so you can read a float dataref as an int without having to worry about type conversions.
This function can also work with array datarefs. If the dataref is an array, this function simply reads the array's first element.
__dr | The dataref to be read. Must be a dr_t * obtained using dr_find(). |
#define dr_gets | ( | __dr, | |
__str, | |||
__cap | |||
) | dr_gets_impl((__dr), DR_DEBUG(#__dr), (__str), (__cap)) |
Reads a string dataref. String datarefs are byte arrays that contain a NUL-terminated value. This function cannot be invoked on anything other than a dataref that is of type xplmType_Data
. This function doesn't support automatic type conversion from different dataref types.
__dr | The dataref to be read. Must be a dr_t * obtained using dr_find() and be of type xplmType_Data . |
__str | A char * buffer to hold the string to be read. This must be allocated by the caller to have sufficient capacity to hold the returned string. If the buffer doesn't have sufficient capacity, the string is truncated and is guaranteed to always be NUL terminated. |
__cap | The capacity of the buffer in __str in bytes. The function will never write more than __cap bytes, including the terminating NUL character. |
Example of how to read a string of unknown length:
#define dr_getvf | ( | __dr, | |
__df, | |||
__off, | |||
__num | |||
) | dr_getvf_impl((__dr), DR_DEBUG(#__dr), (__df), (__off), (__num)) |
Same as dr_getvi(), but expects a double-precision floating point array in __df
instead.
#define dr_getvf32 | ( | __dr, | |
__ff, | |||
__off, | |||
__num | |||
) | dr_getvf32_impl((__dr), DR_DEBUG(#__dr), (__ff), (__off), (__num)) |
Same as dr_getvi(), but expects a single-precision floating point array in __ff
instead.
#define dr_getvi | ( | __dr, | |
__i, | |||
__off, | |||
__num | |||
) | dr_getvi_impl((__dr), DR_DEBUG(#__dr), (__i), (__off), (__num)) |
Reads a 32-bit integer array dataref. If the dataref is an array of floats, this function automatically converts the float data to int
s by truncation.
__dr | The dataref to be read. Must be a dr_t * obtained using dr_find(). |
__i | Pointer to an array of int s that's supposed to be filled with the read integer data. Must be large enough to hold all the data that was requested to be read. |
__off | Offset in the dataref to start the read at. (Caution: NOT an offset into the __i array above!) |
__num | Number of items in the dataref to read, starting at offset __off . |
__num
, if the dataref was shorter than anticipated. NULL
for the __i
pointer and 0 for both __off
and __num
to obtain the actual length of the array. #define dr_setbytes | ( | __dr, | |
__data, | |||
__off, | |||
__num | |||
) | dr_setbytes_impl((__dr), DR_DEBUG(#__dr), (__data), (__off), (__num)) |
Writes a byte array dataref. This function cannot be invoked on anything other than a dataref that is of type xplmType_Data
. This function doesn't support automatic type conversion from different dataref types.
__dr | The dataref to be written. Must be a dr_t * obtained using dr_find(), be of type xplmType_Data and be writable (see dr_writable()). |
__data | A byte buffer containing the data to be written and must contain at least __num bytes. |
__off | The byte offset into the dataref (NOT the __data buffer) where the data buffer should start to be written. |
__num | Number of bytes to be written in __data . |
#define dr_setf | ( | __dr, | |
__f | |||
) | dr_setf_impl((__dr), DR_DEBUG(#__dr), (__f)) |
#define dr_seti | ( | __dr, | |
__i | |||
) | dr_seti_impl((__dr), DR_DEBUG(#__dr), (__i)) |
Writes an integer dataref. If the dataref is not an integer, this function automatically converts the types as necessary, so you can write to a float dataref as an int without having to worry about type conversions.
This function can also work with array datarefs. If the dataref is an array, theis function simply writes the array's first element.
CAUTION: do NOT write to a read-only dataref. Attempting to do so will trip an assertion failure.
__dr | The dataref to be written. Must be a dr_t * obtained using dr_find() and be writable (see dr_writable()). |
__i | The integer value to be written to the dataref. |
#define dr_sets | ( | __dr, | |
__str | |||
) | dr_sets_impl((__dr), DR_DEBUG(#__dr), (__str)) |
Writes a string dataref. String datarefs are byte arrays that contain a NUL-terminated value. This function cannot be invoked on anything other than a dataref that is of type xplmType_Data
. This function doesn't support automatic type conversion from different dataref types.
__dr | The dataref to be written. Must be a dr_t * obtained using dr_find(), be of type xplmType_Data and be writable (see dr_writable()). |
__str | A NUL-terminated char * string to be written. The length of the string is automatically obtained using strlen(). |
#define dr_setvf | ( | __dr, | |
__df, | |||
__off, | |||
__num | |||
) | dr_setvf_impl((__dr), DR_DEBUG(#__dr), (__df), (__off), (__num)) |
Same as dr_setvi(), but expects a double-precision floating point array in __df
instead.
#define dr_setvf32 | ( | __dr, | |
__ff, | |||
__off, | |||
__num | |||
) | dr_setvf32_impl((__dr), DR_DEBUG(#__dr), (__ff), (__off), (__num)) |
Same as dr_setvi(), but expects a single-precision floating point array in __ff
instead.
#define dr_setvi | ( | __dr, | |
__i, | |||
__off, | |||
__num | |||
) | dr_setvi_impl((__dr), DR_DEBUG(#__dr), (__i), (__off), (__num)) |
Writes a 32-bit integer array dataref. If the dataref is an array of floats, this function automatically converts the integer data to float
s by casting.
__dr | The dataref to be written. Must be a dr_t * obtained using dr_find() and be writable (see dr_writable()). |
__i | Pointer to an array of int s that's supposed to be written to the dataref. Must contain __num integers. |
__off | Offset in the dataref to start the write at. (Caution: NOT an offset into the __i array above!) |
__num | Number of items in __i to be written to the dataref at offset __off . |
__num
, if the dataref was shorter than anticipated. #define fdr_find | ( | dr, | |
... | |||
) |
Same as dr_find(), but does a "forcible" lookup. That means, if the dataref doesn't exist, instead of returning B_FALSE
, this macro causes a hard assertion failure. Use this to look up datarefs that you absolutely require to exist (such as those that are part of X-Plane itself).
void dr_array_set_stride | ( | dr_t * | dr, |
size_t | stride | ||
) |
This function is deprecated. Use dr_create_*_cfg()
functions which specify the stride in the configuration structure argument.
For array datarefs you create, you can specify a data access stride value. if set to non-zero after creation, the built-in array read functions of the dr.h
machinery will use the stride calculate the actual offset in the dataref's data buffer for elements past the [0] index. If set to 0 (the default), the stride is automatically determined from the type of the dataref. You can use this to expose array data that is strided in a bigger struct, for example as follows:
void dr_create_b | ( | dr_t * | dr, |
void * | value, | ||
size_t | n, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vi(), but creates an arbitrary byte array dataref and takes an anonymous void *
buffer pointer argument.
void dr_create_b_cfg | ( | dr_t * | dr, |
void * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_b(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_f | ( | dr_t * | dr, |
float * | value, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_i(), but creates a single-precision floating point dataref and takes a float *
data pointer argument.
void dr_create_f64 | ( | dr_t * | dr, |
double * | value, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_i(), but creates a double-precision floating point dataref and takes a double *
data pointer argument.
void dr_create_f64_cfg | ( | dr_t * | dr, |
double * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_f64(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_f_cfg | ( | dr_t * | dr, |
float * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_f(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_i | ( | dr_t * | dr, |
int * | value, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Creates an integer dataref. The data is held by the caller, and the dataref simply receives a reference to the data to be exposed. The dr.h machinery takes care of registering all the appropriate data accessors, as well as handling type conversions as appropriate. After initialization, may want to further customize the dr_t reference by installing a read or write callback. See dr_t.
This function automatically registers the created dataref with DataRefEditor (and DataRefTool, or any 3rd party dataref monitoring plugin, which responds to dataref registration interplugin messages). Thus you do not need to perform the registration yourself.
dr | A pointer to an unused dr_t structure, which will be initialized to contain the information of the dataref. |
value | A pointer to the integer value to be read (and possibly written). If you plan on installing your own read_scalar_cb and/or write_scalar_cb callbacks, you may pass NULL here and manipulate the data entirely dynamically. However, for the vast majority of datarefs, a valid pointer here must be provided and the memory this points to must remain allocated and available throghout the entire existence of the dataref. |
writable | Flag designating the dataref registration as being either writable or read-only. |
fmt | A printf-style format string, from which the name of the dataref will be constructed. The remaining extra variadic arguments are used for this printf-style string construction. |
void dr_create_i_cfg | ( | dr_t * | dr, |
int * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_i(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_vf | ( | dr_t * | dr, |
float * | value, | ||
size_t | n, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vi(), but creates a single-precision floating point array dataref and takes a float *
array pointer argument.
void dr_create_vf64 | ( | dr_t * | dr, |
double * | value, | ||
size_t | n, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vi(), but creates a double-precision floating point array dataref and takes a double *
array pointer argument.
Please note that X-Plane's SDK doesn't natively support a double-precision floating point array dataref. Instead, the dataref will be registered as a single-precision floating point array and type conversions will be performed automatically on read and write. The read_array_cb
and write_array_cb
will still be treated as dealing with double-precision floating point values, but the values will be type-cast right at the "edge" of the interface to X-Plane.
void dr_create_vf64_autoscalar | ( | dr_t * | dr, |
double * | value, | ||
size_t | n, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vi_autoscalar(), but creates a double-precision floating point combo scalar/array dataref and takes a double *
array pointer argument. Same type conversion caveats apply as in the case of dr_create_vf64(), when the dataref is being accessed as an array.
void dr_create_vf64_autoscalar_cfg | ( | dr_t * | dr, |
double * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vf64_autoscalar(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_vf64_cfg | ( | dr_t * | dr, |
double * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vf64(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_vf_autoscalar | ( | dr_t * | dr, |
float * | value, | ||
size_t | n, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vi_autoscalar(), but creates a single-precision floating point combo scalar/array dataref and takes a float *
array pointer argument.
void dr_create_vf_autoscalar_cfg | ( | dr_t * | dr, |
float * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vf_autoscalar(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_vf_cfg | ( | dr_t * | dr, |
float * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vf(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_vi | ( | dr_t * | dr, |
int * | value, | ||
size_t | n, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Creates an integer array ("vi" = vector of int's) dataref. In general this behaves the same as dr_create_i(), except if you wanted to dynamically override the data being read/written through this dataref, you would set the read_array_cb
and write_array_cb
callback fields.
dr | A pointer to an unused dr_t structure, which will be initialized to contain the information of the dataref. |
value | A pointer to the array of integer values to be read (and possibly written). If you plan on installing your own read_array_cb and/or write_array_cb callbacks, you may pass NULL here and manipulate the data entirely dynamically. However, for the vast majority of datarefs, a valid pointer here must be provided and the memory this points to must remain allocated and available throghout the entire existence of the dataref. |
n | The number of elements in the value array above. |
writable | Flag designating the dataref registration as being either writable or read-only. |
fmt | A printf-style format string, from which the name of the dataref will be constructed. The remaining extra variadic arguments are used for this printf-style string construction. |
void dr_create_vi_autoscalar | ( | dr_t * | dr, |
int * | value, | ||
size_t | n, | ||
bool_t | writable, | ||
const char * | fmt, | ||
... | |||
) |
Similar to dr_create_vi(), but creates a combo dataref that holds both a single scalar integer value, as well as an array of integers. Internally the dataref is registered as a bitwise-OR of both xplmType_Int
and xplmType_IntArray
, The dataref has read (and write, if writable
is set to B_TRUE
) handlers implemented for both scalar and array data manipulation. You may also install your own custom callback handlers for read_scalar_cb
, write_scalar_cb
, read_array_cb
and write_array_cb
.
This type of dataref is useful for cases where you want to provide both the ability to treat the data as an array, while still providing meaningful results when the dataref is accessed as a scalar (certain lighting control data accesses in X-Plane require this).
void dr_create_vi_autoscalar_cfg | ( | dr_t * | dr, |
int * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vi_autoscalar(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_create_vi_cfg | ( | dr_t * | dr, |
int * | value, | ||
dr_cfg_t | cfg, | ||
const char * | fmt, | ||
... | |||
) |
Same as dr_create_vi(), but provides a configuration structure to specify additional parameters and custom callbacks.
void dr_delete | ( | dr_t * | dr | ) |
Destroys a dataref previously created using one of the dr_create_*
functions. You MUST destroy every dataref you create prior to your plugin being unloaded.
libacfutils ships with automated macros that help automate the dataref destruction process on plugin unload. See dr_cmd_reg.h for more information.
bool_t dr_find | ( | dr_t * | dr, |
const char * | fmt, | ||
... | |||
) |
Attempts to find a dataref in the X-Plane dataref system and store a handle to it in ‘dr’. The dataref must exist (have been created) at the time of this call. There is no support for late (lazy) resolving of datarefs.
dr | Mandatory return-parameter, which will be filled with an initialized dr_t object that can be used to read the dataref (and write to it, if the dataref is writable). |
fmt | A printf-style format string that will be used to construct the name of the dataref to looked up. The remainder of the variadic arguments must match the format string's format specifiers. |
void * dr_get_cb_userinfo | ( | const dr_t * | dr | ) |
int dr_getbytes_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
void * | data, | ||
unsigned | off, | ||
unsigned | num | ||
) |
Implementation of the dr_getbytes() macro. Use dr_getbytes() instead.
double dr_getf_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname | ||
) |
|
static |
Implementation of the dr_getf_prot() macro. Use dr_getf_prot() instead.
int dr_geti_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname | ||
) |
int dr_gets_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
char * | str, | ||
size_t | cap | ||
) |
int dr_getvf32_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
float * | ff, | ||
unsigned | off, | ||
unsigned | num | ||
) |
Implementation of the dr_getvf32() macro. Use dr_getvf32() instead.
int dr_getvf_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
double * | df, | ||
unsigned | off, | ||
unsigned | num | ||
) |
Implementation of the dr_getvf() macro. Use dr_getvf() instead.
int dr_getvi_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
int * | i, | ||
unsigned | off, | ||
unsigned | num | ||
) |
Implementation of the dr_getvi() macro. Use dr_getvi() instead.
void dr_setbytes_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
void * | data, | ||
unsigned | off, | ||
unsigned | num | ||
) |
Implementation of the dr_setbytes() macro. Use dr_setbytes() instead.
void dr_setf_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
double | f | ||
) |
void dr_seti_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
int | i | ||
) |
void dr_sets_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
char * | str | ||
) |
void dr_setvf32_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
float * | ff, | ||
unsigned | off, | ||
unsigned | num | ||
) |
Implementation of the dr_setvf32() macro. Use dr_setvf32() instead.
void dr_setvf_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
double * | df, | ||
unsigned | off, | ||
unsigned | num | ||
) |
Implementation of the dr_setvf() macro. Use dr_setvf() instead.
void dr_setvi_impl | ( | const dr_t * | dr, |
const char * | filename, | ||
int | line, | ||
const char * | varname, | ||
int * | i, | ||
unsigned | off, | ||
unsigned | num | ||
) |
Implementation of the dr_setvi() macro. Use dr_setvi() instead.