2
* International Chemical Identifier (InChI)
4
* Software version 1.04
7
* The InChI library and programs are free software developed under the
8
* auspices of the International Union of Pure and Applied Chemistry (IUPAC).
9
* Originally developed at NIST. Modifications and additions by IUPAC
10
* and the InChI Trust.
12
* IUPAC/InChI-Trust Licence for the International Chemical Identifier (InChI)
13
* Software version 1.0.
14
* Copyright (C) IUPAC and InChI Trust Limited
16
* This library is free software; you can redistribute it and/or modify it under the
17
* terms of the IUPAC/InChI Trust Licence for the International Chemical Identifier
18
* (InChI) Software version 1.0; either version 1.0 of the License, or
19
* (at your option) any later version.
21
* This library is distributed in the hope that it will be useful,
22
* but WITHOUT ANY WARRANTY; without even the implied warranty of
23
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
24
* See the IUPAC/InChI Trust Licence for the International Chemical Identifier (InChI)
25
* Software version 1.0 for more details.
27
* You should have received a copy of the IUPAC/InChI Trust Licence for the
28
* International Chemical Identifier (InChI) Software version 1.0 along with
29
* this library; if not, write to:
32
* c/o FIZ CHEMIE Berlin
50
#ifndef INCHI_ADD_STR_LEN
51
#define INCHI_ADD_STR_LEN 32768
55
#ifdef TARGET_LIB_FOR_WINCHI
56
extern void (*FWPRINT) (const char * format, va_list argptr );
60
/*^^^ Internal functions */
62
int inchi_ios_str_getc( INCHI_IOSTREAM *ios );
63
char *inchi_ios_str_gets( char *szLine, int len, INCHI_IOSTREAM *ios );
64
char *inchi_ios_str_getsTab( char *szLine, int len, INCHI_IOSTREAM *ios );
65
int GetMaxPrintfLength( const char *lpszFormat, va_list argList);
66
char *inchi_fgetsTab( char *szLine, int len, FILE *f );
67
int inchi_vfprintf( FILE* f, const char* lpszFormat, va_list argList );
69
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72
INCHI_IOSTREAM OPERATIONS
75
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
78
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
81
void inchi_ios_init(INCHI_IOSTREAM* ios, int io_type, FILE *f)
83
memset( ios, 0, sizeof(*ios) );
86
case INCHI_IOSTREAM_FILE: ios->type = INCHI_IOSTREAM_FILE;
88
case INCHI_IOSTREAM_STRING:
89
default: ios->type = INCHI_IOSTREAM_STRING;
98
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
99
If INCHI_IOSTREAM type is INCHI_IOSTREAM_STRING,
100
flush INCHI_IOSTREAM string buffer to file (if non-NULL); then free buffer.
101
If INCHI_IOSTREAM type is INCHI_IOSTREAM_FILE, just flush the file.
102
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
103
void inchi_ios_flush(INCHI_IOSTREAM* ios)
106
if (ios->type == INCHI_IOSTREAM_STRING)
110
if (ios->s.nUsedLength > 0)
114
fprintf(ios->f,"%-s", ios->s.pStr);
117
inchi_free(ios->s.pStr );
119
ios->s.nUsedLength = ios->s.nAllocatedLength = ios->s.nPtr = 0;
124
else if (ios->type == INCHI_IOSTREAM_FILE)
126
/* output to plain file: just flush it. */
135
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136
If INCHI_IOSTREAM type is INCHI_IOSTREAM_STRING,
137
flush INCHI_IOSTREAM string buffer to file (if non-NULL) and
138
another file f2 supplied as parameter (typically, it will be stderr); then free buffer.
139
If INCHI_IOSTREAM type is INCHI_IOSTREAM_FILE, just flush the both files.
140
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
141
void inchi_ios_flush2(INCHI_IOSTREAM* ios, FILE *f2)
144
if (ios->type == INCHI_IOSTREAM_STRING)
148
if (ios->s.nUsedLength > 0)
152
fprintf(ios->f,"%-s", ios->s.pStr);
156
fprintf(f2,"%-s", ios->s.pStr);
158
inchi_free(ios->s.pStr );
160
ios->s.nUsedLength = ios->s.nAllocatedLength = ios->s.nPtr = 0;
165
else if (ios->type == INCHI_IOSTREAM_FILE)
167
/* output to plain file: just flush it. */
168
if ( (ios->f) && (ios->f!=stderr) && (ios->f!=stdout) )
170
if ( f2 && f2!=stderr && f2!=stdout)
181
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
182
Close INCHI_IOSTREAM: free string buffer and close the file.
183
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
184
void inchi_ios_close(INCHI_IOSTREAM* ios)
187
inchi_free(ios->s.pStr);
189
ios->s.nUsedLength = ios->s.nAllocatedLength = ios->s.nPtr = 0;
190
if ( (ios->f) && (ios->f!=stderr) && (ios->f!=stdout) && (ios->f!=stdin))
197
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
198
Reset INCHI_IOSTREAM: set string buffer ptr to NULL (but do _not_ free memory)and close the file.
199
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
200
void inchi_ios_reset(INCHI_IOSTREAM* ios)
203
ios->s.nUsedLength = ios->s.nAllocatedLength = ios->s.nPtr = 0;
204
if ( (ios->f) && (ios->f!=stderr) && (ios->f!=stdout) && (ios->f!=stdin))
213
/*******************************************************************/
214
int inchi_ios_str_getc(INCHI_IOSTREAM *ios)
217
if (ios->type==INCHI_IOSTREAM_STRING)
219
if ( ios->s.nPtr < ios->s.nUsedLength )
221
return (int)ios->s.pStr[ios->s.nPtr++];
226
else if (ios->type==INCHI_IOSTREAM_FILE)
228
return fgetc( ios->f );
237
/*******************************************************************/
238
char *inchi_ios_str_gets(char *szLine, int len, INCHI_IOSTREAM *f)
245
while ( length < len && EOF != (c = inchi_ios_str_getc( f )) )
247
szLine[length++] = (char)c;
251
if ( !length && EOF == c )
255
szLine[length] = '\0';
261
/********************************************************************************/
262
/* read up to len or tab or LF; if empty read next until finds non-empty line */
263
/* remove leading and trailing white spaces; keep zero termination */
264
/********************************************************************************/
265
char *inchi_ios_str_getsTab( char *szLine, int len, INCHI_IOSTREAM *f )
272
while ( length < len && EOF != (c = inchi_ios_str_getc(f)) )
276
szLine[length++] = (char)c;
280
if ( !length && EOF == c )
284
szLine[length] = '\0';
289
/*******************************************************************/
290
int inchi_ios_gets( char *szLine, int len, INCHI_IOSTREAM *f, int *bTooLongLine )
296
p = inchi_ios_str_gets( szLine, len-1, f );
300
return -1; /* end of file or cannot read */
302
szLine[len-1] = '\0';
304
*bTooLongLine = !strchr( szLine, '\n' );
306
p = strchr( szLine, '\n' );
307
*bTooLongLine = ( !p && ((int)strlen(szLine)) == len-2 );
308
LtrimRtrim( szLine, &length );
315
/*******************************************************************/
316
/* read up to len or tab or LF; if empty read next until finds non-empty line */
317
/* remove leading and trailing white spaces; keep zero termination */
318
/*******************************************************************/
319
int inchi_ios_getsTab( char *szLine, int len, INCHI_IOSTREAM *f, int *bTooLongLine )
325
p = inchi_ios_str_getsTab( szLine, len-1, f );
329
return -1; /* end of file or cannot read */
331
szLine[len-1] = '\0';
333
*bTooLongLine = !strchr( szLine, '\n' );
335
p = strchr( szLine, '\n' );
336
*bTooLongLine = ( !p && ((int)strlen(szLine)) == len-2 );
337
LtrimRtrim( szLine, &length );
342
/*******************************************************************/
343
int inchi_ios_getsTab1( char *szLine, int len, INCHI_IOSTREAM *f, int *bTooLongLine )
348
p = inchi_ios_str_getsTab( szLine, len-1, f );
352
return -1; /* end of file or cannot read */
354
szLine[len-1] = '\0';
356
*bTooLongLine = !strchr( szLine, '\n' );
358
p = strchr( szLine, '\n' );
359
*bTooLongLine = ( !p && ((int)strlen(szLine)) == len-2 );
360
LtrimRtrim( szLine, &length );
361
/*} while ( !length );*/
370
/*****************************************************************/
371
int inchi_ios_print( INCHI_IOSTREAM * ios, const char* lpszFormat, ... )
379
if (ios->type == INCHI_IOSTREAM_STRING)
381
/* output to string buffer */
383
my_va_start( argList, lpszFormat );
384
max_len = GetMaxPrintfLength( lpszFormat, argList);
388
if ( ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len )
390
/* enlarge output string */
391
int nAddLength = inchi_max( INCHI_ADD_STR_LEN, max_len );
393
(char *)inchi_calloc( ios->s.nAllocatedLength + nAddLength, sizeof(new_str[0]) );
398
if ( ios->s.nUsedLength > 0 )
399
memcpy( new_str, ios->s.pStr, sizeof(new_str[0])* ios->s.nUsedLength );
400
inchi_free( ios->s.pStr );
402
ios->s.pStr = new_str;
403
ios->s.nAllocatedLength += nAddLength;
405
else return -1; /* failed */
408
my_va_start( argList, lpszFormat );
409
ret = vsprintf( ios->s.pStr + ios->s.nUsedLength, lpszFormat, argList );
412
ios->s.nUsedLength += ret;
413
#ifdef TARGET_LIB_FOR_WINCHI
416
my_va_start( argList, lpszFormat );
417
FWPRINT( lpszFormat, argList );
426
else if (ios->type == INCHI_IOSTREAM_FILE)
431
my_va_start( argList, lpszFormat );
432
ret = vfprintf( ios->f, lpszFormat, argList );
437
my_va_start( argList, lpszFormat );
438
ret2 = vfprintf( stdout, lpszFormat, argList );
441
#ifdef TARGET_LIB_FOR_WINCHI
444
my_va_start( argList, lpszFormat );
445
FWPRINT( lpszFormat, argList );
449
return ret? ret : ret2;
460
/**********************************************************************/
461
/* This function's output should not be displayed in the output pane */
462
/**********************************************************************/
463
int inchi_ios_print_nodisplay( INCHI_IOSTREAM * ios, const char* lpszFormat, ... )
470
if (ios->type == INCHI_IOSTREAM_STRING)
472
/* output to string buffer */
474
my_va_start( argList, lpszFormat );
475
max_len = GetMaxPrintfLength( lpszFormat, argList);
479
if ( ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len )
481
/* enlarge output string */
482
int nAddLength = inchi_max( INCHI_ADD_STR_LEN, max_len );
483
char *new_str = (char *)inchi_calloc( ios->s.nAllocatedLength + nAddLength, sizeof(new_str[0]) );
488
if ( ios->s.nUsedLength > 0 )
490
memcpy( new_str, ios->s.pStr, sizeof(new_str[0])*ios->s.nUsedLength );
492
inchi_free( ios->s.pStr );
494
ios->s.pStr = new_str;
495
ios->s.nAllocatedLength += nAddLength;
498
return -1; /* failed */
502
my_va_start( argList, lpszFormat );
503
ret = vsprintf( ios->s.pStr + ios->s.nUsedLength, lpszFormat, argList );
507
ios->s.nUsedLength += ret;
514
else if (ios->type == INCHI_IOSTREAM_FILE)
516
my_va_start( argList, lpszFormat );
517
inchi_print_nodisplay( ios->f, lpszFormat, argList);
528
/*****************************************************************/
529
/* Print to string buffer or to file+stderr */
530
int inchi_ios_eprint( INCHI_IOSTREAM * ios, const char* lpszFormat, ... )
538
if (ios->type == INCHI_IOSTREAM_STRING) /* was #if ( defined(TARGET_API_LIB) || defined(INCHI_STANDALONE_EXE) ) */
540
/* output to string buffer */
541
int max_len, nAddLength = 0;
542
char *new_str = NULL;
544
my_va_start( argList, lpszFormat );
545
max_len = GetMaxPrintfLength( lpszFormat, argList);
550
if ( ios->s.nAllocatedLength - ios->s.nUsedLength <= max_len )
552
/* enlarge output string */
553
nAddLength = inchi_max( INCHI_ADD_STR_LEN, max_len );
554
new_str = (char *)inchi_calloc( ios->s.nAllocatedLength + nAddLength, sizeof(new_str[0]) );
559
if ( ios->s.nUsedLength > 0 )
561
memcpy( new_str, ios->s.pStr, sizeof(new_str[0])* ios->s.nUsedLength );
563
inchi_free( ios->s.pStr );
565
ios->s.pStr = new_str;
566
ios->s.nAllocatedLength += nAddLength;
570
return -1; /* failed */
575
my_va_start( argList, lpszFormat );
576
ret = vsprintf( ios->s.pStr + ios->s.nUsedLength, lpszFormat, argList );
580
ios->s.nUsedLength += ret;
587
else if (ios->type == INCHI_IOSTREAM_FILE)
591
/* output to plain file */
592
my_va_start( argList, lpszFormat );
593
ret = inchi_vfprintf( ios->f, lpszFormat, argList );
595
/*^^^ No output to stderr from within dll or GUI program */
596
#if ( !defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI) )
597
if ( ios->f != stderr )
599
my_va_start( argList, lpszFormat );
600
ret2 = vfprintf( stderr, lpszFormat, argList );
604
return ret? ret : ret2;
615
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
618
PLAIN FILE OPERATIONS
621
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
625
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
627
/* Print to file, echoing to stderr */
628
int inchi_fprintf( FILE* f, const char* lpszFormat, ... )
634
my_va_start( argList, lpszFormat );
635
ret = inchi_vfprintf( f, lpszFormat, argList );
637
/*^^^ No output to stderr from within dll or GUI program */
638
#if ( !defined(TARGET_API_LIB) && !defined(TARGET_LIB_FOR_WINCHI) )
641
my_va_start( argList, lpszFormat );
642
ret2 = vfprintf( stderr, lpszFormat, argList );
646
return ret? ret : ret2;
653
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
656
int inchi_vfprintf( FILE* f, const char* lpszFormat, va_list argList )
659
if ( f == stderr && lpszFormat && lpszFormat[0] && '\r' == lpszFormat[strlen(lpszFormat)-1] )
661
#define CONSOLE_LINE_LEN 80
662
#ifndef COMPILE_ANSI_ONLY
663
char szLine[CONSOLE_LINE_LEN];
664
ret = _vsnprintf( szLine, CONSOLE_LINE_LEN-1, lpszFormat, argList );
667
/* output is longer than the console line */
668
/*^^^ Fixed bug: (CONSOLE_LINE_LEN-4) --> (CONSOLE_LINE_LEN-4-1) 11-22-08 IPl */
669
strcpy(szLine+CONSOLE_LINE_LEN-5, "...\r");
673
ret = vfprintf( f, lpszFormat, argList );
675
#undef CONSOLE_LINE_LEN
679
ret = vfprintf( f, lpszFormat, argList );
686
/**********************************************************************/
687
/* This function's output should not be displayed in the output pane */
688
/**********************************************************************/
689
int inchi_print_nodisplay( FILE* f, const char* lpszFormat, ... )
698
my_va_start( argList, lpszFormat );
699
ret = vfprintf( fi, lpszFormat, argList );
705
#if ( FIX_READ_LONG_LINE_BUG == 1 )
706
/********************************************************************/
707
int inchi_fgetsLfTab( char *szLine, int len, FILE *f )
712
int bTooLongLine = 0;
714
p = inchi_fgetsTab( szLine, len, f );
716
return -1; /* end of file or cannot read */
718
bTooLongLine = ( (int)strlen(szLine) == len-1 && szLine[len-2] != '\n' );
719
LtrimRtrim( szLine, &length );
721
if ( bTooLongLine ) {
722
while ( p = inchi_fgetsTab( szSkip, sizeof(szSkip)-1, f ) ) {
723
if ( strchr( szSkip, '\n' ) )
730
/********************************************************************/
731
int inchi_fgetsLfTab( char *szLine, int len, FILE *f )
736
int bTooLongLine = 0;
738
p = inchi_fgetsTab( szLine, len-1, f );
740
return -1; /* end of file or cannot read */
742
szLine[len-1] = '\0';
744
bTooLongLine = !strchr( szLine, '\n' );
746
bTooLongLine = ( !p && ((int)strlen(szLine)) == len-2 );
747
LtrimRtrim( szLine, &length );
749
if ( bTooLongLine ) {
750
while ( p = inchi_fgetsTab( szSkip, sizeof(szSkip)-1, f ) ) {
751
szSkip[sizeof(szSkip)-1] = '\0';
752
if ( strchr( szSkip, '\n' ) )
761
/*******************************************************************/
762
/* read up to len or tab or LF; if empty read next until finds non-empty line */
763
/* remove leading and trailing white spaces; keep zero termination */
764
/*******************************************************************/
765
char *inchi_fgetsTab( char *szLine, int len, FILE *f )
769
while ( length < len && EOF != (c = fgetc( f )) ) {
772
szLine[length++] = (char)c;
776
if ( !length && EOF == c ) {
779
szLine[length] = '\0';
785
/******************************************************************/
786
/* read not more than line_len bytes from an lf-terminated line */
787
/* if input line is too long quietly ignore the rest of the line */
788
char* inchi_fgetsLf( char* line, int line_len, FILE* inp )
791
memset( line, 0, line_len );
792
if ( NULL != (p = fgets( line, line_len, inp ) ) && NULL == strchr(p, '\n' ) ){
793
char temp[64]; /* bypass up to '\n' or up to end of file whichever comes first*/
794
while ( NULL != fgets( temp, sizeof(temp), inp ) && NULL == strchr(temp,'\n') )
797
if ( p && (q = strchr(line, '\r')) ) { /* fix CR CR LF line terminator. */
813
/*****************************************************************
815
* Estimate printf string length
817
* The code is based on Microsoft Knowledge Base article Q127038:
818
* "FIX: CString::Format Gives Assertion Failed, Access Violation"
819
* (Related to Microsoft Visual C++, 32-bit Editions, versions 2.0, 2.1)
821
*****************************************************************/
823
#define FORCE_ANSI 0x10000
824
#define FORCE_UNICODE 0x20000
826
/* formatting (using wsprintf style formatting)*/
827
int GetMaxPrintfLength( const char *lpszFormat, va_list argList)
829
/*ASSERT(AfxIsValidString(lpszFormat, FALSE));*/
831
int nMaxLen, nWidth, nPrecision, nModifier, nItemLen;
834
/* make a guess at the maximum length of the resulting string */
835
for ( lpsz = lpszFormat; *lpsz; lpsz ++ )
837
/* handle '%' character, but watch out for '%%' */
838
if (*lpsz != '%' || *( ++ lpsz ) == '%')
846
/* handle '%' character with format */
848
for (; *lpsz; lpsz ++ )
850
/* check for valid flags */
852
nMaxLen += 2; /* for '0x' */
853
else if (*lpsz == '*')
854
nWidth = va_arg(argList, int);
855
else if (*lpsz == '-' || *lpsz == '+' || *lpsz == '0'
858
else /* hit non-flag character */
861
/* get width and skip it */
864
/* width indicated by */
866
for (; *lpsz && isdigit(*lpsz); lpsz ++ )
869
/*ASSERT(nWidth >= 0);*/
871
goto exit_error; /* instead of exception */
876
/* skip past '.' separator (width.precision)*/
879
/* get precision and skip it*/
882
nPrecision = va_arg(argList, int);
887
nPrecision = atoi(lpsz);
888
for (; *lpsz && isdigit(*lpsz); lpsz ++)
891
if ( nPrecision < 0 )
892
goto exit_error; /* instead of exception */
895
/* should be on type modifier or specifier */
899
/* modifiers that affect size */
908
/* short unsigned, short double, etc. -- added to the original MS example */
909
/* ignore the fact that these modifiers do affect size */
913
nModifier = FORCE_ANSI;
926
case 'f': /* long float -- post ANSI C */
927
/* long unsigned, long double, etc. -- added to the original MS example */
928
/* ignore the fact that these modifiers do affect size */
933
nModifier = FORCE_UNICODE;
937
goto exit_error; /* no UNICODE, please */
940
/* modifiers that do not affect size */
948
/* now should be on specifier */
949
switch (*lpsz | nModifier)
951
/* single characters*/
955
va_arg(argList, int);
960
va_arg(argList, int);
962
case 'c'|FORCE_UNICODE:
963
case 'C'|FORCE_UNICODE:
964
goto exit_error; /* no UNICODE, please */
967
va_arg(argList, wchar_t);
974
nItemLen = strlen(va_arg(argList, char*));
975
nItemLen = inchi_max(1, nItemLen);
979
nItemLen = strlen(va_arg(argList, char*));
980
nItemLen = inchi_max(1, nItemLen);
983
case 's'|FORCE_UNICODE:
984
case 'S'|FORCE_UNICODE:
985
goto exit_error; /* no UNICODE, please */
987
nItemLen = wcslen(va_arg(argList, wchar_t*));
988
nItemLen = inchi_max(1, nItemLen);
994
/* adjust nItemLen for strings */
997
nItemLen = inchi_max(nItemLen, nWidth);
999
nItemLen = inchi_min(nItemLen, nPrecision);
1012
va_arg(argList, int);
1014
nItemLen = inchi_max(nItemLen, nWidth+nPrecision);
1021
va_arg(argList, double);
1023
nItemLen = inchi_max(nItemLen, nWidth+nPrecision);
1027
va_arg(argList, void*);
1029
nItemLen = inchi_max(nItemLen, nWidth+nPrecision);
1034
va_arg(argList, int*);
1038
/*ASSERT(FALSE);*/ /* unknown formatting option*/
1039
goto exit_error; /* instead of exception */
1043
/* adjust nMaxLen for output nItemLen */
1044
nMaxLen += nItemLen;
1049
return -1; /* wrong format */