summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-09-18 11:19:54 +0200
committerMichal Krol <michal@vmware.com>2009-09-18 11:19:54 +0200
commit8302208b02739904cfeb5bcc22e63b15c8ec26e9 (patch)
tree52ff5304c4d1cbf1656f6408677fbd730ac8153a
parent95956bb8cb9513c429b9749426720be94f4cf5a8 (diff)
slang: Use glsl pp public interface.
-rw-r--r--src/mesa/shader/slang/slang_compile.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c
index 19fec53877..fb452e5d2c 100644
--- a/src/mesa/shader/slang/slang_compile.c
+++ b/src/mesa/shader/slang/slang_compile.c
@@ -36,10 +36,7 @@
#include "shader/prog_print.h"
#include "shader/prog_parameter.h"
#include "shader/grammar/grammar_mesa.h"
-#include "../../glsl/pp/sl_pp_context.h"
-#include "../../glsl/pp/sl_pp_purify.h"
-#include "../../glsl/pp/sl_pp_version.h"
-#include "../../glsl/pp/sl_pp_process.h"
+#include "../../glsl/pp/sl_pp_public.h"
#include "slang_codegen.h"
#include "slang_compile.h"
#include "slang_storage.h"
@@ -2583,7 +2580,7 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
const struct gl_extensions *extensions,
struct gl_sl_pragmas *pragmas)
{
- struct sl_pp_context context;
+ struct sl_pp_context *context;
struct sl_pp_token_info *tokens;
byte *prod;
GLuint size;
@@ -2601,31 +2598,32 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
return GL_FALSE;
}
- if (sl_pp_context_init(&context)) {
+ context = sl_pp_context_create();
+ if (!context) {
slang_info_log_error(infolog, "out of memory");
free(outbuf);
return GL_FALSE;
}
- if (sl_pp_tokenise(&context, outbuf, &intokens)) {
- slang_info_log_error(infolog, "%s", context.error_msg);
- sl_pp_context_destroy(&context);
+ if (sl_pp_tokenise(context, outbuf, &intokens)) {
+ slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
+ sl_pp_context_destroy(context);
free(outbuf);
return GL_FALSE;
}
free(outbuf);
- if (sl_pp_version(&context, intokens, &version, &tokens_eaten)) {
- slang_info_log_error(infolog, "%s", context.error_msg);
- sl_pp_context_destroy(&context);
+ if (sl_pp_version(context, intokens, &version, &tokens_eaten)) {
+ slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
+ sl_pp_context_destroy(context);
free(intokens);
return GL_FALSE;
}
- if (sl_pp_process(&context, &intokens[tokens_eaten], &tokens)) {
- slang_info_log_error(infolog, "%s", context.error_msg);
- sl_pp_context_destroy(&context);
+ if (sl_pp_process(context, &intokens[tokens_eaten], &tokens)) {
+ slang_info_log_error(infolog, "%s", sl_pp_context_error_message(context));
+ sl_pp_context_destroy(context);
free(intokens);
return GL_FALSE;
}
@@ -2711,15 +2709,15 @@ compile_with_grammar(grammar id, const char *source, slang_code_unit * unit,
slang_info_log_error(infolog,
"language version %.2f is not supported.",
version * 0.01);
- sl_pp_context_destroy(&context);
+ sl_pp_context_destroy(context);
free(tokens);
return GL_FALSE;
}
/* Finally check the syntax and generate its binary representation. */
- result = grammar_fast_check(id, &context, tokens, &prod, &size, 65536);
+ result = grammar_fast_check(id, context, tokens, &prod, &size, 65536);
- sl_pp_context_destroy(&context);
+ sl_pp_context_destroy(context);
free(tokens);
if (!result) {