[PD-cvs] pd/src configure.in, 1.15, 1.15.2.1 d_array.c, 1.5, 1.5.4.1 d_mayer_fft.c, 1.3, 1.3.2.1 g_canvas.c, 1.11, 1.11.2.1 g_editor.c, 1.13, 1.13.2.1 g_graph.c, 1.9, 1.9.2.1 g_rtext.c, 1.5, 1.5.2.1 g_template.c, 1.13, 1.13.2.1 g_text.c, 1.11, 1.11.2.1 m_class.c, 1.4, 1.4.2.1 m_pd.h, 1.8, 1.8.2.1 makefile.in, 1.8, 1.8.2.1 s_entry.c, 1.3, 1.3.6.1 s_file.c, 1.8, 1.8.2.1 s_inter.c, 1.14, 1.14.2.1 s_loader.c, 1.6, 1.6.2.1 s_main.c, 1.20, 1.20.2.1 s_stuff.h, 1.7, 1.7.2.1 s_watchdog.c, 1.2, 1.2.14.1 t_tkcmd.c, 1.6, 1.6.2.1 u_main.tk, 1.17, 1.17.2.1 x_arithmetic.c, 1.2, 1.2.12.1 x_misc.c, 1.2, 1.2.10.1

Hans-Christoph Steiner eighthave at users.sourceforge.net
Tue Dec 19 06:55:47 CET 2006


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

Modified Files:
      Tag: branch-v0-39-2-extended
	configure.in d_array.c d_mayer_fft.c g_canvas.c g_editor.c 
	g_graph.c g_rtext.c g_template.c g_text.c m_class.c m_pd.h 
	makefile.in s_entry.c s_file.c s_inter.c s_loader.c s_main.c 
	s_stuff.h s_watchdog.c t_tkcmd.c u_main.tk x_arithmetic.c 
	x_misc.c 
Log Message:
checking into the release branch with all patches that are in packages/patches to make it easier to fix other bugs

Index: s_loader.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_loader.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -d -r1.6 -r1.6.2.1
*** s_loader.c	30 May 2005 03:04:19 -0000	1.6
--- s_loader.c	19 Dec 2006 05:55:44 -0000	1.6.2.1
***************
*** 3,6 ****
--- 3,9 ----
  * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
  
+ #ifdef __APPLE__
+ #define DL_OPEN
+ #endif
  #ifdef DL_OPEN
  #include <dlfcn.h>
***************
*** 14,18 ****
  #include <windows.h>
  #endif
! #ifdef MACOSX
  #include <mach-o/dyld.h> 
  #endif
--- 17,21 ----
  #include <windows.h>
  #endif
! #ifdef MACOSX10.2
  #include <mach-o/dyld.h> 
  #endif
***************
*** 47,54 ****
  void class_set_extern_dir(t_symbol *s);
  
