v0.4.1
Fast, portable C library for geometry input/output
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
Data Structures | Macros | Typedefs | Enumerations | Functions
gmioCore

All other gmio modules rely on this module. More...

Data Structures

struct  gmio_memblock
 Basic memory block. More...
 
struct  gmio_stream
 Stream that can get input from an arbitrary data source or can write output to an arbitrary data sink. More...
 
struct  gmio_streampos
 Specifies a position within a stream. More...
 
struct  gmio_task_iface
 Defines an interface through which a task can be controlled. More...
 
struct  gmio_vec3f
 Vector of three float coords. More...
 
struct  gmio_vec3d
 Vector of three double coords. More...
 
struct  gmio_zlib_compress_options
 zlib compression options More...
 

Macros

#define GMIO_DECL_EXPORT
 Expands to the C compiler extension to export functions to a DLL. More...
 
#define GMIO_DECL_IMPORT
 Expands to the C compiler extension to import functions from a DLL. More...
 
#define GMIO_API
 Expands either to GMIO_DECL_EXPORT or GMIO_DECL_IMPORT when respectively compiling/using the DLL. More...
 
#define GMIO_UNUSED(x)   (void)x;
 Tells the compiler that a parameter is not used in the body of a function. More...
 
#define GMIO_INLINE
 Expands to the C compiler specific inline keyword (if any) More...
 
#define GMIO_RESTRICT
 Expands to the C compiler specific restrict keyword (if any) More...
 
#define GMIO_C_LINKAGE_BEGIN
 Expands to extern "C" { when building with a C++ compiler. More...
 
#define GMIO_C_LINKAGE_END
 Expands to } when building with a C++ compiler. More...
 
#define GMIO_PRAGMA_MSVC_WARNING_PUSH_AND_DISABLE(__code__)
 MSVC specific macro that disable the compiler warning of code code More...
 
#define GMIO_PRAGMA_MSVC_WARNING_POP()
 MSVC specific macro that pop the changes made after last warning(pop) More...
 
#define GMIO_ARRAY_SIZE(array)   sizeof(array) / sizeof(*array)
 Expands to the size(item count) of an array. More...
 
#define GMIO_VERSION_MAJOR   0
 Expands to gmio's major version number. More...
 
#define GMIO_VERSION_MINOR   4
 Expands to gmio's minor version number. More...
 
#define GMIO_VERSION_PATCH   1
 Expands to gmio's patch version number. More...
 
#define GMIO_VERSION_STR   "0.4.1"
 Expands to a string that specifies gmio's version number. More...
 
#define GMIO_VERSION   0x000401
 Expands to an hexadecimal value of the form 0xMMNNPP (MM=major, NN=minor, PP=patch) that specifies gmio's version number. More...
 

Typedefs

typedef struct gmio_memblock(* gmio_memblock_constructor_func_t )()
 Typedef for a pointer to a function that creates an allocated memblock. More...
 
typedef int64_or_long gmio_streamsize_t
 Type able to represent the size(in bytes) of a stream. More...
 
typedef int64_or_long gmio_streamoffset_t
 Type able to represent the offset position within a stream. More...
 

Enumerations

enum  gmio_endianness
 Common endianness (byte order) of computer memory. More...
 
enum  gmio_error
 Common errors. More...
 
enum  
 GMIO_CORE_ERROR_TAG Byte-mask to tag(identify) gmio_core error codes More...
 
enum  
 GMIO_STREAMPOS_COOKIE_SIZE Size of the byte array gmio_streampos::cookie More...
 
enum  gmio_float_text_format
 Various formats to textually represent a float(single/double precision) More...
 
enum  gmio_zlib_compress_level
 zlib compression level, specific values More...
 
enum  gmio_zlib_compress_strategy
 zlib compression strategy More...
 

Functions

enum gmio_endianness gmio_host_endianness ()
 Returns endianness (byte order) of the host's CPU architecture. More...
 
bool gmio_no_error (int code)
 Returns true if code == GMIO_NO_ERROR More...
 
bool gmio_error (int code)
 Returns true if code != GMIO_NO_ERROR More...
 
bool gmio_memblock_isnull (const struct gmio_memblock *mblock)
 Returns true if mblock is NULL or points to null/void memory. More...
 
struct gmio_memblock gmio_memblock (void *ptr, size_t size, void(*func_deallocate)(void *))
 Returns an initialized memblock object. More...
 
