From 1b1f43e6089bf1f78e8ff19b43a649b931fe4e31 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 16 Jun 2010 12:01:17 -0700 Subject: [PATCH] glcpp: Add support for lexing from a string. The standalone binary still reads from stdin, however. --- glcpp/glcpp-lex.l | 6 ++++++ glcpp/glcpp.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/glcpp/glcpp-lex.l b/glcpp/glcpp-lex.l index cc5f28f8f86..f736ac4d59d 100644 --- a/glcpp/glcpp-lex.l +++ b/glcpp/glcpp-lex.l @@ -201,3 +201,9 @@ NON_STARS_THEN_STARS [^*]*[*]+ } %% + +void +glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader) +{ + yy_scan_string(shader, parser->scanner); +} diff --git a/glcpp/glcpp.h b/glcpp/glcpp.h index ac103b7fb83..0d43f0b69e1 100644 --- a/glcpp/glcpp.h +++ b/glcpp/glcpp.h @@ -159,6 +159,9 @@ glcpp_parser_destroy (glcpp_parser_t *parser); int glcpp_lex_init_extra (glcpp_parser_t *parser, yyscan_t* scanner); +void +glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader); + int glcpp_lex (yyscan_t scanner); -- 2.30.2