mojoshader_preprocessor.c
changeset 583 9c966b751fd6
parent 582 637dcfff28d8
child 586 321a19a62989
equal deleted inserted replaced
582:637dcfff28d8 583:9c966b751fd6
   657         // Microsoft's preprocessor is weird.
   657         // Microsoft's preprocessor is weird.
   658         // It ignores newlines, and then inserts its own around certain
   658         // It ignores newlines, and then inserts its own around certain
   659         //  tokens. For example, after a semicolon. This allows HLSL code to
   659         //  tokens. For example, after a semicolon. This allows HLSL code to
   660         //  be mostly readable, instead of a stream of tokens.
   660         //  be mostly readable, instead of a stream of tokens.
   661         if (token == ((Token) '\n'))
   661         if (token == ((Token) '\n'))
   662             ; // ignore.
   662             isnewline = nl;  // this doesn't actually care about '\n' ...
   663 
   663 
   664         else if ( (token == ((Token) '}')) || (token == ((Token) ';')) )
   664         else if ( (token == ((Token) '}')) || (token == ((Token) ';')) )
   665         {
   665         {
   666             if (!out_of_memory)
   666             if (!out_of_memory)
   667             {
   667             {
   681         {
   681         {
   682             if (!out_of_memory)
   682             if (!out_of_memory)
   683             {
   683             {
   684                 out_of_memory =
   684                 out_of_memory =
   685                     (!add_to_buffer(&buffer,endline,sizeof (endline),m,d)) ||
   685                     (!add_to_buffer(&buffer,endline,sizeof (endline),m,d)) ||
       
   686                     (!indent_buffer(&buffer, indent, 1, m, d)) ||
   686                     (!add_to_buffer(&buffer, "{", 1, m, d)) ||
   687                     (!add_to_buffer(&buffer, "{", 1, m, d)) ||
   687                     (!add_to_buffer(&buffer,endline,sizeof (endline),m,d));
   688                     (!add_to_buffer(&buffer,endline,sizeof (endline),m,d));
   688                 indent++;
   689                 indent++;
   689                 isnewline = 1;
   690                 isnewline = 1;
   690             } // if
   691             } // if