Update of /cvsroot/pure-data/externals/PDContainer/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12682
Modified Files:
h_deque.cpp h_list.cpp HList.cpp h_map.cpp h_multimap.cpp
HMultiMap.cpp h_multiset.cpp h_prioqueue.cpp h_queue.cpp
h_set.cpp h_stack.cpp h_vector.cpp PDContainer.cpp
Log Message:
version 0.2
Index: h_multiset.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_multiset.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** h_multiset.cpp 5 May 2005 23:00:56 -0000 1.3
--- h_multiset.cpp 9 Oct 2005 21:50:57 -0000 1.4
***************
*** 33,40 ****
}
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hmultiset->add( key );
}
--- 33,37 ----
}
! Element key(argc,argv);
x->hmultiset->add( key );
}
***************
*** 48,55 ****
}
! Element key;
! key.length = argc;
! key.atom = argv;
!
int output = x->hmultiset->get( key );
--- 45,49 ----
}
! Element key(argc,argv);
int output = x->hmultiset->get( key );
***************
*** 65,72 ****
}
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hmultiset->remove( key );
}
--- 59,63 ----
}
! Element key(argc,argv);
x->hmultiset->remove( key );
}
Index: HMultiMap.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/HMultiMap.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** HMultiMap.cpp 25 Oct 2004 19:02:30 -0000 1.1.1.1
--- HMultiMap.cpp 9 Oct 2005 21:50:57 -0000 1.2
***************
*** 34,41 ****
}
! // returns a NULL-pointer if there's no element
! // (okay, thats not good, I'll change that)
! Element *nothing;
! nothing = 0;
! return *nothing;
}
--- 34,38 ----
}
! // throw an exception if nothing was found
! throw "h_multimap, get: Element not found !";
}
Index: HList.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/HList.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** HList.cpp 25 Oct 2004 19:02:30 -0000 1.1.1.1
--- HList.cpp 9 Oct 2005 21:50:57 -0000 1.2
***************
*** 77,81 ****
// into the objects and add them to the container
! t_atom *key_atom = new t_atom[key_count];
if(key_atom == NULL)
post("Fatal Error Out Of Memory (%s-readFromFile)",dataname_.c_str());
--- 77,81 ----
// into the objects and add them to the container
! t_atom *key_atom = (t_atom*)getbytes(key_count*sizeof(t_atom));
if(key_atom == NULL)
post("Fatal Error Out Of Memory (%s-readFromFile)",dataname_.c_str());
***************
*** 98,108 ****
}
! key.length = key_count;
! key.atom = (t_atom*)copybytes(key_atom, key_count * sizeof(t_atom));
// insert the data
data_[h_namespace_].insert(iter_,key);
! delete[] key_atom;
}
--- 98,107 ----
}
! key.setAtoms(key_count,key_atom);
// insert the data
data_[h_namespace_].insert(iter_,key);
! freebytes(key_atom, key_count*sizeof(t_atom));
}
Index: h_stack.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_stack.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** h_stack.cpp 25 Oct 2004 19:02:30 -0000 1.1.1.1
--- h_stack.cpp 9 Oct 2005 21:50:57 -0000 1.2
***************
*** 29,36 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hstack->push(key);
}
--- 29,33 ----
if(argc)
{
! Element key(argc,argv);
x->hstack->push(key);
}
***************
*** 60,76 ****
Element output = x->hstack->top();
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
}
--- 57,78 ----
Element output = x->hstack->top();
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
+
+ // no data
+ outlet_bang(x->out2);
}
Index: h_prioqueue.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_prioqueue.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** h_prioqueue.cpp 25 Oct 2004 19:02:30 -0000 1.1.1.1
--- h_prioqueue.cpp 9 Oct 2005 21:50:57 -0000 1.2
***************
*** 62,113 ****
// symbol without selector "symbol":
if(argc == 0)
! {
! x->value.length = 1;
! SETSYMBOL(x->value.atom, s);
! x->event_set = true;
! return;
! }
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0) && (strcmp(s->s_name,"symbol")!=0) )
! {
! t_atom *atoms = new t_atom[argc+1];
// add the selector symbol to the list:
! SETSYMBOL(atoms, s);
! for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! }
! if (x->value.length != argc+1)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc+1;
! x->value.atom = (t_atom*)copybytes(atoms, (argc+1) * sizeof(t_atom));
! } else memcpy(x->value.atom, atoms, (argc+1) * sizeof(t_atom));
! x->event_set = true;
! delete[] atoms;
! return;
! }
! // "normal" input (list, float or symbol):
if (argc)
! {
! if (x->value.length != argc)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc;
! x->value.atom = (t_atom*)copybytes(argv, argc * sizeof(t_atom));
! } else memcpy(x->value.atom, argv, argc * sizeof(t_atom));
! x->event_set = true;
! return;
! }
}
--- 62,108 ----
// symbol without selector "symbol":
if(argc == 0)
! {
! t_atom tmp;
! SETSYMBOL(&tmp, s);
! x->value.setAtoms(1, &tmp);
! x->event_set = true;
! return;
! }
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0)
! && (strcmp(s->s_name,"symbol")!=0)
! && (strcmp(s->s_name,"pointer")!=0) )
! {
! t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
// add the selector symbol to the list:
! SETSYMBOL(atoms, s);
! for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! if(argv[i].a_type == A_POINTER)
! SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
! }
! x->value.setAtoms(argc+1, atoms);
! x->event_set = true;
! freebytes(atoms, (argc+1)*sizeof(t_atom));
! return;
! }
! // "normal" input (list, float, pointer or symbol):
if (argc)
! {
! x->value.setAtoms(argc, argv);
! x->event_set = true;
! return;
! }
}
***************
*** 123,137 ****
Element output = x->hpriority_queue->top();
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
--- 118,134 ----
Element output = x->hpriority_queue->top();
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
Index: h_queue.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_queue.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** h_queue.cpp 25 Oct 2004 19:02:30 -0000 1.1.1.1
--- h_queue.cpp 9 Oct 2005 21:50:57 -0000 1.2
***************
*** 29,36 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hqueue->push(key);
}
--- 29,33 ----
if(argc)
{
! Element key(argc,argv);
x->hqueue->push(key);
}
***************
*** 60,76 ****
Element output = x->hqueue->front();
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
}
--- 57,78 ----
Element output = x->hqueue->front();
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
+
+ // outlet bang if no data here
+ outlet_bang(x->out2);
}
Index: h_deque.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_deque.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** h_deque.cpp 5 May 2005 23:00:56 -0000 1.3
--- h_deque.cpp 9 Oct 2005 21:50:57 -0000 1.4
***************
*** 92,146 ****
{
t_h_deque *x = (t_h_deque *)(p->x);
!
// symbol without selector "symbol":
if(argc == 0)
! {
! x->value.length = 1;
! SETSYMBOL(x->value.atom, s);
! x->event_set = true;
! return;
! }
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0) && (strcmp(s->s_name,"symbol")!=0) )
! {
! t_atom *atoms = new t_atom[argc+1];
// add the selector symbol to the list:
! SETSYMBOL(atoms, s);
! for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! }
! if (x->value.length != argc+1)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc+1;
! x->value.atom = (t_atom*)copybytes(atoms, (argc+1) * sizeof(t_atom));
! } else memcpy(x->value.atom, atoms, (argc+1) * sizeof(t_atom));
! x->event_set = true;
! delete[] atoms;
! return;
! }
// "normal" input (list, float or symbol):
if (argc)
! {
! if (x->value.length != argc)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc;
! x->value.atom = (t_atom*)copybytes(argv, argc * sizeof(t_atom));
! } else memcpy(x->value.atom, argv, argc * sizeof(t_atom));
! x->event_set = true;
! return;
! }
}
--- 92,141 ----
{
t_h_deque *x = (t_h_deque *)(p->x);
!
// symbol without selector "symbol":
if(argc == 0)
! {
! t_atom tmp;
! SETSYMBOL(&tmp, s);
! x->value.setAtoms(1, &tmp);
! x->event_set = true;
! return;
! }
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0)
! && (strcmp(s->s_name,"symbol")!=0)
! && (strcmp(s->s_name,"pointer")!=0) )
! {
! t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
// add the selector symbol to the list:
! SETSYMBOL(atoms, s);
! for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! if(argv[i].a_type == A_POINTER)
! SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
! }
! x->value.setAtoms(argc+1, atoms);
! x->event_set = true;
! freebytes(atoms, (argc+1)*sizeof(t_atom));
! return;
! }
// "normal" input (list, float or symbol):
if (argc)
! {
! x->value.setAtoms(argc, argv);
! x->event_set = true;
! return;
! }
}
***************
*** 164,178 ****
Element output = x->hdeque->get( index );
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
--- 159,175 ----
Element output = x->hdeque->get( index );
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
***************
*** 186,193 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hdeque->pushBack(key);
}
--- 183,187 ----
if(argc)
{
! Element key(argc,argv);
x->hdeque->pushBack(key);
}
***************
*** 217,231 ****
Element output = x->hdeque->back();
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
--- 211,227 ----
Element output = x->hdeque->back();
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
***************
*** 239,246 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hdeque->pushFront(key);
}
--- 235,239 ----
if(argc)
{
! Element key(argc,argv);
x->hdeque->pushFront(key);
}
***************
*** 270,284 ****
Element output = x->hdeque->front();
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
--- 263,279 ----
Element output = x->hdeque->front();
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
***************
*** 394,398 ****
{
string symbol;
! int index;
switch(argc)
--- 389,393 ----
{
string symbol;
! int index=0;
switch(argc)
***************
*** 453,457 ****
{
string symbol;
! int index;
switch(argc)
--- 448,452 ----
{
string symbol;
! int index=0;
switch(argc)
Index: h_vector.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_vector.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** h_vector.cpp 5 May 2005 23:00:56 -0000 1.3
--- h_vector.cpp 9 Oct 2005 21:50:57 -0000 1.4
***************
*** 66,73 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hvector->pushBack(key);
}
--- 66,70 ----
if(argc)
{
! Element key(argc,argv);
x->hvector->pushBack(key);
}
***************
*** 109,160 ****
// symbol without selector "symbol":
if(argc == 0)
! {
! x->value.length = 1;
! SETSYMBOL(x->value.atom, s);
! x->event_set = true;
! return;
! }
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0) && (strcmp(s->s_name,"symbol")!=0) )
! {
! t_atom *atoms = new t_atom[argc+1];
// add the selector symbol to the list:
! SETSYMBOL(atoms, s);
! for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! }
! if (x->value.length != argc+1)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc+1;
! x->value.atom = (t_atom*)copybytes(atoms, (argc+1) * sizeof(t_atom));
! } else memcpy(x->value.atom, atoms, (argc+1) * sizeof(t_atom));
! x->event_set = true;
! delete[] atoms;
! return;
! }
// "normal" input (list, float or symbol):
if (argc)
! {
! if (x->value.length != argc)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc;
! x->value.atom = (t_atom*)copybytes(argv, argc * sizeof(t_atom));
! } else memcpy(x->value.atom, argv, argc * sizeof(t_atom));
! x->event_set = true;
! return;
! }
}
--- 106,152 ----
// symbol without selector "symbol":
if(argc == 0)
! {
! t_atom tmp;
! SETSYMBOL(&tmp, s);
! x->value.setAtoms(1, &tmp);
! x->event_set = true;
! return;
! }
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0)
! && (strcmp(s->s_name,"symbol")!=0)
! && (strcmp(s->s_name,"pointer")!=0) )
! {
! t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
// add the selector symbol to the list:
! SETSYMBOL(atoms, s);
! for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! if(argv[i].a_type == A_POINTER)
! SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
! }
! x->value.setAtoms(argc+1, atoms);
! x->event_set = true;
! freebytes(atoms, (argc+1)*sizeof(t_atom));
! return;
! }
// "normal" input (list, float or symbol):
if (argc)
! {
! x->value.setAtoms(argc, argv);
! x->event_set = true;
! return;
! }
}
***************
*** 178,192 ****
Element output = x->hvector->get( index );
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
--- 170,186 ----
Element output = x->hvector->get( index );
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
***************
*** 313,317 ****
{
string symbol;
! int index;
switch(argc)
--- 307,311 ----
{
string symbol;
! int index=0;
switch(argc)
***************
*** 372,376 ****
{
string symbol;
! int index;
switch(argc)
--- 366,370 ----
{
string symbol;
! int index=0;
switch(argc)
Index: h_list.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_list.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** h_list.cpp 5 May 2005 23:00:56 -0000 1.5
--- h_list.cpp 9 Oct 2005 21:50:57 -0000 1.6
***************
*** 29,36 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hlist->pushBack(key);
}
--- 29,33 ----
if(argc)
{
! Element key(argc,argv);
x->hlist->pushBack(key);
}
***************
*** 54,61 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hlist->pushFront(key);
}
--- 51,55 ----
if(argc)
{
! Element key(argc,argv);
x->hlist->pushFront(key);
}
***************
*** 85,101 ****
Element output = x->hlist->back();
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
}
--- 79,99 ----
Element output = x->hlist->back();
! if(output.getLength() == 1) // symbol, float or pointer
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
+
+ outlet_bang(x->out3);
}
***************
*** 110,126 ****
Element output = x->hlist->front();
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
}
--- 108,128 ----
Element output = x->hlist->front();
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
+
+ outlet_bang(x->out3);
}
***************
*** 133,149 ****
}
! Element output = x->hlist->get();
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
--- 135,164 ----
}
! Element output;
! try
! { output = x->hlist->get(); }
!
! catch(const char* s)
! {
! // if there was no Element found, put out a bang at the right outlet
! post("%s", s);
! outlet_bang(x->out3);
! return;
! }
!
! if(output.getLength() == 1) // symbol or float
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
***************
*** 156,163 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hlist->insert(key);
}
--- 171,175 ----
if(argc)
{
! Element key(argc,argv);
x->hlist->insert(key);
}
***************
*** 170,177 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hlist->modify(key);
}
--- 182,186 ----
if(argc)
{
! Element key(argc,argv);
x->hlist->modify(key);
}
***************
*** 184,191 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hlist->remove(key);
}
--- 193,197 ----
if(argc)
{
! Element key(argc,argv);
x->hlist->remove(key);
}
Index: h_map.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_map.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** h_map.cpp 5 May 2005 23:00:56 -0000 1.3
--- h_map.cpp 9 Oct 2005 21:50:57 -0000 1.4
***************
*** 45,54 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hmap->add(key, x->value);
-
x->event_set = false;
}
--- 45,50 ----
if(argc)
{
! Element key(argc,argv);
x->hmap->add(key, x->value);
x->event_set = false;
}
***************
*** 64,69 ****
if(argc == 0)
{
! x->value.length = 1;
! SETSYMBOL(x->value.atom, s);
x->event_set = true;
return;
--- 60,66 ----
if(argc == 0)
{
! t_atom tmp;
! SETSYMBOL(&tmp, s);
! x->value.setAtoms(1, &tmp);
x->event_set = true;
return;
***************
*** 72,78 ****
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0) && (strcmp(s->s_name,"symbol")!=0) )
{
! t_atom *atoms = new t_atom[argc+1];
// add the selector symbol to the list:
--- 69,77 ----
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0)
! && (strcmp(s->s_name,"symbol")!=0)
! && (strcmp(s->s_name,"pointer")!=0) )
{
! t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
// add the selector symbol to the list:
***************
*** 80,111 ****
for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! }
! if (x->value.length != argc+1)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc+1;
! x->value.atom = (t_atom*)copybytes(atoms, (argc+1) * sizeof(t_atom));
! } else memcpy(x->value.atom, atoms, (argc+1) * sizeof(t_atom));
x->event_set = true;
! delete[] atoms;
return;
}
! // "normal" input (list, float or symbol):
if (argc)
{
! if (x->value.length != argc)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc;
! x->value.atom = (t_atom*)copybytes(argv, argc * sizeof(t_atom));
! } else memcpy(x->value.atom, argv, argc * sizeof(t_atom));
x->event_set = true;
return;
--- 79,102 ----
for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! if(argv[i].a_type == A_POINTER)
! SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
! }
! x->value.setAtoms(argc+1, atoms);
x->event_set = true;
! freebytes(atoms, (argc+1)*sizeof(t_atom));
return;
}
! // "normal" input (list, float, symbol or pointer):
if (argc)
{
! x->value.setAtoms(argc, argv);
x->event_set = true;
return;
***************
*** 119,141 ****
post("h_map, get: no arguments");
return;
! }
!
! Element key;
! key.length = argc;
! key.atom = argv;
! Element output = x->hmap->get( key );
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
return;
}
! if(output.length > 1) // list
{
! outlet_list(x->out0,&s_list,output.length,output.atom);
return;
}
--- 110,142 ----
post("h_map, get: no arguments");
return;
! }
! Element key(argc,argv);
! Element output;
! try
! { output = x->hmap->get( key ); }
!
! catch(const char* s)
! {
! // if there was no Element found, put out a bang at the right outlet
! post("%s", s);
! outlet_bang(x->out2);
! return;
! }
!
! if(output.getLength() == 1) // symbol, float or pointer
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
return;
}
! if(output.getLength() > 1) // list
{
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
return;
}
***************
*** 151,161 ****
post("h_map, remove: no arguments");
return;
! }
!
! Element key;
! key.length = argc;
! key.atom = argv;
! x->hmap->remove( key );
}
--- 152,164 ----
post("h_map, remove: no arguments");
return;
! }
! Element key(argc,argv);
!
! try
! { x->hmap->remove( key ); }
!
! catch(const char* s)
! { post("%s", s); }
}
Index: PDContainer.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/PDContainer.cpp,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** PDContainer.cpp 25 Oct 2004 19:02:30 -0000 1.1.1.1
--- PDContainer.cpp 9 Oct 2005 21:50:57 -0000 1.2
***************
*** 30,34 ****
post("Library (STL) of C++");
post("for documentation see the help patches");
! post("(by Georg Holzmann <grh(a)gmx.at>, 2004)");
post("------------------------------------------\n");
}
--- 30,34 ----
post("Library (STL) of C++");
post("for documentation see the help patches");
! post("(by Georg Holzmann <grh(a)mur.at>, 2004)");
post("------------------------------------------\n");
}
***************
*** 70,74 ****
//-end-----------------------------------------------
! post("\nPD-Container, Version: "PDC_VERSION", by Georg Holzmann <grh(a)gmx.at>, 2004");
// without an argument the following two methods wont work ??? why?? because of c++?
--- 70,74 ----
//-end-----------------------------------------------
! post("\nPD-Container, Version: "PDC_VERSION", by Georg Holzmann <grh(a)mur.at>, 2004-2005");
// 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.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** h_set.cpp 5 May 2005 23:00:56 -0000 1.3
--- h_set.cpp 9 Oct 2005 21:50:57 -0000 1.4
***************
*** 33,40 ****
}
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hset->add( key );
}
--- 33,37 ----
}
! Element key(argc,argv);
x->hset->add( key );
}
***************
*** 48,55 ****
}
! Element key;
! key.length = argc;
! key.atom = argv;
!
int output = x->hset->get( key );
--- 45,49 ----
}
! Element key(argc,argv);
int output = x->hset->get( key );
***************
*** 65,72 ****
}
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hset->remove( key );
}
--- 59,63 ----
}
! Element key(argc,argv);
x->hset->remove( key );
}
Index: h_multimap.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/PDContainer/src/h_multimap.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** h_multimap.cpp 5 May 2005 23:00:56 -0000 1.3
--- h_multimap.cpp 9 Oct 2005 21:50:57 -0000 1.4
***************
*** 45,54 ****
if(argc)
{
! Element key;
! key.length = argc;
! key.atom = argv;
!
x->hmultimap->add(key, x->value);
-
x->event_set = false;
}
--- 45,50 ----
if(argc)
{
! Element key(argc,argv);
x->hmultimap->add(key, x->value);
x->event_set = false;
}
***************
*** 63,114 ****
// symbol without selector "symbol":
if(argc == 0)
! {
! x->value.length = 1;
! SETSYMBOL(x->value.atom, s);
! x->event_set = true;
! return;
! }
// input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0) && (strcmp(s->s_name,"symbol")!=0) )
! {
! t_atom *atoms = new t_atom[argc+1];
// add the selector symbol to the list:
! SETSYMBOL(atoms, s);
! for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! }
! if (x->value.length != argc+1)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc+1;
! x->value.atom = (t_atom*)copybytes(atoms, (argc+1) * sizeof(t_atom));
! } else memcpy(x->value.atom, atoms, (argc+1) * sizeof(t_atom));
! x->event_set = true;
! delete[] atoms;
! return;
! }
! // "normal" input (list, float or symbol):
if (argc)
! {
! if (x->value.length != argc)
! {
! freebytes(x->value.atom, x->value.length * sizeof(t_atom));
! x->value.length = argc;
! x->value.atom = (t_atom*)copybytes(argv, argc * sizeof(t_atom));
! } else memcpy(x->value.atom, argv, argc * sizeof(t_atom));
! x->event_set = true;
! return;
! }
}
--- 59,106 ----
// symbol without selector "symbol":
if(argc == 0)
! {
! t_atom tmp;
! SETSYMBOL(&tmp, s);
! x->value.setAtoms(1, &tmp);
! x->event_set = true;
! return;
! }
// input is a list without selector "list":
+ // input is a list without selector "list":
if ( argc && (strcmp(s->s_name,"list")!=0)
! && (strcmp(s->s_name,"float")!=0)
! && (strcmp(s->s_name,"symbol")!=0)
! && (strcmp(s->s_name,"pointer")!=0) )
! {
! t_atom *atoms = (t_atom*)getbytes( (argc+1)*sizeof(t_atom) );
// add the selector symbol to the list:
! SETSYMBOL(atoms, s);
! for(int i=0; i<argc; i++)
! {
! if(argv[i].a_type == A_FLOAT)
! SETFLOAT(&atoms[i+1],argv[i].a_w.w_float);
! if(argv[i].a_type == A_SYMBOL)
! SETSYMBOL(&atoms[i+1],argv[i].a_w.w_symbol);
! if(argv[i].a_type == A_POINTER)
! SETPOINTER(&atoms[i+1],argv[i].a_w.w_gpointer);
! }
! x->value.setAtoms(argc+1, atoms);
! x->event_set = true;
! freebytes(atoms, (argc+1)*sizeof(t_atom));
! return;
! }
! // "normal" input (list, float, symbol or pointer):
if (argc)
! {
! x->value.setAtoms(argc, argv);
! x->event_set = true;
! return;
! }
}
***************
*** 123,129 ****
// outputs all the values of one key one after an other
! Element key;
! key.length = argc;
! key.atom = argv;
int value_nr = x->hmultimap->getNr( key );
--- 115,119 ----
// outputs all the values of one key one after an other
! Element key(argc,argv);
int value_nr = x->hmultimap->getNr( key );
***************
*** 132,150 ****
for(int i=0; i < value_nr; i++)
{
! Element output(x->hmultimap->get(key, i));
! // check if there exists an value
! if(&output == 0)
continue;
! if(output.length == 1) // symbol or float
{
! if (output.atom[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.atom[0].a_w.w_float);
!
! if (output.atom[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.atom[0].a_w.w_symbol);
}
! if(output.length > 1) // list
! outlet_list(x->out0,&s_list,output.length,output.atom);
}
}
--- 122,145 ----
for(int i=0; i < value_nr; i++)
{
! Element output;
! try
! { output = x->hmultimap->get(key, i); }
! catch(const char* s)
! {
! post("%s", s);
continue;
+ }
! if(output.getLength() == 1) // symbol, float or pointer
{
! if (output.getAtom()[0].a_type == A_FLOAT)
! outlet_float(x->out0, output.getAtom()[0].a_w.w_float);
! if (output.getAtom()[0].a_type == A_SYMBOL)
! outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol);
! if (output.getAtom()[0].a_type == A_POINTER)
! outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer);
}
! if(output.getLength() > 1) // list
! outlet_list(x->out0,&s_list,output.getLength(),output.getAtom());
}
}
***************
*** 158,166 ****
}
! Element key;
! key.length = argc;
! key.atom = argv;
!
! x->hmultimap->remove( key );
}
--- 153,161 ----
}
! Element key(argc,argv);
! try
! { x->hmultimap->remove( key ); }
! catch(const char* s)
! { post("%s", s); }
}