struct gmio_memblock gmio_memblock_malloc (size_t size)
 Returns a memblock allocated with standard malloc(). More...
 
struct gmio_memblock gmio_memblock_calloc (size_t num, size_t size)
 Returns a memblock allocated with standard calloc(). More...
 
struct gmio_memblock gmio_memblock_realloc (void *ptr, size_t size)
 Returns a memblock allocated with standard realloc(). More...
 
void gmio_memblock_deallocate (struct gmio_memblock *mblock)
 Safe and convenient call to gmio_memblock::func_deallocate() More...
 
void gmio_memblock_set_default_constructor (gmio_memblock_constructor_func_t ctor)
 Installs a global function to construct gmio_memblock objects. More...
 
gmio_memblock_constructor_func_t gmio_memblock_default_constructor ()
 Returns the currently installed function to construct memblock objects. More...
 
struct gmio_memblock gmio_memblock_default ()
 Returns a memblock created with the function gmio_memblock_default_constructor() More...
 
struct gmio_stream gmio_stream_null ()
 Returns a null stream. More...
 
struct gmio_stream gmio_stream_stdio (FILE *file)
 Returns a stream for standard FILE* (cookie will hold file) More...
 

Detailed Description

All other gmio modules rely on this module.


Data Structure Documentation

struct gmio_streampos

Specifies a position within a stream.

The information in gmio_streampos objects is usually filled by a call to gmio_stream::func_get_pos(), which takes a pointer to an object of this type as argument.

The content of a gmio_streampos object is not meant to be read directly, but only to be used as an argument in a call to gmio_stream::func_set_pos()

Data Fields
uint8_t cookie[GMIO_STREAMPOS_COOKIE_SIZE] Stores the actual(concrete) stream position object.
struct gmio_vec3f

Vector of three float coords.

Examples:
/examples/stl_read_file.c, and /examples/stl_write_file.c.
Data Fields
float x
float y
float z
struct gmio_vec3d

Vector of three double coords.

Data Fields
double x
double y
double z

Macro Definition Documentation

#define GMIO_DECL_EXPORT

Expands to the C compiler extension to export functions to a DLL.

#define GMIO_DECL_IMPORT

Expands to the C compiler extension to import functions from a DLL.

#define GMIO_API

Expands either to GMIO_DECL_EXPORT or GMIO_DECL_IMPORT when respectively compiling/using the DLL.

#define GMIO_UNUSED (   x)    (void)x;

Tells the compiler that a parameter is not used in the body of a function.

#define GMIO_INLINE

Expands to the C compiler specific inline keyword (if any)

#define GMIO_RESTRICT

Expands to the C compiler specific restrict keyword (if any)

#define GMIO_C_LINKAGE_BEGIN

Expands to extern "C" { when building with a C++ compiler.

#define GMIO_C_LINKAGE_END

Expands to } when building with a C++ compiler.

#define GMIO_PRAGMA_MSVC_WARNING_PUSH_AND_DISABLE (   __code__)

MSVC specific macro that disable the compiler warning of code code

With Visual C++, expands to :

#pragma warning(push)
#pragma warning(disable: __code__)
#define GMIO_PRAGMA_MSVC_WARNING_POP ( )

MSVC specific macro that pop the changes made after last warning(pop)

With Visual C++, expands to :

#pragma warning(pop)
#define GMIO_ARRAY_SIZE (   array)    sizeof(array) / sizeof(*array)

Expands to the size(item count) of an array.

#define GMIO_VERSION_MAJOR   0

Expands to gmio's major version number.

#define GMIO_VERSION_MINOR   4

Expands to gmio's minor version number.

#define GMIO_VERSION_PATCH   1

Expands to gmio's patch version number.

#define GMIO_VERSION_STR   "0.4.1"

Expands to a string that specifies gmio's version number.

#define GMIO_VERSION   0x000401

Expands to an hexadecimal value of the form 0xMMNNPP (MM=major, NN=minor, PP=patch) that specifies gmio's version number.

Typedef Documentation

typedef struct gmio_memblock(* gmio_memblock_constructor_func_t)()

Typedef for a pointer to a function that creates an allocated memblock.

Signature:

struct gmio_memblock mblock_ctor();
typedef int64_or_long gmio_streamsize_t

Type able to represent the size(in bytes) of a stream.