! int sys_load_lib(char *dirname, char *classname)
  {
      char symname[MAXPDSTRING], filename[MAXPDSTRING], dirbuf[MAXPDSTRING],
!         classname2[MAXPDSTRING], *nameptr, *lastdot;
      void *dlobj;
      t_xxx makeout = NULL;
--- 50,58 ----
  void class_set_extern_dir(t_symbol *s);
  
! int sys_load_lib_alt(char *dirname, char *classname, char*altname)
  {
      char symname[MAXPDSTRING], filename[MAXPDSTRING], dirbuf[MAXPDSTRING],
!       classname2[MAXPDSTRING], *nameptr, *lastdot, 
!       altsymname[MAXPDSTRING];
      void *dlobj;
      t_xxx makeout = NULL;
***************
*** 73,76 ****
--- 77,99 ----
              dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
          {
+           /* next try (alternative_classname).(sys_dllextent) */
+           if(altname)
+             {
+               if ((fd = open_via_path(dirname, altname, sys_dllextent,
+                                       dirbuf, &nameptr, MAXPDSTRING, 1)) < 0) {
+ 
+                 /* next try (alternative_classname)/(alternative_classname).(sys_dllextent) ... */
+                 strncpy(classname2, altname, MAXPDSTRING);
+               filename[MAXPDSTRING-2] = 0;
+               strcat(classname2, "/");
+               strncat(classname2, altname, MAXPDSTRING-strlen(classname2));
+               filename[MAXPDSTRING-1] = 0;
+               if ((fd = open_via_path(dirname, classname2, sys_dllextent,
+                                       dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+                 {
+                   return 0;
+                 } }
+             }
+           else
              return (0);
          }
***************
*** 91,100 ****
          *lastdot = 0;
  
! #ifdef MACOSX
      strcpy(symname, "_");
      strcat(symname, nameptr);
  #else
      strcpy(symname, nameptr);
  #endif
          /* if the last character is a tilde, replace with "_tilde" */
      if (symname[strlen(symname) - 1] == '~')
--- 114,134 ----
          *lastdot = 0;
  
! #ifdef MACOSX10.2
      strcpy(symname, "_");
      strcat(symname, nameptr);
+     if(altname)
+       {
+         strcpy(altsymname, "_setup_");
+         strcat(symname, altname);
+       }
  #else
      strcpy(symname, nameptr);
+     if(altname)
+       {
+         strcpy(altsymname, "setup_");
+         strcat(altsymname, altname);
+       }
  #endif
+ 
          /* if the last character is a tilde, replace with "_tilde" */
      if (symname[strlen(symname) - 1] == '~')
***************
*** 111,114 ****
--- 145,149 ----
      }
      makeout = (t_xxx)dlsym(dlobj,  symname);
+     if(!makeout)makeout = (t_xxx)dlsym(dlobj,  altsymname);
  #endif
  #ifdef MSW
***************
*** 122,127 ****
      }
      makeout = (t_xxx)GetProcAddress(ntdll, symname);  
  #endif
! #ifdef MACOSX
      {
          NSObjectFileImage image; 
--- 157,163 ----
      }
      makeout = (t_xxx)GetProcAddress(ntdll, symname);  
+     if(!makeout)makeout = (t_xxx)GetProcAddress(ntdll, altsymname);  
  #endif
! #ifdef MACOSX10.2
      {
          NSObjectFileImage image; 
***************
*** 148,151 ****
--- 184,189 ----
          s = NSLookupSymbolInModule(ret, symname); 
  
+         if(!s)s=NSLookupSymbolInModule(ret, altsymname); 
+ 
          if (s)
              makeout = (t_xxx)NSAddressOfSymbol( s);
***************
*** 157,160 ****
--- 195,200 ----
      {
          post("load_object: Symbol \"%s\" not found", symname);
+         if(altname)
+           post("load_object: Symbol \"%s\" not found", altsymname);
          class_set_extern_dir(&s_);
          return 0;
***************
*** 165,174 ****
--- 205,298 ----
  }
  
+ int sys_load_lib(char *dirname, char *filename)
+ {
+   return sys_load_lib_alt(dirname, filename, 0);
+ }
+ 
+ 
+ 
+ 
+ 
  
  
  
+ /* <hans at at.or.at> { */
+ 
+ /*
+  * This function opens a directory as a library.  In the long run, the idea is
+  * that one folder will have all of objects files, all of the related
+  * *-help.pd files, a file with meta data for the help system, etc.  Then to
+  * install the lib, it would just be dropped into extra, or the path anywhere.
+  * <hans at at.or.at>
+  */
+ 
+ int sys_load_lib_dir(char *dirname, char *classname)
+ {
+     int fd = -1;
+     char searchpathname[MAXPDSTRING], helppathname[MAXPDSTRING], 
+         fullclassname[MAXPDSTRING], dirbuf[MAXPDSTRING], *nameptr;
+     
+ #if 0
+     fprintf(stderr, "sys_load_lib_directory %s %s\n", dirname, classname);
+ #endif
+ 
+ /* look for meta file (classname)/(classname)-meta.pd */
+ 	strncpy(fullclassname, classname, MAXPDSTRING - 6);
+ 	strcat(fullclassname, "/");
+ 	strncat(fullclassname, classname, MAXPDSTRING - strlen(fullclassname) - 6);
+ 	strcat(fullclassname, "-meta");
+     if ((fd = open_via_path(dirname, fullclassname, ".pd",
+                             dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+     {
+         return (0);
+     }
+     close(fd);
+     
+     /* Ultimately, the meta file will be read for meta data, specifically for
+      * the auto-generated Help system, but for other things too.  Right now,
+      * its just used as a marker that a directory is meant to be a library.
+      * Plus its much easier to implement it this way, I can use
+      * open_via_path() instead of writing a new function.  The grand plan is
+      * to have one directory hold the objects, help files, manuals,
+      * etc. making it a self-contained library. <hans at at.or.at>
+      */
  
+ #if 0
+     fprintf(stderr, "sys_load_lib_directory %s %s\n", dirname, classname);
+ #endif
+         /* create full path to libdir for adding to the paths */
+     strcpy(searchpathname,dirbuf);
+ //    strcat(searchpathname,"/");
+ //    strncat(searchpathname,classname, MAXPDSTRING-strlen(searchpathname));
  
+     strncpy(helppathname, sys_libdir->s_name, MAXPDSTRING-30);
+     helppathname[MAXPDSTRING-30] = 0;
+     strcat(helppathname, "/doc/5.reference/");
+     strcat(helppathname, classname);
  
+     sys_searchpath = namelist_append_files(sys_searchpath, searchpathname);
+     /* this help path supports having the help files in a complete library
+      * directory format, where everything is in one folder.  The help meta
+      * system needs to be implemented for this to work with the new Help
+      * menu/browser system. Ultimately, /path/to/extra will have to be added
+      * to sys_helppath in order for this to work properly.<hans at at.or.at> */
+     sys_helppath = namelist_append_files(sys_helppath, searchpathname);
+     /* this supports having the help files in a distinct dir
+      * (i.e. doc/5.reference), but having the help files in subdirs named with
+      * the same name as the library directory.  <hans at at.or.at>*/
+     sys_helppath = namelist_append_files(sys_helppath, helppathname);
+     
+         /* this should be changed to use sys_debuglevel */
+     if (sys_verbose) 
+     {
+         post("Added to search path: %s", searchpathname);
+         post("Added to help path: %s", searchpathname);
+         post("Added to help path: %s", helppathname);
+     }
+     if (sys_verbose) 
+         post("Loaded libdir %s from %s", classname, dirbuf);
  
+     return (1);
+ }
  
+ /* }  <hans at at.or.at> */

Index: u_main.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/u_main.tk,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -C2 -d -r1.17 -r1.17.2.1
*** u_main.tk	15 Oct 2005 23:14:28 -0000	1.17
--- u_main.tk	19 Dec 2006 05:55:44 -0000	1.17.2.1
***************
*** 36,41 ****
      global pd_tearoff
      set pd_gui2 [string range $argv0 0 [expr [string last \\ $argv0 ] - 1]]
!     regsub -all \\\\ $pd_gui2 / pd_gui3
!     set pd_guidir $pd_gui3/..
      load $pd_guidir/bin/pdtcl.dll
      set pd_tearoff 1
--- 36,41 ----
      global pd_tearoff
      set pd_gui2 [string range $argv0 0 [expr [string last \\ $argv0 ] - 1]]
!     regsub -all \\\\ $pd_gui2 / pd_guidir
! 	set pd_guidir [string range $pd_guidir 0 [expr [string last / $pd_guidir] - 1]]
      load $pd_guidir/bin/pdtcl.dll
      set pd_tearoff 1
***************
*** 90,93 ****
--- 90,95 ----
  }
  
+ set help_top_directory $pd_guidir/doc
+ 
  # it's unfortunate but we seem to have to turn off global bindings
  # for Text objects to get control-s and control-t to do what we want for
***************
*** 137,149 ****
  checkbutton .controls.switches.audiobutton -text {compute audio} \
      -variable ctrls_audio_on \
-     -anchor w \
      -command {pd [concat pd dsp $ctrls_audio_on \;]}
  
  checkbutton .controls.switches.meterbutton -text {peak meters} \
      -variable ctrls_meter_on \
-     -anchor w \
      -command {pd [concat pd meters $ctrls_meter_on \;]}
  
! pack .controls.switches.audiobutton .controls.switches.meterbutton -side top
  
  frame .controls.inout
--- 139,150 ----
  checkbutton .controls.switches.audiobutton -text {compute audio} \
      -variable ctrls_audio_on \
      -command {pd [concat pd dsp $ctrls_audio_on \;]}
  
  checkbutton .controls.switches.meterbutton -text {peak meters} \
      -variable ctrls_meter_on \
      -command {pd [concat pd meters $ctrls_meter_on \;]}
  
! pack .controls.switches.audiobutton .controls.switches.meterbutton \
!      -side top -anchor w
  
  frame .controls.inout
***************
*** 172,176 ****
  
  frame .printout
! text .printout.text -relief raised -bd 2 -font -*-courier-bold--normal--12-* \
      -yscrollcommand ".printout.scroll set" -width 80
  # .printout.text insert end "\n\n\n\n\n\n\n\n\n\n"
--- 173,177 ----
  
  frame .printout
! text .printout.text -relief raised -bd 2 -font {courier 12 normal} \
      -yscrollcommand ".printout.scroll set" -width 80
  # .printout.text insert end "\n\n\n\n\n\n\n\n\n\n"
***************
*** 352,360 ****
      global doc_number
      global pd_guidir
-     global pd_myversion
  #    global pd_font3
      set name [format ".help%d" $doc_number]
      toplevel $name
!     text $name.text -relief raised -bd 2 -font -*-times-regular--normal--14-* \
          -yscrollcommand "$name.scroll set" -background white
      scrollbar $name.scroll -command "$name.text yview"
--- 353,360 ----
      global doc_number
      global pd_guidir
  #    global pd_font3
      set name [format ".help%d" $doc_number]
      toplevel $name
!     text $name.text -relief raised -bd 2 -font {times 14 normal} \
          -yscrollcommand "$name.scroll set" -background white
      scrollbar $name.scroll -command "$name.text yview"
***************
*** 366,371 ****
          set bigstring [read $f 1000]
          regsub -all PD_BASEDIR $bigstring $pd_guidir bigstring2
!         regsub -all PD_VERSION $bigstring2 $pd_myversion bigstring3
!         $name.text insert end $bigstring3
      }
      close $f
--- 366,370 ----
          set bigstring [read $f 1000]
          regsub -all PD_BASEDIR $bigstring $pd_guidir bigstring2
!         $name.text insert end $bigstring2
      }
      close $f
***************
*** 390,428 ****
  }
  
- set help_directory $pd_guidir/doc
- set help_top_directory $pd_guidir/doc
- 
- proc menu_documentation {} {
-     global help_directory
-     global pd_nt
-     global pd_guidir
- 
-     if {$pd_nt == 2} {
-         exec rm -rf /tmp/pd-documentation
-         exec cp -pr $pd_guidir/doc /tmp/pd-documentation
-         set filename [tk_getOpenFile -defaultextension .pd \
-         -filetypes { {{documentation} {.pd .txt .htm}} } \
-         -initialdir /tmp/pd-documentation]
-     } else {
-         set filename [tk_getOpenFile -defaultextension .pd \
-         -filetypes { {{documentation} {.pd .txt .htm}} } \
-         -initialdir $help_directory]
-     }    
-     if {$filename != ""} {
-         if {[string first .txt $filename] >= 0} {
-             menu_opentext $filename
-         } elseif {[string first .htm $filename] >= 0} {
-                                 menu_openhtml $filename
-         } else {
-             set help_directory [string range $filename 0 \
-                 [expr [string last / $filename ] - 1]]
-             set basename [string range $filename \
-                 [expr [string last / $filename ] + 1] end]
-             pd [concat pd open [pdtk_enquote $basename] \
-                  [pdtk_enquote $help_directory] \;]
-         }
-     }
- }
- 
  proc menu_doc_open {subdir basename} {
      global pd_guidir
--- 389,392 ----
***************
*** 440,463 ****
  }
  
- proc doc_submenu {helpmenu subdir} {
-          global help_top_directory pd_tearoff
  
!          set menudir $help_top_directory/$subdir
  
!     regsub -all "\\\." $subdir "" submenu
  
!          menu $helpmenu.$submenu -tearoff $pd_tearoff
!     regsub -all "\\\." $subdir " " submenuname
!          $helpmenu add cascade -label $submenuname \
!                   -menu $helpmenu.$submenu
!     catch {
! # use this glob pattern to exclude the supporting files
! #        foreach file [ lsort [ glob -dir $menudir {*[0-9][0-9]*} ] ] 
!          foreach file [ lsort [ glob -dir $menudir * ] ] {
!                   set filename ""
!                   regsub {.*/(.*\..+$)} $file {\1} filename
!                   $helpmenu.$submenu add command -label $filename \
!                                 -command "menu_doc_open doc/$subdir $filename"
           }
      }
  }
--- 404,475 ----
  }
  
  
! ################## help browser and support functions #########################
! proc menu_doc_browser {dir} {
! 	global .mbar
! 	if {![file isdirectory $dir]} {
! 		puts stderr "menu_doc_browser non-directory $dir\n"
! 	}
! 	if { [winfo exists .help_browser.frame] } {
! 		raise .help_browser
! 	} else {
! 		toplevel .help_browser -menu .mbar
! 		wm title .help_browser "Pd Documentation Browser"
! 		frame .help_browser.frame
! 		pack .help_browser.frame -side top -fill both
! 		doc_make_listbox .help_browser.frame $dir 0
!          }
!     }
  
! proc doc_make_listbox {base dir count} {
! 	# check for [file readable]?
! 	if { [info tclversion] >= 8.5 } {
! 		# requires Tcl 8.5 but probably deals with special chars better
! #		destroy {expand}[lrange [winfo children $base] [expr {2 * $count}] end]
! 	} else {
! 		if { [catch { eval destroy [lrange [winfo children $base] \
! 										[expr { 2 * $count }] end] } \
! 				  errorMessage] } {
! 			puts stderr "doc_make_listbox: error listing $dir\n"
! 		}
! 	}
! 	# exportselection 0 looks good, but selection gets easily out-of-sync
! 	set current_listbox [listbox "[set b "$base.listbox$count"]-list" -yscrollcommand \
! 							 [list "$b-scroll" set] -height 20 -exportselection 0]
! 	pack $current_listbox [scrollbar "$b-scroll" -command [list $current_listbox yview]] \
! 		-side left -expand 1 -fill y -anchor w
! 	foreach item [concat [lsort -dictionary [glob -directory $dir -nocomplain -types {d} -- *]] \
! 					  [lsort -dictionary [glob -directory $dir -nocomplain -types {f} -- *]]]  {
! 		$current_listbox insert end "[file tail $item][expr {[file isdirectory $item] ? {/} : {}}]"
! 	}
! 	bind $current_listbox <Button-1> [list doc_navigate $dir $count %W %x %y]
! 	bind $current_listbox <Double-Button-1> [list doc_double_button $dir $count %W %x %y]
! }
  
! proc doc_navigate {dir count width x y} {
! 	if {[set newdir [$width get [$width index "@$x,$y"]]] eq {}} {
! 		return
! 	}
! 	set dir_to_open [file join $dir $newdir]
! 	if {[file isdirectory $dir_to_open]} {
! 		doc_make_listbox [winfo parent $width] $dir_to_open [incr count]
! 	}
! }
! 
! proc doc_double_button {dir count width x y} {
! 	global pd_guidir
! 	if {[set newdir [$width get [$width index "@$x,$y"]]] eq {}} {
! 		return
! 	}
! 	set dir_to_open [file join $dir $newdir]
! 	if {[file isdirectory $dir_to_open]} {
! 		 doc_navigate $dir $count $width $x $y
! 	} else {
! 		regsub -- $pd_guidir [file dirname $dir_to_open] "" subdir
! 		set file [file tail $dir_to_open]
! 		if { [catch {menu_doc_open $subdir $file} fid] } {
! 			puts stderr "Could not open $pd_guidir/$subdir/$file\n"
           }
+ 		return; 
      }
  }
***************
*** 527,531 ****
          -command {menu_doc_open doc/1.manual index.htm} 
      $mbar.help add command -label {Browser ...} \
!         -command {menu_documentation} 
  }
  
--- 539,543 ----
          -command {menu_doc_open doc/1.manual index.htm} 
      $mbar.help add command -label {Browser ...} \
!         -command {menu_doc_browser $help_top_directory} 
  }
  
***************
*** 1132,1135 ****
--- 1144,1148 ----
  # We don't handle multiple clicks yet.
  
+     bind $name.c <Configure> { pdtk_canvas_autoscrollbars %W %w %h }
      bind $name.c <Button> {pdtk_canvas_click %W %x %y %b 0}
      bind $name.c <Shift-Button> {pdtk_canvas_click %W %x %y %b 1}
***************
*** 1253,1257 ****
                          -selectmode extended \
                          -relief solid -background white -borderwidth 1 \
!                         -font [format -*-courier-bold--normal--%d-* \
                                 $font] \
                          -yscrollcommand "$windowName.lb.sb set"]
--- 1266,1270 ----
                          -selectmode extended \
                          -relief solid -background white -borderwidth 1 \
!                         -font [format {courier %d bold} \
                                 $font] \
                          -yscrollcommand "$windowName.lb.sb set"]
***************
*** 1372,1376 ****
      set y [expr [lindex $bbox 1] - 4]
      set $lbName.entry [entry $lbName.entry \
!                        -font [format -*-courier-bold--normal--%d-* $font]]
      $lbName.entry insert 0 []
      place configure $lbName.entry -relx 0 -y $y -relwidth 1
