generic.c File Reference
Detailed Description
Definition in file generic.c.
#include "generic.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <Windows.h>
Go to the source code of this file.
Functions | |
VL_EXPORT char const * | vl_get_version_string () |
Get version string. | |
VL_EXPORT void | vl_print_info () |
Print information about the library. | |
static int | do_nothing_printf (char const *format,...) |
A printf that does not do anything. | |
VL_EXPORT void | vl_set_alloc_func (void *(*malloc_func)(size_t), void *(*realloc_func)(void *, size_t), void *(*calloc_func)(size_t, size_t), void(*free_func)(void *)) |
Set memory allocation functions. | |
VL_EXPORT void | vl_set_printf_func (printf_func_t printf_func) |
Set printf function. | |
void | vl_tic () |
Set time reference. | |
double | vl_toc () |
Get time since reference. | |
Variables | |
VL_EXPORT int | vl_err_no = 0 |
The number of the last error. | |
VL_EXPORT char | vl_err_msg [VL_ERR_MSG_LEN+1] = "" |
The description of the last error. | |
void *(* | vl_malloc_func )(size_t) = &malloc |
Customizable malloc function pointer. | |
void *(* | vl_realloc_func )(void *, size_t) = &realloc |
Customizable realloc function pointer. | |
void *(* | vl_calloc_func )(size_t, size_t) = &calloc |
Customizable calloc function pointer. | |
void(* | vl_free_func )(void *) = &free |
Customizable free function pointer. | |
int(* | vl_printf_func )(char const *,...) = printf |
Customizable printf function pointer. |
Function Documentation
static int do_nothing_printf | ( | char const * | format, | |
... | ||||
) | [static] |
For internal use only.
Definition at line 270 of file generic.c.
Referenced by vl_set_printf_func().
VL_EXPORT char const* vl_get_version_string | ( | ) |
- Returns:
- library version string
Definition at line 251 of file generic.c.
References VL_VERSION_STRING.
Referenced by vl_print_info().
VL_EXPORT void vl_print_info | ( | ) |
- Returns:
- library version string
Definition at line 262 of file generic.c.
References vl_get_version_string(), vl_print_host_info(), and VL_PRINTF.
VL_EXPORT void vl_set_alloc_func | ( | void *(*)(size_t) | malloc_func, | |
void *(*)(void *, size_t) | realloc_func, | |||
void *(*)(size_t, size_t) | calloc_func, | |||
void(*)(void *) | free_func | |||
) |
- Parameters:
-
malloc_func pointer to malloc
.realloc_func pointer to realloc
.calloc_func pointer to calloc
.free_func pointer to free
.
Definition at line 340 of file generic.c.
References vl_calloc_func, vl_free_func, vl_malloc_func, and vl_realloc_func.
VL_EXPORT void vl_set_printf_func | ( | printf_func_t | printf_func | ) |
- Parameters:
-
printf_func pointer to printf
. Letprint_func
be NULL to disable printf.
Definition at line 353 of file generic.c.
References do_nothing_printf(), and vl_printf_func.
double vl_toc | ( | ) |
Returns the processor time elapsed since vl_tic() was called.
- Remarks:
- On UNIX, this function uses the
clock()
system call. On Windows, it uses theQueryPerformanceCounter()
system call, which is more accurate thanclock()
on this platform.
- Returns:
- time in seconds.
Variable Documentation
void*(* vl_calloc_func)(size_t, size_t) = &calloc |
void(* vl_free_func)(void *) = &free |
void*(* vl_malloc_func)(size_t) = &malloc |
int(* vl_printf_func)(char const *,...) = printf |
void*(* vl_realloc_func)(void *, size_t) = &realloc |