2022-11-15 23:49:51 +00:00
|
|
|
/*
|
|
|
|
* Brickworks
|
|
|
|
*
|
|
|
|
* Copyright (C) 2022 Orastron Srl unipersonale
|
|
|
|
*
|
|
|
|
* Brickworks is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3 of the License.
|
|
|
|
*
|
|
|
|
* Brickworks 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
*
|
|
|
|
* File author: Stefano D'Angelo
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* module_type {{{ foundation }}}
|
|
|
|
* version {{{ 0.1.0 }}}
|
|
|
|
* requires {{{ bw_config }}}
|
|
|
|
* description {{{
|
|
|
|
* A common header to make sure that a bunch of basic definitions are
|
|
|
|
* available and consistent for all Brickworks modules.
|
|
|
|
* }}}
|
|
|
|
* changelog {{{
|
|
|
|
* <ul>
|
2022-11-22 14:28:16 +00:00
|
|
|
* <li>Version <strong>0.2.0</strong>:
|
|
|
|
* <ul>
|
|
|
|
* <li>Removed BW_MALLOC, BW_REALLOC, and BW_FREE.</li>
|
2022-11-23 09:54:48 +00:00
|
|
|
* <li>Added BW_RESTRICT.</li>
|
2022-11-22 14:28:16 +00:00
|
|
|
* </ul>
|
|
|
|
* </li>
|
2022-11-15 23:49:51 +00:00
|
|
|
* <li>Version <strong>0.1.0</strong>:
|
|
|
|
* <ul>
|
|
|
|
* <li>First release.</li>
|
|
|
|
* </ul>
|
|
|
|
* </li>
|
|
|
|
* </ul>
|
|
|
|
* }}}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BW_COMMON_H
|
|
|
|
#define _BW_COMMON_H
|
|
|
|
|
|
|
|
/*! api {{{
|
|
|
|
* #### bw_config
|
|
|
|
* At its very beginning, this header `#include`s `<bw_config.h>`, which is
|
|
|
|
* a file you can use to supply custom `#include`s and `#define`s that
|
|
|
|
* override defaults (see [bw_config](bw_config)).
|
|
|
|
*
|
|
|
|
* Alternatively, your compiler probably allows you to specify definitions on
|
|
|
|
* the command line.
|
|
|
|
* >>> */
|
|
|
|
#include <bw_config.h>
|
|
|
|
|
|
|
|
/*! ...
|
|
|
|
* #### NULL
|
|
|
|
* If `NULL` is not defined, then `stddef.h` is `#include`d.
|
|
|
|
* >>> */
|
|
|
|
#ifndef NULL
|
|
|
|
# include <stddef.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*! ...
|
|
|
|
* #### Exact-width integer types
|
|
|
|
* If <code class="hljs">(u)int{8,16,32,64}_t</code>,
|
|
|
|
* `INT{8,16,32,64}_{MIN,MAX}`, and `UINT{8,16,32,64}_MAX` are not defined,
|
|
|
|
* then `stdint.h` is `#include`d (actually, only testing against
|
|
|
|
* `INT32_MAX` but expecting the others to be finally defined).
|
|
|
|
* >>> */
|
|
|
|
#ifndef INT32_MAX
|
|
|
|
# include <stdint.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*! ...
|
|
|
|
* #### INFINITY
|
|
|
|
* If `INFINITY` is not defined, then `math.h` is `#include`d.
|
|
|
|
* >>> */
|
|
|
|
#ifndef INFINITY
|
|
|
|
# include <math.h>
|
|
|
|
#endif
|
|
|
|
|
2022-11-23 09:54:48 +00:00
|
|
|
#ifndef BW_RESTRICT
|
|
|
|
# if defined(__STDC__) && (__STDC_VERSION__ >= 199901L)
|
|
|
|
# define BW_RESTRICT restrict
|
|
|
|
# else
|
|
|
|
# define BW_RESTRICT
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2022-11-15 23:49:51 +00:00
|
|
|
/*! ... }}} */
|
|
|
|
|
|
|
|
#endif
|