vkd3d/libs/vkd3d-shader/preproc.h
Zebediah Figura 78e31bff16 vkd3d-shader: Implement #else.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-04 21:01:09 +01:00

59 lines
1.7 KiB
C

/*
* HLSL preprocessor
*
* Copyright 2020 Zebediah Figura for CodeWeavers
*
* 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 __VKD3D_SHADER_PREPROC_H
#define __VKD3D_SHADER_PREPROC_H
#include "vkd3d_shader_private.h"
struct preproc_if_state
{
/* Are we currently in a "true" block? */
bool current_true;
/* Have we seen a "true" block in this #if..#endif yet? */
bool seen_true;
/* Have we seen an #else yet? */
bool seen_else;
};
struct preproc_ctx
{
void *scanner;
struct vkd3d_shader_message_context *message_context;
struct vkd3d_string_buffer buffer;
struct vkd3d_shader_location location;
struct preproc_if_state *if_stack;
size_t if_count, if_stack_size;
int current_directive;
bool last_was_newline;
bool last_was_eof;
bool error;
};
void preproc_warning(struct preproc_ctx *ctx, const struct vkd3d_shader_location *loc,
enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(4, 5) DECLSPEC_HIDDEN;
#endif