rpmfts-py.c File Reference
PYTHON-C Language Bindings.
`#include "system.h"`
`#include "structmember.h"`
`#include <fts.h>`
`#include "rpmfts-py.h"`
`#include <rpmiotypes.h>`
`#include "debug.h"`
Include dependency graph for rpmfts-py.c:

Go to the source code of this file.

## Macros

#define | infoBit(_ix) (1 << (((unsigned)(_ix)) & 0x1f))
#define | RPMFTS_CLOSE 0
#define | RPMFTS_OPEN 1
#define | RPMFTS_OPEN_LAZY 2
#define | CONSTANT(_v) PyDict_SetItemString(s->md_dict, #_v, o=PyInt_FromLong(_v)); Py_DECREF(o)

## Functions

static const char * | ftsInfoStr (int fts_info)
static void | rpmfts_debug (const char *msg, rpmftsObject *s)
static int | rpmfts_initialize (rpmftsObject *s, const char *root, int options, int ignore)
static int | rpmfts_state (rpmftsObject *s, int nactive)
static PyObject * | rpmfts_step (rpmftsObject *s)
static PyObject * | rpmfts_getattro (PyObject *o, PyObject *n)
static int | rpmfts_setattro (PyObject *o, PyObject *n, PyObject *v)
static PyObject * | rpmfts_iter (rpmftsObject *s)
static PyObject * | rpmfts_iternext (rpmftsObject *s)
static void | rpmfts_free (PyObject *s)
static PyObject * | rpmfts_alloc (PyTypeObject *type, Py_ssize_t nitems)
static void | rpmfts_dealloc (rpmftsObject *s)
static int | rpmfts_init (rpmftsObject *s, PyObject *args, PyObject *kwds)
static PyObject * | rpmfts_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
static int | rpmfts_traverse (rpmftsObject *s, visitproc visit, void *arg)
static int | rpmfts_print (rpmftsObject *s, FILE *fp, int flags)
Class: Rpmfts
static PyObject * | rpmfts_Debug (rpmftsObject *s, PyObject *args, PyObject *kwds)
static PyObject * | rpmfts_Open (rpmftsObject *s, PyObject *args, PyObject *kwds)
static PyObject * | rpmfts_Read (rpmftsObject *s)
static PyObject * | rpmfts_Children (rpmftsObject *s, PyObject *args, PyObject *kwds)
static PyObject * | rpmfts_Close (rpmftsObject *s)
static PyObject * | rpmfts_Set (rpmftsObject *s, PyObject *args, PyObject *kwds)

## Variables

static int | _rpmfts_debug = 1
static const char * | ftsInfoStrings []
static struct PyMethodDef | rpmfts_methods []
static PyMemberDef | rpmfts_members []
static char | rpmfts_doc []
PyTypeObject | rpmfts_Type

## Macro Definition Documentation

#define CONSTANT | ( |  | _v | ) | PyDict_SetItemString(s->md_dict, #_v, o=PyInt_FromLong(_v)); Py_DECREF(o)

Referenced by rpmfts_new().

#define infoBit | ( |  | _ix | ) | (1 << (((unsigned)(_ix)) & 0x1f))

Definition at line 25 of file rpmfts-py.c.

Referenced by rpmfts_initialize(), and rpmfts_step().

#define RPMFTS_CLOSE 0

Definition at line 54 of file rpmfts-py.c.

Referenced by rpmfts_Close(), rpmfts_dealloc(), rpmfts_initialize(), rpmfts_iternext(), rpmfts_state(), and rpmfts_step().

#define RPMFTS_OPEN 1

Definition at line 55 of file rpmfts-py.c.

Referenced by rpmfts_Open(), and rpmfts_state().

#define RPMFTS_OPEN_LAZY 2

Definition at line 56 of file rpmfts-py.c.

Referenced by rpmfts_iternext(), rpmfts_state(), and rpmfts_step().

## Function Documentation

static const char* ftsInfoStr | ( | int | fts_info | ) |

static

Definition at line 46 of file rpmfts-py.c.

References ftsInfoStrings.

Referenced by rpmfts_print().

static PyObject* rpmfts_alloc | ( | PyTypeObject * | type,
|  | Py_ssize_t | nitems
| ) |  |

static

Definition at line 373 of file rpmfts-py.c.

static PyObject* rpmfts_Children | ( | rpmftsObject * | s,
|  | PyObject * | args,
|  | PyObject * | kwds
| ) |  |

static

Definition at line 240 of file rpmfts-py.c.

References rpmftsObject_s::fts, Fts_children(), rpmftsObject_s::ftsp, and rpmfts_debug().

static PyObject* rpmfts_Close | ( | rpmftsObject * | s | ) |

static

Definition at line 264 of file rpmfts-py.c.

References RPMFTS_CLOSE, rpmfts_debug(), and rpmfts_state().

static void rpmfts_dealloc | ( | rpmftsObject * | s | ) |

static

Definition at line 379 of file rpmfts-py.c.

References _free(), rpmftsObject_s::callbacks, rpmftsObject_s::md_dict, rpmftsObject_s::roots, RPMFTS_CLOSE, rpmfts_debug(), and rpmfts_state().

static void rpmfts_debug | ( | const char * | msg,
|  | rpmftsObject * | s
| ) |  |

static

Definition at line 59 of file rpmfts-py.c.

References _rpmfts_debug, rpmftsObject_s::active, rpmftsObject_s::fts, and rpmftsObject_s::ftsp.

Referenced by rpmfts_Children(), rpmfts_Close(), rpmfts_dealloc(), rpmfts_getattro(), rpmfts_init(), rpmfts_new(), rpmfts_Open(), rpmfts_Read(), rpmfts_Set(), rpmfts_setattro(), rpmfts_state(), and rpmfts_step().

static PyObject* rpmfts_Debug | ( | rpmftsObject * | s,
|  | PyObject * | args,
|  | PyObject * | kwds
| ) |  |

static

Definition at line 180 of file rpmfts-py.c.

References _rpmfts_debug.

static void rpmfts_free | ( | PyObject * | s | ) |

static

Definition at line 367 of file rpmfts-py.c.

static PyObject* rpmfts_getattro | ( | PyObject * | o,
|  | PyObject * | n
| ) |  |

static

Definition at line 328 of file rpmfts-py.c.

References rpmfts_debug().

static int rpmfts_init | ( | rpmftsObject * | s,
|  | PyObject * | args,
|  | PyObject * | kwds
| ) |  |

static

Definition at line 401 of file rpmfts-py.c.

References rpmfts_debug(), and rpmfts_initialize().

static int rpmfts_initialize | ( | rpmftsObject * | s,
|  | const char * | root,
|  | int | options,
|  | int | ignore
| ) |  |

static

Definition at line 70 of file rpmfts-py.c.

References _free(), rpmftsObject_s::active, rpmftsObject_s::compare, rpmftsObject_s::fts, FTS_COMFOLLOW, FTS_DP, FTS_LOGICAL, FTS_NOSTAT, rpmftsObject_s::ftsp, rpmftsObject_s::ignore, infoBit, rpmftsObject_s::options, rpmftsObject_s::roots, RPMFTS_CLOSE, and stpcpy().

Referenced by rpmfts_init(), and rpmfts_Open().

static PyObject* rpmfts_iter | ( | rpmftsObject * | s | ) |

static

Definition at line 345 of file rpmfts-py.c.

static PyObject* rpmfts_iternext | ( | rpmftsObject * | s | ) |

static

Definition at line 354 of file rpmfts-py.c.

References rpmftsObject_s::active, RPMFTS_CLOSE, RPMFTS_OPEN_LAZY, rpmfts_state(), and rpmfts_step().

static PyObject* rpmfts_new | ( | PyTypeObject * | type,
|  | PyObject * | args,
|  | PyObject * | kwds
| ) |  |

static

Definition at line 418 of file rpmfts-py.c.

References rpmftsObject_s::callbacks, rpmftsObject_s::compare, CONSTANT, rpmftsObject_s::fts, FTS_AGAIN, FTS_COMFOLLOW, FTS_D, FTS_DC, FTS_DEFAULT, FTS_DNR, FTS_DONTCHDIR, FTS_DOT, FTS_DP, FTS_ERR, FTS_F, FTS_FOLLOW, FTS_LOGICAL, FTS_NAMEONLY, FTS_NOCHDIR, FTS_NOINSTR, FTS_NOSTAT, FTS_NS, FTS_NSOK, FTS_OPTIONMASK, FTS_PHYSICAL, FTS_ROOTLEVEL, FTS_ROOTPARENTLEVEL, FTS_SEEDOT, FTS_SKIP, FTS_SL, FTS_SLNONE, FTS_STOP, FTS_SYMFOLLOW, FTS_W, FTS_WHITEOUT, FTS_XDEV, rpmftsObject_s::ftsp, rpmftsObject_s::md_dict, name, rpmftsObject_s::roots, and rpmfts_debug().

static PyObject* rpmfts_Open | ( | rpmftsObject * | s,
|  | PyObject * | args,
|  | PyObject * | kwds
| ) |  |

static

Definition at line 197 of file rpmfts-py.c.

References rpmfts_debug(), rpmfts_initialize(), RPMFTS_OPEN, and rpmfts_state().

static int rpmfts_print | ( | rpmftsObject * | s,
|  | FILE * | fp,
|  | int | flags
| ) |  |

static

Definition at line 519 of file rpmfts-py.c.

References rpmftsObject_s::fts, _ftsent::fts_info, _ftsent::fts_level, _ftsent::fts_name, ftsInfoStr(), rpmftsObject_s::ftsp, and indent.

static PyObject* rpmfts_Read | ( | rpmftsObject * | s | ) |

static

Definition at line 220 of file rpmfts-py.c.

References rpmfts_debug(), and rpmfts_step().

static PyObject* rpmfts_Set | ( | rpmftsObject * | s,
|  | PyObject * | args,
|  | PyObject * | kwds
| ) |  |

static

Definition at line 275 of file rpmfts-py.c.

References rpmftsObject_s::fts, Fts_set(), rpmftsObject_s::ftsp, and rpmfts_debug().

static int rpmfts_setattro | ( | PyObject * | o,
|  | PyObject * | n,
|  | PyObject * | v
| ) |  |

static

Definition at line 335 of file rpmfts-py.c.

References rpmfts_debug().

static int rpmfts_state | ( | rpmftsObject * | s,
|  | int | nactive
| ) |  |

static

Definition at line 107 of file rpmfts-py.c.

References rpmftsObject_s::active, rpmftsObject_s::compare, rpmftsObject_s::fts, Fts_close(), Fts_open(), rpmftsObject_s::ftsp, rpmftsObject_s::options, rpmftsObject_s::roots, RPMFTS_CLOSE, rpmfts_debug(), RPMFTS_OPEN, and RPMFTS_OPEN_LAZY.

Referenced by rpmfts_Close(), rpmfts_dealloc(), rpmfts_iternext(), rpmfts_Open(), and rpmfts_step().

static PyObject* rpmfts_step | ( | rpmftsObject * | s | ) |

static

Definition at line 138 of file rpmfts-py.c.

References rpmftsObject_s::active, rpmftsObject_s::fts, _ftsent::fts_info, Fts_read(), rpmftsObject_s::ftsp, rpmftsObject_s::ignore, infoBit, RPMFTS_CLOSE, rpmfts_debug(), RPMFTS_OPEN_LAZY, and rpmfts_state().

Referenced by rpmfts_iternext(), and rpmfts_Read().

static int rpmfts_traverse | ( | rpmftsObject * | s,
|  | visitproc | visit,
|  | void * | arg
| ) |  |

static

Definition at line 509 of file rpmfts-py.c.

References rpmftsObject_s::callbacks, and rpmftsObject_s::md_dict.

## Variable Documentation

int _rpmfts_debug = 1

static

Definition at line 23 of file rpmfts-py.c.

Referenced by rpmfts_debug(), and rpmfts_Debug().

const char* ftsInfoStrings[]

static

Initial value:
= {
"UNKNOWN",
"D",
"DC",
"DEFAULT",
"DNR",
"DOT",
"DP",
"ERR",
"F",
"INIT",
"NS",
"NSOK",
"SL",
"SLNONE",
"W",
}

Definition at line 27 of file rpmfts-py.c.

Referenced by ftsInfoStr().

char rpmfts_doc[]

static

Initial value:
=
""

Definition at line 537 of file rpmfts-py.c.

PyMemberDef rpmfts_members[]

static

Initial value:
= {
{"__dict__",T_OBJECT,offsetof(rpmftsObject, md_dict), READONLY,
NULL},
{"callbacks",T_OBJECT,offsetof(rpmftsObject, callbacks), 0,
"Callback dictionary per fts_info state: FTS_{D|DC|DEFAULT|DNR|DOT|DP|ERR|F|INIT|NS|NSOK|SL|SLNONE|W}"},
{"options", T_INT, offsetof(rpmftsObject, options), 0,
"Option bit(s): FTS_{COMFOLLOW|LOGICAL|NOCHDIR|NOSTAT|PHYSICAL|SEEDOT|XDEV}"},
{"ignore", T_INT, offsetof(rpmftsObject, ignore), 0,
"Ignore bit(s): (1 << info) with info one of FTS_{D|DC|DEFAULT|DNR|DOT|DP|ERR|F|INIT|NS|NSOK|SL|SLNONE|W}"},
{NULL, 0, 0, 0, NULL}
}

Definition at line 316 of file rpmfts-py.c.