-
Notifications
You must be signed in to change notification settings - Fork 9
/
misc.h
58 lines (51 loc) · 1.4 KB
/
misc.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef __MISC_H__
#define __MISC_H__
#include <map>
#include <string>
#include <vector>
//#include <boost/bimap.hpp>
#include "strings.h"
//#include <boost/interprocess/containers/list.hpp>
//#include <boost/interprocess/containers/map.hpp>
#include "rdf.h"
#ifdef with_marpa
#define MARPA(x) x
#else
#define MARPA(x)
#endif
typedef i64 resid;
extern std::list<string>& proc;
class bidict {
std::map<resid, node> ip;
std::map<node, resid> pi;
public:
void init();
resid set ( node v );
resid set ( pnode v ) { return set (*v); }
void set ( const std::vector<node>& v );
node operator[] ( resid);
node operator[] ( u64 ) { throw std::runtime_error("called dict[] with wrong type"); }
resid operator[] ( node );
resid operator[] ( pnode v ) { return v ? (*this)[*v] : 0; }
bool has ( resid k ) const;
bool has ( node v ) const;
string tostr();
std::map<string, pnode> nodes;
};
extern bidict& dict;
extern resid file_contents_iri, marpa_parser_iri, marpa_parse_iri, logequalTo, lognotEqualTo, rdffirst, rdfrest, A, Dot, rdfsType, GND, rdfssubClassOf, False, rdfnil, rdfsResource, rdfsdomain;
//extern resid rdfList, _dlopen, _dlclose, _dlsym, _dlerror, _invoke;
string dstr ( resid p, bool json = false );
string indent();
struct _setproc {
string prev;
_setproc(const string& p);
~_setproc();
};
#ifdef DEBUG
#define setproc(x) _setproc __setproc(x)
#else
#define setproc(x)
#endif
extern int _indent;
#endif