[PD-cvs] pd/src m_pd.h, 1.4.4.11.2.20, 1.4.4.11.2.21 m_class.c, 1.3.4.7.2.15, 1.3.4.7.2.16 m_glob.c, 1.4.4.2.2.6, 1.4.4.2.2.7 m_hash.c, 1.1.2.2, 1.1.2.3 desire.tk, 1.1.2.173, 1.1.2.174
Mathieu Bouchard
matju at users.sourceforge.net
Sat Apr 22 02:43:42 CEST 2006
- Previous message: [PD-cvs] pd/src m_pd.h, 1.4.4.11.2.19, 1.4.4.11.2.20 m_hash.c, 1.1.2.1, 1.1.2.2
- Next message: [PD-cvs] pd/src m_class.c, 1.3.4.7.2.16, 1.3.4.7.2.17 s_main.c, 1.7.4.17.2.12, 1.7.4.17.2.13 desire.tk, 1.1.2.174, 1.1.2.175 m_hash.c, 1.1.2.3, 1.1.2.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18013
Modified Files:
Tag: devel_0_39
m_pd.h m_class.c m_glob.c m_hash.c desire.tk
Log Message:
hash-based classlist
Index: m_class.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_class.c,v
retrieving revision 1.3.4.7.2.15
retrieving revision 1.3.4.7.2.16
diff -C2 -d -r1.3.4.7.2.15 -r1.3.4.7.2.16
*** m_class.c 21 Apr 2006 09:03:20 -0000 1.3.4.7.2.15
--- m_class.c 22 Apr 2006 00:43:40 -0000 1.3.4.7.2.16
***************
*** 28,39 ****
#ifdef DESIRE
! typedef struct t_class_list {
! t_class *head;
! struct t_class_list *tail;
! } t_class_list;
! static t_class_list *class_list = 0;
#endif
-
static t_symbol *class_loadsym; /* name under which an extern is invoked */
static void pd_defaultfloat(t_pd *x, t_float f);
--- 28,34 ----
#ifdef DESIRE
! t_hash *class_table=0;
#endif
static t_symbol *class_loadsym; /* name under which an extern is invoked */
static void pd_defaultfloat(t_pd *x, t_float f);
***************
*** 268,277 ****
#ifdef DESIRE
! {
! t_class_list *tc = (t_class_list *) malloc(sizeof(t_class_list));
! tc->head = c;
! tc->tail = class_list;
! class_list=tc;
! }
#endif
return (c);
--- 263,267 ----
#ifdef DESIRE
! hash_set(class_table, c->c_name, c);
#endif
return (c);
***************
*** 1024,1032 ****
/* O(n) asymptotic time :-} */
/* only looks for already loaded classes though. */
! t_class *class_find (t_symbol *s) {
! t_class_list *me = class_list;
! for (; me; me=me->tail) if (me->head->c_name == s) return me->head;
! return 0;
! }
void glob_update_class_info (t_pd *bogus, t_symbol *s, t_symbol *cb_recv, t_symbol *cb_sel) {
--- 1014,1019 ----
/* O(n) asymptotic time :-} */
/* only looks for already loaded classes though. */
!
! t_class *class_find (t_symbol *s) {return hash_get(class_table,s);}
void glob_update_class_info (t_pd *bogus, t_symbol *s, t_symbol *cb_recv, t_symbol *cb_sel) {
Index: m_hash.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_hash.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** m_hash.c 21 Apr 2006 23:06:13 -0000 1.1.2.2
--- m_hash.c 22 Apr 2006 00:43:40 -0000 1.1.2.3
***************
*** 17,20 ****
--- 17,23 ----
long size;
t_hashentry **tab;
+ /* when iterating: */
+ long i;
+ t_hashentry *next;
};
***************
*** 24,27 ****
--- 27,31 ----
self->capa = capa;
self->size = 0;
+ self->i = 0;
self->tab = (t_hashentry **)malloc(capa*sizeof(void*));
for (i=0; i<capa; i++) self->tab[i]=0;
***************
*** 30,33 ****
--- 34,49 ----
long hash_size(t_hash *self) {return self->size;}
+ void hash_start(t_hash *self) {self->i=0; self->next=0;}
+ int hash_next(t_hash *self, hashkey *kp, hashvalue *vp) {
+ while (!self->next && self->i<self->capa) self->next = self->tab[self->i++];
+ if (self->next) {
+ *kp = self->next->k;
+ *vp = self->next->v;
+ self->next = self->next->next;
+ return 1;
+ }
+ return 0;
+ }
+
void hash_each(t_hash *self, hash_iter f, void *data) {
long i;
***************
*** 56,63 ****
return 0;
}
!
void hash_set(t_hash *self, hashkey k, hashvalue v) {
long h = hash_hash(self,k);
t_hashentry *e;
for (e=self->tab[h]; e; e=e->next) {if (e->k==k) {e->v=v; return;}}
t_hashentry *nu = malloc(sizeof(t_hashentry));
--- 72,80 ----
return 0;
}
! #include<stdio.h>
void hash_set(t_hash *self, hashkey k, hashvalue v) {
long h = hash_hash(self,k);
t_hashentry *e;
+ printf("hash_set %p %p %p\n",self,k,v);
for (e=self->tab[h]; e; e=e->next) {if (e->k==k) {e->v=v; return;}}
t_hashentry *nu = malloc(sizeof(t_hashentry));
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.173
retrieving revision 1.1.2.174
diff -C2 -d -r1.1.2.173 -r1.1.2.174
*** desire.tk 21 Apr 2006 21:41:07 -0000 1.1.2.173
--- desire.tk 22 Apr 2006 00:43:40 -0000 1.1.2.174
***************
*** 3229,3233 ****
set n 0
$f.1 delete 0 end
! foreach class [luniq [lsort $class_list]] {
if {[string length $s]==0 || [string first $s $class]>=0} {
$f.1 insert end "$class"
--- 3229,3233 ----
set n 0
$f.1 delete 0 end
! foreach class $class_list {
if {[string length $s]==0 || [string first $s $class]>=0} {
$f.1 insert end "$class"
***************
*** 3252,3256 ****
--- 3252,3261 ----
def ClassBrowser list_callback {} {
global class_list
+
+ set class_list [luniq [lsort $class_list]]
+ puts "class_list = [list $class_list]"
+ puts "([llength $class_list])"
$self search_for_externs
+ set class_list [luniq [lsort $class_list]]
toplevel .browser
set f .browser.cl
Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.4.4.11.2.20
retrieving revision 1.4.4.11.2.21
diff -C2 -d -r1.4.4.11.2.20 -r1.4.4.11.2.21
*** m_pd.h 21 Apr 2006 23:06:13 -0000 1.4.4.11.2.20
--- m_pd.h 22 Apr 2006 00:43:40 -0000 1.4.4.11.2.21
***************
*** 168,172 ****
t_hash * hash_new(long capa);
long hash_size(t_hash *self);
! void hash_each(t_hash *self, hash_iter f, void *data);
hashvalue hash_get(t_hash *self, hashkey k);
void hash_set(t_hash *self, hashkey k, hashvalue v);
--- 168,175 ----
t_hash * hash_new(long capa);
long hash_size(t_hash *self);
! void hash_start(t_hash *self);
! int hash_next(t_hash *self, hashkey *kp, hashvalue *vp);
! #define hash_foreach(k,v,h) for (hash_start(h); hash_next(h,&k,&v); )
!
hashvalue hash_get(t_hash *self, hashkey k);
void hash_set(t_hash *self, hashkey k, hashvalue v);
Index: m_glob.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_glob.c,v
retrieving revision 1.4.4.2.2.6
retrieving revision 1.4.4.2.2.7
diff -C2 -d -r1.4.4.2.2.6 -r1.4.4.2.2.7
*** m_glob.c 21 Apr 2006 08:46:14 -0000 1.4.4.2.2.6
--- m_glob.c 22 Apr 2006 00:43:40 -0000 1.4.4.2.2.7
***************
*** 107,117 ****
}
void glob_update_class_list (t_pd *self, t_symbol *cb_recv, t_symbol *cb_sel) {
- int i;
int n = pd_objectmaker->c_nmethod;
sys_gui("global class_list; set class_list {");
! for (i=0; i<n; i++) {
! sys_vgui("%s ", pd_objectmaker->c_methods[i].me_name->s_name);
! }
sys_gui("}\n");
sys_vgui("%s %s\n",cb_recv->s_name, cb_sel->s_name);
--- 107,116 ----
}
+ EXTERN t_hash *class_table;
void glob_update_class_list (t_pd *self, t_symbol *cb_recv, t_symbol *cb_sel) {
int n = pd_objectmaker->c_nmethod;
+ hashkey k; hashvalue v;
sys_gui("global class_list; set class_list {");
! hash_foreach(k,v,class_table) sys_vgui("%s ", ((t_symbol *)k)->s_name);
sys_gui("}\n");
sys_vgui("%s %s\n",cb_recv->s_name, cb_sel->s_name);
- Previous message: [PD-cvs] pd/src m_pd.h, 1.4.4.11.2.19, 1.4.4.11.2.20 m_hash.c, 1.1.2.1, 1.1.2.2
- Next message: [PD-cvs] pd/src m_class.c, 1.3.4.7.2.16, 1.3.4.7.2.17 s_main.c, 1.7.4.17.2.12, 1.7.4.17.2.13 desire.tk, 1.1.2.174, 1.1.2.175 m_hash.c, 1.1.2.3, 1.1.2.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list