diff --git a/benchmarks/benchmark_gmio/main.c b/benchmarks/benchmark_gmio/main.c index 749da26..178343b 100644 --- a/benchmarks/benchmark_gmio/main.c +++ b/benchmarks/benchmark_gmio/main.c @@ -229,7 +229,7 @@ static void bmk_gmio_stl_readwrite_conv(const void* filepath) fclose(outfile); } -void bmk_gmio_stl_infos_get_all(const void* filepath) +void bmk_gmio_stl_infos_probe_all(const void* filepath) { static bool already_exec = false; FILE* file = fopen(filepath, "rb"); @@ -237,10 +237,10 @@ void bmk_gmio_stl_infos_get_all(const void* filepath) if (file != NULL) { struct gmio_stream stream = gmio_stream_stdio(file); struct gmio_stl_infos infos = {0}; - gmio_stl_infos_get(&infos, &stream, GMIO_STL_INFO_FLAG_ALL, NULL); + gmio_stl_infos_probe(&infos, &stream, GMIO_STL_INFO_FLAG_ALL, NULL); if (!already_exec) { - printf("stl_infos_get(ALL)\n" + printf("stl_infos_probe(ALL)\n" " File: %s\n" " Size: %uKo\n" " Facets: %u\n", @@ -258,7 +258,7 @@ void bmk_gmio_stl_infos_get_all(const void* filepath) fclose(file); } -void bmk_gmio_stl_infos_get_size(const void* filepath) +void bmk_gmio_stl_infos_probe_size(const void* filepath) { static bool already_exec = false; FILE* file = fopen(filepath, "rb"); @@ -266,10 +266,10 @@ void bmk_gmio_stl_infos_get_size(const void* filepath) if (file != NULL) { struct gmio_stream stream = gmio_stream_stdio(file); struct gmio_stl_infos infos = {0}; - gmio_stl_infos_get(&infos, &stream, GMIO_STL_INFO_FLAG_SIZE, NULL); + gmio_stl_infos_probe(&infos, &stream, GMIO_STL_INFO_FLAG_SIZE, NULL); if (!already_exec) { - printf("stl_infos_get(SIZE)\n" + printf("stl_infos_probe(SIZE)\n" " File: %s\n" " Size: %uKo\n", (const char*)filepath, @@ -294,11 +294,11 @@ int main(int argc, char** argv) { "readwrite_conv()", bmk_gmio_stl_readwrite_conv, NULL, NULL, NULL }, - { "stl_infos_get(ALL)", - bmk_gmio_stl_infos_get_all, NULL, + { "stl_infos_probe(ALL)", + bmk_gmio_stl_infos_probe_all, NULL, NULL, NULL }, - { "stl_infos_get(size)", - bmk_gmio_stl_infos_get_size, NULL, + { "stl_infos_probe(size)", + bmk_gmio_stl_infos_probe_size, NULL, NULL, NULL }, {0} }; diff --git a/examples/stl_get_infos.c b/examples/stl_get_infos.c index b3bf891..618caf8 100644 --- a/examples/stl_get_infos.c +++ b/examples/stl_get_infos.c @@ -2,7 +2,7 @@ * * Example: get informations about an STL file * - * Informations that can be retrieved by gmio_stl_infos_get() are: + * Informations that can be retrieved by gmio_stl_infos_probe() are: * - STL format of the input stream * - Count of facets(triangles) * - Size of the STL contents in bytes @@ -53,7 +53,7 @@ int main(int argc, char** argv) struct gmio_stream stream = gmio_stream_stdio(file); struct gmio_stl_infos infos = {0}; /* Retrieve STL informations, using default options(NULL) */ - error = gmio_stl_infos_get( + error = gmio_stl_infos_probe( &infos, &stream, GMIO_STL_INFO_FLAG_ALL, NULL); printf("File: %s\n", filepath); if (error == GMIO_ERROR_OK) diff --git a/examples/stl_read_file.c b/examples/stl_read_file.c index 652d80b..3fcdf17 100644 --- a/examples/stl_read_file.c +++ b/examples/stl_read_file.c @@ -51,7 +51,7 @@ static void my_3d_mesh__copy_triangle( * precisely known. * To overcome this: * - instead of just using general gmio_stl_read(), call - * call gmio_stl_infos_get(GMIO_STL_INFO_FLAG_FACET_COUNT) and then + * call gmio_stl_infos_probe(GMIO_STL_INFO_FLAG_FACET_COUNT) and then * gmio_stla_read() * - or just grow the capacity of your mesh, here the triangle array * is grown by 12.5% */ diff --git a/src/gmio_stl/internal/stla_infos_get.c b/src/gmio_stl/internal/stla_infos_probe.c similarity index 98% rename from src/gmio_stl/internal/stla_infos_get.c rename to src/gmio_stl/internal/stla_infos_probe.c index 316348d..e37fa43 100644 --- a/src/gmio_stl/internal/stla_infos_get.c +++ b/src/gmio_stl/internal/stla_infos_probe.c @@ -27,7 +27,7 @@ ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ -#include "stla_infos_get.h" +#include "stla_infos_probe.h" #include "../../gmio_core/error.h" #include "../../gmio_core/internal/helper_memblock.h" @@ -73,11 +73,11 @@ static size_t gmio_stringstream_read__flagsize( return len_read; } -int gmio_stla_infos_get( +int gmio_stla_infos_probe( struct gmio_stl_infos* infos, struct gmio_stream* stream, unsigned flags, - const struct gmio_stl_infos_get_options* opts) + const struct gmio_stl_infos_probe_options* opts) { const bool flag_facet_count = (flags & GMIO_STL_INFO_FLAG_FACET_COUNT) != 0; diff --git a/src/gmio_stl/internal/stla_infos_get.h b/src/gmio_stl/internal/stla_infos_probe.h similarity index 89% rename from src/gmio_stl/internal/stla_infos_get.h rename to src/gmio_stl/internal/stla_infos_probe.h index e737983..169575a 100644 --- a/src/gmio_stl/internal/stla_infos_get.h +++ b/src/gmio_stl/internal/stla_infos_probe.h @@ -27,16 +27,16 @@ ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ -#ifndef GMIO_INTERNAL_STLA_INFOS_GET_H -#define GMIO_INTERNAL_STLA_INFOS_GET_H +#ifndef GMIO_INTERNAL_STLA_INFOS_PROBE_H +#define GMIO_INTERNAL_STLA_INFOS_PROBE_H #include "../stl_infos.h" /*! Find infos from a STL ASCII stream */ -int gmio_stla_infos_get( +int gmio_stla_infos_probe( struct gmio_stl_infos* infos, struct gmio_stream* stream, unsigned flags, - const struct gmio_stl_infos_get_options* opts); + const struct gmio_stl_infos_probe_options* opts); -#endif /* GMIO_INTERNAL_STLA_INFOS_GET_H */ +#endif /* GMIO_INTERNAL_STLA_INFOS_PROBE_H */ diff --git a/src/gmio_stl/internal/stlb_infos_get.c b/src/gmio_stl/internal/stlb_infos_probe.c similarity index 96% rename from src/gmio_stl/internal/stlb_infos_get.c rename to src/gmio_stl/internal/stlb_infos_probe.c index 3e0d880..ae10c07 100644 --- a/src/gmio_stl/internal/stlb_infos_get.c +++ b/src/gmio_stl/internal/stlb_infos_probe.c @@ -27,7 +27,7 @@ ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ -#include "stlb_infos_get.h" +#include "stlb_infos_probe.h" #include "../../gmio_core/error.h" #include "../../gmio_core/internal/byte_swap.h" @@ -45,11 +45,11 @@ static enum gmio_endianness gmio_stl_format_to_endianness( return GMIO_ENDIANNESS_UNKNOWN; } -int gmio_stlb_infos_get( +int gmio_stlb_infos_probe( struct gmio_stl_infos* infos, struct gmio_stream* stream, unsigned flags, - const struct gmio_stl_infos_get_options* opts) + const struct gmio_stl_infos_probe_options* opts) { if (flags != 0) { const enum gmio_endianness byte_order = diff --git a/src/gmio_stl/internal/stlb_infos_get.h b/src/gmio_stl/internal/stlb_infos_probe.h similarity index 90% rename from src/gmio_stl/internal/stlb_infos_get.h rename to src/gmio_stl/internal/stlb_infos_probe.h index 5858b67..7d73a27 100644 --- a/src/gmio_stl/internal/stlb_infos_get.h +++ b/src/gmio_stl/internal/stlb_infos_probe.h @@ -27,21 +27,21 @@ ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ****************************************************************************/ -#ifndef GMIO_INTERNAL_STLB_INFOS_GET_H -#define GMIO_INTERNAL_STLB_INFOS_GET_H +#ifndef GMIO_INTERNAL_STLB_INFOS_PROBE_H +#define GMIO_INTERNAL_STLB_INFOS_PROBE_H #include "../stl_infos.h" #include "../../gmio_core/endian.h" /*! Finds infos from a STL binary stream */ -int gmio_stlb_infos_get( +int gmio_stlb_infos_probe( struct gmio_stl_infos* infos, struct gmio_stream* stream, unsigned flags, - const struct gmio_stl_infos_get_options* opts); + const struct gmio_stl_infos_probe_options* opts); /*! Returns the size(in bytes) of the whole STL binary data given some facet * count */ gmio_streamsize_t gmio_stlb_infos_size(uint32_t facet_count); -#endif /* GMIO_INTERNAL_STLB_INFOS_GET_H */ +#endif /* GMIO_INTERNAL_STLB_INFOS_PROBE_H */ diff --git a/src/gmio_stl/stl_format.c b/src/gmio_stl/stl_format.c index 0928612..06b22f5 100644 --- a/src/gmio_stl/stl_format.c +++ b/src/gmio_stl/stl_format.c @@ -32,7 +32,7 @@ #include "stl_triangle.h" #include "stlb_header.h" #include "internal/stlb_byte_swap.h" -#include "internal/stlb_infos_get.h" +#include "internal/stlb_infos_probe.h" #include "../gmio_core/endian.h" #include "../gmio_core/internal/byte_codec.h" diff --git a/src/gmio_stl/stl_global.h b/src/gmio_stl/stl_global.h index 1ac319a..3b8bfd5 100644 --- a/src/gmio_stl/stl_global.h +++ b/src/gmio_stl/stl_global.h @@ -80,10 +80,10 @@ * * * Infos on contents - * gmio_stl_infos_get()
- * gmio_stla_infos_get_streamsize() + * gmio_stl_infos_probe()
+ * gmio_stla_infos_probe_streamsize() * gmio_stl_infos
- * gmio_stl_infos_get_options + * gmio_stl_infos_probe_options * * * Detect format diff --git a/src/gmio_stl/stl_infos.c b/src/gmio_stl/stl_infos.c index a302254..228addd 100644 --- a/src/gmio_stl/stl_infos.c +++ b/src/gmio_stl/stl_infos.c @@ -34,14 +34,14 @@ #include "../gmio_core/internal/helper_stream.h" #include "stl_error.h" #include "stl_format.h" -#include "internal/stla_infos_get.h" -#include "internal/stlb_infos_get.h" +#include "internal/stla_infos_probe.h" +#include "internal/stlb_infos_probe.h" -int gmio_stl_infos_get( +int gmio_stl_infos_probe( struct gmio_stl_infos* infos, struct gmio_stream* stream, unsigned flags, - const struct gmio_stl_infos_get_options* opts) + const struct gmio_stl_infos_probe_options* opts) { int error = GMIO_ERROR_OK; const struct gmio_streampos begin_streampos = gmio_streampos(stream, NULL); @@ -49,7 +49,7 @@ int gmio_stl_infos_get( gmio_memblock_helper(opts != NULL ? &opts->stream_memblock : NULL); enum gmio_stl_format format = opts != NULL ? opts->format_hint : GMIO_STL_FORMAT_UNKNOWN; - struct gmio_stl_infos_get_options ovrdn_opts = {0}; + struct gmio_stl_infos_probe_options ovrdn_opts = {0}; if (opts != NULL) ovrdn_opts = *opts; @@ -71,11 +71,11 @@ int gmio_stl_infos_get( /* Dispatch to the sub-function */ switch (format) { case GMIO_STL_FORMAT_ASCII: - error = gmio_stla_infos_get(infos, stream, flags, &ovrdn_opts); + error = gmio_stla_infos_probe(infos, stream, flags, &ovrdn_opts); break; case GMIO_STL_FORMAT_BINARY_LE: case GMIO_STL_FORMAT_BINARY_BE: - error = gmio_stlb_infos_get(infos, stream, flags, &ovrdn_opts); + error = gmio_stlb_infos_probe(infos, stream, flags, &ovrdn_opts); break; default: error = GMIO_STL_ERROR_UNKNOWN_FORMAT; @@ -88,13 +88,13 @@ label_end: return error; } -gmio_streamsize_t gmio_stla_infos_get_streamsize( +gmio_streamsize_t gmio_stla_infos_probe_streamsize( struct gmio_stream *stream, struct gmio_memblock *stream_memblock) { struct gmio_stl_infos infos = {0}; - struct gmio_stl_infos_get_options options = {0}; + struct gmio_stl_infos_probe_options options = {0}; options.stream_memblock = *stream_memblock; options.format_hint = GMIO_STL_FORMAT_ASCII; - gmio_stl_infos_get(&infos, stream, GMIO_STL_INFO_FLAG_SIZE, &options); + gmio_stl_infos_probe(&infos, stream, GMIO_STL_INFO_FLAG_SIZE, &options); return infos.size; } diff --git a/src/gmio_stl/stl_infos.h b/src/gmio_stl/stl_infos.h index c2f1df9..a258f61 100644 --- a/src/gmio_stl/stl_infos.h +++ b/src/gmio_stl/stl_infos.h @@ -42,7 +42,7 @@ #include "stlb_header.h" #include -/*! Informations retrieved by gmio_stl_infos_get() */ +/*! Informations retrieved by gmio_stl_infos_probe() */ struct gmio_stl_infos { /*! STL format of the input stream */ @@ -58,14 +58,14 @@ struct gmio_stl_infos /*! STL ascii only: name of the solid * - * The pointer has to be set before calling gmio_stl_infos_get() + * The pointer has to be set before calling gmio_stl_infos_probe() * \sa stla_solidname_maxlen */ char* stla_solidname; /*! STL ascii only: maximum length(capacity) of stla_solidname * - * The value has to be set before calling gmio_stl_infos_get() + * The value has to be set before calling gmio_stl_infos_probe() * \sa stla_solidname */ size_t stla_solidname_maxlen; @@ -100,8 +100,8 @@ enum gmio_stl_info_flag GMIO_STL_INFO_FLAG_ALL = 0xFFFF }; -/*! Options of function gmio_stl_infos_get() */ -struct gmio_stl_infos_get_options +/*! Options of function gmio_stl_infos_probe() */ +struct gmio_stl_infos_probe_options { /*! See gmio_stl_read_options::stream_memblock */ struct gmio_memblock stream_memblock; @@ -110,7 +110,7 @@ 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(in bytes) + /*! Restrict gmio_stl_infos_probe() to not read further this limit(in bytes) * * \warning Not yet supported */ @@ -133,15 +133,15 @@ GMIO_C_LINKAGE_BEGIN * * \return Error code (see gmio_core/error.h and stl_error.h) */ -GMIO_API int gmio_stl_infos_get( +GMIO_API int gmio_stl_infos_probe( struct gmio_stl_infos* infos, struct gmio_stream* stream, unsigned flags, - const struct gmio_stl_infos_get_options* options); + const struct gmio_stl_infos_probe_options* options); /*! 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 + * It is a facade over gmio_stl_infos_probe() 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 @@ -151,7 +151,7 @@ GMIO_API int gmio_stl_infos_get( * \pre stream != NULL * \pre stream_memblock != NULL */ -GMIO_API gmio_streamsize_t gmio_stla_infos_get_streamsize( +GMIO_API gmio_streamsize_t gmio_stla_infos_probe_streamsize( struct gmio_stream* stream, struct gmio_memblock* stream_memblock); diff --git a/src/gmio_stl/stl_io_options.h b/src/gmio_stl/stl_io_options.h index b69ee6f..423acf0 100644 --- a/src/gmio_stl/stl_io_options.h +++ b/src/gmio_stl/stl_io_options.h @@ -73,7 +73,7 @@ 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() + * \sa gmio_stla_infos_probe_streamsize() */ gmio_streamsize_t (*func_stla_get_streamsize)( struct gmio_stream* stream, diff --git a/tests/test_stl_infos.c b/tests/test_stl_infos.c index 438d1bf..c8343c4 100644 --- a/tests/test_stl_infos.c +++ b/tests/test_stl_infos.c @@ -51,7 +51,7 @@ static const char* __tstl__test_stl_infos( infos.stla_solidname = stla_solid_name; infos.stla_solidname_maxlen = sizeof(stla_solid_name) - 1; - error = gmio_stl_infos_get(&infos, &stream, GMIO_STL_INFO_FLAG_ALL, NULL); + error = gmio_stl_infos_probe(&infos, &stream, GMIO_STL_INFO_FLAG_ALL, NULL); if (testcase->expected_size == -1) expected_size = gmio_stream_size(&stream); diff --git a/tests/test_stl_io.c b/tests/test_stl_io.c index b95188a..845689d 100644 --- a/tests/test_stl_io.c +++ b/tests/test_stl_io.c @@ -333,7 +333,7 @@ static const char* __tstl__test_stl_read_multi_solid( struct gmio_stream stream = gmio_stream_stdio(infile); struct gmio_stl_read_options roptions = {0}; struct gmio_stl_mesh_creator null_creator = {0}; - roptions.func_stla_get_streamsize = gmio_stla_infos_get_streamsize; + roptions.func_stla_get_streamsize = gmio_stla_infos_probe_streamsize; while (gmio_no_error(error) && !gmio_stream_at_end(&stream)) { error = gmio_stl_read(&stream, &null_creator, &roptions); if (gmio_no_error(error)) @@ -435,8 +435,8 @@ static void generate_stlb_tests_models() struct gmio_stream istream = gmio_stream_stdio(infile); struct gmio_stream ostream = gmio_stream_stdio(outfile); struct gmio_stl_read_options ropts = {0}; - ropts.func_stla_get_streamsize = gmio_stla_infos_get_streamsize; - while (gmio_no_error(read_error) && !gmio_stream_at_end(&istream)) { + ropts.func_stla_get_streamsize = gmio_stla_infos_probe_streamsize; + while (gmio_no_error(read_error)) { struct gmio_stl_data data = {0}; struct gmio_stl_mesh_creator creator = gmio_stl_data_mesh_creator(&data); struct gmio_stl_mesh mesh = {0};