third_party/inchi/INCHI_BASE/src/runichi4.c
int TreatErrorsInCreateOneComponentINChI( STRUCT_DATA *sd,
                                          INPUT_PARMS    *ip,
                                          ORIG_ATOM_DATA *orig_inp_data,
                                          int i, long num_inp,
                                          INCHI_IOSTREAM *inp_file,
                                          INCHI_IOSTREAM *log_file,
                                          INCHI_IOSTREAM *out_file,
                                          INCHI_IOSTREAM *prb_file )
{
    if (sd->nErrorCode)
    {
        AddErrorMessage( sd->pStrErrStruct, ErrMsg( sd->nErrorCode ) );
        inchi_ios_eprint( log_file,
                          "Error %d (%s) structure #%ld component %d.%s%s%s%s\n",
                          sd->nErrorCode, sd->pStrErrStruct,
                          num_inp, i + 1, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
        sd->nErrorType = ( sd->nErrorCode == CT_OUT_OF_RAM || sd->nErrorCode == CT_USER_QUIT_ERR )
            ? _IS_FATAL
            : _IS_ERROR;

#ifdef TARGET_LIB_FOR_WINCHI
        if (( ip->bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) &&
            ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ))
        {
            sd->nErrorType = ProcessStructError( out_file, log_file,
                                                 sd->pStrErrStruct, sd->nErrorType,
                                                 num_inp, ip );
            /*  Save the problem structure */
            if (prb_file->f &&
                 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd &&
                 !ip->bSaveAllGoodStructsAsProblem)
            {
                MolfileSaveCopy( inp_file, sd->fPtrStart, sd->fPtrEnd, prb_file->f, num_inp );
            }
        }
        else
        {
            /*  Save the problem structure */
            if (sd->nErrorCode &&
                 prb_file->f &&
                 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd &&
                 !ip->bSaveAllGoodStructsAsProblem)
            {
                MolfileSaveCopy( inp_file, sd->fPtrStart, sd->fPtrEnd, prb_file->f, num_inp );
            }
        }
#endif
    }

/* #ifndef TARGET_API_LIB */
#if ( !defined( TARGET_API_LIB ) && !defined(TARGET_EXE_STANDALONE) )
    /*  print the logfile record */
    if (log_file->f && log_file->f != stderr && ( sd->ulStructTime >= 1000 || sd->nErrorCode ))
    {
        fprintf( log_file->f, "%10lu msec structure #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
                sd->ulStructTime, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ),
                orig_inp_data->num_components, orig_inp_data->num_components == 1 ? "" : "s",
                orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms == 1 ? "" : "s", sd->nErrorCode );
    }
