Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
227a4232
Commit
227a4232
authored
Mar 10, 1995
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the usual
parent
fc8a01fc
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
83 additions
and
27 deletions
+83
-27
Mac/Lib/test/echo.py
Mac/Lib/test/echo.py
+40
-8
Mac/Lib/toolbox/AppleEvents.py
Mac/Lib/toolbox/AppleEvents.py
+1
-0
Mac/Lib/toolbox/Controls.py
Mac/Lib/toolbox/Controls.py
+1
-0
Mac/Lib/toolbox/Dialogs.py
Mac/Lib/toolbox/Dialogs.py
+1
-0
Mac/Lib/toolbox/Events.py
Mac/Lib/toolbox/Events.py
+1
-0
Mac/Lib/toolbox/Resources.py
Mac/Lib/toolbox/Resources.py
+1
-0
Mac/Lib/toolbox/Sound.py
Mac/Lib/toolbox/Sound.py
+1
-0
Mac/Lib/toolbox/Windows.py
Mac/Lib/toolbox/Windows.py
+1
-0
Mac/Modules/ae/aegen.py
Mac/Modules/ae/aegen.py
+1
-0
Mac/Modules/ctl/ctlgen.py
Mac/Modules/ctl/ctlgen.py
+1
-0
Mac/Modules/evt/evtgen.py
Mac/Modules/evt/evtgen.py
+0
-3
Mac/Modules/menu/Menumodule.c
Mac/Modules/menu/Menumodule.c
+1
-1
Mac/Modules/menu/menugen.py
Mac/Modules/menu/menugen.py
+1
-0
Mac/Modules/res/Resmodule.c
Mac/Modules/res/Resmodule.c
+1
-1
Mac/Modules/res/resgen.py
Mac/Modules/res/resgen.py
+1
-0
Mac/Modules/res/resscan.py
Mac/Modules/res/resscan.py
+3
-0
Mac/Modules/snd/sndgen.py
Mac/Modules/snd/sndgen.py
+1
-0
Tools/bgen/bgen/bgenBuffer.py
Tools/bgen/bgen/bgenBuffer.py
+17
-7
Tools/bgen/bgen/bgenHeapBuffer.py
Tools/bgen/bgen/bgenHeapBuffer.py
+7
-5
Tools/bgen/bgen/bgenStackBuffer.py
Tools/bgen/bgen/bgenStackBuffer.py
+2
-2
No files found.
Mac/Lib/test/echo.py
View file @
227a4232
...
...
@@ -11,6 +11,8 @@ addpack.addpack('Demo')
addpack
.
addpack
(
'bgen'
)
addpack
.
addpack
(
'ae'
)
addpack
.
addpack
(
'evt'
)
#addpack.addpack('menu')
addpack
.
addpack
(
'win'
)
import
sys
sys
.
stdout
=
sys
.
stderr
...
...
@@ -20,18 +22,25 @@ import AE
from
AppleEvents
import
*
import
Evt
from
Events
import
*
import
Menu
import
Dlg
import
Win
from
Windows
import
*
import
Qd
import
aetools
import
EasyDialogs
kHighLevelEvent
=
23
# Not defined anywhere for Python yet?
def
main
():
echo
=
EchoServer
()
MacOS
.
EnableAppswitch
(
0
)
# Disable Python's own "event handling"
yield
=
MacOS
.
EnableAppswitch
(
-
1
)
# Disable Python's own "event handling"
try
:
echo
.
mainloop
()
echo
.
mainloop
(
everyEvent
,
0
)
finally
:
MacOS
.
EnableAppswitch
(
1
)
# Let Python have a go at events
MacOS
.
EnableAppswitch
(
yield
)
# Let Python have a go at events
echo
.
close
()
...
...
@@ -44,6 +53,13 @@ class EchoServer:
for
suite
in
self
.
suites
:
AE
.
AEInstallEventHandler
(
suite
,
typeWildCard
,
self
.
aehandler
)
self
.
active
=
1
self
.
appleid
=
1
Menu
.
ClearMenuBar
()
self
.
applemenu
=
applemenu
=
Menu
.
NewMenu
(
self
.
appleid
,
"
\
024
"
)
applemenu
.
AppendMenu
(
"All about echo...;(-"
)
applemenu
.
AddResMenu
(
'DRVR'
)
applemenu
.
InsertMenu
(
0
)
Menu
.
DrawMenuBar
()
def
__del__
(
self
):
self
.
close
()
...
...
@@ -64,22 +80,38 @@ class EchoServer:
self
.
lowlevelhandler
(
event
)
def
lowlevelhandler
(
self
,
event
):
what
,
message
,
when
,
(
h
,
v
),
modifiers
=
event
what
,
message
,
when
,
where
,
modifiers
=
event
h
,
v
=
where
if
what
==
kHighLevelEvent
:
print
"High Level Event:"
,
`code(message)`
,
`code(h | (v<<16))`
msg
=
"High Level Event: %s %s"
%
\
(
`code(message)`
,
`code(h | (v<<16))`
)
try
:
AE
.
AEProcessAppleEvent
(
event
)
except
AE
.
Error
,
msg
:
print
"AEProcessAppleEvent error:"
except
AE
.
Error
,
err
:
EasyDialogs
.
Message
(
msg
+
"
\
015
AEProcessAppleEvent error: %s"
%
str
(
err
))
traceback
.
print_exc
()
else
:
EasyDialogs
.
Message
(
msg
+
"
\
015
OK!"
)
elif
what
==
keyDown
:
c
=
chr
(
message
&
charCodeMask
)
if
c
==
'.'
and
modifiers
&
cmdKey
:
raise
KeyboardInterrupt
,
"Command-period"
MacOS
.
HandleEvent
(
event
)
elif
what
==
mouseDown
:
partcode
,
window
=
Win
.
FindWindow
(
where
)
if
partcode
==
inMenuBar
:
result
=
Menu
.
MenuSelect
(
where
)
id
=
(
result
>>
16
)
&
0xffff
# Hi word
item
=
result
&
0xffff
# Lo word
if
id
==
self
.
appleid
:
if
item
==
1
:
EasyDialogs
.
Message
(
"Echo -- echo AppleEvents"
)
elif
item
>
1
:
name
=
self
.
applemenu
.
GetItem
(
item
)
Qd
.
OpenDeskAcc
(
name
)
elif
what
<>
autoKey
:
print
"Event:"
,
(
eventname
(
what
),
message
,
when
,
(
h
,
v
),
modifiers
)
MacOS
.
HandleEvent
(
event
)
##
MacOS.HandleEvent(event)
def
aehandler
(
self
,
request
,
reply
):
print
"Apple Event"
,
...
...
Mac/Lib/toolbox/AppleEvents.py
View file @
227a4232
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:AppleEvents.h'
typeBoolean
=
'bool'
typeChar
=
'TEXT'
typeSMInt
=
'shor'
...
...
Mac/Lib/toolbox/Controls.py
View file @
227a4232
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Controls.h'
pushButProc
=
0
checkBoxProc
=
1
radioButProc
=
2
...
...
Mac/Lib/toolbox/Dialogs.py
View file @
227a4232
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Dialogs.h'
ctrlItem
=
4
btnCtrl
=
0
chkCtrl
=
1
...
...
Mac/Lib/toolbox/Events.py
View file @
227a4232
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Events.h'
nullEvent
=
0
mouseDown
=
1
mouseUp
=
2
...
...
Mac/Lib/toolbox/Resources.py
View file @
227a4232
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Resources.h'
resSysHeap
=
64
resPurgeable
=
32
resLocked
=
16
...
...
Mac/Lib/toolbox/Sound.py
View file @
227a4232
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Sound.h'
swMode
=
-
1
ftMode
=
1
ffMode
=
0
...
...
Mac/Lib/toolbox/Windows.py
View file @
227a4232
# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Windows.h'
documentProc
=
0
dBoxProc
=
1
plainDBox
=
2
...
...
Mac/Modules/ae/aegen.py
View file @
227a4232
...
...
@@ -312,3 +312,4 @@ f = AEFunction(OSErr, 'AEManagerInfo',
(
long
,
'result'
,
OutMode
),
)
functions
.
append
(
f
)
Mac/Modules/ctl/ctlgen.py
View file @
227a4232
...
...
@@ -170,3 +170,4 @@ f = Method(short, 'GetCVariant',
(
ControlHandle
,
'theControl'
,
InMode
),
)
methods
.
append
(
f
)
Mac/Modules/evt/evtgen.py
View file @
227a4232
...
...
@@ -42,6 +42,3 @@ f = Function(void, 'GetKeys',
)
functions
.
append
(
f
)
f
=
Function
(
long
,
'TickCount'
,
)
functions
.
append
(
f
)
Mac/Modules/menu/Menumodule.c
View file @
227a4232
...
...
@@ -50,7 +50,7 @@ typedef struct MenuObject {
}
MenuObject
;
PyObject
*
MenuObj_New
(
itself
)
const
MenuHandle
itself
;
MenuHandle
itself
;
{
MenuObject
*
it
;
it
=
PyObject_NEW
(
MenuObject
,
&
Menu_Type
);
...
...
Mac/Modules/menu/menugen.py
View file @
227a4232
...
...
@@ -240,3 +240,4 @@ f = Function(void, 'DelMCEntries',
(
short
,
'menuItem'
,
InMode
),
)
functions
.
append
(
f
)
Mac/Modules/res/Resmodule.c
View file @
227a4232
...
...
@@ -50,7 +50,7 @@ typedef struct ResourceObject {
}
ResourceObject
;
PyObject
*
ResObj_New
(
itself
)
const
Handle
itself
;
Handle
itself
;
{
ResourceObject
*
it
;
if
(
itself
==
NULL
)
return
PyMac_Error
(
resNotFound
);
...
...
Mac/Modules/res/resgen.py
View file @
227a4232
...
...
@@ -269,3 +269,4 @@ f = ResMethod(void, 'SetResourceSize',
(
long
,
'newSize'
,
InMode
),
)
resmethods
.
append
(
f
)
Mac/Modules/res/resscan.py
View file @
227a4232
...
...
@@ -38,6 +38,9 @@ class ResourcesScanner(Scanner):
return
[
"ReadPartialResource"
,
"WritePartialResource"
,
## "RmveResource", # RemoveResource
## "SizeResource", # GetResourceSizeOnDisk
## "MaxSizeRsrc", # GetMaxResourceSize
]
def
makerepairinstructions
(
self
):
...
...
Mac/Modules/snd/sndgen.py
View file @
227a4232
...
...
@@ -129,3 +129,4 @@ f = SndFunction(void, 'Exp1to6',
(
unsigned_long
,
'whichChannel'
,
InMode
),
)
functions
.
append
(
f
)
Tools/bgen/bgen/bgenBuffer.py
View file @
227a4232
...
...
@@ -53,21 +53,22 @@ class FixedInputOutputBufferType(InputOnlyType):
def
declareSize
(
self
,
name
):
Output
(
"%s %s__len__;"
,
self
.
sizetype
,
name
)
Output
(
"int %s__in_len__;"
,
name
)
def
getargsFormat
(
self
):
# XXX This only works if the size is int-sized!!!
return
"s#"
def
getargsArgs
(
self
,
name
):
return
"&%s__in__, &%s__len__"
%
(
name
,
name
)
return
"&%s__in__, &%s__
in_
len__"
%
(
name
,
name
)
def
getargsCheck
(
self
,
name
):
Output
(
"if (%s__len__ != %s)"
,
name
,
self
.
size
)
Output
(
"if (%s__
in_
len__ != %s)"
,
name
,
self
.
size
)
OutLbrace
()
Output
(
'PyErr_SetString(PyExc_TypeError, "buffer length should be %s");'
,
self
.
size
)
Output
(
"goto %s__error__;"
,
name
)
OutRbrace
()
Output
(
"%s__len__ = %s__in_len__;"
,
name
,
name
)
def
passOutput
(
self
,
name
):
return
"%s__in__, %s__out__"
%
(
name
,
name
)
...
...
@@ -76,7 +77,7 @@ class FixedInputOutputBufferType(InputOnlyType):
return
"s#"
def
mkvalueArgs
(
self
,
name
):
return
"%s__out__, %s"
%
(
name
,
self
.
size
)
return
"%s__out__,
(int)
%s"
%
(
name
,
self
.
size
)
def
cleanup
(
self
,
name
):
DedentLevel
()
...
...
@@ -138,7 +139,7 @@ class VarInputBufferType(FixedInputBufferType):
FixedInputBufferType
.
__init__
(
self
,
"0"
,
datatype
,
sizetype
,
sizeformat
)
def
getargsCheck
(
self
,
name
):
pass
Output
(
"%s__len__ = %s__in_len__;"
,
name
,
name
)
def
passInput
(
self
,
name
):
return
"%s__in__, %s__len__"
%
(
name
,
name
)
...
...
@@ -161,11 +162,14 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
def
declareInputBuffer
(
self
,
name
):
Output
(
"%s *%s__in__;"
,
self
.
type
,
name
)
def
declareSize
(
self
,
name
):
Output
(
"int %s__in_len__;"
,
name
)
def
declareOutputBuffer
(
self
,
name
):
Output
(
"%s %s__out__;"
,
self
.
type
,
name
)
def
getargsArgs
(
self
,
name
):
return
"(char **)&%s__in__, &%s__len__"
%
(
name
,
name
)
return
"(char **)&%s__in__, &%s__
in_
len__"
%
(
name
,
name
)
def
passInput
(
self
,
name
):
return
"%s__in__"
%
name
...
...
@@ -174,7 +178,7 @@ class StructInputOutputBufferType(FixedInputOutputBufferType):
return
"%s__in__, &%s__out__"
%
(
name
,
name
)
def
mkvalueArgs
(
self
,
name
):
return
"(char *)&%s__out__, %s"
%
(
name
,
self
.
size
)
return
"(char *)&%s__out__,
(int)
%s"
%
(
name
,
self
.
size
)
class
StructCombinedInputOutputBufferType
(
StructInputOutputBufferType
):
...
...
@@ -212,6 +216,9 @@ class StructOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType)
Instantiate with the struct type as parameter.
"""
def
declareSize
(
self
,
name
):
pass
def
passOutput
(
self
,
name
):
return
"&%s__out__"
%
name
...
...
@@ -223,5 +230,8 @@ class ArrayOutputBufferType(OutputOnlyBufferMixIn, StructInputOutputBufferType):
Instantiate with the struct type as parameter.
"""
def
declareSize
(
self
,
name
):
pass
def
passOutput
(
self
,
name
):
return
"%s__out__"
%
name
Tools/bgen/bgen/bgenHeapBuffer.py
View file @
227a4232
...
...
@@ -20,17 +20,19 @@ class HeapInputOutputBufferType(FixedInputOutputBufferType):
Output
(
"%s *%s__out__;"
,
self
.
datatype
,
name
)
def
getargsCheck
(
self
,
name
):
Output
(
"if ((%s__out__ = malloc(%s__len__)) == NULL)"
,
name
,
name
)
Output
(
"if ((%s__out__ = malloc(%s__
in_
len__)) == NULL)"
,
name
,
name
)
OutLbrace
()
Output
(
'PyErr_NoMemory();'
)
Output
(
"goto %s__error__;"
,
name
)
OutRbrace
()
Output
(
"%s__len__ = %s__in_len__;"
,
name
,
name
)
def
passOutput
(
self
,
name
):
return
"%s__in__, %s__out__, %s__len__"
%
(
name
,
name
,
name
)
return
"%s__in__, %s__out__, (%s)%s__len__"
%
\
(
name
,
name
,
self
.
sizetype
,
name
)
def
mkvalueArgs
(
self
,
name
):
return
"%s__out__, %s__len__"
%
(
name
,
name
)
return
"%s__out__,
(int)
%s__len__"
%
(
name
,
name
)
def
cleanup
(
self
,
name
):
Output
(
"free(%s__out__);"
,
name
)
...
...
@@ -75,10 +77,10 @@ class HeapOutputBufferType(OutputOnlyMixIn, HeapInputOutputBufferType):
pass
def
getargsFormat
(
self
):
return
self
.
sizeformat
return
"i"
def
getargsArgs
(
self
,
name
):
return
"&%s__len__"
%
name
return
"&%s__
in_
len__"
%
name
def
passOutput
(
self
,
name
):
return
"%s__out__, %s__len__"
%
(
name
,
name
)
...
...
Tools/bgen/bgen/bgenStackBuffer.py
View file @
227a4232
...
...
@@ -29,7 +29,7 @@ class VarStackOutputBufferType(StackOutputBufferType):
return
"%s__out__, &%s__len__"
%
(
name
,
name
)
def
mkvalueArgs
(
self
,
name
):
return
"%s__out__, %s__len__"
%
(
name
,
name
)
return
"%s__out__,
(int)
%s__len__"
%
(
name
,
name
)
class
VarVarStackOutputBufferType
(
VarStackOutputBufferType
):
...
...
@@ -56,4 +56,4 @@ class ReturnVarStackOutputBufferType(VarStackOutputBufferType):
return
"%s__out__, %s__len__"
%
(
name
,
name
)
def
mkvalueArgs
(
self
,
name
):
return
"%s__out__, _rv"
%
name
return
"%s__out__,
(int)
_rv"
%
name
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment