From: Bertrand <bco...@us...> - 2017-02-25 14:23:23
|
Update of /cvsroot/jsbsim/JSBSim/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24758/tests Modified Files: jsbsim.pxd jsbsim.pyx Log Message: JSBSim now uses SGPath to manage file names. It allows to use absolute paths, to use Unicode file names and to benefit from SimGear maintenance for the corresponding code. Index: jsbsim.pxd =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/tests/jsbsim.pxd,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** jsbsim.pxd 25 Jun 2016 19:55:15 -0000 1.3 --- jsbsim.pxd 25 Feb 2017 14:23:20 -0000 1.4 *************** *** 29,37 **** int GetNumEngines() cdef extern from "initialization/FGInitialCondition.h" namespace "JSBSim": cdef cppclass c_FGInitialCondition "JSBSim::FGInitialCondition": c_FGInitialCondition(c_FGFDMExec* fdm) c_FGInitialCondition(c_FGInitialCondition* ic) ! bool Load(string rstfile, bool useStoredPath) cdef extern from "math/FGMatrix33.h" namespace "JSBSim": --- 29,44 ---- int GetNumEngines() + cdef extern from "simgear/misc/sg_path.hxx": + cdef cppclass c_SGPath "SGPath": + c_SGPath(const string& path, int* validator) + c_SGPath(const c_SGPath& p) + void set(const string& p) + string utf8Str() + cdef extern from "initialization/FGInitialCondition.h" namespace "JSBSim": cdef cppclass c_FGInitialCondition "JSBSim::FGInitialCondition": c_FGInitialCondition(c_FGFDMExec* fdm) c_FGInitialCondition(c_FGInitialCondition* ic) ! bool Load(const c_SGPath& rstfile, bool useStoredPath) cdef extern from "math/FGMatrix33.h" namespace "JSBSim": *************** *** 61,65 **** cdef extern from "FGFDMExec.h" namespace "JSBSim": cdef cppclass c_FGFDMExec "JSBSim::FGFDMExec": ! c_FGFDMExec(int root, int fdmctr) void Unbind() bool Run() except +convertJSBSimToPyExc --- 68,72 ---- cdef extern from "FGFDMExec.h" namespace "JSBSim": cdef cppclass c_FGFDMExec "JSBSim::FGFDMExec": ! c_FGFDMExec(c_FGPropertyManager* root, unsigned int* fdmctr) void Unbind() bool Run() except +convertJSBSimToPyExc *************** *** 67,89 **** bool LoadModel(string model, bool add_model_to_path) ! bool LoadModel(string aircraft_path, ! string engine_path, ! string systems_path, ! string model, bool add_model_to_path) ! bool LoadScript(string script, double delta_t, string initfile) except +convertJSBSimToPyExc ! bool SetEnginePath(string path) ! bool SetAircraftPath(string path) ! bool SetSystemsPath(string path) ! void SetRootDir(string path) ! string GetEnginePath() ! string GetAircraftPath() ! string GetSystemsPath() ! string GetRootDir() ! string GetFullAircraftPath() double GetPropertyValue(string property) void SetPropertyValue(string property, double value) except +convertJSBSimToPyExc string GetModelName() ! bool SetOutputDirectives(string fname) except + #void ForceOutput(int idx=0) void SetLoggingRate(double rate) --- 74,97 ---- bool LoadModel(string model, bool add_model_to_path) ! bool LoadModel(const c_SGPath aircraft_path, ! const c_SGPath engine_path, ! const c_SGPath systems_path, ! const string model, bool add_model_to_path) ! bool LoadScript(const c_SGPath& script, double delta_t, ! const c_SGPath& initfile) except +convertJSBSimToPyExc ! bool SetEnginePath(const c_SGPath& path) ! bool SetAircraftPath(const c_SGPath& path) ! bool SetSystemsPath(const c_SGPath& path) ! void SetRootDir(const c_SGPath& path) ! const c_SGPath& GetEnginePath() ! const c_SGPath& GetAircraftPath() ! const c_SGPath& GetSystemsPath() ! const c_SGPath& GetRootDir() ! const c_SGPath& GetFullAircraftPath() double GetPropertyValue(string property) void SetPropertyValue(string property, double value) except +convertJSBSimToPyExc string GetModelName() ! bool SetOutputDirectives(const c_SGPath& fname) except + #void ForceOutput(int idx=0) void SetLoggingRate(double rate) Index: jsbsim.pyx =================================================================== RCS file: /cvsroot/jsbsim/JSBSim/tests/jsbsim.pyx,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** jsbsim.pyx 16 May 2016 17:25:48 -0000 1.12 --- jsbsim.pyx 25 Feb 2017 14:23:20 -0000 1.13 *************** *** 93,104 **** cdef c_FGFDMExec *thisptr # hold a C++ instance which we're wrapping ! def __cinit__(self, **kwargs): # this hides startup message # os.environ["JSBSIM_DEBUG"]=str(0) ! self.thisptr = new c_FGFDMExec(0,0) if self.thisptr is NULL: raise MemoryError() - - def __init__(self, root_dir=None): if root_dir is None: self.find_root_dir() --- 93,102 ---- cdef c_FGFDMExec *thisptr # hold a C++ instance which we're wrapping ! def __cinit__(self, root_dir=None): # this hides startup message # os.environ["JSBSIM_DEBUG"]=str(0) ! self.thisptr = new c_FGFDMExec(NULL, NULL) if self.thisptr is NULL: raise MemoryError() if root_dir is None: self.find_root_dir() *************** *** 222,227 **** @return true if successful """ ! return self.thisptr.LoadModel(model, aircraft_path, ! engine_path, systems_path, add_model_to_path) def load_script(self, script, delta_t=0.0, initfile=""): --- 220,226 ---- @return true if successful """ ! return self.thisptr.LoadModel(c_SGPath(aircraft_path, NULL), ! c_SGPath(engine_path, NULL), c_SGPath(systems_path, NULL), model, ! add_model_to_path) def load_script(self, script, delta_t=0.0, initfile=""): *************** *** 238,242 **** @return true if successfully loads; false otherwise. */ """ ! return self.thisptr.LoadScript(script, delta_t, initfile) def set_engine_path(self, path): --- 237,242 ---- @return true if successfully loads; false otherwise. */ """ ! return self.thisptr.LoadScript(c_SGPath(script, NULL), delta_t, ! c_SGPath(initfile,NULL)) def set_engine_path(self, path): *************** *** 246,250 **** files are kept, for instance "engine" """ ! return self.thisptr.SetEnginePath(path) def set_aircraft_path(self, path): --- 246,250 ---- files are kept, for instance "engine" """ ! return self.thisptr.SetEnginePath(c_SGPath(path, NULL)) def set_aircraft_path(self, path): *************** *** 255,259 **** modeled aircraft such as C172/, x15/, etc. """ ! return self.thisptr.SetAircraftPath(path) def set_systems_path(self, path): --- 255,259 ---- modeled aircraft such as C172/, x15/, etc. """ ! return self.thisptr.SetAircraftPath(c_SGPath(path, NULL)) def set_systems_path(self, path): *************** *** 263,267 **** files are kept, for instance "systems" """ ! return self.thisptr.SetSystemsPath(path) def set_root_dir(self, path): --- 263,267 ---- files are kept, for instance "systems" """ ! return self.thisptr.SetSystemsPath(c_SGPath(path, NULL)) def set_root_dir(self, path): *************** *** 270,274 **** @param path the string containing the root directory. """ ! self.thisptr.SetRootDir(path) # this is a hack to fix a bug in JSBSim --- 270,274 ---- @param path the string containing the root directory. """ ! self.thisptr.SetRootDir(c_SGPath(path, NULL)) # this is a hack to fix a bug in JSBSim *************** *** 281,285 **** Retrieves the engine path """ ! return self.thisptr.GetEnginePath() def get_aircraft_path(self): --- 281,285 ---- Retrieves the engine path """ ! return self.thisptr.GetEnginePath().utf8Str() def get_aircraft_path(self): *************** *** 287,291 **** Retrieves the aircraft path """ ! return self.thisptr.GetAircraftPath() def get_systems_path(self): --- 287,291 ---- Retrieves the aircraft path """ ! return self.thisptr.GetAircraftPath().utf8Str() def get_systems_path(self): *************** *** 293,297 **** Retrieves the systems path """ ! return self.thisptr.GetSystemsPath() def get_full_aircraft_path(self): --- 293,297 ---- Retrieves the systems path """ ! return self.thisptr.GetSystemsPath().utf8Str() def get_full_aircraft_path(self): *************** *** 299,303 **** Retrieves the full aircraft path name """ ! return self.thisptr.GetFullAircraftPath() def get_root_dir(self): --- 299,303 ---- Retrieves the full aircraft path name """ ! return self.thisptr.GetFullAircraftPath().utf8Str() def get_root_dir(self): *************** *** 306,310 **** @return the string representing the root (base) JSBSim directory. """ ! return self.thisptr.GetRootDir() def get_property_value(self, name): --- 306,310 ---- @return the string representing the root (base) JSBSim directory. """ ! return self.thisptr.GetRootDir().utf8Str() def get_property_value(self, name): *************** *** 347,351 **** @param fname the filename of an output directives file. """ ! return self.thisptr.SetOutputDirectives(fname) #def force_output(self, index): --- 347,351 ---- @param fname the filename of an output directives file. """ ! return self.thisptr.SetOutputDirectives(c_SGPath(fname, NULL)) #def force_output(self, index): *************** *** 553,557 **** def load_ic(self, rstfile, useStoredPath): ! return self.thisptr.GetIC().Load(rstfile, useStoredPath) def get_propagate(self): --- 553,557 ---- def load_ic(self, rstfile, useStoredPath): ! return self.thisptr.GetIC().Load(c_SGPath(rstfile, NULL), useStoredPath) def get_propagate(self): |