--- 1385,1389 ----
      set y [expr [lindex $bbox 1] - 4]
      set $lbName.entry [entry $lbName.entry \
!                        -font [format {courier %d bold} $font]]
      $lbName.entry insert 0 []
      place configure $lbName.entry -relx 0 -y $y -relwidth 1
***************
*** 1420,1423 ****
--- 1433,1449 ----
  #the name of the canvas object in Pd.
  
+ proc pdtk_canvas_autoscrollbars {name x y} {
+     set size [$name bbox all]
+     set x2 [lindex $size 2]
+     set y2 [lindex $size 3]
+     set rootname [winfo parent $name]
+     if {$x > $x2} {pack forget $rootname.scrollhort}
+     if {$y > $y2} {pack forget $rootname.scrollvert}
+     if {$x < $x2} {pack $rootname.scrollhort -side bottom \
+                         -fill x -before $rootname.c}
+     if {$y < $y2} {pack $rootname.scrollvert -side right \
+                         -fill y -before $rootname.c}
+ }
+ 
  proc canvastosym {name} {
      string range $name 0 [expr [string length $name] - 3]
***************
*** 3181,3186 ****
  ############ pdtk_text_new -- create a new text object #2###########
  proc pdtk_text_new {canvasname myname x y text font color} {
! #    if {$font < 13} {set fontname [format -*-courier-bold----%d-* $font]}
! #    if {$font >= 13} {set fontname [format -*-courier-----%d-* $font]}
  
          global pd_font1 pd_font2 pd_font3 pd_font4 pd_font5 pd_font6 pd_font7 
--- 3207,3212 ----
  ############ pdtk_text_new -- create a new text object #2###########
  proc pdtk_text_new {canvasname myname x y text font color} {
! #    if {$font < 13} {set fontname [format {courier %d bold} $font]}
! #    if {$font >= 13} {set fontname [format {courier %d normal} $font]}
  
          global pd_font1 pd_font2 pd_font3 pd_font4 pd_font5 pd_font6 pd_font7 
***************
*** 3228,3246 ****
  
  # tb: user defined typefaces
! proc pdtk_pd_startup {version apilist midiapilist fontname} {
! #    puts stderr [concat $version $apilist $fontname]
!     global pd_myversion pd_apilist pd_midiapilist
!     set pd_myversion $version
      set pd_apilist $apilist
      set pd_midiapilist $midiapilist
      global pd_font1 pd_font2 pd_font3 pd_font4 pd_font5 pd_font6 pd_font7
  
!     set pd_font1 [format -*-%s-bold--normal--8-* $fontname]
!     set pd_font2 [format -*-%s-bold--normal--10-* $fontname]
!     set pd_font3 [format -*-%s-bold--normal--12-* $fontname]
!     set pd_font4 [format -*-%s-bold--normal--14-* $fontname]
!     set pd_font5 [format -*-%s-bold--normal--16-* $fontname]
!     set pd_font6 [format -*-%s-bold--normal--24-* $fontname]
!     set pd_font7 [format -*-%s-bold--normal--36-* $fontname]
  
      set width1 [font measure  $pd_font1 x]
--- 3254,3271 ----
  
  # tb: user defined typefaces
! proc pdtk_pd_startup {apilist midiapilist fontname} {
! #    puts stderr [concat $apilist $midiapilist $fontname]
!     global pd_apilist pd_midiapilist
      set pd_apilist $apilist
      set pd_midiapilist $midiapilist
      global pd_font1 pd_font2 pd_font3 pd_font4 pd_font5 pd_font6 pd_font7
  
!     set pd_font1 [format {%s 8 bold} $fontname]
!     set pd_font2 [format {%s 10 bold} $fontname]
!     set pd_font3 [format {%s 12 bold} $fontname]
!     set pd_font4 [format {%s 14 bold} $fontname]
!     set pd_font5 [format {%s 16 bold} $fontname]
!     set pd_font6 [format {%s 24 bold} $fontname]
!     set pd_font7 [format {%s 36 bold} $fontname]
  
      set width1 [font measure  $pd_font1 x]

Index: s_stuff.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_stuff.h,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** s_stuff.h	16 Jul 2005 01:43:18 -0000	1.7
--- s_stuff.h	19 Dec 2006 05:55:44 -0000	1.7.2.1
***************
*** 48,51 ****
--- 48,54 ----
  /* s_loader.c */
  int sys_load_lib(char *dirname, char *filename);
+ int sys_load_lib_alt(char *dirname, char *filename, char* altname);
+ 
+ int sys_load_lib_dir(char *dirname, char *filename);
  
  /* s_audio.c */

Index: g_rtext.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_rtext.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** g_rtext.c	2 Jul 2005 05:03:06 -0000	1.5
--- g_rtext.c	19 Dec 2006 05:55:44 -0000	1.5.2.1
***************
*** 440,444 ****
          x->x_bufsize = newsize;
  
!         if (n == '\n' || isprint(n))
          {
              newsize = x->x_bufsize+1;
--- 440,446 ----
          x->x_bufsize = newsize;
  
! /* at guenter's suggestion, this gets european characters working */
! /*         if (n == '\n' || isprint(n)) */
!         if (n == '\n' || n > 31)
          {
              newsize = x->x_bufsize+1;

Index: m_class.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_class.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** m_class.c	28 Nov 2004 21:20:42 -0000	1.4
--- m_class.c	19 Dec 2006 05:55:44 -0000	1.4.2.1
***************
*** 17,20 ****
--- 17,21 ----
  #include <stdarg.h>
  #include <string.h>
+ #include <stdio.h>
  
  static t_symbol *class_loadsym;     /* name under which an extern is invoked */
***************
*** 509,512 ****
--- 510,515 ----
  
  void canvas_popabstraction(t_canvas *x);
+ void canvas_initbang(t_canvas *x);
+ 
  extern t_pd *newest;
  
***************
*** 514,517 ****
--- 517,556 ----
  int pd_setloadingabstraction(t_symbol *sym);
  
+ 
+ /* replace everything but [a-zA-Z0-9_] by "0x%x" */
+ static char*alternative_classname(char*classname)
+ {
+   char *altname=(char*)getbytes(sizeof(char)*MAXPDSTRING);
+   int count=0;
+   int i=0;
+   for(i=0; i<MAXPDSTRING; i++)
+     altname[i]=0;
+   i=0;
+   while(*classname)
+     {
+       char c=*classname;
+       if((c>=48 && c<=57)|| /* [0-9] */
+          (c>=65 && c<=90)|| /* [A-Z] */
+          (c>=97 && c<=122)||/* [a-z] */
+          (c==95)) /* [_] */
+         {
+           altname[i]=c;
+           i++;
+         }
+       else /* a "bad" character */
+         {
+           sprintf(altname+i, "0x%02x", c);
+           i+=4;
+           count++;
+         }
+       classname++;
+     }
+   if(count>0)return altname;
+   /* seems like the given classname is fine as can be */
+   freebytes(altname, sizeof(char)*MAXPDSTRING);
+   return 0;
+ }
+ 
+ 
      /* this routine is called when a new "object" is requested whose class Pd
      doesn't know.  Pd tries to load it as an extern, then as an abstraction. */
***************
*** 522,529 ****
      int fd;
      char dirbuf[MAXPDSTRING], *nameptr;
      if (tryingalready) return;
      newest = 0;
      class_loadsym = s;
!     if (sys_load_lib(dir->s_name, s->s_name))
      {
          tryingalready = 1;
--- 561,569 ----
      int fd;
      char dirbuf[MAXPDSTRING], *nameptr;
+     char *altname=alternative_classname(s->s_name);
      if (tryingalready) return;
      newest = 0;
      class_loadsym = s;
!     if (sys_load_lib_alt(dir->s_name, s->s_name,altname))
      {
          tryingalready = 1;
***************
*** 536,539 ****
--- 576,581 ----
      if ((fd = open_via_path(dir->s_name, s->s_name, ".pd",
          dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0 ||
+         (altname && (fd = open_via_path(dir->s_name, altname, ".pd",
+               dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) ||
              (fd = open_via_path(dir->s_name, s->s_name, ".pat",
                  dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
***************
*** 544,550 ****
--- 586,594 ----
              canvas_setargs(argc, argv);
              binbuf_evalfile(gensym(nameptr), gensym(dirbuf));
+             canvas_initbang((t_canvas *)(s__X.s_thing));/* JMZ*/
              if (s__X.s_thing != current)
                  canvas_popabstraction((t_canvas *)(s__X.s_thing));
              canvas_setargs(0, 0);
+ 
          }
          else error("%s: can't load abstraction within itself\n", s->s_name);

Index: d_array.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_array.c,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -d -r1.5 -r1.5.4.1
*** d_array.c	11 Nov 2004 04:58:21 -0000	1.5
--- d_array.c	19 Dec 2006 05:55:43 -0000	1.5.4.1
***************
*** 541,550 ****
  
  #else
! #ifdef MACOSX
  #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 /* MACOSX */
  #endif /* __linux__ */
  #endif /* MSW */
--- 541,554 ----
  
  #else
! #ifdef __APPLE__
! #define int32 int  /* a data type that has 32 bits */
! # ifdef __BIG_ENDIAN__
  #define HIOFFSET 0    /* word offset to find MSB */
  #define LOWOFFSET 1    /* word offset to find LSB */
! # else 
! # define HIOFFSET 1    /* word offset to find MSB */
! # define LOWOFFSET 0    /* word offset to find LSB */
! #endif /* __BIG_ENDIAN__ */
! #endif /* __APPLE__ */
  #endif /* __linux__ */
  #endif /* MSW */

Index: g_template.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_template.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -C2 -d -r1.13 -r1.13.2.1
*** g_template.c	21 Aug 2005 17:46:52 -0000	1.13
--- g_template.c	19 Dec 2006 05:55:44 -0000	1.13.2.1
***************
*** 2091,2095 ****
          sys_vgui(".x%lx.c create text %d %d -anchor nw -fill %s -text {%s}",
                  glist_getcanvas(glist), xloc, yloc, colorstring, buf);
!         sys_vgui(" -font -*-courier-bold--normal--%d-*",
              sys_hostfontsize(glist_getfont(glist)));
          sys_vgui(" -tags drawnumber%lx\n", data);
--- 2091,2095 ----
          sys_vgui(".x%lx.c create text %d %d -anchor nw -fill %s -text {%s}",
                  glist_getcanvas(glist), xloc, yloc, colorstring, buf);
!         sys_vgui(" -font {courier %d bold}",
              sys_hostfontsize(glist_getfont(glist)));
          sys_vgui(" -tags drawnumber%lx\n", data);

Index: makefile.in
===================================================================
RCS file: /cvsroot/pure-data/pd/src/makefile.in,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** makefile.in	24 Jul 2005 19:41:14 -0000	1.8
--- makefile.in	19 Dec 2006 05:55:44 -0000	1.8.2.1
***************
*** 1,2 ****
--- 1,7 ----
+ # On Mac OS X, this needs to be defined to enable dlopen and weak linking
+ # support.  Its safe on other platforms since gcc only checks this env var on
+ # Apple's gcc.  <hans at at.or.at>
+ export MACOSX_DEPLOYMENT_TARGET = 10.3
+ 
  VPATH = ../obj:./
  OBJ_DIR = ../obj
***************
*** 6,13 ****
  GUINAME= @GUINAME@
  
! INSTALL_PREFIX = @prefix@
! GFLAGS = -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
  
! MANDIR = @mandir@
  
  MORECFLAGS = @MORECFLAGS@
--- 11,28 ----
  GUINAME= @GUINAME@
  
! prefix = @prefix@
! exec_prefix = @exec_prefix@
! bindir = @bindir@
! includedir = @includedir@
! libdir = @libdir@
! mandir = @mandir@
  
! GFLAGS = -DINSTALL_PREFIX=\"$(prefix)\"
! 
! # varibles to match packages/Makefile.buildlayout so that they can be easily
! # overridden when building Pd-extended builds. <hans at at.or.at>
! libpddir = $(libdir)/pd
! pddocdir = $(libpddir)/doc
! libpdbindir = $(libpddir)/bin
  
  MORECFLAGS = @MORECFLAGS@
***************
*** 31,34 ****
--- 46,53 ----
  SYSSRC += @SYSSRC@
  
+ ASIOSRC = @ASIOSRC@
+ 
+ ASIOOBJ = $(ASIOSRC:.cpp=.o)
+ 
  SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
      g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
***************
*** 53,56 ****
--- 72,89 ----
  GOBJ = $(GSRC:.c=.o)
  
+ # get version from m_pd.h to use in doc/1.manual/1.introduction.txt
+ PD_MAJOR_VERSION := $(shell grep PD_MAJOR_VERSION m_pd.h | \
+ 	sed 's|^.define *PD_MAJOR_VERSION *\([0-9]*\).*|\1|' )
+ PD_MINOR_VERSION := $(shell grep PD_MINOR_VERSION m_pd.h | \
+ 	sed 's|^.define *PD_MINOR_VERSION *\([0-9]*\).*|\1|' )
+ PD_BUGFIX_VERSION := $(shell grep PD_BUGFIX_VERSION m_pd.h | \
+ 	sed 's|^.define *PD_BUGFIX_VERSION *\([0-9]*\).*|\1|' )
+ PD_TEST_VERSION := $(shell grep PD_TEST_VERSION m_pd.h | \
+ 	sed 's|^.define *PD_TEST_VERSION *"\(.*\)".*|\1|' )
+ PD_VERSION := $(PD_MAJOR_VERSION).$(PD_MINOR_VERSION).$(PD_BUGFIX_VERSION)
+ ifneq ($(PD_TEST_VERSION),)
+ 	PD_VERSION := $(PD_VERSION)-$(PD_TEST_VERSION)
+ endif
+ 
  #
  #  ------------------ targets ------------------------------------
***************
*** 71,74 ****
--- 104,110 ----
  	$(CC) $(CFLAGS) $(GFLAGS) $(GINCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c 
  
+ $(ASIOOBJ): %.o : %.cpp
+ 	$(CXX) $(CFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.cpp
+ 
  pd: $(PDEXEC)
  
***************
*** 78,91 ****
  
  $(BIN_DIR)/pd-watchdog: s_watchdog.c
! 	$(CC) -O2 $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c
  
  $(BIN_DIR)/pdsend: u_pdsend.c
! 	$(CC) $(CFLAGS)  $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c
  
  $(BIN_DIR)/pdreceive: u_pdreceive.c
! 	$(CC) $(CFLAGS)  $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
  
! $(PDEXEC): $(OBJ) 
! 	cd ../obj;  $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) \
  	$(LIB)
  
--- 114,127 ----
  
  $(BIN_DIR)/pd-watchdog: s_watchdog.c
! 	$(CC) -O2 $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c $(LIB)
  
  $(BIN_DIR)/pdsend: u_pdsend.c
! 	$(CC) $(CFLAGS)  $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c $(LIB)
  
  $(BIN_DIR)/pdreceive: u_pdreceive.c
! 	$(CC) $(CFLAGS)  $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c $(LIB)
  
! $(PDEXEC): $(OBJ) $(ASIOOBJ)
! 	cd ../obj;  $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(ASIOOBJ) $(OBJ) \
  	$(LIB)
  
***************
*** 110,113 ****
--- 146,155 ----
  		../bin/libPdTcl.dylib
  
+ # this is for Windows/MinGW (only?)
+ $(BIN_DIR)/pdtcl.dll: $(GOBJ)
+ 	cd $(BIN_DIR); dllwrap --export-all-symbols --output-def pdtcl.def \
+ 	--output-lib=pdtcl.a --dllname=$(GUINAME) $(OBJ_DIR)/t_tkcmd.o $(LIB) $(GLIB)
+ 	strip --strip-unneeded $(BIN_DIR)/pdtcl.dll
+ 
  externs: 
  	cd ../extra/bonk~;make @EXTERNTARGET@
***************
*** 119,150 ****
  	cd ../extra/pique;make @EXTERNTARGET@
  
- INSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)
- MANINSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)/$(MANDIR)
  BINARYMODE=@binarymode@
  
  install:  all
! 	install -d $(INSTDIR)/lib/pd/bin
! 	install $(BIN_DIR)/$(GUINAME) $(INSTDIR)/lib/pd/bin/$(GUINAME)
! 	install $(BIN_DIR)/pd-watchdog $(INSTDIR)/lib/pd/bin/pd-watchdog
! 	install -m644 $(BIN_DIR)/pd.tk $(INSTDIR)/lib/pd/bin/pd.tk
! 	install -d $(INSTDIR)/bin
! 	install $(BINARYMODE) $(PDEXEC) $(INSTDIR)/bin/pd
! 	install -m755 $(BIN_DIR)/pdsend $(INSTDIR)/bin/pdsend
! 	install -m755 $(BIN_DIR)/pdreceive $(INSTDIR)/bin/pdreceive 
! 	cp -pr ../doc ../extra $(INSTDIR)/lib/pd/
! 	rm -f $(INSTDIR)/extra/*/*.o
! 	install -d $(INSTDIR)/include
! 	install -m644 m_pd.h $(INSTDIR)/include/m_pd.h
! 	install -d $(MANINSTDIR)/man1
! 	gzip < ../man/pd.1 >  $(MANINSTDIR)/man1/pd.1.gz
! 	chmod 644 $(MANINSTDIR)/man1/pd.1.gz
! 	gzip < ../man/pdsend.1 >  $(MANINSTDIR)/man1/pdsend.1.gz
! 	chmod 644 $(MANINSTDIR)/man1/pdsend.1.gz
! 	gzip < ../man/pdreceive.1 >  $(MANINSTDIR)/man1/pdreceive.1.gz
! 	chmod 644 $(MANINSTDIR)/man1/pdreceive.1.gz
  
  local-clean:
! 	-rm -f ../obj/* $(BIN_DIR)/pd $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
! 	    $(BIN_DIR)/pdreceive $(BIN_DIR)/pd-watchdog m_stamp.c
  	-rm -f `find ../portaudio ../portaudio_v18 -name "*.o"` 
  	-rm -f *~
--- 161,207 ----
  	cd ../extra/pique;make @EXTERNTARGET@
  
  BINARYMODE=@binarymode@
  
+ ABOUT_FILE=$(pddocdir)/1.manual/1.introduction.txt
  install:  all
! 	install -d $(libpdbindir)
! 	install $(BIN_DIR)/$(GUINAME) $(libpdbindir)/$(GUINAME)
! 	install $(BIN_DIR)/pd-watchdog $(libpdbindir)/pd-watchdog
! 	install -m644 $(BIN_DIR)/pd.tk $(libpdbindir)/pd.tk
! 	install -d $(DESTDIR)$(bindir)
! 	install $(BINARYMODE) $(PDEXEC) $(DESTDIR)$(bindir)/pd
! 	install -m755 $(BIN_DIR)/pdsend $(DESTDIR)$(bindir)/pdsend
! 	install -m755 $(BIN_DIR)/pdreceive $(DESTDIR)$(bindir)/pdreceive 
! 	for dir in $(shell ls -1 ../doc | grep -v CVS); do \
! 		echo "installing $$dir"; \
! 		install -d $(pddocdir)/$$dir ; \
! 		install -p ../doc/$$dir/*.* $(pddocdir)/$$dir ; \
! 	done
! 	for dir in $(shell ls -1 ../doc/7.stuff | grep -v CVS); do \
! 		echo "installing 7.stuff/$$dir"; \
! 		install -d $(pddocdir)/7.stuff/$$dir ; \
! 		install -p ../doc/7.stuff/$$dir/*.* $(pddocdir)/7.stuff/$$dir ; \
! 	done
! 	mv $(ABOUT_FILE) $(ABOUT_FILE).tmp
! 	cat $(ABOUT_FILE).tmp | sed 's|PD_VERSION|Pd version $(PD_VERSION)|' \
! 		> $(ABOUT_FILE)
! 	rm $(ABOUT_FILE).tmp
! 	cp -pr ../extra $(libpddir)/
! 	rm -f $(libpddir)/extra/*/*.o
! 	install -d $(DESTDIR)$(includedir)
! 	install -m644 m_pd.h $(DESTDIR)$(includedir)/m_pd.h
! 	install -d $(DESTDIR)$(mandir)/man1
! 	gzip < ../man/pd.1 >  $(DESTDIR)$(mandir)/man1/pd.1.gz
! 	chmod 644 $(DESTDIR)$(mandir)/man1/pd.1.gz
! 	gzip < ../man/pdsend.1 >  $(DESTDIR)$(mandir)/man1/pdsend.1.gz
! 	chmod 644 $(DESTDIR)$(mandir)/man1/pdsend.1.gz
! 	gzip < ../man/pdreceive.1 >  $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
! 	chmod 644 $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
! 	@echo "Pd install succeeded."
  
  local-clean:
! 	-rm -f ../obj/* $(BIN_DIR)/pd $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend* \
! 	    $(BIN_DIR)/pdreceive* $(BIN_DIR)/pd-watchdog* m_stamp.c \
! 		 $(BIN_DIR)/pd.exe $(BIN_DIR)/pdtcl.* $(BIN_DIR)/pd.tk
  	-rm -f `find ../portaudio ../portaudio_v18 -name "*.o"` 
  	-rm -f *~
***************
*** 161,169 ****
  
  distclean: clean
! 	rm -rf config.cache config.log config.status makefile tags \
! 	     autom4te-*.cache
! 	echo all: > makefile
! 	echo -e  "\t./configure" >> makefile
! 	echo -e "\tmake" >> makefile
  
  tags: $(SRC) $(GSRC); ctags *.[ch]
--- 218,225 ----
  
  distclean: clean
! 	-rm -f config.cache config.log config.status makefile configure tags \
! 		autom4te.cache/output.* autom4te.cache/traces.* autom4te.cache/requests
! 	-rmdir autom4te.cache
! 	-rm -rf autom4te-*.cache
  
  tags: $(SRC) $(GSRC); ctags *.[ch]
***************
*** 175,186 ****
  
  uninstall:
! 	rm -f -r $(INSTDIR)/lib/pd
! 	rm -f $(INSTDIR)/bin/pd
! 	rm -f $(INSTDIR)/bin/pdsend
! 	rm -f $(INSTDIR)/bin/pdreceive
! 	rm -f $(INSTDIR)/include/m_pd.h
! 	rm -f $(MANINSTDIR)/man1/pd.1.gz
! 	rm -f $(MANINSTDIR)/man1/pdsend.1.gz
! 	rm -f $(MANINSTDIR)/man1/pdreceive.1.gz
  
  include makefile.dependencies
--- 231,242 ----
  
  uninstall:
! 	rm -f -r $(libpddir)
! 	rm -f $(DESTDIR)$(bindir)/pd
! 	rm -f $(DESTDIR)$(bindir)/pdsend
! 	rm -f $(DESTDIR)$(bindir)/pdreceive
! 	rm -f $(DESTDIR)$(includedir)/m_pd.h
! 	rm -f $(DESTDIR)$(mandir)/man1/pd.1.gz
! 	rm -f $(DESTDIR)$(mandir)/man1/pdsend.1.gz
! 	rm -f $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
  
  include makefile.dependencies

Index: configure.in
===================================================================
RCS file: /cvsroot/pure-data/pd/src/configure.in,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -C2 -d -r1.15 -r1.15.2.1
*** configure.in	16 Aug 2005 04:06:28 -0000	1.15
--- configure.in	19 Dec 2006 05:55:43 -0000	1.15.2.1
***************
*** 20,23 ****
--- 20,24 ----
  AC_SUBST(OSNUMBER)
  AC_SUBST(EXTERNTARGET)
+ AC_SUBST(ASIOSRC)
  
  dnl other defaults
***************
*** 78,82 ****
  dnl Checking for `pthread_create' function in -pthread
  AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread",
!          echo "pthreads required" || exit 1)
  
  dnl look for tcl 8.x... do I really have to go through all this!?
--- 79,86 ----
  dnl Checking for `pthread_create' function in -pthread
  AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread",
!     AC_CHECK_LIB(pthreadGC2, pthread_create, PDLIB="$PDLIB -lpthreadGC2",
!         AC_CHECK_LIB(pthreadGC1, pthread_create, PDLIB="$PDLIB -lpthreadGC1",
!             AC_CHECK_LIB(pthreadGC, pthread_create, PDLIB="$PDLIB -lpthreadGC",
!          echo "pthreads required"; exit 1))))
  
  dnl look for tcl 8.x... do I really have to go through all this!?
***************
*** 109,112 ****
--- 113,121 ----
  if test $foundit == "no";
  then
+     AC_CHECK_HEADER(tcl8.4/tcl.h,
+     	GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.4";foundit=yes,)
+ fi
+ if test $foundit == "no";
+ then
      AC_CHECK_HEADER(tcl8.3/tcl.h,
      	GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.3";foundit=yes,)
***************
*** 120,144 ****
  then
      echo no tcl header found
!     exit -1
  fi
  
! AC_CHECK_LIB(tcl8.7, main,,
!     AC_CHECK_LIB(tcl8.6, main,,
  	AC_CHECK_LIB(tcl8.5, main,,
  	    AC_CHECK_LIB(tcl8.4, main,,
  		AC_CHECK_LIB(tcl8.3, main,,
  		    AC_CHECK_LIB(tcl8.2, main,,
!         		AC_CHECK_LIB(tcl8.0, main,,echo no tcl library found || exit 1)))))))
  
! AC_CHECK_LIB(tk8.7, main,,
!     AC_CHECK_LIB(tk8.6, main,,
  	AC_CHECK_LIB(tk8.5, main,,
  	    AC_CHECK_LIB(tk8.4, main,,
  		AC_CHECK_LIB(tk8.3, main,,
  		    AC_CHECK_LIB(tk8.2, main,,
!         		AC_CHECK_LIB(tk8.0, main,,echo no tk library found || exit 1)))))))
  
  
! if test `uname -s` = Linux;
  then
      dnl Ckecking for ALSA
--- 129,156 ----
  then
      echo no tcl header found
! 	 echo bolding trying without...
! #    exit -1
  fi
  
! AC_CHECK_LIB(tcl85, main,,
  	AC_CHECK_LIB(tcl8.5, main,,
+         AC_CHECK_LIB(tcl84, main,,
  	    AC_CHECK_LIB(tcl8.4, main,,
  		AC_CHECK_LIB(tcl8.3, main,,
  		    AC_CHECK_LIB(tcl8.2, main,,
!         		            AC_CHECK_LIB(tcl8.0, main,,
!                             echo no tcl library found; exit 1)))))))
  
! AC_CHECK_LIB(tk85, main,,
  	AC_CHECK_LIB(tk8.5, main,,
+        AC_CHECK_LIB(tk84, main,,
  	    AC_CHECK_LIB(tk8.4, main,,
  		AC_CHECK_LIB(tk8.3, main,,
  		    AC_CHECK_LIB(tk8.2, main,,
!         		            AC_CHECK_LIB(tk8.0, main,,
!                             echo no tk library found; exit 1)))))))
  
  
! if test `uname -s` == Linux;
  then
      dnl Ckecking for ALSA
***************
*** 255,259 ****
  fi
  
! if test `uname -s` = Darwin;
  then
      LDFLAGS="-Wl -framework CoreAudio \
--- 267,271 ----
  fi
  
! if test `uname -s` == Darwin;
  then
      LDFLAGS="-Wl -framework CoreAudio \
***************
*** 266,270 ****
  	-I../portmidi/porttime \
  	-Wno-error \
! 	-DUSEAPI_PORTAUDIO -DPA_BIG_ENDIAN -DPA19 -DPA_USE_COREAUDIO"
      SYSSRC="s_midi_pm.c s_audio_pa.c \
      	s_audio_pablio.c     \
--- 278,288 ----
  	-I../portmidi/porttime \
  	-Wno-error \
! 	-DUSEAPI_PORTAUDIO -DPA19 -DPA_USE_COREAUDIO"
! 	 if test `uname -p` == powerpc;
! 	 then
! 		  MORECFLAGS="$MORECFLAGS -DPA_BIG_ENDIAN"
! 	 else
! 		  MORECFLAGS="$MORECFLAGS -DPA_LITTLE_ENDIAN"
! 	 fi
      SYSSRC="s_midi_pm.c s_audio_pa.c \
      	s_audio_pablio.c     \
***************
*** 317,328 ****
      if test x$jack == "xyes";
      then
!     	LDFLAGS=$LDFLAGS" -framework Jack"
      fi
      if test x$jack == "xrun";
      then
!         LDFLAGS=$LDFLAGS" -framework Jack"
      fi
  fi
  
  # support for jack, on either linux or darwin:
  
--- 335,379 ----
      if test x$jack == "xyes";
      then
!     	LDFLAGS=$LDFLAGS" -weak_framework Jack"
      fi
      if test x$jack == "xrun";
      then
!         LDFLAGS=$LDFLAGS" -weak_framework Jack"
      fi
  fi
  
+ # only Windows uses ASIO, for the rest, set to blank
+ ASIOSRC=
+ 
+ if test `uname -s` == MINGW32_NT-5.0;
+ then
+     EXT=dll
+     MORECFLAGS="-DUSEAPI_PORTAUDIO -DPA19 -DMSW -DPA_NO_DS -DPD_INTERNAL \
+         -I../portaudio/pa_common -I../portaudio/pablio \
+         -mwindows -mms-bitfields "$MORECFLAGS
+     PDLIB=$PDLIB" -lwsock32 -lwinmm -lole32 -lstdc++"
+ 
+     SYSSRC="s_audio_pa.c s_audio_pablio.c s_audio_paring.c \
+         s_audio_mmio.c s_midi_mmio.c \
+         ../portaudio/pa_common/pa_allocation.c  \
+         ../portaudio/pa_common/pa_converters.c  \
+         ../portaudio/pa_common/pa_cpuload.c     \
+         ../portaudio/pa_common/pa_dither.c      \
+         ../portaudio/pa_common/pa_front.c       \
+         ../portaudio/pa_common/pa_process.c     \
+         ../portaudio/pa_common/pa_skeleton.c    \
+         ../portaudio/pa_common/pa_stream.c      \
+         ../portaudio/pa_common/pa_trace.c       \
+         ../portaudio/pa_win/pa_win_util.c       \
+         ../portaudio/pa_win/pa_win_hostapis.c   \
+         ../portaudio/pa_win_wmme/pa_win_wmme.c"
+ 	 ASIOSRC="../portaudio/pa_asio/iasiothiscallresolver.cpp \
+ 	 ../portaudio/pa_asio/pa_asio.cpp ../asio/asio.cpp \
+ 	 ../asio/asiodrivers.cpp ../asio/asiolist.cpp"
+     STRIPFLAG="--strip-unneeded"
+     GUINAME="pdtcl.dll"
+     GUIFLAGS=
+ fi
+ 
  # support for jack, on either linux or darwin:
  

Index: s_entry.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_entry.c,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -C2 -d -r1.3 -r1.3.6.1
*** s_entry.c	11 Nov 2004 04:58:21 -0000	1.3
--- s_entry.c	19 Dec 2006 05:55:44 -0000	1.3.6.1
***************
*** 4,8 ****
  int sys_main(int argc, char **argv);
  
! #ifdef MSW
  #include <windows.h>
  #include <stdio.h>
--- 4,12 ----
  int sys_main(int argc, char **argv);
  
! /* 
!  * gcc does not support the __try stuff, only MSVC.  Also, MinGW allows you to
!  * use main() instead of WinMain(). <hans at at.or.at>
!  */
! #ifdef _MSC_VER
  #include <windows.h>
  #include <stdio.h>
***************
*** 22,31 ****
  }
  
! #else /* not MSW */
  int main(int argc, char **argv)
  {
      return (sys_main(argc, argv));
  }
! #endif
  
  
--- 26,35 ----
  }
  
! #else /* not _MSC_VER */
  int main(int argc, char **argv)
  {
      return (sys_main(argc, argv));
  }
! #endif /* _MSC_VER */
  
  

Index: x_arithmetic.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/x_arithmetic.c,v
retrieving revision 1.2
retrieving revision 1.2.12.1
diff -C2 -d -r1.2 -r1.2.12.1
*** x_arithmetic.c	6 Sep 2004 20:20:36 -0000	1.2
--- x_arithmetic.c	19 Dec 2006 05:55:45 -0000	1.2.12.1
***************
*** 672,675 ****
--- 672,676 ----
      float x_f1;
      float x_f2;
+     float x_f3;
  } t_clip;
  
***************
*** 677,692 ****
  {
      t_clip *x = (t_clip *)pd_new(clip_class);
-     floatinlet_new(&x->x_ob, &x->x_f1);
      floatinlet_new(&x->x_ob, &x->x_f2);
      outlet_new(&x->x_ob, &s_float);
!     x->x_f1 = f1;
!     x->x_f2 = f2;
      return (x);
  }
  
  static void clip_float(t_clip *x, t_float f)
  {
!     outlet_float(x->x_ob.ob_outlet, (f < x->x_f1 ? x->x_f1 : (
!         f > x->x_f2 ? x->x_f2 : f)));
  }
  
--- 678,700 ----
  {
      t_clip *x = (t_clip *)pd_new(clip_class);
      floatinlet_new(&x->x_ob, &x->x_f2);
+     floatinlet_new(&x->x_ob, &x->x_f3);
      outlet_new(&x->x_ob, &s_float);
!     x->x_f2 = f1;
!     x->x_f3 = f2;
      return (x);
  }
  
+ static void clip_bang(t_clip *x)
+ {
+ 	outlet_float(x->x_ob.ob_outlet, (x->x_f1 < x->x_f2 ? x->x_f2 : (
+         x->x_f1 > x->x_f3 ? x->x_f3 : x->x_f1)));
+ }
+ 
  static void clip_float(t_clip *x, t_float f)
  {
! 	x->x_f1 = f;
! 	outlet_float(x->x_ob.ob_outlet, (x->x_f1 < x->x_f2 ? x->x_f2 : (
!         x->x_f1 > x->x_f3 ? x->x_f3 : x->x_f1)));
  }
  
***************
*** 696,699 ****
--- 704,708 ----
          sizeof(t_clip), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
      class_addfloat(clip_class, clip_float);
+     class_addbang(clip_class, clip_bang);
  }
  

Index: g_text.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_text.c,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** g_text.c	15 Sep 2005 03:17:27 -0000	1.11
--- g_text.c	19 Dec 2006 05:55:44 -0000	1.11.2.1
***************
*** 146,151 ****
              atom_getintarg(1, argc, argv), 0, b);
      }
!     else
!     {
          t_binbuf *b = binbuf_new();
          int xpix, ypix;
--- 146,154 ----
              atom_getintarg(1, argc, argv), 0, b);
      }
!     else if(!glist_isvisible(gl)){
!       /* JMZ: not a good idea to go into interactive mode in a closed canvas... */
!       post("unable to create stub object in closed canvas!");
!       return;
!     } else {
          t_binbuf *b = binbuf_new();
          int xpix, ypix;
***************
*** 414,417 ****
--- 417,425 ----
      {
          int xpix, ypix;
+         /* JMZ: not a good idea to go into interactive mode in a closed canvas... */
+         if(!glist_isvisible(gl)){
+           post("unable to create stub message in closed canvas!");
+           return;
+         }
          pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1);
          glist_noselect(gl);
***************
*** 567,570 ****
--- 575,591 ----
  }
  
+     /* We need a list method because, since there's both an "inlet" and a
+     "nofirstin" flag, the standard list behavior gets confused. */
+ static void gatom_list(t_gatom *x, t_symbol *s, int argc, t_atom *argv)
+ {
+     if (!argc)
+         gatom_bang(x);
+     else if (argv->a_type == A_FLOAT)
+         gatom_float(x, argv->a_w.w_float);
+     else if (argv->a_type == A_SYMBOL)
+         gatom_symbol(x, argv->a_w.w_symbol);
+     else pd_error(x, "gatom_list: need float or symbol");
+ }
+ 
  static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy)
  {
***************
*** 1350,1353 ****
--- 1371,1375 ----
      class_addfloat(gatom_class, gatom_float);
      class_addsymbol(gatom_class, gatom_symbol);
+     class_addlist(gatom_class, gatom_list);
      class_addmethod(gatom_class, (t_method)gatom_set, gensym("set"),
          A_GIMME, 0);

Index: s_main.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_main.c,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -C2 -d -r1.20 -r1.20.2.1
*** s_main.c	2 Dec 2005 04:58:24 -0000	1.20
--- s_main.c	19 Dec 2006 05:55:44 -0000	1.20.2.1
***************
*** 3,10 ****
  * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
  
- char pd_version[] = "Pd version 0.39-2\n";
- char pd_compiletime[] = __TIME__;
- char pd_compiledate[] = __DATE__;
- 
  #include "m_pd.h"
  #include "m_imp.h"
--- 3,6 ----
***************
*** 27,30 ****
--- 23,30 ----
  #endif
  
+ char pd_version[256];
+ char pd_compiletime[] = __TIME__;
+ char pd_compiledate[] = __DATE__;
+ 
  void pd_init(void);
  int sys_argparse(int argc, char **argv);
***************
*** 34,38 ****
--- 34,40 ----
  int m_scheduler(void);
  void sys_addhelppath(char *p);
+ #ifdef USEAPI_ALSA
  void alsa_adddev(char *name);
+ #endif
  
  int sys_debuglevel;
***************
*** 156,164 ****
  
  int sys_defaultfont;
- #ifdef MSW
- #define DEFAULTFONT 12
- #else
  #define DEFAULTFONT 10
- #endif
  
  static void openit(const char *dirname, const char *filename)
--- 158,162 ----
***************
*** 217,220 ****
--- 215,219 ----
      for  (nl = sys_externlist; nl; nl = nl->nl_next)
          if (!sys_load_lib(cwd, nl->nl_string))
+             if (!sys_load_lib_dir(cwd, nl->nl_string))
              post("%s: can't load library", nl->nl_string);
          /* open patches specifies with "-open" args */
***************
*** 255,258 ****
--- 254,260 ----
          return (1);
      sys_afterargparse();                    /* post-argparse settings */
+ 	/* build version string from defines in m_pd.h */
+ 	sprintf(pd_version, "Pd version %d.%d-%d%s\n",PD_MAJOR_VERSION,
+ 			PD_MINOR_VERSION,PD_BUGFIX_VERSION,PD_TEST_VERSION); 
      if (sys_verbose || sys_version) fprintf(stderr, "%scompiled %s %s\n",
          pd_version, pd_compiletime, pd_compiledate);

Index: s_watchdog.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_watchdog.c,v
retrieving revision 1.2
retrieving revision 1.2.14.1
diff -C2 -d -r1.2 -r1.2.14.1
*** s_watchdog.c	6 Sep 2004 20:20:36 -0000	1.2
--- s_watchdog.c	19 Dec 2006 05:55:44 -0000	1.2.14.1
***************
*** 9,14 ****
--- 9,19 ----
  #include <sys/time.h>
  #include <sys/types.h>
+ #ifdef _WIN32
+ #include <io.h>
+ #include <winsock.h>
+ #else
  #include <unistd.h>
  #include <signal.h>
+ #endif /* _WIN32 */
  #include <stdio.h>
  
***************
*** 42,46 ****
--- 47,53 ----
          }
          happy = 0;
+ #ifndef _WIN32
          kill(getppid(), SIGHUP);
+ #endif /* _WIN32 */
          fprintf(stderr, "watchdog: signaling pd...\n"); 
      }

Index: g_canvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** g_canvas.c	21 Aug 2005 14:46:17 -0000	1.11
--- g_canvas.c	19 Dec 2006 05:55:44 -0000	1.11.2.1
***************
*** 1060,1063 ****
--- 1060,1109 ----
      canvas_loadbangsubpatches(x);
  }
+ /* JMZ:
+  * initbang is emitted after the canvas is done, but before the parent canvas is done
+  * therefore, initbangs cannot reach to the outlets
+  */
+ void canvas_initbang(t_canvas *x)
+ {
+     t_gobj *y;
+     t_symbol *s = gensym("initbang");
+     /* run "initbang" for all subpatches, but NOT for the child abstractions */
+     for (y = x->gl_list; y; y = y->g_next)
+       if (pd_class(&y->g_pd) == canvas_class)
+         {
+           if (!canvas_isabstraction((t_canvas *)y))
+             canvas_initbang((t_canvas *)y);
+         }
+ 
+     /* call the initbang()-method for objects that have one */
+     for (y = x->gl_list; y; y = y->g_next)
+       {
+         if ((pd_class(&y->g_pd) != canvas_class) && zgetfn(&y->g_pd, s))
+           {
+             pd_vmess(&y->g_pd, s, "");
+           }
+       }
+ }
+ /* JMZ:
+  * closebang is emitted before the canvas is destroyed
+  * and BEFORE subpatches/abstractions in this canvas are destroyed
+  */
+ void canvas_closebang(t_canvas *x)
+ {
+     t_gobj *y;
+     t_symbol *s = gensym("closebang");
+ 
+     /* call the closebang()-method for objects that have one 
+      * but NOT for subpatches/abstractions: these are called separately
+      * from g_graph:glist_delete()
+      */
+     for (y = x->gl_list; y; y = y->g_next)
+       {
+         if ((pd_class(&y->g_pd) != canvas_class) && zgetfn(&y->g_pd, s))
+           {
+             pd_vmess(&y->g_pd, s, "");
+           }
+       }
+ }
  
      /* When you ask a canvas its size the result is 2 pixels more than what

Index: d_mayer_fft.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/d_mayer_fft.c,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -d -r1.3 -r1.3.2.1
*** d_mayer_fft.c	18 May 2005 04:28:50 -0000	1.3
--- d_mayer_fft.c	19 Dec 2006 05:55:43 -0000	1.3.2.1
***************
*** 49,53 ****
  */
  
! #ifdef MSW
  #pragma warning( disable : 4305 )  /* uncast const double to float */
  #pragma warning( disable : 4244 )  /* uncast double to float */
--- 49,54 ----
  */
  
! /* These pragmas are only used for MSVC, not MinGW or Cygwin <hans at at.or.at> */
! #ifdef _MSC_VER
  #pragma warning( disable : 4305 )  /* uncast const double to float */
  #pragma warning( disable : 4244 )  /* uncast double to float */

Index: x_misc.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/x_misc.c,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -C2 -d -r1.2 -r1.2.10.1
*** x_misc.c	6 Sep 2004 20:20:36 -0000	1.2
--- x_misc.c	19 Dec 2006 05:55:45 -0000	1.2.10.1
***************
*** 112,115 ****
--- 112,175 ----
  }
  
+ 
+ /* -------------------------- JMZ: initbang ------------------------------ */
+ static t_class *initbang_class;
+ 
+ typedef struct _initbang
+ {
+     t_object x_obj;
+ } t_initbang;
+ 
+ static void *initbang_new(void)
+ {
+     t_initbang *x = (t_initbang *)pd_new(initbang_class);
+     outlet_new(&x->x_obj, &s_bang);
+     return (x);
+ }
+ 
+ static void initbang_initbang(t_initbang *x)
+ {
+   if (!sys_noloadbang) /* JMZ: hmm, not sure whether we should respect sys_noloadbang here... */
+         outlet_bang(x->x_obj.ob_outlet);
+ }
+ 
+ static void initbang_setup(void)
+ {
+   initbang_class = class_new(gensym("initbang"), (t_newmethod)initbang_new, 0,
+         sizeof(t_initbang), CLASS_NOINLET, 0);
+     class_addmethod(initbang_class, (t_method)initbang_initbang,
+         gensym("initbang"), 0);
+ }
+ 
+ 
+ /* -------------------------- JMZ: closebang ------------------------------ */
+ static t_class *closebang_class;
+ 
+ typedef struct _closebang
+ {
+     t_object x_obj;
+ } t_closebang;
+ 
+ static void *closebang_new(void)
+ {
+     t_closebang *x = (t_closebang *)pd_new(closebang_class);
+     outlet_new(&x->x_obj, &s_bang);
+     return (x);
+ }
+ static void closebang_closebang(t_closebang *x)
+ {
+   if (!sys_noloadbang) /* JMZ: hmm, not sure whether we should respect sys_noloadbang here... */
+         outlet_bang(x->x_obj.ob_outlet);
+ }
+ 
+ static void closebang_setup(void)
+ {
+   closebang_class = class_new(gensym("closebang"), (t_newmethod)closebang_new, 0,
+         sizeof(t_closebang), CLASS_NOINLET, 0);
+     class_addmethod(closebang_class, (t_method)closebang_closebang,
+         gensym("closebang"), 0);
+ }
+ 
+ 
  /* ------------- namecanvas (delete this later) --------------------- */
  static t_class *namecanvas_class;
***************
*** 315,318 ****
--- 375,380 ----
      random_setup();
      loadbang_setup();
+     initbang_setup();
+     closebang_setup();
      namecanvas_setup();
      serial_setup();

Index: t_tkcmd.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/t_tkcmd.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -d -r1.6 -r1.6.2.1
*** t_tkcmd.c	15 Oct 2005 23:14:28 -0000	1.6
--- t_tkcmd.c	19 Dec 2006 05:55:44 -0000	1.6.2.1
***************
*** 31,35 ****
  #include <io.h>
  #endif
! #ifdef MSW
  #pragma warning( disable : 4305 )  /* uncast const double to float */
  #pragma warning( disable : 4244 )  /* uncast double to float */
--- 31,35 ----
  #include <io.h>
  #endif
! #ifdef _MSC_VER
  #pragma warning( disable : 4305 )  /* uncast const double to float */
  #pragma warning( disable : 4244 )  /* uncast double to float */

Index: s_file.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_file.c,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** s_file.c	15 Oct 2005 23:14:28 -0000	1.8
--- s_file.c	19 Dec 2006 05:55:44 -0000	1.8.2.1
***************
*** 194,198 ****
          return;
      }
!     err = RegSetValueEx(hkey, key, 0, REG_SZ, value, strlen(value)+1);
      if (err != ERROR_SUCCESS)
          post("unable to set registry entry: %s\n", key);
--- 194,198 ----
          return;
      }
!     err = RegSetValueEx(hkey, key, 0, REG_EXPAND_SZ, value, strlen(value)+1);
      if (err != ERROR_SUCCESS)
          post("unable to set registry entry: %s\n", key);

Index: s_inter.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C2 -d -r1.14 -r1.14.2.1
*** s_inter.c	15 Oct 2005 23:14:28 -0000	1.14
--- s_inter.c	19 Dec 2006 05:55:44 -0000	1.14.2.1
***************
*** 10,14 ****
  #include "m_imp.h"
  #include "g_canvas.h"   /* for GUI queueing stuff */
! #ifndef MSW
  #include <unistd.h>
  #include <sys/socket.h>
--- 10,14 ----
  #include "m_imp.h"
  #include "g_canvas.h"   /* for GUI queueing stuff */
! #ifndef _WIN32
  #include <unistd.h>
  #include <sys/socket.h>
***************
*** 24,28 ****
  #include <bstring.h>
  #endif
! #ifdef MSW
  #include <io.h>
  #include <fcntl.h>
--- 24,28 ----
  #include <bstring.h>
  #endif
! #ifdef _WIN32
  #include <io.h>
  #include <fcntl.h>
***************
*** 30,37 ****
--- 30,40 ----
  #include <winsock.h>
  #include <windows.h>
+ # ifdef _MSC_VER
  typedef int pid_t;
+ # endif
  typedef int socklen_t;
  #define EADDRINUSE WSAEADDRINUSE
  #endif
+ 
  #include <stdarg.h>
  #include <signal.h>
***************
*** 86,90 ****
  };
  
