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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [zpp.l] - Diff between revs 34 and 36

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 34 Rev 36
Line 660... Line 660...
        }
        }
 
 
        BUFSTACK(const char *fname) {
        BUFSTACK(const char *fname) {
                m_fp = fopen(fname, "r");
                m_fp = fopen(fname, "r");
                if (!m_fp) {
                if (!m_fp) {
 
                        char *pathptr = getenv("ZIPINC");
 
                        if (!pathptr) {
                        fprintf(stderr, "Cannot open %s\n", fname);
                        fprintf(stderr, "Cannot open %s\n", fname);
                        perror("O/S Err:");
                        perror("O/S Err:");
                        exit(-1);
                        exit(-1);
 
                        } else {
 
                                char    *dptr, *colonp;
 
                                char *pathcpy = new char[strlen(pathptr)+8192];
 
                                strcpy(pathcpy, pathptr);
 
 
 
                                fprintf(stderr, "ZIPINC := %s\n", pathptr);
 
                                dptr = pathptr;
 
                                while((!m_fp)&&(NULL != (colonp = strchr(dptr, ':')))) {
 
                                        strncpy(pathcpy, dptr, colonp-pathptr);
 
                                        strcat(pathcpy, "/");
 
                                        strcat(pathcpy, fname);
 
                                        fprintf(stderr, "Looking for include file, %s\n", pathcpy);
 
                                        if (access(fname, R_OK)==0)
 
                                                m_fp = fopen(pathcpy, "r");
 
                                        dptr = colonp+1;
 
                                } if ((!m_fp)&&(*dptr)) {
 
                                        strcpy(pathcpy, dptr);
 
                                        strcat(pathcpy, "/");
 
                                        strcat(pathcpy, fname);
 
                                        fprintf(stderr, "Looking for include file, %s\n", pathcpy);
 
                                        m_fp = fopen(pathcpy, "r");
 
                                } if (!m_fp) {
 
                                        fprintf(stderr, "Cannot open %s\n", fname);
 
                                        perror("O/S Err:");
 
                                        exit(-1);
 
                                }
 
 
 
                                delete[] pathcpy;
 
                        }
                }
                }
 
 
                if (curbs)
                if (curbs)
                        curbs->m_lineno = yylineno;
                        curbs->m_lineno = yylineno;
                m_prev = curbs;
                m_prev = curbs;

powered by: WebSVN 2.1.0

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