mojoshader_compiler.c
changeset 716 94a804b54078
parent 714 e8ed66bfff18
child 721 82d1aec6b549
equal deleted inserted replaced
715:817d02ae5c4b 716:94a804b54078
     6     Preprocessor *preprocessor;
     6     Preprocessor *preprocessor;
     7     const char *token;      // assembler token!
     7     const char *token;      // assembler token!
     8     unsigned int tokenlen;  // assembler token!
     8     unsigned int tokenlen;  // assembler token!
     9     Token tokenval;         // assembler token!
     9     Token tokenval;         // assembler token!
    10 } Context;
    10 } Context;
       
    11 
       
    12 #if DEBUG_COMPILER_PARSER
       
    13 #define LEMON_SUPPORT_TRACING 1
       
    14 #endif
    11 
    15 
    12 #define __MOJOSHADER_HLSL_COMPILER__ 1
    16 #define __MOJOSHADER_HLSL_COMPILER__ 1
    13 #include "mojoshader_parser_hlsl.h"
    17 #include "mojoshader_parser_hlsl.h"
    14 
    18 
    15 static int ConvertToLemonToken(const Context *ctx)
    19 static int ConvertToLemonToken(const Context *ctx)
   128     ctx.preprocessor = preprocessor_start(filename, source, sourcelen,
   132     ctx.preprocessor = preprocessor_start(filename, source, sourcelen,
   129                                            include_open, include_close,
   133                                            include_open, include_close,
   130                                            defines, define_count, 0, m, f, d);
   134                                            defines, define_count, 0, m, f, d);
   131 
   135 
   132     void *pParser = ParseHLSLAlloc(m, d);
   136     void *pParser = ParseHLSLAlloc(m, d);
   133     ParseHLSLTrace(stdout, "TRACE: ");
   137 
       
   138     #if DEBUG_COMPILER_PARSER
       
   139     ParseHLSLTrace(stdout, "COMPILER: ");
       
   140     #endif
   134 
   141 
   135     do {
   142     do {
   136         ctx.token = preprocessor_nexttoken(ctx.preprocessor,
   143         ctx.token = preprocessor_nexttoken(ctx.preprocessor,
   137                                                 &ctx.tokenlen,
   144                                                 &ctx.tokenlen,
   138                                                 &ctx.tokenval);
   145                                                 &ctx.tokenval);