File tree Expand file tree Collapse file tree 3 files changed +18
-18
lines changed
Expand file tree Collapse file tree 3 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -6,15 +6,15 @@ TEMP dark;
66
77TEX input, fragment.texcoord[0], texture[0], RECT;
88
9- # Subtract color by 0.51 => everything with more then 0.51 will have at least 0 ;
9+ # Subtract color by 0.51 => everything with more then 0.51 will have at least 0
1010SUB output.rgb, input, 0.51;
1111
12- # Create a dark color..;
12+ # Create a dark color..
1313SUB dark.rgb, input, 0.3;
14- # ..and a bright color ;
14+ # ..and a bright color
1515ADD bright.rgb, input, 0.3;
1616
17- # All colors which are < 0 (original color - 0.51 < 0) get a dark color and everything else a bright color ;
17+ # All colors which are < 0 (original color - 0.51 < 0) get a dark color and everything else a bright color
1818CMP output.rgb, output, dark, bright;
1919
2020MOV result.color, output;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ negative-lightness.frag
1212#const c1 = 4 60 360 120
1313#const c2 = 180 240 0.016666668
1414TEMP R0;
15- TEMP R0;
1615TEMP R1;
1716TEMP R2;
1817TEMP R3;
Original file line number Diff line number Diff line change @@ -352,10 +352,21 @@ programParseSource (CompFunctionData *data,
352352 source ++ ;
353353 }
354354
355- /* Strip linefeeds */
355+ /* Strip linefeeds and comments */
356356 next = source ;
357- while ((next = strstr (next , "\n" )))
358- * next = ' ' ;
357+ while ((next = strpbrk (next , "#\n\r" )))
358+ {
359+ if (* next == '#' )
360+ {
361+ char * line_end = strpbrk (next , "\r\n" );
362+ if (! line_end )
363+ * next = '\0' ;
364+ else
365+ memmove (next , line_end , strlen (line_end ) + 1 );
366+ }
367+ else
368+ * next = ' ' ;
369+ }
359370
360371 line = strtok_r (source , ";" , & strtok_ptr );
361372 /* Parse each instruction */
@@ -367,16 +378,6 @@ programParseSource (CompFunctionData *data,
367378 /* Find instruction type */
368379 type = NoOp ;
369380
370- /* Comments */
371- if (strncmp (current , "#" , 1 ) == 0 )
372- {
373- free (line );
374- line = strtok_r (NULL , ";" , & strtok_ptr );
375- continue ;
376- }
377- if ((next = strstr (current , "#" )))
378- * next = 0 ;
379-
380381 /* Data ops */
381382 if (strncmp (current , "END" , 3 ) == 0 )
382383 type = NoOp ;
You can’t perform that action at this time.
0 commit comments