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

Subversion Repositories zipcpu

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

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

Rev 34 Rev 36
Line 35... Line 35...
**
**
*******************************************************************************/
*******************************************************************************/
 
 
%{
%{
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include "asmdata.h"
 #include "asmdata.h"
 
 
#define DEFAULT_OUTPUT_FNAME    "z.out"
#define DEFAULT_OUTPUT_FNAME    "z.out"
#define YYDEBUG 1
#define YYDEBUG 1
Line 417... Line 418...
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
 
#include 
 
 
OBJFILE objcode;
OBJFILE objcode;
 
 
void    yyerror(const char *str) {
void    yyerror(const char *str) {
        fprintf(stderr, "%s:%d: ERROR: %s\n", master_input_filename, yylineno, str);
        fprintf(stderr, "%s:%d: ERROR: %s\n", master_input_filename, yylineno, str);
Line 497... Line 499...
        char            *path_to_zasm = NULL;
        char            *path_to_zasm = NULL;
        bool    preprocess_only = false;
        bool    preprocess_only = false;
        FILE            *ppout;
        FILE            *ppout;
        pid_t           zpp_pid;
        pid_t           zpp_pid;
        int             zpp_status;
        int             zpp_status;
 
        std::string     inclist;
 
        if (NULL != getenv("ZIPINC"))
 
                inclist = getenv("ZIPINC");
 
 
 
        printf("Original INCLIST = %s\n", inclist.c_str());
 
 
        master_input_filename = NULL;
        master_input_filename = NULL;
 
 
        // Find what directory zasm is in, so that we can find zpp when
        // Find what directory zasm is in, so that we can find zpp when
        // necessary.
        // necessary.
Line 519... Line 526...
                                        free((void *)zout_fname);
                                        free((void *)zout_fname);
                                zout_fname = strdup(argv[argn+skp+1]);
                                zout_fname = strdup(argv[argn+skp+1]);
                                skp++;
                                skp++;
                        } else if (argv[argn+skp][1] == 'E')
                        } else if (argv[argn+skp][1] == 'E')
                                preprocess_only = true;
                                preprocess_only = true;
                        else if (argv[argn+skp][1] == 'd')
                        else if (argv[argn+skp][1] == 'I') {
 
                                if (argv[argn+skp][2]) {
 
                                        if (inclist.size() != 0) {
 
                                                inclist += std::string(":");
 
                                                inclist += &argv[argn+skp][2];
 
                                        } else
 
                                                inclist = &argv[argn+skp][2];
 
                                } else if (argn+skp+1
 
                                        if (inclist.size() != 0) {
 
                                                inclist += std::string(":");
 
                                                inclist += &argv[argn+skp+1][2];
 
                                        } else
 
                                                inclist = &argv[argn+skp+1][2];
 
                                        argn++;
 
                                }
 
                        } else if (argv[argn+skp][1] == 'd')
                                yydebug = 1;
                                yydebug = 1;
                        else if (argv[argn+skp][1] == 'h') {
                        else if (argv[argn+skp][1] == 'h') {
                                usage();
                                usage();
                                exit(0);
                                exit(0);
                        }
                        }
Line 538... Line 560...
                                fprintf(stderr, "ERR: Cowardly refusing to overwrite \'%s\'\n", zout_fname);
                                fprintf(stderr, "ERR: Cowardly refusing to overwrite \'%s\'\n", zout_fname);
                                exit(-2);
                                exit(-2);
                        }
                        }
                }
                }
        }
        }
 
        printf("New INCLIST = %s\n", inclist.c_str());
 
 
        if (preprocess_only) {
        if (preprocess_only) {
                objcode.open("/dev/null");
                objcode.open("/dev/null");
                if (zout_fname)
                if (zout_fname)
                        ppout = fopen(zout_fname, "w");
                        ppout = fopen(zout_fname, "w");
Line 552... Line 575...
                        zout_fname = DEFAULT_OUTPUT_FNAME;
                        zout_fname = DEFAULT_OUTPUT_FNAME;
 
 
                objcode.open(zout_fname);
                objcode.open(zout_fname);
        }
        }
 
 
 
        setenv("ZIPINC",inclist.c_str(), 1);
        master_input_filename = NULL;
        master_input_filename = NULL;
 
 
        if (argc > 0) {
        if (argc > 0) {
                for(int argn=0; argn
                for(int argn=0; argn
                        extern  FILE    *yyin;
                        extern  FILE    *yyin;

powered by: WebSVN 2.1.0

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