summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-03-19 22:42:51 (GMT)
committerGuido van Rossum <guido@python.org>1995-03-19 22:42:51 (GMT)
commit86c3af7d1219bc4d7e69627ce98783031472ce0a (patch)
tree7c41aa415bc87ec222e1ed2620e82b2c1efcfd07 /Mac
parentf23e0fe3beb5ebca676359ca7d19c653dc63a998 (diff)
downloadcpython-86c3af7d1219bc4d7e69627ce98783031472ce0a.zip
cpython-86c3af7d1219bc4d7e69627ce98783031472ce0a.tar.gz
cpython-86c3af7d1219bc4d7e69627ce98783031472ce0a.tar.bz2
moved OpenDeskAcc here
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/menu/Menumodule.c19
-rw-r--r--Mac/Modules/menu/menuedit.py4
-rw-r--r--Mac/Modules/menu/menusupport.py7
3 files changed, 30 insertions, 0 deletions
diff --git a/Mac/Modules/menu/Menumodule.c b/Mac/Modules/menu/Menumodule.c
index a1308f9..84289a3 100644
--- a/Mac/Modules/menu/Menumodule.c
+++ b/Mac/Modules/menu/Menumodule.c
@@ -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}
};
diff --git a/Mac/Modules/menu/menuedit.py b/Mac/Modules/menu/menuedit.py
new file mode 100644
index 0000000..e50dadd
--- /dev/null
+++ b/Mac/Modules/menu/menuedit.py
@@ -0,0 +1,4 @@
+f = Function(void, 'OpenDeskAcc',
+ (Str255, 'name', InMode),
+)
+functions.append(f)
diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py
index c3fb3be..95e52f0 100644
--- a/Mac/Modules/menu/menusupport.py
+++ b/Mac/Modules/menu/menusupport.py
@@ -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)