It can be int64_t or long depending on the compiler support

typedef int64_or_long gmio_streamoffset_t

Type able to represent the offset position within a stream.

It can be int64_t or long depending on the compiler support

Enumeration Type Documentation

Common endianness (byte order) of computer memory.

Enumerator
GMIO_ENDIANNESS_UNKNOWN 

Other (unknown) byte-order.

GMIO_ENDIANNESS_LITTLE 

The least significant byte is stored at the lowest address.

The other bytes follow in increasing order of significance

GMIO_ENDIANNESS_BIG 

The most significant byte is stored at the lowest address.

The other bytes follow in decreasing order of significance

GMIO_ENDIANNESS_HOST 

Endianness(byte order) used by the host computer for storing data in memory.

Set at configure-time to either GMIO_ENDIANNESS_LITTLE or GMIO_ENDIANNESS_BIG

enum gmio_error

Common errors.

Format:
4-bytes signed integer (ISO C restricts enumerator value to 'int')
max value: 0x7FFFFFFF
bits 0x00FFFFFF..0x7FFFFFFF: tag identifying the error category
bits 0x001FFFFF..0x00FFFFFF: tag identifying an error sub-category
bits 0x00000000..0x000FFFFF: error value in the (sub)category
Max count of categories : 128 (2^7)
Max count of sub-categories : 15 (2^4 - 1)
Max count of error values : 1048576 (2^20)

Enumerator
GMIO_ERROR_OK 

No error occurred, success.

GMIO_ERROR_UNKNOWN 

Unknown error.

GMIO_ERROR_NULL_MEMBLOCK 

Pointer on argument memory block is NULL.

GMIO_ERROR_INVALID_MEMBLOCK_SIZE 

Argument size for the memory block is too small.

GMIO_ERROR_NULL_STREAM 

Provided gmio_stream is NULL.

GMIO_ERROR_STREAM 

An error occurred with gmio_stream.

GMIO_ERROR_STREAM_FUNC_REQUIRED 

Some required gmio_stream function pointer is NULL.

GMIO_ERROR_TASK_STOPPED 

Task was stopped by user, that is to say gmio_task_iface::func_is_stop_requested() returned true.

GMIO_ERROR_STDIO 

An error occured after a call to a <stdio.h> function.

The caller can check errno to get the real error number

GMIO_ERROR_BAD_LC_NUMERIC 

Checking of LC_NUMERIC failed(should be "C" or "POSIX")

GMIO_ERROR_ZLIB_ERRNO 

See Z_ERRNO (file operation error)

GMIO_ERROR_ZLIB_STREAM 

See Z_STREAM_ERROR.

GMIO_ERROR_ZLIB_DATA 

See Z_DATA_ERROR.

GMIO_ERROR_ZLIB_MEM 

See Z_MEM_ERROR (not enough memory)

GMIO_ERROR_ZLIB_BUF 

See Z_BUF_ERROR.

GMIO_ERROR_ZLIB_VERSION 

See Z_VERSION_ERROR (zlib library version is incompatible with the version assumed by the caller)

GMIO_ERROR_ZLIB_INVALID_COMPRESS_LEVEL 

Invalid compression level, see gmio_zlib_compress_options::level.

GMIO_ERROR_ZLIB_INVALID_COMPRESS_MEMORY_USAGE 

Invalid compression memory usage, see gmio_zlib_compress_options::memory_usage.

GMIO_ERROR_ZLIB_DEFLATE_NOT_ALL_INPUT_USED 

All input to be deflated(compressed) was not processed.

GMIO_ERROR_ZLIB_DEFLATE_STREAM_INCOMPLETE 

Deflate failure to flush pending output.

GMIO_ERROR_ZIP_INT64_TYPE_REQUIRED 

Zip64 format requires the compiler to provide a 64b integer type.

GMIO_ERROR_ZIP64_FORMAT_REQUIRED 

The size of some ZIP file entry exceeds 32b limit and so requires Zip64 format.

anonymous enum

GMIO_CORE_ERROR_TAG Byte-mask to tag(identify) gmio_core error codes

Enumerator
GMIO_CORE_ERROR_TAG 
anonymous enum

GMIO_STREAMPOS_COOKIE_SIZE Size of the byte array gmio_streampos::cookie

Enumerator
GMIO_STREAMPOS_COOKIE_SIZE 

