]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Merge branch 'master' into ftepp
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 17 Nov 2012 10:34:00 +0000 (11:34 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sat, 17 Nov 2012 10:34:00 +0000 (11:34 +0100)
1  2 
Makefile
lexer.c

diff --combined Makefile
index 76439cbe02456229ab9a6cb18a700ee42ae439c6,5486dd13eaf68e5da1fca94b230d0fe904b8bc65..ad8c9411c7467b647c7e3ad2cb14de64bf07e0ff
+++ b/Makefile
@@@ -1,3 -1,7 +1,7 @@@
+ DESTDIR :=
+ PREFIX := /usr/local
+ BINDIR := $(PREFIX)/bin
  CC     ?= clang
  CFLAGS += -Wall -I. -fomit-frame-pointer -fno-stack-protector -fno-common
  #turn on tons of warnings if clang is present
@@@ -24,8 -28,7 +28,8 @@@ OBJ     = 
            code.o      \
            ast.o       \
            ir.o        \
 -          con.o
 +          con.o       \
 +          ftepp.o
  OBJ_C = main.o lexer.o parser.o
  OBJ_X = exec-standalone.o util.o con.o
  
@@@ -48,5 -51,17 +52,17 @@@ all: gmqcc qcv
  
  clean:
        rm -f *.o gmqcc qcvm
-       
  
+ $(OBJ) $(OBJ_C) $(OBJ_X): gmqcc.h
+ main.o: lexer.h
+ parser.o: ast.h lexer.h
+ ast.o: ast.h ir.h
+ ir.o: ir.h
+ install: install-gmqcc install-qcvm
+ install-gmqcc: gmqcc
+       install -d -m755          $(DESTDIR)$(BINDIR)
+       install    -m755  gmqcc   $(DESTDIR)$(BINDIR)/gmqcc
+ install-qcvm: qcvm
+       install -d -m755          $(DESTDIR)$(BINDIR)
+       install    -m755  qcvm    $(DESTDIR)$(BINDIR)/qcvm
diff --combined lexer.c
index de09bfa2f4b85848dfba2bb0b28b444b809fe8c9,513499a708bbe35a23c4e68f20cc8f09952b022c..34da7d8a97fa1cf107ceef47cb9be2a3518dc9b7
+++ b/lexer.c
@@@ -13,7 -13,10 +13,10 @@@ void lexerror(lex_file *lex, const cha
        va_list ap;
  
        va_start(ap, fmt);
-     con_vprintmsg(LVL_ERROR, lex->name, lex->sline, "parse error", fmt, ap);
+       if (lex)
+         con_vprintmsg(LVL_ERROR, lex->name, lex->sline, "parse error", fmt, ap);
+     else
+         con_vprintmsg(LVL_ERROR, "", 0, "parse error", fmt, ap);
        va_end(ap);
  }
  
@@@ -412,17 -415,13 +415,17 @@@ static int lex_skipwhite(lex_file *lex
  
                  if (lex->flags.preprocessing) {
                      haswhite = true;
 +                    /*
                      lex_tokench(lex, '/');
                      lex_tokench(lex, '/');
 +                    */
 +                    lex_tokench(lex, ' ');
 +                    lex_tokench(lex, ' ');
                  }
  
                  while (ch != EOF && ch != '\n') {
                      if (lex->flags.preprocessing)
 -                        lex_tokench(lex, ch);
 +                        lex_tokench(lex, ' '); /* ch); */
                      ch = lex_getch(lex);
                  }
                  if (lex->flags.preprocessing) {
                  /* multiline comment */
                  if (lex->flags.preprocessing) {
                      haswhite = true;
 +                    /*
                      lex_tokench(lex, '/');
                      lex_tokench(lex, '*');
 +                    */
 +                    lex_tokench(lex, ' ');
 +                    lex_tokench(lex, ' ');
                  }
  
                  while (ch != EOF)
                          ch = lex_getch(lex);
                          if (ch == '/') {
                              if (lex->flags.preprocessing) {
 +                                /*
                                  lex_tokench(lex, '*');
                                  lex_tokench(lex, '/');
 +                                */
 +                                lex_tokench(lex, ' ');
 +                                lex_tokench(lex, ' ');
                              }
                              break;
                          }
                      }
                      if (lex->flags.preprocessing) {
 -                        lex_tokench(lex, ch);
 +                        lex_tokench(lex, ' '); /* ch); */
                      }
                  }
                  ch = ' '; /* cause TRUE in the isspace check */
@@@ -687,21 -678,7 +690,21 @@@ int lex_do(lex_file *lex
          return TOKEN_FATAL;
  #endif
  
 -    ch = lex_skipwhite(lex);
 +    while (true) {
 +        ch = lex_skipwhite(lex);
 +        if (!lex->flags.mergelines || ch != '\\')
 +            break;
 +        ch = lex_getch(lex);
 +        if (ch != '\n') {
 +            lex_ungetch(lex, ch);
 +            ch = '\\';
 +            break;
 +        }
 +        /* we reached a linemerge */
 +        lex_tokench(lex, '\n');
 +        continue;
 +    }
 +
      lex->sline = lex->line;
      lex->tok.ctx.line = lex->sline;
      lex->tok.ctx.file = lex->name;
                  return (lex->tok.ttype = TOKEN_OPERATOR);
          case ')':
          case ';':
 +        case ':':
          case '{':
          case '}':
          case ']':