moved OpenDeskAcc here

This commit is contained in:
Guido van Rossum 1995-03-19 22:42:51 +00:00
parent f23e0fe3be
commit 86c3af7d12
3 changed files with 30 additions and 0 deletions

View File

@ -32,6 +32,8 @@ extern int CtlObj_Convert(PyObject *, ControlHandle *);
extern PyObject *WinObj_WhichWindow(WindowPtr);
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
#include <Desk.h> /* Defines OpenDeskAcc in old headers */
#include <Menus.h>
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
@ -843,6 +845,21 @@ static PyObject *Menu_DelMCEntries(_self, _args)
return _res;
}
static PyObject *Menu_OpenDeskAcc(_self, _args)
PyObject *_self;
PyObject *_args;
{
PyObject *_res = NULL;
Str255 name;
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetStr255, name))
return NULL;
OpenDeskAcc(name);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyMethodDef Menu_methods[] = {
{"InitMenus", (PyCFunction)Menu_InitMenus, 1,
"() -> None"},
@ -882,6 +899,8 @@ static PyMethodDef Menu_methods[] = {
"() -> (long _rv)"},
{"DelMCEntries", (PyCFunction)Menu_DelMCEntries, 1,
"(short menuID, short menuItem) -> None"},
{"OpenDeskAcc", (PyCFunction)Menu_OpenDeskAcc, 1,
"(Str255 name) -> None"},
{NULL, NULL, 0}
};

View File

@ -0,0 +1,4 @@
f = Function(void, 'OpenDeskAcc',
(Str255, 'name', InMode),
)
functions.append(f)

View File

@ -5,6 +5,9 @@
import string
import addpack
addpack.addpack('D:python:Tools:bgen:bgen')
# Declarations that change for each manager
MACHEADERFILE = 'Menus.h' # The Apple header file
MODNAME = 'Menu' # The name of the module
@ -15,6 +18,7 @@ MODPREFIX = MODNAME # The prefix for module-wide routines
OBJECTTYPE = OBJECTNAME + 'Handle' # The C type used to represent them
OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods
INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
EXTRAFILE = string.lower(MODPREFIX) + 'edit.py' # A similar file but hand-made
OUTPUTFILE = MODNAME + "module.c" # The file generated by this program
from macsupport import *
@ -24,6 +28,8 @@ from macsupport import *
MenuHandle = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
includestuff = includestuff + """
#include <Devices.h> /* Defines OpenDeskAcc in universal headers */
#include <Desk.h> /* Defines OpenDeskAcc in old headers */
#include <%s>""" % MACHEADERFILE + """
#define resNotFound -192 /* Can't include <Errors.h> because of Python's "errors.h" */
@ -45,6 +51,7 @@ Method = OSErrMethodGenerator
functions = []
methods = []
execfile(INPUTFILE)
execfile(EXTRAFILE)
# add the populated lists to the generator groups
for f in functions: module.add(f)