Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a4b1d003
Kaydet (Commit)
a4b1d003
authored
Agu 14, 1995
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Interface to the Mac List Manager.
üst
f33a69f2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1049 additions
and
0 deletions
+1049
-0
tlist.py
Mac/Lib/test/tlist.py
+79
-0
Lists.py
Mac/Lib/toolbox/Lists.py
+15
-0
Listmodule.c
Mac/Modules/list/Listmodule.c
+638
-0
listgen.py
Mac/Modules/list/listgen.py
+160
-0
listscan.py
Mac/Modules/list/listscan.py
+73
-0
listsupport.py
Mac/Modules/list/listsupport.py
+84
-0
No files found.
Mac/Lib/test/tlist.py
0 → 100644
Dosyayı görüntüle @
a4b1d003
# Test List module.
# Draw a window with all the files in the current folder.
# double-clicking will change folder.
#
# This test expects Win, Evt and FrameWork (and anything used by those)
# to work.
from
FrameWork
import
*
import
Win
import
Qd
import
List
import
os
class
TestList
(
Application
):
def
__init__
(
self
):
os
.
chdir
(
'Moes:'
)
self
.
makemenubar
()
self
.
makewindow
()
def
makewindow
(
self
):
r
=
(
40
,
40
,
400
,
300
)
w
=
Win
.
NewWindow
(
r
,
"List test"
,
1
,
0
,
-
1
,
1
,
0x55555555
)
r2
=
(
0
,
0
,
345
,
245
)
self
.
list
=
List
.
LNew
(
r2
,
(
0
,
0
,
1
,
1
),
(
0
,
0
),
0
,
w
,
0
,
1
,
1
,
1
)
self
.
filllist
()
w
.
DrawGrowIcon
()
self
.
win
=
w
def
makeusermenus
(
self
):
self
.
filemenu
=
m
=
Menu
(
self
.
menubar
,
"File"
)
self
.
quititem
=
MenuItem
(
m
,
"Quit"
,
"Q"
,
self
.
quit
)
def
quit
(
self
,
*
args
):
raise
self
def
do_about
(
self
,
id
,
item
,
window
,
event
):
EasyDialogs
.
Message
(
"""Test the List Manager interface.
Double-click on a folder to change directory"""
)
def
do_activateEvt
(
self
,
*
args
):
self
.
list
.
LActivate
(
1
)
# XXXX Wrong...
def
do_update
(
self
,
*
args
):
print
'LUPDATE'
self
.
list
.
LUpdate
()
def
do_inContent
(
self
,
partcode
,
window
,
event
):
(
what
,
message
,
when
,
where
,
modifiers
)
=
event
Qd
.
SetPort
(
window
)
local
=
Qd
.
GlobalToLocal
(
where
)
print
'CLICK'
,
where
,
'->'
,
local
dclick
=
self
.
list
.
LClick
(
local
,
modifiers
)
if
dclick
:
h
,
v
=
self
.
list
.
LLastClick
()
file
=
self
.
list
.
LGetCell
(
1000
,
(
h
,
v
))
os
.
chdir
(
file
)
self
.
filllist
()
def
filllist
(
self
):
"""Fill the list with the contents of the current directory"""
l
=
self
.
list
l
.
LSetDrawingMode
(
0
)
l
.
LDelRow
(
0
,
0
)
contents
=
os
.
listdir
(
':'
)
print
contents
l
.
LAddRow
(
len
(
contents
),
0
)
for
i
in
range
(
len
(
contents
)):
l
.
LSetCell
(
contents
[
i
],
(
0
,
i
))
l
.
LSetDrawingMode
(
1
)
l
.
LUpdate
()
def
main
():
App
=
TestList
()
App
.
mainloop
()
if
__name__
==
'__main__'
:
main
()
Mac/Lib/toolbox/Lists.py
0 → 100644
Dosyayı görüntüle @
a4b1d003
# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:Lists.h'
lDoVAutoscroll
=
2
lDoHAutoscroll
=
1
lOnlyOne
=
-
128
lExtendDrag
=
64
lNoDisjoint
=
32
lNoExtend
=
16
lNoRect
=
8
lUseSense
=
4
lNoNilHilite
=
2
lInitMsg
=
0
lDrawMsg
=
1
lHiliteMsg
=
2
lCloseMsg
=
3
Mac/Modules/list/Listmodule.c
0 → 100644
Dosyayı görüntüle @
a4b1d003
/* ========================== Module List =========================== */
#include "Python.h"
#define SystemSevenOrLater 1
#include "macglue.h"
#include <Memory.h>
#include <Dialogs.h>
#include <Menus.h>
#include <Controls.h>
extern
PyObject
*
ResObj_New
(
Handle
);
extern
int
ResObj_Convert
(
PyObject
*
,
Handle
*
);
extern
PyObject
*
WinObj_New
(
WindowPtr
);
extern
int
WinObj_Convert
(
PyObject
*
,
WindowPtr
*
);
extern
PyObject
*
DlgObj_New
(
DialogPtr
);
extern
int
DlgObj_Convert
(
PyObject
*
,
DialogPtr
*
);
extern
PyTypeObject
Dialog_Type
;
#define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type)
extern
PyObject
*
MenuObj_New
(
MenuHandle
);
extern
int
MenuObj_Convert
(
PyObject
*
,
MenuHandle
*
);
extern
PyObject
*
CtlObj_New
(
ControlHandle
);
extern
int
CtlObj_Convert
(
PyObject
*
,
ControlHandle
*
);
extern
PyObject
*
WinObj_WhichWindow
(
WindowPtr
);
#include <Lists.h>
static
PyObject
*
List_Error
;
/* ------------------------ Object type List ------------------------ */
PyTypeObject
List_Type
;
#define ListObj_Check(x) ((x)->ob_type == &List_Type)
typedef
struct
ListObject
{
PyObject_HEAD
ListRef
ob_itself
;
}
ListObject
;
PyObject
*
ListObj_New
(
itself
)
ListRef
itself
;
{
ListObject
*
it
;
if
(
itself
==
NULL
)
{
PyErr_SetString
(
List_Error
,
"Cannot create null List"
);
return
NULL
;
}
it
=
PyObject_NEW
(
ListObject
,
&
List_Type
);
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
return
(
PyObject
*
)
it
;
}
ListObj_Convert
(
v
,
p_itself
)
PyObject
*
v
;
ListRef
*
p_itself
;
{
if
(
!
ListObj_Check
(
v
))
{
PyErr_SetString
(
PyExc_TypeError
,
"List required"
);
return
0
;
}
*
p_itself
=
((
ListObject
*
)
v
)
->
ob_itself
;
return
1
;
}
static
void
ListObj_dealloc
(
self
)
ListObject
*
self
;
{
LDispose
(
self
->
ob_itself
);
PyMem_DEL
(
self
);
}
static
PyObject
*
ListObj_LAddColumn
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
short
_rv
;
short
count
;
short
colNum
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
count
,
&
colNum
))
return
NULL
;
_rv
=
LAddColumn
(
count
,
colNum
,
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"h"
,
_rv
);
return
_res
;
}
static
PyObject
*
ListObj_LAddRow
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
short
_rv
;
short
count
;
short
rowNum
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
count
,
&
rowNum
))
return
NULL
;
_rv
=
LAddRow
(
count
,
rowNum
,
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"h"
,
_rv
);
return
_res
;
}
static
PyObject
*
ListObj_LDelColumn
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
short
count
;
short
colNum
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
count
,
&
colNum
))
return
NULL
;
LDelColumn
(
count
,
colNum
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LDelRow
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
short
count
;
short
rowNum
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
count
,
&
rowNum
))
return
NULL
;
LDelRow
(
count
,
rowNum
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LGetSelect
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Boolean
_rv
;
Boolean
next
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"bO&"
,
&
next
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
_rv
=
LGetSelect
(
next
,
&
theCell
,
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"bO&"
,
_rv
,
PyMac_BuildPoint
,
theCell
);
return
_res
;
}
static
PyObject
*
ListObj_LLastClick
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Point
_rv
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
_rv
=
LLastClick
(
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"O&"
,
PyMac_BuildPoint
,
_rv
);
return
_res
;
}
static
PyObject
*
ListObj_LNextCell
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Boolean
_rv
;
Boolean
hNext
;
Boolean
vNext
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"bbO&"
,
&
hNext
,
&
vNext
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
_rv
=
LNextCell
(
hNext
,
vNext
,
&
theCell
,
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"bO&"
,
_rv
,
PyMac_BuildPoint
,
theCell
);
return
_res
;
}
static
PyObject
*
ListObj_LSize
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
short
listWidth
;
short
listHeight
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
listWidth
,
&
listHeight
))
return
NULL
;
LSize
(
listWidth
,
listHeight
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LSetDrawingMode
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Boolean
drawIt
;
if
(
!
PyArg_ParseTuple
(
_args
,
"b"
,
&
drawIt
))
return
NULL
;
LSetDrawingMode
(
drawIt
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LScroll
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
short
dCols
;
short
dRows
;
if
(
!
PyArg_ParseTuple
(
_args
,
"hh"
,
&
dCols
,
&
dRows
))
return
NULL
;
LScroll
(
dCols
,
dRows
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LAutoScroll
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
LAutoScroll
(
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LUpdate
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
LUpdate
((
*
_self
->
ob_itself
)
->
port
->
visRgn
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LActivate
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Boolean
act
;
if
(
!
PyArg_ParseTuple
(
_args
,
"b"
,
&
act
))
return
NULL
;
LActivate
(
act
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LCellSize
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Point
cSize
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
PyMac_GetPoint
,
&
cSize
))
return
NULL
;
LCellSize
(
cSize
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LClick
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Boolean
_rv
;
Point
pt
;
short
modifiers
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&h"
,
PyMac_GetPoint
,
&
pt
,
&
modifiers
))
return
NULL
;
_rv
=
LClick
(
pt
,
modifiers
,
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"b"
,
_rv
);
return
_res
;
}
static
PyObject
*
ListObj_LAddToCell
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
char
*
dataPtr__in__
;
short
dataPtr__len__
;
int
dataPtr__in_len__
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"s#O&"
,
&
dataPtr__in__
,
&
dataPtr__in_len__
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
dataPtr__len__
=
dataPtr__in_len__
;
LAddToCell
(
dataPtr__in__
,
dataPtr__len__
,
theCell
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
dataPtr__error__
:
;
return
_res
;
}
static
PyObject
*
ListObj_LClrCell
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
LClrCell
(
theCell
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LGetCell
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
char
*
dataPtr__out__
;
short
dataPtr__len__
;
int
dataPtr__in_len__
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"iO&"
,
&
dataPtr__in_len__
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
if
((
dataPtr__out__
=
malloc
(
dataPtr__in_len__
))
==
NULL
)
{
PyErr_NoMemory
();
goto
dataPtr__error__
;
}
dataPtr__len__
=
dataPtr__in_len__
;
LGetCell
(
dataPtr__out__
,
&
dataPtr__len__
,
theCell
,
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"s#"
,
dataPtr__out__
,
(
int
)
dataPtr__len__
);
free
(
dataPtr__out__
);
dataPtr__error__
:
;
return
_res
;
}
static
PyObject
*
ListObj_LRect
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Rect
cellRect
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
LRect
(
&
cellRect
,
theCell
,
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"O&"
,
PyMac_BuildRect
,
&
cellRect
);
return
_res
;
}
static
PyObject
*
ListObj_LSetCell
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
char
*
dataPtr__in__
;
short
dataPtr__len__
;
int
dataPtr__in_len__
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"s#O&"
,
&
dataPtr__in__
,
&
dataPtr__in_len__
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
dataPtr__len__
=
dataPtr__in_len__
;
LSetCell
(
dataPtr__in__
,
dataPtr__len__
,
theCell
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
dataPtr__error__
:
;
return
_res
;
}
static
PyObject
*
ListObj_LSetSelect
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Boolean
setIt
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"bO&"
,
&
setIt
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
LSetSelect
(
setIt
,
theCell
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
ListObj_LDraw
(
_self
,
_args
)
ListObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
Point
theCell
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&"
,
PyMac_GetPoint
,
&
theCell
))
return
NULL
;
LDraw
(
theCell
,
_self
->
ob_itself
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyMethodDef
ListObj_methods
[]
=
{
{
"LAddColumn"
,
(
PyCFunction
)
ListObj_LAddColumn
,
1
,
"(short count, short colNum) -> (short _rv)"
},
{
"LAddRow"
,
(
PyCFunction
)
ListObj_LAddRow
,
1
,
"(short count, short rowNum) -> (short _rv)"
},
{
"LDelColumn"
,
(
PyCFunction
)
ListObj_LDelColumn
,
1
,
"(short count, short colNum) -> None"
},
{
"LDelRow"
,
(
PyCFunction
)
ListObj_LDelRow
,
1
,
"(short count, short rowNum) -> None"
},
{
"LGetSelect"
,
(
PyCFunction
)
ListObj_LGetSelect
,
1
,
"(Boolean next, Point theCell) -> (Boolean _rv, Point theCell)"
},
{
"LLastClick"
,
(
PyCFunction
)
ListObj_LLastClick
,
1
,
"() -> (Point _rv)"
},
{
"LNextCell"
,
(
PyCFunction
)
ListObj_LNextCell
,
1
,
"(Boolean hNext, Boolean vNext, Point theCell) -> (Boolean _rv, Point theCell)"
},
{
"LSize"
,
(
PyCFunction
)
ListObj_LSize
,
1
,
"(short listWidth, short listHeight) -> None"
},
{
"LSetDrawingMode"
,
(
PyCFunction
)
ListObj_LSetDrawingMode
,
1
,
"(Boolean drawIt) -> None"
},
{
"LScroll"
,
(
PyCFunction
)
ListObj_LScroll
,
1
,
"(short dCols, short dRows) -> None"
},
{
"LAutoScroll"
,
(
PyCFunction
)
ListObj_LAutoScroll
,
1
,
"() -> None"
},
{
"LUpdate"
,
(
PyCFunction
)
ListObj_LUpdate
,
1
,
"() -> None"
},
{
"LActivate"
,
(
PyCFunction
)
ListObj_LActivate
,
1
,
"(Boolean act) -> None"
},
{
"LCellSize"
,
(
PyCFunction
)
ListObj_LCellSize
,
1
,
"(Point cSize) -> None"
},
{
"LClick"
,
(
PyCFunction
)
ListObj_LClick
,
1
,
"(Point pt, short modifiers) -> (Boolean _rv)"
},
{
"LAddToCell"
,
(
PyCFunction
)
ListObj_LAddToCell
,
1
,
"(Buffer dataPtr, Point theCell) -> None"
},
{
"LClrCell"
,
(
PyCFunction
)
ListObj_LClrCell
,
1
,
"(Point theCell) -> None"
},
{
"LGetCell"
,
(
PyCFunction
)
ListObj_LGetCell
,
1
,
"(Buffer dataPtr, Point theCell) -> (Buffer dataPtr)"
},
{
"LRect"
,
(
PyCFunction
)
ListObj_LRect
,
1
,
"(Point theCell) -> (Rect cellRect)"
},
{
"LSetCell"
,
(
PyCFunction
)
ListObj_LSetCell
,
1
,
"(Buffer dataPtr, Point theCell) -> None"
},
{
"LSetSelect"
,
(
PyCFunction
)
ListObj_LSetSelect
,
1
,
"(Boolean setIt, Point theCell) -> None"
},
{
"LDraw"
,
(
PyCFunction
)
ListObj_LDraw
,
1
,
"(Point theCell) -> None"
},
{
NULL
,
NULL
,
0
}
};
PyMethodChain
ListObj_chain
=
{
ListObj_methods
,
NULL
};
static
PyObject
*
ListObj_getattr
(
self
,
name
)
ListObject
*
self
;
char
*
name
;
{
return
Py_FindMethodInChain
(
&
ListObj_chain
,
(
PyObject
*
)
self
,
name
);
}
#define ListObj_setattr NULL
PyTypeObject
List_Type
=
{
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
/*ob_size*/
"List"
,
/*tp_name*/
sizeof
(
ListObject
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
/* methods */
(
destructor
)
ListObj_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
(
getattrfunc
)
ListObj_getattr
,
/*tp_getattr*/
(
setattrfunc
)
ListObj_setattr
,
/*tp_setattr*/
};
/* ---------------------- End object type List ---------------------- */
static
PyObject
*
List_LNew
(
_self
,
_args
)
PyObject
*
_self
;
PyObject
*
_args
;
{
PyObject
*
_res
=
NULL
;
ListRef
_rv
;
Rect
rView
;
Rect
dataBounds
;
Point
cSize
;
short
theProc
;
WindowPtr
theWindow
;
Boolean
drawIt
;
Boolean
hasGrow
;
Boolean
scrollHoriz
;
Boolean
scrollVert
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&O&O&hO&bbbb"
,
PyMac_GetRect
,
&
rView
,
PyMac_GetRect
,
&
dataBounds
,
PyMac_GetPoint
,
&
cSize
,
&
theProc
,
WinObj_Convert
,
&
theWindow
,
&
drawIt
,
&
hasGrow
,
&
scrollHoriz
,
&
scrollVert
))
return
NULL
;
_rv
=
LNew
(
&
rView
,
&
dataBounds
,
cSize
,
theProc
,
theWindow
,
drawIt
,
hasGrow
,
scrollHoriz
,
scrollVert
);
_res
=
Py_BuildValue
(
"O&"
,
ListObj_New
,
_rv
);
return
_res
;
}
static
PyMethodDef
List_methods
[]
=
{
{
"LNew"
,
(
PyCFunction
)
List_LNew
,
1
,
"(Rect rView, Rect dataBounds, Point cSize, short theProc, WindowPtr theWindow, Boolean drawIt, Boolean hasGrow, Boolean scrollHoriz, Boolean scrollVert) -> (ListRef _rv)"
},
{
NULL
,
NULL
,
0
}
};
void
initList
()
{
PyObject
*
m
;
PyObject
*
d
;
m
=
Py_InitModule
(
"List"
,
List_methods
);
d
=
PyModule_GetDict
(
m
);
List_Error
=
PyMac_GetOSErrException
();
if
(
List_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
List_Error
)
!=
0
)
Py_FatalError
(
"can't initialize List.Error"
);
}
/* ======================== End module List ========================= */
Mac/Modules/list/listgen.py
0 → 100644
Dosyayı görüntüle @
a4b1d003
# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:Lists.h'
f
=
Function
(
ListRef
,
'LNew'
,
(
Rect_ptr
,
'rView'
,
InMode
),
(
Rect_ptr
,
'dataBounds'
,
InMode
),
(
Point
,
'cSize'
,
InMode
),
(
short
,
'theProc'
,
InMode
),
(
WindowRef
,
'theWindow'
,
InMode
),
(
Boolean
,
'drawIt'
,
InMode
),
(
Boolean
,
'hasGrow'
,
InMode
),
(
Boolean
,
'scrollHoriz'
,
InMode
),
(
Boolean
,
'scrollVert'
,
InMode
),
)
functions
.
append
(
f
)
f
=
Method
(
short
,
'LAddColumn'
,
(
short
,
'count'
,
InMode
),
(
short
,
'colNum'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
short
,
'LAddRow'
,
(
short
,
'count'
,
InMode
),
(
short
,
'rowNum'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LDelColumn'
,
(
short
,
'count'
,
InMode
),
(
short
,
'colNum'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LDelRow'
,
(
short
,
'count'
,
InMode
),
(
short
,
'rowNum'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
Boolean
,
'LGetSelect'
,
(
Boolean
,
'next'
,
InMode
),
(
Cell
,
'theCell'
,
InOutMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
Cell
,
'LLastClick'
,
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
Boolean
,
'LNextCell'
,
(
Boolean
,
'hNext'
,
InMode
),
(
Boolean
,
'vNext'
,
InMode
),
(
Cell
,
'theCell'
,
InOutMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LSize'
,
(
short
,
'listWidth'
,
InMode
),
(
short
,
'listHeight'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LSetDrawingMode'
,
(
Boolean
,
'drawIt'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LScroll'
,
(
short
,
'dCols'
,
InMode
),
(
short
,
'dRows'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LAutoScroll'
,
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LUpdate'
,
(
RgnHandle
,
'theRgn'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LActivate'
,
(
Boolean
,
'act'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LCellSize'
,
(
Point
,
'cSize'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
Boolean
,
'LClick'
,
(
Point
,
'pt'
,
InMode
),
(
short
,
'modifiers'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LAddToCell'
,
(
InBufferShortsize
,
'dataPtr'
,
InMode
),
(
Cell
,
'theCell'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LClrCell'
,
(
Cell
,
'theCell'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LGetCell'
,
(
VarOutBufferShortsize
,
'dataPtr'
,
InOutMode
),
(
Cell
,
'theCell'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LRect'
,
(
Rect
,
'cellRect'
,
OutMode
),
(
Cell
,
'theCell'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LSetCell'
,
(
InBufferShortsize
,
'dataPtr'
,
InMode
),
(
Cell
,
'theCell'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LSetSelect'
,
(
Boolean
,
'setIt'
,
InMode
),
(
Cell
,
'theCell'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
f
=
Method
(
void
,
'LDraw'
,
(
Cell
,
'theCell'
,
InMode
),
(
ListRef
,
'lHandle'
,
InMode
),
)
methods
.
append
(
f
)
Mac/Modules/list/listscan.py
0 → 100644
Dosyayı görüntüle @
a4b1d003
# Scan an Apple header file, generating a Python file of generator calls.
import
addpack
addpack
.
addpack
(
':tools:bgen:bgen'
)
from
scantools
import
Scanner
LONG
=
"Lists"
SHORT
=
"list"
OBJECT
=
"ListRef"
def
main
():
input
=
LONG
+
".h"
output
=
SHORT
+
"gen.py"
defsoutput
=
LONG
+
".py"
scanner
=
MyScanner
(
input
,
output
,
defsoutput
)
scanner
.
scan
()
scanner
.
close
()
print
"=== Done scanning and generating, now importing the generated code... ==="
exec
"import "
+
SHORT
+
"support"
print
"=== Done. It's up to you to compile it now! ==="
class
MyScanner
(
Scanner
):
def
destination
(
self
,
type
,
name
,
arglist
):
classname
=
"Function"
listname
=
"functions"
if
arglist
:
t
,
n
,
m
=
arglist
[
-
1
]
# This is non-functional today
if
t
==
OBJECT
and
m
==
"InMode"
:
classname
=
"Method"
listname
=
"methods"
return
classname
,
listname
def
makeblacklistnames
(
self
):
return
[
"LDispose"
,
# Done by removing the object
"LSearch"
,
# We don't want to handle procs just yet
"LGetCellDataLocation"
,
# What does this do??
]
def
makeblacklisttypes
(
self
):
return
[
]
def
makerepairinstructions
(
self
):
return
[
([(
'ListBounds_ptr'
,
'*'
,
'InMode'
)],
[(
'Rect_ptr'
,
'*'
,
'InMode'
)]),
([(
"Cell"
,
"theCell"
,
"OutMode"
)],
[(
"Cell"
,
"theCell"
,
"InOutMode"
)]),
([(
"void_ptr"
,
"*"
,
"InMode"
),
(
"short"
,
"*"
,
"InMode"
)],
[(
"InBufferShortsize"
,
"*"
,
"*"
)]),
([(
"void"
,
"*"
,
"OutMode"
),
(
"short"
,
"*"
,
"OutMode"
)],
[(
"VarOutBufferShortsize"
,
"*"
,
"InOutMode"
)]),
# ([("void", "wStorage", "OutMode")],
# [("NullStorage", "*", "InMode")]),
#
# # GetKeys
# ([('KeyMap', 'theKeys', 'InMode')],
# [('*', '*', 'OutMode')]),
#
# # GetTicker
# ([('unsigned long', '*', '*')],
# [('unsigned_long', '*', '*')]),
]
if
__name__
==
"__main__"
:
main
()
Mac/Modules/list/listsupport.py
0 → 100644
Dosyayı görüntüle @
a4b1d003
# This script generates a Python interface for an Apple Macintosh Manager.
# It uses the "bgen" package to generate C code.
# The function specifications are generated by scanning the mamager's header file,
# using the "scantools" package (customized for this particular manager).
import
string
# Declarations that change for each manager
MACHEADERFILE
=
'Lists.h'
# The Apple header file
MODNAME
=
'List'
# The name of the module
OBJECTNAME
=
'List'
# The basic name of the objects used here
KIND
=
'Handle'
# Usually 'Ptr' or 'Handle'
# The following is *usually* unchanged but may still require tuning
MODPREFIX
=
MODNAME
# The prefix for module-wide routines
OBJECTTYPE
=
"ListRef"
# 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
OUTPUTFILE
=
MODNAME
+
"module.c"
# The file generated by this program
from
macsupport
import
*
# Create the type objects
ListRef
=
OpaqueByValueType
(
"ListRef"
,
"ListObj"
)
Cell
=
Point
VarOutBufferShortsize
=
VarHeapOutputBufferType
(
'char'
,
'short'
,
's'
)
# (buf, &len)
InBufferShortsize
=
VarInputBufferType
(
'char'
,
'short'
,
's'
)
# (buf, len)
# For LUpdate, we alsways update the complete visible region.
RgnHandle
=
FakeType
(
"(*_self->ob_itself)->port->visRgn"
)
includestuff
=
includestuff
+
"""
#include <
%
s>"""
%
MACHEADERFILE
+
"""
"""
class
ListMethodGenerator
(
MethodGenerator
):
"""Similar to MethodGenerator, but has self as last argument"""
def
parseArgumentList
(
self
,
args
):
args
,
a0
=
args
[:
-
1
],
args
[
-
1
]
t0
,
n0
,
m0
=
a0
if
m0
!=
InMode
:
raise
ValueError
,
"method's 'self' must be 'InMode'"
self
.
itself
=
Variable
(
t0
,
"_self->ob_itself"
,
SelfMode
)
FunctionGenerator
.
parseArgumentList
(
self
,
args
)
self
.
argumentList
.
append
(
self
.
itself
)
class
MyObjectDefinition
(
GlobalObjectDefinition
):
def
outputCheckNewArg
(
self
):
Output
(
"""if (itself == NULL) {
PyErr_SetString(List_Error,"Cannot create null List");
return NULL;
}"""
)
def
outputFreeIt
(
self
,
itselfname
):
Output
(
"LDispose(
%
s);"
,
itselfname
)
# From here on it's basically all boiler plate...
# Create the generator groups and link them
module
=
MacModule
(
MODNAME
,
MODPREFIX
,
includestuff
,
finalstuff
,
initstuff
)
object
=
MyObjectDefinition
(
OBJECTNAME
,
OBJECTPREFIX
,
OBJECTTYPE
)
module
.
addobject
(
object
)
# Create the generator classes used to populate the lists
Function
=
FunctionGenerator
Method
=
ListMethodGenerator
# Create and populate the lists
functions
=
[]
methods
=
[]
execfile
(
INPUTFILE
)
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for
f
in
functions
:
module
.
add
(
f
)
for
f
in
methods
:
object
.
add
(
f
)
# generate output (open the output file as late as possible)
SetOutputFileName
(
OUTPUTFILE
)
module
.
generate
()
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