#endif

    return sd->nErrorType;
}
/****************************************************************************
  Treat errors returned by CreateOneComponentINChI( ... )
****************************************************************************/
Treat errors returned by CreateOneComponentINChI( ...
Treat errors returned by CreateOneComponentINChI ( ...
int TreatErrorsInCreateOneComponentINChI( STRUCT_DATA *sd,
                                          INPUT_PARMS    *ip,
                                          ORIG_ATOM_DATA *orig_inp_data,
                                          int i, long num_inp,
                                          INCHI_IOSTREAM *inp_file,
                                          INCHI_IOSTREAM *log_file,
                                          INCHI_IOSTREAM *out_file,
                                          INCHI_IOSTREAM *prb_file )
{
    if (sd->nErrorCode)
    {
        AddErrorMessage( sd->pStrErrStruct, ErrMsg( sd->nErrorCode ) );
        inchi_ios_eprint( log_file,
                          "Error %d (%s) structure #%ld component %d.%s%s%s%s\n",
                          sd->nErrorCode, sd->pStrErrStruct,
                          num_inp, i + 1, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ) );
        sd->nErrorType = ( sd->nErrorCode == CT_OUT_OF_RAM || sd->nErrorCode == CT_USER_QUIT_ERR )
            ? _IS_FATAL
            : _IS_ERROR;
#ifdef TARGET_LIB_FOR_WINCHI
        if (( ip->bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) &&
            ( ip->bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ))
        {
            sd->nErrorType = ProcessStructError( out_file, log_file,
                                                 sd->pStrErrStruct, sd->nErrorType,
                                                 num_inp, ip );
            if (prb_file->f &&
                 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd &&
                 !ip->bSaveAllGoodStructsAsProblem)
            {
                MolfileSaveCopy( inp_file, sd->fPtrStart, sd->fPtrEnd, prb_file->f, num_inp );
            }
        }
        else
        {
            if (sd->nErrorCode &&
                 prb_file->f &&
                 0L <= sd->fPtrStart && sd->fPtrStart < sd->fPtrEnd &&
                 !ip->bSaveAllGoodStructsAsProblem)
            {
                MolfileSaveCopy( inp_file, sd->fPtrStart, sd->fPtrEnd, prb_file->f, num_inp );
            }
        }
#endif
    }
#if ( !defined( TARGET_API_LIB ) && !defined(TARGET_EXE_STANDALONE) )
    if (log_file->f && log_file->f != stderr && ( sd->ulStructTime >= 1000 || sd->nErrorCode ))
    {
        fprintf( log_file->f, "%10lu msec structure #%ld.%s%s%s%s (%d component%s, %d atom%s, error=%d).\n",
                sd->ulStructTime, num_inp, SDF_LBL_VAL( ip->pSdfLabel, ip->pSdfValue ),
                orig_inp_data->num_components, orig_inp_data->num_components == 1 ? "" : "s",
                orig_inp_data->num_inp_atoms, orig_inp_data->num_inp_atoms == 1 ? "" : "s", sd->nErrorCode );
    }
#endif
    return sd->nErrorType;
}
int TreatErrorsInCreateOneComponentINChI ( STRUCT_DATA * sd , INPUT_PARMS * ip , ORIG_ATOM_DATA * orig_inp_data , int i , long num_inp , INCHI_IOSTREAM * inp_file , INCHI_IOSTREAM * log_file , INCHI_IOSTREAM * out_file , INCHI_IOSTREAM * prb_file ) { if ( sd -> nErrorCode ) { AddErrorMessage ( sd -> pStrErrStruct , ErrMsg ( sd -> nErrorCode ) ) ; inchi_ios_eprint ( log_file , " \n " , sd -> nErrorCode , sd -> pStrErrStruct , num_inp , i + 1 , SDF_LBL_VAL ( ip -> pSdfLabel , ip -> pSdfValue ) ) ; sd -> nErrorType = ( sd -> nErrorCode == CT_OUT_OF_RAM || sd -> nErrorCode == CT_USER_QUIT_ERR ) ? _IS_FATAL : _IS_ERROR ; #ifdef TARGET_LIB_FOR_WINCHI if ( ( ip -> bINChIOutputOptions & INCHI_OUT_WINCHI_WINDOW ) && ( ip -> bINChIOutputOptions & INCHI_OUT_PLAIN_TEXT ) ) { sd -> nErrorType = ProcessStructError ( out_file , log_file , sd -> pStrErrStruct , sd -> nErrorType , num_inp , ip ) ; if ( prb_file -> f && 0L <= sd -> fPtrStart && sd -> fPtrStart < sd -> fPtrEnd && ! ip -> bSaveAllGoodStructsAsProblem ) { MolfileSaveCopy ( inp_file , sd -> fPtrStart , sd -> fPtrEnd , prb_file -> f , num_inp ) ; } } else { if ( sd -> nErrorCode && prb_file -> f && 0L <= sd -> fPtrStart && sd -> fPtrStart < sd -> fPtrEnd && ! ip -> bSaveAllGoodStructsAsProblem ) { MolfileSaveCopy ( inp_file , sd -> fPtrStart , sd -> fPtrEnd , prb_file -> f , num_inp ) ; } } #endif } #if ( ! defined ( TARGET_API_LIB ) && ! defined ( TARGET_EXE_STANDALONE ) ) if ( log_file -> f && log_file -> f != stderr && ( sd -> ulStructTime >= 1000 || sd -> nErrorCode ) ) { fprintf ( log_file -> f , " \n " , sd -> ulStructTime , num_inp , SDF_LBL_VAL ( ip -> pSdfLabel , ip -> pSdfValue ) , orig_inp_data -> num_components , orig_inp_data -> num_components == 1 ? " " : " " , orig_inp_data -> num_inp_atoms , orig_inp_data -> num_inp_atoms == 1 ? " " : " " , sd -> nErrorCode ) ; } #endif return sd -> nErrorType ; }
Treat errors returned by CreateOneComponentINChI( ... )
Treat errors returned by CreateOneComponentINChI ( ... )
/*  Save the problem structure */ /*  Save the problem structure */ /* #ifndef TARGET_API_LIB */ /*  print the logfile record */