Update of /cvsroot/csp/APPLICATIONS/SimData/Source In directory sc8-pr-cvs1:/tmp/cvs-serv8014/Source Modified Files: Tag: simdata DataArchive.cpp HashUtility.cpp Path.cpp cSimData.py cSimData_wrap.cpp Log Message: hasht fixes, printf Index: DataArchive.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Attic/DataArchive.cpp,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** DataArchive.cpp 20 Jan 2003 23:06:48 -0000 1.1.2.5 --- DataArchive.cpp 21 Jan 2003 19:04:12 -0000 1.1.2.6 *************** *** 52,56 **** t.classhash = hash; t.pathhash = hash_string(path); - //printf("%s => %lld\n", path, t.pathhash); table_map[t.pathhash] = n_objects; n_objects++; --- 52,55 ---- *************** *** 82,86 **** size_t n; n = fread(&table_offset, 4, 1, f); - printf("table offset = %08x\n", (int)table_offset); if (n != 1) { throw CorruptArchive("Lookup table offset."); --- 81,84 ---- *************** *** 88,92 **** fseek(f, table_offset, SEEK_SET); n = fread(&n_objects, 4, 1, f); - printf("table entries = %d\n", n_objects); if (n != 1 || n_objects < 0 || n_objects > 100000) { throw CorruptArchive("Number of objects."); --- 86,89 ---- *************** *** 102,106 **** //printf("%6d %d\n", i, table[i].pathhash); table_map[table[i].pathhash] = i; ! //printf("%02d: %llu %llu %08x %d\n", i, table[i].pathhash, table[i].classhash, table[i].offset, table[i].length); } } --- 99,105 ---- //printf("%6d %d\n", i, table[i].pathhash); table_map[table[i].pathhash] = i; ! //printf("%02d: ", i); ! //std::cout << table[i].pathhash << " " << table[i].classhash; ! //printf(" %08x %d\n", table[i].offset, table[i].length); } } *************** *** 168,172 **** a.pack(p); int length = p.getCount(); ! fprintf(stderr, "added %s (%d bytes) [%llu]\n", path, length, hash_string(path)); _addEntry(offset, length, a.getClassHash(), path); } --- 167,171 ---- a.pack(p); int length = p.getCount(); ! std::cerr << "added " << path << " (" << length << " bytes) [" << hash_string(path) << "]" << std::endl; _addEntry(offset, length, a.getClassHash(), path); } *************** *** 275,280 **** if (i == table_map.end()) { std::string msg; - char buf[128]; - snprintf(buf, 128, " [%llu]", key); if (path_str==0 || *path_str==0) { msg = "human-readable path unavailable"; --- 274,277 ---- *************** *** 282,287 **** msg = path_str; } ! msg = "path not found in archive '" + _fn + "' (" + msg + ")" + buf + "\n"; ! printf(msg.c_str()); throw IndexError(msg.c_str()); } --- 279,284 ---- msg = path_str; } ! msg = "path not found in archive '" + _fn + "' (" + msg + ")" + key.str() + "\n"; ! std::cerr << msg; throw IndexError(msg.c_str()); } *************** *** 302,306 **** printf("getObject(\"%s\"):\n", path_str); } ! printf("Interface proxy [%llu] not found.\n", t.classhash); assert(0); } --- 299,303 ---- printf("getObject(\"%s\"):\n", path_str); } ! std::cout << "Interface proxy [" << t.classhash << "] not found." << std::endl; assert(0); } *************** *** 314,318 **** n_buffer++; } else { ! printf("BUFFERSIZE exceeded, allocating larger buffer\n"); buffer = (char*) malloc(length); free_buffer = true; --- 311,315 ---- n_buffer++; } else { ! std::cout << "BUFFERSIZE exceeded, allocating larger buffer" << std::endl; buffer = (char*) malloc(length); free_buffer = true; *************** *** 322,326 **** fread(buffer, length, 1, f); UnPacker p(buffer, length, this); ! printf("got object %s\n",dup->getClassName()); dup->_setPath(key); dup->unpack(p); --- 319,323 ---- fread(buffer, length, 1, f); UnPacker p(buffer, length, this); ! std::cout << "got object " << dup->getClassName() << std::endl; dup->_setPath(key); dup->unpack(p); *************** *** 331,335 **** } if (!p.isComplete()) { ! printf("INTERNAL ERROR: Object extraction incomplete for class '%s'.\n", dup->getClassName()); assert(0); } --- 328,332 ---- } if (!p.isComplete()) { ! std::cout << "INTERNAL ERROR: Object extraction incomplete for class '" << dup->getClassName() << "'." << std::endl; assert(0); } Index: HashUtility.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Attic/HashUtility.cpp,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** HashUtility.cpp 20 Jan 2003 23:06:48 -0000 1.1.2.2 --- HashUtility.cpp 21 Jan 2003 19:04:12 -0000 1.1.2.3 *************** *** 28,31 **** --- 28,32 ---- #include <SimData/HashUtility.h> + #include <sstream> *************** *** 119,128 **** } ! ! NAMESPACE_END // namespace simdata ! std::ostream & operator<<(std::ostream &o, const hasht &x) { return o << "(" << x.b << ":" << x.a << ")"; } --- 120,135 ---- } ! std::string HashT::str() const { ! std::stringstream repr; ! repr << *this; ! return repr.str(); ! } std::ostream & operator<<(std::ostream &o, const hasht &x) { return o << "(" << x.b << ":" << x.a << ")"; } + + + NAMESPACE_END // namespace simdata + Index: Path.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Attic/Path.cpp,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** Path.cpp 20 Jan 2003 05:53:12 -0000 1.1.2.3 --- Path.cpp 21 Jan 2003 19:04:12 -0000 1.1.2.4 *************** *** 23,26 **** --- 23,28 ---- #include <SimData/ns-simdata.h> + #include <sstream> + using std::cout; using std::endl; *************** *** 49,55 **** std::string Path::asString() const { ! char repr[128]; ! snprintf(repr, 128, "<Path %llu>", _path); ! return repr; } --- 51,57 ---- std::string Path::asString() const { ! std::stringstream repr; ! repr << "<Path " << _path << ">"; ! return repr.str(); } *************** *** 127,133 **** std::string PathPointerBase::asString() const { ! char repr[128]; ! snprintf(repr, 128, "<Path %llu>", _path); ! return repr; } --- 129,135 ---- std::string PathPointerBase::asString() const { ! std::stringstream repr; ! repr << "<Path " << _path << ">"; ! return repr.str(); } *************** *** 154,158 **** _assign(0); } else { ! printf("loading pathpointerbase from %llu %llu\n", path, _path); Path _p(path); PathPointerBase _ppb; --- 156,160 ---- _assign(0); } else { ! std::cerr << "loading pathpointerbase from " << path << " " << _path << std::endl; Path _p(path); PathPointerBase _ppb; Index: cSimData.py =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Attic/cSimData.py,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** cSimData.py 20 Jan 2003 23:06:48 -0000 1.1.2.2 --- cSimData.py 21 Jan 2003 19:04:12 -0000 1.1.2.3 *************** *** 82,91 **** __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, HashT, name) - __swig_setmethods__["a"] = _cSimData.HashT_a_set - __swig_getmethods__["a"] = _cSimData.HashT_a_get - if _newclass:a = property(_cSimData.HashT_a_get,_cSimData.HashT_a_set) - __swig_setmethods__["b"] = _cSimData.HashT_b_set - __swig_getmethods__["b"] = _cSimData.HashT_b_get - if _newclass:b = property(_cSimData.HashT_b_get,_cSimData.HashT_b_set) def __init__(self,*args): self.this = apply(_cSimData.new_HashT,args) --- 82,85 ---- *************** *** 106,111 **** self.__class__ = HashT _cSimData.HashT_swigregister(HashTPtr) - - newhash4_cstring = _cSimData.newhash4_cstring hash_string = _cSimData.hash_string --- 100,103 ---- Index: cSimData_wrap.cpp =================================================================== RCS file: /cvsroot/csp/APPLICATIONS/SimData/Source/Attic/cSimData_wrap.cpp,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** cSimData_wrap.cpp 20 Jan 2003 23:06:48 -0000 1.1.2.4 --- cSimData_wrap.cpp 21 Jan 2003 19:04:12 -0000 1.1.2.5 *************** *** 1779,1866 **** return Py_BuildValue((char *)""); } - static PyObject *_wrap_HashT_a_set(PyObject *self, PyObject *args) { - PyObject *resultobj; - simdata::HashT *arg1 = (simdata::HashT *) 0 ; - guint32 arg2 ; - guint32 *argp2 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"OO:HashT_a_set",&obj0,&obj1)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_simdata__HashT,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if ((SWIG_ConvertPtr(obj1,(void **) &argp2, SWIGTYPE_p_guint32,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail; - arg2 = *argp2; - if (arg1) (arg1)->a = arg2; - - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; - } - - - static PyObject *_wrap_HashT_a_get(PyObject *self, PyObject *args) { - PyObject *resultobj; - simdata::HashT *arg1 = (simdata::HashT *) 0 ; - guint32 result; - PyObject * obj0 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"O:HashT_a_get",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_simdata__HashT,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - result = ((arg1)->a); - - { - guint32 * resultptr; - resultptr = new guint32((guint32 &) result); - resultobj = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_guint32, 1); - } - return resultobj; - fail: - return NULL; - } - - - static PyObject *_wrap_HashT_b_set(PyObject *self, PyObject *args) { - PyObject *resultobj; - simdata::HashT *arg1 = (simdata::HashT *) 0 ; - guint32 arg2 ; - guint32 *argp2 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"OO:HashT_b_set",&obj0,&obj1)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_simdata__HashT,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - if ((SWIG_ConvertPtr(obj1,(void **) &argp2, SWIGTYPE_p_guint32,SWIG_POINTER_EXCEPTION) == -1)) SWIG_fail; - arg2 = *argp2; - if (arg1) (arg1)->b = arg2; - - Py_INCREF(Py_None); resultobj = Py_None; - return resultobj; - fail: - return NULL; - } - - - static PyObject *_wrap_HashT_b_get(PyObject *self, PyObject *args) { - PyObject *resultobj; - simdata::HashT *arg1 = (simdata::HashT *) 0 ; - guint32 result; - PyObject * obj0 = 0 ; - - if(!PyArg_ParseTuple(args,(char *)"O:HashT_b_get",&obj0)) goto fail; - if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_simdata__HashT,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; - result = ((arg1)->b); - - { - guint32 * resultptr; - resultptr = new guint32((guint32 &) result); - resultobj = SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_guint32, 1); - } - return resultobj; - fail: - return NULL; - } - - static PyObject *_wrap_new_HashT__SWIG_0(PyObject *self, PyObject *args) { PyObject *resultobj; --- 1779,1782 ---- *************** *** 2252,2270 **** return Py_BuildValue((char *)""); } - static PyObject *_wrap_newhash4_cstring(PyObject *self, PyObject *args) { - PyObject *resultobj; - char *arg1 ; - u4 result; - - if(!PyArg_ParseTuple(args,(char *)"s:newhash4_cstring",&arg1)) goto fail; - result = (u4)simdata::newhash4_cstring((char const *)arg1); - - resultobj = PyInt_FromLong((long)result); - return resultobj; - fail: - return NULL; - } - - static PyObject *_wrap_hash_string(PyObject *self, PyObject *args) { PyObject *resultobj; --- 2168,2171 ---- *************** *** 21957,21964 **** { (char *)"delete_PythonException", _wrap_delete_PythonException, METH_VARARGS }, { (char *)"PythonException_swigregister", PythonException_swigregister, METH_VARARGS }, - { (char *)"HashT_a_set", _wrap_HashT_a_set, METH_VARARGS }, - { (char *)"HashT_a_get", _wrap_HashT_a_get, METH_VARARGS }, - { (char *)"HashT_b_set", _wrap_HashT_b_set, METH_VARARGS }, - { (char *)"HashT_b_get", _wrap_HashT_b_get, METH_VARARGS }, { (char *)"new_HashT", _wrap_new_HashT, METH_VARARGS }, { (char *)"HashT___eq__", _wrap_HashT___eq__, METH_VARARGS }, --- 21858,21861 ---- *************** *** 21966,21970 **** { (char *)"delete_HashT", _wrap_delete_HashT, METH_VARARGS }, { (char *)"HashT_swigregister", HashT_swigregister, METH_VARARGS }, - { (char *)"newhash4_cstring", _wrap_newhash4_cstring, METH_VARARGS }, { (char *)"hash_string", _wrap_hash_string, METH_VARARGS }, { (char *)"new_ParseException", _wrap_new_ParseException, METH_VARARGS }, --- 21863,21866 ---- |