[PD-cvs] pd/src SConscript, 1.1.4.14, 1.1.4.15 d_filter.c, 1.3.4.3.2.2, 1.3.4.3.2.3 d_osc.c, 1.2.4.1.2.1, 1.2.4.1.2.2 d_soundfile.c, 1.4.4.11.2.2, 1.4.4.11.2.3 g_template.c, 1.4.8.2, 1.4.8.3 g_text.c, 1.5.4.2.2.3, 1.5.4.2.2.4 g_traversal.c, 1.2.8.2, 1.2.8.3 s_file.c, 1.2.4.8.2.2, 1.2.4.8.2.3 s_inter.c, 1.5.4.10.2.5, 1.5.4.10.2.6 s_main.c, 1.7.4.17.2.4, 1.7.4.17.2.5 t_tkcmd.c, 1.2.4.1.2.2, 1.2.4.1.2.3 u_main.tk, 1.4.4.10.2.7, 1.4.4.10.2.8

Tim Blechmann timblech at users.sourceforge.net
Tue Aug 2 23:25:08 CEST 2005


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

Modified Files:
      Tag: devel_0_39
	SConscript d_filter.c d_osc.c d_soundfile.c g_template.c 
	g_text.c g_traversal.c s_file.c s_inter.c s_main.c t_tkcmd.c 
	u_main.tk 
Log Message:
updating to miller's 0.39-test4b
thomas's fixes to devel_0_38

Index: g_traversal.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_traversal.c,v
retrieving revision 1.2.8.2
retrieving revision 1.2.8.3
diff -C2 -d -r1.2.8.2 -r1.2.8.3
*** g_traversal.c	25 Jul 2005 18:21:29 -0000	1.2.8.2
--- g_traversal.c	2 Aug 2005 21:25:05 -0000	1.2.8.3
***************
*** 417,423 ****
      for (i = nitems - 1, vp = x->x_variables + i; i >= 0; i--, vp--)
      {
!         float f = template_getfloat(template, vp->gv_sym, vec, 1);
!         outlet_float(vp->gv_outlet, f);
!             /* LATER deal with other types. */
      }
  }
--- 417,435 ----
      for (i = nitems - 1, vp = x->x_variables + i; i >= 0; i--, vp--)
      {
!         int onset, type;
!         t_symbol *arraytype;
!         if (template_find_field(template, vp->gv_sym, &onset, &type, &arraytype))
!         {
!             if (type == DT_FLOAT)
!                 outlet_float(vp->gv_outlet,
!                     *(t_float *)(((char *)vec) + onset));
!             else if (type == DT_SYMBOL)
!                 outlet_symbol(vp->gv_outlet,
!                     *(t_symbol **)(((char *)vec) + onset));
!             else pd_error(x, "get: %s.%s is not a number or symbol",
!                     template->t_sym->s_name, vp->gv_sym->s_name);
!         }
!         else pd_error(x, "get: %s.%s: no such field",
!             template->t_sym->s_name, vp->gv_sym->s_name);
      }
  }
***************
*** 442,446 ****
  {
      t_symbol *gv_sym;
!     t_float gv_f;       /* LATER take other types */
  } t_setvariable;
  
--- 454,458 ----
  {
      t_symbol *gv_sym;
!     union word gv_w;
  } t_setvariable;
  
***************
*** 451,454 ****
--- 463,467 ----
      t_symbol *x_templatesym;
      int x_nin;
+     int x_issymbol;
      t_setvariable *x_variables;
  } t_set;
***************
*** 459,462 ****
--- 472,483 ----
      int i;
      t_setvariable *sp;
+     if (argc && (argv[0].a_type == A_SYMBOL) &&
+         !strcmp(argv[0].a_w.w_symbol->s_name, "-symbol"))
+     {
+         x->x_issymbol = 1;
+         argc--;
+         argv++;
+     }
+     else x->x_issymbol = 0;
      x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv));
      if (argc) argc--, argv++;
***************
*** 469,475 ****
          {
              sp->gv_sym = atom_getsymbolarg(i, argc, argv);
!             sp->gv_f = 0;
!             if (i) floatinlet_new(&x->x_obj, &sp->gv_f);
!                 /* LATER figure out type as in "get" object. */
          }
      }
--- 490,502 ----
          {
              sp->gv_sym = atom_getsymbolarg(i, argc, argv);
!             if (x->x_issymbol)
!                 sp->gv_w.w_symbol = &s_;
!             else sp->gv_w.w_float = 0;
!             if (i)
!             {
!                 if (x->x_issymbol)
!                     symbolinlet_new(&x->x_obj, &sp->gv_w.w_symbol);
!                 else floatinlet_new(&x->x_obj, &sp->gv_w.w_float);
!             }
          }
      }
