Path: blob/main_old/src/compiler/preprocessor/Preprocessor.h
1693 views
//1// Copyright 2011 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56#ifndef COMPILER_PREPROCESSOR_PREPROCESSOR_H_7#define COMPILER_PREPROCESSOR_PREPROCESSOR_H_89#include <cstddef>1011#include "GLSLANG/ShaderLang.h"12#include "common/angleutils.h"1314namespace angle15{1617namespace pp18{1920class Diagnostics;21class DirectiveHandler;22struct PreprocessorImpl;23struct Token;2425struct PreprocessorSettings final26{27PreprocessorSettings(ShShaderSpec shaderSpec)28: maxMacroExpansionDepth(1000), shaderSpec(shaderSpec)29{}3031PreprocessorSettings(const PreprocessorSettings &other) = default;3233int maxMacroExpansionDepth;34ShShaderSpec shaderSpec;35};3637class Preprocessor : angle::NonCopyable38{39public:40Preprocessor(Diagnostics *diagnostics,41DirectiveHandler *directiveHandler,42const PreprocessorSettings &settings);43~Preprocessor();4445// count: specifies the number of elements in the string and length arrays.46// string: specifies an array of pointers to strings.47// length: specifies an array of string lengths.48// If length is NULL, each string is assumed to be null terminated.49// If length is a value other than NULL, it points to an array containing50// a string length for each of the corresponding elements of string.51// Each element in the length array may contain the length of the52// corresponding string or a value less than 0 to indicate that the string53// is null terminated.54bool init(size_t count, const char *const string[], const int length[]);55// Adds a pre-defined macro.56void predefineMacro(const char *name, int value);5758void lex(Token *token);5960// Set maximum preprocessor token size61void setMaxTokenSize(size_t maxTokenSize);6263private:64PreprocessorImpl *mImpl;65};6667} // namespace pp6869} // namespace angle7071#endif // COMPILER_PREPROCESSOR_PREPROCESSOR_H_727374