Update of /cvsroot/pure-data/externals/PDContainer/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11891/src
Modified Files: h_deque.cpp h_list.cpp h_map.cpp h_multimap.cpp h_multiset.cpp h_set.cpp h_vector.cpp Log Message: added new xml parser
Index: h_multiset.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_multiset.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** h_multiset.cpp 29 Oct 2004 11:56:14 -0000 1.2 --- h_multiset.cpp 5 May 2005 23:00:56 -0000 1.3 *************** *** 134,137 **** --- 134,164 ---- }
+ static void h_multiset_save_xml(t_h_multiset *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(x->hmultiset->saveToFileXML(filename)) + post("h_multiset: data of namespace %s written to file %s", + x->hmultiset->getNamespace().c_str(),s->s_name); + else + post("h_multiset: couldn't write to file %s",s->s_name); + } + + static void h_multiset_read_xml(t_h_multiset *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hmultiset->readFromFileXML(filename)) + post("h_multiset: couldn't read from file %s",s->s_name); + } + static void *h_multiset_new(t_symbol *s, int argc, t_atom *argv) { *************** *** 193,196 **** --- 220,227 ---- class_addmethod(h_multiset_class, (t_method)h_multiset_read, gensym("read"), A_DEFSYMBOL , 0); + class_addmethod(h_multiset_class, (t_method)h_multiset_save_xml, + gensym("saveXML"), A_DEFSYMBOL , 0); + class_addmethod(h_multiset_class, (t_method)h_multiset_read_xml, + gensym("readXML"), A_DEFSYMBOL , 0);
// without an argument the following two methods wont work ??? why?? because of c++?
Index: h_vector.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_vector.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** h_vector.cpp 29 Oct 2004 11:56:14 -0000 1.2 --- h_vector.cpp 5 May 2005 23:00:56 -0000 1.3 *************** *** 342,345 **** --- 342,404 ---- }
+ static void h_vector_save_xml(t_h_vector *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(x->hvector->saveToFileXML(filename)) + post("h_vector: data of namespace %s written to file %s", + x->hvector->getNamespace().c_str(),s->s_name); + else + post("h_vector: couldn't write to file %s",s->s_name); + } + + static void h_vector_read_xml(t_h_vector *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hvector->readFromFileXML(filename)) + post("h_vector: couldn't read from file %s",s->s_name); + } + + static void h_vector_read_at_xml(t_h_vector *x, t_symbol *s, int argc, t_atom *argv) + { + string symbol; + int index; + + switch(argc) + { + default: + post("h_vector read: only two argument are possible!"); + break; + case 2: + symbol = argv[0].a_w.w_symbol->s_name; + index = (int)argv[1].a_w.w_float; + break; + case 1: + symbol = argv[0].a_w.w_symbol->s_name; + index = 0; + break; + case 0: + post("h_vector read: no filename!"); + } + + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, (char*)symbol.c_str(), filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hvector->readFromFile2XML(filename,index)) + post("h_vector: couldn't read from file %s",s->s_name); + } + static void *h_vector_new(t_symbol *s, int argc, t_atom *argv) { *************** *** 424,427 **** --- 483,492 ---- class_addmethod(h_vector_class, (t_method)h_vector_read_at, gensym("readat"), A_GIMME, 0); + class_addmethod(h_vector_class, (t_method)h_vector_save_xml, + gensym("saveXML"), A_DEFSYMBOL , 0); + class_addmethod(h_vector_class, (t_method)h_vector_read_xml, + gensym("readXML"), A_DEFSYMBOL , 0); + class_addmethod(h_vector_class, (t_method)h_vector_read_at_xml, + gensym("readatXML"), A_GIMME, 0);
// without an argument the following two methods wont work ??? why?? because of c++?
Index: h_list.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_list.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** h_list.cpp 18 Mar 2005 10:15:01 -0000 1.4 --- h_list.cpp 5 May 2005 23:00:56 -0000 1.5 *************** *** 306,309 **** --- 306,336 ---- }
+ static void h_list_save_xml(t_h_list *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(x->hlist->saveToFileXML(filename)) + post("h_list: data of namespace %s written to file %s", + x->hlist->getNamespace().c_str(),s->s_name); + else + post("h_list: couldn't write to file %s",s->s_name); + } + + static void h_list_read_xml(t_h_list *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hlist->readFromFileXML(filename)) + post("h_list: couldn't read from file %s",s->s_name); + } + static void *h_list_new(t_symbol *s, int argc, t_atom *argv) { *************** *** 400,403 **** --- 427,434 ---- class_addmethod(h_list_class, (t_method)h_list_read, gensym("read"), A_DEFSYMBOL , 0); + class_addmethod(h_list_class, (t_method)h_list_save_xml, + gensym("saveXML"), A_DEFSYMBOL , 0); + class_addmethod(h_list_class, (t_method)h_list_read_xml, + gensym("readXML"), A_DEFSYMBOL , 0);
// without an argument the following two methods wont work ??? why?? because of c++?
Index: h_map.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_map.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** h_map.cpp 29 Oct 2004 11:56:14 -0000 1.2 --- h_map.cpp 5 May 2005 23:00:56 -0000 1.3 *************** *** 210,213 **** --- 210,228 ---- }
+ static void h_map_save_xml(t_h_map *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(x->hmap->saveToFileXML(filename)) + post("h_map: data of namespace %s written to file %s", + x->hmap->getNamespace().c_str(),s->s_name); + else + post("h_map: couldn't write to file %s",s->s_name); + } + static void h_map_read(t_h_map *x, t_symbol *s) { *************** *** 222,225 **** --- 237,252 ---- }
+ static void h_map_read_xml(t_h_map *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hmap->readFromFileXML(filename)) + post("h_map: couldn't read from file %s",s->s_name); + } + static void *h_map_new(t_symbol *s, int argc, t_atom *argv) { *************** *** 293,298 **** --- 320,329 ---- class_addmethod(h_map_class, (t_method)h_map_save, gensym("save"), A_DEFSYMBOL , 0); + class_addmethod(h_map_class, (t_method)h_map_save_xml, + gensym("saveXML"), A_DEFSYMBOL , 0); class_addmethod(h_map_class, (t_method)h_map_read, gensym("read"), A_DEFSYMBOL , 0); + class_addmethod(h_map_class, (t_method)h_map_read_xml, + gensym("readXML"), A_DEFSYMBOL , 0);
// without an argument the following two methods wont work ??? why?? because of c++?
Index: h_multimap.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_multimap.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** h_multimap.cpp 29 Oct 2004 11:56:14 -0000 1.2 --- h_multimap.cpp 5 May 2005 23:00:56 -0000 1.3 *************** *** 215,218 **** --- 215,233 ---- }
+ static void h_multimap_save_xml(t_h_multimap *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(x->hmultimap->saveToFileXML(filename)) + post("h_multimap: data of namespace %s written to file %s", + x->hmultimap->getNamespace().c_str(),s->s_name); + else + post("h_multimap: couldn't write to file %s",s->s_name); + } + static void h_multimap_read(t_h_multimap *x, t_symbol *s) { *************** *** 227,230 **** --- 242,257 ---- }
+ static void h_multimap_read_xml(t_h_multimap *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hmultimap->readFromFileXML(filename)) + post("h_multimap: couldn't read from file %s",s->s_name); + } + static void *h_multimap_new(t_symbol *s, int argc, t_atom *argv) { *************** *** 297,302 **** --- 324,333 ---- class_addmethod(h_multimap_class, (t_method)h_multimap_save, gensym("save"), A_DEFSYMBOL , 0); + class_addmethod(h_multimap_class, (t_method)h_multimap_save_xml, + gensym("saveXML"), A_DEFSYMBOL , 0); class_addmethod(h_multimap_class, (t_method)h_multimap_read, gensym("read"), A_DEFSYMBOL , 0); + class_addmethod(h_multimap_class, (t_method)h_multimap_read_xml, + gensym("readXML"), A_DEFSYMBOL , 0);
// without an argument the following two methods wont work ??? why?? because of c++?
Index: h_set.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_set.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** h_set.cpp 29 Oct 2004 11:56:14 -0000 1.2 --- h_set.cpp 5 May 2005 23:00:56 -0000 1.3 *************** *** 134,137 **** --- 134,164 ---- }
+ static void h_set_save_xml(t_h_set *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(x->hset->saveToFileXML(filename)) + post("h_set: data of namespace %s written to file %s", + x->hset->getNamespace().c_str(),s->s_name); + else + post("h_set: couldn't write to file %s",s->s_name); + } + + static void h_set_read_xml(t_h_set *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hset->readFromFileXML(filename)) + post("h_set: couldn't read from file %s",s->s_name); + } + static void *h_set_new(t_symbol *s, int argc, t_atom *argv) { *************** *** 193,196 **** --- 220,227 ---- class_addmethod(h_set_class, (t_method)h_set_read, gensym("read"), A_DEFSYMBOL , 0); + class_addmethod(h_set_class, (t_method)h_set_save_xml, + gensym("saveXML"), A_DEFSYMBOL , 0); + class_addmethod(h_set_class, (t_method)h_set_read_xml, + gensym("readXML"), A_DEFSYMBOL , 0);
// without an argument the following two methods wont work ??? why?? because of c++?
Index: h_deque.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_deque.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** h_deque.cpp 29 Oct 2004 11:56:14 -0000 1.2 --- h_deque.cpp 5 May 2005 23:00:56 -0000 1.3 *************** *** 423,426 **** --- 423,485 ---- }
+ static void h_deque_save_xml(t_h_deque *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(x->hdeque->saveToFileXML(filename)) + post("h_deque: data of namespace %s written to file %s", + x->hdeque->getNamespace().c_str(),s->s_name); + else + post("h_deque: couldn't write to file %s",s->s_name); + } + + static void h_deque_read_xml(t_h_deque *x, t_symbol *s) + { + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, s->s_name, filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hdeque->readFromFileXML(filename)) + post("h_deque: couldn't read from file %s",s->s_name); + } + + static void h_deque_read_at_xml(t_h_deque *x, t_symbol *s, int argc, t_atom *argv) + { + string symbol; + int index; + + switch(argc) + { + default: + post("h_deque read: only two argument are possible!"); + break; + case 2: + symbol = argv[0].a_w.w_symbol->s_name; + index = (int)argv[1].a_w.w_float; + break; + case 1: + symbol = argv[0].a_w.w_symbol->s_name; + index = 0; + break; + case 0: + post("h_deque read: no filename!"); + } + + // make correct path + char filnam[MAXPDSTRING]; + char filename[MAXPDSTRING]; + canvas_makefilename(x->x_canvas, (char*)symbol.c_str(), filnam, MAXPDSTRING); + sys_bashfilename(filnam, filename); + + if(!x->hdeque->readFromFile2XML(filename,index)) + post("h_deque: couldn't read from file %s",s->s_name); + } + static void *h_deque_new(t_symbol *s, int argc, t_atom *argv) { *************** *** 513,516 **** --- 572,581 ---- class_addmethod(h_deque_class, (t_method)h_deque_read_at, gensym("readat"), A_GIMME, 0); + class_addmethod(h_deque_class, (t_method)h_deque_save_xml, + gensym("saveXML"), A_DEFSYMBOL , 0); + class_addmethod(h_deque_class, (t_method)h_deque_read_xml, + gensym("readXML"), A_DEFSYMBOL , 0); + class_addmethod(h_deque_class, (t_method)h_deque_read_at_xml, + gensym("readatXML"), A_GIMME, 0);
// without an argument the following two methods wont work ??? why?? because of c++?