aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-03-04 13:54:03 +0000
committermarha <marha@users.sourceforge.net>2011-03-04 13:54:03 +0000
commit0a5888393c68f6f7db86206d1f277232db18240b (patch)
tree9afe740e7b124ea8d2125ef7be0d42760d3b8e6a /mesalib/src/glsl
parent56950d7bed70ee82186f44f9333537cdbb33c448 (diff)
downloadvcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.tar.gz
vcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.tar.bz2
vcxsrv-0a5888393c68f6f7db86206d1f277232db18240b.zip
xserver xkeyboard-config mesa git update 4 Marc 2011
Diffstat (limited to 'mesalib/src/glsl')
-rw-r--r--mesalib/src/glsl/SConscript18
-rw-r--r--mesalib/src/glsl/glcpp/Makefile.am44
-rw-r--r--mesalib/src/glsl/glcpp/glcpp-lex.l49
3 files changed, 38 insertions, 73 deletions
diff --git a/mesalib/src/glsl/SConscript b/mesalib/src/glsl/SConscript
index 10abab6f9..bb02a87c7 100644
--- a/mesalib/src/glsl/SConscript
+++ b/mesalib/src/glsl/SConscript
@@ -14,10 +14,16 @@ env.Prepend(CPPPATH = [
'#src/glsl/glcpp',
])
+# Make glcpp/glcpp-parse.h and glsl_parser.h reacheable from the include path
+env.Append(CPPPATH = [Dir('.').abspath])
+
env.Append(YACCFLAGS = '-d')
-parser_env = env.Clone();
-parser_env.Append(YACCFLAGS = ['--defines=src/glsl/glsl_parser.h', '-p', '_mesa_glsl_'])
+parser_env = env.Clone()
+parser_env.Append(YACCFLAGS = [
+ '--defines=%s' % File('glsl_parser.h').abspath,
+ '-p', '_mesa_glsl_',
+])
glcpp_lexer = env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
glcpp_parser = env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
@@ -107,6 +113,10 @@ else:
'#src/mesa/program/symbol_table.c'],
)
+ # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll
+ # depends on glsl_parser.h
+ env.Depends(builtin_compiler, glsl_parser)
+
builtin_glsl_function = env.CodeGenerate(
target = 'builtin_function.cpp',
script = 'builtins/tools/generate_builtins.py',
@@ -129,6 +139,10 @@ glsl = env.ConvenienceLibrary(
source = sources,
)
+# SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
+# glsl_parser.h
+env.Depends(glsl, glsl_parser)
+
Export('glsl')
# FIXME: We can't build the programs because there's a cyclic dependency between tis directory and src/mesa
diff --git a/mesalib/src/glsl/glcpp/Makefile.am b/mesalib/src/glsl/glcpp/Makefile.am
deleted file mode 100644
index 8a3e9b007..000000000
--- a/mesalib/src/glsl/glcpp/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright © 2010 Intel Corporation
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# on the rights to use, copy, modify, merge, publish, distribute, sub
-# license, and/or sell copies of the Software, and to permit persons to whom
-# the Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-# AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
-# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-# USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-noinst_LTLIBRARIES = libglcpp.la
-libglcpp_la_SOURCES = \
- glcpp-lex.l \
- glcpp-parse.y \
- glcpp.h \
- pp.c
-
-BUILT_SOURCES = glcpp-parse.h glcpp-parse.c glcpp-lex.c
-CLEANFILES = $(BUILT_SOURCES)
-
-glcpp-parse.h: glcpp-parse.c
-
-bin_PROGRAMS = glcpp
-glcpp_LDADD = libglcpp.la
-glcpp_LDFLAGS = @LDFLAGS@ $(talloc_LIBS)
-glcpp_SOURCES = glcpp.c
-
-.l.c:
- $(LEXCOMPILE) --outfile="$@" $<
-
-test: glcpp
- @(cd tests; ./glcpp-test)
diff --git a/mesalib/src/glsl/glcpp/glcpp-lex.l b/mesalib/src/glsl/glcpp/glcpp-lex.l
index 11b73aea8..68e44eb79 100644
--- a/mesalib/src/glsl/glcpp/glcpp-lex.l
+++ b/mesalib/src/glsl/glcpp/glcpp-lex.l
@@ -57,7 +57,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner);
%option stack
%option never-interactive
-%x DONE COMMENT UNREACHABLE
+%x DONE COMMENT UNREACHABLE SKIP
SPACE [[:space:]]
NONSPACE [^[:space:]]
@@ -74,6 +74,17 @@ OCTAL_INTEGER 0[0-7]*[uU]?
HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
%%
+ /* Implicitly switch between SKIP and INITIAL (non-skipping);
+ * don't switch if some other state was explicitly set.
+ */
+ glcpp_parser_t *parser = yyextra;
+ if (YY_START == 0 || YY_START == SKIP) {
+ if (parser->lexing_if || parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) {
+ BEGIN 0;
+ } else {
+ BEGIN SKIP;
+ }
+ }
/* Single-line comments */
"//"[^\n]* {
@@ -137,60 +148,44 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
yylineno = strtol(ptr, &ptr, 0) - 1;
}
-{HASH}ifdef/.*\n {
+<SKIP,INITIAL>{
+{HASH}ifdef {
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
return HASH_IFDEF;
}
-{HASH}ifndef/.*\n {
+{HASH}ifndef {
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
return HASH_IFNDEF;
}
-{HASH}if/[^_a-zA-Z0-9].*\n {
+{HASH}if/[^_a-zA-Z0-9] {
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
return HASH_IF;
}
-{HASH}elif/.*\n {
+{HASH}elif {
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
return HASH_ELIF;
}
-{HASH}else/.*\n {
+{HASH}else {
yyextra->space_tokens = 0;
return HASH_ELSE;
}
-{HASH}endif/.*\n {
+{HASH}endif {
yyextra->space_tokens = 0;
return HASH_ENDIF;
}
-
- /* When skipping (due to an #if 0 or similar) consume anything
- * up to a newline. We do this with less priority than any
- * #if-related directive (#if, #elif, #else, #endif), but with
- * more priority than any other directive or token to avoid
- * any side-effects from skipped content.
- *
- * We use the lexing_if flag to avoid skipping any part of an
- * if conditional expression. */
-[^\n]+/\n {
- /* Since this rule always matches, YY_USER_ACTION gets called for it,
- * wrongly incrementing yycolumn. We undo that effect here. */
- yycolumn -= yyleng;
- if (yyextra->lexing_if ||
- yyextra->skip_stack == NULL ||
- yyextra->skip_stack->type == SKIP_NO_SKIP)
- {
- REJECT;
- }
}
+<SKIP>[^\n] ;
+
{HASH}error.* {
char *p;
for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */
@@ -293,7 +288,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
}
}
-\n {
+<SKIP,INITIAL>\n {
yyextra->lexing_if = 0;
yylineno++;
yycolumn = 0;