***************
*** 479,483 ****
  }
  
! static void set_float(t_set *x, t_float f)
  {
      int nitems = x->x_nin, i;
--- 506,510 ----
  }
  
! static void set_bang(t_set *x)
  {
      int nitems = x->x_nin, i;
***************
*** 504,516 ****
          return;
      }
!     if (!nitems) return;
!     x->x_variables[0].gv_f = f;
!     if (gs->gs_which == GP_ARRAY) vec = gp->gp_un.gp_w;
      else vec = gp->gp_un.gp_scalar->sc_vec;
!     for (i = 0, vp = x->x_variables; i < nitems; i++, vp++)
!     {
!         template_setfloat(template, vp->gv_sym, vec, vp->gv_f, 1);
!             /* LATER deal with other types ala get_pointer. */
!     }
      if (gs->gs_which == GP_GLIST)
          glist_redrawitem(gs->gs_un.gs_glist, (t_gobj *)(gp->gp_un.gp_scalar));  
--- 531,544 ----
          return;
      }
!     if (!nitems)
!         return;
!     if (gs->gs_which == GP_ARRAY)
!         vec = gp->gp_un.gp_w;
      else vec = gp->gp_un.gp_scalar->sc_vec;
!     if (x->x_issymbol)
!         for (i = 0, vp = x->x_variables; i < nitems; i++, vp++)
!             template_setsymbol(template, vp->gv_sym, vec, vp->gv_w.w_symbol, 1);
!     else for (i = 0, vp = x->x_variables; i < nitems; i++, vp++)
!         template_setfloat(template, vp->gv_sym, vec, vp->gv_w.w_float, 1);
      if (gs->gs_which == GP_GLIST)
          glist_redrawitem(gs->gs_un.gs_glist, (t_gobj *)(gp->gp_un.gp_scalar));  
***************
*** 525,528 ****
--- 553,576 ----
  }
  
+ static void set_float(t_set *x, t_float f)
+ {
+     if (x->x_nin && !x->x_issymbol)
+     {
+         x->x_variables[0].gv_w.w_float = f;
+         set_bang(x);
+     }
+     else pd_error(x, "type mismatch or no field specified");
+ }
+ 
+ static void set_symbol(t_set *x, t_symbol *s)
+ {
+     if (x->x_nin && x->x_issymbol)
+     {
+         x->x_variables[0].gv_w.w_symbol = s;
+         set_bang(x);
+     }
+     else pd_error(x, "type mismatch or no field specified");
+ }
+ 
  static void set_free(t_set *x)
  {
***************
*** 536,539 ****
--- 584,589 ----
          (t_method)set_free, sizeof(t_set), 0, A_GIMME, 0);
      class_addfloat(set_class, set_float); 
+     class_addsymbol(set_class, set_symbol); 
+     class_addbang(set_class, set_bang); 
  }
  

Index: g_text.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_text.c,v
retrieving revision 1.5.4.2.2.3
retrieving revision 1.5.4.2.2.4
diff -C2 -d -r1.5.4.2.2.3 -r1.5.4.2.2.4
*** g_text.c	25 Jul 2005 18:21:29 -0000	1.5.4.2.2.3
--- g_text.c	2 Aug 2005 21:25:05 -0000	1.5.4.2.2.4
***************
*** 1031,1035 ****
                  pd_vmess(&x->te_pd, clicksym, "fffff",
                      (double)xpix, (double)ypix,
!                         (double)shift, 0, (double)alt);
              return (1);
          }
--- 1031,1035 ----
                  pd_vmess(&x->te_pd, clicksym, "fffff",
                      (double)xpix, (double)ypix,
!                         (double)shift, (double)0, (double)alt);
              return (1);
          }
***************
*** 1040,1044 ****
          if (doit)
              gatom_click((t_gatom *)x, (t_floatarg)xpix, (t_floatarg)ypix,
!                 (t_floatarg)shift, 0, (t_floatarg)alt);
          return (1);
      }
--- 1040,1044 ----
          if (doit)
              gatom_click((t_gatom *)x, (t_floatarg)xpix, (t_floatarg)ypix,
!                 (t_floatarg)shift, (t_floatarg)0, (t_floatarg)alt);
          return (1);
      }
***************
*** 1047,1051 ****
          if (doit)
              message_click((t_message *)x, (t_floatarg)xpix, (t_floatarg)ypix,
!                 (t_floatarg)shift, 0, (t_floatarg)alt);
          return (1);
      }
--- 1047,1051 ----
          if (doit)
              message_click((t_message *)x, (t_floatarg)xpix, (t_floatarg)ypix,
!                 (t_floatarg)shift, (t_floatarg)0, (t_floatarg)alt);
          return (1);
      }