- extern char pd_version[];
  extern int sys_guisetportnumber;
  extern char sys_font[]; /* tb: typeface */
--- 89,92 ----
***************
*** 101,105 ****
  /* ----------- functions for timing, signals, priorities, etc  --------- */
  
! #ifdef MSW
  static LARGE_INTEGER nt_inittime;
  static double nt_freq = 0;
--- 103,107 ----
  /* ----------- functions for timing, signals, priorities, etc  --------- */
  
! #ifdef _WIN32
  static LARGE_INTEGER nt_inittime;
  static double nt_freq = 0;
***************
*** 130,134 ****
  }
  #endif
! #endif /* MSW */
  
      /* get "real time" in seconds; take the
--- 132,136 ----
  }
  #endif
! #endif /* _WIN32 */
  
      /* get "real time" in seconds; take the
***************
*** 136,140 ****
  double sys_getrealtime(void)    
  {
! #ifndef MSW
      static struct timeval then;
      struct timeval now;
--- 138,142 ----
  double sys_getrealtime(void)    
  {
! #ifndef _WIN32
      static struct timeval then;
      struct timeval now;
***************
*** 166,174 ****
          for (fp = sys_fdpoll, i = sys_nfdpoll; i--; fp++)
              FD_SET(fp->fdp_fd, &readset);
! #ifdef MSW
          if (sys_maxfd == 0)
                  Sleep(microsec/1000);
          else
! #endif
          select(sys_maxfd+1, &readset, &writeset, &exceptset, &timout);
          for (i = 0; i < sys_nfdpoll; i++)
--- 168,176 ----
          for (fp = sys_fdpoll, i = sys_nfdpoll; i--; fp++)
              FD_SET(fp->fdp_fd, &readset);
! #ifdef _WIN32
          if (sys_maxfd == 0)
                  Sleep(microsec/1000);
          else
! #endif /* _WIN32 */
          select(sys_maxfd+1, &readset, &writeset, &exceptset, &timout);
          for (i = 0; i < sys_nfdpoll; i++)
