third_party/inchi/INCHI_BASE/src/ichiprt1.c
int OutputINCHI_ChargeAndRemovedAddedProtonsLayers( CANON_GLOBALS    *pCG,
                                                    INCHI_IOSTREAM   *out_file,
                                                    INCHI_IOS_STRING *strbuf,
                                                    INCHI_OUT_CTL    *io,
                                                    char             *pLF,
                                                    char             *pTAB )
{

    /* charge  */

    io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_q_CHARGE] );
    if (io->nSegmAction)
    {
        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_CHRG | io->bFhTag, io->szTag1, &io->bAlways );
        inchi_strbuf_reset( strbuf );
        io->tot_len = 0;
        if (INCHI_SEGM_FILL == io->nSegmAction)
        {
            io->tot_len = str_Charge2( io->pINChISort, io->pINChISort2,
                                   strbuf, &io->bOverflow, io->bOutType, io->num_components,
                                   io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
            io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
        }
        if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
        {
            return 1;
        }
        inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
    }

    /* removed protons */

    if (io->iCurTautMode == TAUT_YES && !io->bSecondNonTautPass)
    {

        io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_p_PROTONS] );
        if (io->nSegmAction)
        {
            szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_PROT | io->bFhTag, io->szTag1, &io->bAlways );
            inchi_strbuf_reset( strbuf );
            io->tot_len = 0;
            inchi_strbuf_printf( strbuf, "%+d", io->nNumRemovedProtons );
            if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
            {
                return 1;
            }
            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
        }
        else
        {
            if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "/" );
        }
    }

    return 0;
}
/****************************************************************************
Output InChI: charge and  removed protons layers
****************************************************************************/
Output InChI: charge and  removed protons layers
Output InChI : charge and removed protons layers
int OutputINCHI_ChargeAndRemovedAddedProtonsLayers( CANON_GLOBALS    *pCG,
                                                    INCHI_IOSTREAM   *out_file,
                                                    INCHI_IOS_STRING *strbuf,
                                                    INCHI_OUT_CTL    *io,
                                                    char             *pLF,
                                                    char             *pTAB )
{
    io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_q_CHARGE] );
    if (io->nSegmAction)
    {
        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_CHRG | io->bFhTag, io->szTag1, &io->bAlways );
        inchi_strbuf_reset( strbuf );
        io->tot_len = 0;
        if (INCHI_SEGM_FILL == io->nSegmAction)
        {
            io->tot_len = str_Charge2( io->pINChISort, io->pINChISort2,
                                   strbuf, &io->bOverflow, io->bOutType, io->num_components,
                                   io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
            io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
        }
        if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
        {
            return 1;
        }
        inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
    }
    if (io->iCurTautMode == TAUT_YES && !io->bSecondNonTautPass)
    {
        io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_p_PROTONS] );
        if (io->nSegmAction)
        {
            szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_PROT | io->bFhTag, io->szTag1, &io->bAlways );
            inchi_strbuf_reset( strbuf );
            io->tot_len = 0;
            inchi_strbuf_printf( strbuf, "%+d", io->nNumRemovedProtons );
            if (str_LineEnd( io->szTag1, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
            {
                return 1;
            }
            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
        }
        else
        {
            if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "/" );
        }
    }
    return 0;
}
int OutputINCHI_ChargeAndRemovedAddedProtonsLayers ( CANON_GLOBALS * pCG , INCHI_IOSTREAM * out_file , INCHI_IOS_STRING * strbuf , INCHI_OUT_CTL * io , char * pLF , char * pTAB ) { io -> nSegmAction = INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_q_CHARGE ] ) ; if ( io -> nSegmAction ) { szGetTag ( IdentLbl , io -> nTag , io -> bTag1 = IL_CHRG | io -> bFhTag , io -> szTag1 , & io -> bAlways ) ; inchi_strbuf_reset ( strbuf ) ; io -> tot_len = 0 ; if ( INCHI_SEGM_FILL == io -> nSegmAction ) { io -> tot_len = str_Charge2 ( io -> pINChISort , io -> pINChISort2 , strbuf , & io -> bOverflow , io -> bOutType , io -> num_components , io -> bSecondNonTautPass , io -> bOmitRepetitions , io -> bUseMulipliers ) ; io -> bNonTautNonIsoIdentifierNotEmpty += io -> bSecondNonTautPass ; } if ( str_LineEnd ( io -> szTag1 , & io -> bOverflow , strbuf , - io -> nSegmAction , io -> bPlainTextTags ) ) { return 1 ; } inchi_ios_print_nodisplay ( out_file , " " , strbuf -> pStr , pLF ) ; } if ( io -> iCurTautMode == TAUT_YES && ! io -> bSecondNonTautPass ) { io -> nSegmAction = INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_p_PROTONS ] ) ; if ( io -> nSegmAction ) { szGetTag ( IdentLbl , io -> nTag , io -> bTag1 = IL_PROT | io -> bFhTag , io -> szTag1 , & io -> bAlways ) ; inchi_strbuf_reset ( strbuf ) ; io -> tot_len = 0 ; inchi_strbuf_printf ( strbuf , " " , io -> nNumRemovedProtons ) ; if ( str_LineEnd ( io -> szTag1 , & io -> bOverflow , strbuf , - io -> nSegmAction , io -> bPlainTextTags ) ) { return 1 ; } inchi_ios_print_nodisplay ( out_file , " " , strbuf -> pStr , pLF ) ; } else { if ( io -> bPlainTextTags == 1 ) inchi_ios_print_nodisplay ( out_file , " " ) ; } } return 0 ; }
Output InChI: charge and  removed protons layers
Output InChI : charge and removed protons layers
/* charge  */ /* removed protons */