Index: s_main.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_main.c,v
retrieving revision 1.7.4.17.2.4
retrieving revision 1.7.4.17.2.5
diff -C2 -d -r1.7.4.17.2.4 -r1.7.4.17.2.5
*** s_main.c	16 Jul 2005 11:02:37 -0000	1.7.4.17.2.4
--- s_main.c	2 Aug 2005 21:25:05 -0000	1.7.4.17.2.5
***************
*** 8,12 ****
   */
  
! char pd_version[] = "Pd version 0.39 TEST 4 devel\n";
  char pd_compiletime[] = __TIME__;
  char pd_compiledate[] = __DATE__;
--- 8,12 ----
   */
  
! char pd_version[] = "Pd version 0.39 TEST 4b devel\n";
  char pd_compiletime[] = __TIME__;
  char pd_compiledate[] = __DATE__;

Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.4.4.10.2.7
retrieving revision 1.4.4.10.2.8
diff -C2 -d -r1.4.4.10.2.7 -r1.4.4.10.2.8
*** u_main.tk	25 Jul 2005 18:21:29 -0000	1.4.4.10.2.7
--- u_main.tk	2 Aug 2005 21:25:05 -0000	1.4.4.10.2.8
***************
*** 1421,1425 ****
  
  proc pdtk_canvas_click {name x y b f} {
! #    puts stderr [concat got $f]
      pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b $f \;
  }
--- 1421,1426 ----
  
  proc pdtk_canvas_click {name x y b f} {
!     global pd_nt
!     if {$pd_nt == 0} {focus $name}
      pd [canvastosym $name] mouse [$name canvasx $x] [$name canvasy $y] $b $f \;
  }