***************
*** 188,196 ****
      else
      {
! #ifdef MSW
          if (sys_maxfd == 0)
                Sleep(microsec/1000);
          else
! #endif
          select(0, 0, 0, 0, &timout);
          return (0);
--- 190,198 ----
      else
      {
! #ifdef _WIN32
          if (sys_maxfd == 0)
                Sleep(microsec/1000);
          else
! #endif /* _WIN32 */
          select(0, 0, 0, 0, &timout);
          return (0);
***************
*** 336,340 ****
  void sys_sockerror(char *s)
  {
! #ifdef MSW
      int err = WSAGetLastError();
      if (err == 10054) return;
--- 338,342 ----
  void sys_sockerror(char *s)
  {
! #ifdef _WIN32
      int err = WSAGetLastError();
      if (err == 10054) return;
***************
*** 347,351 ****
  #else
      int err = errno;
! #endif
      fprintf(stderr, "%s: %s (%d)\n", s, strerror(err), err);
  }
--- 349,353 ----
  #else
      int err = errno;
! #endif /* _WIN32 */
      fprintf(stderr, "%s: %s (%d)\n", s, strerror(err), err);
  }
***************
*** 550,556 ****
      close(fd);
  #endif
! #ifdef MSW
      closesocket(fd);
! #endif
  }
  
--- 552,558 ----
      close(fd);
  #endif
! #ifdef _WIN32
      closesocket(fd);
! #endif /* _WIN32 */
  }
  
