Python stuffs
parent
347eb66d21
commit
562c30c703
@ -0,0 +1,27 @@
|
||||
%module dfhack
|
||||
%include "std_string.i"
|
||||
%include "std_vector.i"
|
||||
%include "stdint.i"
|
||||
%{
|
||||
/* Includes the header in the wrapper code */
|
||||
#define LINUX_BUILD
|
||||
#define SWIG_WRAPPER
|
||||
#include "DFTypes.h"
|
||||
#include "DFHackAPI.h"
|
||||
using namespace std;
|
||||
using namespace DFHack;
|
||||
%}
|
||||
|
||||
/* templates have to be instantiated for swig */
|
||||
using namespace std;
|
||||
namespace std
|
||||
{
|
||||
%template(MatglossVector) vector<DFHack::t_matgloss>;
|
||||
%template(PlantMatglossVector) vector<DFHack::t_matglossPlant>;
|
||||
%template(VeinVector) std::vector <DFHack::t_vein>;
|
||||
%template(IceVeinVector) std::vector <DFHack::t_frozenliquidvein>;
|
||||
}
|
||||
|
||||
/* Parse the header file to generate wrappers */
|
||||
%include "DFTypes.h"
|
||||
%include "DFHackAPI.h"
|
@ -0,0 +1,9 @@
|
||||
import dfhack
|
||||
x = dfhack.API("Memory.xml")
|
||||
y = dfhack.MatglossVector()
|
||||
|
||||
if x.Attach():
|
||||
if x.ReadStoneMatgloss(y):
|
||||
print "Dumping all stone"
|
||||
for matgloss in y:
|
||||
print "ID %s, name %s" % (matgloss.id, matgloss.name)
|
Loading…
Reference in New Issue