***************
*** 1616,1619 ****
--- 1617,1621 ----
  
  proc pdtk_canvas_saveas {name initfile initdir} {
+     global pd_nt
      set filename [tk_getSaveFile -initialfile $initfile \
         -initialdir $initdir  -defaultextension .pd \
***************
*** 1621,1624 ****
--- 1623,1642 ----
  
      if {$filename != ""} {
+ # yes, we need the extent even if we're on a mac.
+ 	if {$pd_nt == 2} {
+ 	  if {[string last .pd $filename] < 0 && \
+             [string last .PD $filename] < 0 && \
+             [string last .pat $filename] < 0 && \
+ 	    [string last .PAT $filename] < 0} {
+ 		set filename $filename.pd
+ 		if {[file exists $filename]} {
+     			set answer [tk_messageBox \
+ 			\-message [concat overwrite $filename "?"] \
+ 			 \-type yesno \-icon question]
+     			if {$answer == no} {return}
+ 		}
+ 	  }
+ 	}
+ 
      	set directory [string range $filename 0 \
      	    [expr [string last / $filename ] - 1]]

Index: s_inter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v
retrieving revision 1.5.4.10.2.5
retrieving revision 1.5.4.10.2.6
diff -C2 -d -r1.5.4.10.2.5 -r1.5.4.10.2.6
*** s_inter.c	16 Jul 2005 11:02:37 -0000	1.5.4.10.2.5
--- s_inter.c	2 Aug 2005 21:25:05 -0000	1.5.4.10.2.6
***************
*** 510,513 ****
--- 510,515 ----
  }
  
+ void sys_exit(void);
+ 
  void socketreceiver_read(t_socketreceiver *x, int fd)
  {
***************
*** 548,552 ****
                  {
                      fprintf(stderr, "pd: exiting\n");
!                     sys_bail(0);
                  }
                  else
--- 550,555 ----
                  {
                      fprintf(stderr, "pd: exiting\n");
!                     sys_exit();
!                     return;
                  }
                  else
***************
*** 1082,1085 ****
--- 1085,1089 ----
                  char *homedir = getenv("HOME"), filename[250];
                  struct stat statbuf;
+                     /* first look for Wish bundled with and renamed "Pd" */
                  sprintf(filename, "%s/../../MacOS/Pd", guidir);
                  if (stat(filename, &statbuf) >= 0)
***************
*** 1087,1090 ****
--- 1091,1097 ----
                  if (!homedir || strlen(homedir) > 150)
                      goto nohomedir;
+                     /* Look for Wish in user's Applications.  Might or might
+                     not be names "Wish Shell", and might or might not be
+                     in "Utilities" subdir. */
                  sprintf(filename,
                      "%s/Applications/Utilities/Wish shell.app/Contents/MacOS/Wish Shell",
***************
*** 1093,1101 ****
--- 1100,1119 ----
                      goto foundit;
                  sprintf(filename,
+                     "%s/Applications/Utilities/Wish.app/Contents/MacOS/Wish",
+                         homedir);
+                 if (stat(filename, &statbuf) >= 0)
+                     goto foundit;
+                 sprintf(filename,
                      "%s/Applications/Wish shell.app/Contents/MacOS/Wish Shell",
                          homedir);
                  if (stat(filename, &statbuf) >= 0)
                      goto foundit;
+                 sprintf(filename,
+                     "%s/Applications/Wish.app/Contents/MacOS/Wish",
+                         homedir);
+                 if (stat(filename, &statbuf) >= 0)
+                     goto foundit;
              nohomedir:
+                     /* Perform the same search among system applications. */
                  strcpy(filename, 
                      "/Applications/Utilities/Wish Shell.app/Contents/MacOS/Wish Shell");
***************
*** 1103,1107 ****
--- 1121,1133 ----
                      goto foundit;
                  strcpy(filename, 
+                     "/Applications/Utilities/Wish.app/Contents/MacOS/Wish");
+                 if (stat(filename, &statbuf) >= 0)
+                     goto foundit;
+                 strcpy(filename, 
                      "/Applications/Wish Shell.app/Contents/MacOS/Wish Shell");
+                 if (stat(filename, &statbuf) >= 0)
+                     goto foundit;
+                 strcpy(filename, 
+                     "/Applications/Wish.app/Contents/MacOS/Wish");
              foundit:
                  sprintf(cmdbuf, "\"%s\" %s/pd.tk %d\n", filename, guidir, portno);
***************
*** 1279,1285 ****
  
  
- /* T.Grill - import clean quit function */
- extern void sys_exit(void);
- 
  /* This is called when something bad has happened, like a segfault.
  Call glob_quit() below to exit cleanly.
--- 1305,1308 ----
***************
*** 1296,1302 ****
          sys_close_midi();
          fprintf(stderr, "... done.\n");
!         _exit(n);
      }
!     else _exit(n);
  }
  
--- 1319,1325 ----
          sys_close_midi();
          fprintf(stderr, "... done.\n");
!         exit(n);
      }
!     else _exit(1);
  }
  
***************
*** 1385,1393 ****
  		if (status)
  		{
  			fprintf(stderr, "watchdog killing");
  			/* kill parent thread */
  			kill(0,9);
  		}
- 		
  		sys_microsleep(1.5e7); /* and sleep for another 15 seconds */
  	}
--- 1408,1417 ----
  		if (status)
  		{
+ #if defined(__linux__) || defined(IRIX)
  			fprintf(stderr, "watchdog killing");
  			/* kill parent thread */
  			kill(0,9);
+ #endif
  		}
  		sys_microsleep(1.5e7); /* and sleep for another 15 seconds */
  	}

Index: SConscript
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/SConscript,v
retrieving revision 1.1.4.14
retrieving revision 1.1.4.15
diff -C2 -d -r1.1.4.14 -r1.1.4.15
*** SConscript	25 Jul 2005 18:21:28 -0000	1.1.4.14
--- SConscript	2 Aug 2005 21:25:03 -0000	1.1.4.15
***************
*** 198,201 ****
--- 198,205 ----
  	defs.append('HAVE_LIBFFTW3F')
  
+ if conf.CheckFunc('alloca'):
+ 	defs.append('HAVE_ALLOCA')
+ 
+ 
  ######################################################################
  #

Index: s_file.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_file.c,v
retrieving revision 1.2.4.8.2.2
retrieving revision 1.2.4.8.2.3
diff -C2 -d -r1.2.4.8.2.2 -r1.2.4.8.2.3
*** s_file.c	12 Jul 2005 15:11:11 -0000	1.2.4.8.2.2
--- s_file.c	2 Aug 2005 21:25:05 -0000	1.2.4.8.2.3
***************
*** 264,268 ****
      int nmidiindev, midiindev[MAXMIDIINDEV];
      int nmidioutdev, midioutdev[MAXMIDIOUTDEV];
!     int i, rate = 0, advance = 0, dacblocksize = 0, api, nolib, scheduler = 0;
      char prefbuf[MAXPDSTRING], keybuf[80];
      sys_initloadpreferences();
--- 264,268 ----
      int nmidiindev, midiindev[MAXMIDIINDEV];
      int nmidioutdev, midioutdev[MAXMIDIOUTDEV];
!     int i, rate = 0, advance = 0, dacblocksize = 0, api, nolib, maxi, scheduler = 0;
      char prefbuf[MAXPDSTRING], keybuf[80];
      sys_initloadpreferences();
***************
*** 345,350 ****
      }
      sys_open_midi(nmidiindev, midiindev, nmidioutdev, midioutdev, 0);
          /* search path */
!     for (i = 0; 1; i++)
      {
          sprintf(keybuf, "path%d", i+1);
--- 345,354 ----
      }
      sys_open_midi(nmidiindev, midiindev, nmidioutdev, midioutdev, 0);
+ 
          /* search path */
!     if (sys_getpreference("npath", prefbuf, MAXPDSTRING))
!         sscanf(prefbuf, "%d", &maxi);
!     else maxi = 0x7fffffff;
!     for (i = 0; i<maxi; i++)
      {
          sprintf(keybuf, "path%d", i+1);
***************
*** 359,363 ****
  
          /* startup settings */
!     for (i = 0; 1; i++)
      {
          sprintf(keybuf, "loadlib%d", i+1);
--- 363,370 ----
  
          /* startup settings */
!     if (sys_getpreference("nloadlib", prefbuf, MAXPDSTRING))
!         sscanf(prefbuf, "%d", &maxi);
!     else maxi = 0x7fffffff;
!     for (i = 0; i<maxi; i++)
      {
          sprintf(keybuf, "loadlib%d", i+1);
***************
*** 463,466 ****
--- 470,475 ----
          sys_putpreference(buf1, pathelem);
      }
+     sprintf(buf1, "%d", i);
+     sys_putpreference("npath", buf1);
      sprintf(buf1, "%d", sys_usestdpath);
      sys_putpreference("standardpath", buf1);
***************
*** 477,480 ****
--- 486,491 ----
          sys_putpreference(buf1, pathelem);
      }
+     sprintf(buf1, "%d", i);
+     sys_putpreference("nloadlib", buf1);
      sprintf(buf1, "%d", sys_defeatrt);
      sys_putpreference("defeatrt", buf1);

Index: d_filter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_filter.c,v
retrieving revision 1.3.4.3.2.2
retrieving revision 1.3.4.3.2.3
diff -C2 -d -r1.3.4.3.2.2 -r1.3.4.3.2.3
*** d_filter.c	13 Jul 2005 22:49:39 -0000	1.3.4.3.2.2
--- d_filter.c	2 Aug 2005 21:25:03 -0000	1.3.4.3.2.3
***************
*** 594,600 ****
  }
  
! static void sigsamphold_reset(t_sigsamphold *x)
  {
!     x->x_lastin = 1e20;
  }
  
--- 594,602 ----
  }
  
! static void sigsamphold_reset(t_sigsamphold *x, t_symbol *s, int argc,
!     t_atom *argv)
  {
!     x->x_lastin = ((argc > 0 && (argv[0].a_type == A_FLOAT)) ?
!         argv[0].a_w.w_float : 1e20);
  }
  
***************
*** 612,616 ****
          gensym("set"), A_DEFFLOAT, 0);
      class_addmethod(sigsamphold_class, (t_method)sigsamphold_reset,
!         gensym("reset"), 0);
      class_addmethod(sigsamphold_class, (t_method)sigsamphold_dsp,
          gensym("dsp"), 0);
--- 614,618 ----
          gensym("set"), A_DEFFLOAT, 0);
      class_addmethod(sigsamphold_class, (t_method)sigsamphold_reset,
!         gensym("reset"), A_GIMME, 0);
      class_addmethod(sigsamphold_class, (t_method)sigsamphold_dsp,
          gensym("dsp"), 0);

Index: d_soundfile.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v
retrieving revision 1.4.4.11.2.2
retrieving revision 1.4.4.11.2.3
diff -C2 -d -r1.4.4.11.2.2 -r1.4.4.11.2.3
*** d_soundfile.c	13 Jul 2005 22:49:39 -0000	1.4.4.11.2.2
--- d_soundfile.c	2 Aug 2005 21:25:03 -0000	1.4.4.11.2.3
***************
*** 105,108 ****
--- 105,110 ----
      char  dc_id[4];                 /* data chunk id 'SSND'       */
      uint32 dc_size;                 /* length of data chunk       */
+     uint32 dc_offset;               /* additional offset in bytes */
+     uint32 dc_block;                /* block size                 */
  } t_datachunk;
  
***************
*** 134,138 ****
  
  
! #define AIFFPLUS (AIFFHDRSIZE + 8)  /* header size including first chunk hdr */
  
  #define WHDR1 sizeof(t_nextstep)
--- 136,140 ----
  
  
! #define AIFFPLUS (AIFFHDRSIZE + 16)  /* header size including SSND chunk hdr */
  
  #define WHDR1 sizeof(t_nextstep)
***************
*** 679,682 ****
--- 681,685 ----
          longtmp = swap4(datasize, swap);
          memcpy(aiffhdr->a_samprate + sizeof(dogdoo), &longtmp, 4);
+         memset(aiffhdr->a_samprate + sizeof(dogdoo) + 4, 0, 8);
          headersize = AIFFPLUS;
      }
***************
*** 752,756 ****
                      SEEK_SET) == 0)
                          goto baddonewrite;
