gmio_stl: rename functions/structs in stl_infos.h (_get -> _probe)

Rename :
  * Func gmio_stl_infos_get() -> gmio_stl_infos_probe()
  * Func gmio_stla_infos_get_streamsize() -> gmio_stla_infos_probe_streamsize()
  * Struct gmio_stl_infos_get_options -> gmio_stl_infos_probe_options

GitHub issue #3
This commit is contained in:
Hugues Delorme 2016-07-13 11:46:28 +02:00
parent 4fe5eaad99
commit 941a015bfb
14 changed files with 58 additions and 58 deletions

View File

@ -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}
};

View File

@ -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)

View File

@ -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% */

View File

@ -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;

View File

@ -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 */

View File

@ -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 =

View File

@ -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 */

View File

@ -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"

View File

@ -80,10 +80,10 @@
* </tr>
* <tr>
* <td>Infos on contents</td>
* <td>gmio_stl_infos_get()<br/>
* gmio_stla_infos_get_streamsize()</td>
* <td>gmio_stl_infos_probe()<br/>
* gmio_stla_infos_probe_streamsize()</td>
* <td>gmio_stl_infos<br/>
* gmio_stl_infos_get_options</td>
* gmio_stl_infos_probe_options</td>
* </tr>
* <tr>
* <td>Detect format</td>

View File

@ -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;
}

View File

@ -42,7 +42,7 @@
#include "stlb_header.h"
#include <stddef.h>
/*! 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 <tt> stream != NULL </tt>
* \pre <tt> stream_memblock != NULL </tt>
*/
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);

View File

@ -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,

View File

@ -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);

View File

@ -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};