[Python-checkins] CVS: python/dist/src/Tools/perfecthash perfect_hash.py,1.1,1.2
M.-A. Lemburg
python-dev@python.org
Fri, 30 Jun 2000 02:56:02 -0700
Update of /cvsroot/python/python/dist/src/Tools/perfecthash
In directory slayer.i.sourceforge.net:/tmp/cvs-serv15153/Tools/perfecthash
Modified Files:
perfect_hash.py
Log Message:
Marc-Andre Lemburg <mal@lemburg.com>:
Include <> -> "". Removed some left over code at the end of the file.
Patch by Bill Tutt.
Index: perfect_hash.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/perfecthash/perfect_hash.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** perfect_hash.py 2000/06/28 16:53:16 1.1
--- perfect_hash.py 2000/06/30 09:56:00 1.2
***************
*** 292,296 ****
def generate_header(self, structName):
header = """
! #include <Python.h>
#include <stdlib.h>
--- 292,296 ----
def generate_header(self, structName):
header = """
! #include "Python.h"
#include <stdlib.h>
***************
*** 604,664 ****
return PerfectHash(cchMaxKey, f1, f2, G, N, len(keys), maxHashValue)
-
- """
- static
- PyObject *codec_tuple(PyObject *unicode,
- int len)
- {
- PyObject *v,*w;
-
- if (unicode == NULL)
- return NULL;
- v = PyTuple_New(2);
- if (v == NULL) {
- Py_DECREF(unicode);
- return NULL;
- }
- PyTuple_SET_ITEM(v,0,unicode);
- w = PyInt_FromLong(len);
- if (w == NULL) {
- Py_DECREF(v);
- return NULL;
- }
- PyTuple_SET_ITEM(v,1,w);
- return v;
- }
-
- static PyObject *
- ucn_decode(PyObject *self,
- PyObject *args)
- {
- const char *data;
- int size;
- const char *errors = NULL;
- PyObject *mapping = NULL;
-
- if (!PyArg_ParseTuple(args, "t#|z:ucn_decode",
- &data, &size, &errors))
- return NULL;
- if (mapping == Py_None)
- mapping = NULL;
-
- return codec_tuple(PyUnicode_DecodeNamedUnicodeEscape(data, size, errors),
- size);
- }
-
-
- static PyMethodDef _codecs_functions[] = {
- { "ucn_decode", ucn_decode, 1 },
- };
-
- DL_EXPORT(void)
- init_ucn()
- {
- Py_InitModule("_ucn", _codecs_functions);
- }
-
- """
-
-
-
--- 604,605 ----