!             mofo = swap4(nframes, swap);
              if (write(fd, (char *)(&mofo), 4) < 4)
                  goto baddonewrite;
--- 755,771 ----
                      SEEK_SET) == 0)
                          goto baddonewrite;
!             mofo = swap4(itemswritten, swap);
!             if (write(fd, (char *)(&mofo), 4) < 4)
!                 goto baddonewrite;
!             if (lseek(fd,
!                 ((char *)(&((t_aiff *)0)->a_chunksize)) - (char *)0,
!                     SEEK_SET) == 0)
!                         goto baddonewrite;
!             mofo = swap4(itemswritten*bytesperframe+AIFFHDRSIZE, swap);
!             if (write(fd, (char *)(&mofo), 4) < 4)
!                 goto baddonewrite;
!             if (lseek(fd, (AIFFHDRSIZE+4), SEEK_SET) == 0)
!                 goto baddonewrite;
!             mofo = swap4(itemswritten*bytesperframe, swap);
              if (write(fd, (char *)(&mofo), 4) < 4)
                  goto baddonewrite;

Index: t_tkcmd.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/t_tkcmd.c,v
retrieving revision 1.2.4.1.2.2
retrieving revision 1.2.4.1.2.3
diff -C2 -d -r1.2.4.1.2.2 -r1.2.4.1.2.3
*** t_tkcmd.c	16 Jul 2005 21:18:33 -0000	1.2.4.1.2.2
--- t_tkcmd.c	2 Aug 2005 21:25:05 -0000	1.2.4.1.2.3
***************
*** 100,104 ****
  static int sockfd;
  
! /* The "pd_suck" command, which polls the socket. */
  
  #define CHUNKSIZE 20000 /* chunks to allocate memory for reading socket */
--- 100,104 ----
  static int sockfd;
  
! /* The "pd_readsocket" command, which polls the socket. */
  
  #define CHUNKSIZE 20000 /* chunks to allocate memory for reading socket */
***************
*** 107,115 ****
  static char *pd_tkbuf = 0;      /* buffer for reading */
  static int pd_tkbufsize = 0;    /* current buffer size */
