InChI
 
Loading...
Searching...
No Matches
ichi_io.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: MIT
3 * Copyright (c) 2024 IUPAC and InChI Trust
4 */
5
6
7#ifndef _ICHI_IO_H_
8#define _ICHI_IO_H_
9
10
11/*
12 INCHI I/O (IOSTREAM MAINLY) OPERATIONS
13*/
14
15
16#include "mode.h"
17#ifndef COMPILE_ALL_CPP
18#ifdef __cplusplus
19extern "C" {
20#endif
21#endif
22
23
24 void inchi_ios_init( INCHI_IOSTREAM *ios, int io_type, FILE *f );
26 void inchi_ios_flush2( INCHI_IOSTREAM *ios, FILE *f2 );
31
32 int inchi_ios_gets( char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine );
33 int inchi_ios_getsTab( char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine );
34 int inchi_ios_getsTab1( char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine );
35
36 int inchi_ios_print( INCHI_IOSTREAM *ios, const char* lpszFormat, ... );
37 int inchi_ios_print_nodisplay( INCHI_IOSTREAM *ios, const char* lpszFormat, ... );
39 int push_to_winchi_text_window( INCHI_IOSTREAM * ios ); /*, const char* lpszFormat, ... ) */
40
41 /* Print to string buffer or to file+stderr */
42 int inchi_ios_eprint( INCHI_IOSTREAM *ios, const char* lpszFormat, ... );
43
44
45 /*
46 PLAIN FILE OPERATIONS
47 */
48
49 /* Print to file, echoing to stderr */
50 int inchi_fprintf( FILE* f, const char* lpszFormat, ... );
51 int inchi_print_nodisplay( FILE* f, const char* lpszFormat, ... );
52
53 char* inchi_fgetsLf( char* line, int line_len, INCHI_IOSTREAM* inp_stream );
54 int inchi_fgetsLfTab( char *szLine, int len, FILE *f );
55
56 char *inchi_sgets( char *s, int n, INCHI_IOSTREAM* ios );
57
58
59
60
61 /*
62 Support of simplistic print buffer (growing string)
63 */
64
65#define INCHI_STRBUF_INITIAL_SIZE 262144
66#define INCHI_STRBUF_SIZE_INCREMENT 262144
67#define INCHI_STRBUF_SMALLER_INITIAL_SIZE 1024
68#define INCHI_STRBUF_SMALLER_SIZE_INCREMENT 4096
69
70int inchi_strbuf_init( INCHI_IOS_STRING *buf, int start_size, int incr_size );
73int inchi_strbuf_printf( INCHI_IOS_STRING *buf, const char* lpszFormat, ... );
74int inchi_strbuf_printf_from( INCHI_IOS_STRING *buf, int npos, const char* lpszFormat, ... );
76int inchi_strbuf_update( INCHI_IOS_STRING *buf, int new_addition_size );
77int inchi_strbuf_getline( INCHI_IOS_STRING *buf, FILE *f, int crlf2lf, int preserve_lf );
78
79int inchi_strbuf_addline( INCHI_IOS_STRING *buf, INCHI_IOSTREAM *inp_stream, int crlf2lf, int preserve_lf );
80
81void print_sequence_of_nums_compressing_ranges( int n, int *num, INCHI_IOS_STRING *strbuf );
82
83int _inchi_trace( const char *format, ... );
84
86 int num_input_struct,
87 int bNoStructLabels,
88 const char *szSdfLabel,
89 const char *szSdfValue,
90 unsigned long lSdfId,
91 char *pLF,
92 char *pTAB);
93
94
95#if ( defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER) )
96#define ITRACE_ _inchi_trace
97#else
98#define ITRACE_ 0 && _inchi_trace
99#endif
100
101#ifndef COMPILE_ALL_CPP
102#ifdef __cplusplus
103}
104#endif
105#endif
106
107
108#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:1638
void print_sequence_of_nums_compressing_ranges(int n, int *num, INCHI_IOS_STRING *strbuf)
Definition ichiprt2.c:2659
int inchi_strbuf_create_copy(INCHI_IOS_STRING *buf2, INCHI_IOS_STRING *buf)
Definition ichi_io.c:1441
int inchi_fgetsLfTab(char *szLine, int len, FILE *f)
Definition ichi_io.c:896
int inchi_ios_print(INCHI_IOSTREAM *ios, const char *lpszFormat,...)
Definition ichi_io.c:442
int inchi_strbuf_update(INCHI_IOS_STRING *buf, int new_addition_size)
Definition ichi_io.c:1462
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:1712
int inchi_ios_getsTab(char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine)
Definition ichi_io.c:385
int inchi_ios_create_copy(INCHI_IOSTREAM *ios, INCHI_IOSTREAM *ios0)
Definition ichi_io.c:71
int inchi_strbuf_printf_from(INCHI_IOS_STRING *buf, int npos, const char *lpszFormat,...)
Definition ichi_io.c:1547
void inchi_ios_close(INCHI_IOSTREAM *ios)
Definition ichi_io.c:194
int inchi_strbuf_printf(INCHI_IOS_STRING *buf, const char *lpszFormat,...)
Definition ichi_io.c:1510
void inchi_ios_init(INCHI_IOSTREAM *ios, int io_type, FILE *f)
Definition ichi_io.c:50
int inchi_ios_gets(char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine)
Definition ichi_io.c:351
int inchi_print_nodisplay(FILE *f, const char *lpszFormat,...)
Definition ichi_io.c:870
int inchi_strbuf_init(INCHI_IOS_STRING *buf, int start_size, int incr_size)
Definition ichi_io.c:1373
int _inchi_trace(const char *format,...)
Definition ichi_io.c:1702
char * inchi_fgetsLf(char *line, int line_len, INCHI_IOSTREAM *inp_stream)
Definition ichi_io.c:999
int inchi_ios_getsTab1(char *szLine, int len, INCHI_IOSTREAM *ios, int *bTooLongLine)
Definition ichi_io.c:416
int inchi_strbuf_getline(INCHI_IOS_STRING *buf, FILE *f, int crlf2lf, int preserve_lf)
Definition ichi_io.c:1587
void inchi_strbuf_reset(INCHI_IOS_STRING *buf)
Definition ichi_io.c:1406
int inchi_ios_print_nodisplay(INCHI_IOSTREAM *ios, const char *lpszFormat,...)
Definition ichi_io.c:569
void inchi_ios_flush2(INCHI_IOSTREAM *ios, FILE *f2)
Definition ichi_io.c:148
int inchi_ios_flush_not_displayed(INCHI_IOSTREAM *ios)
Definition ichi_io.c:682
int inchi_fprintf(FILE *f, const char *lpszFormat,...)
Definition ichi_io.c:803
void inchi_strbuf_close(INCHI_IOS_STRING *buf)
Definition ichi_io.c:1425
void inchi_ios_flush(INCHI_IOSTREAM *ios)
Definition ichi_io.c:109
void inchi_ios_free_str(INCHI_IOSTREAM *ios)
Definition ichi_io.c:237
int push_to_winchi_text_window(INCHI_IOSTREAM *ios)
Definition ichi_io.c:541
int inchi_ios_eprint(INCHI_IOSTREAM *ios, const char *lpszFormat,...)
Definition ichi_io.c:711
char * inchi_sgets(char *s, int n, INCHI_IOSTREAM *ios)
Definition ichi_io.c:1325
void inchi_ios_reset(INCHI_IOSTREAM *ios)
Definition ichi_io.c:220
Definition mode.h:999
Definition mode.h:985