mojoshader_preprocessor.c
changeset 625 bfb4016d9404
parent 624 99d1cf8a18a3
child 626 95d97e613112
equal deleted inserted replaced
624:99d1cf8a18a3 625:bfb4016d9404
   787     } // if
   787     } // if
   788 
   788 
   789     conditional->type = type;
   789     conditional->type = type;
   790     conditional->linenum = state->line - 1;
   790     conditional->linenum = state->line - 1;
   791     conditional->skipping = skipping;
   791     conditional->skipping = skipping;
       
   792     conditional->chosen = !skipping;
   792     conditional->next = prev;
   793     conditional->next = prev;
   793     state->conditional_stack = conditional;
   794     state->conditional_stack = conditional;
   794     return conditional;
   795     return conditional;
   795 } // _handle_pp_ifdef
   796 } // _handle_pp_ifdef
   796 
   797 
   818         fail(ctx, "#else without #if");
   819         fail(ctx, "#else without #if");
   819     else if (cond->type == TOKEN_PP_ELSE)
   820     else if (cond->type == TOKEN_PP_ELSE)
   820         fail(ctx, "#else after #else");
   821         fail(ctx, "#else after #else");
   821     else
   822     else
   822     {
   823     {
   823         // !!! FIXME: doesn't work for #elif
       
   824         cond->type = TOKEN_PP_ELSE;
   824         cond->type = TOKEN_PP_ELSE;
   825         cond->skipping = !cond->skipping;
   825         cond->skipping = cond->chosen;
       
   826         if (!cond->chosen)
       
   827             cond->chosen = 1;
   826     } // else
   828     } // else
   827 } // handle_pp_else
   829 } // handle_pp_else
   828 
   830 
   829 
   831 
   830 static void handle_pp_endif(Context *ctx)
   832 static void handle_pp_endif(Context *ctx)