Version: 6.3.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes

ParaMEDMEM.SPythonInterpreter Class Reference

#include <SPythonInterpreter.hxx>

Public Member Functions

 SPythonInterpreter (PyObject *globals, PyObject *locals)
void initialize ()
bool run (const char *str, bool &isSPython)
bool finishSession ()

Static Public Member Functions

static std::string strip (const std::string &s)
static bool isSpythonManipulationNeeded (const std::string &s, std::string &pythonLines)
static bool isCandidateParenthesis (const std::string &s, std::size_t p1, std::size_t &n)

Static Public Attributes

static const int NB_OF_INDENT = 7
static const char * INDENT_TOKEN [] = {"def","class","for","if","while","try","except"}
static const char NUMBERS [] = "0123456789"

Private Member Functions

bool checkIndentCoherency (const std::string &s, std::size_t p)
void checkPythonInterp (PyObject *r)
bool isIndenter (const std::string &s, std::size_t p)
bool isSPythonExpression (const std::string &s)
bool isSPythonExpressionLev1 (const std::string &s, std::string &result)

Private Attributes

std::string _cmd
std::set< int_indent_pos
bool _indent_must_change
PyObject * _glob
PyObject * _loc

Constructor & Destructor Documentation

SPythonInterpreter::SPythonInterpreter ( PyObject *  globals,
PyObject *  locals 
)

Member Function Documentation

void SPythonInterpreter::initialize ( )
bool SPythonInterpreter::run ( const char *  str,
bool &  isSPython 
)
bool SPythonInterpreter::finishSession ( )
bool SPythonInterpreter::checkIndentCoherency ( const std::string &  s,
std::size_t  p 
) [private]
void SPythonInterpreter::checkPythonInterp ( PyObject *  r) [private]
bool SPythonInterpreter::isIndenter ( const std::string &  s,
std::size_t  p 
) [private]

looks that s contains at the begin of non empty char a python keyword that forces indentation of next line.

References ParaMEDMEM.SPythonInterpreter.INDENT_TOKEN, ParaMEDMEM.SPythonInterpreter.NB_OF_INDENT, and TestMedCorba3.s1.

bool SPythonInterpreter::isSPythonExpression ( const std::string &  s) [private]
bool SPythonInterpreter::isSPythonExpressionLev1 ( const std::string &  s,
std::string &  result 
) [private]
std::string SPythonInterpreter::strip ( const std::string &  s) [static]
static bool ParaMEDMEM.SPythonInterpreter.isSpythonManipulationNeeded ( const std::string &  s,
std::string &  pythonLines 
) [static]
bool SPythonInterpreter::isCandidateParenthesis ( const std::string &  s,
std::size_t  p1,
std::size_t &  n 
) [static]

Field Documentation

const char * SPythonInterpreter::INDENT_TOKEN = {"def","class","for","if","while","try","except"} [static]
const char SPythonInterpreter::NUMBERS = "0123456789" [static]
std::string ParaMEDMEM.SPythonInterpreter._cmd [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS