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

    {
        int i;
        i = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] );
        i = i;
    }

    if (INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ) ||
         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ) ||
         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ) ||
         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
    {

        /*  stereo */

        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_STER | io->bFhTag, io->szTag1, &io->bAlways );

        /*  sp2 */

        /*if ( bStereoSp2[io->iCurTautMode]  )*/
        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ))
        {
            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_DBND, io->szTag2, &io->bAlways );
            inchi_strbuf_reset( strbuf );
            io->tot_len = 0;
            if (INCHI_SEGM_FILL == io->nSegmAction)
            {
                io->tot_len = str_Sp2( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
                                        io->bOutType, io->TAUT_MODE, io->num_components,
                                        io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );

                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
            }

            if (str_LineEnd( io->szTag2, &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, "/" ); /* sp2 */
            }
        }

        /*  sp3 */

        /*if ( bStereoSp3[io->iCurTautMode]  )*/
        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ))
        {
            io->bRelRac = io->bRelativeStereo[io->iCurTautMode] || io->bRacemicStereo[io->iCurTautMode];
            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_SP3S, io->szTag2, &io->bAlways );
            inchi_strbuf_reset( strbuf );
            io->tot_len = 0;
            if (INCHI_SEGM_FILL == io->nSegmAction)
            {
                io->tot_len = str_Sp3( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
                                       io->bOutType, io->TAUT_MODE, io->num_components, io->bRelRac,
                                   io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );

                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
            }

            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
            {
                return 2;
            }
            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
        }
        else
        {
            if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "/" ); /* sp3 */
        }

        /* bStereoAbsInverted[io->iCurTautMode]  */

        /* if ( bStereoAbs[io->iCurTautMode]  ) */
        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ))
        {
            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_INVS, io->szTag2, &io->bAlways );
            inchi_strbuf_reset( strbuf ); io->tot_len = 0;
            if (INCHI_SEGM_FILL == io->nSegmAction)
            {
                io->tot_len = str_StereoAbsInv( io->pINChISort, strbuf,
                                            &io->bOverflow, io->bOutType, io->num_components );
                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
            }

            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
            {
                return 3;
            }
            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
        }
        else
        {
            if (io->bPlainTextTags == 1)
            {
                inchi_ios_print_nodisplay( out_file, "/" ); /* stereo-abs-inv */
            }
        }

        /* stereo type */

        /*if ( io->bRacemicStereo[io->iCurTautMode] || io->bRelativeStereo[io->iCurTautMode] || bStereoAbs[io->iCurTautMode] )*/
        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
        {
            const char *p_stereo = io->bRelativeStereo[io->iCurTautMode] ? x_rel :
                io->bRacemicStereo[io->iCurTautMode] ? x_rac : x_abs;
            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_TYPS, io->szTag2, &io->bAlways );
            inchi_strbuf_reset( strbuf ); io->tot_len = 0;
            if (INCHI_SEGM_FILL == io->nSegmAction)
            {
                ( io->tot_len ) += MakeDelim( p_stereo, strbuf, &io->bOverflow );
                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
            }
            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
            {
                return 1;
            }
            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
        }
        if (io->bPlainTextTags == 1)
        {
            inchi_ios_print_nodisplay( out_file, "/" );  /* no abs, inv or racemic stereo */
        }
    }
    else
    {
        if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "////" ); /* sp3, sp2, abs-inv, stereo.type */
    }

    return 0;
}
/****************************************************************************
Output InChI: stereo layer with sublayers
****************************************************************************/
Output InChI: stereo layer with sublayers
Output InChI : stereo layer with sublayers
int OutputINCHI_StereoLayer( CANON_GLOBALS    *pCG,
                             INCHI_IOSTREAM   *out_file,
                             INCHI_IOS_STRING *strbuf,
                             INCHI_OUT_CTL    *io,
                             char             *pLF,
                             char             *pTAB )
{
    {
        int i;
        i = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] );
        i = i;
    }
    if (INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ) ||
         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ) ||
         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ) ||
         INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
    {
        szGetTag( IdentLbl, io->nTag, io->bTag1 = IL_STER | io->bFhTag, io->szTag1, &io->bAlways );
        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_b_SBONDS] ))
        {
            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_DBND, io->szTag2, &io->bAlways );
            inchi_strbuf_reset( strbuf );
            io->tot_len = 0;
            if (INCHI_SEGM_FILL == io->nSegmAction)
            {
                io->tot_len = str_Sp2( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
                                        io->bOutType, io->TAUT_MODE, io->num_components,
                                        io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
            }
            if (str_LineEnd( io->szTag2, &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, "/" ); 
            }
        }
        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_t_SATOMS] ))
        {
            io->bRelRac = io->bRelativeStereo[io->iCurTautMode] || io->bRacemicStereo[io->iCurTautMode];
            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_SP3S, io->szTag2, &io->bAlways );
            inchi_strbuf_reset( strbuf );
            io->tot_len = 0;
            if (INCHI_SEGM_FILL == io->nSegmAction)
            {
                io->tot_len = str_Sp3( io->pINChISort, io->pINChISort2, strbuf, &io->bOverflow,
                                       io->bOutType, io->TAUT_MODE, io->num_components, io->bRelRac,
                                   io->bSecondNonTautPass, io->bOmitRepetitions, io->bUseMulipliers );
                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
            }
            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
            {
                return 2;
            }
            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
        }
        else
        {
            if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "/" ); 
        }
        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_m_SP3INV] ))
        {
            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_INVS, io->szTag2, &io->bAlways );
            inchi_strbuf_reset( strbuf ); io->tot_len = 0;
            if (INCHI_SEGM_FILL == io->nSegmAction)
            {
                io->tot_len = str_StereoAbsInv( io->pINChISort, strbuf,
                                            &io->bOverflow, io->bOutType, io->num_components );
                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
            }
            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
            {
                return 3;
            }
            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
        }
        else
        {
            if (io->bPlainTextTags == 1)
            {
                inchi_ios_print_nodisplay( out_file, "/" ); 
            }
        }
        if (io->nSegmAction = INChI_SegmentAction( io->sDifSegs[io->nCurINChISegment][DIFS_s_STYPE] ))
        {
            const char *p_stereo = io->bRelativeStereo[io->iCurTautMode] ? x_rel :
                io->bRacemicStereo[io->iCurTautMode] ? x_rac : x_abs;
            szGetTag( IdentLbl, io->nTag, io->bTag2 = io->bTag1 | IL_TYPS, io->szTag2, &io->bAlways );
            inchi_strbuf_reset( strbuf ); io->tot_len = 0;
            if (INCHI_SEGM_FILL == io->nSegmAction)
            {
                ( io->tot_len ) += MakeDelim( p_stereo, strbuf, &io->bOverflow );
                io->bNonTautNonIsoIdentifierNotEmpty += io->bSecondNonTautPass;
            }
            if (str_LineEnd( io->szTag2, &io->bOverflow, strbuf, -io->nSegmAction, io->bPlainTextTags ))
            {
                return 1;
            }
            inchi_ios_print_nodisplay( out_file, "%s%s", strbuf->pStr, pLF );
        }
        if (io->bPlainTextTags == 1)
        {
            inchi_ios_print_nodisplay( out_file, "/" );  
        }
    }
    else
    {
        if (io->bPlainTextTags == 1) inchi_ios_print_nodisplay( out_file, "////" ); 
    }
    return 0;
}
int OutputINCHI_StereoLayer ( CANON_GLOBALS * pCG , INCHI_IOSTREAM * out_file , INCHI_IOS_STRING * strbuf , INCHI_OUT_CTL * io , char * pLF , char * pTAB ) { { int i ; i = INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_t_SATOMS ] ) ; i = i ; } if ( INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_b_SBONDS ] ) || INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_t_SATOMS ] ) || INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_m_SP3INV ] ) || INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_s_STYPE ] ) ) { szGetTag ( IdentLbl , io -> nTag , io -> bTag1 = IL_STER | io -> bFhTag , io -> szTag1 , & io -> bAlways ) ; if ( io -> nSegmAction = INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_b_SBONDS ] ) ) { szGetTag ( IdentLbl , io -> nTag , io -> bTag2 = io -> bTag1 | IL_DBND , io -> szTag2 , & io -> bAlways ) ; inchi_strbuf_reset ( strbuf ) ; io -> tot_len = 0 ; if ( INCHI_SEGM_FILL == io -> nSegmAction ) { io -> tot_len = str_Sp2 ( io -> pINChISort , io -> pINChISort2 , strbuf , & io -> bOverflow , io -> bOutType , io -> TAUT_MODE , io -> num_components , io -> bSecondNonTautPass , io -> bOmitRepetitions , io -> bUseMulipliers ) ; io -> bNonTautNonIsoIdentifierNotEmpty += io -> bSecondNonTautPass ; } if ( str_LineEnd ( io -> szTag2 , & 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 , " " ) ; } } if ( io -> nSegmAction = INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_t_SATOMS ] ) ) { io -> bRelRac = io -> bRelativeStereo [ io -> iCurTautMode ] || io -> bRacemicStereo [ io -> iCurTautMode ] ; szGetTag ( IdentLbl , io -> nTag , io -> bTag2 = io -> bTag1 | IL_SP3S , io -> szTag2 , & io -> bAlways ) ; inchi_strbuf_reset ( strbuf ) ; io -> tot_len = 0 ; if ( INCHI_SEGM_FILL == io -> nSegmAction ) { io -> tot_len = str_Sp3 ( io -> pINChISort , io -> pINChISort2 , strbuf , & io -> bOverflow , io -> bOutType , io -> TAUT_MODE , io -> num_components , io -> bRelRac , io -> bSecondNonTautPass , io -> bOmitRepetitions , io -> bUseMulipliers ) ; io -> bNonTautNonIsoIdentifierNotEmpty += io -> bSecondNonTautPass ; } if ( str_LineEnd ( io -> szTag2 , & io -> bOverflow , strbuf , - io -> nSegmAction , io -> bPlainTextTags ) ) { return 2 ; } inchi_ios_print_nodisplay ( out_file , " " , strbuf -> pStr , pLF ) ; } else { if ( io -> bPlainTextTags == 1 ) inchi_ios_print_nodisplay ( out_file , " " ) ; } if ( io -> nSegmAction = INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_m_SP3INV ] ) ) { szGetTag ( IdentLbl , io -> nTag , io -> bTag2 = io -> bTag1 | IL_INVS , io -> szTag2 , & io -> bAlways ) ; inchi_strbuf_reset ( strbuf ) ; io -> tot_len = 0 ; if ( INCHI_SEGM_FILL == io -> nSegmAction ) { io -> tot_len = str_StereoAbsInv ( io -> pINChISort , strbuf , & io -> bOverflow , io -> bOutType , io -> num_components ) ; io -> bNonTautNonIsoIdentifierNotEmpty += io -> bSecondNonTautPass ; } if ( str_LineEnd ( io -> szTag2 , & io -> bOverflow , strbuf , - io -> nSegmAction , io -> bPlainTextTags ) ) { return 3 ; } inchi_ios_print_nodisplay ( out_file , " " , strbuf -> pStr , pLF ) ; } else { if ( io -> bPlainTextTags == 1 ) { inchi_ios_print_nodisplay ( out_file , " " ) ; } } if ( io -> nSegmAction = INChI_SegmentAction ( io -> sDifSegs [ io -> nCurINChISegment ] [ DIFS_s_STYPE ] ) ) { const char * p_stereo = io -> bRelativeStereo [ io -> iCurTautMode ] ? x_rel : io -> bRacemicStereo [ io -> iCurTautMode ] ? x_rac : x_abs ; szGetTag ( IdentLbl , io -> nTag , io -> bTag2 = io -> bTag1 | IL_TYPS , io -> szTag2 , & io -> bAlways ) ; inchi_strbuf_reset ( strbuf ) ; io -> tot_len = 0 ; if ( INCHI_SEGM_FILL == io -> nSegmAction ) { ( io -> tot_len ) += MakeDelim ( p_stereo , strbuf , & io -> bOverflow ) ; io -> bNonTautNonIsoIdentifierNotEmpty += io -> bSecondNonTautPass ; } if ( str_LineEnd ( io -> szTag2 , & io -> bOverflow , strbuf , - io -> nSegmAction , io -> bPlainTextTags ) ) { return 1 ; } inchi_ios_print_nodisplay ( out_file , " " , strbuf -> pStr , pLF ) ; } if ( io -> bPlainTextTags == 1 ) { inchi_ios_print_nodisplay ( out_file , " " ) ; } } else { if ( io -> bPlainTextTags == 1 ) inchi_ios_print_nodisplay ( out_file , " " ) ; } return 0 ; }
Output InChI: stereo layer with sublayers
Output InChI : stereo layer with sublayers
/*  stereo */ /*  sp2 */ /*if ( bStereoSp2[io->iCurTautMode]  )*/ /* sp2 */ /*  sp3 */ /*if ( bStereoSp3[io->iCurTautMode]  )*/ /* sp3 */ /* bStereoAbsInverted[io->iCurTautMode]  */ /* if ( bStereoAbs[io->iCurTautMode]  ) */ /* stereo-abs-inv */ /* stereo type */ /*if ( io->bRacemicStereo[io->iCurTautMode] || io->bRelativeStereo[io->iCurTautMode] || bStereoAbs[io->iCurTautMode] )*/ /* no abs, inv or racemic stereo */ /* sp3, sp2, abs-inv, stereo.type */