***************
*** 843,847 ****
  #define FIRSTPORTNUM 5400
  
! static int defaultfontshit[] = {
      8, 5, 9, 10, 6, 10, 12, 7, 13, 14, 9, 17, 16, 10, 19, 24, 15, 28,
          24, 15, 28};
--- 845,850 ----
  #define FIRSTPORTNUM 5400
  
! #define MAXFONTS 21
! static int defaultfontshit[MAXFONTS] = {
      8, 5, 9, 10, 6, 10, 12, 7, 13, 14, 9, 17, 16, 10, 19, 24, 15, 28,
          24, 15, 28};
***************
*** 857,864 ****
      int ntry = 0, portno = FIRSTPORTNUM;
      int xsock = -1;
! #ifdef MSW
      short version = MAKEWORD(2, 0);
      WSADATA nobby;
! #endif
  #ifdef UNISTD
      int stdinpipe[2];
--- 860,867 ----
      int ntry = 0, portno = FIRSTPORTNUM;
      int xsock = -1;
! #ifdef _WIN32
      short version = MAKEWORD(2, 0);
      WSADATA nobby;
! #endif /* _WIN32 */
  #ifdef UNISTD
      int stdinpipe[2];
***************
*** 885,891 ****
  #endif
  #endif
! #ifdef MSW
      if (WSAStartup(version, &nobby)) sys_sockerror("WSAstartup");
