InChI
 
Loading...
Searching...
No Matches
bcf_s.h
Go to the documentation of this file.
1/*
2 * International Chemical Identifier (InChI)
3 * Version 1
4 * Software version 1.07
5 * April 30, 2024
6 *
7 * MIT License
8 *
9 * Copyright (c) 2024 IUPAC and InChI Trust
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in all
19 * copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * SOFTWARE.
28*
29* The InChI library and programs are free software developed under the
30 * auspices of the International Union of Pure and Applied Chemistry (IUPAC).
31 * Originally developed at NIST.
32 * Modifications and additions by IUPAC and the InChI Trust.
33 * Some portions of code were developed/changed by external contributors
34 * (either contractor or volunteer) which are listed in the file
35 * 'External-contributors' included in this distribution.
36 *
37 * info@inchi-trust.org
38 *
39*/
40
41/* djb-rwth: bounds-checking functions / C11 Annex K */
42
43/* djb-rwth: adding guard idiom instead of #pragma once for code portabilty */
44#ifndef BCF_S_H
45#define BCF_S_H
46
47#include <stdio.h>
48#include <stdlib.h>
49#include <string.h>
50#include <errno.h>
51
52#define CURRENT_VER "1.07.5" /* djb-rwth: full version number in the output, required for fixing GHI #61 */
53
54#ifdef __STDC_LIB_EXT1__
55#if (__STDC_LIB_EXT1__ >= 201112L)
56#define USE_BCF_GCC 1 /* djb-rwth: use bounds-checking functions / C11 Annex K */
57#define __STDC_WANT_LIB_EXT1__ 1 /* Want the ext1 functions */
58#endif
59#endif
60
61#ifdef __STDC_SECURE_LIB__
62#define USE_BCF_MS 1 /* djb-rwth: use bounds-checking functions / C11 Annex K */
63#endif
64
65#if (USE_BCF_GCC || USE_BCF_MS)
66/* djb-rwth: change the following parameter to 1 (or other unsigned integer) to use bounds-checking functions */
67#define USE_BCF 0
68#endif
69
70/* djb-rwth: control macros */
71#define RINCHI_TEST 0 /* djb-rwrh: RInChI testing */
72/* #define GHI100_FIX */ /* djb-rwth: enabling any of the three GHI #100 fixes defined by SPRINTF_FLAG macro */
73#define SPRINTF_FLAG 2 /* djb-rwth: 1 - stb_(v)s(n)pritnf, 2 - custom double to 2*int; any other value (different from 1 or 2) - standard sprintf w/ setlocale */
74
75/* djb-rwth: custom functions */
76int max_3(int a, int b, int c);
77int memcpy_custom(char** dst, char* src, unsigned long long len);
78int dbl2int(char* str, int fwidth, int ndecpl, char dbl_flag, double dblinp);
79
80#endif
int max_3(int a, int b, int c)
Definition bcf_s.c:58
int dbl2int(char *str, int fwidth, int ndecpl, char dbl_flag, double dblinp)
Definition bcf_s.c:92
int memcpy_custom(char **dst, char *src, unsigned long long len)
Definition bcf_s.c:68