summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-05-15 23:08:47 +0000
committereschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-05-15 23:08:47 +0000
commit8d5161bf33528459447ee1ca02006ec0252db196 (patch)
treee618608535597cfadc56255eec9e099b47bd3921
parent0bad3f039d9734b99f43b36215e1dae482eae9a9 (diff)
Move all of Piraha into cctki_piraha namespace
Change namespace "piraha" to "cctki_piraha", as per Cactus naming standard. Move smart_ptr into this namespace as well. git-svn-id: http://svn.cactuscode.org/flesh/trunk@5012 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r--src/piraha/AutoGrammar.cc2
-rw-r--r--src/piraha/Boundary.cc2
-rw-r--r--src/piraha/Bracket.cc4
-rw-r--r--src/piraha/Call.cc2
-rw-r--r--src/piraha/Dot.cc2
-rw-r--r--src/piraha/End.cc2
-rw-r--r--src/piraha/Generic.cc2
-rw-r--r--src/piraha/Grammar.cc6
-rw-r--r--src/piraha/Group.cc2
-rw-r--r--src/piraha/ILiteral.cc2
-rw-r--r--src/piraha/Literal.cc2
-rw-r--r--src/piraha/Lookup.cc2
-rw-r--r--src/piraha/Matcher.cc2
-rw-r--r--src/piraha/Multi.cc2
-rw-r--r--src/piraha/NegLookAhead.cc2
-rw-r--r--src/piraha/Or.cc2
-rw-r--r--src/piraha/Piraha.hpp2
-rw-r--r--src/piraha/ReParse.cc2
-rw-r--r--src/piraha/Seq.cc2
-rw-r--r--src/piraha/Start.cc2
-rw-r--r--src/piraha/smart_ptr.cc4
-rw-r--r--src/piraha/smart_ptr.hpp8
22 files changed, 35 insertions, 23 deletions
diff --git a/src/piraha/AutoGrammar.cc b/src/piraha/AutoGrammar.cc
index 26789e28..e4ef5eed 100644
--- a/src/piraha/AutoGrammar.cc
+++ b/src/piraha/AutoGrammar.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
smart_ptr<Grammar> AutoGrammar::reparserGenerator() {
smart_ptr<Grammar> g = new Grammar();
diff --git a/src/piraha/Boundary.cc b/src/piraha/Boundary.cc
index 6c34335b..8a25524d 100644
--- a/src/piraha/Boundary.cc
+++ b/src/piraha/Boundary.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
bool is_c_ident(char c) {
return ('a' <= c && c <= 'z')
diff --git a/src/piraha/Bracket.cc b/src/piraha/Bracket.cc
index d16d75da..47c3cc04 100644
--- a/src/piraha/Bracket.cc
+++ b/src/piraha/Bracket.cc
@@ -1,7 +1,7 @@
#include "Piraha.hpp"
#include <string.h>
-using namespace piraha;
+using namespace cctki_piraha;
typedef vector<smart_ptr<Range> >::iterator range_iter;
@@ -95,7 +95,7 @@ bool Bracket::match(Matcher *m) {
}
}
-void piraha::insertc(std::ostream& o,char c) {
+void cctki_piraha::insertc(std::ostream& o,char c) {
if(c == '-') {
o << "\\-";
} else if(c == '\n') {
diff --git a/src/piraha/Call.cc b/src/piraha/Call.cc
index 5c3b5757..9cccb426 100644
--- a/src/piraha/Call.cc
+++ b/src/piraha/Call.cc
@@ -12,7 +12,7 @@
#include <limits>
#include <fstream>
-namespace piraha {
+namespace cctki_piraha {
#define VAR(X) " " #X "=" << X
diff --git a/src/piraha/Dot.cc b/src/piraha/Dot.cc
index 8f1b0396..b06cd319 100644
--- a/src/piraha/Dot.cc
+++ b/src/piraha/Dot.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
bool Dot::match(Matcher *m) {
if(m->pos - m->input_size >= 0)
diff --git a/src/piraha/End.cc b/src/piraha/End.cc
index 2c76dceb..52d85913 100644
--- a/src/piraha/End.cc
+++ b/src/piraha/End.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
bool End::match(Matcher *m) {
return m->pos == (int)m->input_size;
diff --git a/src/piraha/Generic.cc b/src/piraha/Generic.cc
index f60696ee..21012a85 100644
--- a/src/piraha/Generic.cc
+++ b/src/piraha/Generic.cc
@@ -2,7 +2,7 @@
#include <fstream>
#include <stdlib.h>
-using namespace piraha;
+using namespace cctki_piraha;
void read_file(const char *file,std::string& buf) {
std::ifstream in;
diff --git a/src/piraha/Grammar.cc b/src/piraha/Grammar.cc
index 5a516358..66aca571 100644
--- a/src/piraha/Grammar.cc
+++ b/src/piraha/Grammar.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-namespace piraha {
+namespace cctki_piraha {
extern smart_ptr<Pattern> compile(smart_ptr<Group> g,bool ignCase,smart_ptr<Grammar> gram);
@@ -8,7 +8,7 @@ smart_ptr<Grammar> pegGrammar = AutoGrammar::reparserGenerator();
void compile(smart_ptr<Grammar> thisg,std::string name,smart_ptr<Group> g) {
thisg->default_rule = name;
- smart_ptr<Pattern> p = piraha::compile(g,false,thisg);
+ smart_ptr<Pattern> p = cctki_piraha::compile(g,false,thisg);
thisg->patterns.put(name,p);
}
void compile(smart_ptr<Grammar> thisg,std::string name,std::string pattern) {
@@ -16,7 +16,7 @@ void compile(smart_ptr<Grammar> thisg,std::string name,std::string pattern) {
smart_ptr<Matcher> m = new Matcher(pegGrammar,"pattern",pattern.c_str());
smart_ptr<Group> g = m.dup<Group>();
if(m->matches()) {
- smart_ptr<Pattern> p = piraha::compile(g,false,thisg);
+ smart_ptr<Pattern> p = cctki_piraha::compile(g,false,thisg);
thisg->patterns.put(name,p);
} else {
std::cout << "Could not compile(" << name << "," << pattern << ")" << std::endl;
diff --git a/src/piraha/Group.cc b/src/piraha/Group.cc
index 95079800..11e1ac61 100644
--- a/src/piraha/Group.cc
+++ b/src/piraha/Group.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
void Group::dump(std::ostream& o) {
dump(-1,o,0);
diff --git a/src/piraha/ILiteral.cc b/src/piraha/ILiteral.cc
index a01c48fd..b7816145 100644
--- a/src/piraha/ILiteral.cc
+++ b/src/piraha/ILiteral.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
ILiteral::ILiteral(char b) : lc(lc_(b)), uc(uc_(b)) {}
diff --git a/src/piraha/Literal.cc b/src/piraha/Literal.cc
index 62678266..a8022ff8 100644
--- a/src/piraha/Literal.cc
+++ b/src/piraha/Literal.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
bool Literal::match(Matcher *m) {
if(m->pos - m->input_size >= 0) {
diff --git a/src/piraha/Lookup.cc b/src/piraha/Lookup.cc
index 3b442864..a1cc457c 100644
--- a/src/piraha/Lookup.cc
+++ b/src/piraha/Lookup.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
Lookup::Lookup(std::string name_,smart_ptr<Grammar> g) : gram(g), name(name_), capture(true) {
if(name[0] == '-') {
diff --git a/src/piraha/Matcher.cc b/src/piraha/Matcher.cc
index dd189042..9a37a06b 100644
--- a/src/piraha/Matcher.cc
+++ b/src/piraha/Matcher.cc
@@ -1,7 +1,7 @@
#include <string.h>
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
Matcher::Matcher(smart_ptr<Grammar> g_,const char *pat_,const char *input_,int input_size_) :
Group(pat_,input_),
diff --git a/src/piraha/Multi.cc b/src/piraha/Multi.cc
index ff03f7d9..ae795645 100644
--- a/src/piraha/Multi.cc
+++ b/src/piraha/Multi.cc
@@ -1,7 +1,7 @@
#include <iostream>
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
bool Multi::match(Matcher *m) {
vector<smart_ptr<Group> > chSave;
diff --git a/src/piraha/NegLookAhead.cc b/src/piraha/NegLookAhead.cc
index a70e5539..43385ee9 100644
--- a/src/piraha/NegLookAhead.cc
+++ b/src/piraha/NegLookAhead.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
bool NegLookAhead::match(Matcher *m) {
int pos = m->pos;
diff --git a/src/piraha/Or.cc b/src/piraha/Or.cc
index c5caec00..d9633e3e 100644
--- a/src/piraha/Or.cc
+++ b/src/piraha/Or.cc
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
Or::Or(Pattern *p,...) : patterns() {
va_list ap;
diff --git a/src/piraha/Piraha.hpp b/src/piraha/Piraha.hpp
index b8af3b7a..004a3ba0 100644
--- a/src/piraha/Piraha.hpp
+++ b/src/piraha/Piraha.hpp
@@ -7,7 +7,7 @@
#include <iostream>
#include <smart_ptr.hpp>
-namespace piraha {
+namespace cctki_piraha {
const int max_int = 10000;
diff --git a/src/piraha/ReParse.cc b/src/piraha/ReParse.cc
index 295b0b29..60b83db5 100644
--- a/src/piraha/ReParse.cc
+++ b/src/piraha/ReParse.cc
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <string.h>
-namespace piraha {
+namespace cctki_piraha {
char getChar(smart_ptr<Group> gr) {
if(gr->groupCount()==1) {
diff --git a/src/piraha/Seq.cc b/src/piraha/Seq.cc
index c0b697bc..80be5ace 100644
--- a/src/piraha/Seq.cc
+++ b/src/piraha/Seq.cc
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
Seq::Seq(Pattern *p,...) {
va_list ap;
diff --git a/src/piraha/Start.cc b/src/piraha/Start.cc
index 52e3cf40..bcb72ef9 100644
--- a/src/piraha/Start.cc
+++ b/src/piraha/Start.cc
@@ -1,6 +1,6 @@
#include "Piraha.hpp"
-using namespace piraha;
+using namespace cctki_piraha;
bool Start::match(Matcher *m) {
return m->pos == 0;
diff --git a/src/piraha/smart_ptr.cc b/src/piraha/smart_ptr.cc
index b2e5a826..112e0f62 100644
--- a/src/piraha/smart_ptr.cc
+++ b/src/piraha/smart_ptr.cc
@@ -1,3 +1,7 @@
#include "smart_ptr.hpp"
+namespace cctki_piraha {
+
std::set<void*> *ptrs = new std::set<void*>();
+
+}
diff --git a/src/piraha/smart_ptr.hpp b/src/piraha/smart_ptr.hpp
index 58555562..b8784b55 100644
--- a/src/piraha/smart_ptr.hpp
+++ b/src/piraha/smart_ptr.hpp
@@ -8,6 +8,8 @@
#define NULL ((void*)0)
#endif
+namespace cctki_piraha {
+
extern std::set<void*> *ptrs;
// TODO: This code is disabled because it leads to segfaults during
@@ -19,11 +21,15 @@ extern std::set<void*> *ptrs;
inline void add(std::set<void*>& v,void *t) {
if(t == NULL)
return;
+ // TODO: Don't separate finding and inserting; do it in one go to
+ // save a lookup.
assert(v.find(t) == v.end());
v.insert(t);
}
inline void remove(std::set<void*>& v,void* t) {
+ // TODO: Don't separate finding and erasing; do it in one go
+ // to save a lookup.
std::set<void*>::iterator it = v.find(t);
assert(it != v.end());
v.erase(it);
@@ -163,4 +169,6 @@ class smart_ptr {
template<typename C>
friend class smart_ptr;
};
+
+}
#endif