summaryrefslogtreecommitdiffstats
path: root/src/glsl/pp/sl_pp_macro.c
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2009-06-26 11:44:43 +0200
committerMichal Krol <[email protected]>2009-09-07 10:11:50 +0200
commit3b027bca9d54383b2fc8b2ad5a9cb6d2166c7acc (patch)
treeb7a9904765a0ff67e1c50705bae0fc7975c46b6e /src/glsl/pp/sl_pp_macro.c
parent3bb446ba6e890bc3f60a34318a5a0fe860e53cbb (diff)
glsl: Support if preprocessor directive and friends.
Diffstat (limited to 'src/glsl/pp/sl_pp_macro.c')
-rw-r--r--src/glsl/pp/sl_pp_macro.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/glsl/pp/sl_pp_macro.c b/src/glsl/pp/sl_pp_macro.c
index 0138270c67b..a8412f0651c 100644
--- a/src/glsl/pp/sl_pp_macro.c
+++ b/src/glsl/pp/sl_pp_macro.c
@@ -78,7 +78,8 @@ sl_pp_macro_expand(struct sl_pp_context *context,
const struct sl_pp_token_info *input,
unsigned int *pi,
struct sl_pp_macro *local,
- struct sl_pp_process_state *state)
+ struct sl_pp_process_state *state,
+ int mute)
{
int macro_name;
struct sl_pp_macro *macro = NULL;
@@ -108,8 +109,10 @@ sl_pp_macro_expand(struct sl_pp_context *context,
}
if (!macro) {
- if (sl_pp_process_out(state, &input[*pi])) {
- return -1;
+ if (!mute) {
+ if (sl_pp_process_out(state, &input[*pi])) {
+ return -1;
+ }
}
(*pi)++;
return 0;
@@ -244,8 +247,15 @@ sl_pp_macro_expand(struct sl_pp_context *context,
for (j = 0;;) {
switch (macro->body[j].token) {
+ case SL_PP_NEWLINE:
+ if (sl_pp_process_out(state, &macro->body[j])) {
+ return -1;
+ }
+ j++;
+ break;
+
case SL_PP_IDENTIFIER:
- if (sl_pp_macro_expand(context, macro->body, &j, actual_arg, state)) {
+ if (sl_pp_macro_expand(context, macro->body, &j, actual_arg, state, mute)) {
return -1;
}
break;
@@ -255,8 +265,10 @@ sl_pp_macro_expand(struct sl_pp_context *context,
return 0;
default:
- if (sl_pp_process_out(state, &macro->body[j])) {
- return -1;
+ if (!mute) {
+ if (sl_pp_process_out(state, &macro->body[j])) {
+ return -1;
+ }
}
j++;
}