Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
53218ff7
Commit
53218ff7
authored
Nov 11, 2010
by
Roberto Raggi
Browse files
Introduced a simple memory pool.
parent
06df2e2d
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
src/libs/glsl/glsl-lib.pri
View file @
53218ff7
HEADERS += $$PWD/glsl.h $$PWD/glsllexer.h $$PWD/glslparser.h $$PWD/glslparsertable_p.h $$PWD/glslast.h \
$$PWD/glslastvisitor.h $$PWD/glslengine.h
$$PWD/glslastvisitor.h $$PWD/glslengine.h
$$PWD/glslmemorypool.h
SOURCES += $$PWD/glslkeywords.cpp $$PWD/glslparser.cpp $$PWD/glslparsertable.cpp \
$$PWD/glsllexer.cpp $$PWD/glslast.cpp \
$$PWD/glslastvisitor.cpp $$PWD/glslengine.cpp
$$PWD/glslastvisitor.cpp $$PWD/glslengine.cpp
$$PWD/glslmemorypool.cpp
OTHER_FILES = $$PWD/glsl.g \
$$PWD/specs/grammar.txt
src/libs/glsl/glsl.g
View file @
53218ff7
...
...
@@ -277,6 +277,7 @@ private:
void reduce(int ruleno);
private:
Engine *_engine;
int _tos;
int _index;
std::vector<int> _stateStack;
...
...
@@ -319,6 +320,7 @@ private:
**************************************************************************/
#include "glslparser.h"
#include "glslengine.h"
#include <iostream>
#include <cstdio>
#include <cassert>
...
...
@@ -326,7 +328,7 @@ private:
using namespace GLSL;
Parser::Parser(Engine *engine, const char *source, unsigned size, int variant)
: _tos(-1), _index(0)
:
_engine(engine),
_tos(-1), _index(0)
{
_tokens.reserve(1024);
...
...
@@ -2602,14 +2604,14 @@ case $rule_number: {
external_declaration_list ::= external_declaration ;
/.
case $rule_number: {
sym(1).declaration_list = new List<Declaration *>(sym(1).declaration);
sym(1).declaration_list = new
(_engine->pool())
List<Declaration *>(sym(1).declaration);
} break;
./
external_declaration_list ::= external_declaration_list external_declaration ;
/.
case $rule_number: {
sym(1).declaration_list = new List<Declaration *>(sym(1).declaration_list, sym(2).declaration);
sym(1).declaration_list = new
(_engine->pool())
List<Declaration *>(sym(1).declaration_list, sym(2).declaration);
} break;
./
...
...
src/libs/glsl/glsl.h
View file @
53218ff7
...
...
@@ -46,6 +46,7 @@ namespace GLSL {
class
Engine
;
class
Lexer
;
class
Parser
;
class
MemoryPool
;
class
AST
;
template
<
typename
T
>
class
List
;
}
...
...
src/libs/glsl/glslast.h
View file @
53218ff7
...
...
@@ -30,6 +30,7 @@
#define GLSLAST_H
#include "glsl.h"
#include "glslmemorypool.h"
#include <vector>
#include <string>
...
...
@@ -66,7 +67,7 @@ class StructType;
class
Visitor
;
template
<
typename
T
>
class
GLSL_EXPORT
List
class
GLSL_EXPORT
List
:
public
Managed
{
public:
List
(
const
T
&
value
)
...
...
@@ -90,7 +91,7 @@ public:
List
*
next
;
};
class
GLSL_EXPORT
AST
class
GLSL_EXPORT
AST
// : public Managed
{
public:
enum
Kind
{
...
...
src/libs/glsl/glslengine.cpp
View file @
53218ff7
...
...
@@ -19,3 +19,8 @@ const std::string *Engine::identifier(const char *s, int n)
{
return
&*
_identifiers
.
insert
(
std
::
string
(
s
,
n
)).
first
;
}
MemoryPool
*
Engine
::
pool
()
{
return
&
_pool
;
}
src/libs/glsl/glslengine.h
View file @
53218ff7
...
...
@@ -2,6 +2,7 @@
#define GLSLENGINE_H
#include "glsl.h"
#include "glslmemorypool.h"
#include <set>
#include <string>
...
...
@@ -16,8 +17,11 @@ public:
const
std
::
string
*
identifier
(
const
std
::
string
&
s
);
const
std
::
string
*
identifier
(
const
char
*
s
,
int
n
);
MemoryPool
*
pool
();
private:
std
::
set
<
std
::
string
>
_identifiers
;
MemoryPool
_pool
;
};
}
// namespace GLSL
...
...
src/libs/glsl/glslparser.cpp
View file @
53218ff7
This diff is collapsed.
Click to expand it.
src/libs/glsl/glslparser.h
View file @
53218ff7
...
...
@@ -68,6 +68,7 @@ private:
void
reduce
(
int
ruleno
);
private:
Engine
*
_engine
;
int
_tos
;
int
_index
;
std
::
vector
<
int
>
_stateStack
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment