Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9804
Modified Files: Tag: devel_0_37 m_class.c Log Message: added class browser thingies: t_class_list, class_list, class_find(), glob_update_class_info()
Index: m_class.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_class.c,v retrieving revision 1.1.1.2.2.5 retrieving revision 1.1.1.2.2.6 diff -C2 -d -r1.1.1.2.2.5 -r1.1.1.2.2.6 *** m_class.c 23 Jul 2004 08:46:40 -0000 1.1.1.2.2.5 --- m_class.c 25 Oct 2004 15:19:30 -0000 1.1.1.2.2.6 *************** *** 127,130 **** --- 127,175 ---- }
+ /* matju (for class browser) { */ + + typedef struct t_class_list { + t_class *head; + struct t_class_list *tail; + } t_class_list; + + static t_class_list *class_list = 0; + + /* 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_class *c = class_find(s); + if (!c) { post("class not found!"); return; } + sys_vgui("global class_info; set class_info(%s) [list " + "helpname "%s" externdir "%s" size "%d" " + /* + t_methodentry *c_methods; int c_nmethod; + t_method c_freemethod; + struct _widgetbehavior *c_wb; + struct _parentwidgetbehavior *c_pwb; + t_savefn c_savefn; + t_propertiesfn c_propertiesfn; + int c_floatsignalin; + */ + "gobj "%d" patchable "%d" firstin "%d" " + "firsttip "%s" methods {",s->s_name,c->c_helpname->s_name,c->c_externdir->s_name, + c->c_size,c->c_gobj,c->c_patchable,c->c_firstin,c->c_firsttip->s_name); + if (c-> c_bangmethod != pd_defaultbang) sys_vgui("<bang> "); + if (c->c_pointermethod != pd_defaultpointer) sys_vgui("<pointer> "); + if (c-> c_floatmethod != pd_defaultfloat) sys_vgui("<float> "); + if (c-> c_symbolmethod != pd_defaultsymbol) sys_vgui("<symbol> "); + if (c-> c_listmethod != pd_defaultlist) sys_vgui("<list> "); + if (c-> c_anymethod != pd_defaultanything) sys_vgui("<any> "); + {int i; for (i=0; i<c->c_nmethod; i++) sys_vgui("%s ",c->c_methods[i].me_name->s_name);} + sys_vgui("}]; class_info_callback %s\n",s->s_name); + } + + /* } matju */ + /* for now we assume that all "gobjs" are text unless explicitly overridden later by calling class_setbehavior(). I'm not sure