/[svn]/linuxsampler/trunk/src/scriptvm/tree.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/tree.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3728 by schoenebeck, Wed Jan 29 13:58:33 2020 UTC revision 3804 by schoenebeck, Thu Aug 6 12:15:02 2020 UTC
# Line 25  Line 25 
25  #include "../common/global.h"  #include "../common/global.h"
26  #include "../common/Ref.h"  #include "../common/Ref.h"
27  #include "../common/ArrayList.h"  #include "../common/ArrayList.h"
28    #include "../common/optional.h"
29  #include "common.h"  #include "common.h"
30    
31  namespace LinuxSampler {  namespace LinuxSampler {
# Line 45  enum Qualifier_t { Line 46  enum Qualifier_t {
46      QUALIFIER_NONE = 0,      QUALIFIER_NONE = 0,
47      QUALIFIER_CONST = 1,      QUALIFIER_CONST = 1,
48      QUALIFIER_POLYPHONIC = (1<<1),      QUALIFIER_POLYPHONIC = (1<<1),
49        QUALIFIER_PATCH = (1<<2),
50    };
51    
52    struct PatchVarBlock {
53        CodeBlock nameBlock;
54        optional<CodeBlock> exprBlock;
55  };  };
56    
57  /**  /**
# Line 81  inline String qualifierStr(Qualifier_t q Line 88  inline String qualifierStr(Qualifier_t q
88          case QUALIFIER_NONE:          return "none";          case QUALIFIER_NONE:          return "none";
89          case QUALIFIER_CONST:         return "const";          case QUALIFIER_CONST:         return "const";
90          case QUALIFIER_POLYPHONIC:    return "polyphonic";          case QUALIFIER_POLYPHONIC:    return "polyphonic";
91            case QUALIFIER_PATCH:         return "patch";
92      }      }
93      return "unknown";      return "unknown";
94  }  }
# Line 634  class FunctionCall : virtual public Leaf Line 642  class FunctionCall : virtual public Leaf
642      VMFnResult* result;      VMFnResult* result;
643  public:  public:
644      FunctionCall(const char* function, ArgsRef args, VMFunction* fn);      FunctionCall(const char* function, ArgsRef args, VMFunction* fn);
645        virtual ~FunctionCall();
646      void dump(int level = 0) OVERRIDE;      void dump(int level = 0) OVERRIDE;
647      StmtFlags_t exec() OVERRIDE;      StmtFlags_t exec() OVERRIDE;
648      vmint evalInt() OVERRIDE;      vmint evalInt() OVERRIDE;
# Line 659  public: Line 668  public:
668  };  };
669  typedef Ref<NoFunctionCall,Node> NoFunctionCallRef;  typedef Ref<NoFunctionCall,Node> NoFunctionCallRef;
670    
671  class EventHandler : virtual public Statements, virtual public VMEventHandler {  class Subroutine : public Statements {
672      StatementsRef statements;      StatementsRef statements;
673    public:
674        Subroutine(StatementsRef statements);
675        Statement* statement(uint i) OVERRIDE { return statements->statement(i); }
676        void dump(int level = 0) OVERRIDE;
677    };
678    typedef Ref<Subroutine,Node> SubroutineRef;
679    
680    class UserFunction : public Subroutine {
681    public:
682        UserFunction(StatementsRef statements);
683    };
684    typedef Ref<UserFunction,Node> UserFunctionRef;
685    
686    class EventHandler : public Subroutine, virtual public VMEventHandler {
687      bool usingPolyphonics;      bool usingPolyphonics;
688  public:  public:
689      void dump(int level = 0) OVERRIDE;      void dump(int level = 0) OVERRIDE;
     StmtFlags_t exec();  
690      EventHandler(StatementsRef statements);      EventHandler(StatementsRef statements);
     Statement* statement(uint i) OVERRIDE { return statements->statement(i); }  
691      bool isPolyphonic() const OVERRIDE { return usingPolyphonics; }      bool isPolyphonic() const OVERRIDE { return usingPolyphonics; }
692  };  };
693  typedef Ref<EventHandler,Node> EventHandlerRef;  typedef Ref<EventHandler,Node> EventHandlerRef;
# Line 944  public: Line 965  public:
965    
966      void* scanner;      void* scanner;
967      std::istream* is;      std::istream* is;
968        int nbytes;
969      std::vector<ParserIssue> vErrors;      std::vector<ParserIssue> vErrors;
970      std::vector<ParserIssue> vWarnings;      std::vector<ParserIssue> vWarnings;
971      std::vector<ParserIssue> vIssues;      std::vector<ParserIssue> vIssues;
972      std::vector<CodeBlock>   vPreprocessorComments;      std::vector<CodeBlock>   vPreprocessorComments;
973        std::map<String,PatchVarBlock> patchVars;
974    
975      std::set<String> builtinPreprocessorConditions;      std::set<String> builtinPreprocessorConditions;
976      std::set<String> userPreprocessorConditions;      std::set<String> userPreprocessorConditions;
977    
978      std::map<String,VariableRef> vartable;      std::map<String,VariableRef> vartable;
979      std::map<String,StatementsRef> userFnTable;      std::map<String,UserFunctionRef> userFnTable;
980      vmint globalIntVarCount;      vmint globalIntVarCount;
981      vmint globalRealVarCount;      vmint globalRealVarCount;
982      vmint globalStrVarCount;      vmint globalStrVarCount;
# Line 982  public: Line 1005  public:
1005      ExecContext* execContext;      ExecContext* execContext;
1006    
1007      ParserContext(VMFunctionProvider* parent) :      ParserContext(VMFunctionProvider* parent) :
1008          scanner(NULL), is(NULL),          scanner(NULL), is(NULL), nbytes(0),
1009          globalIntVarCount(0), globalRealVarCount(0), globalStrVarCount(0),          globalIntVarCount(0), globalRealVarCount(0), globalStrVarCount(0),
1010          globalUnitFactorCount(0),          globalUnitFactorCount(0),
1011          polyphonicIntVarCount(0), polyphonicRealVarCount(0),          polyphonicIntVarCount(0), polyphonicRealVarCount(0),
# Line 999  public: Line 1022  public:
1022      RealVariableRef globalRealVar(const String& name);      RealVariableRef globalRealVar(const String& name);
1023      StringVariableRef globalStrVar(const String& name);      StringVariableRef globalStrVar(const String& name);
1024      VariableRef variableByName(const String& name);      VariableRef variableByName(const String& name);
1025      StatementsRef userFunctionByName(const String& name);      UserFunctionRef userFunctionByName(const String& name);
1026      void addErr(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt);      void addErr(int firstLine, int lastLine, int firstColumn, int lastColumn,
1027      void addWrn(int firstLine, int lastLine, int firstColumn, int lastColumn, const char* txt);                  int firstByte, int lengthBytes, const char* txt);
1028      void addPreprocessorComment(int firstLine, int lastLine, int firstColumn, int lastColumn);      void addWrn(int firstLine, int lastLine, int firstColumn, int lastColumn,
1029                    int firstByte, int lengthBytes, const char* txt);
1030        void addPreprocessorComment(int firstLine, int lastLine, int firstColumn,
1031                                    int lastColumn, int firstByte, int lengthBytes);
1032      void createScanner(std::istream* is);      void createScanner(std::istream* is);
1033      void destroyScanner();      void destroyScanner();
1034      bool setPreprocessorCondition(const char* name);      bool setPreprocessorCondition(const char* name);

Legend:
Removed from v.3728  
changed lines
  Added in v.3804

  ViewVC Help
Powered by ViewVC