gdiplus: Fix the linesfilled calculation in GdipMeasureString.
[wine.git] / dlls / d3dx9_36 / asmshader.l
blob99af3809074f73cc8925dc8b69e0191beae22415
1 /*
2  * Direct3D shader assembler
3  *
4  * Copyright 2008 Stefan Dösinger
5  * Copyright 2009 Matteo Bruni
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
23 #include "config.h"
24 #include "wine/port.h"
25 #include "wine/debug.h"
27 #include "d3dx9_36_private.h"
28 #include "asmshader.tab.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(asmshader);
33 %option noyywrap
34 %option prefix="asmshader_"
35 %option noinput nounput
37 /* Registers */
38 REG_TEMP                r[0-9]+
39 /* for relative addressing in the form o[x], v[x] and c[x] */
40 REG_CONSTFLOAT          c[0-9]*
42 PREPROCESSORDIRECTIVE   #[^\n]*\n
44 /* Comments */
45 DOUBLESLASHCOMMENT      "//"[^\n]*
46 SEMICOLONCOMMENT        ";"[^\n]*
48 /* Whitespaces are spaces, tabs and newlines */
49 WHITESPACE              [ \t]+
50 NEWLINE                 (\n)|(\r\n)
52 COMMA                   ","
54 IMMVAL                  \-?(([0-9]+)|([0-9]*\.[0-9]+))(f)?
56 ANY                     (.)
60     /* Common instructions(vertex and pixel shaders) */
61 mov                     {return INSTR_MOV;          }
63 {REG_TEMP}              {
64                             asmshader_lval.regnum = atoi(yytext + 1);
65                             return REG_TEMP;
66                         }
67 {REG_CONSTFLOAT}        {
68                             asmshader_lval.regnum = atoi(yytext + 1);
69                             return REG_CONSTFLOAT;
70                         }
72     /* Shader versions. These are important to select the correct
73      * parser profile.
74      */
75 vs\.1\.0|vs_1_0         {return VER_VS10;       }
76 vs\.1\.1|vs_1_1         {return VER_VS11;       }
78 vs_2_0                  {return VER_VS20;       }
79 vs_2_x                  {return VER_VS2X;       }
80 vs_3_0                  {return VER_VS30;       }
82 ps\.1\.0|ps_1_0         {return VER_PS10;       }
83 ps\.1\.1|ps_1_1         {return VER_PS11;       }
84 ps\.1\.2|ps_1_2         {return VER_PS12;       }
85 ps\.1\.3|ps_1_3         {return VER_PS13;       }
86 ps\.1\.4|ps_1_4         {return VER_PS14;       }
88 ps_2_0                  {return VER_PS20;       }
89 ps_2_x                  {return VER_PS2X;       }
90 ps_3_0                  {return VER_PS30;       }
92 {COMMA}                 {return yytext[0];          }
93 -                       {return yytext[0];          }
94 \(                      {return yytext[0];          }
95 \)                      {return yytext[0];          }
97 {PREPROCESSORDIRECTIVE} {
98                             /* TODO: update current line information */
99                             TRACE("line info update: %s", yytext);
100                         }
102     /* Skip comments */
103 {DOUBLESLASHCOMMENT}    {                           }
104 {SEMICOLONCOMMENT}      {                           }
106 {WHITESPACE}            { /* Do nothing */          }
107 {NEWLINE}               {
108                             asm_ctx.line_no++;
109                         }
111 {ANY}                   {
112                             asmparser_message(&asm_ctx, "Line %u: Unexpected input %s\n", asm_ctx.line_no, yytext);
113                             set_parse_status(&asm_ctx, PARSE_ERR);
114                         }
118 struct bwriter_shader *SlAssembleShader(const char *text, char **messages) {
119     struct bwriter_shader *ret = NULL;
120     YY_BUFFER_STATE buffer;
121     TRACE("%p, %p\n", text, messages);
123     buffer = asmshader__scan_string(text);
124     asmshader__switch_to_buffer(buffer);
126     ret = parse_asm_shader(messages);
128     asmshader__delete_buffer(buffer);
130     return ret;