RetroArch
PpContext.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2013 LunarG, Inc.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions
7 // are met:
8 //
9 // Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following
14 // disclaimer in the documentation and/or other materials provided
15 // with the distribution.
16 //
17 // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
18 // contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 // POSSIBILITY OF SUCH DAMAGE.
33 //
34 /****************************************************************************\
35 Copyright (c) 2002, NVIDIA Corporation.
36 
37 NVIDIA Corporation("NVIDIA") supplies this software to you in
38 consideration of your agreement to the following terms, and your use,
39 installation, modification or redistribution of this NVIDIA software
40 constitutes acceptance of these terms. If you do not agree with these
41 terms, please do not use, install, modify or redistribute this NVIDIA
42 software.
43 
44 In consideration of your agreement to abide by the following terms, and
45 subject to these terms, NVIDIA grants you a personal, non-exclusive
46 license, under NVIDIA's copyrights in this original NVIDIA software (the
47 "NVIDIA Software"), to use, reproduce, modify and redistribute the
48 NVIDIA Software, with or without modifications, in source and/or binary
49 forms; provided that if you redistribute the NVIDIA Software, you must
50 retain the copyright notice of NVIDIA, this notice and the following
51 text and disclaimers in all such redistributions of the NVIDIA Software.
52 Neither the name, trademarks, service marks nor logos of NVIDIA
53 Corporation may be used to endorse or promote products derived from the
54 NVIDIA Software without specific prior written permission from NVIDIA.
55 Except as expressly stated in this notice, no other rights or licenses
56 express or implied, are granted by NVIDIA herein, including but not
57 limited to any patent rights that may be infringed by your derivative
58 works or by other works in which the NVIDIA Software may be
59 incorporated. No hardware is licensed hereunder.
60 
61 THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
62 WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
63 INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
64 NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
65 ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
66 PRODUCTS.
67 
68 IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
69 INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
70 TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
71 USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
72 OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
73 NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
74 TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
75 NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
76 \****************************************************************************/
77 
78 #ifndef PPCONTEXT_H
79 #define PPCONTEXT_H
80 
81 #include <stack>
82 #include <unordered_map>
83 #include <sstream>
84 
85 #include "../ParseHelper.h"
86 
87 /* windows only pragma */
88 #ifdef _MSC_VER
89  #pragma warning(disable : 4127)
90 #endif
91 
92 namespace glslang {
93 
94 class TPpToken {
95 public:
96  TPpToken() { clear(); }
97  void clear()
98  {
99  space = false;
100  i64val = 0;
101  loc.init();
102  name[0] = 0;
103  }
104 
105  // Used for comparing macro definitions, so checks what is relevant for that.
106  bool operator==(const TPpToken& right)
107  {
108  return space == right.space &&
109  ival == right.ival && dval == right.dval && i64val == right.i64val &&
110  strncmp(name, right.name, MaxTokenLength) == 0;
111  }
112  bool operator!=(const TPpToken& right) { return ! operator==(right); }
113 
115  // True if a space (for white space or a removed comment) should also be
116  // recognized, in front of the token returned:
117  bool space;
118  // Numeric value of the token:
119  union {
120  int ival;
121  double dval;
122  long long i64val;
123  };
124  // Text string of the token:
125  char name[MaxTokenLength + 1];
126 };
127 
129 //
130 // Implementation is in PpAtom.cpp
131 //
132 // Maintain a bi-directional mapping between relevant preprocessor strings and
133 // "atoms" which a unique integers (small, contiguous, not hash-like) per string.
134 //
135 public:
136  TStringAtomMap();
137 
138  // Map string -> atom.
139  // Return 0 if no existing string.
140  int getAtom(const char* s) const
141  {
142  auto it = atomMap.find(s);
143  return it == atomMap.end() ? 0 : it->second;
144  }
145 
146  // Map a new or existing string -> atom, inventing a new atom if necessary.
147  int getAddAtom(const char* s)
148  {
149  int atom = getAtom(s);
150  if (atom == 0) {
151  atom = nextAtom++;
152  addAtomFixed(s, atom);
153  }
154  return atom;
155  }
156 
157  // Map atom -> string.
158  const char* getString(int atom) const { return stringMap[atom]->c_str(); }
159 
160 protected:
163 
165  TVector<const TString*> stringMap; // these point into the TString in atomMap
166  int nextAtom;
167 
168  // Bad source characters can lead to bad atoms, so gracefully handle those by
169  // pre-filling the table with them (to avoid if tests later).
171 
172  // Add bi-directional mappings:
173  // - string -> atom
174  // - atom -> string
175  void addAtomFixed(const char* s, int atom)
176  {
177  auto it = atomMap.insert(std::pair<TString, int>(s, atom)).first;
178  if (stringMap.size() < (size_t)atom + 1)
179  stringMap.resize(atom + 100, &badToken);
180  stringMap[atom] = &it->first;
181  }
182 };
183 
184 class TInputScanner;
185 
186 // This class is the result of turning a huge pile of C code communicating through globals
187 // into a class. This was done to allowing instancing to attain thread safety.
188 // Don't expect too much in terms of OO design.
189 class TPpContext {
190 public:
192  virtual ~TPpContext();
193 
194  void setPreamble(const char* preamble, size_t length);
195 
196  int tokenize(TPpToken& ppToken);
197  int tokenPaste(int token, TPpToken&);
198 
199  class tInput {
200  public:
202  virtual ~tInput() { }
203 
204  virtual int scan(TPpToken*) = 0;
205  virtual int getch() = 0;
206  virtual void ungetch() = 0;
207  virtual bool peekPasting() { return false; } // true when about to see ##
208  virtual bool endOfReplacementList() { return false; } // true when at the end of a macro replacement list (RHS of #define)
209  virtual bool isMacroInput() { return false; }
210 
211  // Will be called when we start reading tokens from this instance
212  virtual void notifyActivated() {}
213  // Will be called when we do not read tokens from this instance anymore
214  virtual void notifyDeleted() {}
215  protected:
216  bool done;
218  };
219 
220  void setInput(TInputScanner& input, bool versionWillBeError);
221 
223  {
224  inputStack.push_back(in);
225  in->notifyActivated();
226  }
227  void popInput()
228  {
229  inputStack.back()->notifyDeleted();
230  delete inputStack.back();
231  inputStack.pop_back();
232  }
233 
234  //
235  // From PpTokens.cpp
236  //
237 
238  class TokenStream {
239  public:
240  TokenStream() : current(0) { }
241 
242  void putToken(int token, TPpToken* ppToken);
244  bool atEnd() { return current >= data.size(); }
245  bool peekTokenizedPasting(bool lastTokenPastes);
246  bool peekUntokenizedPasting();
247  void reset() { current = 0; }
248 
249  protected:
250  void putSubtoken(char);
251  int getSubtoken();
252  void ungetSubtoken();
253 
255  size_t current;
256  };
257 
258  //
259  // From Pp.cpp
260  //
261 
262  struct MacroSymbol {
263  MacroSymbol() : emptyArgs(0), busy(0), undef(0) { }
266  unsigned emptyArgs : 1;
267  unsigned busy : 1;
268  unsigned undef : 1;
269  };
270 
272  TSymbolMap macroDefs; // map atoms to macro definitions
274  {
275  auto existingMacroIt = macroDefs.find(atom);
276  return (existingMacroIt == macroDefs.end()) ? nullptr : &(existingMacroIt->second);
277  }
278  void addMacroDef(int atom, MacroSymbol& macroDef) { macroDefs[atom] = macroDef; }
279 
280 protected:
283 
285  char* preamble; // string to parse, all before line 1 of string 0, it is 0 if no preamble
287  char** strings; // official strings of shader, starting a string 0 line 1
288  size_t* lengths;
289  int numStrings; // how many official strings there are
290  int currentString; // which string we're currently parsing (-1 for preamble)
291 
292  // Scanner data:
295 
296  // Get the next token from *stack* of input sources, popping input sources
297  // that are out of tokens, down until an input source is found that has a token.
298  // Return EndOfInput when there are no more tokens to be found by doing this.
299  int scanToken(TPpToken* ppToken)
300  {
301  int token = EndOfInput;
302 
303  while (! inputStack.empty()) {
304  token = inputStack.back()->scan(ppToken);
305  if (token != EndOfInput || inputStack.empty())
306  break;
307  popInput();
308  }
309 
310  return token;
311  }
312  int getChar() { return inputStack.back()->getch(); }
313  void ungetChar() { inputStack.back()->ungetch(); }
314  bool peekPasting() { return !inputStack.empty() && inputStack.back()->peekPasting(); }
315  bool endOfReplacementList() { return inputStack.empty() || inputStack.back()->endOfReplacementList(); }
316  bool isMacroInput() { return inputStack.size() > 0 && inputStack.back()->isMacroInput(); }
317 
318  static const int maxIfNesting = 65;
319 
320  int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor)
321  bool elseSeen[maxIfNesting]; // Keep a track of whether an else has been seen at a particular depth
322  int elsetracker; // #if-#else and #endif constructs...Counter.
323 
324  class tMacroInput : public tInput {
325  public:
327  virtual ~tMacroInput()
328  {
329  for (size_t i = 0; i < args.size(); ++i)
330  delete args[i];
331  for (size_t i = 0; i < expandedArgs.size(); ++i)
332  delete expandedArgs[i];
333  }
334 
335  virtual int scan(TPpToken*) override;
336  virtual int getch() override { assert(0); return EndOfInput; }
337  virtual void ungetch() override { assert(0); }
338  bool peekPasting() override { return prepaste; }
339  bool endOfReplacementList() override { return mac->body.atEnd(); }
340  bool isMacroInput() override { return true; }
341 
345 
346  protected:
347  bool prepaste; // true if we are just before ##
348  bool postpaste; // true if we are right after ##
349  };
350 
351  class tMarkerInput : public tInput {
352  public:
354  virtual int scan(TPpToken*) override
355  {
356  if (done)
357  return EndOfInput;
358  done = true;
359 
360  return marker;
361  }
362  virtual int getch() override { assert(0); return EndOfInput; }
363  virtual void ungetch() override { assert(0); }
364  static const int marker = -3;
365  };
366 
367  class tZeroInput : public tInput {
368  public:
370  virtual int scan(TPpToken*) override;
371  virtual int getch() override { assert(0); return EndOfInput; }
372  virtual void ungetch() override { assert(0); }
373  };
374 
375  std::vector<tInput*> inputStack;
378 
379  //
380  // from Pp.cpp
381  //
382 
383  // Used to obtain #include content.
385 
386  int CPPdefine(TPpToken * ppToken);
387  int CPPundef(TPpToken * ppToken);
388  int CPPelse(int matchelse, TPpToken * ppToken);
389  int extraTokenCheck(int atom, TPpToken* ppToken, int token);
390  int eval(int token, int precedence, bool shortCircuit, int& res, bool& err, TPpToken * ppToken);
391  int evalToToken(int token, bool shortCircuit, int& res, bool& err, TPpToken * ppToken);
392  int CPPif (TPpToken * ppToken);
393  int CPPifdef(int defined, TPpToken * ppToken);
394  int CPPinclude(TPpToken * ppToken);
395  int CPPline(TPpToken * ppToken);
396  int CPPerror(TPpToken * ppToken);
397  int CPPpragma(TPpToken * ppToken);
398  int CPPversion(TPpToken * ppToken);
399  int CPPextension(TPpToken * ppToken);
400  int readCPPline(TPpToken * ppToken);
401  int scanHeaderName(TPpToken* ppToken, char delimit);
402  TokenStream* PrescanMacroArg(TokenStream&, TPpToken*, bool newLineOkay);
403  int MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOkay);
404 
405  //
406  // From PpTokens.cpp
407  //
408  void pushTokenStreamInput(TokenStream&, bool pasting = false);
409  void UngetToken(int token, TPpToken*);
410 
411  class tTokenInput : public tInput {
412  public:
413  tTokenInput(TPpContext* pp, TokenStream* t, bool prepasting) : tInput(pp), tokens(t), lastTokenPastes(prepasting) { }
414  virtual int scan(TPpToken *ppToken) override { return tokens->getToken(pp->_parseContext, ppToken); }
415  virtual int getch() override { assert(0); return EndOfInput; }
416  virtual void ungetch() override { assert(0); }
417  virtual bool peekPasting() override { return tokens->peekTokenizedPasting(lastTokenPastes); }
418  protected:
420  bool lastTokenPastes; // true if the last token in the input is to be pasted, rather than consumed as a token
421  };
422 
423  class tUngotTokenInput : public tInput {
424  public:
426  virtual int scan(TPpToken *) override;
427  virtual int getch() override { assert(0); return EndOfInput; }
428  virtual void ungetch() override { assert(0); }
429  protected:
430  int token;
432  };
433 
434  //
435  // From PpScanner.cpp
436  //
437  class tStringInput : public tInput {
438  public:
440  virtual int scan(TPpToken*) override;
441 
442  // Scanner used to get source stream characters.
443  // - Escaped newlines are handled here, invisibly to the caller.
444  // - All forms of newline are handled, and turned into just a '\n'.
445  int getch() override
446  {
447  int ch = input->get();
448 
449  if (ch == '\\') {
450  // Move past escaped newlines, as many as sequentially exist
451  do {
452  if (input->peek() == '\r' || input->peek() == '\n') {
453  bool allowed = pp->_parseContext.lineContinuationCheck(input->getSourceLoc(), pp->inComment);
454  if (! allowed && pp->inComment)
455  return '\\';
456 
457  // escape one newline now
458  ch = input->get();
459  int nextch = input->get();
460  if (ch == '\r' && nextch == '\n')
461  ch = input->get();
462  else
463  ch = nextch;
464  } else
465  return '\\';
466  } while (ch == '\\');
467  }
468 
469  // handle any non-escaped newline
470  if (ch == '\r' || ch == '\n') {
471  if (ch == '\r' && input->peek() == '\n')
472  input->get();
473  return '\n';
474  }
475 
476  return ch;
477  }
478 
479  // Scanner used to backup the source stream characters. Newlines are
480  // handled here, invisibly to the caller, meaning have to undo exactly
481  // what getch() above does (e.g., don't leave things in the middle of a
482  // sequence of escaped newlines).
483  void ungetch() override
484  {
485  input->unget();
486 
487  do {
488  int ch = input->peek();
489  if (ch == '\r' || ch == '\n') {
490  if (ch == '\n') {
491  // correct for two-character newline
492  input->unget();
493  if (input->peek() != '\r')
494  input->get();
495  }
496  // now in front of a complete newline, move past an escape character
497  input->unget();
498  if (input->peek() == '\\')
499  input->unget();
500  else {
501  input->get();
502  break;
503  }
504  } else
505  break;
506  } while (true);
507  }
508 
509  protected:
511  };
512 
513  // Holds a reference to included file data, as well as a
514  // prologue and an epilogue string. This can be scanned using the tInput
515  // interface and acts as a single source string.
517  public:
518  // Copies prologue and epilogue. The includedFile must remain valid
519  // until this TokenizableIncludeFile is no longer used.
521  const std::string& prologue,
522  TShader::Includer::IncludeResult* includedFile,
523  const std::string& epilogue,
524  TPpContext* pp)
525  : tInput(pp),
526  prologue_(prologue),
527  epilogue_(epilogue),
528  includedFile_(includedFile),
529  scanner(3, strings, lengths, names, 0, 0, true),
530  prevScanner(nullptr),
532  {
533  strings[0] = prologue_.data();
535  strings[2] = epilogue_.data();
536 
537  lengths[0] = prologue_.size();
539  lengths[2] = epilogue_.size();
540 
541  scanner.setLine(startLoc.line);
542  scanner.setString(startLoc.string);
543 
544  scanner.setFile(startLoc.name, 0);
545  scanner.setFile(startLoc.name, 1);
546  scanner.setFile(startLoc.name, 2);
547  }
548 
549  // tInput methods:
550  int scan(TPpToken* t) override { return stringInput.scan(t); }
551  int getch() override { return stringInput.getch(); }
552  void ungetch() override { stringInput.ungetch(); }
553 
554  void notifyActivated() override
555  {
559  }
560 
561  void notifyDeleted() override
562  {
564  pp->pop_include();
565  }
566 
567  private:
569 
570  // Stores the prologue for this string.
572 
573  // Stores the epilogue for this string.
575 
576  // Points to the IncludeResult that this TokenizableIncludeFile represents.
578 
579  // Will point to prologue_, includedFile_->headerData and epilogue_
580  // This is passed to scanner constructor.
581  // These do not own the storage and it must remain valid until this
582  // object has been destroyed.
583  const char* strings[3];
584  // Length of str_, passed to scanner constructor.
585  size_t lengths[3];
586  // String names
587  const char* names[3];
588  // Scans over str_.
590  // The previous effective scanner before the scanner in this instance
591  // has been activated.
593  // Delegate object implementing the tInput interface.
595  };
596 
597  int ScanFromString(char* s);
598  void missingEndifCheck();
599  int lFloatConst(int len, int ch, TPpToken* ppToken);
600  int characterLiteral(TPpToken* ppToken);
601 
603  {
604  currentSourceFile = result->headerName;
605  includeStack.push(result);
606  }
607 
608  void pop_include()
609  {
611  includeStack.pop();
612  includer.releaseInclude(include);
613  if (includeStack.empty()) {
615  } else {
616  currentSourceFile = includeStack.top()->headerName;
617  }
618  }
619 
620  bool inComment;
622  std::stack<TShader::Includer::IncludeResult*> includeStack;
624 
625  std::istringstream strtodStream;
626 };
627 
628 } // end namespace glslang
629 
630 #endif // PPCONTEXT_H
Definition: PpContext.h:262
static const int maxIfNesting
Definition: PpContext.h:318
Definition: ShaderLang.h:445
tMacroInput(TPpContext *pp)
Definition: PpContext.h:326
bool postpaste
Definition: PpContext.h:348
Definition: PpContext.h:189
int CPPinclude(TPpToken *ppToken)
Definition: Pp.cpp:596
GLuint const GLchar * name
Definition: glext.h:6671
int MacroExpand(TPpToken *ppToken, bool expandUndef, bool newLineOkay)
Definition: Pp.cpp:1125
Definition: PpContext.h:94
TInputScanner scanner
Definition: PpContext.h:589
int preambleLength
Definition: PpContext.h:286
int token
Definition: PpContext.h:430
int previous_token
Definition: PpContext.h:293
tUngotTokenInput(TPpContext *pp, int t, TPpToken *p)
Definition: PpContext.h:425
virtual int scan(TPpToken *)=0
virtual bool peekPasting()
Definition: PpContext.h:207
Definition: PpContext.h:423
bool isMacroInput() override
Definition: PpContext.h:340
TInputScanner * input
Definition: PpContext.h:510
virtual void notifyDeleted()
Definition: PpContext.h:214
int strncmp(const char *s1, const char *s2, size_t n)
Definition: compat_ctype.c:179
Definition: PpContext.h:351
Definition: Common.h:231
Definition: PpContext.h:238
bool operator==(const TPpToken &right)
Definition: PpContext.h:106
unsigned undef
Definition: PpContext.h:268
virtual int scan(TPpToken *) override
Definition: PpScanner.cpp:420
void putToken(int token, TPpToken *ppToken)
Definition: PpTokens.cpp:174
TVector< TokenStream * > args
Definition: PpContext.h:343
tStringInput stringInput
Definition: PpContext.h:594
void popInput()
Definition: PpContext.h:227
virtual ~tMacroInput()
Definition: PpContext.h:327
int line
Definition: Common.h:243
Definition: PpContext.h:128
TokenizableIncludeFile(const TSourceLoc &startLoc, const std::string &prologue, TShader::Includer::IncludeResult *includedFile, const std::string &epilogue, TPpContext *pp)
Definition: PpContext.h:520
GLuint res
Definition: glext.h:10520
GLdouble GLdouble t
Definition: glext.h:6398
bool operator!=(const TPpToken &right)
Definition: PpContext.h:112
void putSubtoken(char)
Definition: PpTokens.cpp:151
int scan(TPpToken *t) override
Definition: PpContext.h:550
GLsizei const GLchar *const * strings
Definition: glext.h:8289
GLenum GLsizei len
Definition: glext.h:7389
const std::string prologue_
Definition: PpContext.h:571
Definition: ParseHelper.h:75
double dval
Definition: PpContext.h:121
TMap< int, MacroSymbol > TSymbolMap
Definition: PpContext.h:271
TVector< unsigned char > data
Definition: PpContext.h:254
std::string currentSourceFile
Definition: PpContext.h:623
int currentString
Definition: PpContext.h:290
int lFloatConst(int len, int ch, TPpToken *ppToken)
Definition: PpScanner.cpp:103
unsigned busy
Definition: PpContext.h:267
int scanHeaderName(TPpToken *ppToken, char delimit)
Definition: Pp.cpp:973
Definition: PpContext.h:411
void pop_include()
Definition: PpContext.h:608
GLdouble s
Definition: glext.h:6390
void UngetToken(int token, TPpToken *)
Definition: PpTokens.cpp:333
virtual void ungetch() override
Definition: PpContext.h:428
bool peekPasting()
Definition: PpContext.h:314
Definition: PpContext.h:324
GLsizei const GLchar *const * string
Definition: glext.h:6699
void ungetch() override
Definition: PpContext.h:552
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
Definition: glext.h:8420
TShader::Includer & includer
Definition: PpContext.h:384
bool peekPasting() override
Definition: PpContext.h:338
TStringAtomMap()
Definition: PpAtom.cpp:159
tZeroInput(TPpContext *pp)
Definition: PpContext.h:369
Definition: ibxm.h:9
GLenum GLenum GLenum input
Definition: glext.h:9938
int getSubtoken()
Definition: PpTokens.cpp:157
void setInput(TInputScanner &input, bool versionWillBeError)
Definition: PpContext.cpp:108
virtual int scan(TPpToken *) override
Definition: Pp.cpp:1037
GLdouble GLdouble right
Definition: glext.h:11766
void ungetSubtoken()
Definition: PpTokens.cpp:166
tInput(TPpContext *p)
Definition: PpContext.h:201
int nextAtom
Definition: PpContext.h:166
bool space
Definition: PpContext.h:117
virtual int scan(TPpToken *ppToken) override
Definition: PpContext.h:414
TPpToken()
Definition: PpContext.h:96
size_t * lengths
Definition: PpContext.h:288
virtual bool peekPasting() override
Definition: PpContext.h:417
int evalToToken(int token, bool shortCircuit, int &res, bool &err, TPpToken *ppToken)
Definition: Pp.cpp:515
std::istringstream strtodStream
Definition: PpContext.h:625
int CPPundef(TPpToken *ppToken)
Definition: Pp.cpp:196
Definition: PpContext.h:437
void pushTokenStreamInput(TokenStream &, bool pasting=false)
Definition: PpTokens.cpp:315
bool inComment
Definition: PpContext.h:620
void notifyDeleted() override
Definition: PpContext.h:561
TokenStream * PrescanMacroArg(TokenStream &, TPpToken *, bool newLineOkay)
Definition: Pp.cpp:1005
char ** strings
Definition: PpContext.h:287
void setString(int newString)
Definition: Scan.h:185
bool prepaste
Definition: PpContext.h:347
TSourceLoc loc
Definition: PpContext.h:114
bool errorOnVersion
Definition: PpContext.h:376
int getAtom(const char *s) const
Definition: PpContext.h:140
virtual bool endOfReplacementList()
Definition: PpContext.h:208
Definition: ShaderLang.h:449
bool done
Definition: PpContext.h:216
TokenStream()
Definition: PpContext.h:240
int CPPdefine(TPpToken *ppToken)
Definition: Pp.cpp:95
int ival
Definition: PpContext.h:120
virtual void notifyActivated()
Definition: PpContext.h:212
virtual bool lineContinuationCheck(const TSourceLoc &, bool endOfComment)=0
const int MaxTokenLength
Definition: Common.h:252
tTokenInput(TPpContext *pp, TokenStream *t, bool prepasting)
Definition: PpContext.h:413
const char * name
Definition: Common.h:241
int characterLiteral(TPpToken *ppToken)
Definition: PpScanner.cpp:347
MacroSymbol * mac
Definition: PpContext.h:342
int eval(int token, int precedence, bool shortCircuit, int &res, bool &err, TPpToken *ppToken)
Definition: Pp.cpp:397
static const int marker
Definition: PpContext.h:364
int CPPifdef(int defined, TPpToken *ppToken)
Definition: Pp.cpp:563
bool peekTokenizedPasting(bool lastTokenPastes)
Definition: PpTokens.cpp:253
virtual int getch() override
Definition: PpContext.h:415
bool atEnd()
Definition: PpContext.h:244
TInputScanner * getScanner() const
Definition: parseVersions.h:111
bool endOfReplacementList() override
Definition: PpContext.h:339
TokenStream * tokens
Definition: PpContext.h:419
int CPPversion(TPpToken *ppToken)
Definition: Pp.cpp:796
TVector< int > args
Definition: PpContext.h:264
void setScanner(TInputScanner *scanner)
Definition: parseVersions.h:110
TInputScanner * prevScanner
Definition: PpContext.h:592
void push_include(TShader::Includer::IncludeResult *result)
Definition: PpContext.h:602
void setPreamble(const char *preamble, size_t length)
void reset()
Definition: PpContext.h:247
virtual int getch() override
Definition: PpContext.h:362
int extraTokenCheck(int atom, TPpToken *ppToken, int token)
Definition: Pp.cpp:299
virtual bool isMacroInput()
Definition: PpContext.h:209
const char *const headerData
Definition: ShaderLang.h:462
int CPPline(TPpToken *ppToken)
Definition: Pp.cpp:669
int getch() override
Definition: PpContext.h:445
virtual void ungetch()=0
TUnorderedMap< TString, int > atomMap
Definition: PpContext.h:164
bool isMacroInput()
Definition: PpContext.h:316
int ifdepth
Definition: PpContext.h:320
int scanToken(TPpToken *ppToken)
Definition: PpContext.h:299
GLuint in
Definition: glext.h:10523
GLuint64EXT * result
Definition: glext.h:12211
MacroSymbol * lookupMacroDef(int atom)
Definition: PpContext.h:273
void ungetChar()
Definition: PpContext.h:313
void ungetch() override
Definition: PpContext.h:483
TStringAtomMap & operator=(TStringAtomMap &)
int getChar()
Definition: PpContext.h:312
tStringInput(TPpContext *pp, TInputScanner &i)
Definition: PpContext.h:439
int getAddAtom(const char *s)
Definition: PpContext.h:147
const char * getString(int atom) const
Definition: PpContext.h:158
未知的編譯器 設備已從連接口上移開 文件已存在。儲存到備份至緩衝區 連接來自: 公開地址 設定光碟機裡光碟 你已離開遊戲 這個核心模擬器不支援不同系統的網路連線對打 輸入連線遊戲服務器的密碼: s 已斷開連線 已離開連線遊戲模式 連線遊戲人數已滿 連線遊戲對方 s 已暫停 使用模擬器硬體渲染私人內容時可避免硬體在各frames時的狀態改變 調整選單顯示的相關設定。 以延遲和視訊撕裂為代價換取高性能,當且僅當能 n 達到全速模擬時使用。 自動偵測 容量 連接到連接口 對不起,錯誤發生:模擬器核心未請求內容,無法加入連線遊戲。 密碼 用戶名 帳戶列表終端 成就列表 添加遊戲內容 導入遊戲內容 詢問 塊幀 聲音驅動程式 啟用聲音 渦輪 盲區 聲音最大採樣間隔 動態聲音碼率控制間隔 聲音 SaveRAM自動儲存間隔 自動戴入重映射文件 返回 訊息 向下滾動 開始 切換選單 確認 退出 默認值 切換選單 啟用藍牙服務 緩沖目錄 相機驅動程式 執行金手指修改 金手指文件 另存金手指文件 描述 鎖定 非官方測試成就 未鎖定 設定 設定 退出時進行詢問 遊戲內容數據庫目錄 歷史記錄數量 快捷選單 下載目錄 核心計數器 核心訊息 分類 核心名稱 許可證 支持的擴展 系統名稱 戴入核心 核心 自動解壓下載的檔案 核心更新程序 指針目錄 自定義比率 選擇數據庫 選擇文件並探測核心< 默認 > 沒有找到文件夾。 Disk Cycle Tray Status 光碟索引 不關心 下載核心…… 啟用DPI覆蓋 驅動 載入前檢查韌體 BIOS是否存在 動態壁紙目錄 選單項懸停顏色 取消 顯示幀率 幀率限制 自動戴入遊戲內容特定的核心選項 遊戲選項文件 聲音 視訊故障排除 基本選單控制 戴入遊戲內容 什麼是「核心」? 歷史 圖像 訊息 所有用戶都能控制選單 左搖桿Y 右搖桿X 右搖桿Y Gun Trigger Gun Aux A Gun Aux C Gun Select Gun D pad Down Gun D pad Right 輸入軸閾值 綁定全部 綁定超時時間 顯示輸入描述標籤 設備類型 Turbo占空比 鍵盤控制器映射啟用 下十字鍵 左十字鍵 右十字鍵 開始鍵 Mouse Mouse Mouse Wheel Down Wheel Right 最大用戶數 金手指索引 金手指開關 下一張光碟 啟用熱鍵 快進切換 切換全營幕 切換遊戲焦距 切換選單 靜音開關 切換營幕鍵盤 切換暫停 重置遊戲 儲存狀態 下一個Shader 慢動作 存檔槽 音量 顯示覆層 輪詢類型行為 稍晚 優先前置觸摸 啟用綁定重映射 輸入 啟用觸摸 Turbo區間 內部存儲狀態 手柄驅動 簡體中文 荷蘭語 世界語 德語 日語 波蘭語 葡萄牙語 西班牙語 Arabic 核心目錄 核心日誌級別 使用核心戴入壓縮包 載入遊戲內容 允許使用位置 日誌 主選單 選單顏色主題 藍灰色 綠色 紅色 底部不透明度 選單驅動 選單文件瀏覽器 Horizontal Animation 選單壁紙 丟失 鼠標支持 音樂 環繞式導航 連線遊戲 連線遊戲延遲幀數 啟用連線遊戲 作為遊戲主機 服務器地址 啟用連線遊戲客戶端 服務器密碼 連線遊戲無狀態模式 啟用連線遊戲旁觀者 連線遊戲使用NAT穿透技術 網路命令端口 網路遊戲控制器 網路 無 沒有可顯示的成就。 沒有可用的核心。 沒有可用的核心選項。 沒有可用的歷史記錄。 沒有條目。 未發現網路。 沒有遊戲列表。 沒有找到設定。 關 連線更新器 營幕覆層 營幕通知 OSK覆層目錄 自動戴入最佳的覆層 覆層不透明度 覆層縮放比例 使用PAL60模式 當選單激活時暫停 性能計數器 遊戲列表目錄 觸控支援 現在 退出 RetroArch BBFC 分級 多人遊戲支持 描述 Edge雜誌發行 Edge雜誌評論 增強硬件 經銷商 MD5 起源 出版方 發售年份 系列 啟動遊戲內容 重啟 錄影輸出目錄 錄影設定 啟用錄影 使用輸出目錄 戴入重映射文件 儲存遊戲重映射文件 重啟 繼續 Retro鍵盤 RetroPad w Analog 啟用回溯 回溯 設定目錄 右側搖桿 啟用SAMBA文件共享服務 自動索引儲存狀態 自動儲存狀態 既時存檔縮圖 儲存核心覆寫 儲存新設定 存檔 掃瞄文件 營幕截圖目錄 搜索: 設定 Shader Shader效果 Simple Snow 顯示高級設定 關機 排序文件夾中的存檔 啟用SSH遠程終端服務 啟動遠程的RetroPad 狀態存儲槽 標準輸入流命令 暫停屏保程序 系統 BIOS目錄 支持 編譯日期 Cocoa 支持 CoreText 支持 顯示器度量DPI DirectSound 支持 動態鏈接庫支持 EGL 支持 FFmpeg 支持 STB TrueType 支持 前端名稱 Git版本 HLSL 支持 KMS EGL 支持 Libusb 支持 網路控制台支持 OpenAL 支持 OpenGL 支持 OpenVG 支持 覆層支持 已充滿電 放電中 PulseAudio 支持 BMP RetroRating 等級 RoarAudio 支持 RSound 支持 SDL2 支持 SDL1 支持 多線程支持 Video4Linux2 支持 Vulkan 支持 X11 支持 XVideo 支持 截取營幕 縮略圖 縮略圖更新程序 截屏 顯示時間日期 真 UI Companion Start On Boot 無法讀取壓縮的文件。 撤銷儲存狀態 更新程序 更新自動設定檔案 更新金手指 更新數據庫 更新 Lakka 更新Slang Shader效果文件 用戶界面 用戶 使用內建媒體播放器 允許旋轉 畫面比例選項 Crop 禁用桌面元素 視訊驅動 視訊濾鏡目錄 強制畫面比例 幀延時 視訊Gamma 啟用GPU截屏 強制GPU同步幀數 顯示器索引 刷新率 Set Display Reported Refresh Rate 窗口縮放量 視訊 Shader渲染遍數 戴入Shader預設 儲存核心預設 啟用硬件共享上下文 啟用軟件過濾器 視訊 降低閃爍 自定義畫面寬度 自定義畫面Y 垂直同步 窗口寬度 Wi Fi驅動 選單透明度因子 自定義 Monochrome Systematic Pixel Retrosystem 選單顏色主題 深色 鐵藍色 傳統紅 樸素 火山紅 選單縮放因子 顯示歷史頁 顯示圖像頁 顯示設定頁 Menu Layout 是 打開或關閉成就。更多內容請訪問 為測試目的而打開或關閉非官方成就和 或測試版特性。 修改驅動設定。 修改核心設定。 修改顯示覆蓋、鍵盤覆蓋和營幕通知的設定。 修改存檔設定。 修改用戶界面設定。 修改你的隱私設定。 修改遊戲列表設定。 下載且 或者掃瞄遊戲內容,並將其加入你的收藏中。 啟用或者禁止藍牙。 修改設定文件的默認設定。 CPU擁有的核心總數。 設定熱鍵選項。 調整遊戲控制器、鍵盤和鼠標的設定。 啟用或禁止向控制台打印日誌。 在局域網內搜索並連接聯網遊戲的主機。 下載並更新RetroArch的附加插件和組件。 管理操作系統層級的服務。 阻止系統激活營幕保護程序。 在幀與幀之間插入黑色的中間幀,通常用於消除在 n n 的鬼影。 設定當開啟「強制GPU同步」時CPU可以預先GPU多少幀。 選擇將要使用哪一個顯示器。 The refresh rate as reported by the display driver 掃瞄無線網路並且建立連接。 磁碟已加入 載入 shader 取消靜音。 自動設定文件儲存成功。 自動儲存狀態至 啟用通訊埠上的指令介面 無法推斷新的設定路徑,使用當前時間。 與已知的magic numbers比較 未設定設定目錄,無法儲存新的設定。 內容的CRC32s不同。無法使用不同的遊戲。 核心不支持儲存狀態。 無法找到磁碟 無法找到有效的數據軌 無法讀取內容文件 無法讀取視訊狀態 Custom timing given 解壓縮失敗。 無法找到任何有效的內容位置 已關閉 正在下載 錯誤 Libretro core 但程式未找到可載入內容 無法儲存 core options 檔案 無法儲存預置 shader 正在解壓 無法儲存設定到 無法讓觀眾加入 無法載入 shader 創建目錄失敗。 從客戶端獲取暱稱失敗 載入內容失敗 無法戴入 overlay 打開libretro核心失敗 無法接收連線端的資訊 無法接收主控端的暱稱 無法接收主控端 SRAM 資料 移除臨時文件失敗 即時存檔儲存失敗 發送暱稱尺寸失敗 發送暱稱至主控端失敗 聲音驅動啟動失敗,將在無聲音模式下繼續啟動。 建用錄製視訊失敗 還原載入即時存檔失敗 還原取消靜音失敗 未找到文件 找到磁碟標籤 找到最後一個狀態槽 幀 錯誤的磁碟索引 打開遊戲焦點 Libretro core is hardware rendered Must use post shaded recording as well 輸入金手指 目前檔案 接口 可移除的儲存空間 字節 兆字節 為libretro而設計的前端 戴入狀態從槽 一個或多個固件文件丟失 正在讀取歷史文件 內存 視訊格式看起來使用了不同的序列化版本。很有可能失敗。 停止視訊錄製。 沒有內容,啟動虛擬核心。 沒有戴入任何存檔。 覆蓋儲存成功。 RetroArch 接收完畢 錄製到 重新轉向 save file to Remap file 儲存成功 移除臨時內容文件 重啟錄製由於驅動器重新初始化。 Reverting savefile directory to 正在回溯。 初始化回放緩存失敗 回放功能關閉 到達回放緩存末端 儲存狀態至槽 成功儲存至 存檔中 已完成對文件夾的掃瞄 Several patches are explicitly defined
Definition: msg_hash_cht.h:2214
GLfloat GLfloat p
Definition: glext.h:9809
virtual int getch() override
Definition: PpContext.h:371
virtual void releaseInclude(IncludeResult *)=0
unsigned emptyArgs
Definition: PpContext.h:266
virtual int scan(TPpToken *) override
Definition: Pp.cpp:1104
TPpContext(TParseContextBase &, const std::string &rootFileName, TShader::Includer &)
Definition: PpContext.cpp:86
virtual void ungetch() override
Definition: PpContext.h:416
virtual int scan(TPpToken *) override
Definition: PpContext.h:354
const int EndOfInput
Definition: Scan.h:46
Definition: arrays.h:46
TPpContext * pp
Definition: PpContext.h:217
size_t current
Definition: PpContext.h:255
MacroSymbol()
Definition: PpContext.h:263
int numStrings
Definition: PpContext.h:289
TStringAtomMap atomStrings
Definition: PpContext.h:284
TPpToken lval
Definition: PpContext.h:431
long long i64val
Definition: PpContext.h:122
int CPPerror(TPpToken *ppToken)
Definition: Pp.cpp:727
int CPPextension(TPpToken *ppToken)
Definition: Pp.cpp:844
void missingEndifCheck()
Definition: PpScanner.cpp:1190
int CPPpragma(TPpToken *ppToken)
Definition: Pp.cpp:756
TVector< const TString * > stringMap
Definition: PpContext.h:165
int getToken(TParseContextBase &, TPpToken *)
Definition: PpTokens.cpp:198
void setLine(int newLine)
Definition: Scan.h:164
TokenStream body
Definition: PpContext.h:265
TParseContextBase & _parseContext
Definition: PpContext.h:294
void addAtomFixed(const char *s, int atom)
Definition: PpContext.h:175
void notifyActivated() override
Definition: PpContext.h:554
bool lastTokenPastes
Definition: PpContext.h:420
int CPPif(TPpToken *ppToken)
Definition: Pp.cpp:542
GLuint GLuint * names
Definition: glext.h:12452
Definition: PpContext.h:199
TString badToken
Definition: PpContext.h:170
bool peekUntokenizedPasting()
Definition: PpTokens.cpp:291
bool elseSeen[maxIfNesting]
Definition: PpContext.h:321
virtual ~tInput()
Definition: PpContext.h:202
TVector< TokenStream * > expandedArgs
Definition: PpContext.h:344
virtual void ungetch() override
Definition: PpContext.h:337
char * preamble
Definition: PpContext.h:285
TShader::Includer::IncludeResult * includedFile_
Definition: PpContext.h:577
virtual int getch() override
Definition: PpContext.h:336
TokenizableIncludeFile & operator=(const TokenizableIncludeFile &)
void addMacroDef(int atom, MacroSymbol &macroDef)
Definition: PpContext.h:278
tMarkerInput(TPpContext *pp)
Definition: PpContext.h:353
int readCPPline(TPpToken *ppToken)
Definition: Pp.cpp:885
TPpContext & operator=(TPpContext &)
const size_t headerLength
Definition: ShaderLang.h:463
std::vector< tInput * > inputStack
Definition: PpContext.h:375
virtual int scan(TPpToken *) override
Definition: PpTokens.cpp:321
Definition: PpContext.h:367
int getch() override
Definition: PpContext.h:551
TSymbolMap macroDefs
Definition: PpContext.h:272
const GLchar * marker
Definition: glsym_es2.h:111
virtual int getch() override
Definition: PpContext.h:427
#define false
Definition: ordinals.h:83
void clear()
Definition: PpContext.h:97
virtual void ungetch() override
Definition: PpContext.h:363
#define true
Definition: ordinals.h:82
virtual ~TPpContext()
Definition: PpContext.cpp:99
Definition: Common.h:175
int tokenPaste(int token, TPpToken &)
Definition: PpScanner.cpp:1105
int ScanFromString(char *s)
int elsetracker
Definition: PpContext.h:322
Definition: Scan.h:52
std::string rootFileName
Definition: PpContext.h:621
GLenum GLuint GLenum GLsizei length
Definition: glext.h:6233
int tokenize(TPpToken &ppToken)
Definition: PpScanner.cpp:1033
virtual void ungetch() override
Definition: PpContext.h:372
std::stack< TShader::Includer::IncludeResult * > includeStack
Definition: PpContext.h:622
int CPPelse(int matchelse, TPpToken *ppToken)
Definition: Pp.cpp:222
Definition: lobject.h:303
bool versionSeen
Definition: PpContext.h:377
void pushInput(tInput *in)
Definition: PpContext.h:222
bool endOfReplacementList()
Definition: PpContext.h:315
void init()
Definition: Common.h:232
void setFile(const char *filename)
Definition: Scan.h:171
int string
Definition: Common.h:242
const std::string epilogue_
Definition: PpContext.h:574