-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kimchi: Renaming project from pump to kimchi
- Loading branch information
Showing
35 changed files
with
102 additions
and
99 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* pump.c: A library used to serialize/deserialize certain python objects. | ||
* kimchi.c: A library used to serialize/deserialize certain python objects. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -22,7 +22,7 @@ | |
* [Type][Size][Serialization] | ||
* | ||
* Type: 1 byte. | ||
* Bitflag representing what type was serialized here. See pump.h for type definitions. | ||
* Bitflag representing what type was serialized here. See headers/kimchi.h for type definitions. | ||
* | ||
* Size: X bytes. | ||
* The number of bytes the size field consumes is determined by the first byte which has its first bit set to 1. | ||
|
@@ -42,18 +42,18 @@ | |
/* DevNote: To extend this library with the capability to serialize further objects, the following steps must be taken. | ||
* Follow the existing conventions in place in each of the files when making changes. | ||
* | ||
* 1. Add a new entry to pump/headers/pump.h: Type Definitions. | ||
* 2. Add an entry to if block chain in pump/utils/types.c discerning whether a generic python object is of your type. | ||
* 3. Add cases to the switches in pump/utils/serialize.c to serialize and deserialize objects of your type. | ||
* 4. Add a new file to pump/serializers/ to serialize & deserialize your type. | ||
* 1. Add a new entry to kimchi/headers/kimchi.h: Type Definitions. | ||
* 2. Add an entry to if block chain in kimchi/utils/types.c discerning whether a generic python object is of your type. | ||
* 3. Add cases to the switches in kimchi/utils/serialize.c to serialize and deserialize objects of your type. | ||
* 4. Add a new file to kimchi/serializers/ to serialize & deserialize your type. | ||
* Ensure that the Python Object returned from your deserialization has a ref count of 1. | ||
* 5. Add a new unit test for your type to the pump/tests/ directory. | ||
* 5. Add a new unit test for your type to the kimchi/tests/ directory. | ||
* It will be automatically included in the unit tests. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
static PyObject *deflate(PyObject *self, PyObject *args) { | ||
static PyObject *dumps(PyObject *self, PyObject *args) { | ||
/* API function which serializes a python object. | ||
* | ||
* Inputs: self - Unused. The required `self` parameter of any python-visible function. | ||
|
@@ -80,13 +80,13 @@ static PyObject *deflate(PyObject *self, PyObject *args) { | |
return obj; | ||
} | ||
|
||
static PyObject *inflate(PyObject *self, PyObject *args) { | ||
static PyObject *loads(PyObject *self, PyObject *args) { | ||
/* API function which deserializes a python object. | ||
* | ||
* Inputs: self - Unused. The required `self` parameter of any python-visible function. | ||
* args - Positional arguments passed to the function. | ||
* | ||
* Outputs: A copy of the original Python object serialized by the deflate function, or NULL if an error occurs. | ||
* Outputs: A copy of the original Python object serialized by the dumps function, or NULL if an error occurs. | ||
*/ | ||
|
||
PyObject *obj; | ||
|
@@ -108,31 +108,31 @@ static PyObject *inflate(PyObject *self, PyObject *args) { | |
return obj; | ||
} | ||
|
||
static PyMethodDef pumpMethods[] = { | ||
{"deflate", (PyCFunction) deflate, METH_VARARGS, "Serialize a python object as a string."}, | ||
{"inflate", (PyCFunction) inflate, METH_VARARGS, "Deserialize a string as a python object."}, | ||
static PyMethodDef kimchiMethods[] = { | ||
{"dumps", (PyCFunction) dumps, METH_VARARGS, "Serialize a python object as a string."}, | ||
{"loads", (PyCFunction) loads, METH_VARARGS, "Deserialize a string as a python object."}, | ||
{NULL, NULL, 0, NULL} /* sentinel */ | ||
}; | ||
|
||
#if PY_MAJOR_VERSION >= 3 | ||
static struct PyModuleDef pumpDef = { | ||
static struct PyModuleDef kimchiDef = { | ||
PyModuleDef_HEAD_INIT, | ||
"pump", | ||
"kimchi", | ||
"Provides serialization capabilities for most built in objects", | ||
-1, | ||
pumpMethods, | ||
kimchiMethods, | ||
NULL, | ||
NULL, | ||
NULL, | ||
NULL | ||
}; | ||
|
||
PyMODINIT_FUNC PyInit_pump(void) { | ||
return PyModule_Create(&pumpDef); | ||
PyMODINIT_FUNC PyInit_kimchi(void) { | ||
return PyModule_Create(&kimchiDef); | ||
} | ||
|
||
#else | ||
void initpump(void) { | ||
Py_InitModule("pump", pumpMethods); | ||
void initkimchi(void) { | ||
Py_InitModule("kimchi", kimchiMethods); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* bool.c: A file containing functions used by pump.c to serialize Python Booleans. | ||
* bool.c: A file containing functions used by kimchi.c to serialize Python Booleans. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function Prototypes | ||
int serializeBool(char **, unsigned long long *); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* bytes.c: A file containing functions used by pump.c to serialize `bytes` objects and Python2 strings. | ||
* bytes.c: A file containing functions used by kimchi.c to serialize `bytes` objects and Python2 strings. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function prototypes | ||
int serializeBytes(PyObject *, char **, unsigned long long *); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* dict.c: A file containing functions used by pump.c to serialize Python Dictionaries. | ||
* dict.c: A file containing functions used by kimchi.c to serialize Python Dictionaries. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function Prototypes | ||
int serializeDict(PyObject *, char **, unsigned long long *); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* float.c: A file containing functions used by pump.c to serialize floats. | ||
* float.c: A file containing functions used by kimchi.c to serialize floats. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function Prototypes | ||
int serializeFloat(PyObject *, char **, unsigned long long *); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* int.c: A file containing functions used by pump.c to serialize integers. | ||
* int.c: A file containing functions used by kimchi.c to serialize integers. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function Prototypes | ||
static unsigned long long _numBytesToSerialize(unsigned long long); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* list.c: A file containing functions used by pump.c to serialize Python Lists. | ||
* list.c: A file containing functions used by kimchi.c to serialize Python Lists. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function Prototypes | ||
static void _freeSerializeListBuffers(char **, unsigned long long *, unsigned long long); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* long.c: A file containing functions used by pump.c to serialize longs. | ||
* long.c: A file containing functions used by kimchi.c to serialize longs. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
#include "longintrepr.h" | ||
|
||
// Function Prototypes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* none.c: A file containing functions used by pump.c to serialize Python None's. | ||
* none.c: A file containing functions used by kimchi.c to serialize Python None's. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function Prototypes | ||
int serializeNone(char **, unsigned long long *); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* set.c: A file containing functions used by pump.c to serialize Python Sets and FrozenSets. | ||
* set.c: A file containing functions used by kimchi.c to serialize Python Sets and FrozenSets. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function Prototypes | ||
static void _freeSerializeSetBuffers(char **, unsigned long long *, unsigned long long, PyObject *); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* tuple.c: A file containing functions used by pump.c to serialize Python Tuples. | ||
* tuple.c: A file containing functions used by kimchi.c to serialize Python Tuples. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function Prototypes | ||
static void _freeSerializeTupleBuffers(char **, unsigned long long *, unsigned long long); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* unicode.c: A file containing functions used by pump.c to serialize unicode strings. | ||
* unicode.c: A file containing functions used by kimchi.c to serialize unicode strings. | ||
* Copyright (C) 2016 Warren Spencer [email protected] | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -16,7 +16,7 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "headers/pump.h" | ||
#include "headers/kimchi.h" | ||
|
||
// Function prototypes | ||
int serializeUnicode(PyObject *, char **, unsigned long long *); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.