cake
/
libcasio
Archived
1
1
Fork 0
This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
libcasio/include/libcasio/misc.h

82 lines
2.8 KiB
C

/* ****************************************************************************
* libcasio/misc.h -- libcasio miscallaneous utilities.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libcasio.
* libcasio is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libcasio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libcasio; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************* */
#ifndef LIBCASIO_MISC_H
# define LIBCASIO_MISC_H 2018051601
# include "cdefs.h"
# include "stream.h"
# include "fs.h"
CASIO_BEGIN_NAMESPACE
CASIO_BEGIN_DECLS
/* As there is no portable sleep function, libcasio implements one.
* It takes a callback, of the following form: */
CASIO_EXTERN int CASIO_EXPORT casio_sleep
OF((unsigned long casio__ms));
/* If the default function is not good enough for you, just change it
* using the following function. */
typedef void casio_sleep_t OF((unsigned long casio__ms));
CASIO_EXTERN void CASIO_EXPORT casio_set_sleep_func
OF((casio_sleep_t *casio__func));
/* As for time and timeouts management, here are functions to time
* anything in libcasio. Times are expressed in milliseconds. */
struct casio_timer_s;
typedef struct casio_timer_s casio_timer_t;
CASIO_EXTERN int CASIO_EXPORT casio_get_timer
OF((casio_timer_t **casio__timer));
CASIO_EXTERN void CASIO_EXPORT casio_free_timer
OF((casio_timer_t *casio__timer));
CASIO_EXTERN int CASIO_EXPORT casio_get_spent_time
OF((casio_timer_t *casio__timer, unsigned long *casio__spent));
/* You can change these functions too! */
typedef int CASIO_EXPORT casio_get_timer_t
OF((casio_timer_t **casio__timer));
typedef void CASIO_EXPORT casio_free_timer_t
OF((casio_timer_t *casio__timer));
typedef int CASIO_EXPORT casio_get_spent_time_t
OF((casio_timer_t *casio__timer, unsigned long *casio__spent));
CASIO_EXTERN int CASIO_EXPORT casio_set_timer_funcs
OF((casio_get_timer_t *casio__get_timer,
casio_free_timer_t *casio__free_timer,
casio_get_spent_time_t *casio__get_spent_time));
/* And here are cross-platform allocation functions.
* They are defined just in case. */
CASIO_EXTERN void* CASIO_EXPORT casio_alloc
OF((size_t casio__num_elements, size_t casio__element_size));
CASIO_EXTERN void CASIO_EXPORT casio_free
OF((void *casio__ptr));
CASIO_END_DECLS
CASIO_END_NAMESPACE
#endif /* LIBCASIO_MISC_H */