Various formats to textually represent a float(single/double precision)

Enumerator
GMIO_FLOAT_TEXT_FORMAT_DECIMAL_LOWERCASE 

Decimal floating point, lowercase (ex: 392.65)

GMIO_FLOAT_TEXT_FORMAT_DECIMAL_UPPERCASE 

Decimal floating point, uppercase (ex: 392.65)

GMIO_FLOAT_TEXT_FORMAT_SCIENTIFIC_LOWERCASE 

Scientific notation, lowercase (ex: 3.9265e+2)

GMIO_FLOAT_TEXT_FORMAT_SCIENTIFIC_UPPERCASE 

Scientific notation, uppercase (ex: 3.9265E+2)

GMIO_FLOAT_TEXT_FORMAT_SHORTEST_LOWERCASE 

Use the shortest representation: decimal or scientific lowercase.

GMIO_FLOAT_TEXT_FORMAT_SHORTEST_UPPERCASE 

Use the shortest representation: decimal or scientific uppercase.

zlib compression level, specific values

Enumerator
GMIO_ZLIB_COMPRESS_LEVEL_NONE 

-> Z_NO_COMPRESSION

GMIO_ZLIB_COMPRESS_LEVEL_DEFAULT 

-> Z_DEFAULT_COMPRESSION

GMIO_ZLIB_COMPRESS_LEVEL_BEST_SPEED 

-> Z_BEST_SPEED

GMIO_ZLIB_COMPRESS_LEVEL_BEST_SIZE 

-> Z_BEST_COMPRESSION

zlib compression strategy

Enumerator
GMIO_ZLIB_COMPRESSION_STRATEGY_DEFAULT 

-> Z_DEFAULT_STRATEGY

GMIO_ZLIB_COMPRESSION_STRATEGY_FILTERED 

-> Z_FILTERED

GMIO_ZLIB_COMPRESSION_STRATEGY_HUFFMAN_ONLY 

-> Z_HUFFMAN_ONLY

GMIO_ZLIB_COMPRESSION_STRATEGY_RLE 

-> Z_RLE

GMIO_ZLIB_COMPRESSION_STRATEGY_FIXED 

-> Z_FIXED

Function Documentation

enum gmio_endianness gmio_host_endianness ( )

Returns endianness (byte order) of the host's CPU architecture.

bool gmio_no_error ( int  code)

Returns true if code == GMIO_NO_ERROR

bool gmio_error ( int  code)

Returns true if code != GMIO_NO_ERROR

bool gmio_memblock_isnull ( const struct gmio_memblock mblock)

Returns true if mblock is NULL or points to null/void memory.

struct gmio_memblock gmio_memblock ( void *  ptr,
size_t  size,
void(*)(void *)  func_deallocate 
)

Returns an initialized memblock object.

If ptr is NULL then gmio_memblock::size is forced to 0

struct gmio_memblock gmio_memblock_malloc ( size_t  size)

Returns a memblock allocated with standard malloc().

gmio_memblock::func_deallocate is set to standard free()

struct gmio_memblock gmio_memblock_calloc ( size_t  num,
size_t  size 
)

Returns a memblock allocated with standard calloc().

gmio_memblock::func_deallocate is set to standard free()

struct gmio_memblock gmio_memblock_realloc ( void *  ptr,
size_t  size 
)

Returns a memblock allocated with standard realloc().

gmio_memblock::func_deallocate is set to standard free()

void gmio_memblock_deallocate ( struct gmio_memblock mblock)

Safe and convenient call to gmio_memblock::func_deallocate()

void gmio_memblock_set_default_constructor ( gmio_memblock_constructor_func_t  ctor)

Installs a global function to construct gmio_memblock objects.

The constructor function allocates a memblock on demand, to be used when a temporary memblock is needed.

This function is not thread-safe.

gmio_memblock_constructor_func_t gmio_memblock_default_constructor ( )

Returns the currently installed function to construct memblock objects.

It is initialized to gmio_memblock_malloc(128KB)

struct gmio_memblock gmio_memblock_default ( )

Returns a memblock created with the function gmio_memblock_default_constructor()

struct gmio_stream gmio_stream_null ( )

Returns a null stream.

struct gmio_stream gmio_stream_stdio ( FILE *  file)

Returns a stream for standard FILE* (cookie will hold file)

Fougue © 2017