[PD-cvs] pd/src m_pd.h, 1.4.4.11.2.17, 1.4.4.11.2.18 m_class.c, 1.3.4.7.2.13, 1.3.4.7.2.14 m_glob.c, 1.4.4.2.2.5, 1.4.4.2.2.6 s_path.c, 1.3.4.6.2.5, 1.3.4.6.2.6

Mathieu Bouchard matju at users.sourceforge.net
Fri Apr 21 10:46:16 CEST 2006


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22638

Modified Files:
      Tag: devel_0_39
	m_pd.h m_class.c m_glob.c s_path.c 
Log Message:
class browser code, server side


Index: m_class.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_class.c,v
retrieving revision 1.3.4.7.2.13
retrieving revision 1.3.4.7.2.14
diff -C2 -d -r1.3.4.7.2.13 -r1.3.4.7.2.14
*** m_class.c	14 Mar 2006 13:17:35 -0000	1.3.4.7.2.13
--- m_class.c	21 Apr 2006 08:46:14 -0000	1.3.4.7.2.14
***************
*** 1004,1006 ****
--- 1004,1050 ----
  	return -1;
  }
+ 
+ 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_symbol *cb_recv, t_symbol *cb_sel) {
+     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("}]; %s %s %s\n",cb_recv->s_name, cb_sel->s_name, s->s_name);
+ }
+ 
+ 
  #endif

Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.4.4.11.2.17
retrieving revision 1.4.4.11.2.18
diff -C2 -d -r1.4.4.11.2.17 -r1.4.4.11.2.18
*** m_pd.h	9 Mar 2006 14:22:51 -0000	1.4.4.11.2.17
--- m_pd.h	21 Apr 2006 08:46:14 -0000	1.4.4.11.2.18
***************
*** 445,448 ****
--- 445,449 ----
  #endif
  
+ EXTERN t_class *class_find (t_symbol *s);
  EXTERN t_class *class_new(t_symbol *name, t_newmethod newmethod,
      t_method freemethod, size_t size, int flags, t_atomtypearg arg1, ...);

Index: s_path.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_path.c,v
retrieving revision 1.3.4.6.2.5
retrieving revision 1.3.4.6.2.6
diff -C2 -d -r1.3.4.6.2.5 -r1.3.4.6.2.6
*** s_path.c	30 Nov 2005 13:36:58 -0000	1.3.4.6.2.5
--- s_path.c	21 Apr 2006 08:46:14 -0000	1.3.4.6.2.6
***************
*** 615,616 ****
--- 615,624 ----
  
  
+ #ifdef DESIRE
+ void glob_update_path (void) {
+     t_namelist *nl;
+     sys_vgui("global pd_path; set pd_path {");
+     for (nl=sys_searchpath; nl; nl=nl->nl_next) sys_vgui("%s ",nl->nl_string);
+     sys_vgui("}\n");
+ }
+ #endif

Index: m_glob.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_glob.c,v
retrieving revision 1.4.4.2.2.5
retrieving revision 1.4.4.2.2.6
diff -C2 -d -r1.4.4.2.2.5 -r1.4.4.2.2.6
*** m_glob.c	20 Apr 2006 13:32:33 -0000	1.4.4.2.2.5
--- m_glob.c	21 Apr 2006 08:46:14 -0000	1.4.4.2.2.6
***************
*** 93,96 ****
--- 93,126 ----
  }
  
+ #ifdef DESIRE
+ char *class_gethelpdir(t_class *c);
+ #include <string.h>
+ /* see also canvas_done_popup */
+ void glob_help(t_pd *bogus, t_symbol *s) {
+         char namebuf[MAXPDSTRING], *dir;
+         t_class *c = class_find(s);
+         if (!c) { post("HUH? no help because no class. (!)"); return; }
+         strcpy(namebuf, class_gethelpname(c));
+         dir = class_gethelpdir(c);
+         if (strcmp(namebuf + strlen(namebuf) - 3, ".pd")) strcat(namebuf, ".pd");
+         open_via_helppath(namebuf, dir);
+ }
+ 
+ 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);
+ }
+ #endif
+ 
+ EXTERN void glob_update_class_info (t_pd *bogus, t_symbol *s, t_symbol *cb_recv, t_symbol *cb_sel);
+ EXTERN void glob_update_path (void);
+ EXTERN void glob_redraw (void);
+ 
  void glob_init(void)
  {
***************
*** 173,176 ****
--- 203,218 ----
          gensym("getaudiodevice"), 0);  
  	/* tb } */
+ #ifdef DESIRE
+     class_addmethod(glob_pdobject, (t_method)glob_update_class_list,
+         gensym("update-class-list"), A_SYMBOL, A_SYMBOL, 0);
+     class_addmethod(glob_pdobject, (t_method)glob_update_class_info,
+         gensym("update-class-info"), A_SYMBOL, A_SYMBOL, A_SYMBOL, 0);
+     class_addmethod(glob_pdobject, (t_method)glob_update_path,
+         gensym("update-path"), 0);
+     class_addmethod(glob_pdobject, (t_method)glob_help,
+         gensym("help"), A_SYMBOL, 0);
+     class_addmethod(glob_pdobject, (t_method)glob_redraw,
+         gensym("redraw"), 0);
+ #endif
  #ifdef UNIX
      class_addmethod(glob_pdobject, (t_method)glob_watchdog,





More information about the Pd-cvs mailing list