예제 #1
0
static PyObject *
thread_PyThread_allocate_lock(PyObject *self, PyObject *args)
{
	if (!PyArg_NoArgs(args))
		return NULL;
	return (PyObject *) newlockobject();
}
예제 #2
0
파일: sgmlop.c 프로젝트: Jbaumotte/web2py
static PyObject*
element_destroy(ElementObject* self, PyObject* args)
{
    int i;
    PyObject* res;
    
    if (!PyArg_NoArgs(args))
        return NULL;

    /* break the backlink */
    if (self->parent != Py_None) {
        Py_DECREF(self->parent);
        self->parent = Py_None;
        Py_INCREF(self->parent);
    }

    /* destroy element children */
    if (self->children) {
        for (i = 0; i < self->child_count; i++) {
            res = element_destroy((ElementObject*) self->children[i], args);
            Py_DECREF(res);
            Py_DECREF(self->children[i]);
        }
        self->child_count = 0;
    }

    /* leave the rest to the garbage collector... */

    Py_INCREF(Py_None);
    return Py_None;
}
예제 #3
0
static PyObject *
get_line_buffer(PyObject *self, PyObject *args)
{
	if (!PyArg_NoArgs(args))
		return NULL;
	return PyString_FromString(rl_line_buffer);
}
예제 #4
0
static PyObject *
nis_maps (PyObject *self, PyObject *args)
{
	nismaplist *maps;
	PyObject *list;

        if (!PyArg_NoArgs(args))
		return NULL;
	if ((maps = nis_maplist ()) == NULL)
		return NULL;
	if ((list = PyList_New(0)) == NULL)
		return NULL;
	for (maps = maps; maps; maps = maps->next) {
		PyObject *str = PyString_FromString(maps->map);
		if (!str || PyList_Append(list, str) < 0)
		{
			Py_DECREF(list);
			list = NULL;
			break;
		}
		Py_DECREF(str);
	}
	/* XXX Shouldn't we free the list of maps now? */
	return list;
}
예제 #5
0
파일: sgmlop.c 프로젝트: Jbaumotte/web2py
static PyObject*
_sgmlop_xmlparser(PyObject* self, PyObject* args)
{
    if (!PyArg_NoArgs(args))
        return NULL;

    return _sgmlop_new(1);
}
예제 #6
0
static PyObject *
thread_PyThread_exit_thread(PyObject *self, PyObject *args)
{
	if (!PyArg_NoArgs(args))
		return NULL;
	PyErr_SetNone(PyExc_SystemExit);
	return NULL;
}
예제 #7
0
/* get the beginning index for the scope of the tab-completion */
static PyObject *
get_begidx(PyObject *self, PyObject *args)
{
	if(!PyArg_NoArgs(args)) {
		return NULL;
	} 
	Py_INCREF(begidx);
	return begidx;
}
예제 #8
0
파일: sgmlop.c 프로젝트: Jbaumotte/web2py
static PyObject*
_sgmlop_close(FastSGMLParserObject* self, PyObject* args)
{
    /* flush parser buffers */

    if (!PyArg_NoArgs(args))
        return NULL;

    return feed(self, "", 0, 1);
}
예제 #9
0
get the beginning index of the readline tab-completion scope";

/* get the ending index for the scope of the tab-completion */
static PyObject *
get_endidx(PyObject *self, PyObject *args)
{
 	if(!PyArg_NoArgs(args)) {
		return NULL;
	} 
	Py_INCREF(endidx);
	return endidx;
}
예제 #10
0
static PyObject *
thread_get_ident(PyObject *self, PyObject *args)
{
	long ident;
	if (!PyArg_NoArgs(args))
		return NULL;
	ident = PyThread_get_thread_ident();
	if (ident == -1) {
		PyErr_SetString(ThreadError, "no current thread ident");
		return NULL;
	}
	return PyInt_FromLong(ident);
}
예제 #11
0
set the readline word delimiters for tab-completion";


/* get the tab-completion word-delimiters that readline uses */

static PyObject *
get_completer_delims(PyObject *self, PyObject *args)
{
	if(!PyArg_NoArgs(args)) {
		return NULL;
	}
	return PyString_FromString(rl_completer_word_break_characters);
}
예제 #12
0
but it needn't be locked by the same thread that unlocks it.";

static PyObject *
lock_locked_lock(lockobject *self, PyObject *args)
{
	if (!PyArg_NoArgs(args))
		return NULL;

	if (PyThread_acquire_lock(self->lock_lock, 0)) {
		PyThread_release_lock(self->lock_lock);
		return PyInt_FromLong(0L);
	}
	return PyInt_FromLong(1L);
}
예제 #13
0
파일: shmmodule.c 프로젝트: clones/kaa
static PyObject *
PyShmMemory_detach(
    PyShmObj *self,
    PyObject *args)
{
    if (!PyArg_NoArgs(args))
	return NULL;
    if (self->addr != NULL) {
	//refresh_memory_status(self);
	if (shmdt(self->addr) != 0)
	    return PyShm_Err();
	self->addr = NULL;		/* mark as detached */
    }
    Py_INCREF(Py_None);
    return Py_None;
}
예제 #14
0
static PyObject *
lock_PyThread_release_lock(lockobject *self, PyObject *args)
{
	if (!PyArg_NoArgs(args))
		return NULL;

	/* Sanity check: the lock must be locked */
	if (PyThread_acquire_lock(self->lock_lock, 0)) {
		PyThread_release_lock(self->lock_lock);
		PyErr_SetString(ThreadError, "release unlocked lock");
		return NULL;
	}

	PyThread_release_lock(self->lock_lock);
	Py_INCREF(Py_None);
	return Py_None;
}
예제 #15
0
파일: shmmodule.c 프로젝트: clones/kaa
static PyObject *
PyShmSemaphore_Z(
    PyShmSemObj *self,
    PyObject *args)
{
    struct sembuf op[1];
    int res;

    op[0].sem_num = 0;
    op[0].sem_op = 0;
    op[0].sem_flg = self->opflag;

    if (!PyArg_NoArgs(args))
	return NULL;
    refresh_semaphore_status(self);
    res = semop(self->semid, op, (size_t)1);
    if (res == -1)
	return PyShm_Err();
    Py_INCREF(Py_None);
    return Py_None;
}
예제 #16
0
static PyObject *
PyDiaProperties_Keys(PyDiaProperties *self, PyObject *args)
{
  PyObject *list;
  const PropDescription *desc = NULL;

  if (!PyArg_NoArgs(args))
    return NULL;

  list = PyList_New(0);

  if (self->object->ops->describe_props)
    desc = self->object->ops->describe_props(self->object);
  if (desc) {
    int i;
    for (i = 0; desc[i].name; i++) {
      /* at the moment I see no use case to access widgets from Python, PROP_FLAG_LOAD_ONLY compatibility not anted here */
      if ((desc[i].flags & (PROP_FLAG_WIDGET_ONLY|PROP_FLAG_LOAD_ONLY)) == 0)
        PyList_Append(list, PyString_FromString(desc[i].name));
    }
  }

  return list;
}
예제 #17
0
static PyObject *riscos_getcwd(PyObject *self,PyObject *args)
{ if(!PyArg_NoArgs(args)) return NULL;
  return canon("@");
}