API simplification, more homogeneous
This commit is contained in:
parent
e4492f92f9
commit
d5133928c4
@ -105,7 +105,7 @@ static void readwrite_begin_solid(
|
||||
* procedure (in gmio_stl_mesh_creator::func_end_solid() callback)
|
||||
*/
|
||||
const enum gmio_endianness byte_order = to_byte_order(rw_conv->out_format);
|
||||
gmio_stlb_write_header(stream, byte_order, NULL, 0);
|
||||
gmio_stlb_header_write(stream, byte_order, NULL, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -113,7 +113,7 @@ static void readwrite_begin_solid(
|
||||
stream->func_write(stream->cookie, "solid\n", 1, 6);
|
||||
}
|
||||
else {
|
||||
gmio_stlb_write_header(
|
||||
gmio_stlb_header_write(
|
||||
stream,
|
||||
to_byte_order(rw_conv->out_format),
|
||||
infos->stlb_header,
|
||||
@ -172,7 +172,7 @@ static void readwrite_end_solid(void* cookie)
|
||||
/* The total facet count has to be written because it wasn't known at
|
||||
* the beginning of the read procedure */
|
||||
stream->func_set_pos(stream->cookie, &rw_conv->out_stream_pos_begin);
|
||||
gmio_stlb_write_header(
|
||||
gmio_stlb_header_write(
|
||||
stream, byte_order, NULL, rw_conv->total_triangle_count);
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ static void bmk_gmio_stl_readwrite_conv(const void* filepath)
|
||||
|
||||
if (infile != NULL) {
|
||||
instream = gmio_stream_stdio(infile);
|
||||
rw_conv.in_format = gmio_stl_get_format(&instream);
|
||||
rw_conv.in_format = gmio_stl_format_probe(&instream);
|
||||
}
|
||||
if (outfile != NULL) {
|
||||
rw_conv.stream = gmio_stream_stdio(outfile);
|
||||
|
@ -30,8 +30,8 @@ include_directories(${CMAKE_BINARY_DIR}/src/gmio_core) # For cmake generated hea
|
||||
|
||||
# Enable DLL generation (export symbols)
|
||||
if(GMIO_BUILD_SHARED_LIBS)
|
||||
add_definitions(-DGMIO_LIB_DLL
|
||||
-DGMIO_LIB_MAKE_DLL)
|
||||
add_definitions(-DGMIO_DLL
|
||||
-DGMIO_MAKING_DLL)
|
||||
if(MSVC)
|
||||
configure_file(gmio_core/gmio.rc.cmake gmio_core/gmio.rc @ONLY)
|
||||
set(GMIO_SRC_FILES ${GMIO_SRC_FILES} ${CMAKE_BINARY_DIR}/src/gmio_core/gmio.rc)
|
||||
@ -46,10 +46,10 @@ file(GLOB GMIO_CORE_HEADERS gmio_core/*.h)
|
||||
install(FILES ${GMIO_CORE_HEADERS} DESTINATION include/gmio_core)
|
||||
|
||||
# Module libSTL
|
||||
if(GMIO_BUILD_SHARED_LIBS)
|
||||
add_definitions(-DGMIO_LIBSTL_DLL
|
||||
-DGMIO_LIBSTL_MAKE_DLL)
|
||||
endif()
|
||||
#if(GMIO_BUILD_SHARED_LIBS)
|
||||
# add_definitions(-DGMIO_STL_DLL
|
||||
# -DGMIO_STL_MAKING_DLL)
|
||||
#endif()
|
||||
|
||||
file(GLOB GMIO_LIBSTL_SRC_FILES gmio_stl/* gmio_stl/internal/*)
|
||||
set(GMIO_SRC_FILES ${GMIO_SRC_FILES} ${GMIO_LIBSTL_SRC_FILES})
|
||||
|
@ -55,7 +55,7 @@ enum gmio_endianness
|
||||
GMIO_C_LINKAGE_BEGIN
|
||||
|
||||
/*! Returns endianness (byte order) of the host's CPU architecture */
|
||||
GMIO_LIB_EXPORT enum gmio_endianness gmio_host_endianness();
|
||||
GMIO_API enum gmio_endianness gmio_host_endianness();
|
||||
|
||||
GMIO_C_LINKAGE_END
|
||||
|
||||
|
@ -63,17 +63,17 @@
|
||||
# define GMIO_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
/* GMIO_LIB_EXPORT */
|
||||
#ifdef GMIO_LIB_DLL
|
||||
# ifdef GMIO_LIB_MAKE_DLL
|
||||
# define GMIO_LIB_EXPORT GMIO_DECL_EXPORT
|
||||
/* GMIO_API */
|
||||
#ifdef GMIO_DLL
|
||||
# ifdef GMIO_MAKING_DLL
|
||||
# define GMIO_API GMIO_DECL_EXPORT
|
||||
# else
|
||||
# define GMIO_LIB_EXPORT GMIO_DECL_IMPORT
|
||||
# endif /* GMIO_LIB_MAKE_DLL */
|
||||
# define GMIO_API GMIO_DECL_IMPORT
|
||||
# endif /* GMIO_MAKING_DLL */
|
||||
#else
|
||||
/*! Expands either to GMIO_DECL_EXPORT or GMIO_DECL_IMPORT when respectively
|
||||
* compiling/using the DLL */
|
||||
# define GMIO_LIB_EXPORT
|
||||
# define GMIO_API
|
||||
#endif
|
||||
|
||||
/* Typedefs for specific width integers */
|
||||
|
@ -44,32 +44,26 @@ struct gmio_memblock
|
||||
GMIO_C_LINKAGE_BEGIN
|
||||
|
||||
/*! Returns true if \p mblock is NULL or points to null/void memory */
|
||||
GMIO_LIB_EXPORT
|
||||
bool gmio_memblock_isnull(const struct gmio_memblock* mblock);
|
||||
GMIO_API bool gmio_memblock_isnull(const struct gmio_memblock* mblock);
|
||||
|
||||
/*! Returns an initialized gmio_memblock object
|
||||
*
|
||||
* If \p ptr is NULL then gmio_memblock::size is forced to \c 0
|
||||
*/
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock(
|
||||
GMIO_API struct gmio_memblock gmio_memblock(
|
||||
void* ptr, size_t size, void (*func_deallocate)(void*));
|
||||
|
||||
/*! Returns a gmio_memblock object allocated with standard \c malloc() */
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock_malloc(size_t size);
|
||||
GMIO_API struct gmio_memblock gmio_memblock_malloc(size_t size);
|
||||
|
||||
/*! Returns a gmio_memblock object allocated with standard \c calloc() */
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock_calloc(size_t num, size_t size);
|
||||
GMIO_API struct gmio_memblock gmio_memblock_calloc(size_t num, size_t size);
|
||||
|
||||
/*! Returns a gmio_memblock object allocated with standard \c realloc() */
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock_realloc(void* ptr, size_t size);
|
||||
GMIO_API struct gmio_memblock gmio_memblock_realloc(void* ptr, size_t size);
|
||||
|
||||
/*! Safe and convenient call to gmio_memblock::func_deallocate() */
|
||||
GMIO_LIB_EXPORT
|
||||
void gmio_memblock_deallocate(struct gmio_memblock* mblock);
|
||||
GMIO_API void gmio_memblock_deallocate(struct gmio_memblock* mblock);
|
||||
|
||||
/*! Typedef for a pointer to a function that creates an allocated mblock
|
||||
*
|
||||
@ -85,21 +79,18 @@ typedef struct gmio_memblock (*gmio_memblock_constructor_func_t)();
|
||||
*
|
||||
* This function is not thread-safe.
|
||||
*/
|
||||
GMIO_LIB_EXPORT
|
||||
void gmio_memblock_set_default_constructor(
|
||||
GMIO_API void gmio_memblock_set_default_constructor(
|
||||
gmio_memblock_constructor_func_t ctor);
|
||||
|
||||
/*! Returns the currently installed function to construct gmio_memblock objects
|
||||
*
|
||||
* It is initialized to <tt>gmio_memblock_malloc(128KB)</tt>
|
||||
*/
|
||||
GMIO_LIB_EXPORT
|
||||
gmio_memblock_constructor_func_t gmio_memblock_default_constructor();
|
||||
GMIO_API gmio_memblock_constructor_func_t gmio_memblock_default_constructor();
|
||||
|
||||
/*! Returns a gmio_memblock object created using the function
|
||||
* gmio_memblock_default_constructor() */
|
||||
GMIO_LIB_EXPORT
|
||||
struct gmio_memblock gmio_memblock_default();
|
||||
GMIO_API struct gmio_memblock gmio_memblock_default();
|
||||
|
||||
GMIO_C_LINKAGE_END
|
||||
|
||||
|
@ -28,12 +28,25 @@
|
||||
#include "streampos.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef GMIO_HAVE_INT64_TYPE
|
||||
#ifndef DOXYGEN
|
||||
# ifdef GMIO_HAVE_INT64_TYPE
|
||||
typedef int64_t gmio_streamsize_t;
|
||||
typedef int64_t gmio_streamoffset_t;
|
||||
#else
|
||||
# else
|
||||
typedef long gmio_streamsize_t;
|
||||
typedef long gmio_streamoffset_t;
|
||||
# endif
|
||||
#else
|
||||
/*! 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_streamsize_t;
|
||||
/*! Type able to represent the offset position within a stream
|
||||
*
|
||||
* It can be int64_t or long depending on the compiler support
|
||||
*/
|
||||
typedef int64_or_long gmio_streamoffset_t;
|
||||
#endif
|
||||
|
||||
/*! Stream that can get input from an arbitrary data source or can write
|
||||
@ -126,10 +139,10 @@ GMIO_C_LINKAGE_BEGIN
|
||||
/* Initialization */
|
||||
|
||||
/*! Returns a null stream */
|
||||
GMIO_LIB_EXPORT struct gmio_stream gmio_stream_null();
|
||||
GMIO_API struct gmio_stream gmio_stream_null();
|
||||
|
||||
/*! Returns a stream for standard FILE* (cookie will hold \p file) */
|
||||
GMIO_LIB_EXPORT struct gmio_stream gmio_stream_stdio(FILE* file);
|
||||
GMIO_API struct gmio_stream gmio_stream_stdio(FILE* file);
|
||||
|
||||
GMIO_C_LINKAGE_END
|
||||
|
||||
|
@ -25,7 +25,8 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/*! Size of the byte array gmio_streampos::cookie */
|
||||
/*! \c GMIO_STREAMPOS_COOKIE_SIZE
|
||||
* Size of the byte array gmio_streampos::cookie */
|
||||
enum { GMIO_STREAMPOS_COOKIE_SIZE = 32 /* bytes */ };
|
||||
|
||||
/*! Specifies a position within a stream
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
/*! Defines an interface through which any task can be controlled */
|
||||
/*! Defines an interface through which a task can be controlled */
|
||||
struct gmio_task_iface
|
||||
{
|
||||
/*! Optional opaque pointer on a user task object, passed as first
|
||||
|
@ -122,7 +122,7 @@ int gmio_stlb_write(
|
||||
goto label_end;
|
||||
|
||||
if (!write_triangles_only) {
|
||||
error = gmio_stlb_write_header(stream, byte_order, header, facet_count);
|
||||
error = gmio_stlb_header_write(stream, byte_order, header, facet_count);
|
||||
if (gmio_error(error))
|
||||
goto label_end;
|
||||
}
|
||||
|
@ -23,7 +23,8 @@
|
||||
#ifndef GMIO_STL_ERROR_H
|
||||
#define GMIO_STL_ERROR_H
|
||||
|
||||
/*! A byte-mask to tag(identify) STL-specific error codes */
|
||||
/*! \c GMIO_STL_ERROR_TAG
|
||||
* Byte-mask to tag(identify) STL-specific error codes */
|
||||
enum { GMIO_STL_ERROR_TAG = 0x11000000 };
|
||||
|
||||
/*! This enum defines the various error codes reported by STL read/write
|
||||
|
@ -116,7 +116,7 @@ static bool gmio_is_stl_ascii(const char* buff, size_t buff_len)
|
||||
return false;
|
||||
}
|
||||
|
||||
enum gmio_stl_format gmio_stl_get_format(struct gmio_stream *stream)
|
||||
enum gmio_stl_format gmio_stl_format_probe(struct gmio_stream *stream)
|
||||
{
|
||||
char buff[GMIO_FIXED_BUFFER_SIZE] = {0};
|
||||
size_t read_size = 0;
|
||||
@ -155,14 +155,14 @@ enum gmio_stl_format gmio_stl_get_format(struct gmio_stream *stream)
|
||||
return GMIO_STL_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
enum gmio_stl_format gmio_stl_get_format_file(const char* filepath)
|
||||
enum gmio_stl_format gmio_stl_format_probe_file(const char* filepath)
|
||||
{
|
||||
enum gmio_stl_format format = GMIO_STL_FORMAT_UNKNOWN;
|
||||
FILE* file = fopen(filepath, "rb");
|
||||
|
||||
if (file != NULL) {
|
||||
struct gmio_stream stream = gmio_stream_stdio(file);
|
||||
format = gmio_stl_get_format(&stream);
|
||||
format = gmio_stl_format_probe(&stream);
|
||||
fclose(file);
|
||||
}
|
||||
return format;
|
||||
|
@ -26,7 +26,8 @@
|
||||
#include "stl_global.h"
|
||||
#include "../gmio_core/stream.h"
|
||||
|
||||
/*! A byte-mask to tag(identify) STL binary formats */
|
||||
/*! \c GMIO_STL_FORMAT_TAG_BINARY
|
||||
* Byte-mask to tag(identify) STL binary formats */
|
||||
enum { GMIO_STL_FORMAT_TAG_BINARY = 0x10 };
|
||||
|
||||
/*! This enums defines the various STL formats */
|
||||
@ -53,19 +54,17 @@ GMIO_C_LINKAGE_BEGIN
|
||||
*
|
||||
* \retval GMIO_STL_FORMAT_UNKNOWN in case of error.
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
enum gmio_stl_format gmio_stl_get_format(struct gmio_stream* stream);
|
||||
GMIO_API enum gmio_stl_format gmio_stl_format_probe(struct gmio_stream* stream);
|
||||
|
||||
/*! Returns the format of the STL data in file at location \p filepath
|
||||
*
|
||||
* This function is a wrapper around gmio_stl_get_format()
|
||||
* This function is a wrapper around gmio_stl_format_probe()
|
||||
*
|
||||
* \param filepath Path to the STL file. A stream is opened with fopen() so
|
||||
* \param filepath Path to the STL file. A stream is opened with \c fopen() so
|
||||
* the string shall follow the file name specifications of the running
|
||||
* environment
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
enum gmio_stl_format gmio_stl_get_format_file(const char* filepath);
|
||||
GMIO_API enum gmio_stl_format gmio_stl_format_probe_file(const char* filepath);
|
||||
|
||||
GMIO_C_LINKAGE_END
|
||||
|
||||
|
@ -28,17 +28,5 @@
|
||||
|
||||
#include "../gmio_core/global.h"
|
||||
|
||||
#ifdef GMIO_LIBSTL_DLL
|
||||
# ifdef GMIO_LIBSTL_MAKE_DLL
|
||||
# define GMIO_LIBSTL_EXPORT GMIO_DECL_EXPORT
|
||||
# else
|
||||
# define GMIO_LIBSTL_EXPORT GMIO_DECL_IMPORT
|
||||
# endif /* GMIO_DATAX_LIBSTL_MAKE_DLL */
|
||||
#else
|
||||
/*! Expands either to GMIO_DECL_EXPORT or GMIO_DECL_IMPORT when respectively
|
||||
* compiling/using the DLL */
|
||||
# define GMIO_LIBSTL_EXPORT
|
||||
#endif /* GMIO_LIBSTL_DLL */
|
||||
|
||||
#endif /* GMIO_STL_GLOBAL_H */
|
||||
/*! @} */
|
||||
|
@ -43,7 +43,7 @@ int gmio_stl_infos_get(
|
||||
|
||||
/* Guess format when left unspecified */
|
||||
if (format == GMIO_STL_FORMAT_UNKNOWN) {
|
||||
format = gmio_stl_get_format(stream);
|
||||
format = gmio_stl_format_probe(stream);
|
||||
if (format == GMIO_STL_FORMAT_UNKNOWN) {
|
||||
error = GMIO_STL_ERROR_UNKNOWN_FORMAT;
|
||||
goto label_end;
|
||||
|
@ -87,7 +87,7 @@ enum gmio_stl_info_flag
|
||||
GMIO_STL_INFO_FLAG_ALL = 0xFFFF
|
||||
};
|
||||
|
||||
/*! Optional parameters of gmio_stl_infos_get() */
|
||||
/*! Options of function gmio_stl_infos_get() */
|
||||
struct gmio_stl_infos_get_options
|
||||
{
|
||||
/*! See gmio_core_readwrite_options::stream_memblock */
|
||||
@ -97,9 +97,9 @@ struct gmio_stl_infos_get_options
|
||||
* automatically guessed */
|
||||
enum gmio_stl_format format_hint;
|
||||
|
||||
/*! Restrict gmio_stl_infos_get() to not read further this limit
|
||||
/*! Restrict gmio_stl_infos_get() to not read further this limit(in bytes)
|
||||
*
|
||||
* Not yet supported
|
||||
* \warning Not yet supported
|
||||
*/
|
||||
gmio_streamsize_t size_limit;
|
||||
};
|
||||
@ -107,22 +107,30 @@ struct gmio_stl_infos_get_options
|
||||
GMIO_C_LINKAGE_BEGIN
|
||||
|
||||
/*! Finds informations about STL contents
|
||||
*
|
||||
* \p infos is an output parameter that will hold the retrieved infos
|
||||
*
|
||||
* \p flags is a bitor combination of \c gmio_stl_info_flag values and is used
|
||||
* to select the infos to retrieve.
|
||||
*
|
||||
* \return Error code (see gmio_core/error.h and stl_error.h)
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stl_infos_get(
|
||||
GMIO_API int gmio_stl_infos_get(
|
||||
struct gmio_stl_infos* infos,
|
||||
struct gmio_stream* stream,
|
||||
unsigned flags, /*!< Bitor combination of gmio_stl_info_flag values */
|
||||
unsigned flags,
|
||||
const struct gmio_stl_infos_get_options* options);
|
||||
|
||||
/*! Returns the size(in bytes) of next STL ascii solid in \p stream
|
||||
/*! Returns the size(in bytes) of the next STL ascii solid in \p stream
|
||||
*
|
||||
* It is a facade over gmio_stl_infos_get() for gmio_stl_infos::size only
|
||||
*
|
||||
* Pointer to this function can be given to
|
||||
* gmio_stl_read_options::func_stla_get_streamsize() and is useful when
|
||||
* reading in sequence multi solids in STL ascii. The stream can be cleanly
|
||||
* advanced solid by solid after each call to gmio_stl_read()
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
gmio_streamsize_t gmio_stla_infos_get_streamsize(
|
||||
GMIO_API gmio_streamsize_t gmio_stla_infos_get_streamsize(
|
||||
struct gmio_stream* stream,
|
||||
struct gmio_memblock* stream_memblock);
|
||||
|
||||
|
@ -28,7 +28,7 @@ int gmio_stl_read(
|
||||
struct gmio_stl_mesh_creator* mesh_creator,
|
||||
const struct gmio_stl_read_options* options)
|
||||
{
|
||||
const enum gmio_stl_format format = gmio_stl_get_format(stream);
|
||||
const enum gmio_stl_format format = gmio_stl_format_probe(stream);
|
||||
switch (format) {
|
||||
case GMIO_STL_FORMAT_ASCII:
|
||||
return gmio_stla_read(stream, mesh_creator, options);
|
||||
@ -96,7 +96,7 @@ int gmio_stl_write_file(
|
||||
|
||||
static const struct gmio_stlb_header internal_stlb_zero_header = {0};
|
||||
|
||||
int gmio_stlb_write_header(
|
||||
int gmio_stlb_header_write(
|
||||
struct gmio_stream *stream,
|
||||
enum gmio_endianness byte_order,
|
||||
const struct gmio_stlb_header *header,
|
||||
|
@ -38,8 +38,7 @@ GMIO_C_LINKAGE_BEGIN
|
||||
*
|
||||
* \return Error code (see gmio_core/error.h and stl_error.h)
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stl_read(
|
||||
GMIO_API int gmio_stl_read(
|
||||
struct gmio_stream* stream,
|
||||
struct gmio_stl_mesh_creator* mesh_creator,
|
||||
const struct gmio_stl_read_options* options);
|
||||
@ -49,33 +48,30 @@ int gmio_stl_read(
|
||||
* This is just a facility function over gmio_stl_read(). The internal stream
|
||||
* object is created to read file at \p filepath (see gmio_stream_stdio(FILE*))
|
||||
*
|
||||
* The file is opened with fopen() so \p filepath shall follow the file name
|
||||
* The file is opened with \c fopen() so \p filepath shall follow the file name
|
||||
* specifications of the running environment
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stl_read_file(
|
||||
GMIO_API int gmio_stl_read_file(
|
||||
const char* filepath,
|
||||
struct gmio_stl_mesh_creator* mesh_creator,
|
||||
const struct gmio_stl_read_options* options);
|
||||
|
||||
/*! Reads geometry from STL ascii stream
|
||||
/*! Reads mesh from STL ascii stream
|
||||
*
|
||||
* \return Error code (see gmio_core/error.h and stl_error.h)
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stla_read(
|
||||
GMIO_API int gmio_stla_read(
|
||||
struct gmio_stream* stream,
|
||||
struct gmio_stl_mesh_creator* mesh_creator,
|
||||
const struct gmio_stl_read_options* options);
|
||||
|
||||
/*! Reads geometry from STL binary stream
|
||||
/*! Reads mesh from STL binary stream
|
||||
*
|
||||
* \return Error code (see gmio_core/error.h and stl_error.h)
|
||||
* \retval GMIO_ERROR_INVALID_MEMBLOCK_SIZE
|
||||
* if <tt>options->stream_memblock.size < GMIO_STLB_MIN_CONTENTS_SIZE</tt>
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stlb_read(
|
||||
GMIO_API int gmio_stlb_read(
|
||||
struct gmio_stream* stream,
|
||||
struct gmio_stl_mesh_creator* mesh_creator,
|
||||
enum gmio_endianness byte_order,
|
||||
@ -85,8 +81,7 @@ int gmio_stlb_read(
|
||||
*
|
||||
* \return Error code (see gmio_core/error.h and stl_error.h)
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stl_write(
|
||||
GMIO_API int gmio_stl_write(
|
||||
enum gmio_stl_format format,
|
||||
struct gmio_stream* stream,
|
||||
const struct gmio_stl_mesh* mesh,
|
||||
@ -97,13 +92,12 @@ int gmio_stl_write(
|
||||
* This is just a facility function over gmio_stl_write(). The internal stream
|
||||
* object is created to read file at \p filepath (see gmio_stream_stdio(FILE*))
|
||||
*
|
||||
* The file is opened with fopen() so \p filepath shall follow the file name
|
||||
* The file is opened with \c fopen() so \p filepath shall follow the file name
|
||||
* specifications of the running environment
|
||||
|
||||
* \return Error code (see gmio_core/error.h and stl_error.h)
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stl_write_file(
|
||||
GMIO_API int gmio_stl_write_file(
|
||||
enum gmio_stl_format format,
|
||||
const char* filepath,
|
||||
const struct gmio_stl_mesh* mesh,
|
||||
@ -114,21 +108,14 @@ int gmio_stl_write_file(
|
||||
* This functions only writes the 80-bytes header array and the count of facets
|
||||
* in the mesh(with respect of the specified byte order).
|
||||
*
|
||||
* \p header Can be safely set to \c NULL to generate an array of zeroes
|
||||
*
|
||||
* \return Error code (see error.h and stl_error.h)
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
int gmio_stlb_write_header(
|
||||
/*! Output stream where is written the header data */
|
||||
GMIO_API int gmio_stlb_header_write(
|
||||
struct gmio_stream* stream,
|
||||
|
||||
/*! Byte order of the output STL data */
|
||||
enum gmio_endianness byte_order,
|
||||
|
||||
/*! 80-bytes array of header data, can be safely set to NULL to generate
|
||||
* an array of zeroes */
|
||||
const struct gmio_stlb_header* header,
|
||||
|
||||
/*! Total count of facets (triangles) in the mesh to be written */
|
||||
uint32_t facet_count
|
||||
);
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "../gmio_core/task_iface.h"
|
||||
#include "../gmio_core/text_format.h"
|
||||
|
||||
/*! Options of function gmio_stl_read() */
|
||||
struct gmio_stl_read_options
|
||||
{
|
||||
/*! Used by the stream to bufferize I/O operations
|
||||
@ -50,13 +51,15 @@ struct gmio_stl_read_options
|
||||
*
|
||||
* The resulting stream size is passed to
|
||||
* gmio_task_iface::func_handle_progress() as the \p max_value argument.
|
||||
*
|
||||
* \sa gmio_stla_infos_get_streamsize()
|
||||
*/
|
||||
gmio_streamsize_t (*func_stla_get_streamsize)(
|
||||
struct gmio_stream* stream,
|
||||
struct gmio_memblock* stream_memblock);
|
||||
};
|
||||
|
||||
/*! Options for gmio_stl_write() */
|
||||
/*! Options of function gmio_stl_write() */
|
||||
struct gmio_stl_write_options
|
||||
{
|
||||
/*! See gmio_stl_read_options::stream_memblock */
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
/*! Informations about the STL stream, used in
|
||||
* gmio_stl_mesh_creator::begin_solid() */
|
||||
* gmio_stl_mesh_creator::func_begin_solid() */
|
||||
struct gmio_stl_mesh_creator_infos
|
||||
{
|
||||
/*! Format of the input STL mesh */
|
||||
|
@ -39,8 +39,7 @@ struct gmio_stl_triangle
|
||||
GMIO_C_LINKAGE_BEGIN
|
||||
|
||||
/*! Computes the normal vector of triangle \p tri */
|
||||
GMIO_LIBSTL_EXPORT
|
||||
void gmio_stl_triangle_compute_normal(struct gmio_stl_triangle* tri);
|
||||
GMIO_API void gmio_stl_triangle_compute_normal(struct gmio_stl_triangle* tri);
|
||||
|
||||
GMIO_C_LINKAGE_END
|
||||
|
||||
|
@ -41,8 +41,7 @@ GMIO_C_LINKAGE_BEGIN
|
||||
* If the length of \p str is less than \c GMIO_STLB_HEADER_SIZE then the
|
||||
* remaining bytes are filled with zeroes.
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
struct gmio_stlb_header gmio_stlb_header_str(const char* str);
|
||||
GMIO_API struct gmio_stlb_header gmio_stlb_header_str(const char* str);
|
||||
|
||||
/*! Copies \p header into C string \p str
|
||||
*
|
||||
@ -50,8 +49,7 @@ struct gmio_stlb_header gmio_stlb_header_str(const char* str);
|
||||
* \p str must be at least \c GMIO_STLB_HEADER_SIZE+1 long, a terminating null
|
||||
* character ('\0') is copied at position \c GMIO_STLB_HEADER_SIZE
|
||||
*/
|
||||
GMIO_LIBSTL_EXPORT
|
||||
void gmio_stlb_header_to_printable_str(
|
||||
GMIO_API void gmio_stlb_header_to_printable_str(
|
||||
const struct gmio_stlb_header* header, char* str, char replacement);
|
||||
|
||||
GMIO_C_LINKAGE_END
|
||||
|
@ -45,7 +45,7 @@ class TColgp_SequenceOfXYZ;
|
||||
*
|
||||
* You don't have to use API of this class, it's intended to gmio_stl_mesh()
|
||||
*/
|
||||
struct GMIO_LIBSUPPORT_EXPORT gmio_stl_occmesh_iterator
|
||||
struct gmio_stl_occmesh_iterator
|
||||
{
|
||||
gmio_stl_occmesh_iterator();
|
||||
explicit gmio_stl_occmesh_iterator(const StlMesh_Mesh* mesh);
|
||||
@ -81,7 +81,6 @@ private:
|
||||
* gmio_stl_write_file(stl_format, filepath, &mesh, &options);
|
||||
* \endcode
|
||||
*/
|
||||
GMIO_LIBSUPPORT_EXPORT
|
||||
gmio_stl_mesh gmio_stl_occmesh(const gmio_stl_occmesh_iterator& it);
|
||||
|
||||
/*! Returns a gmio_stl_mesh_creator that will build a new domain in a
|
||||
@ -89,7 +88,6 @@ gmio_stl_mesh gmio_stl_occmesh(const gmio_stl_occmesh_iterator& it);
|
||||
*
|
||||
* The creator's cookie will point \p mesh
|
||||
*/
|
||||
GMIO_LIBSUPPORT_EXPORT
|
||||
gmio_stl_mesh_creator gmio_stl_occmesh_creator(StlMesh_Mesh* mesh);
|
||||
|
||||
/*! Same as gmio_stl_occmesh_creator(StlMesh_Mesh*) but takes a handle
|
||||
@ -97,7 +95,6 @@ gmio_stl_mesh_creator gmio_stl_occmesh_creator(StlMesh_Mesh* mesh);
|
||||
* The creator's cookie will point to the internal data(ie StlMesh_Mesh*) of
|
||||
* handle \p hnd
|
||||
*/
|
||||
GMIO_LIBSUPPORT_EXPORT
|
||||
gmio_stl_mesh_creator gmio_stl_occmesh_creator(const Handle_StlMesh_Mesh& hnd);
|
||||
|
||||
|
||||
|
@ -36,7 +36,6 @@ class QIODevice;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/*! Returns a gmio_stream for \c QIODevice* (cookie will hold \p device) */
|
||||
GMIO_LIBSUPPORT_EXPORT
|
||||
struct gmio_stream gmio_stream_qiodevice(
|
||||
#ifndef DOXYGEN
|
||||
QT_PREPEND_NAMESPACE(QIODevice)* device
|
||||
|
@ -28,15 +28,5 @@
|
||||
|
||||
#include "../gmio_core/global.h"
|
||||
|
||||
#ifdef GMIO_LIBSUPPORT_DLL
|
||||
# ifdef GMIO_LIBSUPPORT_MAKE_DLL
|
||||
# define GMIO_LIBSUPPORT_EXPORT GMIO_DECL_EXPORT
|
||||
# else
|
||||
# define GMIO_LIBSUPPORT_EXPORT GMIO_DECL_IMPORT
|
||||
# endif /* GMIO_LIBSUPPORT_MAKE_DLL */
|
||||
#else
|
||||
# define GMIO_LIBSUPPORT_EXPORT
|
||||
#endif /* GMIO_LIBSUPPORT_DLL */
|
||||
|
||||
#endif /* GMIO_SUPPORT_GLOBAL_H */
|
||||
/*! @} */
|
||||
|
@ -30,7 +30,7 @@ const char* test_stl_read_multi_solid();
|
||||
const char* test_stla_write();
|
||||
const char* test_stlb_read();
|
||||
const char* test_stlb_write();
|
||||
const char* test_stlb_write_header();
|
||||
const char* test_stlb_header_write();
|
||||
|
||||
const char* test_stlb_header_str();
|
||||
const char* test_stlb_header_to_printable_str();
|
||||
@ -63,7 +63,7 @@ const char* all_tests()
|
||||
UTEST_RUN(test_stla_write);
|
||||
UTEST_RUN(test_stlb_read);
|
||||
UTEST_RUN(test_stlb_write);
|
||||
UTEST_RUN(test_stlb_write_header);
|
||||
UTEST_RUN(test_stlb_header_write);
|
||||
|
||||
UTEST_RUN(test_stlb_header_str);
|
||||
UTEST_RUN(test_stlb_header_to_printable_str);
|
||||
|
@ -64,7 +64,7 @@ const char* test_stl_read()
|
||||
|
||||
while (testcase != stl_read_testcases_ptr_end()) {
|
||||
const enum gmio_stl_format format =
|
||||
gmio_stl_get_format_file(testcase->filepath);
|
||||
gmio_stl_format_probe_file(testcase->filepath);
|
||||
const int err =
|
||||
gmio_stl_read_file(testcase->filepath, &mesh_creator, NULL);
|
||||
|
||||
@ -128,7 +128,7 @@ const char* test_stlb_read()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* test_stlb_write_header()
|
||||
const char* test_stlb_header_write()
|
||||
{
|
||||
const char* filepath = "temp/solid.stlb";
|
||||
struct gmio_stlb_header header = {0};
|
||||
@ -141,7 +141,7 @@ const char* test_stlb_write_header()
|
||||
memcpy(&header,
|
||||
header_str,
|
||||
GMIO_MIN(GMIO_STLB_HEADER_SIZE, strlen(header_str)));
|
||||
error = gmio_stlb_write_header(
|
||||
error = gmio_stlb_header_write(
|
||||
&stream, GMIO_ENDIANNESS_LITTLE, &header, 0);
|
||||
fclose(outfile);
|
||||
UTEST_COMPARE_INT(GMIO_ERROR_OK, error);
|
||||
@ -346,7 +346,7 @@ void generate_stlb_tests_models()
|
||||
{
|
||||
FILE* outfile = fopen(filepath_stlb_empty, "wb");
|
||||
struct gmio_stream stream = gmio_stream_stdio(outfile);
|
||||
gmio_stlb_write_header(&stream, GMIO_ENDIANNESS_LITTLE, NULL, 0);
|
||||
gmio_stlb_header_write(&stream, GMIO_ENDIANNESS_LITTLE, NULL, 0);
|
||||
fclose(outfile);
|
||||
}
|
||||
|
||||
@ -400,7 +400,7 @@ void generate_stlb_tests_models()
|
||||
FILE* outfile = fopen(filepath_stlb_header_nofacets, "wb");
|
||||
struct gmio_stream ostream = gmio_stream_stdio(outfile);
|
||||
const struct gmio_stlb_header header = {0};
|
||||
gmio_stlb_write_header(&ostream, GMIO_ENDIANNESS_LITTLE, &header, 100);
|
||||
gmio_stlb_header_write(&ostream, GMIO_ENDIANNESS_LITTLE, &header, 100);
|
||||
fclose(outfile);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user