[PD-cvs] externals/hcs sql_query.c, 1.5, 1.6 sql_query-help.pd, 1.3, 1.4

Hans-Christoph Steiner eighthave at users.sourceforge.net
Sun Dec 23 02:28:52 CET 2007


Update of /cvsroot/pure-data/externals/hcs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7788

Modified Files:
	sql_query.c sql_query-help.pd 
Log Message:

- first working version, called proxy_inlet_setup() function, and fixed proxy
  inlet ID assignment.

- left inlet is now properly hot

- cleaned out debug post()s


Index: sql_query-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/sql_query-help.pd,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sql_query-help.pd	22 Dec 2007 23:39:13 -0000	1.3
--- sql_query-help.pd	23 Dec 2007 01:28:49 -0000	1.4
***************
*** 1,5 ****
  #N canvas 238 82 613 618 10;
  #X obj 362 244 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144
! -1 -1 0 1;
  #X floatatom 420 276 5 0 0 0 - - -;
  #X text 395 223 age;
--- 1,5 ----
  #N canvas 238 82 613 618 10;
  #X obj 362 244 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144
! -1 -1 4800 1;
  #X floatatom 420 276 5 0 0 0 - - -;
  #X text 395 223 age;
***************
*** 27,30 ****
--- 27,38 ----
  #X msg 39 235 bang;
  #X msg 177 268 234;
+ #X msg 480 275 symbol twenty;
+ #X msg 116 76 fred;
+ #X msg 174 77 one;
+ #X msg 234 78 2;
+ #X msg 287 78 3;
+ #X msg 345 78 4;
+ #X obj 117 155 pddp/print;
+ #X obj 344 131 pddp/print;
  #X connect 0 0 11 1;
  #X connect 1 0 11 1;
***************
*** 37,40 ****
--- 45,56 ----
  #X connect 11 0 3 0;
  #X connect 11 1 3 1;
+ #X connect 12 0 21 0;
+ #X connect 12 1 22 0;
  #X connect 13 0 11 0;
  #X connect 14 0 11 0;
+ #X connect 15 0 11 1;
+ #X connect 16 0 12 0;
+ #X connect 17 0 12 1;
+ #X connect 18 0 12 2;
+ #X connect 19 0 12 3;
+ #X connect 20 0 12 4;

Index: sql_query.c
===================================================================
RCS file: /cvsroot/pure-data/externals/hcs/sql_query.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** sql_query.c	22 Dec 2007 23:39:13 -0000	1.5
--- sql_query.c	23 Dec 2007 01:28:49 -0000	1.6
***************
*** 35,40 ****
  #include <string.h>
  
! //#define DEBUG(x)
! #define DEBUG(x) x 
  
  #define PLACEHOLDER  '?'
--- 35,40 ----
  #include <string.h>
  
! #define DEBUG(x)
! //#define DEBUG(x) x 
  
  #define PLACEHOLDER  '?'
***************
*** 60,64 ****
      t_binbuf*           x_query_binbuf;   // binbuf for converting args to string
      
!     struct _proxy_inlet*inlets;           // pointer to array of _proxy_inlets
      t_atom*             atoms;            // pointer to array of atoms
      unsigned int        placeholder_count;// number of items in above arrays
--- 60,64 ----
      t_binbuf*           x_query_binbuf;   // binbuf for converting args to string
      
!     t_proxy_inlet*      inlets;           // pointer to array of _proxy_inlets
      t_atom*             atoms;            // pointer to array of atoms
      unsigned int        placeholder_count;// number of items in above arrays
***************
*** 72,76 ****
   * FUNCTION PROTOTYPES
   */
! static void sql_query_set_atom(t_sql_query *x, int atom_num, t_symbol *s, t_atom *atom);
  
  /*------------------------------------------------------------------------------
--- 72,77 ----
   * FUNCTION PROTOTYPES
   */
