PageRenderTime 35ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/python/file.i

#
Swig | 41 lines | 29 code | 5 blank | 7 comment | 0 complexity | d55bce4381cfc915926515c0ae0453d9 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* -----------------------------------------------------------------------------
  2. * file.i
  3. *
  4. * Typemaps for FILE*
  5. * ----------------------------------------------------------------------------- */
  6. %types(FILE *);
  7. /* defining basic methods */
  8. %fragment("SWIG_AsValFilePtr","header") {
  9. SWIGINTERN int
  10. SWIG_AsValFilePtr(PyObject *obj, FILE **val) {
  11. static swig_type_info* desc = 0;
  12. void *vptr = 0;
  13. if (!desc) desc = SWIG_TypeQuery("FILE *");
  14. if ((SWIG_ConvertPtr(obj, &vptr, desc, 0)) == SWIG_OK) {
  15. if (val) *val = (FILE *)vptr;
  16. return SWIG_OK;
  17. }
  18. %#if PY_VERSION_HEX < 0x03000000
  19. if (PyFile_Check(obj)) {
  20. if (val) *val = PyFile_AsFile(obj);
  21. return SWIG_OK;
  22. }
  23. %#endif
  24. return SWIG_TypeError;
  25. }
  26. }
  27. %fragment("SWIG_AsFilePtr","header",fragment="SWIG_AsValFilePtr") {
  28. SWIGINTERNINLINE FILE*
  29. SWIG_AsFilePtr(PyObject *obj) {
  30. FILE *val = 0;
  31. SWIG_AsValFilePtr(obj, &val);
  32. return val;
  33. }
  34. }
  35. /* defining the typemaps */
  36. %typemaps_asval(%checkcode(POINTER), SWIG_AsValFilePtr, "SWIG_AsValFilePtr", FILE*);