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
142eeb83
Kaydet (Commit)
142eeb83
authored
Agu 13, 1997
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
cPickle release 0.3 from Jim Fulton
üst
f55afae3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
143 additions
and
126 deletions
+143
-126
cStringIO.h
Include/cStringIO.h
+25
-6
cPickle.c
Modules/cPickle.c
+0
-0
cStringIO.c
Modules/cStringIO.c
+118
-120
No files found.
Include/cStringIO.h
Dosyayı görüntüle @
142eeb83
...
...
@@ -70,12 +70,12 @@
This would typically be done in your init function.
$Log$
Revision 2.4 1997/04/09 18:04:08 guido
Got rid of the static decl of PyCObject_Import, which was a 1.4
compatibility hack.
Revision 2.5 1997/08/13 03:14:08 guido
cPickle release 0.3 from Jim Fulton
Revision 2.3 1997/04/09 17:34:28 guido
Changed the way the C API was exported. Jim Fulton.
Revision 1.3 1997/06/13 19:44:02 jim
- changed to avoid warning of multiple declarations in 1.5 and
our 1.4.
Revision 1.2 1997/01/27 14:13:05 jim
Changed the way the C API was exported.
...
...
@@ -121,7 +121,26 @@ static struct PycStringIO_CAPI {
#define PycStringIO_OutputCheck(O) \
((O)->ob_type==PycStringIO->OutputType)
static
void
*
xxxPyCObject_Import
(
char
*
module_name
,
char
*
name
)
{
PyObject
*
m
,
*
c
;
void
*
r
=
NULL
;
if
((
m
=
PyImport_ImportModule
(
module_name
)))
{
if
((
c
=
PyObject_GetAttrString
(
m
,
name
)))
{
r
=
PyCObject_AsVoidPtr
(
c
);
Py_DECREF
(
c
);
}
Py_DECREF
(
m
);
}
return
r
;
}
#define PycString_IMPORT \
PycStringIO=PyCObject_Import("cStringIO", "cStringIO_CAPI")
PycStringIO=
xxx
PyCObject_Import("cStringIO", "cStringIO_CAPI")
#endif
/* CSTRINGIO_INCLUDED */
Modules/cPickle.c
Dosyayı görüntüle @
142eeb83
This diff is collapsed.
Click to expand it.
Modules/cStringIO.c
Dosyayı görüntüle @
142eeb83
...
...
@@ -51,70 +51,12 @@
If you have questions regarding this software,
contact:
Jim Fulton, jim
@digicool.com
info
@digicool.com
Digital Creations L.C.
(540) 371-6909
$Log$
Revision 2.5 1997/04/11 19:56:06 guido
My own patch: support writable 'softspace' attribute.
Revision 2.4 1997/04/09 17:35:33 guido
Unknown changes by Jim Fulton.
Revision 1.16 1997/02/17 22:17:43 jim
*** empty log message ***
Revision 1.14 1997/01/24 19:56:24 chris
undid last change
Revision 1.13 1997/01/24 19:45:20 chris
extra byte in buffer no longer included in buf_size
Revision 1.12 1997/01/24 19:38:28 chris
*** empty log message ***
Revision 1.11 1997/01/23 20:45:01 jim
ANSIfied it.
Changed way C API was exported.
Revision 1.10 1997/01/02 15:19:55 chris
checked in to be sure repository is up to date.
Revision 1.9 1996/12/27 21:40:29 jim
Took out some lamosities in interface, like returning self from
write.
Revision 1.8 1996/12/23 15:52:49 jim
Added ifdef to check for CObject before using it.
Revision 1.7 1996/12/23 15:22:35 jim
Finished implementation, adding full compatibility with StringIO, and
then some.
We still need to take out some cStringIO oddities.
Revision 1.6 1996/10/15 18:42:07 jim
Added lots of casts to make warnings go away.
Revision 1.5 1996/10/11 21:03:42 jim
*** empty log message ***
Revision 1.4 1996/10/11 21:02:15 jim
*** empty log message ***
Revision 1.3 1996/10/07 20:51:38 chris
*** empty log message ***
Revision 1.2 1996/07/18 13:08:34 jfulton
*** empty log message ***
Revision 1.1 1996/07/15 17:06:33 jfulton
Initial version.
*/
static
char
cStringIO_module_documentation
[]
=
"A simple fast partial StringIO replacement.
\n
"
...
...
@@ -142,6 +84,8 @@ static char cStringIO_module_documentation[] =
"
\n
"
"If someone else wants to provide a more complete implementation,
\n
"
"go for it. :-)
\n
"
"
\n
"
"$Id$
\n
"
;
#include "Python.h"
...
...
@@ -150,8 +94,6 @@ static char cStringIO_module_documentation[] =
#define UNLESS(E) if(!(E))
/* ----------------------------------------------------- */
/* Declarations for objects of type StringO */
typedef
struct
{
...
...
@@ -160,10 +102,6 @@ typedef struct {
int
pos
,
string_size
,
buf_size
,
closed
,
softspace
;
}
Oobject
;
staticforward
PyTypeObject
Otype
;
/* ---------------------------------------------------------------- */
/* Declarations for objects of type StringI */
typedef
struct
{
...
...
@@ -173,10 +111,6 @@ typedef struct {
PyObject
*
pbuf
;
}
Iobject
;
staticforward
PyTypeObject
Itype
;
/* ---------------------------------------------------------------- */
static
char
O_reset__doc__
[]
=
"reset() -- Reset the file position to the beginning"
;
...
...
@@ -343,7 +277,14 @@ O_write(Oobject *self, PyObject *args) {
static
PyObject
*
O_getval
(
Oobject
*
self
,
PyObject
*
args
)
{
return
PyString_FromStringAndSize
(
self
->
buf
,
self
->
pos
);
PyObject
*
use_pos
;
int
s
;
use_pos
=
Py_None
;
UNLESS
(
PyArg_ParseTuple
(
args
,
"|O"
,
&
use_pos
))
return
NULL
;
if
(
PyObject_IsTrue
(
use_pos
))
s
=
self
->
pos
;
else
s
=
self
->
string_size
;
return
PyString_FromStringAndSize
(
self
->
buf
,
s
);
}
static
PyObject
*
...
...
@@ -434,7 +375,12 @@ static struct PyMethodDef O_methods[] = {
{
"reset"
,
(
PyCFunction
)
O_reset
,
0
,
O_reset__doc__
},
{
"seek"
,
(
PyCFunction
)
O_seek
,
1
,
O_seek__doc__
},
{
"tell"
,
(
PyCFunction
)
O_tell
,
0
,
O_tell__doc__
},
{
"getvalue"
,
(
PyCFunction
)
O_getval
,
0
,
"getvalue() -- Get the string value"
},
{
"getvalue"
,
(
PyCFunction
)
O_getval
,
1
,
"getvalue([use_pos]) -- Get the string value."
"
\n
"
"If use_pos is specified and is a true value, then the string returned
\n
"
"will include only the text up to the current file position.
\n
"
},
{
"truncate"
,
(
PyCFunction
)
O_truncate
,
0
,
O_truncate__doc__
},
{
"isatty"
,
(
PyCFunction
)
O_isatty
,
0
,
O_isatty__doc__
},
{
"close"
,
(
PyCFunction
)
O_close
,
0
,
O_close__doc__
},
...
...
@@ -443,32 +389,6 @@ static struct PyMethodDef O_methods[] = {
{
NULL
,
NULL
}
/* sentinel */
};
/* ---------- */
static
PyObject
*
newOobject
(
int
size
)
{
Oobject
*
self
;
self
=
PyObject_NEW
(
Oobject
,
&
Otype
);
if
(
self
==
NULL
)
return
NULL
;
self
->
pos
=
0
;
self
->
closed
=
0
;
self
->
string_size
=
0
;
self
->
softspace
=
0
;
UNLESS
(
self
->
buf
=
malloc
(
size
*
sizeof
(
char
)))
{
PyErr_SetString
(
PyExc_MemoryError
,
"out of memory"
);
self
->
buf_size
=
0
;
return
NULL
;
}
self
->
buf_size
=
size
;
return
(
PyObject
*
)
self
;
}
static
void
O_dealloc
(
Oobject
*
self
)
{
...
...
@@ -527,6 +447,29 @@ static PyTypeObject Otype = {
Otype__doc__
/* Documentation string */
};
static
PyObject
*
newOobject
(
int
size
)
{
Oobject
*
self
;
self
=
PyObject_NEW
(
Oobject
,
&
Otype
);
if
(
self
==
NULL
)
return
NULL
;
self
->
pos
=
0
;
self
->
closed
=
0
;
self
->
string_size
=
0
;
self
->
softspace
=
0
;
UNLESS
(
self
->
buf
=
malloc
(
size
*
sizeof
(
char
)))
{
PyErr_SetString
(
PyExc_MemoryError
,
"out of memory"
);
self
->
buf_size
=
0
;
return
NULL
;
}
self
->
buf_size
=
size
;
return
(
PyObject
*
)
self
;
}
/* End of code for StringO objects */
/* -------------------------------------------------------- */
...
...
@@ -554,29 +497,6 @@ static struct PyMethodDef I_methods[] = {
{
NULL
,
NULL
}
/* sentinel */
};
/* ---------- */
static
PyObject
*
newIobject
(
PyObject
*
s
)
{
Iobject
*
self
;
char
*
buf
;
int
size
;
UNLESS
(
buf
=
PyString_AsString
(
s
))
return
NULL
;
UNLESS
(
-
1
!=
(
size
=
PyString_Size
(
s
)))
return
NULL
;
UNLESS
(
self
=
PyObject_NEW
(
Iobject
,
&
Itype
))
return
NULL
;
Py_INCREF
(
s
);
self
->
buf
=
buf
;
self
->
string_size
=
size
;
self
->
pbuf
=
s
;
self
->
pos
=
0
;
self
->
closed
=
0
;
return
(
PyObject
*
)
self
;
}
static
void
I_dealloc
(
Iobject
*
self
)
{
Py_DECREF
(
self
->
pbuf
);
...
...
@@ -617,6 +537,25 @@ static PyTypeObject Itype = {
Itype__doc__
/* Documentation string */
};
static
PyObject
*
newIobject
(
PyObject
*
s
)
{
Iobject
*
self
;
char
*
buf
;
int
size
;
UNLESS
(
buf
=
PyString_AsString
(
s
))
return
NULL
;
UNLESS
(
-
1
!=
(
size
=
PyString_Size
(
s
)))
return
NULL
;
UNLESS
(
self
=
PyObject_NEW
(
Iobject
,
&
Itype
))
return
NULL
;
Py_INCREF
(
s
);
self
->
buf
=
buf
;
self
->
string_size
=
size
;
self
->
pbuf
=
s
;
self
->
pos
=
0
;
self
->
closed
=
0
;
return
(
PyObject
*
)
self
;
}
/* End of code for StringI objects */
/* -------------------------------------------------------- */
...
...
@@ -676,8 +615,67 @@ initcStringIO() {
/* Export Types */
PyDict_SetItemString
(
d
,
"InputType"
,
(
PyObject
*
)
&
Itype
);
PyDict_SetItemString
(
d
,
"OutputType"
,
(
PyObject
*
)
&
Otype
);
/* Maybe make certain warnings go away */
if
(
0
)
PycString_IMPORT
;
/* Check for errors */
if
(
PyErr_Occurred
())
Py_FatalError
(
"can't initialize module cStringIO"
);
}
/******************************************************************************
$Log$
Revision 2.6 1997/08/13 03:14:41 guido
cPickle release 0.3 from Jim Fulton
Revision 1.21 1997/06/19 18:51:42 jim
Added ident string.
Revision 1.20 1997/06/13 20:50:50 jim
- Various changes to make gcc -Wall -pedantic happy, including
getting rid of staticforward declarations and adding pretend use
of two statics defined in .h file.
Revision 1.19 1997/06/02 18:15:17 jim
Merged in guido's changes.
Revision 1.18 1997/05/07 16:26:47 jim
getvalue() can nor be given an argument. If this argument is true,
then getvalue returns the text upto the current position. Otherwise
it returns all of the text. The default value of the argument is
false.
Revision 1.17 1997/04/17 18:02:46 chris
getvalue() now returns entire string, not just the string up to
current position
Revision 2.5 1997/04/11 19:56:06 guido
My own patch: support writable 'softspace' attribute.
> Jim asked: What is softspace for?
It's an old feature. The print statement uses this to remember
whether it should insert a space before the next item or not.
Implementation is in fileobject.c.
Revision 1.11 1997/01/23 20:45:01 jim
ANSIfied it.
Changed way C API was exported.
Revision 1.10 1997/01/02 15:19:55 chris
checked in to be sure repository is up to date.
Revision 1.9 1996/12/27 21:40:29 jim
Took out some lamosities in interface, like returning self from
write.
Revision 1.8 1996/12/23 15:52:49 jim
Added ifdef to check for CObject before using it.
Revision 1.7 1996/12/23 15:22:35 jim
Finished implementation, adding full compatibility with StringIO, and
then some.
*****************************************************************************/
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