! #endif
  
      if (sys_nogui)
--- 888,894 ----
  #endif
  #endif
! #ifdef _WIN32
      if (WSAStartup(version, &nobby)) sys_sockerror("WSAstartup");
! #endif /* _WIN32 */
  
      if (sys_nogui)
***************
*** 893,902 ****
              /* fake the GUI's message giving cwd and font sizes; then
              skip starting the GUI up. */
!         t_atom zz[19];
          int i;
! #ifdef MSW
          if (GetCurrentDirectory(MAXPDSTRING, cmdbuf) == 0)
              strcpy(cmdbuf, ".");
! #endif
  #ifdef UNISTD
          if (!getcwd(cmdbuf, MAXPDSTRING))
--- 896,905 ----
              /* fake the GUI's message giving cwd and font sizes; then
              skip starting the GUI up. */
!         t_atom zz[MAXFONTS+2];
          int i;
! #ifdef _WIN32
          if (GetCurrentDirectory(MAXPDSTRING, cmdbuf) == 0)
              strcpy(cmdbuf, ".");
! #endif /* _WIN32 */
  #ifdef UNISTD
          if (!getcwd(cmdbuf, MAXPDSTRING))
***************
*** 905,912 ****
  #endif
          SETSYMBOL(zz, gensym(cmdbuf));
!         for (i = 1; i < 22; i++)
!             SETFLOAT(zz + i, defaultfontshit[i-1]);
!         SETFLOAT(zz+22,0);
!         glob_initfromgui(0, 0, 23, zz);
      }
      else if (sys_guisetportnumber)  /* GUI exists and sent us a port number */
