OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v5/] [software/] [AS64/] [source/] [main.cpp] - Diff between revs 55 and 59

Show entire file | Details | Blame | View Log

Rev 55 Rev 59
Line 1508... Line 1508...
        char *p1, *p2, *p3;
        char *p1, *p2, *p3;
        bool codecut = false;
        bool codecut = false;
 
 
        // Cut out the if statement
        // Cut out the if statement
        p1 = pif1;
        p1 = pif1;
        memmove(pif1,pif2,sizeof(masterFile)-(pif2-masterFile));
        memmove(pif1,pif2,masterFileLength-(pif2-masterFile));
 
 
        p1 = inptr = pif1;
        p1 = inptr = pif1;
        while(*inptr) {
        while(*inptr) {
                SkipSpaces();
                SkipSpaces();
                p2 = inptr;
                p2 = inptr;
Line 1524... Line 1524...
                        iflevel--;
                        iflevel--;
                        if (iflevel==0) {
                        if (iflevel==0) {
                                // If the if was false cut out the code between
                                // If the if was false cut out the code between
                                // if and endif
                                // if and endif
                                if (val==0 && !codecut) {
                                if (val==0 && !codecut) {
                                        memmove(pif1,p3,sizeof(masterFile)-(p3-masterFile));
                                        memmove(pif1,p3,masterFileLength-(p3-masterFile));
                                        inptr = pif1;
                                        inptr = pif1;
                                        return;
                                        return;
                                }
                                }
                                else {
                                else {
                                        // remove endif but leave remaining text
                                        // remove endif but leave remaining text
                                        memmove(p2,inptr,sizeof(masterFile)-(inptr-masterFile));
                                        memmove(p2,inptr,masterFileLength-(inptr-masterFile));
                                        inptr = p2;
                                        inptr = p2;
                                }
                                }
                        }
                        }
                }
                }
                else if (token==tk_else) {
                else if (token==tk_else) {
                        if (iflevel==0) {
                        if (iflevel==0) {
                                // cut out code between if and else
                                // cut out code between if and else
                                // and keep going until endif
                                // and keep going until endif
                                if (val==0) {
                                if (val==0) {
                                        memmove(pif1,p2+4,sizeof(masterFile)-(p2+4-masterFile));
                                        memmove(pif1,p2+4,masterFileLength-(p2+4-masterFile));
                                        inptr = pif1;
                                        inptr = pif1;
                                        codecut = true;
                                        codecut = true;
                                }
                                }
                                else {
                                else {
                                        // remove the else from text
                                        // remove the else from text
                                        // and keep going until endif
                                        // and keep going until endif
                                        memmove(p2,inptr,sizeof(masterFile)-(inptr-masterFile));
                                        memmove(p2,inptr,masterFileLength-(inptr-masterFile));
                                        inptr = p2;
                                        inptr = p2;
                                }
                                }
                        }
                        }
                }
                }
                else
                else
Line 1574... Line 1574...
 
 
void doifdef()
void doifdef()
{
{
        int64_t val;
        int64_t val;
 
 
 
        SkipSpaces();
        if (getIdentifier()==0)
        if (getIdentifier()==0)
                printf("Expecting an identifier %d.\n", lineno);
                printf("Expecting an identifier %d.\n", lineno);
    val = (find_symbol(lastid)!=nullptr);
    val = (find_symbol(lastid)!=nullptr);
        ScanToEOL();
 
        pif2 = inptr;
        pif2 = inptr;
 
        ScanToEOL();
        skipif(val);
        skipif(val);
}
}
 
 
void doifndef()
void doifndef()
{
{

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.