mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 18:31:26 +00:00
[D3DCOMPILER_43] Sync with Wine Staging 4.18. CORE-16441
This commit is contained in:
parent
3c0800ac94
commit
dffb99c172
30 changed files with 16251 additions and 3140 deletions
|
@ -8,14 +8,11 @@ spec2def(d3dcompiler_43.dll d3dcompiler_43.spec ADD_IMPORTLIB)
|
|||
|
||||
list(APPEND SOURCE
|
||||
asmparser.c
|
||||
asmshader.tab.c
|
||||
asmshader.yy.c
|
||||
blob.c
|
||||
bytecodewriter.c
|
||||
compiler.c
|
||||
hlsl.tab.c
|
||||
hlsl.yy.c
|
||||
main.c
|
||||
preproc.c
|
||||
reflection.c
|
||||
utils.c
|
||||
precomp.h
|
||||
|
@ -23,6 +20,12 @@ list(APPEND SOURCE
|
|||
|
||||
add_library(d3dcompiler_43 MODULE
|
||||
${SOURCE}
|
||||
asmshader.tab.c
|
||||
asmshader.yy.c
|
||||
hlsl.tab.c
|
||||
hlsl.yy.c
|
||||
ppy.tab.c
|
||||
ppl.yy.c
|
||||
version.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/d3dcompiler_43.def)
|
||||
|
||||
|
@ -32,11 +35,13 @@ set_source_files_properties(
|
|||
asmshader.yy.c
|
||||
hlsl.tab.c
|
||||
hlsl.yy.c
|
||||
ppy.tab.c
|
||||
ppl.yy.c
|
||||
PROPERTIES COMPILE_FLAGS "-UREACTOS_SOURCE_DIR -DREACTOS_SOURCE_DIR=\"\\\".\\\"\"")
|
||||
|
||||
set_module_type(d3dcompiler_43 win32dll)
|
||||
target_link_libraries(d3dcompiler_43 dx10guid uuid wine wpp)
|
||||
add_importlibs(d3dcompiler_43 msvcrt kernel32 ntdll)
|
||||
add_dependencies(d3dcompiler_43 d3d_idl_headers)
|
||||
#add_pch(d3dcompiler_43 precomp.h SOURCE)
|
||||
add_pch(d3dcompiler_43 precomp.h SOURCE)
|
||||
add_cd_file(TARGET d3dcompiler_43 DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "d3dcompiler_private.h"
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*/
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "d3dcompiler_private.h"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,9 @@
|
|||
/* A Bison parser, made by GNU Bison 3.0.2. */
|
||||
/* A Bison parser, made by GNU Bison 3.4.1. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,8 +31,11 @@
|
|||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_ASMSHADER_ASMSHADER_TAB_H_INCLUDED
|
||||
# define YY_ASMSHADER_ASMSHADER_TAB_H_INCLUDED
|
||||
/* Undocumented macros, especially those whose name start with YY_,
|
||||
are private implementation details. Do not rely on them. */
|
||||
|
||||
#ifndef YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED
|
||||
# define YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
|
@ -210,10 +214,9 @@ extern int asmshader_debug;
|
|||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 70 "asmshader.y" /* yacc.c:1909 */
|
||||
#line 68 "asmshader.y"
|
||||
|
||||
struct {
|
||||
float val;
|
||||
|
@ -248,8 +251,10 @@ union YYSTYPE
|
|||
struct rel_reg rel_reg;
|
||||
struct src_regs sregs;
|
||||
|
||||
#line 252 "asmshader.tab.h" /* yacc.c:1909 */
|
||||
#line 255 "asmshader.tab.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
@ -259,4 +264,4 @@ extern YYSTYPE asmshader_lval;
|
|||
|
||||
int asmshader_parse (void);
|
||||
|
||||
#endif /* !YY_ASMSHADER_ASMSHADER_TAB_H_INCLUDED */
|
||||
#endif /* !YY_ASMSHADER_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_ASMSHADER_TAB_H_INCLUDED */
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*/
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "d3dcompiler_private.h"
|
||||
|
@ -30,13 +28,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(asmshader);
|
|||
|
||||
struct asm_parser asm_ctx;
|
||||
|
||||
void asmparser_message(struct asm_parser *ctx, const char *fmt, ...)
|
||||
void WINAPIV asmparser_message(struct asm_parser *ctx, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
__ms_va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
__ms_va_start(args, fmt);
|
||||
compilation_message(&ctx->messages, fmt, args);
|
||||
va_end(args);
|
||||
__ms_va_end(args);
|
||||
}
|
||||
|
||||
static void asmshader_error(char const *s) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
711
dll/directx/wine/d3dcompiler_43/asmshader.yy.h
Normal file
711
dll/directx/wine/d3dcompiler_43/asmshader.yy.h
Normal file
|
@ -0,0 +1,711 @@
|
|||
#ifndef asmshader_HEADER_H
|
||||
#define asmshader_HEADER_H 1
|
||||
#define asmshader_IN_HEADER 1
|
||||
|
||||
#line 5 "asmshader.yy.h"
|
||||
|
||||
#line 7 "asmshader.yy.h"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 6
|
||||
#define YY_FLEX_SUBMINOR_VERSION 4
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
||||
#ifdef yy_create_buffer
|
||||
#define asmshader__create_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_create_buffer asmshader__create_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_delete_buffer
|
||||
#define asmshader__delete_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_delete_buffer asmshader__delete_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_buffer
|
||||
#define asmshader__scan_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_buffer asmshader__scan_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_string
|
||||
#define asmshader__scan_string_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_string asmshader__scan_string
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_bytes
|
||||
#define asmshader__scan_bytes_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_bytes asmshader__scan_bytes
|
||||
#endif
|
||||
|
||||
#ifdef yy_init_buffer
|
||||
#define asmshader__init_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_init_buffer asmshader__init_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_flush_buffer
|
||||
#define asmshader__flush_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_flush_buffer asmshader__flush_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_load_buffer_state
|
||||
#define asmshader__load_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_load_buffer_state asmshader__load_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yy_switch_to_buffer
|
||||
#define asmshader__switch_to_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_switch_to_buffer asmshader__switch_to_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yypush_buffer_state
|
||||
#define asmshader_push_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yypush_buffer_state asmshader_push_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yypop_buffer_state
|
||||
#define asmshader_pop_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yypop_buffer_state asmshader_pop_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yyensure_buffer_stack
|
||||
#define asmshader_ensure_buffer_stack_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyensure_buffer_stack asmshader_ensure_buffer_stack
|
||||
#endif
|
||||
|
||||
#ifdef yylex
|
||||
#define asmshader_lex_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex asmshader_lex
|
||||
#endif
|
||||
|
||||
#ifdef yyrestart
|
||||
#define asmshader_restart_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyrestart asmshader_restart
|
||||
#endif
|
||||
|
||||
#ifdef yylex_init
|
||||
#define asmshader_lex_init_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_init asmshader_lex_init
|
||||
#endif
|
||||
|
||||
#ifdef yylex_init_extra
|
||||
#define asmshader_lex_init_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_init_extra asmshader_lex_init_extra
|
||||
#endif
|
||||
|
||||
#ifdef yylex_destroy
|
||||
#define asmshader_lex_destroy_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_destroy asmshader_lex_destroy
|
||||
#endif
|
||||
|
||||
#ifdef yyget_debug
|
||||
#define asmshader_get_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_debug asmshader_get_debug
|
||||
#endif
|
||||
|
||||
#ifdef yyset_debug
|
||||
#define asmshader_set_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_debug asmshader_set_debug
|
||||
#endif
|
||||
|
||||
#ifdef yyget_extra
|
||||
#define asmshader_get_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_extra asmshader_get_extra
|
||||
#endif
|
||||
|
||||
#ifdef yyset_extra
|
||||
#define asmshader_set_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_extra asmshader_set_extra
|
||||
#endif
|
||||
|
||||
#ifdef yyget_in
|
||||
#define asmshader_get_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_in asmshader_get_in
|
||||
#endif
|
||||
|
||||
#ifdef yyset_in
|
||||
#define asmshader_set_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_in asmshader_set_in
|
||||
#endif
|
||||
|
||||
#ifdef yyget_out
|
||||
#define asmshader_get_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_out asmshader_get_out
|
||||
#endif
|
||||
|
||||
#ifdef yyset_out
|
||||
#define asmshader_set_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_out asmshader_set_out
|
||||
#endif
|
||||
|
||||
#ifdef yyget_leng
|
||||
#define asmshader_get_leng_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_leng asmshader_get_leng
|
||||
#endif
|
||||
|
||||
#ifdef yyget_text
|
||||
#define asmshader_get_text_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_text asmshader_get_text
|
||||
#endif
|
||||
|
||||
#ifdef yyget_lineno
|
||||
#define asmshader_get_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_lineno asmshader_get_lineno
|
||||
#endif
|
||||
|
||||
#ifdef yyset_lineno
|
||||
#define asmshader_set_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_lineno asmshader_set_lineno
|
||||
#endif
|
||||
|
||||
#ifdef yywrap
|
||||
#define asmshader_wrap_ALREADY_DEFINED
|
||||
#else
|
||||
#define yywrap asmshader_wrap
|
||||
#endif
|
||||
|
||||
#ifdef yyalloc
|
||||
#define asmshader_alloc_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyalloc asmshader_alloc
|
||||
#endif
|
||||
|
||||
#ifdef yyrealloc
|
||||
#define asmshader_realloc_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyrealloc asmshader_realloc
|
||||
#endif
|
||||
|
||||
#ifdef yyfree
|
||||
#define asmshader_free_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyfree asmshader_free
|
||||
#endif
|
||||
|
||||
#ifdef yytext
|
||||
#define asmshader_text_ALREADY_DEFINED
|
||||
#else
|
||||
#define yytext asmshader_text
|
||||
#endif
|
||||
|
||||
#ifdef yyleng
|
||||
#define asmshader_leng_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyleng asmshader_leng
|
||||
#endif
|
||||
|
||||
#ifdef yyin
|
||||
#define asmshader_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyin asmshader_in
|
||||
#endif
|
||||
|
||||
#ifdef yyout
|
||||
#define asmshader_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyout asmshader_out
|
||||
#endif
|
||||
|
||||
#ifdef yy_flex_debug
|
||||
#define asmshader__flex_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_flex_debug asmshader__flex_debug
|
||||
#endif
|
||||
|
||||
#ifdef yylineno
|
||||
#define asmshader_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylineno asmshader_lineno
|
||||
#endif
|
||||
|
||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
||||
|
||||
/* begin standard C headers. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* end standard C headers. */
|
||||
|
||||
/* flex integer type definitions */
|
||||
|
||||
#ifndef FLEXINT_H
|
||||
#define FLEXINT_H
|
||||
|
||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
typedef int8_t flex_int8_t;
|
||||
typedef uint8_t flex_uint8_t;
|
||||
typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
#define INT8_MIN (-128)
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
#define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
#ifndef INT32_MIN
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#endif
|
||||
#ifndef INT8_MAX
|
||||
#define INT8_MAX (127)
|
||||
#endif
|
||||
#ifndef INT16_MAX
|
||||
#define INT16_MAX (32767)
|
||||
#endif
|
||||
#ifndef INT32_MAX
|
||||
#define INT32_MAX (2147483647)
|
||||
#endif
|
||||
#ifndef UINT8_MAX
|
||||
#define UINT8_MAX (255U)
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
#define UINT16_MAX (65535U)
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
#define SIZE_MAX (~(size_t)0)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
/* begin standard C++ headers. */
|
||||
|
||||
/* TODO: this is always defined, so inline it */
|
||||
#define yyconst const
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
#define yynoreturn __attribute__((__noreturn__))
|
||||
#else
|
||||
#define yynoreturn
|
||||
#endif
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
||||
#define YY_TYPEDEF_YY_BUFFER_STATE
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
extern int yyleng;
|
||||
|
||||
extern FILE *yyin, *yyout;
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
{
|
||||
FILE *yy_input_file;
|
||||
|
||||
char *yy_ch_buf; /* input buffer */
|
||||
char *yy_buf_pos; /* current position in input buffer */
|
||||
|
||||
/* Size of input buffer in bytes, not including room for EOB
|
||||
* characters.
|
||||
*/
|
||||
int yy_buf_size;
|
||||
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
int yy_n_chars;
|
||||
|
||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
||||
* and can realloc() it to grow it, and should free() it to
|
||||
* delete it.
|
||||
*/
|
||||
int yy_is_our_buffer;
|
||||
|
||||
/* Whether this is an "interactive" input source; if so, and
|
||||
* if we're using stdio for input, then we want to use getc()
|
||||
* instead of fread(), to make sure we stop fetching input after
|
||||
* each newline.
|
||||
*/
|
||||
int yy_is_interactive;
|
||||
|
||||
/* Whether we're considered to be at the beginning of a line.
|
||||
* If so, '^' rules will be active on the next match, otherwise
|
||||
* not.
|
||||
*/
|
||||
int yy_at_bol;
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
int yy_fill_buffer;
|
||||
|
||||
int yy_buffer_status;
|
||||
|
||||
};
|
||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||
|
||||
void yyrestart ( FILE *input_file );
|
||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
void yy_flush_buffer ( YY_BUFFER_STATE b );
|
||||
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
|
||||
void yypop_buffer_state ( void );
|
||||
|
||||
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
|
||||
YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
|
||||
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
|
||||
|
||||
void *yyalloc ( yy_size_t );
|
||||
void *yyrealloc ( void *, yy_size_t );
|
||||
void yyfree ( void * );
|
||||
|
||||
/* Begin user sect3 */
|
||||
|
||||
#define asmshader_wrap() (/*CONSTCOND*/1)
|
||||
#define YY_SKIP_YYWRAP
|
||||
|
||||
extern int yylineno;
|
||||
|
||||
extern char *yytext;
|
||||
#ifdef yytext_ptr
|
||||
#undef yytext_ptr
|
||||
#endif
|
||||
#define yytext_ptr yytext
|
||||
|
||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
||||
#define INITIAL 0
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNISTD_H
|
||||
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
||||
* down here because we want the user's section 1 to have been scanned first.
|
||||
* The user has a chance to override it with an option.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef YY_EXTRA_TYPE
|
||||
#define YY_EXTRA_TYPE void *
|
||||
#endif
|
||||
|
||||
/* Accessor methods to globals.
|
||||
These are made visible to non-reentrant scanners for convenience. */
|
||||
|
||||
int yylex_destroy ( void );
|
||||
|
||||
int yyget_debug ( void );
|
||||
|
||||
void yyset_debug ( int debug_flag );
|
||||
|
||||
YY_EXTRA_TYPE yyget_extra ( void );
|
||||
|
||||
void yyset_extra ( YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *yyget_in ( void );
|
||||
|
||||
void yyset_in ( FILE * _in_str );
|
||||
|
||||
FILE *yyget_out ( void );
|
||||
|
||||
void yyset_out ( FILE * _out_str );
|
||||
|
||||
int yyget_leng ( void );
|
||||
|
||||
char *yyget_text ( void );
|
||||
|
||||
int yyget_lineno ( void );
|
||||
|
||||
void yyset_lineno ( int _line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
|
||||
#ifndef YY_SKIP_YYWRAP
|
||||
#ifdef __cplusplus
|
||||
extern "C" int yywrap ( void );
|
||||
#else
|
||||
extern int yywrap ( void );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy ( char *, const char *, int );
|
||||
#endif
|
||||
|
||||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen ( const char * );
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
|
||||
#endif
|
||||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Number of entries by which start-condition stack grows. */
|
||||
#ifndef YY_START_STACK_INCR
|
||||
#define YY_START_STACK_INCR 25
|
||||
#endif
|
||||
|
||||
/* Default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters.
|
||||
*/
|
||||
#ifndef YY_DECL
|
||||
#define YY_DECL_IS_OURS 1
|
||||
|
||||
extern int yylex (void);
|
||||
|
||||
#define YY_DECL int yylex (void)
|
||||
#endif /* !YY_DECL */
|
||||
|
||||
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
||||
|
||||
#undef YY_NEW_FILE
|
||||
#undef YY_FLUSH_BUFFER
|
||||
#undef yy_set_bol
|
||||
#undef yy_new_buffer
|
||||
#undef yy_set_interactive
|
||||
#undef YY_DO_BEFORE_ACTION
|
||||
|
||||
#ifdef YY_DECL_IS_OURS
|
||||
#undef YY_DECL_IS_OURS
|
||||
#undef YY_DECL
|
||||
#endif
|
||||
|
||||
#ifndef asmshader__create_buffer_ALREADY_DEFINED
|
||||
#undef yy_create_buffer
|
||||
#endif
|
||||
#ifndef asmshader__delete_buffer_ALREADY_DEFINED
|
||||
#undef yy_delete_buffer
|
||||
#endif
|
||||
#ifndef asmshader__scan_buffer_ALREADY_DEFINED
|
||||
#undef yy_scan_buffer
|
||||
#endif
|
||||
#ifndef asmshader__scan_string_ALREADY_DEFINED
|
||||
#undef yy_scan_string
|
||||
#endif
|
||||
#ifndef asmshader__scan_bytes_ALREADY_DEFINED
|
||||
#undef yy_scan_bytes
|
||||
#endif
|
||||
#ifndef asmshader__init_buffer_ALREADY_DEFINED
|
||||
#undef yy_init_buffer
|
||||
#endif
|
||||
#ifndef asmshader__flush_buffer_ALREADY_DEFINED
|
||||
#undef yy_flush_buffer
|
||||
#endif
|
||||
#ifndef asmshader__load_buffer_state_ALREADY_DEFINED
|
||||
#undef yy_load_buffer_state
|
||||
#endif
|
||||
#ifndef asmshader__switch_to_buffer_ALREADY_DEFINED
|
||||
#undef yy_switch_to_buffer
|
||||
#endif
|
||||
#ifndef asmshader_push_buffer_state_ALREADY_DEFINED
|
||||
#undef yypush_buffer_state
|
||||
#endif
|
||||
#ifndef asmshader_pop_buffer_state_ALREADY_DEFINED
|
||||
#undef yypop_buffer_state
|
||||
#endif
|
||||
#ifndef asmshader_ensure_buffer_stack_ALREADY_DEFINED
|
||||
#undef yyensure_buffer_stack
|
||||
#endif
|
||||
#ifndef asmshader_lex_ALREADY_DEFINED
|
||||
#undef yylex
|
||||
#endif
|
||||
#ifndef asmshader_restart_ALREADY_DEFINED
|
||||
#undef yyrestart
|
||||
#endif
|
||||
#ifndef asmshader_lex_init_ALREADY_DEFINED
|
||||
#undef yylex_init
|
||||
#endif
|
||||
#ifndef asmshader_lex_init_extra_ALREADY_DEFINED
|
||||
#undef yylex_init_extra
|
||||
#endif
|
||||
#ifndef asmshader_lex_destroy_ALREADY_DEFINED
|
||||
#undef yylex_destroy
|
||||
#endif
|
||||
#ifndef asmshader_get_debug_ALREADY_DEFINED
|
||||
#undef yyget_debug
|
||||
#endif
|
||||
#ifndef asmshader_set_debug_ALREADY_DEFINED
|
||||
#undef yyset_debug
|
||||
#endif
|
||||
#ifndef asmshader_get_extra_ALREADY_DEFINED
|
||||
#undef yyget_extra
|
||||
#endif
|
||||
#ifndef asmshader_set_extra_ALREADY_DEFINED
|
||||
#undef yyset_extra
|
||||
#endif
|
||||
#ifndef asmshader_get_in_ALREADY_DEFINED
|
||||
#undef yyget_in
|
||||
#endif
|
||||
#ifndef asmshader_set_in_ALREADY_DEFINED
|
||||
#undef yyset_in
|
||||
#endif
|
||||
#ifndef asmshader_get_out_ALREADY_DEFINED
|
||||
#undef yyget_out
|
||||
#endif
|
||||
#ifndef asmshader_set_out_ALREADY_DEFINED
|
||||
#undef yyset_out
|
||||
#endif
|
||||
#ifndef asmshader_get_leng_ALREADY_DEFINED
|
||||
#undef yyget_leng
|
||||
#endif
|
||||
#ifndef asmshader_get_text_ALREADY_DEFINED
|
||||
#undef yyget_text
|
||||
#endif
|
||||
#ifndef asmshader_get_lineno_ALREADY_DEFINED
|
||||
#undef yyget_lineno
|
||||
#endif
|
||||
#ifndef asmshader_set_lineno_ALREADY_DEFINED
|
||||
#undef yyset_lineno
|
||||
#endif
|
||||
#ifndef asmshader_get_column_ALREADY_DEFINED
|
||||
#undef yyget_column
|
||||
#endif
|
||||
#ifndef asmshader_set_column_ALREADY_DEFINED
|
||||
#undef yyset_column
|
||||
#endif
|
||||
#ifndef asmshader_wrap_ALREADY_DEFINED
|
||||
#undef yywrap
|
||||
#endif
|
||||
#ifndef asmshader_get_lval_ALREADY_DEFINED
|
||||
#undef yyget_lval
|
||||
#endif
|
||||
#ifndef asmshader_set_lval_ALREADY_DEFINED
|
||||
#undef yyset_lval
|
||||
#endif
|
||||
#ifndef asmshader_get_lloc_ALREADY_DEFINED
|
||||
#undef yyget_lloc
|
||||
#endif
|
||||
#ifndef asmshader_set_lloc_ALREADY_DEFINED
|
||||
#undef yyset_lloc
|
||||
#endif
|
||||
#ifndef asmshader_alloc_ALREADY_DEFINED
|
||||
#undef yyalloc
|
||||
#endif
|
||||
#ifndef asmshader_realloc_ALREADY_DEFINED
|
||||
#undef yyrealloc
|
||||
#endif
|
||||
#ifndef asmshader_free_ALREADY_DEFINED
|
||||
#undef yyfree
|
||||
#endif
|
||||
#ifndef asmshader_text_ALREADY_DEFINED
|
||||
#undef yytext
|
||||
#endif
|
||||
#ifndef asmshader_leng_ALREADY_DEFINED
|
||||
#undef yyleng
|
||||
#endif
|
||||
#ifndef asmshader_in_ALREADY_DEFINED
|
||||
#undef yyin
|
||||
#endif
|
||||
#ifndef asmshader_out_ALREADY_DEFINED
|
||||
#undef yyout
|
||||
#endif
|
||||
#ifndef asmshader__flex_debug_ALREADY_DEFINED
|
||||
#undef yy_flex_debug
|
||||
#endif
|
||||
#ifndef asmshader_lineno_ALREADY_DEFINED
|
||||
#undef yylineno
|
||||
#endif
|
||||
#ifndef asmshader_tables_fload_ALREADY_DEFINED
|
||||
#undef yytables_fload
|
||||
#endif
|
||||
#ifndef asmshader_tables_destroy_ALREADY_DEFINED
|
||||
#undef yytables_destroy
|
||||
#endif
|
||||
#ifndef asmshader_TABLES_NAME_ALREADY_DEFINED
|
||||
#undef yyTABLES_NAME
|
||||
#endif
|
||||
|
||||
#line 485 "asmshader.l"
|
||||
|
||||
|
||||
#line 709 "asmshader.yy.h"
|
||||
#undef asmshader_IN_HEADER
|
||||
#endif /* asmshader_HEADER_H */
|
|
@ -19,9 +19,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include "d3dcompiler_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
|
||||
|
@ -466,9 +463,55 @@ HRESULT WINAPI D3DStripShader(const void *data, SIZE_T data_size, UINT flags, ID
|
|||
|
||||
HRESULT WINAPI D3DReadFileToBlob(const WCHAR *filename, ID3DBlob **contents)
|
||||
{
|
||||
FIXME("filename %s, contents %p\n", debugstr_w(filename), contents);
|
||||
struct d3dcompiler_blob *object;
|
||||
SIZE_T data_size;
|
||||
DWORD read_size;
|
||||
HANDLE file;
|
||||
HRESULT hr;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("filename %s, contents %p.\n", debugstr_w(filename), contents);
|
||||
|
||||
file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (file == INVALID_HANDLE_VALUE)
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
|
||||
data_size = GetFileSize(file, NULL);
|
||||
if (data_size == INVALID_FILE_SIZE)
|
||||
{
|
||||
CloseHandle(file);
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
{
|
||||
CloseHandle(file);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
if (FAILED(hr = d3dcompiler_blob_init(object, data_size)))
|
||||
{
|
||||
WARN("Failed to initialize blob, hr %#x.\n", hr);
|
||||
CloseHandle(file);
|
||||
heap_free(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (!ReadFile(file, object->data, data_size, &read_size, NULL) || (read_size != data_size))
|
||||
{
|
||||
WARN("Failed to read file contents.\n");
|
||||
CloseHandle(file);
|
||||
heap_free(object->data);
|
||||
heap_free(object);
|
||||
return E_FAIL;
|
||||
}
|
||||
CloseHandle(file);
|
||||
object->size = read_size;
|
||||
|
||||
*contents = &object->ID3DBlob_iface;
|
||||
|
||||
TRACE("Returning ID3DBlob %p.\n", *contents);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI D3DWriteBlobToFile(ID3DBlob* blob, const WCHAR *filename, BOOL overwrite)
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "d3d9types.h"
|
||||
|
|
|
@ -18,13 +18,12 @@
|
|||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#include "d3dcompiler_private.h"
|
||||
#include "wine/wpp.h"
|
||||
#include "wpp_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
|
||||
|
||||
|
@ -61,6 +60,15 @@ static int wpp_output_capacity, wpp_output_size;
|
|||
static char *wpp_messages;
|
||||
static int wpp_messages_capacity, wpp_messages_size;
|
||||
|
||||
struct define
|
||||
{
|
||||
struct define *next;
|
||||
char *name;
|
||||
char *value;
|
||||
};
|
||||
|
||||
static struct define *cmdline_defines;
|
||||
|
||||
/* Mutex used to guarantee a single invocation
|
||||
of the D3DXAssembleShader function (or its variants) at a time.
|
||||
This is needed as wpp isn't thread-safe */
|
||||
|
@ -75,7 +83,7 @@ static CRITICAL_SECTION_DEBUG wpp_mutex_debug =
|
|||
static CRITICAL_SECTION wpp_mutex = { &wpp_mutex_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
/* Preprocessor error reporting functions */
|
||||
static void wpp_write_message(const char *fmt, va_list args)
|
||||
static void wpp_write_message(const char *fmt, __ms_va_list args)
|
||||
{
|
||||
char* newbuffer;
|
||||
int rc, newsize;
|
||||
|
@ -115,35 +123,43 @@ static void wpp_write_message(const char *fmt, va_list args)
|
|||
}
|
||||
}
|
||||
|
||||
static void PRINTF_ATTR(1,2) wpp_write_message_var(const char *fmt, ...)
|
||||
static void WINAPIV PRINTF_ATTR(1,2) wpp_write_message_var(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
__ms_va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
__ms_va_start(args, fmt);
|
||||
wpp_write_message(fmt, args);
|
||||
va_end(args);
|
||||
__ms_va_end(args);
|
||||
}
|
||||
|
||||
static void wpp_error(const char *file, int line, int col, const char *_near,
|
||||
const char *msg, va_list ap)
|
||||
int WINAPIV ppy_error(const char *msg, ...)
|
||||
{
|
||||
wpp_write_message_var("%s:%d:%d: %s: ", file ? file : "'main file'",
|
||||
line, col, "Error");
|
||||
__ms_va_list ap;
|
||||
__ms_va_start(ap, msg);
|
||||
wpp_write_message_var("%s:%d:%d: %s: ",
|
||||
pp_status.input ? pp_status.input : "'main file'",
|
||||
pp_status.line_number, pp_status.char_number, "Error");
|
||||
wpp_write_message(msg, ap);
|
||||
wpp_write_message_var("\n");
|
||||
__ms_va_end(ap);
|
||||
pp_status.state = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void wpp_warning(const char *file, int line, int col, const char *_near,
|
||||
const char *msg, va_list ap)
|
||||
int WINAPIV ppy_warning(const char *msg, ...)
|
||||
{
|
||||
wpp_write_message_var("%s:%d:%d: %s: ", file ? file : "'main file'",
|
||||
line, col, "Warning");
|
||||
__ms_va_list ap;
|
||||
__ms_va_start(ap, msg);
|
||||
wpp_write_message_var("%s:%d:%d: %s: ",
|
||||
pp_status.input ? pp_status.input : "'main file'",
|
||||
pp_status.line_number, pp_status.char_number, "Warning");
|
||||
wpp_write_message(msg, ap);
|
||||
wpp_write_message_var("\n");
|
||||
__ms_va_end(ap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *wpp_lookup_mem(const char *filename, int type, const char *parent_name,
|
||||
char **include_path, int include_path_count)
|
||||
char *wpp_lookup(const char *filename, int type, const char *parent_name)
|
||||
{
|
||||
/* We don't check for file existence here. We will potentially fail on
|
||||
* the following wpp_open_mem(). */
|
||||
|
@ -176,7 +192,7 @@ static char *wpp_lookup_mem(const char *filename, int type, const char *parent_n
|
|||
return path;
|
||||
}
|
||||
|
||||
static void *wpp_open_mem(const char *filename, int type)
|
||||
void *wpp_open(const char *filename, int type)
|
||||
{
|
||||
struct mem_file_desc *desc;
|
||||
HRESULT hr;
|
||||
|
@ -239,7 +255,7 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void wpp_close_mem(void *file)
|
||||
void wpp_close(void *file)
|
||||
{
|
||||
struct mem_file_desc *desc = file;
|
||||
|
||||
|
@ -255,7 +271,7 @@ static void wpp_close_mem(void *file)
|
|||
}
|
||||
}
|
||||
|
||||
static int wpp_read_mem(void *file, char *buffer, unsigned int len)
|
||||
int wpp_read(void *file, char *buffer, unsigned int len)
|
||||
{
|
||||
struct mem_file_desc *desc = file;
|
||||
|
||||
|
@ -265,7 +281,7 @@ static int wpp_read_mem(void *file, char *buffer, unsigned int len)
|
|||
return len;
|
||||
}
|
||||
|
||||
static void wpp_write_mem(const char *buffer, unsigned int len)
|
||||
void wpp_write(const char *buffer, unsigned int len)
|
||||
{
|
||||
char *new_wpp_output;
|
||||
|
||||
|
@ -307,6 +323,164 @@ static int wpp_close_output(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void add_cmdline_defines(void)
|
||||
{
|
||||
struct define *def;
|
||||
|
||||
for (def = cmdline_defines; def; def = def->next)
|
||||
{
|
||||
if (def->value) pp_add_define( def->name, def->value );
|
||||
}
|
||||
}
|
||||
|
||||
static void del_cmdline_defines(void)
|
||||
{
|
||||
struct define *def;
|
||||
|
||||
for (def = cmdline_defines; def; def = def->next)
|
||||
{
|
||||
if (def->value) pp_del_define( def->name );
|
||||
}
|
||||
}
|
||||
|
||||
static void add_special_defines(void)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
pp_entry_t *ppp;
|
||||
char buf[32];
|
||||
|
||||
strftime(buf, sizeof(buf), "\"%b %d %Y\"", localtime(&now));
|
||||
pp_add_define( "__DATE__", buf );
|
||||
|
||||
strftime(buf, sizeof(buf), "\"%H:%M:%S\"", localtime(&now));
|
||||
pp_add_define( "__TIME__", buf );
|
||||
|
||||
ppp = pp_add_define( "__FILE__", "" );
|
||||
if(ppp)
|
||||
ppp->type = def_special;
|
||||
|
||||
ppp = pp_add_define( "__LINE__", "" );
|
||||
if(ppp)
|
||||
ppp->type = def_special;
|
||||
}
|
||||
|
||||
static void del_special_defines(void)
|
||||
{
|
||||
pp_del_define( "__DATE__" );
|
||||
pp_del_define( "__TIME__" );
|
||||
pp_del_define( "__FILE__" );
|
||||
pp_del_define( "__LINE__" );
|
||||
}
|
||||
|
||||
|
||||
/* add a define to the preprocessor list */
|
||||
int wpp_add_define( const char *name, const char *value )
|
||||
{
|
||||
struct define *def;
|
||||
|
||||
if (!value) value = "";
|
||||
|
||||
for (def = cmdline_defines; def; def = def->next)
|
||||
{
|
||||
if (!strcmp( def->name, name ))
|
||||
{
|
||||
char *new_value = pp_xstrdup(value);
|
||||
if(!new_value)
|
||||
return 1;
|
||||
free( def->value );
|
||||
def->value = new_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
def = pp_xmalloc( sizeof(*def) );
|
||||
if(!def)
|
||||
return 1;
|
||||
def->next = cmdline_defines;
|
||||
def->name = pp_xstrdup(name);
|
||||
if(!def->name)
|
||||
{
|
||||
free(def);
|
||||
return 1;
|
||||
}
|
||||
def->value = pp_xstrdup(value);
|
||||
if(!def->value)
|
||||
{
|
||||
free(def->name);
|
||||
free(def);
|
||||
return 1;
|
||||
}
|
||||
cmdline_defines = def;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* undefine a previously added definition */
|
||||
void wpp_del_define( const char *name )
|
||||
{
|
||||
struct define *def;
|
||||
|
||||
for (def = cmdline_defines; def; def = def->next)
|
||||
{
|
||||
if (!strcmp( def->name, name ))
|
||||
{
|
||||
free( def->value );
|
||||
def->value = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* the main preprocessor parsing loop */
|
||||
int wpp_parse( const char *input, FILE *output )
|
||||
{
|
||||
int ret;
|
||||
|
||||
pp_status.input = NULL;
|
||||
pp_status.line_number = 1;
|
||||
pp_status.char_number = 1;
|
||||
pp_status.state = 0;
|
||||
|
||||
ret = pp_push_define_state();
|
||||
if(ret)
|
||||
return ret;
|
||||
add_cmdline_defines();
|
||||
add_special_defines();
|
||||
|
||||
if (!input) pp_status.file = stdin;
|
||||
else if (!(pp_status.file = wpp_open(input, 1)))
|
||||
{
|
||||
ppy_error("Could not open %s\n", input);
|
||||
del_special_defines();
|
||||
del_cmdline_defines();
|
||||
pp_pop_define_state();
|
||||
return 2;
|
||||
}
|
||||
|
||||
pp_status.input = input ? pp_xstrdup(input) : NULL;
|
||||
|
||||
ppy_out = output;
|
||||
pp_writestring("# 1 \"%s\" 1\n", input ? input : "");
|
||||
|
||||
ret = ppy_parse();
|
||||
/* If there were errors during processing, return an error code */
|
||||
if (!ret && pp_status.state) ret = pp_status.state;
|
||||
|
||||
if (input)
|
||||
{
|
||||
wpp_close(pp_status.file);
|
||||
free(pp_status.input);
|
||||
}
|
||||
/* Clean if_stack, it could remain dirty on errors */
|
||||
while (pp_get_if_depth()) pp_pop_if();
|
||||
del_special_defines();
|
||||
del_cmdline_defines();
|
||||
pp_pop_define_state();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char *filename,
|
||||
const D3D_SHADER_MACRO *defines, ID3DInclude *include, ID3DBlob **error_messages)
|
||||
{
|
||||
|
@ -314,17 +488,6 @@ static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char
|
|||
HRESULT hr = S_OK;
|
||||
const D3D_SHADER_MACRO *def = defines;
|
||||
|
||||
static const struct wpp_callbacks wpp_callbacks =
|
||||
{
|
||||
wpp_lookup_mem,
|
||||
wpp_open_mem,
|
||||
wpp_close_mem,
|
||||
wpp_read_mem,
|
||||
wpp_write_mem,
|
||||
wpp_error,
|
||||
wpp_warning,
|
||||
};
|
||||
|
||||
if (def != NULL)
|
||||
{
|
||||
while (def->Name != NULL)
|
||||
|
@ -339,7 +502,6 @@ static HRESULT preprocess_shader(const void *data, SIZE_T data_size, const char
|
|||
wpp_output_size = wpp_output_capacity = 0;
|
||||
wpp_output = NULL;
|
||||
|
||||
wpp_set_callbacks(&wpp_callbacks);
|
||||
wpp_messages_size = wpp_messages_capacity = 0;
|
||||
wpp_messages = NULL;
|
||||
current_shader.buffer = data;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "wine/debug.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/rbtree.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
#define COBJMACROS
|
||||
#include "windef.h"
|
||||
|
@ -284,8 +285,8 @@ struct bwriter_shader *parse_asm_shader(char **messages) DECLSPEC_HIDDEN;
|
|||
#define PRINTF_ATTR(fmt,args)
|
||||
#endif
|
||||
|
||||
void compilation_message(struct compilation_messages *msg, const char *fmt, va_list args) DECLSPEC_HIDDEN;
|
||||
void asmparser_message(struct asm_parser *ctx, const char *fmt, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN;
|
||||
void compilation_message(struct compilation_messages *msg, const char *fmt, __ms_va_list args) DECLSPEC_HIDDEN;
|
||||
void WINAPIV asmparser_message(struct asm_parser *ctx, const char *fmt, ...) PRINTF_ATTR(2,3) DECLSPEC_HIDDEN;
|
||||
static inline void set_parse_status(enum parse_status *current, enum parse_status update)
|
||||
{
|
||||
if (update == PARSE_ERR)
|
||||
|
@ -705,13 +706,11 @@ struct source_location
|
|||
|
||||
enum hlsl_ir_node_type
|
||||
{
|
||||
HLSL_IR_VAR = 0,
|
||||
HLSL_IR_ASSIGNMENT,
|
||||
HLSL_IR_ASSIGNMENT = 0,
|
||||
HLSL_IR_CONSTANT,
|
||||
HLSL_IR_CONSTRUCTOR,
|
||||
HLSL_IR_DEREF,
|
||||
HLSL_IR_EXPR,
|
||||
HLSL_IR_FUNCTION_DECL,
|
||||
HLSL_IR_IF,
|
||||
HLSL_IR_LOOP,
|
||||
HLSL_IR_JUMP,
|
||||
|
@ -755,12 +754,13 @@ struct reg_reservation
|
|||
|
||||
struct hlsl_ir_var
|
||||
{
|
||||
struct hlsl_ir_node node;
|
||||
struct hlsl_type *data_type;
|
||||
struct source_location loc;
|
||||
const char *name;
|
||||
const char *semantic;
|
||||
unsigned int modifiers;
|
||||
const struct reg_reservation *reg_reservation;
|
||||
struct list scope_entry;
|
||||
struct list scope_entry, param_entry;
|
||||
|
||||
struct hlsl_var_allocation *allocation;
|
||||
};
|
||||
|
@ -775,7 +775,8 @@ struct hlsl_ir_function
|
|||
|
||||
struct hlsl_ir_function_decl
|
||||
{
|
||||
struct hlsl_ir_node node;
|
||||
struct hlsl_type *return_type;
|
||||
struct source_location loc;
|
||||
struct wine_rb_entry entry;
|
||||
struct hlsl_ir_function *func;
|
||||
const char *semantic;
|
||||
|
@ -951,7 +952,8 @@ struct hlsl_ir_constant
|
|||
struct hlsl_ir_constructor
|
||||
{
|
||||
struct hlsl_ir_node node;
|
||||
struct list *arguments;
|
||||
struct hlsl_ir_node *args[16];
|
||||
unsigned int args_count;
|
||||
};
|
||||
|
||||
struct hlsl_scope
|
||||
|
@ -978,6 +980,12 @@ struct parse_colon_attribute
|
|||
struct reg_reservation *reg_reservation;
|
||||
};
|
||||
|
||||
struct parse_initializer
|
||||
{
|
||||
struct hlsl_ir_node **args;
|
||||
unsigned int args_count;
|
||||
};
|
||||
|
||||
struct parse_variable_def
|
||||
{
|
||||
struct list entry;
|
||||
|
@ -987,7 +995,7 @@ struct parse_variable_def
|
|||
unsigned int array_size;
|
||||
const char *semantic;
|
||||
struct reg_reservation *reg_reservation;
|
||||
struct list *initializer;
|
||||
struct parse_initializer initializer;
|
||||
};
|
||||
|
||||
struct parse_function
|
||||
|
@ -1054,16 +1062,10 @@ enum hlsl_error_level
|
|||
HLSL_LEVEL_NOTE,
|
||||
};
|
||||
|
||||
void hlsl_message(const char *fmt, ...) PRINTF_ATTR(1,2) DECLSPEC_HIDDEN;
|
||||
void hlsl_report_message(const char *filename, DWORD line, DWORD column,
|
||||
void WINAPIV hlsl_message(const char *fmt, ...) PRINTF_ATTR(1,2) DECLSPEC_HIDDEN;
|
||||
void WINAPIV hlsl_report_message(const char *filename, DWORD line, DWORD column,
|
||||
enum hlsl_error_level level, const char *fmt, ...) PRINTF_ATTR(5,6) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline struct hlsl_ir_var *var_from_node(const struct hlsl_ir_node *node)
|
||||
{
|
||||
assert(node->type == HLSL_IR_VAR);
|
||||
return CONTAINING_RECORD(node, struct hlsl_ir_var, node);
|
||||
}
|
||||
|
||||
static inline struct hlsl_ir_expr *expr_from_node(const struct hlsl_ir_node *node)
|
||||
{
|
||||
assert(node->type == HLSL_IR_EXPR);
|
||||
|
@ -1134,28 +1136,6 @@ struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **ope
|
|||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *new_cast(struct hlsl_ir_node *node, struct hlsl_type *type,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_mul(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_div(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_mod(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_add(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_sub(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_lt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_gt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_le(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_ge(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_eq(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_expr *hlsl_ne(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_deref *new_var_deref(struct hlsl_ir_var *var) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_deref *new_record_deref(struct hlsl_ir_node *record, struct hlsl_struct_field *field) DECLSPEC_HIDDEN;
|
||||
struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assign_op assign_op,
|
||||
|
@ -1178,6 +1158,19 @@ void free_instr(struct hlsl_ir_node *node) DECLSPEC_HIDDEN;
|
|||
void free_instr_list(struct list *list) DECLSPEC_HIDDEN;
|
||||
void free_function_rb(struct wine_rb_entry *entry, void *context) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline struct hlsl_ir_node *new_unary_expr(enum hlsl_ir_expr_op op,
|
||||
struct hlsl_ir_node *op1, struct source_location loc)
|
||||
{
|
||||
struct hlsl_ir_node *operands[3] = {op1};
|
||||
return &new_expr(op, operands, &loc)->node;
|
||||
}
|
||||
|
||||
static inline struct hlsl_ir_node *new_binary_expr(enum hlsl_ir_expr_op op,
|
||||
struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location loc)
|
||||
{
|
||||
struct hlsl_ir_node *operands[3] = {op1, op2};
|
||||
return &new_expr(op, operands, &loc)->node;
|
||||
}
|
||||
|
||||
#define MAKE_TAG(ch0, ch1, ch2, ch3) \
|
||||
((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*/
|
||||
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#define YY_NO_UNISTD_H
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,9 @@
|
|||
/* A Bison parser, made by GNU Bison 3.0. */
|
||||
/* A Bison parser, made by GNU Bison 3.4.1. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -30,6 +31,9 @@
|
|||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Undocumented macros, especially those whose name start with YY_,
|
||||
are private implementation details. Do not rely on them. */
|
||||
|
||||
#ifndef YY_HLSL_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_HLSL_TAB_H_INCLUDED
|
||||
# define YY_HLSL_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_HLSL_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
|
@ -152,10 +156,9 @@ extern int hlsl_debug;
|
|||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 910 "hlsl.y" /* yacc.c:1909 */
|
||||
#line 890 "hlsl.y"
|
||||
|
||||
struct hlsl_type *type;
|
||||
INT intval;
|
||||
|
@ -163,11 +166,11 @@ union YYSTYPE
|
|||
BOOL boolval;
|
||||
char *name;
|
||||
DWORD modifiers;
|
||||
struct hlsl_ir_var *var;
|
||||
struct hlsl_ir_node *instr;
|
||||
struct list *list;
|
||||
struct parse_function function;
|
||||
struct parse_parameter parameter;
|
||||
struct parse_initializer initializer;
|
||||
struct parse_variable_def *variable_def;
|
||||
struct parse_if_body if_body;
|
||||
enum parse_unary_op unary_op;
|
||||
|
@ -175,8 +178,10 @@ union YYSTYPE
|
|||
struct reg_reservation *reg_reservation;
|
||||
struct parse_colon_attribute colon_attribute;
|
||||
|
||||
#line 179 "hlsl.tab.h" /* yacc.c:1909 */
|
||||
#line 182 "hlsl.tab.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
%{
|
||||
#include "config.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -35,13 +34,13 @@ struct hlsl_parse_ctx hlsl_ctx;
|
|||
struct YYLTYPE;
|
||||
static void set_location(struct source_location *loc, const struct YYLTYPE *l);
|
||||
|
||||
void hlsl_message(const char *fmt, ...)
|
||||
void WINAPIV hlsl_message(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
__ms_va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
__ms_va_start(args, fmt);
|
||||
compilation_message(&hlsl_ctx.messages, fmt, args);
|
||||
va_end(args);
|
||||
__ms_va_end(args);
|
||||
}
|
||||
|
||||
static const char *hlsl_get_error_level_name(enum hlsl_error_level level)
|
||||
|
@ -55,18 +54,18 @@ static const char *hlsl_get_error_level_name(enum hlsl_error_level level)
|
|||
return names[level];
|
||||
}
|
||||
|
||||
void hlsl_report_message(const char *filename, DWORD line, DWORD column,
|
||||
void WINAPIV hlsl_report_message(const char *filename, DWORD line, DWORD column,
|
||||
enum hlsl_error_level level, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
__ms_va_list args;
|
||||
char *string = NULL;
|
||||
int rc, size = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
va_start(args, fmt);
|
||||
__ms_va_start(args, fmt);
|
||||
rc = vsnprintf(string, size, fmt, args);
|
||||
va_end(args);
|
||||
__ms_va_end(args);
|
||||
|
||||
if (rc >= 0 && rc < size)
|
||||
break;
|
||||
|
@ -123,7 +122,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
|
|||
BOOL ret;
|
||||
|
||||
TRACE("Declaring variable %s.\n", decl->name);
|
||||
if (decl->node.data_type->type == HLSL_CLASS_MATRIX)
|
||||
if (decl->data_type->type == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
if (!(decl->modifiers & (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR)))
|
||||
{
|
||||
|
@ -132,7 +131,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
|
|||
}
|
||||
}
|
||||
else
|
||||
check_invalid_matrix_modifiers(decl->modifiers, &decl->node.loc);
|
||||
check_invalid_matrix_modifiers(decl->modifiers, &decl->loc);
|
||||
|
||||
if (local)
|
||||
{
|
||||
|
@ -140,12 +139,12 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
|
|||
| HLSL_STORAGE_GROUPSHARED | HLSL_STORAGE_UNIFORM);
|
||||
if (invalid)
|
||||
{
|
||||
hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR,
|
||||
hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR,
|
||||
"modifier '%s' invalid for local variables", debug_modifiers(invalid));
|
||||
}
|
||||
if (decl->semantic)
|
||||
{
|
||||
hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR,
|
||||
hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR,
|
||||
"semantics are not allowed on local variables");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -154,7 +153,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
|
|||
{
|
||||
if (find_function(decl->name))
|
||||
{
|
||||
hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR,
|
||||
hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR,
|
||||
"redefinition of '%s'", decl->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -164,9 +163,9 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
|
|||
{
|
||||
struct hlsl_ir_var *old = get_variable(hlsl_ctx.cur_scope, decl->name);
|
||||
|
||||
hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_ERROR,
|
||||
hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_ERROR,
|
||||
"\"%s\" already declared", decl->name);
|
||||
hlsl_report_message(old->node.loc.file, old->node.loc.line, old->node.loc.col, HLSL_LEVEL_NOTE,
|
||||
hlsl_report_message(old->loc.file, old->loc.line, old->loc.col, HLSL_LEVEL_NOTE,
|
||||
"\"%s\" was previously declared here", old->name);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -258,9 +257,8 @@ static void declare_predefined_types(struct hlsl_scope *scope)
|
|||
|
||||
static struct hlsl_ir_if *loop_condition(struct list *cond_list)
|
||||
{
|
||||
struct hlsl_ir_node *cond, *not_cond;
|
||||
struct hlsl_ir_if *out_cond;
|
||||
struct hlsl_ir_expr *not_cond;
|
||||
struct hlsl_ir_node *cond, *operands[3];
|
||||
struct hlsl_ir_jump *jump;
|
||||
unsigned int count = list_count(cond_list);
|
||||
|
||||
|
@ -277,16 +275,13 @@ static struct hlsl_ir_if *loop_condition(struct list *cond_list)
|
|||
return NULL;
|
||||
}
|
||||
out_cond->node.type = HLSL_IR_IF;
|
||||
operands[0] = cond;
|
||||
operands[1] = operands[2] = NULL;
|
||||
not_cond = new_expr(HLSL_IR_UNOP_LOGIC_NOT, operands, &cond->loc);
|
||||
if (!not_cond)
|
||||
if (!(not_cond = new_unary_expr(HLSL_IR_UNOP_LOGIC_NOT, cond, cond->loc)))
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
d3dcompiler_free(out_cond);
|
||||
return NULL;
|
||||
}
|
||||
out_cond->condition = ¬_cond->node;
|
||||
out_cond->condition = not_cond;
|
||||
jump = d3dcompiler_alloc(sizeof(*jump));
|
||||
if (!jump)
|
||||
{
|
||||
|
@ -379,29 +374,24 @@ oom:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static unsigned int initializer_size(struct list *initializer)
|
||||
static unsigned int initializer_size(const struct parse_initializer *initializer)
|
||||
{
|
||||
unsigned int count = 0;
|
||||
struct hlsl_ir_node *node;
|
||||
unsigned int count = 0, i;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(node, initializer, struct hlsl_ir_node, entry)
|
||||
for (i = 0; i < initializer->args_count; ++i)
|
||||
{
|
||||
count += components_count_type(node->data_type);
|
||||
count += components_count_type(initializer->args[i]->data_type);
|
||||
}
|
||||
TRACE("Initializer size = %u\n", count);
|
||||
TRACE("Initializer size = %u.\n", count);
|
||||
return count;
|
||||
}
|
||||
|
||||
static unsigned int components_count_expr_list(struct list *list)
|
||||
static void free_parse_initializer(struct parse_initializer *initializer)
|
||||
{
|
||||
struct hlsl_ir_node *node;
|
||||
unsigned int count = 0;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(node, list, struct hlsl_ir_node, entry)
|
||||
{
|
||||
count += components_count_type(node->data_type);
|
||||
}
|
||||
return count;
|
||||
unsigned int i;
|
||||
for (i = 0; i < initializer->args_count; ++i)
|
||||
free_instr(initializer->args[i]);
|
||||
d3dcompiler_free(initializer->args);
|
||||
}
|
||||
|
||||
static struct hlsl_ir_swizzle *new_swizzle(DWORD s, unsigned int components,
|
||||
|
@ -501,35 +491,35 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var, struct list *initializer)
|
||||
static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var,
|
||||
struct parse_initializer *initializer)
|
||||
{
|
||||
struct hlsl_type *type = var->node.data_type;
|
||||
struct hlsl_ir_node *node;
|
||||
struct hlsl_type *type = var->data_type;
|
||||
struct hlsl_struct_field *field;
|
||||
struct list *cur_node;
|
||||
struct hlsl_ir_node *assignment;
|
||||
struct hlsl_ir_deref *deref;
|
||||
unsigned int i = 0;
|
||||
|
||||
if (initializer_size(initializer) != components_count_type(type))
|
||||
{
|
||||
hlsl_report_message(var->node.loc.file, var->node.loc.line, var->node.loc.col, HLSL_LEVEL_ERROR,
|
||||
hlsl_report_message(var->loc.file, var->loc.line, var->loc.col, HLSL_LEVEL_ERROR,
|
||||
"structure initializer mismatch");
|
||||
free_instr_list(initializer);
|
||||
free_parse_initializer(initializer);
|
||||
return;
|
||||
}
|
||||
cur_node = list_head(initializer);
|
||||
assert(cur_node);
|
||||
node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry);
|
||||
|
||||
LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry)
|
||||
{
|
||||
if (!cur_node)
|
||||
struct hlsl_ir_node *node = initializer->args[i];
|
||||
|
||||
if (i++ >= initializer->args_count)
|
||||
{
|
||||
d3dcompiler_free(initializer);
|
||||
d3dcompiler_free(initializer->args);
|
||||
return;
|
||||
}
|
||||
if (components_count_type(field->type) == components_count_type(node->data_type))
|
||||
{
|
||||
deref = new_record_deref(&var->node, field);
|
||||
deref = new_record_deref(&new_var_deref(var)->node, field);
|
||||
if (!deref)
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
|
@ -541,19 +531,12 @@ static void struct_var_initializer(struct list *list, struct hlsl_ir_var *var, s
|
|||
}
|
||||
else
|
||||
FIXME("Initializing with \"mismatched\" fields is not supported yet.\n");
|
||||
cur_node = list_next(initializer, cur_node);
|
||||
node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry);
|
||||
}
|
||||
|
||||
/* Free initializer elements in excess. */
|
||||
while (cur_node)
|
||||
{
|
||||
struct list *next = list_next(initializer, cur_node);
|
||||
free_instr(node);
|
||||
cur_node = next;
|
||||
node = LIST_ENTRY(cur_node, struct hlsl_ir_node, entry);
|
||||
}
|
||||
d3dcompiler_free(initializer);
|
||||
for (; i < initializer->args_count; ++i)
|
||||
free_instr(initializer->args[i]);
|
||||
d3dcompiler_free(initializer->args);
|
||||
}
|
||||
|
||||
static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers, struct list *var_list)
|
||||
|
@ -587,13 +570,12 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
|
|||
d3dcompiler_free(v);
|
||||
continue;
|
||||
}
|
||||
var->node.type = HLSL_IR_VAR;
|
||||
if (v->array_size)
|
||||
type = new_array_type(basic_type, v->array_size);
|
||||
else
|
||||
type = basic_type;
|
||||
var->node.data_type = type;
|
||||
var->node.loc = v->loc;
|
||||
var->data_type = type;
|
||||
var->loc = v->loc;
|
||||
var->name = v->name;
|
||||
var->modifiers = modifiers;
|
||||
var->semantic = v->semantic;
|
||||
|
@ -606,7 +588,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
|
|||
local = FALSE;
|
||||
}
|
||||
|
||||
if (var->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer)
|
||||
if (var->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer.args_count)
|
||||
{
|
||||
hlsl_report_message(v->loc.file, v->loc.line, v->loc.col,
|
||||
HLSL_LEVEL_ERROR, "const variable without initializer");
|
||||
|
@ -624,10 +606,9 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
|
|||
}
|
||||
TRACE("Declared variable %s.\n", var->name);
|
||||
|
||||
if (v->initializer)
|
||||
if (v->initializer.args_count)
|
||||
{
|
||||
unsigned int size = initializer_size(v->initializer);
|
||||
struct hlsl_ir_node *node;
|
||||
unsigned int size = initializer_size(&v->initializer);
|
||||
|
||||
TRACE("Variable with initializer.\n");
|
||||
if (type->type <= HLSL_CLASS_LAST_NUMERIC
|
||||
|
@ -637,7 +618,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
|
|||
{
|
||||
hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR,
|
||||
"'%s' initializer does not match", v->name);
|
||||
free_instr_list(v->initializer);
|
||||
free_parse_initializer(&v->initializer);
|
||||
d3dcompiler_free(v);
|
||||
continue;
|
||||
}
|
||||
|
@ -647,43 +628,43 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
|
|||
{
|
||||
hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR,
|
||||
"'%s' initializer does not match", v->name);
|
||||
free_instr_list(v->initializer);
|
||||
free_parse_initializer(&v->initializer);
|
||||
d3dcompiler_free(v);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type->type == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
struct_var_initializer(statements_list, var, v->initializer);
|
||||
struct_var_initializer(statements_list, var, &v->initializer);
|
||||
d3dcompiler_free(v);
|
||||
continue;
|
||||
}
|
||||
if (type->type > HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
FIXME("Initializers for non scalar/struct variables not supported yet.\n");
|
||||
free_instr_list(v->initializer);
|
||||
free_parse_initializer(&v->initializer);
|
||||
d3dcompiler_free(v);
|
||||
continue;
|
||||
}
|
||||
if (v->array_size > 0)
|
||||
{
|
||||
FIXME("Initializing arrays is not supported yet.\n");
|
||||
free_instr_list(v->initializer);
|
||||
free_parse_initializer(&v->initializer);
|
||||
d3dcompiler_free(v);
|
||||
continue;
|
||||
}
|
||||
if (list_count(v->initializer) > 1)
|
||||
if (v->initializer.args_count > 1)
|
||||
{
|
||||
FIXME("Complex initializers are not supported yet.\n");
|
||||
free_instr_list(v->initializer);
|
||||
free_parse_initializer(&v->initializer);
|
||||
d3dcompiler_free(v);
|
||||
continue;
|
||||
}
|
||||
node = LIST_ENTRY(list_head(v->initializer), struct hlsl_ir_node, entry);
|
||||
assignment = make_assignment(&var->node, ASSIGN_OP_ASSIGN,
|
||||
BWRITERSP_WRITEMASK_ALL, node);
|
||||
|
||||
assignment = make_assignment(&new_var_deref(var)->node, ASSIGN_OP_ASSIGN,
|
||||
BWRITERSP_WRITEMASK_ALL, v->initializer.args[0]);
|
||||
d3dcompiler_free(v->initializer.args);
|
||||
list_add_tail(statements_list, &assignment->entry);
|
||||
d3dcompiler_free(v->initializer);
|
||||
}
|
||||
d3dcompiler_free(v);
|
||||
}
|
||||
|
@ -731,11 +712,11 @@ static struct list *gen_struct_fields(struct hlsl_type *type, DWORD modifiers, s
|
|||
field->name = v->name;
|
||||
field->modifiers = modifiers;
|
||||
field->semantic = v->semantic;
|
||||
if (v->initializer)
|
||||
if (v->initializer.args_count)
|
||||
{
|
||||
hlsl_report_message(v->loc.file, v->loc.line, v->loc.col, HLSL_LEVEL_ERROR,
|
||||
"struct field with an initializer.\n");
|
||||
free_instr_list(v->initializer);
|
||||
free_parse_initializer(&v->initializer);
|
||||
}
|
||||
list_add_tail(list, &field->entry);
|
||||
d3dcompiler_free(v);
|
||||
|
@ -818,9 +799,8 @@ static BOOL add_func_parameter(struct list *list, struct parse_parameter *param,
|
|||
ERR("Out of memory.\n");
|
||||
return FALSE;
|
||||
}
|
||||
decl->node.type = HLSL_IR_VAR;
|
||||
decl->node.data_type = param->type;
|
||||
decl->node.loc = *loc;
|
||||
decl->data_type = param->type;
|
||||
decl->loc = *loc;
|
||||
decl->name = param->name;
|
||||
decl->semantic = param->semantic;
|
||||
decl->reg_reservation = param->reg_reservation;
|
||||
|
@ -831,7 +811,7 @@ static BOOL add_func_parameter(struct list *list, struct parse_parameter *param,
|
|||
free_declaration(decl);
|
||||
return FALSE;
|
||||
}
|
||||
list_add_tail(list, &decl->node.entry);
|
||||
list_add_tail(list, &decl->param_entry);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -903,7 +883,7 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr
|
|||
%}
|
||||
|
||||
%locations
|
||||
%error-verbose
|
||||
%define parse.error verbose
|
||||
%expect 1
|
||||
|
||||
%union
|
||||
|
@ -914,11 +894,11 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr
|
|||
BOOL boolval;
|
||||
char *name;
|
||||
DWORD modifiers;
|
||||
struct hlsl_ir_var *var;
|
||||
struct hlsl_ir_node *instr;
|
||||
struct list *list;
|
||||
struct parse_function function;
|
||||
struct parse_parameter parameter;
|
||||
struct parse_initializer initializer;
|
||||
struct parse_variable_def *variable_def;
|
||||
struct parse_if_body if_body;
|
||||
enum parse_unary_op unary_op;
|
||||
|
@ -1042,15 +1022,14 @@ static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tr
|
|||
%type <type> unnamed_struct_spec
|
||||
%type <list> type_specs
|
||||
%type <variable_def> type_spec
|
||||
%type <list> complex_initializer
|
||||
%type <list> initializer_expr_list
|
||||
%type <initializer> complex_initializer
|
||||
%type <initializer> initializer_expr_list
|
||||
%type <instr> initializer_expr
|
||||
%type <modifiers> var_modifiers
|
||||
%type <list> field
|
||||
%type <list> parameters
|
||||
%type <list> param_list
|
||||
%type <instr> expr
|
||||
%type <var> variable
|
||||
%type <intval> array
|
||||
%type <list> statement
|
||||
%type <list> statement_list
|
||||
|
@ -1103,28 +1082,28 @@ hlsl_prog: /* empty */
|
|||
{
|
||||
if (decl->body && $2.decl->body)
|
||||
{
|
||||
hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
|
||||
$2.decl->node.loc.col, HLSL_LEVEL_ERROR,
|
||||
hlsl_report_message($2.decl->loc.file, $2.decl->loc.line,
|
||||
$2.decl->loc.col, HLSL_LEVEL_ERROR,
|
||||
"redefinition of function %s", debugstr_a($2.name));
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
else if (!compare_hlsl_types(decl->node.data_type, $2.decl->node.data_type))
|
||||
else if (!compare_hlsl_types(decl->return_type, $2.decl->return_type))
|
||||
{
|
||||
hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
|
||||
$2.decl->node.loc.col, HLSL_LEVEL_ERROR,
|
||||
hlsl_report_message($2.decl->loc.file, $2.decl->loc.line,
|
||||
$2.decl->loc.col, HLSL_LEVEL_ERROR,
|
||||
"redefining function %s with a different return type",
|
||||
debugstr_a($2.name));
|
||||
hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_NOTE,
|
||||
hlsl_report_message(decl->loc.file, decl->loc.line, decl->loc.col, HLSL_LEVEL_NOTE,
|
||||
"%s previously declared here",
|
||||
debugstr_a($2.name));
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
|
||||
if ($2.decl->node.data_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic)
|
||||
if ($2.decl->return_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic)
|
||||
{
|
||||
hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
|
||||
$2.decl->node.loc.col, HLSL_LEVEL_ERROR,
|
||||
hlsl_report_message($2.decl->loc.file, $2.decl->loc.line,
|
||||
$2.decl->loc.col, HLSL_LEVEL_ERROR,
|
||||
"void function with a semantic");
|
||||
}
|
||||
|
||||
|
@ -1199,7 +1178,7 @@ named_struct_spec: var_modifiers KW_STRUCT any_identifier '{' fields_list
|
|||
{
|
||||
hlsl_report_message(hlsl_ctx.source_file, @3.first_line, @3.first_column,
|
||||
HLSL_LEVEL_ERROR, "redefinition of '%s'", $3);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
ret = add_type_to_scope(hlsl_ctx.cur_scope, $$);
|
||||
|
@ -1207,7 +1186,7 @@ named_struct_spec: var_modifiers KW_STRUCT any_identifier '{' fields_list
|
|||
{
|
||||
hlsl_report_message(hlsl_ctx.source_file, @3.first_line, @3.first_column,
|
||||
HLSL_LEVEL_ERROR, "redefinition of struct '%s'", $3);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1278,7 +1257,7 @@ func_prototype: var_modifiers type var_identifier '(' parameters ')' c
|
|||
{
|
||||
hlsl_report_message(hlsl_ctx.source_file, @3.first_line, @3.first_column,
|
||||
HLSL_LEVEL_ERROR, "redefinition of '%s'\n", $3);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
if ($2->base_type == HLSL_TYPE_VOID && $7.semantic)
|
||||
{
|
||||
|
@ -1295,11 +1274,11 @@ func_prototype: var_modifiers type var_identifier '(' parameters ')' c
|
|||
if (!$$.decl)
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
$$.name = $3;
|
||||
$$.decl->semantic = $7.semantic;
|
||||
set_location(&$$.decl->node.loc, &@3);
|
||||
set_location(&$$.decl->loc, &@3);
|
||||
}
|
||||
|
||||
compound_statement: '{' '}'
|
||||
|
@ -1378,7 +1357,7 @@ param_list: parameter
|
|||
{
|
||||
ERR("Error adding function parameter %s.\n", $1.name);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| param_list ',' parameter
|
||||
|
@ -1391,7 +1370,7 @@ param_list: parameter
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"duplicate parameter %s", $3.name);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1415,7 +1394,7 @@ input_mods: /* Empty */
|
|||
{
|
||||
hlsl_report_message(hlsl_ctx.source_file, @2.first_line, @2.first_column,
|
||||
HLSL_LEVEL_ERROR, "duplicate input-output modifiers");
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
$$ = $1 | $2;
|
||||
}
|
||||
|
@ -1444,14 +1423,14 @@ type: base_type
|
|||
hlsl_message("Line %u: vectors of non-scalar types are not allowed.\n",
|
||||
hlsl_ctx.line_no);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
if ($5 < 1 || $5 > 4)
|
||||
{
|
||||
hlsl_message("Line %u: vector size must be between 1 and 4.\n",
|
||||
hlsl_ctx.line_no);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
$$ = new_hlsl_type(NULL, HLSL_CLASS_VECTOR, $3->base_type, $5, 1);
|
||||
|
@ -1463,14 +1442,14 @@ type: base_type
|
|||
hlsl_message("Line %u: matrices of non-scalar types are not allowed.\n",
|
||||
hlsl_ctx.line_no);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
if ($5 < 1 || $5 > 4 || $7 < 1 || $7 > 4)
|
||||
{
|
||||
hlsl_message("Line %u: matrix dimensions must be between 1 and 4.\n",
|
||||
hlsl_ctx.line_no);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
$$ = new_hlsl_type(NULL, HLSL_CLASS_MATRIX, $3->base_type, $5, $7);
|
||||
|
@ -1539,7 +1518,7 @@ declaration_statement: declaration
|
|||
if (!$$)
|
||||
{
|
||||
ERR("Out of memory\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
list_init($$);
|
||||
}
|
||||
|
@ -1550,7 +1529,7 @@ typedef: KW_TYPEDEF var_modifiers type type_specs ';'
|
|||
|
||||
set_location(&loc, &@1);
|
||||
if (!add_typedef($2, $3, $4, &loc))
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
| KW_TYPEDEF struct_spec type_specs ';'
|
||||
{
|
||||
|
@ -1558,7 +1537,7 @@ typedef: KW_TYPEDEF var_modifiers type type_specs ';'
|
|||
|
||||
set_location(&loc, &@1);
|
||||
if (!add_typedef(0, $2, $3, &loc))
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
type_specs: type_spec
|
||||
|
@ -1690,9 +1669,10 @@ var_modifiers: /* Empty */
|
|||
|
||||
complex_initializer: initializer_expr
|
||||
{
|
||||
$$ = d3dcompiler_alloc(sizeof(*$$));
|
||||
list_init($$);
|
||||
list_add_head($$, &$1->entry);
|
||||
$$.args_count = 1;
|
||||
if (!($$.args = d3dcompiler_alloc(sizeof(*$$.args))))
|
||||
YYABORT;
|
||||
$$.args[0] = $1;
|
||||
}
|
||||
| '{' initializer_expr_list '}'
|
||||
{
|
||||
|
@ -1710,14 +1690,17 @@ initializer_expr: assignment_expr
|
|||
|
||||
initializer_expr_list: initializer_expr
|
||||
{
|
||||
$$ = d3dcompiler_alloc(sizeof(*$$));
|
||||
list_init($$);
|
||||
list_add_head($$, &$1->entry);
|
||||
$$.args_count = 1;
|
||||
if (!($$.args = d3dcompiler_alloc(sizeof(*$$.args))))
|
||||
YYABORT;
|
||||
$$.args[0] = $1;
|
||||
}
|
||||
| initializer_expr_list ',' initializer_expr
|
||||
{
|
||||
$$ = $1;
|
||||
list_add_tail($$, &$3->entry);
|
||||
if (!($$.args = d3dcompiler_realloc($$.args, ($$.args_count + 1) * sizeof(*$$.args))))
|
||||
YYABORT;
|
||||
$$.args[$$.args_count++] = $3;
|
||||
}
|
||||
|
||||
boolean: KW_TRUE
|
||||
|
@ -1754,7 +1737,7 @@ jump_statement: KW_RETURN expr ';'
|
|||
if (!jump)
|
||||
{
|
||||
ERR("Out of memory\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
jump->node.type = HLSL_IR_JUMP;
|
||||
set_location(&jump->node.loc, &@1);
|
||||
|
@ -1777,7 +1760,7 @@ selection_statement: KW_IF '(' expr ')' if_body
|
|||
if (!instr)
|
||||
{
|
||||
ERR("Out of memory\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
instr->node.type = HLSL_IR_IF;
|
||||
set_location(&instr->node.loc, &@1);
|
||||
|
@ -1814,7 +1797,7 @@ loop_statement: KW_WHILE '(' expr ')' statement
|
|||
if (!cond)
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
list_init(cond);
|
||||
list_add_head(cond, &$3->entry);
|
||||
|
@ -1829,7 +1812,7 @@ loop_statement: KW_WHILE '(' expr ')' statement
|
|||
if (!cond)
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
list_init(cond);
|
||||
list_add_head(cond, &$5->entry);
|
||||
|
@ -1875,7 +1858,7 @@ primary_expr: C_FLOAT
|
|||
if (!c)
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
c->node.type = HLSL_IR_CONSTANT;
|
||||
set_location(&c->node.loc, &yylloc);
|
||||
|
@ -1889,7 +1872,7 @@ primary_expr: C_FLOAT
|
|||
if (!c)
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
c->node.type = HLSL_IR_CONSTANT;
|
||||
set_location(&c->node.loc, &yylloc);
|
||||
|
@ -1903,7 +1886,7 @@ primary_expr: C_FLOAT
|
|||
if (!c)
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
c->node.type = HLSL_IR_CONSTANT;
|
||||
set_location(&c->node.loc, &yylloc);
|
||||
|
@ -1911,10 +1894,19 @@ primary_expr: C_FLOAT
|
|||
c->v.value.b[0] = $1;
|
||||
$$ = &c->node;
|
||||
}
|
||||
| variable
|
||||
| VAR_IDENTIFIER
|
||||
{
|
||||
struct hlsl_ir_deref *deref = new_var_deref($1);
|
||||
if (deref)
|
||||
struct hlsl_ir_deref *deref;
|
||||
struct hlsl_ir_var *var;
|
||||
|
||||
if (!(var = get_variable(hlsl_ctx.cur_scope, $1)))
|
||||
{
|
||||
hlsl_message("Line %d: variable '%s' not declared\n",
|
||||
hlsl_ctx.line_no, $1);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
YYABORT;
|
||||
}
|
||||
if ((deref = new_var_deref(var)))
|
||||
{
|
||||
$$ = &deref->node;
|
||||
set_location(&$$->loc, &@1);
|
||||
|
@ -1927,27 +1919,12 @@ primary_expr: C_FLOAT
|
|||
$$ = $2;
|
||||
}
|
||||
|
||||
variable: VAR_IDENTIFIER
|
||||
{
|
||||
struct hlsl_ir_var *var;
|
||||
var = get_variable(hlsl_ctx.cur_scope, $1);
|
||||
if (!var)
|
||||
{
|
||||
hlsl_message("Line %d: variable '%s' not declared\n",
|
||||
hlsl_ctx.line_no, $1);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return 1;
|
||||
}
|
||||
$$ = var;
|
||||
}
|
||||
|
||||
postfix_expr: primary_expr
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
| postfix_expr OP_INC
|
||||
{
|
||||
struct hlsl_ir_node *operands[3];
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
|
@ -1955,18 +1932,15 @@ postfix_expr: primary_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"modifying a const expression");
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
operands[0] = $1;
|
||||
operands[1] = operands[2] = NULL;
|
||||
$$ = &new_expr(HLSL_IR_UNOP_POSTINC, operands, &loc)->node;
|
||||
$$ = new_unary_expr(HLSL_IR_UNOP_POSTINC, $1, loc);
|
||||
/* Post increment/decrement expressions are considered const */
|
||||
$$->data_type = clone_hlsl_type($$->data_type);
|
||||
$$->data_type->modifiers |= HLSL_MODIFIER_CONST;
|
||||
}
|
||||
| postfix_expr OP_DEC
|
||||
{
|
||||
struct hlsl_ir_node *operands[3];
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
|
@ -1974,11 +1948,9 @@ postfix_expr: primary_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"modifying a const expression");
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
operands[0] = $1;
|
||||
operands[1] = operands[2] = NULL;
|
||||
$$ = &new_expr(HLSL_IR_UNOP_POSTDEC, operands, &loc)->node;
|
||||
$$ = new_unary_expr(HLSL_IR_UNOP_POSTDEC, $1, loc);
|
||||
/* Post increment/decrement expressions are considered const */
|
||||
$$->data_type = clone_hlsl_type($$->data_type);
|
||||
$$->data_type->modifiers |= HLSL_MODIFIER_CONST;
|
||||
|
@ -2003,7 +1975,7 @@ postfix_expr: primary_expr
|
|||
if (!deref)
|
||||
{
|
||||
ERR("Out of memory\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
deref->node.loc = loc;
|
||||
$$ = &deref->node;
|
||||
|
@ -2014,7 +1986,7 @@ postfix_expr: primary_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"invalid subscript %s", debugstr_a($3));
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
else if ($1->data_type->type <= HLSL_CLASS_LAST_NUMERIC)
|
||||
|
@ -2026,7 +1998,7 @@ postfix_expr: primary_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"invalid swizzle %s", debugstr_a($3));
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
$$ = &swizzle->node;
|
||||
}
|
||||
|
@ -2034,7 +2006,7 @@ postfix_expr: primary_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"invalid subscript %s", debugstr_a($3));
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
}
|
||||
| postfix_expr '[' expr ']'
|
||||
|
@ -2050,7 +2022,7 @@ postfix_expr: primary_expr
|
|||
if (!deref)
|
||||
{
|
||||
ERR("Out of memory\n");
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
deref->node.type = HLSL_IR_DEREF;
|
||||
set_location(&loc, &@2);
|
||||
|
@ -2078,7 +2050,7 @@ postfix_expr: primary_expr
|
|||
d3dcompiler_free(deref);
|
||||
free_instr($1);
|
||||
free_instr($3);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
if ($3->data_type->type != HLSL_CLASS_SCALAR)
|
||||
{
|
||||
|
@ -2087,7 +2059,7 @@ postfix_expr: primary_expr
|
|||
d3dcompiler_free(deref);
|
||||
free_instr($1);
|
||||
free_instr($3);
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
deref->type = HLSL_IR_DEREF_ARRAY;
|
||||
deref->v.array.array = $1;
|
||||
|
@ -2107,29 +2079,31 @@ postfix_expr: primary_expr
|
|||
hlsl_message("Line %u: unexpected modifier in a constructor.\n",
|
||||
hlsl_ctx.line_no);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
if ($2->type > HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
hlsl_message("Line %u: constructors are allowed only for numeric data types.\n",
|
||||
hlsl_ctx.line_no);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
if ($2->dimx * $2->dimy != components_count_expr_list($4))
|
||||
if ($2->dimx * $2->dimy != initializer_size(&$4))
|
||||
{
|
||||
hlsl_message("Line %u: wrong number of components in constructor.\n",
|
||||
hlsl_ctx.line_no);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
return -1;
|
||||
YYABORT;
|
||||
}
|
||||
assert($4.args_count <= ARRAY_SIZE(constructor->args));
|
||||
|
||||
constructor = d3dcompiler_alloc(sizeof(*constructor));
|
||||
constructor->node.type = HLSL_IR_CONSTRUCTOR;
|
||||
set_location(&constructor->node.loc, &@3);
|
||||
constructor->node.data_type = $2;
|
||||
constructor->arguments = $4;
|
||||
|
||||
constructor->args_count = $4.args_count;
|
||||
memcpy(constructor->args, $4.args, $4.args_count * sizeof(*$4.args));
|
||||
d3dcompiler_free($4.args);
|
||||
$$ = &constructor->node;
|
||||
}
|
||||
|
||||
|
@ -2139,7 +2113,6 @@ unary_expr: postfix_expr
|
|||
}
|
||||
| OP_INC unary_expr
|
||||
{
|
||||
struct hlsl_ir_node *operands[3];
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@1);
|
||||
|
@ -2147,15 +2120,12 @@ unary_expr: postfix_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"modifying a const expression");
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
operands[0] = $2;
|
||||
operands[1] = operands[2] = NULL;
|
||||
$$ = &new_expr(HLSL_IR_UNOP_PREINC, operands, &loc)->node;
|
||||
$$ = new_unary_expr(HLSL_IR_UNOP_PREINC, $2, loc);
|
||||
}
|
||||
| OP_DEC unary_expr
|
||||
{
|
||||
struct hlsl_ir_node *operands[3];
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@1);
|
||||
|
@ -2163,17 +2133,14 @@ unary_expr: postfix_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"modifying a const expression");
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
operands[0] = $2;
|
||||
operands[1] = operands[2] = NULL;
|
||||
$$ = &new_expr(HLSL_IR_UNOP_PREDEC, operands, &loc)->node;
|
||||
$$ = new_unary_expr(HLSL_IR_UNOP_PREDEC, $2, loc);
|
||||
}
|
||||
| unary_op unary_expr
|
||||
{
|
||||
enum hlsl_ir_expr_op ops[] = {0, HLSL_IR_UNOP_NEG,
|
||||
HLSL_IR_UNOP_LOGIC_NOT, HLSL_IR_UNOP_BIT_NOT};
|
||||
struct hlsl_ir_node *operands[3];
|
||||
struct source_location loc;
|
||||
|
||||
if ($1 == UNARY_OP_PLUS)
|
||||
|
@ -2182,10 +2149,8 @@ unary_expr: postfix_expr
|
|||
}
|
||||
else
|
||||
{
|
||||
operands[0] = $2;
|
||||
operands[1] = operands[2] = NULL;
|
||||
set_location(&loc, &@1);
|
||||
$$ = &new_expr(ops[$1], operands, &loc)->node;
|
||||
$$ = new_unary_expr(ops[$1], $2, loc);
|
||||
}
|
||||
}
|
||||
/* var_modifiers just to avoid shift/reduce conflicts */
|
||||
|
@ -2201,7 +2166,7 @@ unary_expr: postfix_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"unexpected modifier in a cast");
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
if ($4)
|
||||
|
@ -2214,7 +2179,7 @@ unary_expr: postfix_expr
|
|||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"can't cast from %s to %s",
|
||||
debug_hlsl_type(src_type), debug_hlsl_type(dst_type));
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
expr = new_cast($6, dst_type, &loc);
|
||||
|
@ -2247,21 +2212,21 @@ mul_expr: unary_expr
|
|||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_mul($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_MUL, $1, $3, loc);
|
||||
}
|
||||
| mul_expr '/' unary_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_div($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_DIV, $1, $3, loc);
|
||||
}
|
||||
| mul_expr '%' unary_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_mod($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_MOD, $1, $3, loc);
|
||||
}
|
||||
|
||||
add_expr: mul_expr
|
||||
|
@ -2273,14 +2238,14 @@ add_expr: mul_expr
|
|||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_add($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_ADD, $1, $3, loc);
|
||||
}
|
||||
| add_expr '-' mul_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_sub($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_SUB, $1, $3, loc);
|
||||
}
|
||||
|
||||
shift_expr: add_expr
|
||||
|
@ -2305,28 +2270,28 @@ relational_expr: shift_expr
|
|||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_lt($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_LESS, $1, $3, loc);
|
||||
}
|
||||
| relational_expr '>' shift_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_gt($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_GREATER, $1, $3, loc);
|
||||
}
|
||||
| relational_expr OP_LE shift_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_le($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_LEQUAL, $1, $3, loc);
|
||||
}
|
||||
| relational_expr OP_GE shift_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_ge($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_GEQUAL, $1, $3, loc);
|
||||
}
|
||||
|
||||
equality_expr: relational_expr
|
||||
|
@ -2338,14 +2303,14 @@ equality_expr: relational_expr
|
|||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_eq($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_EQUAL, $1, $3, loc);
|
||||
}
|
||||
| equality_expr OP_NE relational_expr
|
||||
{
|
||||
struct source_location loc;
|
||||
|
||||
set_location(&loc, &@2);
|
||||
$$ = &hlsl_ne($1, $3, &loc)->node;
|
||||
$$ = new_binary_expr(HLSL_IR_BINOP_NEQUAL, $1, $3, loc);
|
||||
}
|
||||
|
||||
bitand_expr: equality_expr
|
||||
|
@ -2415,11 +2380,11 @@ assignment_expr: conditional_expr
|
|||
{
|
||||
hlsl_report_message(loc.file, loc.line, loc.col, HLSL_LEVEL_ERROR,
|
||||
"l-value is const");
|
||||
return 1;
|
||||
YYABORT;
|
||||
}
|
||||
$$ = make_assignment($1, $2, BWRITERSP_WRITEMASK_ALL, $3);
|
||||
if (!$$)
|
||||
return 1;
|
||||
YYABORT;
|
||||
$$->loc = loc;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
715
dll/directx/wine/d3dcompiler_43/hlsl.yy.h
Normal file
715
dll/directx/wine/d3dcompiler_43/hlsl.yy.h
Normal file
|
@ -0,0 +1,715 @@
|
|||
#ifndef hlsl_HEADER_H
|
||||
#define hlsl_HEADER_H 1
|
||||
#define hlsl_IN_HEADER 1
|
||||
|
||||
#line 5 "hlsl.yy.h"
|
||||
|
||||
#line 7 "hlsl.yy.h"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 6
|
||||
#define YY_FLEX_SUBMINOR_VERSION 4
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
||||
#ifdef yy_create_buffer
|
||||
#define hlsl__create_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_create_buffer hlsl__create_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_delete_buffer
|
||||
#define hlsl__delete_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_delete_buffer hlsl__delete_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_buffer
|
||||
#define hlsl__scan_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_buffer hlsl__scan_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_string
|
||||
#define hlsl__scan_string_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_string hlsl__scan_string
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_bytes
|
||||
#define hlsl__scan_bytes_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_bytes hlsl__scan_bytes
|
||||
#endif
|
||||
|
||||
#ifdef yy_init_buffer
|
||||
#define hlsl__init_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_init_buffer hlsl__init_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_flush_buffer
|
||||
#define hlsl__flush_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_flush_buffer hlsl__flush_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_load_buffer_state
|
||||
#define hlsl__load_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_load_buffer_state hlsl__load_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yy_switch_to_buffer
|
||||
#define hlsl__switch_to_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_switch_to_buffer hlsl__switch_to_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yypush_buffer_state
|
||||
#define hlsl_push_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yypush_buffer_state hlsl_push_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yypop_buffer_state
|
||||
#define hlsl_pop_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yypop_buffer_state hlsl_pop_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yyensure_buffer_stack
|
||||
#define hlsl_ensure_buffer_stack_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyensure_buffer_stack hlsl_ensure_buffer_stack
|
||||
#endif
|
||||
|
||||
#ifdef yylex
|
||||
#define hlsl_lex_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex hlsl_lex
|
||||
#endif
|
||||
|
||||
#ifdef yyrestart
|
||||
#define hlsl_restart_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyrestart hlsl_restart
|
||||
#endif
|
||||
|
||||
#ifdef yylex_init
|
||||
#define hlsl_lex_init_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_init hlsl_lex_init
|
||||
#endif
|
||||
|
||||
#ifdef yylex_init_extra
|
||||
#define hlsl_lex_init_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_init_extra hlsl_lex_init_extra
|
||||
#endif
|
||||
|
||||
#ifdef yylex_destroy
|
||||
#define hlsl_lex_destroy_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_destroy hlsl_lex_destroy
|
||||
#endif
|
||||
|
||||
#ifdef yyget_debug
|
||||
#define hlsl_get_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_debug hlsl_get_debug
|
||||
#endif
|
||||
|
||||
#ifdef yyset_debug
|
||||
#define hlsl_set_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_debug hlsl_set_debug
|
||||
#endif
|
||||
|
||||
#ifdef yyget_extra
|
||||
#define hlsl_get_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_extra hlsl_get_extra
|
||||
#endif
|
||||
|
||||
#ifdef yyset_extra
|
||||
#define hlsl_set_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_extra hlsl_set_extra
|
||||
#endif
|
||||
|
||||
#ifdef yyget_in
|
||||
#define hlsl_get_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_in hlsl_get_in
|
||||
#endif
|
||||
|
||||
#ifdef yyset_in
|
||||
#define hlsl_set_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_in hlsl_set_in
|
||||
#endif
|
||||
|
||||
#ifdef yyget_out
|
||||
#define hlsl_get_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_out hlsl_get_out
|
||||
#endif
|
||||
|
||||
#ifdef yyset_out
|
||||
#define hlsl_set_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_out hlsl_set_out
|
||||
#endif
|
||||
|
||||
#ifdef yyget_leng
|
||||
#define hlsl_get_leng_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_leng hlsl_get_leng
|
||||
#endif
|
||||
|
||||
#ifdef yyget_text
|
||||
#define hlsl_get_text_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_text hlsl_get_text
|
||||
#endif
|
||||
|
||||
#ifdef yyget_lineno
|
||||
#define hlsl_get_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_lineno hlsl_get_lineno
|
||||
#endif
|
||||
|
||||
#ifdef yyset_lineno
|
||||
#define hlsl_set_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_lineno hlsl_set_lineno
|
||||
#endif
|
||||
|
||||
#ifdef yywrap
|
||||
#define hlsl_wrap_ALREADY_DEFINED
|
||||
#else
|
||||
#define yywrap hlsl_wrap
|
||||
#endif
|
||||
|
||||
#ifdef yyalloc
|
||||
#define hlsl_alloc_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyalloc hlsl_alloc
|
||||
#endif
|
||||
|
||||
#ifdef yyrealloc
|
||||
#define hlsl_realloc_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyrealloc hlsl_realloc
|
||||
#endif
|
||||
|
||||
#ifdef yyfree
|
||||
#define hlsl_free_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyfree hlsl_free
|
||||
#endif
|
||||
|
||||
#ifdef yytext
|
||||
#define hlsl_text_ALREADY_DEFINED
|
||||
#else
|
||||
#define yytext hlsl_text
|
||||
#endif
|
||||
|
||||
#ifdef yyleng
|
||||
#define hlsl_leng_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyleng hlsl_leng
|
||||
#endif
|
||||
|
||||
#ifdef yyin
|
||||
#define hlsl_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyin hlsl_in
|
||||
#endif
|
||||
|
||||
#ifdef yyout
|
||||
#define hlsl_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyout hlsl_out
|
||||
#endif
|
||||
|
||||
#ifdef yy_flex_debug
|
||||
#define hlsl__flex_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_flex_debug hlsl__flex_debug
|
||||
#endif
|
||||
|
||||
#ifdef yylineno
|
||||
#define hlsl_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylineno hlsl_lineno
|
||||
#endif
|
||||
|
||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
||||
|
||||
/* begin standard C headers. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* end standard C headers. */
|
||||
|
||||
/* flex integer type definitions */
|
||||
|
||||
#ifndef FLEXINT_H
|
||||
#define FLEXINT_H
|
||||
|
||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
typedef int8_t flex_int8_t;
|
||||
typedef uint8_t flex_uint8_t;
|
||||
typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
#define INT8_MIN (-128)
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
#define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
#ifndef INT32_MIN
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#endif
|
||||
#ifndef INT8_MAX
|
||||
#define INT8_MAX (127)
|
||||
#endif
|
||||
#ifndef INT16_MAX
|
||||
#define INT16_MAX (32767)
|
||||
#endif
|
||||
#ifndef INT32_MAX
|
||||
#define INT32_MAX (2147483647)
|
||||
#endif
|
||||
#ifndef UINT8_MAX
|
||||
#define UINT8_MAX (255U)
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
#define UINT16_MAX (65535U)
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
#define SIZE_MAX (~(size_t)0)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
/* begin standard C++ headers. */
|
||||
|
||||
/* TODO: this is always defined, so inline it */
|
||||
#define yyconst const
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
#define yynoreturn __attribute__((__noreturn__))
|
||||
#else
|
||||
#define yynoreturn
|
||||
#endif
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
||||
#define YY_TYPEDEF_YY_BUFFER_STATE
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
extern int yyleng;
|
||||
|
||||
extern FILE *yyin, *yyout;
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
{
|
||||
FILE *yy_input_file;
|
||||
|
||||
char *yy_ch_buf; /* input buffer */
|
||||
char *yy_buf_pos; /* current position in input buffer */
|
||||
|
||||
/* Size of input buffer in bytes, not including room for EOB
|
||||
* characters.
|
||||
*/
|
||||
int yy_buf_size;
|
||||
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
int yy_n_chars;
|
||||
|
||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
||||
* and can realloc() it to grow it, and should free() it to
|
||||
* delete it.
|
||||
*/
|
||||
int yy_is_our_buffer;
|
||||
|
||||
/* Whether this is an "interactive" input source; if so, and
|
||||
* if we're using stdio for input, then we want to use getc()
|
||||
* instead of fread(), to make sure we stop fetching input after
|
||||
* each newline.
|
||||
*/
|
||||
int yy_is_interactive;
|
||||
|
||||
/* Whether we're considered to be at the beginning of a line.
|
||||
* If so, '^' rules will be active on the next match, otherwise
|
||||
* not.
|
||||
*/
|
||||
int yy_at_bol;
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
int yy_fill_buffer;
|
||||
|
||||
int yy_buffer_status;
|
||||
|
||||
};
|
||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||
|
||||
void yyrestart ( FILE *input_file );
|
||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
void yy_flush_buffer ( YY_BUFFER_STATE b );
|
||||
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
|
||||
void yypop_buffer_state ( void );
|
||||
|
||||
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
|
||||
YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
|
||||
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
|
||||
|
||||
void *yyalloc ( yy_size_t );
|
||||
void *yyrealloc ( void *, yy_size_t );
|
||||
void yyfree ( void * );
|
||||
|
||||
/* Begin user sect3 */
|
||||
|
||||
#define hlsl_wrap() (/*CONSTCOND*/1)
|
||||
#define YY_SKIP_YYWRAP
|
||||
|
||||
extern int yylineno;
|
||||
|
||||
extern char *yytext;
|
||||
#ifdef yytext_ptr
|
||||
#undef yytext_ptr
|
||||
#endif
|
||||
#define yytext_ptr yytext
|
||||
|
||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
||||
#define INITIAL 0
|
||||
#define pp 1
|
||||
#define pp_line 2
|
||||
#define pp_pragma 3
|
||||
#define pp_ignore 4
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNISTD_H
|
||||
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
||||
* down here because we want the user's section 1 to have been scanned first.
|
||||
* The user has a chance to override it with an option.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef YY_EXTRA_TYPE
|
||||
#define YY_EXTRA_TYPE void *
|
||||
#endif
|
||||
|
||||
/* Accessor methods to globals.
|
||||
These are made visible to non-reentrant scanners for convenience. */
|
||||
|
||||
int yylex_destroy ( void );
|
||||
|
||||
int yyget_debug ( void );
|
||||
|
||||
void yyset_debug ( int debug_flag );
|
||||
|
||||
YY_EXTRA_TYPE yyget_extra ( void );
|
||||
|
||||
void yyset_extra ( YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *yyget_in ( void );
|
||||
|
||||
void yyset_in ( FILE * _in_str );
|
||||
|
||||
FILE *yyget_out ( void );
|
||||
|
||||
void yyset_out ( FILE * _out_str );
|
||||
|
||||
int yyget_leng ( void );
|
||||
|
||||
char *yyget_text ( void );
|
||||
|
||||
int yyget_lineno ( void );
|
||||
|
||||
void yyset_lineno ( int _line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
|
||||
#ifndef YY_SKIP_YYWRAP
|
||||
#ifdef __cplusplus
|
||||
extern "C" int yywrap ( void );
|
||||
#else
|
||||
extern int yywrap ( void );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy ( char *, const char *, int );
|
||||
#endif
|
||||
|
||||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen ( const char * );
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
|
||||
#endif
|
||||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Number of entries by which start-condition stack grows. */
|
||||
#ifndef YY_START_STACK_INCR
|
||||
#define YY_START_STACK_INCR 25
|
||||
#endif
|
||||
|
||||
/* Default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters.
|
||||
*/
|
||||
#ifndef YY_DECL
|
||||
#define YY_DECL_IS_OURS 1
|
||||
|
||||
extern int yylex (void);
|
||||
|
||||
#define YY_DECL int yylex (void)
|
||||
#endif /* !YY_DECL */
|
||||
|
||||
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
||||
|
||||
#undef YY_NEW_FILE
|
||||
#undef YY_FLUSH_BUFFER
|
||||
#undef yy_set_bol
|
||||
#undef yy_new_buffer
|
||||
#undef yy_set_interactive
|
||||
#undef YY_DO_BEFORE_ACTION
|
||||
|
||||
#ifdef YY_DECL_IS_OURS
|
||||
#undef YY_DECL_IS_OURS
|
||||
#undef YY_DECL
|
||||
#endif
|
||||
|
||||
#ifndef hlsl__create_buffer_ALREADY_DEFINED
|
||||
#undef yy_create_buffer
|
||||
#endif
|
||||
#ifndef hlsl__delete_buffer_ALREADY_DEFINED
|
||||
#undef yy_delete_buffer
|
||||
#endif
|
||||
#ifndef hlsl__scan_buffer_ALREADY_DEFINED
|
||||
#undef yy_scan_buffer
|
||||
#endif
|
||||
#ifndef hlsl__scan_string_ALREADY_DEFINED
|
||||
#undef yy_scan_string
|
||||
#endif
|
||||
#ifndef hlsl__scan_bytes_ALREADY_DEFINED
|
||||
#undef yy_scan_bytes
|
||||
#endif
|
||||
#ifndef hlsl__init_buffer_ALREADY_DEFINED
|
||||
#undef yy_init_buffer
|
||||
#endif
|
||||
#ifndef hlsl__flush_buffer_ALREADY_DEFINED
|
||||
#undef yy_flush_buffer
|
||||
#endif
|
||||
#ifndef hlsl__load_buffer_state_ALREADY_DEFINED
|
||||
#undef yy_load_buffer_state
|
||||
#endif
|
||||
#ifndef hlsl__switch_to_buffer_ALREADY_DEFINED
|
||||
#undef yy_switch_to_buffer
|
||||
#endif
|
||||
#ifndef hlsl_push_buffer_state_ALREADY_DEFINED
|
||||
#undef yypush_buffer_state
|
||||
#endif
|
||||
#ifndef hlsl_pop_buffer_state_ALREADY_DEFINED
|
||||
#undef yypop_buffer_state
|
||||
#endif
|
||||
#ifndef hlsl_ensure_buffer_stack_ALREADY_DEFINED
|
||||
#undef yyensure_buffer_stack
|
||||
#endif
|
||||
#ifndef hlsl_lex_ALREADY_DEFINED
|
||||
#undef yylex
|
||||
#endif
|
||||
#ifndef hlsl_restart_ALREADY_DEFINED
|
||||
#undef yyrestart
|
||||
#endif
|
||||
#ifndef hlsl_lex_init_ALREADY_DEFINED
|
||||
#undef yylex_init
|
||||
#endif
|
||||
#ifndef hlsl_lex_init_extra_ALREADY_DEFINED
|
||||
#undef yylex_init_extra
|
||||
#endif
|
||||
#ifndef hlsl_lex_destroy_ALREADY_DEFINED
|
||||
#undef yylex_destroy
|
||||
#endif
|
||||
#ifndef hlsl_get_debug_ALREADY_DEFINED
|
||||
#undef yyget_debug
|
||||
#endif
|
||||
#ifndef hlsl_set_debug_ALREADY_DEFINED
|
||||
#undef yyset_debug
|
||||
#endif
|
||||
#ifndef hlsl_get_extra_ALREADY_DEFINED
|
||||
#undef yyget_extra
|
||||
#endif
|
||||
#ifndef hlsl_set_extra_ALREADY_DEFINED
|
||||
#undef yyset_extra
|
||||
#endif
|
||||
#ifndef hlsl_get_in_ALREADY_DEFINED
|
||||
#undef yyget_in
|
||||
#endif
|
||||
#ifndef hlsl_set_in_ALREADY_DEFINED
|
||||
#undef yyset_in
|
||||
#endif
|
||||
#ifndef hlsl_get_out_ALREADY_DEFINED
|
||||
#undef yyget_out
|
||||
#endif
|
||||
#ifndef hlsl_set_out_ALREADY_DEFINED
|
||||
#undef yyset_out
|
||||
#endif
|
||||
#ifndef hlsl_get_leng_ALREADY_DEFINED
|
||||
#undef yyget_leng
|
||||
#endif
|
||||
#ifndef hlsl_get_text_ALREADY_DEFINED
|
||||
#undef yyget_text
|
||||
#endif
|
||||
#ifndef hlsl_get_lineno_ALREADY_DEFINED
|
||||
#undef yyget_lineno
|
||||
#endif
|
||||
#ifndef hlsl_set_lineno_ALREADY_DEFINED
|
||||
#undef yyset_lineno
|
||||
#endif
|
||||
#ifndef hlsl_get_column_ALREADY_DEFINED
|
||||
#undef yyget_column
|
||||
#endif
|
||||
#ifndef hlsl_set_column_ALREADY_DEFINED
|
||||
#undef yyset_column
|
||||
#endif
|
||||
#ifndef hlsl_wrap_ALREADY_DEFINED
|
||||
#undef yywrap
|
||||
#endif
|
||||
#ifndef hlsl_get_lval_ALREADY_DEFINED
|
||||
#undef yyget_lval
|
||||
#endif
|
||||
#ifndef hlsl_set_lval_ALREADY_DEFINED
|
||||
#undef yyset_lval
|
||||
#endif
|
||||
#ifndef hlsl_get_lloc_ALREADY_DEFINED
|
||||
#undef yyget_lloc
|
||||
#endif
|
||||
#ifndef hlsl_set_lloc_ALREADY_DEFINED
|
||||
#undef yyset_lloc
|
||||
#endif
|
||||
#ifndef hlsl_alloc_ALREADY_DEFINED
|
||||
#undef yyalloc
|
||||
#endif
|
||||
#ifndef hlsl_realloc_ALREADY_DEFINED
|
||||
#undef yyrealloc
|
||||
#endif
|
||||
#ifndef hlsl_free_ALREADY_DEFINED
|
||||
#undef yyfree
|
||||
#endif
|
||||
#ifndef hlsl_text_ALREADY_DEFINED
|
||||
#undef yytext
|
||||
#endif
|
||||
#ifndef hlsl_leng_ALREADY_DEFINED
|
||||
#undef yyleng
|
||||
#endif
|
||||
#ifndef hlsl_in_ALREADY_DEFINED
|
||||
#undef yyin
|
||||
#endif
|
||||
#ifndef hlsl_out_ALREADY_DEFINED
|
||||
#undef yyout
|
||||
#endif
|
||||
#ifndef hlsl__flex_debug_ALREADY_DEFINED
|
||||
#undef yy_flex_debug
|
||||
#endif
|
||||
#ifndef hlsl_lineno_ALREADY_DEFINED
|
||||
#undef yylineno
|
||||
#endif
|
||||
#ifndef hlsl_tables_fload_ALREADY_DEFINED
|
||||
#undef yytables_fload
|
||||
#endif
|
||||
#ifndef hlsl_tables_destroy_ALREADY_DEFINED
|
||||
#undef yytables_destroy
|
||||
#endif
|
||||
#ifndef hlsl_TABLES_NAME_ALREADY_DEFINED
|
||||
#undef yyTABLES_NAME
|
||||
#endif
|
||||
|
||||
#line 274 "hlsl.l"
|
||||
|
||||
|
||||
#line 713 "hlsl.yy.h"
|
||||
#undef hlsl_IN_HEADER
|
||||
#endif /* hlsl_HEADER_H */
|
|
@ -19,8 +19,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
|
|
1547
dll/directx/wine/d3dcompiler_43/ppl.l
Normal file
1547
dll/directx/wine/d3dcompiler_43/ppl.l
Normal file
File diff suppressed because it is too large
Load diff
4757
dll/directx/wine/d3dcompiler_43/ppl.yy.c
Normal file
4757
dll/directx/wine/d3dcompiler_43/ppl.yy.c
Normal file
File diff suppressed because it is too large
Load diff
730
dll/directx/wine/d3dcompiler_43/ppl.yy.h
Normal file
730
dll/directx/wine/d3dcompiler_43/ppl.yy.h
Normal file
|
@ -0,0 +1,730 @@
|
|||
#ifndef ppy_HEADER_H
|
||||
#define ppy_HEADER_H 1
|
||||
#define ppy_IN_HEADER 1
|
||||
|
||||
#line 5 "ppl.yy.h"
|
||||
|
||||
#line 7 "ppl.yy.h"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 6
|
||||
#define YY_FLEX_SUBMINOR_VERSION 4
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
|
||||
#ifdef yy_create_buffer
|
||||
#define ppy__create_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_create_buffer ppy__create_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_delete_buffer
|
||||
#define ppy__delete_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_delete_buffer ppy__delete_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_buffer
|
||||
#define ppy__scan_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_buffer ppy__scan_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_string
|
||||
#define ppy__scan_string_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_string ppy__scan_string
|
||||
#endif
|
||||
|
||||
#ifdef yy_scan_bytes
|
||||
#define ppy__scan_bytes_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_scan_bytes ppy__scan_bytes
|
||||
#endif
|
||||
|
||||
#ifdef yy_init_buffer
|
||||
#define ppy__init_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_init_buffer ppy__init_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_flush_buffer
|
||||
#define ppy__flush_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_flush_buffer ppy__flush_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yy_load_buffer_state
|
||||
#define ppy__load_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_load_buffer_state ppy__load_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yy_switch_to_buffer
|
||||
#define ppy__switch_to_buffer_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_switch_to_buffer ppy__switch_to_buffer
|
||||
#endif
|
||||
|
||||
#ifdef yypush_buffer_state
|
||||
#define ppy_push_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yypush_buffer_state ppy_push_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yypop_buffer_state
|
||||
#define ppy_pop_buffer_state_ALREADY_DEFINED
|
||||
#else
|
||||
#define yypop_buffer_state ppy_pop_buffer_state
|
||||
#endif
|
||||
|
||||
#ifdef yyensure_buffer_stack
|
||||
#define ppy_ensure_buffer_stack_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyensure_buffer_stack ppy_ensure_buffer_stack
|
||||
#endif
|
||||
|
||||
#ifdef yylex
|
||||
#define ppy_lex_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex ppy_lex
|
||||
#endif
|
||||
|
||||
#ifdef yyrestart
|
||||
#define ppy_restart_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyrestart ppy_restart
|
||||
#endif
|
||||
|
||||
#ifdef yylex_init
|
||||
#define ppy_lex_init_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_init ppy_lex_init
|
||||
#endif
|
||||
|
||||
#ifdef yylex_init_extra
|
||||
#define ppy_lex_init_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_init_extra ppy_lex_init_extra
|
||||
#endif
|
||||
|
||||
#ifdef yylex_destroy
|
||||
#define ppy_lex_destroy_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylex_destroy ppy_lex_destroy
|
||||
#endif
|
||||
|
||||
#ifdef yyget_debug
|
||||
#define ppy_get_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_debug ppy_get_debug
|
||||
#endif
|
||||
|
||||
#ifdef yyset_debug
|
||||
#define ppy_set_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_debug ppy_set_debug
|
||||
#endif
|
||||
|
||||
#ifdef yyget_extra
|
||||
#define ppy_get_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_extra ppy_get_extra
|
||||
#endif
|
||||
|
||||
#ifdef yyset_extra
|
||||
#define ppy_set_extra_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_extra ppy_set_extra
|
||||
#endif
|
||||
|
||||
#ifdef yyget_in
|
||||
#define ppy_get_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_in ppy_get_in
|
||||
#endif
|
||||
|
||||
#ifdef yyset_in
|
||||
#define ppy_set_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_in ppy_set_in
|
||||
#endif
|
||||
|
||||
#ifdef yyget_out
|
||||
#define ppy_get_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_out ppy_get_out
|
||||
#endif
|
||||
|
||||
#ifdef yyset_out
|
||||
#define ppy_set_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_out ppy_set_out
|
||||
#endif
|
||||
|
||||
#ifdef yyget_leng
|
||||
#define ppy_get_leng_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_leng ppy_get_leng
|
||||
#endif
|
||||
|
||||
#ifdef yyget_text
|
||||
#define ppy_get_text_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_text ppy_get_text
|
||||
#endif
|
||||
|
||||
#ifdef yyget_lineno
|
||||
#define ppy_get_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyget_lineno ppy_get_lineno
|
||||
#endif
|
||||
|
||||
#ifdef yyset_lineno
|
||||
#define ppy_set_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyset_lineno ppy_set_lineno
|
||||
#endif
|
||||
|
||||
#ifdef yywrap
|
||||
#define ppy_wrap_ALREADY_DEFINED
|
||||
#else
|
||||
#define yywrap ppy_wrap
|
||||
#endif
|
||||
|
||||
#ifdef yyalloc
|
||||
#define ppy_alloc_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyalloc ppy_alloc
|
||||
#endif
|
||||
|
||||
#ifdef yyrealloc
|
||||
#define ppy_realloc_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyrealloc ppy_realloc
|
||||
#endif
|
||||
|
||||
#ifdef yyfree
|
||||
#define ppy_free_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyfree ppy_free
|
||||
#endif
|
||||
|
||||
#ifdef yytext
|
||||
#define ppy_text_ALREADY_DEFINED
|
||||
#else
|
||||
#define yytext ppy_text
|
||||
#endif
|
||||
|
||||
#ifdef yyleng
|
||||
#define ppy_leng_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyleng ppy_leng
|
||||
#endif
|
||||
|
||||
#ifdef yyin
|
||||
#define ppy_in_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyin ppy_in
|
||||
#endif
|
||||
|
||||
#ifdef yyout
|
||||
#define ppy_out_ALREADY_DEFINED
|
||||
#else
|
||||
#define yyout ppy_out
|
||||
#endif
|
||||
|
||||
#ifdef yy_flex_debug
|
||||
#define ppy__flex_debug_ALREADY_DEFINED
|
||||
#else
|
||||
#define yy_flex_debug ppy__flex_debug
|
||||
#endif
|
||||
|
||||
#ifdef yylineno
|
||||
#define ppy_lineno_ALREADY_DEFINED
|
||||
#else
|
||||
#define yylineno ppy_lineno
|
||||
#endif
|
||||
|
||||
/* First, we deal with platform-specific or compiler-specific issues. */
|
||||
|
||||
/* begin standard C headers. */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* end standard C headers. */
|
||||
|
||||
/* flex integer type definitions */
|
||||
|
||||
#ifndef FLEXINT_H
|
||||
#define FLEXINT_H
|
||||
|
||||
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
|
||||
|
||||
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
|
||||
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
|
||||
* if you want the limit (max/min) macros for int types.
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
typedef int8_t flex_int8_t;
|
||||
typedef uint8_t flex_uint8_t;
|
||||
typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
#define INT8_MIN (-128)
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
#define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
#ifndef INT32_MIN
|
||||
#define INT32_MIN (-2147483647-1)
|
||||
#endif
|
||||
#ifndef INT8_MAX
|
||||
#define INT8_MAX (127)
|
||||
#endif
|
||||
#ifndef INT16_MAX
|
||||
#define INT16_MAX (32767)
|
||||
#endif
|
||||
#ifndef INT32_MAX
|
||||
#define INT32_MAX (2147483647)
|
||||
#endif
|
||||
#ifndef UINT8_MAX
|
||||
#define UINT8_MAX (255U)
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
#define UINT16_MAX (65535U)
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
#define SIZE_MAX (~(size_t)0)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
/* begin standard C++ headers. */
|
||||
|
||||
/* TODO: this is always defined, so inline it */
|
||||
#define yyconst const
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||
#define yynoreturn __attribute__((__noreturn__))
|
||||
#else
|
||||
#define yynoreturn
|
||||
#endif
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
|
||||
#define YY_TYPEDEF_YY_BUFFER_STATE
|
||||
typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
||||
#endif
|
||||
|
||||
#ifndef YY_TYPEDEF_YY_SIZE_T
|
||||
#define YY_TYPEDEF_YY_SIZE_T
|
||||
typedef size_t yy_size_t;
|
||||
#endif
|
||||
|
||||
extern int yyleng;
|
||||
|
||||
extern FILE *yyin, *yyout;
|
||||
|
||||
#ifndef YY_STRUCT_YY_BUFFER_STATE
|
||||
#define YY_STRUCT_YY_BUFFER_STATE
|
||||
struct yy_buffer_state
|
||||
{
|
||||
FILE *yy_input_file;
|
||||
|
||||
char *yy_ch_buf; /* input buffer */
|
||||
char *yy_buf_pos; /* current position in input buffer */
|
||||
|
||||
/* Size of input buffer in bytes, not including room for EOB
|
||||
* characters.
|
||||
*/
|
||||
int yy_buf_size;
|
||||
|
||||
/* Number of characters read into yy_ch_buf, not including EOB
|
||||
* characters.
|
||||
*/
|
||||
int yy_n_chars;
|
||||
|
||||
/* Whether we "own" the buffer - i.e., we know we created it,
|
||||
* and can realloc() it to grow it, and should free() it to
|
||||
* delete it.
|
||||
*/
|
||||
int yy_is_our_buffer;
|
||||
|
||||
/* Whether this is an "interactive" input source; if so, and
|
||||
* if we're using stdio for input, then we want to use getc()
|
||||
* instead of fread(), to make sure we stop fetching input after
|
||||
* each newline.
|
||||
*/
|
||||
int yy_is_interactive;
|
||||
|
||||
/* Whether we're considered to be at the beginning of a line.
|
||||
* If so, '^' rules will be active on the next match, otherwise
|
||||
* not.
|
||||
*/
|
||||
int yy_at_bol;
|
||||
|
||||
int yy_bs_lineno; /**< The line count. */
|
||||
int yy_bs_column; /**< The column count. */
|
||||
|
||||
/* Whether to try to fill the input buffer when we reach the
|
||||
* end of it.
|
||||
*/
|
||||
int yy_fill_buffer;
|
||||
|
||||
int yy_buffer_status;
|
||||
|
||||
};
|
||||
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
|
||||
|
||||
void yyrestart ( FILE *input_file );
|
||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
void yy_flush_buffer ( YY_BUFFER_STATE b );
|
||||
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
|
||||
void yypop_buffer_state ( void );
|
||||
|
||||
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
|
||||
YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
|
||||
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
|
||||
|
||||
void *yyalloc ( yy_size_t );
|
||||
void *yyrealloc ( void *, yy_size_t );
|
||||
void yyfree ( void * );
|
||||
|
||||
/* Begin user sect3 */
|
||||
|
||||
extern int yylineno;
|
||||
|
||||
extern char *yytext;
|
||||
#ifdef yytext_ptr
|
||||
#undef yytext_ptr
|
||||
#endif
|
||||
#define yytext_ptr yytext
|
||||
|
||||
#ifdef YY_HEADER_EXPORT_START_CONDITIONS
|
||||
#define INITIAL 0
|
||||
#define pp_pp 1
|
||||
#define pp_eol 2
|
||||
#define pp_inc 3
|
||||
#define pp_dqs 4
|
||||
#define pp_sqs 5
|
||||
#define pp_iqs 6
|
||||
#define pp_comment 7
|
||||
#define pp_def 8
|
||||
#define pp_define 9
|
||||
#define pp_macro 10
|
||||
#define pp_mbody 11
|
||||
#define pp_macign 12
|
||||
#define pp_macscan 13
|
||||
#define pp_macexp 14
|
||||
#define pp_if 15
|
||||
#define pp_ifd 16
|
||||
#define pp_ifignored 17
|
||||
#define pp_endif 18
|
||||
#define pp_line 19
|
||||
#define pp_defined 20
|
||||
#define pp_ignore 21
|
||||
#define RCINCL 22
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_UNISTD_H
|
||||
/* Special case for "unistd.h", since it is non-ANSI. We include it way
|
||||
* down here because we want the user's section 1 to have been scanned first.
|
||||
* The user has a chance to override it with an option.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef YY_EXTRA_TYPE
|
||||
#define YY_EXTRA_TYPE void *
|
||||
#endif
|
||||
|
||||
/* Accessor methods to globals.
|
||||
These are made visible to non-reentrant scanners for convenience. */
|
||||
|
||||
int yylex_destroy ( void );
|
||||
|
||||
int yyget_debug ( void );
|
||||
|
||||
void yyset_debug ( int debug_flag );
|
||||
|
||||
YY_EXTRA_TYPE yyget_extra ( void );
|
||||
|
||||
void yyset_extra ( YY_EXTRA_TYPE user_defined );
|
||||
|
||||
FILE *yyget_in ( void );
|
||||
|
||||
void yyset_in ( FILE * _in_str );
|
||||
|
||||
FILE *yyget_out ( void );
|
||||
|
||||
void yyset_out ( FILE * _out_str );
|
||||
|
||||
int yyget_leng ( void );
|
||||
|
||||
char *yyget_text ( void );
|
||||
|
||||
int yyget_lineno ( void );
|
||||
|
||||
void yyset_lineno ( int _line_number );
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
*/
|
||||
|
||||
#ifndef YY_SKIP_YYWRAP
|
||||
#ifdef __cplusplus
|
||||
extern "C" int yywrap ( void );
|
||||
#else
|
||||
extern int yywrap ( void );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef yytext_ptr
|
||||
static void yy_flex_strncpy ( char *, const char *, int );
|
||||
#endif
|
||||
|
||||
#ifdef YY_NEED_STRLEN
|
||||
static int yy_flex_strlen ( const char * );
|
||||
#endif
|
||||
|
||||
#ifndef YY_NO_INPUT
|
||||
|
||||
#endif
|
||||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Number of entries by which start-condition stack grows. */
|
||||
#ifndef YY_START_STACK_INCR
|
||||
#define YY_START_STACK_INCR 25
|
||||
#endif
|
||||
|
||||
/* Default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters.
|
||||
*/
|
||||
#ifndef YY_DECL
|
||||
#define YY_DECL_IS_OURS 1
|
||||
|
||||
extern int yylex (void);
|
||||
|
||||
#define YY_DECL int yylex (void)
|
||||
#endif /* !YY_DECL */
|
||||
|
||||
/* yy_get_previous_state - get the state just before the EOB char was reached */
|
||||
|
||||
#undef YY_NEW_FILE
|
||||
#undef YY_FLUSH_BUFFER
|
||||
#undef yy_set_bol
|
||||
#undef yy_new_buffer
|
||||
#undef yy_set_interactive
|
||||
#undef YY_DO_BEFORE_ACTION
|
||||
|
||||
#ifdef YY_DECL_IS_OURS
|
||||
#undef YY_DECL_IS_OURS
|
||||
#undef YY_DECL
|
||||
#endif
|
||||
|
||||
#ifndef ppy__create_buffer_ALREADY_DEFINED
|
||||
#undef yy_create_buffer
|
||||
#endif
|
||||
#ifndef ppy__delete_buffer_ALREADY_DEFINED
|
||||
#undef yy_delete_buffer
|
||||
#endif
|
||||
#ifndef ppy__scan_buffer_ALREADY_DEFINED
|
||||
#undef yy_scan_buffer
|
||||
#endif
|
||||
#ifndef ppy__scan_string_ALREADY_DEFINED
|
||||
#undef yy_scan_string
|
||||
#endif
|
||||
#ifndef ppy__scan_bytes_ALREADY_DEFINED
|
||||
#undef yy_scan_bytes
|
||||
#endif
|
||||
#ifndef ppy__init_buffer_ALREADY_DEFINED
|
||||
#undef yy_init_buffer
|
||||
#endif
|
||||
#ifndef ppy__flush_buffer_ALREADY_DEFINED
|
||||
#undef yy_flush_buffer
|
||||
#endif
|
||||
#ifndef ppy__load_buffer_state_ALREADY_DEFINED
|
||||
#undef yy_load_buffer_state
|
||||
#endif
|
||||
#ifndef ppy__switch_to_buffer_ALREADY_DEFINED
|
||||
#undef yy_switch_to_buffer
|
||||
#endif
|
||||
#ifndef ppy_push_buffer_state_ALREADY_DEFINED
|
||||
#undef yypush_buffer_state
|
||||
#endif
|
||||
#ifndef ppy_pop_buffer_state_ALREADY_DEFINED
|
||||
#undef yypop_buffer_state
|
||||
#endif
|
||||
#ifndef ppy_ensure_buffer_stack_ALREADY_DEFINED
|
||||
#undef yyensure_buffer_stack
|
||||
#endif
|
||||
#ifndef ppy_lex_ALREADY_DEFINED
|
||||
#undef yylex
|
||||
#endif
|
||||
#ifndef ppy_restart_ALREADY_DEFINED
|
||||
#undef yyrestart
|
||||
#endif
|
||||
#ifndef ppy_lex_init_ALREADY_DEFINED
|
||||
#undef yylex_init
|
||||
#endif
|
||||
#ifndef ppy_lex_init_extra_ALREADY_DEFINED
|
||||
#undef yylex_init_extra
|
||||
#endif
|
||||
#ifndef ppy_lex_destroy_ALREADY_DEFINED
|
||||
#undef yylex_destroy
|
||||
#endif
|
||||
#ifndef ppy_get_debug_ALREADY_DEFINED
|
||||
#undef yyget_debug
|
||||
#endif
|
||||
#ifndef ppy_set_debug_ALREADY_DEFINED
|
||||
#undef yyset_debug
|
||||
#endif
|
||||
#ifndef ppy_get_extra_ALREADY_DEFINED
|
||||
#undef yyget_extra
|
||||
#endif
|
||||
#ifndef ppy_set_extra_ALREADY_DEFINED
|
||||
#undef yyset_extra
|
||||
#endif
|
||||
#ifndef ppy_get_in_ALREADY_DEFINED
|
||||
#undef yyget_in
|
||||
#endif
|
||||
#ifndef ppy_set_in_ALREADY_DEFINED
|
||||
#undef yyset_in
|
||||
#endif
|
||||
#ifndef ppy_get_out_ALREADY_DEFINED
|
||||
#undef yyget_out
|
||||
#endif
|
||||
#ifndef ppy_set_out_ALREADY_DEFINED
|
||||
#undef yyset_out
|
||||
#endif
|
||||
#ifndef ppy_get_leng_ALREADY_DEFINED
|
||||
#undef yyget_leng
|
||||
#endif
|
||||
#ifndef ppy_get_text_ALREADY_DEFINED
|
||||
#undef yyget_text
|
||||
#endif
|
||||
#ifndef ppy_get_lineno_ALREADY_DEFINED
|
||||
#undef yyget_lineno
|
||||
#endif
|
||||
#ifndef ppy_set_lineno_ALREADY_DEFINED
|
||||
#undef yyset_lineno
|
||||
#endif
|
||||
#ifndef ppy_get_column_ALREADY_DEFINED
|
||||
#undef yyget_column
|
||||
#endif
|
||||
#ifndef ppy_set_column_ALREADY_DEFINED
|
||||
#undef yyset_column
|
||||
#endif
|
||||
#ifndef ppy_wrap_ALREADY_DEFINED
|
||||
#undef yywrap
|
||||
#endif
|
||||
#ifndef ppy_get_lval_ALREADY_DEFINED
|
||||
#undef yyget_lval
|
||||
#endif
|
||||
#ifndef ppy_set_lval_ALREADY_DEFINED
|
||||
#undef yyset_lval
|
||||
#endif
|
||||
#ifndef ppy_get_lloc_ALREADY_DEFINED
|
||||
#undef yyget_lloc
|
||||
#endif
|
||||
#ifndef ppy_set_lloc_ALREADY_DEFINED
|
||||
#undef yyset_lloc
|
||||
#endif
|
||||
#ifndef ppy_alloc_ALREADY_DEFINED
|
||||
#undef yyalloc
|
||||
#endif
|
||||
#ifndef ppy_realloc_ALREADY_DEFINED
|
||||
#undef yyrealloc
|
||||
#endif
|
||||
#ifndef ppy_free_ALREADY_DEFINED
|
||||
#undef yyfree
|
||||
#endif
|
||||
#ifndef ppy_text_ALREADY_DEFINED
|
||||
#undef yytext
|
||||
#endif
|
||||
#ifndef ppy_leng_ALREADY_DEFINED
|
||||
#undef yyleng
|
||||
#endif
|
||||
#ifndef ppy_in_ALREADY_DEFINED
|
||||
#undef yyin
|
||||
#endif
|
||||
#ifndef ppy_out_ALREADY_DEFINED
|
||||
#undef yyout
|
||||
#endif
|
||||
#ifndef ppy__flex_debug_ALREADY_DEFINED
|
||||
#undef yy_flex_debug
|
||||
#endif
|
||||
#ifndef ppy_lineno_ALREADY_DEFINED
|
||||
#undef yylineno
|
||||
#endif
|
||||
#ifndef ppy_tables_fload_ALREADY_DEFINED
|
||||
#undef yytables_fload
|
||||
#endif
|
||||
#ifndef ppy_tables_destroy_ALREADY_DEFINED
|
||||
#undef yytables_destroy
|
||||
#endif
|
||||
#ifndef ppy_TABLES_NAME_ALREADY_DEFINED
|
||||
#undef yyTABLES_NAME
|
||||
#endif
|
||||
|
||||
#line 768 "ppl.l"
|
||||
|
||||
|
||||
#line 728 "ppl.yy.h"
|
||||
#undef ppy_IN_HEADER
|
||||
#endif /* ppy_HEADER_H */
|
2619
dll/directx/wine/d3dcompiler_43/ppy.tab.c
Normal file
2619
dll/directx/wine/d3dcompiler_43/ppy.tab.c
Normal file
File diff suppressed because it is too large
Load diff
129
dll/directx/wine/d3dcompiler_43/ppy.tab.h
Normal file
129
dll/directx/wine/d3dcompiler_43/ppy.tab.h
Normal file
|
@ -0,0 +1,129 @@
|
|||
/* A Bison parser, made by GNU Bison 3.4.1. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* Undocumented macros, especially those whose name start with YY_,
|
||||
are private implementation details. Do not rely on them. */
|
||||
|
||||
#ifndef YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED
|
||||
# define YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int ppy_debug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
tRCINCLUDE = 258,
|
||||
tIF = 259,
|
||||
tIFDEF = 260,
|
||||
tIFNDEF = 261,
|
||||
tELSE = 262,
|
||||
tELIF = 263,
|
||||
tENDIF = 264,
|
||||
tDEFINED = 265,
|
||||
tNL = 266,
|
||||
tINCLUDE = 267,
|
||||
tLINE = 268,
|
||||
tGCCLINE = 269,
|
||||
tERROR = 270,
|
||||
tWARNING = 271,
|
||||
tPRAGMA = 272,
|
||||
tPPIDENT = 273,
|
||||
tUNDEF = 274,
|
||||
tMACROEND = 275,
|
||||
tCONCAT = 276,
|
||||
tELIPSIS = 277,
|
||||
tSTRINGIZE = 278,
|
||||
tIDENT = 279,
|
||||
tLITERAL = 280,
|
||||
tMACRO = 281,
|
||||
tDEFINE = 282,
|
||||
tDQSTRING = 283,
|
||||
tSQSTRING = 284,
|
||||
tIQSTRING = 285,
|
||||
tUINT = 286,
|
||||
tSINT = 287,
|
||||
tULONG = 288,
|
||||
tSLONG = 289,
|
||||
tULONGLONG = 290,
|
||||
tSLONGLONG = 291,
|
||||
tRCINCLUDEPATH = 292,
|
||||
tLOGOR = 293,
|
||||
tLOGAND = 294,
|
||||
tEQ = 295,
|
||||
tNE = 296,
|
||||
tLTE = 297,
|
||||
tGTE = 298,
|
||||
tLSHIFT = 299,
|
||||
tRSHIFT = 300
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 114 "ppy.y"
|
||||
|
||||
int sint;
|
||||
unsigned int uint;
|
||||
long slong;
|
||||
unsigned long ulong;
|
||||
__int64 sll;
|
||||
unsigned __int64 ull;
|
||||
int *iptr;
|
||||
char *cptr;
|
||||
cval_t cval;
|
||||
marg_t *marg;
|
||||
mtext_t *mtext;
|
||||
|
||||
#line 117 "ppy.tab.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
|
||||
extern YYSTYPE ppy_lval;
|
||||
|
||||
int ppy_parse (void);
|
||||
|
||||
#endif /* !YY_PPY_E_REACTOSSYNC_GCC_DLL_DIRECTX_WINE_D3DCOMPILER_43_PPY_TAB_H_INCLUDED */
|
687
dll/directx/wine/d3dcompiler_43/ppy.y
Normal file
687
dll/directx/wine/d3dcompiler_43/ppy.y
Normal file
|
@ -0,0 +1,687 @@
|
|||
/*
|
||||
* Wrc preprocessor syntax analysis
|
||||
*
|
||||
* Copyright 1999-2000 Bertho A. Stultiens (BS)
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "wpp_private.h"
|
||||
|
||||
|
||||
#define UNARY_OP(r, v, OP) \
|
||||
switch(v.type) \
|
||||
{ \
|
||||
case cv_sint: r.val.si = OP v.val.si; break; \
|
||||
case cv_uint: r.val.ui = OP v.val.ui; break; \
|
||||
case cv_slong: r.val.sl = OP v.val.sl; break; \
|
||||
case cv_ulong: r.val.ul = OP v.val.ul; break; \
|
||||
case cv_sll: r.val.sll = OP v.val.sll; break; \
|
||||
case cv_ull: r.val.ull = OP v.val.ull; break; \
|
||||
}
|
||||
|
||||
#define cv_signed(v) ((v.type & FLAG_SIGNED) != 0)
|
||||
|
||||
#define BIN_OP_INT(r, v1, v2, OP) \
|
||||
r.type = v1.type; \
|
||||
if(cv_signed(v1) && cv_signed(v2)) \
|
||||
r.val.si = v1.val.si OP v2.val.si; \
|
||||
else if(cv_signed(v1) && !cv_signed(v2)) \
|
||||
r.val.si = v1.val.si OP (signed) v2.val.ui; \
|
||||
else if(!cv_signed(v1) && cv_signed(v2)) \
|
||||
r.val.si = (signed) v1.val.ui OP v2.val.si; \
|
||||
else \
|
||||
r.val.ui = v1.val.ui OP v2.val.ui;
|
||||
|
||||
#define BIN_OP_LONG(r, v1, v2, OP) \
|
||||
r.type = v1.type; \
|
||||
if(cv_signed(v1) && cv_signed(v2)) \
|
||||
r.val.sl = v1.val.sl OP v2.val.sl; \
|
||||
else if(cv_signed(v1) && !cv_signed(v2)) \
|
||||
r.val.sl = v1.val.sl OP (signed long) v2.val.ul; \
|
||||
else if(!cv_signed(v1) && cv_signed(v2)) \
|
||||
r.val.sl = (signed long) v1.val.ul OP v2.val.sl; \
|
||||
else \
|
||||
r.val.ul = v1.val.ul OP v2.val.ul;
|
||||
|
||||
#define BIN_OP_LONGLONG(r, v1, v2, OP) \
|
||||
r.type = v1.type; \
|
||||
if(cv_signed(v1) && cv_signed(v2)) \
|
||||
r.val.sll = v1.val.sll OP v2.val.sll; \
|
||||
else if(cv_signed(v1) && !cv_signed(v2)) \
|
||||
r.val.sll = v1.val.sll OP (__int64) v2.val.ull; \
|
||||
else if(!cv_signed(v1) && cv_signed(v2)) \
|
||||
r.val.sll = (__int64) v1.val.ull OP v2.val.sll; \
|
||||
else \
|
||||
r.val.ull = v1.val.ull OP v2.val.ull;
|
||||
|
||||
#define BIN_OP(r, v1, v2, OP) \
|
||||
switch(v1.type & SIZE_MASK) \
|
||||
{ \
|
||||
case SIZE_INT: BIN_OP_INT(r, v1, v2, OP); break; \
|
||||
case SIZE_LONG: BIN_OP_LONG(r, v1, v2, OP); break; \
|
||||
case SIZE_LONGLONG: BIN_OP_LONGLONG(r, v1, v2, OP); break; \
|
||||
default: pp_internal_error(__FILE__, __LINE__, "Invalid type indicator (0x%04x)", v1.type); \
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
static int boolean(cval_t *v);
|
||||
static void promote_equal_size(cval_t *v1, cval_t *v2);
|
||||
static void cast_to_sint(cval_t *v);
|
||||
static void cast_to_uint(cval_t *v);
|
||||
static void cast_to_slong(cval_t *v);
|
||||
static void cast_to_ulong(cval_t *v);
|
||||
static void cast_to_sll(cval_t *v);
|
||||
static void cast_to_ull(cval_t *v);
|
||||
static marg_t *new_marg(char *str, def_arg_t type);
|
||||
static marg_t *add_new_marg(char *str, def_arg_t type);
|
||||
static int marg_index(char *id);
|
||||
static mtext_t *new_mtext(char *str, int idx, def_exp_t type);
|
||||
static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp);
|
||||
static char *merge_text(char *s1, char *s2);
|
||||
|
||||
/*
|
||||
* Local variables
|
||||
*/
|
||||
static marg_t **macro_args; /* Macro parameters array while parsing */
|
||||
static int nmacro_args;
|
||||
|
||||
%}
|
||||
|
||||
%union{
|
||||
int sint;
|
||||
unsigned int uint;
|
||||
long slong;
|
||||
unsigned long ulong;
|
||||
__int64 sll;
|
||||
unsigned __int64 ull;
|
||||
int *iptr;
|
||||
char *cptr;
|
||||
cval_t cval;
|
||||
marg_t *marg;
|
||||
mtext_t *mtext;
|
||||
}
|
||||
|
||||
%token tRCINCLUDE
|
||||
%token tIF tIFDEF tIFNDEF tELSE tELIF tENDIF tDEFINED tNL
|
||||
%token tINCLUDE tLINE tGCCLINE tERROR tWARNING tPRAGMA tPPIDENT
|
||||
%token tUNDEF tMACROEND tCONCAT tELIPSIS tSTRINGIZE
|
||||
%token <cptr> tIDENT tLITERAL tMACRO tDEFINE
|
||||
%token <cptr> tDQSTRING tSQSTRING tIQSTRING
|
||||
%token <uint> tUINT
|
||||
%token <sint> tSINT
|
||||
%token <ulong> tULONG
|
||||
%token <slong> tSLONG
|
||||
%token <ull> tULONGLONG
|
||||
%token <sll> tSLONGLONG
|
||||
%token <cptr> tRCINCLUDEPATH
|
||||
|
||||
%right '?' ':'
|
||||
%left tLOGOR
|
||||
%left tLOGAND
|
||||
%left '|'
|
||||
%left '^'
|
||||
%left '&'
|
||||
%left tEQ tNE
|
||||
%left '<' tLTE '>' tGTE
|
||||
%left tLSHIFT tRSHIFT
|
||||
%left '+' '-'
|
||||
%left '*' '/'
|
||||
%right '~' '!'
|
||||
|
||||
%type <cval> pp_expr
|
||||
%type <marg> emargs margs
|
||||
%type <mtext> opt_mtexts mtexts mtext
|
||||
%type <sint> allmargs
|
||||
%type <cptr> opt_text text
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
* The parser starts here
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
%%
|
||||
|
||||
pp_file : /* Empty */
|
||||
| pp_file preprocessor
|
||||
;
|
||||
|
||||
preprocessor
|
||||
: tINCLUDE tDQSTRING tNL { pp_do_include($2, 1); }
|
||||
| tINCLUDE tIQSTRING tNL { pp_do_include($2, 0); }
|
||||
| tIF pp_expr tNL { pp_next_if_state(boolean(&$2)); }
|
||||
| tIFDEF tIDENT tNL { pp_next_if_state(pplookup($2) != NULL); free($2); }
|
||||
| tIFNDEF tIDENT tNL {
|
||||
int t = pplookup($2) == NULL;
|
||||
if(pp_incl_state.state == 0 && t && !pp_incl_state.seen_junk)
|
||||
{
|
||||
pp_incl_state.state = 1;
|
||||
pp_incl_state.ppp = $2;
|
||||
pp_incl_state.ifdepth = pp_get_if_depth();
|
||||
}
|
||||
else if(pp_incl_state.state != 1)
|
||||
{
|
||||
pp_incl_state.state = -1;
|
||||
free($2);
|
||||
}
|
||||
else
|
||||
free($2);
|
||||
pp_next_if_state(t);
|
||||
}
|
||||
| tELIF pp_expr tNL {
|
||||
pp_if_state_t s = pp_pop_if();
|
||||
switch(s)
|
||||
{
|
||||
case if_true:
|
||||
case if_elif:
|
||||
pp_push_if(if_elif);
|
||||
break;
|
||||
case if_false:
|
||||
pp_push_if(boolean(&$2) ? if_true : if_false);
|
||||
break;
|
||||
case if_ignore:
|
||||
pp_push_if(if_ignore);
|
||||
break;
|
||||
case if_elsetrue:
|
||||
case if_elsefalse:
|
||||
ppy_error("#elif cannot follow #else");
|
||||
break;
|
||||
case if_error:
|
||||
break;
|
||||
default:
|
||||
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s);
|
||||
}
|
||||
}
|
||||
| tELSE tNL {
|
||||
pp_if_state_t s = pp_pop_if();
|
||||
switch(s)
|
||||
{
|
||||
case if_true:
|
||||
pp_push_if(if_elsefalse);
|
||||
break;
|
||||
case if_elif:
|
||||
pp_push_if(if_elif);
|
||||
break;
|
||||
case if_false:
|
||||
pp_push_if(if_elsetrue);
|
||||
break;
|
||||
case if_ignore:
|
||||
pp_push_if(if_ignore);
|
||||
break;
|
||||
case if_elsetrue:
|
||||
case if_elsefalse:
|
||||
ppy_error("#else clause already defined");
|
||||
break;
|
||||
case if_error:
|
||||
break;
|
||||
default:
|
||||
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s);
|
||||
}
|
||||
}
|
||||
| tENDIF tNL {
|
||||
if(pp_pop_if() != if_error)
|
||||
{
|
||||
if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1)
|
||||
{
|
||||
pp_incl_state.state = 2;
|
||||
pp_incl_state.seen_junk = 0;
|
||||
}
|
||||
else if(pp_incl_state.state != 1)
|
||||
{
|
||||
pp_incl_state.state = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
| tUNDEF tIDENT tNL { pp_del_define($2); free($2); }
|
||||
| tDEFINE opt_text tNL { pp_add_define($1, $2); free($1); free($2); }
|
||||
| tMACRO res_arg allmargs tMACROEND opt_mtexts tNL {
|
||||
pp_add_macro($1, macro_args, nmacro_args, $5);
|
||||
}
|
||||
| tLINE tSINT tDQSTRING tNL { if($3) pp_writestring("# %d %s\n", $2 , $3); free($3); }
|
||||
| tGCCLINE tSINT tDQSTRING tNL { if($3) pp_writestring("# %d %s\n", $2 , $3); free($3); }
|
||||
| tGCCLINE tSINT tDQSTRING tSINT tNL
|
||||
{ if($3) pp_writestring("# %d %s %d\n", $2, $3, $4); free($3); }
|
||||
| tGCCLINE tSINT tDQSTRING tSINT tSINT tNL
|
||||
{ if($3) pp_writestring("# %d %s %d %d\n", $2 ,$3, $4, $5); free($3); }
|
||||
| tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tNL
|
||||
{ if($3) pp_writestring("# %d %s %d %d %d\n", $2 ,$3 ,$4 ,$5, $6); free($3); }
|
||||
| tGCCLINE tSINT tDQSTRING tSINT tSINT tSINT tSINT tNL
|
||||
{ if($3) pp_writestring("# %d %s %d %d %d %d\n", $2 ,$3 ,$4 ,$5, $6, $7); free($3); }
|
||||
| tGCCLINE tNL /* The null-token */
|
||||
| tERROR opt_text tNL { ppy_error("#error directive: '%s'", $2); free($2); }
|
||||
| tWARNING opt_text tNL { ppy_warning("#warning directive: '%s'", $2); free($2); }
|
||||
| tPRAGMA opt_text tNL { pp_writestring("#pragma %s\n", $2 ? $2 : ""); free($2); }
|
||||
| tPPIDENT opt_text tNL { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", $2); free($2); }
|
||||
| tRCINCLUDE tRCINCLUDEPATH {
|
||||
if($2)
|
||||
{
|
||||
int nl=strlen($2) +3;
|
||||
char *fn=pp_xmalloc(nl);
|
||||
if(fn)
|
||||
{
|
||||
sprintf(fn,"\"%s\"",$2);
|
||||
pp_do_include(fn,1);
|
||||
}
|
||||
free($2);
|
||||
}
|
||||
}
|
||||
| tRCINCLUDE tDQSTRING {
|
||||
pp_do_include($2,1);
|
||||
}
|
||||
/*| tNL*/
|
||||
;
|
||||
|
||||
opt_text: /* Empty */ { $$ = NULL; }
|
||||
| text { $$ = $1; }
|
||||
;
|
||||
|
||||
text : tLITERAL { $$ = $1; }
|
||||
| tDQSTRING { $$ = $1; }
|
||||
| tSQSTRING { $$ = $1; }
|
||||
| text tLITERAL { $$ = merge_text($1, $2); }
|
||||
| text tDQSTRING { $$ = merge_text($1, $2); }
|
||||
| text tSQSTRING { $$ = merge_text($1, $2); }
|
||||
;
|
||||
|
||||
res_arg : /* Empty */ { macro_args = NULL; nmacro_args = 0; }
|
||||
;
|
||||
|
||||
allmargs: /* Empty */ { $$ = 0; macro_args = NULL; nmacro_args = 0; }
|
||||
| emargs { $$ = nmacro_args; }
|
||||
;
|
||||
|
||||
emargs : margs { $$ = $1; }
|
||||
| margs ',' tELIPSIS { $$ = add_new_marg(NULL, arg_list); nmacro_args *= -1; }
|
||||
;
|
||||
|
||||
margs : margs ',' tIDENT { $$ = add_new_marg($3, arg_single); }
|
||||
| tIDENT { $$ = add_new_marg($1, arg_single); }
|
||||
;
|
||||
|
||||
opt_mtexts
|
||||
: /* Empty */ { $$ = NULL; }
|
||||
| mtexts {
|
||||
for($$ = $1; $$ && $$->prev; $$ = $$->prev)
|
||||
;
|
||||
}
|
||||
;
|
||||
|
||||
mtexts : mtext { $$ = $1; }
|
||||
| mtexts mtext { $$ = combine_mtext($1, $2); }
|
||||
;
|
||||
|
||||
mtext : tLITERAL { $$ = new_mtext($1, 0, exp_text); }
|
||||
| tDQSTRING { $$ = new_mtext($1, 0, exp_text); }
|
||||
| tSQSTRING { $$ = new_mtext($1, 0, exp_text); }
|
||||
| tCONCAT { $$ = new_mtext(NULL, 0, exp_concat); }
|
||||
| tSTRINGIZE tIDENT {
|
||||
int mat = marg_index($2);
|
||||
if(mat < 0)
|
||||
ppy_error("Stringification identifier must be an argument parameter");
|
||||
else
|
||||
$$ = new_mtext(NULL, mat, exp_stringize);
|
||||
}
|
||||
| tIDENT {
|
||||
int mat = marg_index($1);
|
||||
if(mat >= 0)
|
||||
$$ = new_mtext(NULL, mat, exp_subst);
|
||||
else if($1)
|
||||
$$ = new_mtext($1, 0, exp_text);
|
||||
}
|
||||
;
|
||||
|
||||
pp_expr : tSINT { $$.type = cv_sint; $$.val.si = $1; }
|
||||
| tUINT { $$.type = cv_uint; $$.val.ui = $1; }
|
||||
| tSLONG { $$.type = cv_slong; $$.val.sl = $1; }
|
||||
| tULONG { $$.type = cv_ulong; $$.val.ul = $1; }
|
||||
| tSLONGLONG { $$.type = cv_sll; $$.val.sll = $1; }
|
||||
| tULONGLONG { $$.type = cv_ull; $$.val.ull = $1; }
|
||||
| tDEFINED tIDENT { $$.type = cv_sint; $$.val.si = pplookup($2) != NULL; }
|
||||
| tDEFINED '(' tIDENT ')' { $$.type = cv_sint; $$.val.si = pplookup($3) != NULL; }
|
||||
| tIDENT { $$.type = cv_sint; $$.val.si = 0; }
|
||||
| pp_expr tLOGOR pp_expr { $$.type = cv_sint; $$.val.si = boolean(&$1) || boolean(&$3); }
|
||||
| pp_expr tLOGAND pp_expr { $$.type = cv_sint; $$.val.si = boolean(&$1) && boolean(&$3); }
|
||||
| pp_expr tEQ pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, ==); }
|
||||
| pp_expr tNE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, !=); }
|
||||
| pp_expr '<' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <); }
|
||||
| pp_expr '>' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >); }
|
||||
| pp_expr tLTE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <=); }
|
||||
| pp_expr tGTE pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >=); }
|
||||
| pp_expr '+' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, +); }
|
||||
| pp_expr '-' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, -); }
|
||||
| pp_expr '^' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, ^); }
|
||||
| pp_expr '&' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, &); }
|
||||
| pp_expr '|' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, |); }
|
||||
| pp_expr '*' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, *); }
|
||||
| pp_expr '/' pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, /); }
|
||||
| pp_expr tLSHIFT pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, <<); }
|
||||
| pp_expr tRSHIFT pp_expr { promote_equal_size(&$1, &$3); BIN_OP($$, $1, $3, >>); }
|
||||
| '+' pp_expr { $$ = $2; }
|
||||
| '-' pp_expr { UNARY_OP($$, $2, -); }
|
||||
| '~' pp_expr { UNARY_OP($$, $2, ~); }
|
||||
| '!' pp_expr { $$.type = cv_sint; $$.val.si = !boolean(&$2); }
|
||||
| '(' pp_expr ')' { $$ = $2; }
|
||||
| pp_expr '?' pp_expr ':' pp_expr { $$ = boolean(&$1) ? $3 : $5; }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
* Support functions
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
static void cast_to_sint(cval_t *v)
|
||||
{
|
||||
switch(v->type)
|
||||
{
|
||||
case cv_sint: break;
|
||||
case cv_uint: break;
|
||||
case cv_slong: v->val.si = v->val.sl; break;
|
||||
case cv_ulong: v->val.si = v->val.ul; break;
|
||||
case cv_sll: v->val.si = v->val.sll; break;
|
||||
case cv_ull: v->val.si = v->val.ull; break;
|
||||
}
|
||||
v->type = cv_sint;
|
||||
}
|
||||
|
||||
static void cast_to_uint(cval_t *v)
|
||||
{
|
||||
switch(v->type)
|
||||
{
|
||||
case cv_sint: break;
|
||||
case cv_uint: break;
|
||||
case cv_slong: v->val.ui = v->val.sl; break;
|
||||
case cv_ulong: v->val.ui = v->val.ul; break;
|
||||
case cv_sll: v->val.ui = v->val.sll; break;
|
||||
case cv_ull: v->val.ui = v->val.ull; break;
|
||||
}
|
||||
v->type = cv_uint;
|
||||
}
|
||||
|
||||
static void cast_to_slong(cval_t *v)
|
||||
{
|
||||
switch(v->type)
|
||||
{
|
||||
case cv_sint: v->val.sl = v->val.si; break;
|
||||
case cv_uint: v->val.sl = v->val.ui; break;
|
||||
case cv_slong: break;
|
||||
case cv_ulong: break;
|
||||
case cv_sll: v->val.sl = v->val.sll; break;
|
||||
case cv_ull: v->val.sl = v->val.ull; break;
|
||||
}
|
||||
v->type = cv_slong;
|
||||
}
|
||||
|
||||
static void cast_to_ulong(cval_t *v)
|
||||
{
|
||||
switch(v->type)
|
||||
{
|
||||
case cv_sint: v->val.ul = v->val.si; break;
|
||||
case cv_uint: v->val.ul = v->val.ui; break;
|
||||
case cv_slong: break;
|
||||
case cv_ulong: break;
|
||||
case cv_sll: v->val.ul = v->val.sll; break;
|
||||
case cv_ull: v->val.ul = v->val.ull; break;
|
||||
}
|
||||
v->type = cv_ulong;
|
||||
}
|
||||
|
||||
static void cast_to_sll(cval_t *v)
|
||||
{
|
||||
switch(v->type)
|
||||
{
|
||||
case cv_sint: v->val.sll = v->val.si; break;
|
||||
case cv_uint: v->val.sll = v->val.ui; break;
|
||||
case cv_slong: v->val.sll = v->val.sl; break;
|
||||
case cv_ulong: v->val.sll = v->val.ul; break;
|
||||
case cv_sll: break;
|
||||
case cv_ull: break;
|
||||
}
|
||||
v->type = cv_sll;
|
||||
}
|
||||
|
||||
static void cast_to_ull(cval_t *v)
|
||||
{
|
||||
switch(v->type)
|
||||
{
|
||||
case cv_sint: v->val.ull = v->val.si; break;
|
||||
case cv_uint: v->val.ull = v->val.ui; break;
|
||||
case cv_slong: v->val.ull = v->val.sl; break;
|
||||
case cv_ulong: v->val.ull = v->val.ul; break;
|
||||
case cv_sll: break;
|
||||
case cv_ull: break;
|
||||
}
|
||||
v->type = cv_ull;
|
||||
}
|
||||
|
||||
|
||||
static void promote_equal_size(cval_t *v1, cval_t *v2)
|
||||
{
|
||||
#define cv_sizeof(v) ((int)(v->type & SIZE_MASK))
|
||||
int s1 = cv_sizeof(v1);
|
||||
int s2 = cv_sizeof(v2);
|
||||
#undef cv_sizeof
|
||||
|
||||
if(s1 == s2)
|
||||
return;
|
||||
else if(s1 > s2)
|
||||
{
|
||||
switch(v1->type)
|
||||
{
|
||||
case cv_sint: cast_to_sint(v2); break;
|
||||
case cv_uint: cast_to_uint(v2); break;
|
||||
case cv_slong: cast_to_slong(v2); break;
|
||||
case cv_ulong: cast_to_ulong(v2); break;
|
||||
case cv_sll: cast_to_sll(v2); break;
|
||||
case cv_ull: cast_to_ull(v2); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(v2->type)
|
||||
{
|
||||
case cv_sint: cast_to_sint(v1); break;
|
||||
case cv_uint: cast_to_uint(v1); break;
|
||||
case cv_slong: cast_to_slong(v1); break;
|
||||
case cv_ulong: cast_to_ulong(v1); break;
|
||||
case cv_sll: cast_to_sll(v1); break;
|
||||
case cv_ull: cast_to_ull(v1); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int boolean(cval_t *v)
|
||||
{
|
||||
switch(v->type)
|
||||
{
|
||||
case cv_sint: return v->val.si != 0;
|
||||
case cv_uint: return v->val.ui != 0;
|
||||
case cv_slong: return v->val.sl != 0;
|
||||
case cv_ulong: return v->val.ul != 0;
|
||||
case cv_sll: return v->val.sll != 0;
|
||||
case cv_ull: return v->val.ull != 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static marg_t *new_marg(char *str, def_arg_t type)
|
||||
{
|
||||
marg_t *ma = pp_xmalloc(sizeof(marg_t));
|
||||
if(!ma)
|
||||
return NULL;
|
||||
ma->arg = str;
|
||||
ma->type = type;
|
||||
ma->nnl = 0;
|
||||
return ma;
|
||||
}
|
||||
|
||||
static marg_t *add_new_marg(char *str, def_arg_t type)
|
||||
{
|
||||
marg_t **new_macro_args;
|
||||
marg_t *ma;
|
||||
if(!str)
|
||||
return NULL;
|
||||
new_macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0]));
|
||||
if(!new_macro_args)
|
||||
return NULL;
|
||||
macro_args = new_macro_args;
|
||||
ma = new_marg(str, type);
|
||||
if(!ma)
|
||||
return NULL;
|
||||
macro_args[nmacro_args] = ma;
|
||||
nmacro_args++;
|
||||
return ma;
|
||||
}
|
||||
|
||||
static int marg_index(char *id)
|
||||
{
|
||||
int t;
|
||||
if(!id)
|
||||
return -1;
|
||||
for(t = 0; t < nmacro_args; t++)
|
||||
{
|
||||
if(!strcmp(id, macro_args[t]->arg))
|
||||
break;
|
||||
}
|
||||
return t < nmacro_args ? t : -1;
|
||||
}
|
||||
|
||||
static mtext_t *new_mtext(char *str, int idx, def_exp_t type)
|
||||
{
|
||||
mtext_t *mt = pp_xmalloc(sizeof(mtext_t));
|
||||
if(!mt)
|
||||
return NULL;
|
||||
if(str == NULL)
|
||||
mt->subst.argidx = idx;
|
||||
else
|
||||
mt->subst.text = str;
|
||||
mt->type = type;
|
||||
mt->next = mt->prev = NULL;
|
||||
return mt;
|
||||
}
|
||||
|
||||
static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp)
|
||||
{
|
||||
if(!tail)
|
||||
return mtp;
|
||||
|
||||
if(!mtp)
|
||||
return tail;
|
||||
|
||||
if(tail->type == exp_text && mtp->type == exp_text)
|
||||
{
|
||||
char *new_text;
|
||||
new_text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1);
|
||||
if(!new_text)
|
||||
return mtp;
|
||||
tail->subst.text = new_text;
|
||||
strcat(tail->subst.text, mtp->subst.text);
|
||||
free(mtp->subst.text);
|
||||
free(mtp);
|
||||
return tail;
|
||||
}
|
||||
|
||||
if(tail->type == exp_concat && mtp->type == exp_concat)
|
||||
{
|
||||
free(mtp);
|
||||
return tail;
|
||||
}
|
||||
|
||||
if(tail->type == exp_concat && mtp->type == exp_text)
|
||||
{
|
||||
int len = strlen(mtp->subst.text);
|
||||
while(len)
|
||||
{
|
||||
/* FIXME: should delete space from head of string */
|
||||
if(isspace(mtp->subst.text[len-1] & 0xff))
|
||||
mtp->subst.text[--len] = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if(!len)
|
||||
{
|
||||
free(mtp->subst.text);
|
||||
free(mtp);
|
||||
return tail;
|
||||
}
|
||||
}
|
||||
|
||||
if(tail->type == exp_text && mtp->type == exp_concat)
|
||||
{
|
||||
int len = strlen(tail->subst.text);
|
||||
while(len)
|
||||
{
|
||||
if(isspace(tail->subst.text[len-1] & 0xff))
|
||||
tail->subst.text[--len] = '\0';
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if(!len)
|
||||
{
|
||||
mtp->prev = tail->prev;
|
||||
mtp->next = tail->next;
|
||||
if(tail->prev)
|
||||
tail->prev->next = mtp;
|
||||
free(tail->subst.text);
|
||||
free(tail);
|
||||
return mtp;
|
||||
}
|
||||
}
|
||||
|
||||
tail->next = mtp;
|
||||
mtp->prev = tail;
|
||||
|
||||
return mtp;
|
||||
}
|
||||
|
||||
static char *merge_text(char *s1, char *s2)
|
||||
{
|
||||
int l1;
|
||||
int l2;
|
||||
char *snew;
|
||||
if(!s1)
|
||||
return s2;
|
||||
if(!s2)
|
||||
return s1;
|
||||
l1 = strlen(s1);
|
||||
l2 = strlen(s2);
|
||||
snew = pp_xrealloc(s1, l1+l2+1);
|
||||
if(!snew)
|
||||
{
|
||||
free(s2);
|
||||
return s1;
|
||||
}
|
||||
s1 = snew;
|
||||
memcpy(s1+l1, s2, l2+1);
|
||||
free(s2);
|
||||
return s1;
|
||||
}
|
447
dll/directx/wine/d3dcompiler_43/preproc.c
Normal file
447
dll/directx/wine/d3dcompiler_43/preproc.c
Normal file
|
@ -0,0 +1,447 @@
|
|||
/*
|
||||
* Copyright 1998 Bertho A. Stultiens (BS)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "wpp_private.h"
|
||||
|
||||
struct pp_status pp_status;
|
||||
|
||||
#define HASHKEY 2039
|
||||
|
||||
typedef struct pp_def_state
|
||||
{
|
||||
struct pp_def_state *next;
|
||||
pp_entry_t *defines[HASHKEY];
|
||||
} pp_def_state_t;
|
||||
|
||||
static pp_def_state_t *pp_def_state;
|
||||
|
||||
#define MAXIFSTACK 64
|
||||
static pp_if_state_t if_stack[MAXIFSTACK];
|
||||
static int if_stack_idx = 0;
|
||||
|
||||
void *pp_xmalloc(size_t size)
|
||||
{
|
||||
void *res;
|
||||
|
||||
assert(size > 0);
|
||||
res = malloc(size);
|
||||
if(res == NULL)
|
||||
{
|
||||
/* Set the error flag */
|
||||
pp_status.state = 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void *pp_xrealloc(void *p, size_t size)
|
||||
{
|
||||
void *res;
|
||||
|
||||
assert(size > 0);
|
||||
res = realloc(p, size);
|
||||
if(res == NULL)
|
||||
{
|
||||
/* Set the error flag */
|
||||
pp_status.state = 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
char *pp_xstrdup(const char *str)
|
||||
{
|
||||
char *s;
|
||||
int len;
|
||||
|
||||
assert(str != NULL);
|
||||
len = strlen(str)+1;
|
||||
s = pp_xmalloc(len);
|
||||
if(!s)
|
||||
return NULL;
|
||||
return memcpy(s, str, len);
|
||||
}
|
||||
|
||||
/* Don't comment on the hash, it's primitive but functional... */
|
||||
static int pphash(const char *str)
|
||||
{
|
||||
int sum = 0;
|
||||
while(*str)
|
||||
sum += *str++;
|
||||
return sum % HASHKEY;
|
||||
}
|
||||
|
||||
pp_entry_t *pplookup(const char *ident)
|
||||
{
|
||||
int idx;
|
||||
pp_entry_t *ppp;
|
||||
|
||||
if(!ident)
|
||||
return NULL;
|
||||
idx = pphash(ident);
|
||||
for(ppp = pp_def_state->defines[idx]; ppp; ppp = ppp->next)
|
||||
{
|
||||
if(!strcmp(ident, ppp->ident))
|
||||
return ppp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void free_pp_entry( pp_entry_t *ppp, int idx )
|
||||
{
|
||||
if(ppp->iep)
|
||||
{
|
||||
if(ppp->iep == pp_includelogiclist)
|
||||
{
|
||||
pp_includelogiclist = ppp->iep->next;
|
||||
if(pp_includelogiclist)
|
||||
pp_includelogiclist->prev = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ppp->iep->prev->next = ppp->iep->next;
|
||||
if(ppp->iep->next)
|
||||
ppp->iep->next->prev = ppp->iep->prev;
|
||||
}
|
||||
free(ppp->iep->filename);
|
||||
free(ppp->iep);
|
||||
}
|
||||
|
||||
if(pp_def_state->defines[idx] == ppp)
|
||||
{
|
||||
pp_def_state->defines[idx] = ppp->next;
|
||||
if(pp_def_state->defines[idx])
|
||||
pp_def_state->defines[idx]->prev = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ppp->prev->next = ppp->next;
|
||||
if(ppp->next)
|
||||
ppp->next->prev = ppp->prev;
|
||||
}
|
||||
|
||||
free(ppp);
|
||||
}
|
||||
|
||||
/* push a new (empty) define state */
|
||||
int pp_push_define_state(void)
|
||||
{
|
||||
pp_def_state_t *state = pp_xmalloc( sizeof(*state) );
|
||||
if(!state)
|
||||
return 1;
|
||||
|
||||
memset( state->defines, 0, sizeof(state->defines) );
|
||||
state->next = pp_def_state;
|
||||
pp_def_state = state;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* pop the current define state */
|
||||
void pp_pop_define_state(void)
|
||||
{
|
||||
int i;
|
||||
pp_entry_t *ppp;
|
||||
pp_def_state_t *state;
|
||||
|
||||
for (i = 0; i < HASHKEY; i++)
|
||||
{
|
||||
while ((ppp = pp_def_state->defines[i]) != NULL) pp_del_define( ppp->ident );
|
||||
}
|
||||
state = pp_def_state;
|
||||
pp_def_state = state->next;
|
||||
free( state );
|
||||
}
|
||||
|
||||
void pp_del_define(const char *name)
|
||||
{
|
||||
pp_entry_t *ppp;
|
||||
int idx = pphash(name);
|
||||
|
||||
if((ppp = pplookup(name)) == NULL)
|
||||
{
|
||||
if(pp_status.pedantic)
|
||||
ppy_warning("%s was not defined", name);
|
||||
return;
|
||||
}
|
||||
|
||||
free( ppp->ident );
|
||||
free( ppp->subst.text );
|
||||
free( ppp->filename );
|
||||
free_pp_entry( ppp, idx );
|
||||
}
|
||||
|
||||
pp_entry_t *pp_add_define(const char *def, const char *text)
|
||||
{
|
||||
int len;
|
||||
char *cptr;
|
||||
int idx;
|
||||
pp_entry_t *ppp;
|
||||
|
||||
if(!def)
|
||||
return NULL;
|
||||
idx = pphash(def);
|
||||
if((ppp = pplookup(def)) != NULL)
|
||||
{
|
||||
if(pp_status.pedantic)
|
||||
ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", def, ppp->filename, ppp->linenumber);
|
||||
pp_del_define(def);
|
||||
}
|
||||
ppp = pp_xmalloc(sizeof(pp_entry_t));
|
||||
if(!ppp)
|
||||
return NULL;
|
||||
memset( ppp, 0, sizeof(*ppp) );
|
||||
ppp->ident = pp_xstrdup(def);
|
||||
if(!ppp->ident)
|
||||
goto error;
|
||||
ppp->type = def_define;
|
||||
ppp->subst.text = text ? pp_xstrdup(text) : NULL;
|
||||
if(text && !ppp->subst.text)
|
||||
goto error;
|
||||
ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>");
|
||||
if(!ppp->filename)
|
||||
goto error;
|
||||
ppp->linenumber = pp_status.input ? pp_status.line_number : 0;
|
||||
ppp->next = pp_def_state->defines[idx];
|
||||
pp_def_state->defines[idx] = ppp;
|
||||
if(ppp->next)
|
||||
ppp->next->prev = ppp;
|
||||
if(ppp->subst.text)
|
||||
{
|
||||
/* Strip trailing white space from subst text */
|
||||
len = strlen(ppp->subst.text);
|
||||
while(len && strchr(" \t\r\n", ppp->subst.text[len-1]))
|
||||
{
|
||||
ppp->subst.text[--len] = '\0';
|
||||
}
|
||||
/* Strip leading white space from subst text */
|
||||
for(cptr = ppp->subst.text; *cptr && strchr(" \t\r", *cptr); cptr++)
|
||||
;
|
||||
if(ppp->subst.text != cptr)
|
||||
memmove(ppp->subst.text, cptr, strlen(cptr)+1);
|
||||
}
|
||||
return ppp;
|
||||
|
||||
error:
|
||||
free(ppp->ident);
|
||||
free(ppp->subst.text);
|
||||
free(ppp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp)
|
||||
{
|
||||
int idx;
|
||||
pp_entry_t *ppp;
|
||||
|
||||
if(!id)
|
||||
return NULL;
|
||||
idx = pphash(id);
|
||||
if((ppp = pplookup(id)) != NULL)
|
||||
{
|
||||
if(pp_status.pedantic)
|
||||
ppy_warning("Redefinition of %s\n\tPrevious definition: %s:%d", id, ppp->filename, ppp->linenumber);
|
||||
pp_del_define(id);
|
||||
}
|
||||
ppp = pp_xmalloc(sizeof(pp_entry_t));
|
||||
if(!ppp)
|
||||
return NULL;
|
||||
memset( ppp, 0, sizeof(*ppp) );
|
||||
ppp->ident = id;
|
||||
ppp->type = def_macro;
|
||||
ppp->margs = args;
|
||||
ppp->nargs = nargs;
|
||||
ppp->subst.mtext= exp;
|
||||
ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : "<internal or cmdline>");
|
||||
if(!ppp->filename)
|
||||
{
|
||||
free(ppp);
|
||||
return NULL;
|
||||
}
|
||||
ppp->linenumber = pp_status.input ? pp_status.line_number : 0;
|
||||
ppp->next = pp_def_state->defines[idx];
|
||||
pp_def_state->defines[idx] = ppp;
|
||||
if(ppp->next)
|
||||
ppp->next->prev = ppp;
|
||||
return ppp;
|
||||
}
|
||||
|
||||
|
||||
void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath)
|
||||
{
|
||||
char *path;
|
||||
void *fp;
|
||||
|
||||
if (!(path = wpp_lookup(name, type, parent_name))) return NULL;
|
||||
fp = wpp_open(path, type);
|
||||
|
||||
if (fp)
|
||||
{
|
||||
if (newpath) *newpath = path;
|
||||
else free( path );
|
||||
return fp;
|
||||
}
|
||||
free( path );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
*-------------------------------------------------------------------------
|
||||
* #if, #ifdef, #ifndef, #else, #elif and #endif state management
|
||||
*
|
||||
* #if state transitions are made on basis of the current TOS and the next
|
||||
* required state. The state transitions are required to housekeep because
|
||||
* #if:s can be nested. The ignore case is activated to prevent output from
|
||||
* within a false clause.
|
||||
* Some special cases come from the fact that the #elif cases are not
|
||||
* binary, but three-state. The problem is that all other elif-cases must
|
||||
* be false when one true one has been found. A second problem is that the
|
||||
* #else clause is a final clause. No extra #else:s may follow.
|
||||
*
|
||||
* The states mean:
|
||||
* if_true Process input to output
|
||||
* if_false Process input but no output
|
||||
* if_ignore Process input but no output
|
||||
* if_elif Process input but no output
|
||||
* if_elsefalse Process input but no output
|
||||
* if_elsettrue Process input to output
|
||||
*
|
||||
* The possible state-sequences are [state(stack depth)] (rest can be deduced):
|
||||
* TOS #if 1 #else #endif
|
||||
* if_true(n) if_true(n+1) if_elsefalse(n+1)
|
||||
* if_false(n) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_elsetrue(n) if_true(n+1) if_elsefalse(n+1)
|
||||
* if_elsefalse(n) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_elif(n) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_ignore(n) if_ignore(n+1) if_ignore(n+1)
|
||||
*
|
||||
* TOS #if 1 #elif 0 #else #endif
|
||||
* if_true(n) if_true(n+1) if_elif(n+1) if_elif(n+1)
|
||||
* if_false(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_elsetrue(n) if_true(n+1) if_elif(n+1) if_elif(n+1)
|
||||
* if_elsefalse(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_elif(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_ignore(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1)
|
||||
*
|
||||
* TOS #if 0 #elif 1 #else #endif
|
||||
* if_true(n) if_false(n+1) if_true(n+1) if_elsefalse(n+1)
|
||||
* if_false(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_elsetrue(n) if_false(n+1) if_true(n+1) if_elsefalse(n+1)
|
||||
* if_elsefalse(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_elif(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1)
|
||||
* if_ignore(n) if_ignore(n+1) if_ignore(n+1) if_ignore(n+1)
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void pp_push_if(pp_if_state_t s)
|
||||
{
|
||||
if(if_stack_idx >= MAXIFSTACK)
|
||||
pp_internal_error(__FILE__, __LINE__, "#if-stack overflow; #{if,ifdef,ifndef} nested too deeply (> %d)", MAXIFSTACK);
|
||||
|
||||
if_stack[if_stack_idx++] = s;
|
||||
|
||||
switch(s)
|
||||
{
|
||||
case if_true:
|
||||
case if_elsetrue:
|
||||
break;
|
||||
case if_false:
|
||||
case if_elsefalse:
|
||||
case if_elif:
|
||||
case if_ignore:
|
||||
pp_push_ignore_state();
|
||||
break;
|
||||
default:
|
||||
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state());
|
||||
}
|
||||
}
|
||||
|
||||
pp_if_state_t pp_pop_if(void)
|
||||
{
|
||||
if(if_stack_idx <= 0)
|
||||
{
|
||||
ppy_error("#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)");
|
||||
return if_error;
|
||||
}
|
||||
|
||||
switch(pp_if_state())
|
||||
{
|
||||
case if_true:
|
||||
case if_elsetrue:
|
||||
break;
|
||||
case if_false:
|
||||
case if_elsefalse:
|
||||
case if_elif:
|
||||
case if_ignore:
|
||||
pp_pop_ignore_state();
|
||||
break;
|
||||
default:
|
||||
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state());
|
||||
}
|
||||
return if_stack[--if_stack_idx];
|
||||
}
|
||||
|
||||
pp_if_state_t pp_if_state(void)
|
||||
{
|
||||
if(!if_stack_idx)
|
||||
return if_true;
|
||||
else
|
||||
return if_stack[if_stack_idx-1];
|
||||
}
|
||||
|
||||
|
||||
void pp_next_if_state(int i)
|
||||
{
|
||||
switch(pp_if_state())
|
||||
{
|
||||
case if_true:
|
||||
case if_elsetrue:
|
||||
pp_push_if(i ? if_true : if_false);
|
||||
break;
|
||||
case if_false:
|
||||
case if_elsefalse:
|
||||
case if_elif:
|
||||
case if_ignore:
|
||||
pp_push_if(if_ignore);
|
||||
break;
|
||||
default:
|
||||
pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #{if,ifdef,ifndef} directive", (int)pp_if_state());
|
||||
}
|
||||
}
|
||||
|
||||
int pp_get_if_depth(void)
|
||||
{
|
||||
return if_stack_idx;
|
||||
}
|
||||
|
||||
void WINAPIV pp_internal_error(const char *file, int line, const char *s, ...)
|
||||
{
|
||||
__ms_va_list ap;
|
||||
__ms_va_start(ap, s);
|
||||
fprintf(stderr, "Internal error (please report) %s %d: ", file, line);
|
||||
vfprintf(stderr, s, ap);
|
||||
fprintf(stderr, "\n");
|
||||
__ms_va_end(ap);
|
||||
exit(3);
|
||||
}
|
|
@ -18,10 +18,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include "initguid.h"
|
||||
#include "d3dcompiler_private.h"
|
||||
#include "wine/winternl.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3dcompiler);
|
||||
|
||||
|
@ -52,6 +51,7 @@ struct d3dcompiler_shader_reflection_type
|
|||
|
||||
D3D11_SHADER_TYPE_DESC desc;
|
||||
struct d3dcompiler_shader_reflection_type_member *members;
|
||||
char *name;
|
||||
};
|
||||
|
||||
struct d3dcompiler_shader_reflection_type_member
|
||||
|
@ -223,6 +223,7 @@ static void d3dcompiler_shader_reflection_type_destroy(struct wine_rb_entry *ent
|
|||
HeapFree(GetProcessHeap(), 0, t->members);
|
||||
}
|
||||
|
||||
heap_free(t->name);
|
||||
HeapFree(GetProcessHeap(), 0, t);
|
||||
}
|
||||
|
||||
|
@ -665,6 +666,14 @@ static UINT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetThreadGroupSize(
|
|||
return 0;
|
||||
}
|
||||
|
||||
static UINT64 STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetRequiresFlags(
|
||||
ID3D11ShaderReflection *iface)
|
||||
{
|
||||
FIXME("iface %p stub!\n", iface);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl =
|
||||
{
|
||||
/* IUnknown methods */
|
||||
|
@ -690,6 +699,7 @@ static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtb
|
|||
d3dcompiler_shader_reflection_GetNumInterfaceSlots,
|
||||
d3dcompiler_shader_reflection_GetMinFeatureLevel,
|
||||
d3dcompiler_shader_reflection_GetThreadGroupSize,
|
||||
d3dcompiler_shader_reflection_GetRequiresFlags,
|
||||
};
|
||||
|
||||
/* ID3D11ShaderReflectionConstantBuffer methods */
|
||||
|
@ -1124,7 +1134,12 @@ static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, c
|
|||
read_dword(&ptr, &r->gs_max_output_vertex_count);
|
||||
TRACE("GSMaxOutputVertexCount: %u\n", r->gs_max_output_vertex_count);
|
||||
|
||||
skip_dword_unknown(&ptr, 3);
|
||||
skip_dword_unknown(&ptr, 2);
|
||||
|
||||
/* old dx10 stat size */
|
||||
if (size == 28) return S_OK;
|
||||
|
||||
skip_dword_unknown(&ptr, 1);
|
||||
|
||||
/* dx10 stat size */
|
||||
if (size == 29) return S_OK;
|
||||
|
@ -1251,6 +1266,19 @@ static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type
|
|||
}
|
||||
}
|
||||
|
||||
if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
|
||||
{
|
||||
read_dword(&ptr, &offset);
|
||||
if (!copy_name(data + offset, &type->name))
|
||||
{
|
||||
ERR("Failed to copy name.\n");
|
||||
heap_free(members);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
desc->Name = type->name;
|
||||
TRACE("Type name: %s.\n", debugstr_a(type->name));
|
||||
}
|
||||
|
||||
type->members = members;
|
||||
|
||||
return S_OK;
|
||||
|
@ -1658,10 +1686,14 @@ static HRESULT d3dcompiler_parse_signature(struct d3dcompiler_shader_signature *
|
|||
|
||||
if (d[i].Register == 0xffffffff)
|
||||
{
|
||||
if (!strcasecmp(d[i].SemanticName, "sv_depth")) d[i].SystemValueType = D3D_NAME_DEPTH;
|
||||
if (!strcasecmp(d[i].SemanticName, "sv_coverage")) d[i].SystemValueType = D3D_NAME_COVERAGE;
|
||||
if (!strcasecmp(d[i].SemanticName, "sv_depthgreaterequal")) d[i].SystemValueType = D3D_NAME_DEPTH_GREATER_EQUAL;
|
||||
if (!strcasecmp(d[i].SemanticName, "sv_depthlessequal")) d[i].SystemValueType = D3D_NAME_DEPTH_LESS_EQUAL;
|
||||
if (!_strnicmp(d[i].SemanticName, "sv_depth", -1))
|
||||
d[i].SystemValueType = D3D_NAME_DEPTH;
|
||||
else if (!_strnicmp(d[i].SemanticName, "sv_coverage", -1))
|
||||
d[i].SystemValueType = D3D_NAME_COVERAGE;
|
||||
else if (!_strnicmp(d[i].SemanticName, "sv_depthgreaterequal", -1))
|
||||
d[i].SystemValueType = D3D_NAME_DEPTH_GREATER_EQUAL;
|
||||
else if (!_strnicmp(d[i].SemanticName, "sv_depthlessequal", -1))
|
||||
d[i].SystemValueType = D3D_NAME_DEPTH_LESS_EQUAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "d3dcompiler_private.h"
|
||||
|
@ -719,7 +716,7 @@ HRESULT dxbc_write_blob(struct dxbc *dxbc, ID3DBlob **blob)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
void compilation_message(struct compilation_messages *msg, const char *fmt, va_list args)
|
||||
void compilation_message(struct compilation_messages *msg, const char *fmt, __ms_va_list args)
|
||||
{
|
||||
char* buffer;
|
||||
int rc, size;
|
||||
|
@ -1280,19 +1277,10 @@ static struct hlsl_type *expr_common_type(struct hlsl_type *t1, struct hlsl_type
|
|||
static struct hlsl_ir_node *implicit_conversion(struct hlsl_ir_node *node, struct hlsl_type *type,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *cast;
|
||||
struct hlsl_ir_node *operands[3];
|
||||
|
||||
if (compare_hlsl_types(node->data_type, type))
|
||||
return node;
|
||||
TRACE("Implicit conversion of expression to %s\n", debug_hlsl_type(type));
|
||||
operands[0] = node;
|
||||
operands[1] = operands[2] = NULL;
|
||||
cast = new_expr(HLSL_IR_UNOP_CAST, operands, loc);
|
||||
if (!cast)
|
||||
return NULL;
|
||||
cast->node.data_type = type;
|
||||
return &cast->node;
|
||||
return &new_cast(node, type, loc)->node;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **operands,
|
||||
|
@ -1355,158 +1343,12 @@ struct hlsl_ir_expr *new_expr(enum hlsl_ir_expr_op op, struct hlsl_ir_node **ope
|
|||
struct hlsl_ir_expr *new_cast(struct hlsl_ir_node *node, struct hlsl_type *type,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *cast;
|
||||
struct hlsl_ir_node *operands[3];
|
||||
struct hlsl_ir_node *cast;
|
||||
|
||||
operands[0] = node;
|
||||
operands[1] = operands[2] = NULL;
|
||||
cast = new_expr(HLSL_IR_UNOP_CAST, operands, loc);
|
||||
cast = new_unary_expr(HLSL_IR_UNOP_CAST, node, *loc);
|
||||
if (cast)
|
||||
cast->node.data_type = type;
|
||||
return cast;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_mul(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_MUL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_div(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_DIV, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_mod(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_MOD, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_add(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_ADD, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_sub(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_SUB, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_lt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_LESS, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_gt(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_GREATER, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_le(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_LEQUAL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_ge(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_GEQUAL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_eq(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_EQUAL, ops, loc);
|
||||
return expr;
|
||||
}
|
||||
|
||||
struct hlsl_ir_expr *hlsl_ne(struct hlsl_ir_node *op1, struct hlsl_ir_node *op2,
|
||||
struct source_location *loc)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_node *ops[3];
|
||||
|
||||
ops[0] = op1;
|
||||
ops[1] = op2;
|
||||
ops[2] = NULL;
|
||||
expr = new_expr(HLSL_IR_BINOP_NEQUAL, ops, loc);
|
||||
return expr;
|
||||
cast->data_type = type;
|
||||
return expr_from_node(cast);
|
||||
}
|
||||
|
||||
struct hlsl_ir_deref *new_var_deref(struct hlsl_ir_var *var)
|
||||
|
@ -1519,7 +1361,7 @@ struct hlsl_ir_deref *new_var_deref(struct hlsl_ir_var *var)
|
|||
return NULL;
|
||||
}
|
||||
deref->node.type = HLSL_IR_DEREF;
|
||||
deref->node.data_type = var->node.data_type;
|
||||
deref->node.data_type = var->data_type;
|
||||
deref->type = HLSL_IR_DEREF_VAR;
|
||||
deref->v.var = var;
|
||||
return deref;
|
||||
|
@ -1537,9 +1379,6 @@ struct hlsl_ir_deref *new_record_deref(struct hlsl_ir_node *record, struct hlsl_
|
|||
deref->node.type = HLSL_IR_DEREF;
|
||||
deref->node.data_type = field->type;
|
||||
deref->type = HLSL_IR_DEREF_RECORD;
|
||||
if (record->type == HLSL_IR_VAR)
|
||||
deref->v.record.record = &new_var_deref(var_from_node(record))->node;
|
||||
else
|
||||
deref->v.record.record = record;
|
||||
deref->v.record.field = field;
|
||||
return deref;
|
||||
|
@ -1568,7 +1407,6 @@ static enum hlsl_ir_expr_op op_from_assignment(enum parse_assign_op op)
|
|||
struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assign_op assign_op,
|
||||
DWORD writemask, struct hlsl_ir_node *right)
|
||||
{
|
||||
struct hlsl_ir_expr *expr;
|
||||
struct hlsl_ir_assignment *assign = d3dcompiler_alloc(sizeof(*assign));
|
||||
struct hlsl_type *type;
|
||||
struct hlsl_ir_node *lhs, *rhs;
|
||||
|
@ -1618,11 +1456,6 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig
|
|||
FIXME("Check for casts in the lhs.\n");
|
||||
|
||||
lhs = left;
|
||||
if (lhs->type == HLSL_IR_VAR)
|
||||
{
|
||||
struct hlsl_ir_deref *lhs_deref = new_var_deref(var_from_node(lhs));
|
||||
lhs = &lhs_deref->node;
|
||||
}
|
||||
/* FIXME: check for invalid writemasks on the lhs. */
|
||||
|
||||
if (!compare_hlsl_types(type, rhs->data_type))
|
||||
|
@ -1658,8 +1491,8 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig
|
|||
assign->lhs = lhs;
|
||||
if (assign_op != ASSIGN_OP_ASSIGN)
|
||||
{
|
||||
struct hlsl_ir_node *operands[3];
|
||||
enum hlsl_ir_expr_op op = op_from_assignment(assign_op);
|
||||
struct hlsl_ir_node *expr;
|
||||
|
||||
if (lhs->type != HLSL_IR_DEREF || deref_from_node(lhs)->type != HLSL_IR_DEREF_VAR)
|
||||
{
|
||||
|
@ -1672,11 +1505,8 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig
|
|||
|
||||
TRACE("Adding an expression for the compound assignment.\n");
|
||||
new_deref = new_var_deref(lhs_deref->v.var);
|
||||
operands[0] = &new_deref->node;
|
||||
operands[1] = rhs;
|
||||
operands[2] = NULL;
|
||||
expr = new_expr(op, operands, &left->loc);
|
||||
assign->rhs = &expr->node;
|
||||
expr = new_binary_expr(op, &new_deref->node, rhs, left->loc);
|
||||
assign->rhs = expr;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1739,8 +1569,7 @@ struct hlsl_ir_function_decl *new_func_decl(struct hlsl_type *return_type, struc
|
|||
ERR("Out of memory.\n");
|
||||
return NULL;
|
||||
}
|
||||
decl->node.type = HLSL_IR_FUNCTION_DECL;
|
||||
decl->node.data_type = return_type;
|
||||
decl->return_type = return_type;
|
||||
decl->parameters = parameters;
|
||||
|
||||
return decl;
|
||||
|
@ -1812,9 +1641,9 @@ static int compare_function_decl_rb(const void *key, const struct wine_rb_entry
|
|||
while (p1cur && p2cur)
|
||||
{
|
||||
struct hlsl_ir_var *p1, *p2;
|
||||
p1 = LIST_ENTRY(p1cur, struct hlsl_ir_var, node.entry);
|
||||
p2 = LIST_ENTRY(p2cur, struct hlsl_ir_var, node.entry);
|
||||
if ((r = compare_param_hlsl_types(p1->node.data_type, p2->node.data_type)))
|
||||
p1 = LIST_ENTRY(p1cur, struct hlsl_ir_var, param_entry);
|
||||
p2 = LIST_ENTRY(p2cur, struct hlsl_ir_var, param_entry);
|
||||
if ((r = compare_param_hlsl_types(p1->data_type, p2->data_type)))
|
||||
return r;
|
||||
p1cur = list_next(params, p1cur);
|
||||
p2cur = list_next(decl->parameters, p2cur);
|
||||
|
@ -1931,13 +1760,11 @@ static const char *debug_node_type(enum hlsl_ir_node_type type)
|
|||
{
|
||||
static const char * const names[] =
|
||||
{
|
||||
"HLSL_IR_VAR",
|
||||
"HLSL_IR_ASSIGNMENT",
|
||||
"HLSL_IR_CONSTANT",
|
||||
"HLSL_IR_CONSTRUCTOR",
|
||||
"HLSL_IR_DEREF",
|
||||
"HLSL_IR_EXPR",
|
||||
"HLSL_IR_FUNCTION_DECL",
|
||||
"HLSL_IR_IF",
|
||||
"HLSL_IR_JUMP",
|
||||
"HLSL_IR_SWIZZLE",
|
||||
|
@ -1965,7 +1792,7 @@ static void debug_dump_ir_var(const struct hlsl_ir_var *var)
|
|||
{
|
||||
if (var->modifiers)
|
||||
TRACE("%s ", debug_modifiers(var->modifiers));
|
||||
TRACE("%s %s", debug_hlsl_type(var->node.data_type), var->name);
|
||||
TRACE("%s %s", debug_hlsl_type(var->data_type), var->name);
|
||||
if (var->semantic)
|
||||
TRACE(" : %s", debugstr_a(var->semantic));
|
||||
}
|
||||
|
@ -2125,12 +1952,12 @@ static void debug_dump_ir_expr(const struct hlsl_ir_expr *expr)
|
|||
|
||||
static void debug_dump_ir_constructor(const struct hlsl_ir_constructor *constructor)
|
||||
{
|
||||
struct hlsl_ir_node *arg;
|
||||
unsigned int i;
|
||||
|
||||
TRACE("%s (", debug_hlsl_type(constructor->node.data_type));
|
||||
LIST_FOR_EACH_ENTRY(arg, constructor->arguments, struct hlsl_ir_node, entry)
|
||||
for (i = 0; i < constructor->args_count; ++i)
|
||||
{
|
||||
debug_dump_instr(arg);
|
||||
debug_dump_instr(constructor->args[i]);
|
||||
TRACE(" ");
|
||||
}
|
||||
TRACE(")");
|
||||
|
@ -2262,7 +2089,7 @@ void debug_dump_ir_function_decl(const struct hlsl_ir_function_decl *func)
|
|||
|
||||
TRACE("Dumping function %s.\n", debugstr_a(func->func->name));
|
||||
TRACE("Function parameters:\n");
|
||||
LIST_FOR_EACH_ENTRY(param, func->parameters, struct hlsl_ir_var, node.entry)
|
||||
LIST_FOR_EACH_ENTRY(param, func->parameters, struct hlsl_ir_var, param_entry)
|
||||
{
|
||||
debug_dump_ir_var(param);
|
||||
TRACE("\n");
|
||||
|
@ -2352,7 +2179,9 @@ static void free_ir_swizzle(struct hlsl_ir_swizzle *swizzle)
|
|||
|
||||
static void free_ir_constructor(struct hlsl_ir_constructor *constructor)
|
||||
{
|
||||
free_instr_list(constructor->arguments);
|
||||
unsigned int i;
|
||||
for (i = 0; i < constructor->args_count; ++i)
|
||||
free_instr(constructor->args[i]);
|
||||
d3dcompiler_free(constructor);
|
||||
}
|
||||
|
||||
|
@ -2396,9 +2225,6 @@ void free_instr(struct hlsl_ir_node *node)
|
|||
{
|
||||
switch (node->type)
|
||||
{
|
||||
case HLSL_IR_VAR:
|
||||
/* These are freed later on from the scopes. */
|
||||
break;
|
||||
case HLSL_IR_CONSTANT:
|
||||
free_ir_constant(constant_from_node(node));
|
||||
break;
|
||||
|
|
250
dll/directx/wine/d3dcompiler_43/wpp_private.h
Normal file
250
dll/directx/wine/d3dcompiler_43/wpp_private.h
Normal file
|
@ -0,0 +1,250 @@
|
|||
/*
|
||||
* Copyright 1998 Bertho A. Stultiens (BS)
|
||||
* Copyright 2002 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __WPP_PRIVATE_H
|
||||
#define __WPP_PRIVATE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "windef.h"
|
||||
|
||||
/* Return value == 0 means successful execution */
|
||||
extern int wpp_add_define( const char *name, const char *value );
|
||||
extern void wpp_del_define( const char *name );
|
||||
extern char *wpp_lookup(const char *filename, int type, const char *parent_name);
|
||||
extern void *wpp_open(const char *filename, int type);
|
||||
extern void wpp_close(void *file);
|
||||
extern int wpp_read(void *file, char *buffer, unsigned int len);
|
||||
extern void wpp_write(const char *buffer, unsigned int len);
|
||||
extern int wpp_parse( const char *input, FILE *output );
|
||||
|
||||
struct pp_entry; /* forward */
|
||||
/*
|
||||
* Include logic
|
||||
* A stack of files which are already included and
|
||||
* are protected in the #ifndef/#endif way.
|
||||
*/
|
||||
typedef struct includelogicentry {
|
||||
struct includelogicentry *next;
|
||||
struct includelogicentry *prev;
|
||||
struct pp_entry *ppp; /* The define which protects the file */
|
||||
char *filename; /* The filename of the include */
|
||||
} includelogicentry_t;
|
||||
|
||||
/*
|
||||
* The arguments of a macrodefinition
|
||||
*/
|
||||
typedef enum {
|
||||
arg_single,
|
||||
arg_list
|
||||
} def_arg_t;
|
||||
|
||||
typedef struct marg {
|
||||
def_arg_t type; /* Normal or ... argument */
|
||||
char *arg; /* The textual argument */
|
||||
int nnl; /* Number of newlines in the text to subst */
|
||||
} marg_t;
|
||||
|
||||
/*
|
||||
* The expansiontext of a macro
|
||||
*/
|
||||
typedef enum {
|
||||
exp_text, /* Simple text substitution */
|
||||
exp_concat, /* Concat (##) operator requested */
|
||||
exp_stringize, /* Stringize (#) operator requested */
|
||||
exp_subst /* Substitute argument */
|
||||
} def_exp_t;
|
||||
|
||||
typedef struct mtext {
|
||||
struct mtext *next;
|
||||
struct mtext *prev;
|
||||
def_exp_t type;
|
||||
union {
|
||||
char *text;
|
||||
int argidx; /* For exp_subst and exp_stringize reference */
|
||||
} subst;
|
||||
} mtext_t;
|
||||
|
||||
/*
|
||||
* The define descriptor
|
||||
*/
|
||||
typedef enum {
|
||||
def_none, /* Not-a-define; used as return value */
|
||||
def_define, /* Simple defines */
|
||||
def_macro, /* Macro defines */
|
||||
def_special /* Special expansions like __LINE__ and __FILE__ */
|
||||
} def_type_t;
|
||||
|
||||
typedef struct pp_entry {
|
||||
struct pp_entry *next;
|
||||
struct pp_entry *prev;
|
||||
def_type_t type; /* Define or macro */
|
||||
char *ident; /* The key */
|
||||
marg_t **margs; /* Macro arguments array or NULL if none */
|
||||
int nargs;
|
||||
union {
|
||||
mtext_t *mtext; /* The substitution sequence or NULL if none */
|
||||
char *text;
|
||||
} subst;
|
||||
int expanding; /* Set when feeding substitution into the input */
|
||||
char *filename; /* Filename where it was defined */
|
||||
int linenumber; /* Linenumber where it was defined */
|
||||
includelogicentry_t *iep; /* Points to the include it protects */
|
||||
} pp_entry_t;
|
||||
|
||||
|
||||
/*
|
||||
* If logic
|
||||
*/
|
||||
#define MAXIFSTACK 64 /* If this isn't enough you should alter the source... */
|
||||
|
||||
typedef enum {
|
||||
if_false,
|
||||
if_true,
|
||||
if_elif,
|
||||
if_elsefalse,
|
||||
if_elsetrue,
|
||||
if_ignore,
|
||||
if_error
|
||||
} pp_if_state_t;
|
||||
|
||||
|
||||
/*
|
||||
* Trace the include files to prevent double reading.
|
||||
* This save 20..30% of processing time for most stuff
|
||||
* that uses complex includes.
|
||||
* States:
|
||||
* -1 Don't track or seen junk
|
||||
* 0 New include, waiting for "#ifndef __xxx_h"
|
||||
* 1 Seen #ifndef, waiting for "#define __xxx_h ..."
|
||||
* 2 Seen #endif, waiting for EOF
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int state;
|
||||
char *ppp; /* The define to be set from the #ifndef */
|
||||
int ifdepth; /* The level of ifs at the #ifdef */
|
||||
int seen_junk; /* Set when junk is seen */
|
||||
} include_state_t;
|
||||
|
||||
#define SIZE_CHAR 1
|
||||
#define SIZE_SHORT 2
|
||||
#define SIZE_INT 3
|
||||
#define SIZE_LONG 4
|
||||
#define SIZE_LONGLONG 5
|
||||
#define SIZE_MASK 0x00ff
|
||||
#define FLAG_SIGNED 0x0100
|
||||
|
||||
typedef enum {
|
||||
#if 0
|
||||
cv_schar = SIZE_CHAR + FLAG_SIGNED,
|
||||
cv_uchar = SIZE_CHAR,
|
||||
cv_sshort = SIZE_SHORT + FLAG_SIGNED,
|
||||
cv_ushort = SIZE_SHORT,
|
||||
#endif
|
||||
cv_sint = SIZE_INT + FLAG_SIGNED,
|
||||
cv_uint = SIZE_INT,
|
||||
cv_slong = SIZE_LONG + FLAG_SIGNED,
|
||||
cv_ulong = SIZE_LONG,
|
||||
cv_sll = SIZE_LONGLONG + FLAG_SIGNED,
|
||||
cv_ull = SIZE_LONGLONG
|
||||
} ctype_t;
|
||||
|
||||
typedef struct cval {
|
||||
ctype_t type;
|
||||
union {
|
||||
#if 0
|
||||
signed char sc; /* Explicitly signed because compilers are stupid */
|
||||
unsigned char uc;
|
||||
short ss;
|
||||
unsigned short us;
|
||||
#endif
|
||||
int si;
|
||||
unsigned int ui;
|
||||
long sl;
|
||||
unsigned long ul;
|
||||
__int64 sll;
|
||||
unsigned __int64 ull;
|
||||
} val;
|
||||
} cval_t;
|
||||
|
||||
|
||||
|
||||
void *pp_xmalloc(size_t);
|
||||
void *pp_xrealloc(void *, size_t);
|
||||
char *pp_xstrdup(const char *str);
|
||||
pp_entry_t *pplookup(const char *ident);
|
||||
int pp_push_define_state(void);
|
||||
void pp_pop_define_state(void);
|
||||
pp_entry_t *pp_add_define(const char *def, const char *text);
|
||||
pp_entry_t *pp_add_macro(char *ident, marg_t *args[], int nargs, mtext_t *exp);
|
||||
void pp_del_define(const char *name);
|
||||
void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath);
|
||||
void pp_push_if(pp_if_state_t s);
|
||||
void pp_next_if_state(int);
|
||||
pp_if_state_t pp_pop_if(void);
|
||||
pp_if_state_t pp_if_state(void);
|
||||
int pp_get_if_depth(void);
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
extern const struct wpp_callbacks *wpp_callbacks;
|
||||
|
||||
int WINAPIV ppy_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
int WINAPIV ppy_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
void WINAPIV pp_internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
|
||||
|
||||
/* current preprocessor state */
|
||||
/* everything is in this structure to avoid polluting the global symbol space */
|
||||
struct pp_status
|
||||
{
|
||||
char *input; /* current input file name */
|
||||
void *file; /* current input file descriptor */
|
||||
int line_number; /* current line number */
|
||||
int char_number; /* current char number in line */
|
||||
int state; /* current error state */
|
||||
int pedantic; /* pedantic option */
|
||||
};
|
||||
|
||||
extern struct pp_status pp_status;
|
||||
extern include_state_t pp_incl_state;
|
||||
extern includelogicentry_t *pp_includelogiclist;
|
||||
|
||||
/*
|
||||
* From ppl.l
|
||||
*/
|
||||
extern FILE *ppy_out;
|
||||
extern char *ppy_text;
|
||||
int ppy_lex(void);
|
||||
|
||||
void pp_do_include(char *fname, int type);
|
||||
void pp_push_ignore_state(void);
|
||||
void pp_pop_ignore_state(void);
|
||||
|
||||
void WINAPIV pp_writestring(const char *format, ...) __attribute__((format (printf, 1, 2)));
|
||||
|
||||
/*
|
||||
* From ppy.y
|
||||
*/
|
||||
int ppy_parse(void);
|
||||
|
||||
#endif /* __WPP_PRIVATE_H */
|
|
@ -24,7 +24,7 @@ The following libraries are shared with Wine.
|
|||
dll/directx/wine/amstream # Synced to WineStaging-3.9
|
||||
dll/directx/wine/d3d8 # Synced to WineStaging-3.3
|
||||
dll/directx/wine/d3d9 # Synced to WineStaging-3.3
|
||||
dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-3.3
|
||||
dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-4.18
|
||||
dll/directx/wine/d3drm # Synced to WineStaging-4.0
|
||||
dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-4.0
|
||||
dll/directx/wine/d3dxof # Synced to WineStaging-3.17
|
||||
|
|
Loading…
Reference in a new issue