File: scrap_mac.c

package info (click to toggle)
pygame 1.9.6%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,060 kB
  • sloc: ansic: 59,765; python: 31,220; objc: 334; makefile: 57; cpp: 25
file content (82 lines) | stat: -rw-r--r-- 2,229 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
    pygame - Python Game Library
    Copyright (C) 2006, 2007 Rene Dudfield, Marcus von Appen

    Originally written and put in the public domain by Sam Lantinga.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

static PyObject *
mac_scrap_call(char *name, PyObject *args)
{
    static PyObject *mac_scrap_module = NULL;
    PyObject *method;
    PyObject *result;

    if (!mac_scrap_module)
        mac_scrap_module = PyImport_ImportModule("pygame.sdlmain_osx");
    if (!mac_scrap_module)
        return NULL;

    method = PyObject_GetAttrString(mac_scrap_module, name);
    if (!method)
        return NULL;
    result = PyObject_CallObject(method, args);
    Py_DECREF(method);
    return result;
}

static PyObject *
_scrap_init(PyObject *self, PyObject *args)
{
    return mac_scrap_call("ScrapInit", args);
}

static PyObject *
_scrap_get_scrap(PyObject *self, PyObject *args)
{
    return mac_scrap_call("ScrapGet", args);
}

static PyObject *
_scrap_put_scrap(PyObject *self, PyObject *args)
{
    return mac_scrap_call("ScrapPut", args);
}

static PyObject *
_scrap_lost_scrap(PyObject *self, PyObject *args)
{
    return mac_scrap_call("ScrapLost", args);
}

static PyObject *
_scrap_get_types(PyObject *self, PyObject *args)
{
    return mac_scrap_call("ScrapGetTypes", args);
}

static PyObject *
_scrap_contains(PyObject *self, PyObject *args)
{
    return mac_scrap_call("ScrapContains", args);
}

static PyObject *
_scrap_set_mode(PyObject *self, PyObject *args)
{
    return mac_scrap_call("ScrapSetMode", args);
}