! static void sql_query_set_atom(t_sql_query *x, int atom_num, t_symbol *s, 
!                                int argc, t_atom *a);
  
  /*------------------------------------------------------------------------------
***************
*** 80,83 ****
--- 81,85 ----
  static void proxy_inlet_new(t_proxy_inlet *p, t_object *owner, unsigned int id) 
  {
+ 	DEBUG(post("proxy_inlet_new"););
  	p->pd = proxy_inlet_class;
  	p->owner = owner;
***************
*** 86,96 ****
  }
  
- 
- 
- 
  static void proxy_inlet_anything(t_proxy_inlet *p, t_symbol *s, int argc, t_atom *argv)
  {
! 	post("proxy_inlet_anything: %s %d", s->s_name, argc);
!     sql_query_set_atom(p->owner, p->id, s, argv);
  }
  
--- 88,95 ----
  }
  
  static void proxy_inlet_anything(t_proxy_inlet *p, t_symbol *s, int argc, t_atom *argv)
  {
! 	DEBUG(post("proxy_inlet_anything"););
!     sql_query_set_atom(p->owner, p->id, s, argc, argv);
  }
  
***************
*** 112,135 ****
   */
  
! static void sql_query_set_atom(t_sql_query *x, int atom_num, t_symbol *s, t_atom *a)
  {
      DEBUG(post("sql_query_set_atom"););
      if( (s == &s_symbol) || (s == &s_list) || (s == &s_float) )
-     {
-         char buf[MAXPDSTRING];
-         atom_string(a, &buf, MAXPDSTRING);
          x->atoms[atom_num] = *a;
-         post("symbol/list set %s", buf);
-     }
      else
-     {
          SETSYMBOL(&x->atoms[atom_num], s);
-         post("selector set %s", s->s_name);
-     }
- }
- 
- static void sql_query_anything(t_sql_query *x, t_symbol *s, int argc, t_atom *argv) 
- {
-     sql_query_set_atom(x, 0, s, argv);
  }
  
--- 111,122 ----
   */
  
! static void sql_query_set_atom(t_sql_query *x, int atom_num, t_symbol *s, 
!                                int argc, t_atom *a)
  {
      DEBUG(post("sql_query_set_atom"););
      if( (s == &s_symbol) || (s == &s_list) || (s == &s_float) )
          x->atoms[atom_num] = *a;
      else
          SETSYMBOL(&x->atoms[atom_num], s);
  }
  
***************
*** 143,146 ****
--- 130,139 ----
  }
  
+ static void sql_query_anything(t_sql_query *x, t_symbol *s, int argc, t_atom *argv) 
+ {
+     sql_query_set_atom(x, 0, s, argc, argv);
+     sql_query_output(x);
+ }
+ 
  static void sql_query_free(t_sql_query *x) 
  {
***************
*** 157,160 ****
--- 150,155 ----
  	t_sql_query *x = (t_sql_query *)pd_new(sql_query_class);
  
+     proxy_inlet_setup();
+ 
      x->x_query_binbuf = binbuf_new();
      binbuf_add(x->x_query_binbuf, argc, argv);
***************
*** 166,186 ****
      while (current != NULL)
      {
-         post("found placeholder %c", PLACEHOLDER);
          x->placeholder_count++;
          current = strchr(current + 1, PLACEHOLDER);
      }
!     post("creating %d inlets", x->placeholder_count);
      x->inlets = getbytes(x->placeholder_count * sizeof(t_proxy_inlet));
!     for(i=1; i< x->placeholder_count; ++i)
!     {
!         proxy_inlet_new(&x->inlets[i], (t_object *)x, x->placeholder_count);
!         post("\tinlet %d", i);
!     }
! 
      x->atoms = getbytes(x->placeholder_count * sizeof(t_atom));
!     for(i=0; i< x->placeholder_count; ++i)
!     {
          SETSYMBOL(&x->atoms[i], &s_);
-     }
  
  	x->x_data_outlet = outlet_new(&x->x_obj, 0);
--- 161,175 ----
      while (current != NULL)
      {
          x->placeholder_count++;
          current = strchr(current + 1, PLACEHOLDER);
      }
!     
      x->inlets = getbytes(x->placeholder_count * sizeof(t_proxy_inlet));
!     for(i = 1; i < x->placeholder_count; ++i)
!         proxy_inlet_new(&x->inlets[i], (t_object *)x, i);
!     
      x->atoms = getbytes(x->placeholder_count * sizeof(t_atom));
!     for(i = 0; i < x->placeholder_count; ++i)
          SETSYMBOL(&x->atoms[i], &s_);
  
  	x->x_data_outlet = outlet_new(&x->x_obj, 0);
***************
*** 192,196 ****
  void sql_query_setup(void) 
  {
- 	DEBUG(post("sql_query_setup"););
  	sql_query_class = class_new(gensym("sql_query"), 
                                  (t_newmethod)sql_query_new, 
--- 181,184 ----





More information about the Pd-cvs mailing list