--- 908,915 ----
  #endif
          SETSYMBOL(zz, gensym(cmdbuf));
!         for (i = 0; i < MAXFONTS; i++)
!             SETFLOAT(zz+i+1, defaultfontshit[i]);
!         SETFLOAT(zz+i+1,0);
!         glob_initfromgui(0, 0, MAXFONTS+2, zz);
      }
      else if (sys_guisetportnumber)  /* GUI exists and sent us a port number */
***************
*** 945,958 ****
      else    /* default behavior: start up the GUI ourselves. */
      {
! #ifdef MSW
          char scriptbuf[MAXPDSTRING+30], wishbuf[MAXPDSTRING+30], portbuf[80];
          int spawnret;
  
! #endif
! #ifdef MSW
          char intarg;
  #else
          int intarg;
! #endif
  
          /* create a socket */
--- 948,961 ----
      else    /* default behavior: start up the GUI ourselves. */
      {
! #ifdef _WIN32
          char scriptbuf[MAXPDSTRING+30], wishbuf[MAXPDSTRING+30], portbuf[80];
          int spawnret;
  
! #endif /* _WIN32 */
! #ifdef WIN32
          char intarg;
  #else
          int intarg;
! #endif /* _WIN32 */
  
          /* create a socket */
***************
*** 972,978 ****
          if (setsockopt(xsock, IPPROTO_TCP, TCP_NODELAY,
              &intarg, sizeof(intarg)) < 0)
! #ifndef MSW
                  post("setsockopt (TCP_NODELAY) failed\n")
! #endif
                      ;
          
--- 975,981 ----
          if (setsockopt(xsock, IPPROTO_TCP, TCP_NODELAY,
              &intarg, sizeof(intarg)) < 0)
! #ifndef _WIN32
                  post("setsockopt (TCP_NODELAY) failed\n")
! #endif /* not _WIN32 */
                      ;
          
***************
*** 987,995 ****
          while (bind(xsock, (struct sockaddr *)&server, sizeof(server)) < 0)
          {
! #ifdef MSW
              int err = WSAGetLastError();
  #else
              int err = errno;
! #endif
              if ((ntry++ > 20) || (err != EADDRINUSE))
              {
--- 990,998 ----
          while (bind(xsock, (struct sockaddr *)&server, sizeof(server)) < 0)
          {
! #ifdef _WIN32
              int err = WSAGetLastError();
  #else
              int err = errno;
! #endif /* _WIN32 */
              if ((ntry++ > 20) || (err != EADDRINUSE))
              {
***************
*** 1103,1108 ****
  #endif /* UNISTD */
  
! #ifdef MSW
!             /* in MSW land "guipath" is unused; we just do everything from
              the libdir. */
          /* fprintf(stderr, "%s\n", sys_libdir->s_name); */
--- 1106,1111 ----
  #endif /* UNISTD */
  
! #ifdef _WIN32
!             /* in WIN32 land "guipath" is unused; we just do everything from
              the libdir. */
          /* fprintf(stderr, "%s\n", sys_libdir->s_name); */
***************
*** 1127,1131 ****
          }
  
! #endif /* MSW */
      }
  
--- 1130,1134 ----
          }
  
! #endif /* _WIN32 */
      }
  
***************
*** 1199,1206 ****
  #endif /* __linux__ */
  
! #ifdef MSW
      if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS))
          fprintf(stderr, "pd: couldn't set high priority class\n");
! #endif
  #ifdef MACOSX
      if (sys_hipriority)
--- 1202,1209 ----
  #endif /* __linux__ */
  
! #ifdef _WIN32
      if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS))
          fprintf(stderr, "pd: couldn't set high priority class\n");
! #endif /* _WIN32 */
  #ifdef MACOSX
      if (sys_hipriority)
***************
*** 1246,1251 ****
           sys_get_audio_apis(buf);
           sys_get_midi_apis(buf2);
!          sys_vgui("pdtk_pd_startup {%s} %s %s {%s}\n", pd_version, buf, buf2,
!                                   sys_font); 
      }
      return (0);
--- 1249,1253 ----
           sys_get_audio_apis(buf);
           sys_get_midi_apis(buf2);
!          sys_vgui("pdtk_pd_startup %s %s {%s}\n", buf, buf2, sys_font); 
      }
      return (0);

Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** m_pd.h	19 Aug 2005 23:28:03 -0000	1.8
--- m_pd.h	19 Dec 2006 05:55:44 -0000	1.8.2.1
***************
*** 11,14 ****
--- 11,16 ----
  #define PD_MAJOR_VERSION 0
  #define PD_MINOR_VERSION 39   
+ #define PD_BUGFIX_VERSION 2
+ #define PD_TEST_VERSION "extended-test7"
  
  /* old name for "MSW" flag -- we have to take it for the sake of many old
***************
*** 18,30 ****
  #endif
  
! #ifdef MSW
  /* #pragma warning( disable : 4091 ) */
  #pragma warning( disable : 4305 )  /* uncast const double to float */
  #pragma warning( disable : 4244 )  /* uncast float/int conversion etc. */
  #pragma warning( disable : 4101 )  /* unused automatic variables */
! #endif /* MSW */
  
      /* the external storage class is "extern" in UNIX; in MSW it's ugly. */
! #ifdef MSW
  #ifdef PD_INTERNAL
  #define EXTERN __declspec(dllexport) extern
--- 20,33 ----
  #endif
  
! /* These pragmas are only used for MSVC, not MinGW or Cygwin <hans at at.or.at> */
! #ifdef _MSC_VER
  /* #pragma warning( disable : 4091 ) */
  #pragma warning( disable : 4305 )  /* uncast const double to float */
  #pragma warning( disable : 4244 )  /* uncast float/int conversion etc. */
  #pragma warning( disable : 4101 )  /* unused automatic variables */
! #endif /* _MSC_VER */
  
      /* the external storage class is "extern" in UNIX; in MSW it's ugly. */
! #ifdef _WIN32
  #ifdef PD_INTERNAL
  #define EXTERN __declspec(dllexport) extern
***************
*** 34,38 ****
  #else
  #define EXTERN extern
! #endif /* MSW */
  
      /* and depending on the compiler, hidden data structures are
--- 37,41 ----
  #else
  #define EXTERN extern
! #endif /* _WIN32 */
  
      /* and depending on the compiler, hidden data structures are

Index: g_graph.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_graph.c,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** g_graph.c	15 Sep 2005 03:17:27 -0000	1.9
--- g_graph.c	19 Dec 2006 05:55:44 -0000	1.9.2.1
***************
*** 63,66 ****
--- 63,69 ----
  }
  
+ /* JMZ: emit a closebang message */
+ void canvas_closebang(t_canvas *x);
+ 
      /* delete an object from a glist and free it */
  void glist_delete(t_glist *x, t_gobj *y)
***************
*** 72,76 ****
      int drawcommand = class_isdrawcommand(y->g_pd);
      int wasdeleting;
!     
      wasdeleting = canvas_setdeleting(canvas, 1);
      if (x->gl_editor)
--- 75,84 ----
      int drawcommand = class_isdrawcommand(y->g_pd);
      int wasdeleting;
! 
!     if (pd_class(&y->g_pd) == canvas_class) {
!       /* JMZ: send a closebang to the canvas */
!       canvas_closebang((t_canvas *)y);
!     }
!  
      wasdeleting = canvas_setdeleting(canvas, 1);
      if (x->gl_editor)
***************
*** 740,744 ****
              t_symbol *s = garray_getname((t_garray *)g);
              sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor sw\
!              -font -*-courier-bold--normal--%d-* -tags %s\n",
                  (long)glist_getcanvas(x),  x1, ymin, s->s_name,
                  sys_hostfontsize(glist_getfont(x)), tag);
--- 748,752 ----
              t_symbol *s = garray_getname((t_garray *)g);
              sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor sw\
!              -font {courier %d bold} -tags %s\n",
                  (long)glist_getcanvas(x),  x1, ymin, s->s_name,
                  sys_hostfontsize(glist_getfont(x)), tag);
***************
*** 822,826 ****
          for (i = 0; i < x->gl_nxlabels; i++)
              sys_vgui(".x%lx.c create text\
!         %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n",
                  glist_getcanvas(x),
                  (int)glist_xtopixels(x, atof(x->gl_xlabel[i]->s_name)),
--- 830,834 ----
          for (i = 0; i < x->gl_nxlabels; i++)
              sys_vgui(".x%lx.c create text\
!         %d %d -text {%s} -font {courier %d bold} -tags %s\n",
                  glist_getcanvas(x),
                  (int)glist_xtopixels(x, atof(x->gl_xlabel[i]->s_name)),
***************
*** 831,835 ****
          for (i = 0; i < x->gl_nylabels; i++)
              sys_vgui(".x%lx.c create text\
!         %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n",
                  glist_getcanvas(x),
                  (int)glist_xtopixels(x, x->gl_ylabelx),
--- 839,843 ----
          for (i = 0; i < x->gl_nylabels; i++)
              sys_vgui(".x%lx.c create text\
!         %d %d -text {%s} -font {courier %d bold} -tags %s\n",
                  glist_getcanvas(x),
                  (int)glist_xtopixels(x, x->gl_ylabelx),

Index: g_editor.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_editor.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -C2 -d -r1.13 -r1.13.2.1
*** g_editor.c	15 Sep 2005 03:17:27 -0000	1.13
--- g_editor.c	19 Dec 2006 05:55:44 -0000	1.13.2.1
***************
*** 1028,1037 ****
  #define RIGHTCLICK 8
  
- /* on one-button-mouse machines, you can use double click to
-     mean right click (which gets the popup menu.)  Do this for Mac. */
- #ifdef MACOSX
- #define SIMULATERIGHTCLICK
- #endif
- 
  static double canvas_upclicktime;
  static int canvas_upx, canvas_upy;
--- 1028,1031 ----
***************
*** 1068,1076 ****
      if (doit && !runmode && xpos == canvas_upx && ypos == canvas_upy &&
          sys_getrealtime() - canvas_upclicktime < DCLICKINTERVAL)
- #ifdef SIMULATERIGHTCLICK
-             rightclick = 1;
- #else
              doublemod = 1;
- #endif
      x->gl_editor->e_lastmoved = 0;
      if (doit)
--- 1062,1066 ----
***************
*** 1689,1695 ****
          else
          {
!             sys_vgui(
! "pdtk_check {Close this window??} {.x%lx menuclose 1;\n} yes\n",
!                 x);
          }
      }
--- 1679,1686 ----
          else
          {
! /*             sys_vgui( */
! /* 				"pdtk_check {Close this window??} {.x%lx menuclose 1;\n} yes\n", */
! /*                 x); */
! 			pd_free(&x->gl_pd);
          }
      }





More information about the Pd-cvs mailing list