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
893b0ab9
Kaydet (Commit)
893b0ab9
authored
Eki 09, 2001
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed the embedding demo to correctly show the use of
overriding the console writer.
üst
04cf1d31
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
demo.c
Mac/Demo/embed/demo.c
+19
-11
embeddemo.prj
Mac/Demo/embed/embeddemo.prj
+0
-0
No files found.
Mac/Demo/embed/demo.c
Dosyayı görüntüle @
893b0ab9
/* Example of embedding Python in another program */
#include "Python.h"
#ifdef macintosh
#include "macglue.h"
#endif
/* macintosh */
static
char
*
argv0
;
long
my_writehandler
(
char
*
buf
,
long
count
)
{
long
mycount
;
unsigned
char
mybuf
[
255
];
mycount
=
count
;
if
(
mycount
>
255
)
mycount
=
255
;
mybuf
[
0
]
=
(
unsigned
char
)
mycount
;
strncpy
((
char
*
)
mybuf
+
1
,
buf
,
mycount
);
DebugStr
(
mybuf
);
return
count
;
}
main
(
argc
,
argv
)
int
argc
;
char
**
argv
;
{
#ifdef macintosh
/* So the user can set argc/argv to something interesting */
argc
=
ccommand
(
&
argv
);
#endif
/* Save a copy of argv0 */
argv0
=
argv
[
0
];
/* Initialize the Python interpreter. Required. */
#ifdef macintosh
/* If the first option is "-q" we don't open a console */
if
(
argc
>
1
&&
strcmp
(
argv
[
1
],
"-q"
)
==
0
)
{
PyMac_SetConsoleHandler
(
PyMac_DummyReadHandler
,
PyMac_DummyWriteHandler
,
PyMac_DummyWriteHandler
);
/* freopen("demo output", "w", stdout); */
}
}
else
if
(
argc
>
1
&&
strcmp
(
argv
[
1
],
"-d"
)
==
0
)
{
PyMac_SetConsoleHandler
(
PyMac_DummyReadHandler
,
my_writehandler
,
my_writehandler
);
}
/* Initialize the Python interpreter. Required. */
PyMac_Initialize
();
#else
Py_Initialize
();
#endif
/* Define sys.argv. It is up to the application if you
want this; you can also let it undefined (since the Python
...
...
Mac/Demo/embed/embeddemo.prj
Dosyayı görüntüle @
893b0ab9
No preview for this file type
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