File: MacroManager.h

package info (click to toggle)
getdp 3.0.4%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,856 kB
  • sloc: cpp: 63,020; fortran: 13,955; yacc: 9,350; f90: 1,640; lex: 799; makefile: 55; ansic: 34; awk: 33; sh: 23
file content (38 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// GetDP - Copyright (C) 1997-2015 P. Dular, C. Geuzaine
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/getdp/getdp/issues

#ifndef _MACRO_MANAGER_H_
#define _MACRO_MANAGER_H_

#include <string>

// Singleton, one macro manager for all parsers.

class MacroManagerStack;
class MacroManagerMap;

class MacroManager
{
 private:
  MacroManagerMap *_macros;
  MacroManagerStack *_calls;
  MacroManager();
  static MacroManager *_instance;
 public :
  static MacroManager *Instance();
  void clear();
  // macro in a file that is (being) parsed
  int createMacro(const std::string &name, FILE *f,
                  const std::string &filename, long int lineno);
  int leaveMacro(FILE **f, std::string &filename, long int &lineno);
  int enterMacro(const std::string &name, FILE **f,
                 std::string &filename, long int &lineno) const;

  // explicit macro as a string
  int createStringMacro(const std::string &name, const std::string &value);
  int enterStringMacro(const std::string &name) const;
};

#endif