The stick2xyz Documentation 1.14.1
|
#include "inputbasicpriv.h"
Go to the source code of this file.
void mod_input_close | ( | input_handle | handle | ) |
Closes an input handle.
[in] | handle | The handle to close. |
Definition at line 549 of file inputbasic.c.
References inputbasic_close().
stick2xyz_pctchar mod_input_desc | ( | void | ) |
Returns the the internally stored module short description.
stick2xyz_pctchar | The constant module short description. |
Definition at line 255 of file inputbasic.c.
References inputbasic_desc().
input_handle mod_input_fdopen | ( | int | fildes | ) |
Opens a file using fdopen, using a descriptor created by the system. The system descriptor can potentially be a socket, pipe, or file opened with the system open function.
[in] | fildes | The system descriptor to run through fdopen. |
input_handle | A handle to pass in to the read functions. |
NULL | If an error occured. |
Definition at line 455 of file inputbasic.c.
References inputbasic_fdopen().
input_handle mod_input_fdopen_bt | ( | int | fildes, |
uint32_t * | filtype | ||
) |
Opens a file using fdopen, using a descriptor created by the system. The system descriptor can potentially be a socket, pipe, or file opened with the system open function.
[in] | fildes | The system descriptor to run through fdopen. |
[in,out] | filtype | One of the following types is input: STICK2XYZ_INPUT_TYPE_AUTO, STICK2XYZ_INPUT_TYPE_PLAIN, STICK2XYZ_INPUT_TYPE_GZIP, STICK2XYZ_INPUT_TYPE_BZIP2, STICK2XYZ_INPUT_TYPE_LZMA2 The value will be changed if STICK2XYZ_INPUT_TYPE_AUTO is passed in. This allows the application to know the detected encoding of the file, even if the function fails. However, the bit-wise value involving UTF encodings will always change by being OR'ed to filtype unless the descriptor could not be opened. STICK2XYZ_INPUT_TYPE_IS_UTF8 macro is provided starting in 1.14.x that can be used to determine if any of the following flags are set. STICK2XYZ_INPUT_TYPE_UTF32BE, STICK2XYZ_INPUT_TYPE_UTF32LE, STICK2XYZ_INPUT_TYPE_UTF16BE, STICK2XYZ_INPUT_TYPE_UTF16LE |
input_handle | A handle to pass in to the read functions. |
NULL | If an error occured. |
Definition at line 490 of file inputbasic.c.
References inputbasic_fdopen_bt().
input_handle mod_input_fopen | ( | const char * | filnam | ) |
Opens a file using fopen, with a name encoded in ASCII or UTF-8.
[in] | filnam | The path/file combination to open. |
input_handle | A handle to pass in to the read functions. |
NULL | If an error occured. |
Definition at line 347 of file inputbasic.c.
References inputbasic_fopen().
input_handle mod_input_fopen_bt | ( | const char * | filnam, |
uint32_t * | filtype | ||
) |
Opens a file using fopen, with a name encoded by selected type.
[in] | filnam | The path/file combination to open. |
[in,out] | filtype | One of the following types is input: STICK2XYZ_INPUT_TYPE_AUTO, STICK2XYZ_INPUT_TYPE_PLAIN, STICK2XYZ_INPUT_TYPE_GZIP, STICK2XYZ_INPUT_TYPE_BZIP2, STICK2XYZ_INPUT_TYPE_LZMA2 The value will be changed if STICK2XYZ_INPUT_TYPE_AUTO is passed in. This allows the application to know the detected encoding of the file, even if the function fails. However, the bit-wise value involving UTF encodings will always change by being OR'ed to filtype unless the file could not be opened. STICK2XYZ_INPUT_TYPE_IS_UTF8 macro is provided starting in 1.14.x that can be used to determine if any of the following flags are set. STICK2XYZ_INPUT_TYPE_UTF32BE, STICK2XYZ_INPUT_TYPE_UTF32LE, STICK2XYZ_INPUT_TYPE_UTF16BE, STICK2XYZ_INPUT_TYPE_UTF16LE |
input_handle | A handle to pass in to the read functions. |
NULL | If an error occured. |
Definition at line 380 of file inputbasic.c.
References inputbasic_fopen_bt().
input_handle mod_input_fwopen | ( | const wchar_t * | filnam | ) |
Opens a file using any available FileOpen mechanism that can take a wide character input as a file name. If there is no available wide character naming mechanism available in the operating system, the name will be converted to a multi-byte string and fopen'ed.
[in] | filnam | A wide character filename to open. |
input_handle | A handle to pass in to the read functions. |
NULL | If an error occured. |
Definition at line 400 of file inputbasic.c.
References inputbasic_fwopen().
input_handle mod_input_fwopen_bt | ( | const wchar_t * | filnam, |
uint32_t * | filtype | ||
) |
Opens a file using any available FileOpen mechanism that can take a wide character input as a file name. If there is no available wide character naming mechanism available in the operating system, the name will be converted to a multi-byte string and fopen'ed.
[in] | filnam | A wide character filename to open. |
[in,out] | filtype | One of the following types is input: STICK2XYZ_INPUT_TYPE_AUTO, STICK2XYZ_INPUT_TYPE_PLAIN, STICK2XYZ_INPUT_TYPE_GZIP, STICK2XYZ_INPUT_TYPE_BZIP2, STICK2XYZ_INPUT_TYPE_LZMA2 The value will be changed if STICK2XYZ_INPUT_TYPE_AUTO is passed in. This allows the application to know the detected encoding of the file, even if the function fails. However, the bit-wise value involving UTF encodings will always change by being OR'ed to filtype unless the file could not be opened. STICK2XYZ_INPUT_TYPE_IS_UTF8 macro is provided starting in 1.14.x that can be used to determine if any of the following flags are set. STICK2XYZ_INPUT_TYPE_UTF32BE, STICK2XYZ_INPUT_TYPE_UTF32LE, STICK2XYZ_INPUT_TYPE_UTF16BE, STICK2XYZ_INPUT_TYPE_UTF16LE |
input_handle | A handle to pass in to the read functions. |
NULL | If an error occured. |
Definition at line 437 of file inputbasic.c.
References inputbasic_fwopen_bt().
uint32_t mod_input_get_algorithm | ( | input_handle | handle | ) |
Gets the algorithm used to decompress the input file.
[in] | handle | The handle to query. |
STICK2XYZ_INPUT_TYPE_GZIP | if the file is compressed in gzip. |
STICK2XYZ_INPUT_TYPE_BZIP2 | if the file is compressed in bzip2. |
STICK2XYZ_INPUT_TYPE_LZMA2 | if the file is compressed in xz. |
STICK2XYZ_INPUT_TYPE_PLAIN | if the file is not compressed. |
-1 | If handle is NULL. |
Definition at line 569 of file inputbasic.c.
References inputbasic_get_algorithm().
uint64_t mod_input_get_lineno | ( | input_handle | handle | ) |
Gets the last line number read from the input file.
[in] | handle | The handle to query. |
>0 | The last line number read. |
0 | If the file has not been read or is a binary file. |
Definition at line 606 of file inputbasic.c.
References inputbasic_get_lineno().
uint32_t mod_input_get_supportedalgorithm | ( | void | ) |
Returns bits of STICK2XYZ_INPUT_TYPE_* that is supported by the module.
uint32_t | Supported compression algorithms in a bitwise format. |
Definition at line 332 of file inputbasic.c.
References inputbasic_get_supportedalgorithm().
uint32_t mod_input_get_utftype | ( | input_handle | handle | ) |
Gets the UTF byte size and endian of the input file.
[in] | handle | The handle to query. |
STICK2XYZ_INPUT_TYPE_UTF16BE | if the file is encoded in UTF-16 Big Endian. |
STICK2XYZ_INPUT_TYPE_UTF16LE | if the file is encoded in UTF-16 Little Endian. |
STICK2XYZ_INPUT_TYPE_UTF32BE | if the file is encoded in UTF-32 Big Endian. |
STICK2XYZ_INPUT_TYPE_UTF32LE | if the file is encoded in UTF-32 Little Endian. |
STICK2XYZ_INPUT_TYPE_UTF8 | if the file is encoded in UTF-8 or ASCII. |
-1 | If handle is NULL. |
Definition at line 591 of file inputbasic.c.
References inputbasic_get_utftype().
int mod_input_init | ( | int | multithread | ) |
This optional function is called when the module is initialized. This function allows you to return a count of references to the module.
[in] | multithread | 1 if program is running with multiple threads, 0 if program is running single threaded. |
0 | on error. |
1 | any positive integer means success. |
Definition at line 660 of file inputbasic.c.
void mod_input_lang | ( | stick2xyz_print_ptr | newval | ) |
Changes the pointer type of the language pack calling function.
[in] | newval | The new function pointer to store. |
Definition at line 721 of file inputbasic.c.
References inputbasic_lang().
stick2xyz_pctchar mod_input_name | ( | void | ) |
Returns the internally stored UNIX module name.
stick2xyz_pctchar | The constant UNIX module name. |
Definition at line 245 of file inputbasic.c.
References inputbasic_name().
input_handle mod_input_open | ( | void * | fildes | ) |
Opens a file using an already fopen'ed FILE descriptor.
[in] | fildes | The FILE descriptor to utilize. |
input_handle | A handle to pass in to the read functions. |
NULL | If an error occured. |
Definition at line 505 of file inputbasic.c.
References inputbasic_open().
input_handle mod_input_open_bt | ( | void * | fildes, |
uint32_t * | filtype | ||
) |
Opens a file using an already fopen'ed FILE descriptor.
[in] | fildes | The FILE descriptor to utilize. |
[in,out] | filtype | One of the following types is input: STICK2XYZ_INPUT_TYPE_AUTO, STICK2XYZ_INPUT_TYPE_PLAIN, STICK2XYZ_INPUT_TYPE_GZIP, STICK2XYZ_INPUT_TYPE_BZIP2, STICK2XYZ_INPUT_TYPE_LZMA2 The value will be changed if STICK2XYZ_INPUT_TYPE_AUTO is passed in. This allows the application to know the detected encoding of the file, even if the function fails. However, the bit-wise value involving UTF encodings will always change by being OR'ed to filtype unless the descriptor could not be opened. STICK2XYZ_INPUT_TYPE_IS_UTF8 macro is provided starting in 1.14.x that can be used to determine if any of the following flags are set. STICK2XYZ_INPUT_TYPE_UTF32BE, STICK2XYZ_INPUT_TYPE_UTF32LE, STICK2XYZ_INPUT_TYPE_UTF16BE, STICK2XYZ_INPUT_TYPE_UTF16LE |
input_handle | A handle to pass in to the read functions. |
NULL | If an error occured. |
Definition at line 538 of file inputbasic.c.
References inputbasic_open_bt().
int mod_input_read | ( | input_handle | handle, |
struct input_buf * | dest, | ||
size_t | dest_size, | ||
size_t | dest_str_size | ||
) |
Reads in the next line from the file. The destination array will be formatted as follows:
[in] | handle | The handle whose data is to be read. |
[out] | dest | An array as described above. |
[in] | dest_size | The amount of elements in the array. |
[in] | dest_str_size | The amount of characters in the dest string. |
>0 | Amount of characters read. |
0 | EOF reached. |
-1 | An I/O error occured. |
Definition at line 635 of file inputbasic.c.
References inputbasic_read().
int mod_input_release | ( | void | ) |
This optional function is called when the module is being unloaded. This function allows you to run any cleanup code independent of the operating system's way of notifying the module.
0 | when module is ready to be unloaded. |
1 | any positive integer means module is not ready to be unloaded. |
Definition at line 675 of file inputbasic.c.
void mod_input_set_tty | ( | void * | fildescout, |
void * | fildescerr | ||
) |
This function sets the file descriptors for writing to the terminal.
By default, the library uses stdout and stderr.
This function was introduced in version 1.5.0.
[in] | fildescout | The file descriptor for stdout. |
[in] | fildescerr | The file descriptor for stderr. |
Definition at line 304 of file inputbasic.c.
References inputbasic_set_tty().
int mod_input_sigterm | ( | input_sigterm_ready | func, |
int | modnumber | ||
) |
This optional function is called when the program receives signal SIGTERM.
[in] | func | The function for the module to call when ready for program exit, if 0 is returned by the module. |
[in] | modnumber | The module number in the dynamic or static array. This number is the parameter when calling func. |
1 | module is ready to be unloaded. |
0 | module is not ready to be unloaded. |
Definition at line 707 of file inputbasic.c.
int mod_input_type | ( | void | ) |
Returns the integer describing the module type.
The possible values are:
ASCII Modules:
STICK2XYZ_MODTYPE_PANE2D_DEBUG
UNICODE Modules:
STICK2XYZ_MODTYPE_PANE2D_UNICODE
STICK2XYZ_MODTYPE_PANE2D_UNICODE_DEBUG
int | The module type as described above. |
Definition at line 289 of file inputbasic.c.
References inputbasic_type().
int mod_input_type_supported | ( | uint32_t | filtype | ) |
Tells the caller if a file compression type is supported by the module.
[in] | filtype | A STICK2XYZ_INPUT_TYPE_* to check. |
1 | If filtype is supported by the module. |
0 | If filtype is not supported by the module. |
Definition at line 320 of file inputbasic.c.
References inputbasic_type_supported().
void mod_input_version | ( | int * | dest | ) |
Sets up the major, minor, and revision numbers into three integers.
[out] | dest | An array of three integers to receive the module data. |
Definition at line 265 of file inputbasic.c.
References inputbasic_version().