InChI
 
Loading...
Searching...
No Matches
ichi_io.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
42#ifndef _ICHI_IO_H_
43#define _ICHI_IO_H_
44
45
46/*
47 INCHI I/O (IOSTREAM MAINLY) OPERATIONS
48*/
49
50
51#include "mode.h"
52#ifndef COMPILE_ALL_CPP
53#ifdef __cplusplus
54extern "C" {
55#endif
56#endif
57
58
59 void inchi_ios_init( INCHI_IOSTREAM *ios, int io_type, FILE *f );
61 void inchi_ios_flush2( INCHI_IOSTREAM *ios, FILE *f2 );
66
67 int inchi_ios_gets( char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine );
68 int inchi_ios_getsTab( char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine );
69 int inchi_ios_getsTab1( char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine );
70
71 int inchi_ios_print( INCHI_IOSTREAM *ios, const char* lpszFormat, ... );
72 int inchi_ios_print_nodisplay( INCHI_IOSTREAM *ios, const char* lpszFormat, ... );
74 int push_to_winchi_text_window( INCHI_IOSTREAM * ios ); /*, const char* lpszFormat, ... ) */
75
76 /* Print to string buffer or to file+stderr */
77 int inchi_ios_eprint( INCHI_IOSTREAM *ios, const char* lpszFormat, ... );
78
79
80 /*
81 PLAIN FILE OPERATIONS
82 */
83
84 /* Print to file, echoing to stderr */
85 int inchi_fprintf( FILE* f, const char* lpszFormat, ... );
86 int inchi_print_nodisplay( FILE* f, const char* lpszFormat, ... );
87
88 char* inchi_fgetsLf( char* line, int line_len, INCHI_IOSTREAM* inp_stream );
89 int inchi_fgetsLfTab( char *szLine, int len, FILE *f );
90
91 char *inchi_sgets( char *s, int n, INCHI_IOSTREAM* ios );
92
93
94
95
96 /*
97 Support of simplistic print buffer (growing string)
98 */
99
100#define INCHI_STRBUF_INITIAL_SIZE 262144
101#define INCHI_STRBUF_SIZE_INCREMENT 262144
102#define INCHI_STRBUF_SMALLER_INITIAL_SIZE 1024
103#define INCHI_STRBUF_SMALLER_SIZE_INCREMENT 4096
104
105int inchi_strbuf_init( INCHI_IOS_STRING *buf, int start_size, int incr_size );
108int inchi_strbuf_printf( INCHI_IOS_STRING *buf, const char* lpszFormat, ... );
109int inchi_strbuf_printf_from( INCHI_IOS_STRING *buf, int npos, const char* lpszFormat, ... );
111int inchi_strbuf_update( INCHI_IOS_STRING *buf, int new_addition_size );
112int inchi_strbuf_getline( INCHI_IOS_STRING *buf, FILE *f, int crlf2lf, int preserve_lf );
113
114int inchi_strbuf_addline( INCHI_IOS_STRING *buf, INCHI_IOSTREAM *inp_stream, int crlf2lf, int preserve_lf );
115
116void print_sequence_of_nums_compressing_ranges( int n, int *num, INCHI_IOS_STRING *strbuf );
117
118int _inchi_trace( char *format, ... );
119
120int Output_RecordInfo( INCHI_IOSTREAM *out_file,
121 int num_input_struct,
122 int bNoStructLabels,
123 const char *szSdfLabel,
124 const char *szSdfValue,
125 unsigned long lSdfId,
126 char *pLF,
127 char *pTAB);
128
129
130#if ( defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER) )
131#define ITRACE_ _inchi_trace
132#else
133#define ITRACE_ 0 && _inchi_trace
134#endif
135
136#ifndef COMPILE_ALL_CPP
137#ifdef __cplusplus
138}
139#endif
140#endif
141
142
143#endif /* _ICHI_IO_H_ */
int inchi_strbuf_addline(INCHI_IOS_STRING *buf, INCHI_IOSTREAM *inp_stream, int crlf2lf, int preserve_lf)
Definition ichi_io.c:1634
void print_sequence_of_nums_compressing_ranges(int n, int *num, INCHI_IOS_STRING *strbuf)
Definition ichiprt2.c:2299
int inchi_strbuf_create_copy(INCHI_IOS_STRING *buf2, INCHI_IOS_STRING *buf)
Definition ichi_io.c:1437
int inchi_fgetsLfTab(char *szLine, int len, FILE *f)
Definition ichi_io.c:892
int inchi_ios_print(INCHI_IOSTREAM *ios, const char *lpszFormat,...)
Definition ichi_io.c:477
int inchi_strbuf_update(INCHI_IOS_STRING *buf, int new_addition_size)
Definition ichi_io.c:1458
int Output_RecordInfo(INCHI_IOSTREAM *out_file, int num_input_struct, int bNoStructLabels, const char *szSdfLabel, const char *szSdfValue, unsigned long lSdfId, char *pLF, char *pTAB)
Definition ichi_io.c:1708
int inchi_ios_getsTab(char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine)
Definition ichi_io.c:420
int inchi_ios_create_copy(INCHI_IOSTREAM *ios, INCHI_IOSTREAM *ios0)
Definition ichi_io.c:106
int inchi_strbuf_printf_from(INCHI_IOS_STRING *buf, int npos, const char *lpszFormat,...)
Definition ichi_io.c:1543
void inchi_ios_close(INCHI_IOSTREAM *ios)
Definition ichi_io.c:229
int inchi_strbuf_printf(INCHI_IOS_STRING *buf, const char *lpszFormat,...)
Definition ichi_io.c:1506
int _inchi_trace(char *format,...)
Definition ichi_io.c:1698
void inchi_ios_init(INCHI_IOSTREAM *ios, int io_type, FILE *f)
Definition ichi_io.c:85
int inchi_ios_gets(char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine)
Definition ichi_io.c:386
int inchi_print_nodisplay(FILE *f, const char *lpszFormat,...)
Definition ichi_io.c:867
int inchi_strbuf_init(INCHI_IOS_STRING *buf, int start_size, int incr_size)
Definition ichi_io.c:1369
char * inchi_fgetsLf(char *line, int line_len, INCHI_IOSTREAM *inp_stream)
Definition ichi_io.c:995
int inchi_ios_getsTab1(char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine)
Definition ichi_io.c:451
int inchi_strbuf_getline(INCHI_IOS_STRING *buf, FILE *f, int crlf2lf, int preserve_lf)
Definition ichi_io.c:1583
void inchi_strbuf_reset(INCHI_IOS_STRING *buf)
Definition ichi_io.c:1402
int inchi_ios_print_nodisplay(INCHI_IOSTREAM *ios, const char *lpszFormat,...)
Definition ichi_io.c:604
void inchi_ios_flush2(INCHI_IOSTREAM *ios, FILE *f2)
Definition ichi_io.c:183
int inchi_ios_flush_not_displayed(INCHI_IOSTREAM *ios)
Definition ichi_io.c:679
int inchi_fprintf(FILE *f, const char *lpszFormat,...)
Definition ichi_io.c:800
void inchi_strbuf_close(INCHI_IOS_STRING *buf)
Definition ichi_io.c:1421
void inchi_ios_flush(INCHI_IOSTREAM *ios)
Definition ichi_io.c:144
void inchi_ios_free_str(INCHI_IOSTREAM *ios)
Definition ichi_io.c:272
int push_to_winchi_text_window(INCHI_IOSTREAM *ios)
Definition ichi_io.c:576
int inchi_ios_eprint(INCHI_IOSTREAM *ios, const char *lpszFormat,...)
Definition ichi_io.c:708
char * inchi_sgets(char *s, int n, INCHI_IOSTREAM *ios)
Definition ichi_io.c:1321
void inchi_ios_reset(INCHI_IOSTREAM *ios)
Definition ichi_io.c:255
Definition mode.h:1030
Definition mode.h:1016