! static int pd_tkgotbytes = 0;   /* number of bytes already in buffer */
  
  static void pd_readsocket(ClientData cd, int mask)
  {
-     int ngot;
      fd_set readset, writeset, exceptset;
      struct timeval timout;
--- 107,116 ----
  static char *pd_tkbuf = 0;      /* buffer for reading */
  static int pd_tkbufsize = 0;    /* current buffer size */
! static int pd_buftail = 0;      /* number of bytes already in buffer */
! static int pd_bufhead = 0;    /* index of first byte to read */
  
+     /* mask argument unused but is here to follow tcl's prototype. */
  static void pd_readsocket(ClientData cd, int mask)
  {
      fd_set readset, writeset, exceptset;
      struct timeval timout;
***************
*** 131,135 ****
          pd_tkbufsize = CHUNKSIZE;
      }
!     if (pd_tkgotbytes + READSIZE + 1 > pd_tkbufsize)
      {   
          int newsize = pd_tkbufsize + CHUNKSIZE;
--- 132,136 ----
          pd_tkbufsize = CHUNKSIZE;
      }
!     if (pd_buftail + READSIZE + 1 > pd_tkbufsize)
      {   
          int newsize = pd_tkbufsize + CHUNKSIZE;
***************
*** 148,157 ****
      {
          int ret;
!         ret = recv(sockfd, pd_tkbuf + pd_tkgotbytes, READSIZE, 0);
          if (ret < 0)
              pdgui_sockerror("socket receive error");
          else if (ret == 0)
          {
!             /* fprintf(stderr, "read %d\n", SOCKSIZE - pd_tkgotbytes); */
              fprintf(stderr, "pd_gui: pd process exited\n");
              tcl_mess("exit\n");
--- 149,158 ----
      {
          int ret;
!         ret = recv(sockfd, pd_tkbuf + pd_buftail, READSIZE, 0);
          if (ret < 0)
              pdgui_sockerror("socket receive error");
          else if (ret == 0)
          {
!             /* fprintf(stderr, "read %d\n", SOCKSIZE - pd_buftail); */
              fprintf(stderr, "pd_gui: pd process exited\n");
              tcl_mess("exit\n");
***************
*** 159,201 ****
          else
          {
!             char *lastcr = 0, *bp = pd_tkbuf, *ep = bp + (pd_tkgotbytes + ret);
!             int brace = 0;
!             char lastc = 0;
!                 /* search for locations that terminate a complete TK
!                 command.  These are carriage returns which are not inside
!                 any braces.  Braces can be escaped with backslashes (but
!                 backslashes themselves can't.) */
!             while (bp < ep)
!             {
!                 char c = *bp;
!                 if (c == '}' && brace)
!                     brace--;
!                 else if (c == '{')
!                     brace++;
!                 else if (!brace && c == '\n' && lastc != '\\')
!                     lastcr = bp;
!                 lastc = c;
!                 bp++;
!             }
!                 /* if lastcr is set there is at least one complete TK
!                 command in the buffer.  Execute it or them, and slide any
!                 extra bytes to beginning of the buffer. */
!             if (lastcr)
              {
!                 int xtra = pd_tkbuf + pd_tkgotbytes + ret - (lastcr+1);
!                 char bashwas = lastcr[1];
!                 lastcr[1] = 0;
!                 tcl_mess(pd_tkbuf);
!                 lastcr[1] = bashwas;
!                 if (xtra)
                  {
!                     /* fprintf(stderr, "x %d\n", xtra); */
!                     memmove(pd_tkbuf, lastcr+1, xtra);
                  }
!                 pd_tkgotbytes = xtra;
              }
!             else
              {
!                 pd_tkgotbytes += ret;
              }
          }
--- 160,226 ----
          else
          {
!             pd_buftail += ret;
!             while (1)
              {
!                 char lastc = 0, *gotcr = 0, *bp = pd_tkbuf + pd_bufhead,
!                     *ep = pd_tkbuf + pd_buftail;
!                 int brace = 0;
!                     /* search for locations that terminate a complete TK
!                     command.  These are carriage returns which are not inside
!                     any braces.  Braces can be escaped with backslashes (but
!                     backslashes themselves can't.) */
!                 while (bp < ep)
                  {
!                     char c = *bp;
!                     if (c == '}' && brace)
!                         brace--;
!                     else if (c == '{')
!                         brace++;
!                     else if (!brace && c == '\n' && lastc != '\\')
!                     {
!                         gotcr = bp;
!                         break;
!                     }
!                     lastc = c;
!                     bp++;
                  }
!                     /* if gotcr is set there is at least one complete TK
!                     command in the buffer, and gotcr terminates the first one.
!                     Because sending the command to tcl may cause this code to
!                     be reentered, we first copy the command and take it out of
!                     the buffer, then execute the command.
!                     Execute it and slide any
!                     extra bytes to beginning of the buffer. */
!                 if (gotcr)
!                 {
!                     int bytesincmd = (gotcr - (pd_tkbuf+pd_bufhead)) + 1;
!                     char smallcmdbuf[1000], *realcmdbuf;
!                     if (gotcr - (pd_tkbuf+pd_bufhead) < 998)
!                         realcmdbuf = smallcmdbuf;
!                     else realcmdbuf = malloc(bytesincmd+1);
!                     if (realcmdbuf)
!                     {
!                         strncpy(realcmdbuf, pd_tkbuf+pd_bufhead, bytesincmd);
!                         realcmdbuf[bytesincmd] = 0;
!                     }
!                     pd_bufhead += bytesincmd;
!                     if (realcmdbuf)
!                     {
!                         tcl_mess(realcmdbuf);
!                         if (realcmdbuf != smallcmdbuf)
!                             free(realcmdbuf);
!                     }
!                     if (pd_buftail < pd_bufhead)
!                         fprintf(stderr, "tkcmd bug\n");
!                 }
!                 else break;
              }
!             if (pd_bufhead)
              {
!                 if (pd_buftail > pd_bufhead)
!                     memmove(pd_tkbuf, pd_tkbuf + pd_bufhead,
!                         pd_buftail-pd_bufhead);
!                 pd_buftail  -= pd_bufhead;
!                 pd_bufhead = 0;
              }
          }

Index: d_osc.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_osc.c,v
retrieving revision 1.2.4.1.2.1
retrieving revision 1.2.4.1.2.2
diff -C2 -d -r1.2.4.1.2.1 -r1.2.4.1.2.2
*** d_osc.c	12 Jul 2005 15:11:06 -0000	1.2.4.1.2.1
--- d_osc.c	2 Aug 2005 21:25:03 -0000	1.2.4.1.2.2
***************
*** 18,22 ****
  #define LOWOFFSET 1    /* word offset to find LSB */
  #define int32 long  /* a data type that has 32 bits */
! #else
  #if defined(MSW) || defined(__CYGWIN__)
      /* little-endian; most significant byte is at highest address */
--- 18,23 ----
  #define LOWOFFSET 1    /* word offset to find LSB */
  #define int32 long  /* a data type that has 32 bits */
! #endif /* IRIX */
! 
  #if defined(MSW) || defined(__CYGWIN__)
      /* little-endian; most significant byte is at highest address */
***************
*** 24,48 ****
  #define LOWOFFSET 0
  #define int32 long
! #else
! #ifdef __FreeBSD__
  #include <machine/endian.h>
- #if BYTE_ORDER == LITTLE_ENDIAN
- #define HIOFFSET 1
- #define LOWOFFSET 0
- #else
- #define HIOFFSET 0    /* word offset to find MSB */
- #define LOWOFFSET 1    /* word offset to find LSB */
- #endif /* BYTE_ORDER */
- #include <sys/types.h>
- #define int32 int32_t
  #endif
- #ifdef __linux__
  
  #include <endian.h>
  
  #if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN)                         
  #error No byte order defined                                                    
  #endif                                                                          
!                                                                                 
  #if __BYTE_ORDER == __LITTLE_ENDIAN                                             
  #define HIOFFSET 1                                                              
--- 25,48 ----
  #define LOWOFFSET 0
  #define int32 long
! #endif
! 
! #if defined(__FreeBSD__) || defined(MACOSX)
  #include <machine/endian.h>
  #endif
  
+ #ifdef MACOSX
+ #define __BYTE_ORDER BYTE_ORDER
+ #define __LITTLE_ENDIAN LITTLE_ENDIAN
+ #endif                                                                          
+ 
+ #ifdef __linux__
  #include <endian.h>
+ #endif
  
+ #if defined(__unix__) || defined(MACOSX)
  #if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN)                         
  #error No byte order defined                                                    
  #endif                                                                          
! 
  #if __BYTE_ORDER == __LITTLE_ENDIAN                                             
  #define HIOFFSET 1                                                              
***************
*** 52,69 ****
  #define LOWOFFSET 1    /* word offset to find LSB */                            
  #endif /* __BYTE_ORDER */                                                       
- 
  #include <sys/types.h>
  #define int32 int32_t
! 
! #else
! #ifdef __APPLE__
! #define HIOFFSET 0    /* word offset to find MSB */
! #define LOWOFFSET 1    /* word offset to find LSB */
! #define int32 int  /* a data type that has 32 bits */
! 
! #endif /* __APPLE__ */
! #endif /* __linux__ */
! #endif /* MSW */
! #endif /* SGI */
  
  union tabfudge
--- 52,58 ----
  #define LOWOFFSET 1    /* word offset to find LSB */                            
  #endif /* __BYTE_ORDER */                                                       
  #include <sys/types.h>
  #define int32 int32_t
! #endif /* __unix__ or MACOSX*/
  
  union tabfudge

Index: g_template.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_template.c,v
retrieving revision 1.4.8.2
retrieving revision 1.4.8.3
diff -C2 -d -r1.4.8.2 -r1.4.8.3
*** g_template.c	12 Jul 2005 15:11:09 -0000	1.4.8.2
--- g_template.c	2 Aug 2005 21:25:04 -0000	1.4.8.3
***************
*** 787,790 ****
--- 787,804 ----
  }
  
+ static void fielddesc_setsymbolarg(t_fielddesc *fd, int argc, t_atom *argv)
+ {
+         if (argc <= 0) fielddesc_setsymbol_const(fd, &s_);
+         else if (argv->a_type == A_SYMBOL)
+         {
+             fd->fd_type = A_SYMBOL;
+             fd->fd_var = 1;
+             fd->fd_un.fd_varsym = argv->a_w.w_symbol;
+             fd->fd_v1 = fd->fd_v2 = fd->fd_screen1 = fd->fd_screen2 =
+                 fd->fd_quantum = 0;
+         }
+         else fielddesc_setsymbol_const(fd, &s_);
+ }
+ 
  static void fielddesc_setarrayarg(t_fielddesc *fd, int argc, t_atom *argv)
  {
***************
*** 1888,1893 ****
          else break;
      }
!     if (argc) fielddesc_setfloatarg(&x->x_value, argc--, argv++);
!     else fielddesc_setfloat_const(&x->x_value, 0);
      if (argc) fielddesc_setfloatarg(&x->x_xloc, argc--, argv++);
      else fielddesc_setfloat_const(&x->x_xloc, 0);
--- 1902,1916 ----
          else break;
      }
!     if (flags & DRAW_SYMBOL)
!     {
!         if (argc) fielddesc_setsymbolarg(&x->x_value, argc--, argv++);
!         else fielddesc_setsymbol_const(&x->x_value, &s_);
!     
!     }
!     else
!     {
!         if (argc) fielddesc_setfloatarg(&x->x_value, argc--, argv++);
!         else fielddesc_setfloat_const(&x->x_value, 0);
!     }
      if (argc) fielddesc_setfloatarg(&x->x_xloc, argc--, argv++);
      else fielddesc_setfloat_const(&x->x_xloc, 0);





More information about the Pd-cvs mailing list