LMMS
Loading...
Searching...
No Matches
ttldata.h
Go to the documentation of this file.
1#ifndef _TTLDATA_H
2#define _TTLDATA_H
3
4#include <iostream>
5#include <sstream>
6#include <string>
7#include <Python.h>
8
9class TTLLexer: public yyFlexLexer
10{
11public:
12 std::string strctx;
13 PyObject *pylist;
14
15 TTLLexer(std::istream *istr) : yyFlexLexer(istr), pylist(PyList_New(0)) {}
16 void add(const std::string &type, const std::string &value) {
17 PyList_Append(pylist, Py_BuildValue("(ss)", type.c_str(), value.c_str()));
18 // printf("Type %s, Value %s\n", type.c_str(), value.c_str());
19 }
20 void add(const std::string &type, PyObject *value) {
21 PyList_Append(pylist, Py_BuildValue("(sO)", type.c_str(), value));
22 PyObject *str = PyObject_Str(value);
23 // printf("Type %s, Repr Value %s\n", type.c_str(), PyString_AsString(str));
24 Py_DECREF(str);
25 }
26 PyObject *grab() {
27 PyObject *tmp = pylist;
28 pylist = NULL;
29 return tmp;
30 }
32 Py_XDECREF(pylist);
33 }
34};
35
36#define LEXER_DATA (dynamic_cast<TTLLexer *>(this))
37
38#endif
#define NULL
Definition CarlaBridgeFormat.cpp:30
CAdPlugDatabase::CRecord::RecordType type
Definition adplugdb.cpp:93
void add(const std::string &type, PyObject *value)
Definition ttldata.h:20
TTLLexer(std::istream *istr)
Definition ttldata.h:15
std::string strctx
Definition ttldata.h:12
void add(const std::string &type, const std::string &value)
Definition ttldata.h:16
PyObject * pylist
Definition ttldata.h:13
PyObject * grab()
Definition ttldata.h:26
~TTLLexer()
Definition ttldata.h:31
static PuglViewHint int value
Definition pugl.h:1708