[PD-cvs] externals/grill/absattr absattr-no.pd, NONE, 1.1 absattr.vcproj, NONE, 1.1 absattr-help.pd, 1.1, 1.2 absattr-sub.pd, 1.1, 1.2 absattr.cpp, 1.3, 1.4 license.txt, 1.1, 1.2 readme.txt, 1.2, 1.3

Thomas Grill xovo at users.sourceforge.net
Wed May 24 14:21:23 CEST 2006


Update of /cvsroot/pure-data/externals/grill/absattr
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4709

Modified Files:
	absattr-help.pd absattr-sub.pd absattr.cpp license.txt 
	readme.txt 
Added Files:
	absattr-no.pd absattr.vcproj 
Log Message:
small fixes
small ad
added loadbang prioritization


Index: absattr-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/absattr/absattr-help.pd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** absattr-help.pd	5 Aug 2005 15:57:32 -0000	1.1
--- absattr-help.pd	24 May 2006 12:21:20 -0000	1.2
***************
*** 1,3 ****
! #N canvas 858 421 470 238 12;
  #X obj 32 186 print EXT;
  #X msg 33 20 getattributes;
--- 1,3 ----
! #N canvas 762 129 502 531 12;
  #X obj 32 186 print EXT;
  #X msg 33 20 getattributes;
***************
*** 6,13 ****
  #X msg 149 99 set attr1;
  #X msg 63 72 get attr1;
! #X obj 32 143 absattr-sub 1 2 3 @attr1 hey ho;
! #X connect 1 0 6 0;
! #X connect 3 0 6 0;
! #X connect 4 0 6 0;
! #X connect 5 0 6 0;
! #X connect 6 0 0 0;
--- 6,23 ----
  #X msg 149 99 set attr1;
  #X msg 63 72 get attr1;
! #X text 152 174 loadbang priority 3 ... comes later;
! #X text 135 304 loadbang priority 1 ... comes sooner;
! #X text 116 379 no loadbang priority given... default = 0;
! #X text 154 200 \$0 represents the parent patch;
! #X text 155 217 (used for grouping loadbang priorities);
! #X text 231 360 internal attr2 is deleted;
! #X obj 29 359 absattr-sub abs1 @attr2;
! #X obj 31 447 absattr-no arg1 arg2;
! #X text 112 471 loadbang disabled inside;
! #X obj 32 143 absattr-sub 1 2 3 @loadbang \$0 3 @attr1 hey ho;
! #X obj 32 277 absattr-sub a b c @loadbang \$0 1 @me and you;
! #X connect 1 0 15 0;
! #X connect 3 0 15 0;
! #X connect 4 0 15 0;
! #X connect 5 0 15 0;
! #X connect 15 0 0 0;

Index: license.txt
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/absattr/license.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** license.txt	5 Aug 2005 15:57:32 -0000	1.1
--- license.txt	24 May 2006 12:21:20 -0000	1.2
***************
*** 1,4 ****
! pdattr - patcher attributes
! Copyright (C) 2005 Thomas Grill
  
  This program is free software; you can redistribute it and/or
--- 1,4 ----
! absattr - patcher attributes
! Copyright (C) 2005-2006 Thomas Grill
  
  This program is free software; you can redistribute it and/or

--- NEW FILE: absattr-no.pd ---
#N canvas 307 422 585 525 12;
#X obj 405 38 inlet;
#X obj 32 187 print ARGS;
#X obj 224 190 print ATTR;
#X obj 377 189 outlet;
#X text 453 38 extern;
#X text 446 191 extern;
#X obj 84 146 t a b;
#X obj 95 112 absattr @loadbang 0;
#X text 274 111 loadbang disabled;
#X obj 82 49 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X text 109 48 dump manually;
#X obj 31 225 print -----------------------;
#X connect 0 0 7 1;
#X connect 6 0 1 0;
#X connect 6 1 11 0;
#X connect 7 0 6 0;
#X connect 7 1 2 0;
#X connect 7 2 3 0;
#X connect 9 0 7 0;

--- NEW FILE: absattr.vcproj ---
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
	ProjectType="Visual C++"
	Version="7.10"
	Name="absattr"
	ProjectGUID="{FE64A824-6DA0-423F-BCAD-91C220DA6F96}"
	Keyword="Win32Proj">
	<Platforms>
		<Platform
			Name="Win32"/>
	</Platforms>
	<Configurations>
		<Configuration
			Name="PD Debug|Win32"
			OutputDirectory="Debug"
			IntermediateDirectory="Debug"
			ConfigurationType="2"
			CharacterSet="2">
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="c:\data\pd\pd-cvs\src;..\flext\source"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;FLEXT_SYS=2"
				MinimalRebuild="TRUE"
				BasicRuntimeChecks="3"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				Detect64BitPortabilityProblems="TRUE"
				DebugInformationFormat="4"/>
			<Tool
				Name="VCCustomBuildTool"/>
			<Tool
				Name="VCLinkerTool"
				AdditionalDependencies="pd.lib"
				OutputFile="$(OutDir)/absattr.dll"
				LinkIncremental="2"
				AdditionalLibraryDirectories="c:\data\pd\pd-cvs\bin"
				GenerateDebugInformation="TRUE"
				ProgramDatabaseFile="$(OutDir)/absattr.pdb"
				SubSystem="2"
				ImportLibrary="$(OutDir)/absattr.lib"
				TargetMachine="1"/>
			<Tool
				Name="VCMIDLTool"/>
			<Tool
				Name="VCPostBuildEventTool"/>
			<Tool
				Name="VCPreBuildEventTool"/>
			<Tool
				Name="VCPreLinkEventTool"/>
			<Tool
				Name="VCResourceCompilerTool"/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"/>
			<Tool
				Name="VCXMLDataGeneratorTool"/>
			<Tool
				Name="VCWebDeploymentTool"/>
			<Tool
				Name="VCManagedWrapperGeneratorTool"/>
			<Tool
				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
		</Configuration>
		<Configuration
			Name="PD Release|Win32"
			OutputDirectory="Release"
			IntermediateDirectory="Release"
			ConfigurationType="2"
			CharacterSet="2">
			<Tool
				Name="VCCLCompilerTool"
				AdditionalIncludeDirectories="c:\programme\audio\pd\src;..\flext\source"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;FLEXT_SYS=2"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				Detect64BitPortabilityProblems="TRUE"
				DebugInformationFormat="3"/>
			<Tool
				Name="VCCustomBuildTool"/>
			<Tool
				Name="VCLinkerTool"
				AdditionalDependencies="pd.lib"
				OutputFile="$(OutDir)/absattr.dll"
				LinkIncremental="1"
				AdditionalLibraryDirectories="c:\programme\audio\pd\bin"
				GenerateDebugInformation="TRUE"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)/absattr.lib"
				TargetMachine="1"/>
			<Tool
				Name="VCMIDLTool"/>
			<Tool
				Name="VCPostBuildEventTool"/>
			<Tool
				Name="VCPreBuildEventTool"/>
			<Tool
				Name="VCPreLinkEventTool"/>
			<Tool
				Name="VCResourceCompilerTool"/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"/>
			<Tool
				Name="VCXMLDataGeneratorTool"/>
			<Tool
				Name="VCWebDeploymentTool"/>
			<Tool
				Name="VCManagedWrapperGeneratorTool"/>
			<Tool
				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<File
			RelativePath=".\absattr.cpp">
		</File>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>

Index: absattr-sub.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/absattr/absattr-sub.pd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** absattr-sub.pd	5 Aug 2005 15:57:32 -0000	1.1
--- absattr-sub.pd	24 May 2006 12:21:20 -0000	1.2
***************
*** 1,6 ****
! #N canvas 307 422 557 497 12;
  #X obj 405 38 inlet;
! #X obj 80 418 print ARGS;
! #X obj 174 418 print ATTR;
  #X obj 392 422 outlet;
  #X obj 72 21 bng 15 250 50 0 empty empty empty 0 -6 0 8 -260818 -1
--- 1,6 ----
! #N canvas 307 422 577 517 12;
  #X obj 405 38 inlet;
! #X obj 47 420 print ARGS;
! #X obj 239 423 print ATTR;
  #X obj 392 422 outlet;
  #X obj 72 21 bng 15 250 50 0 empty empty empty 0 -6 0 8 -260818 -1
***************
*** 13,17 ****
  #X msg 149 153 set newattr \$1;
  #X text 68 36 bang to dump;
- #X obj 70 57 loadbang;
  #X obj 110 345 absattr @attr2 default;
  #X text 453 38 extern;
--- 13,16 ----
***************
*** 26,40 ****
  #X msg 71 91 getattributes;
  #X text 186 93 list attributes;
! #X connect 0 0 13 1;
! #X connect 4 0 13 0;
  #X connect 5 0 10 0;
! #X connect 6 0 13 0;
! #X connect 7 0 13 0;
! #X connect 8 0 13 0;
! #X connect 9 0 13 0;
! #X connect 10 0 13 0;
! #X connect 12 0 13 0;
! #X connect 13 0 1 0;
! #X connect 13 1 2 0;
! #X connect 13 2 3 0;
! #X connect 23 0 13 0;
--- 25,42 ----
  #X msg 71 91 getattributes;
  #X text 186 93 list attributes;
! #X obj 99 379 t a b;
! #X obj 126 450 print -----------------------;
! #X connect 0 0 12 1;
! #X connect 4 0 12 0;
  #X connect 5 0 10 0;
! #X connect 6 0 12 0;
! #X connect 7 0 12 0;
! #X connect 8 0 12 0;
! #X connect 9 0 12 0;
! #X connect 10 0 12 0;
! #X connect 12 0 24 0;
! #X connect 12 1 2 0;
! #X connect 12 2 3 0;
! #X connect 22 0 12 0;
! #X connect 24 0 1 0;
! #X connect 24 1 25 0;

Index: readme.txt
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/absattr/readme.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** readme.txt	5 Aug 2005 16:23:49 -0000	1.2
--- readme.txt	24 May 2006 12:21:20 -0000	1.3
***************
*** 1,5 ****
  absattr - patcher attributes
  
! Copyright (c)2005 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
--- 1,5 ----
  absattr - patcher attributes
  
! Copyright (c)2005-2006 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 43,46 ****
--- 43,50 ----
  Version history:
  
+ 0.2.0:
+ - added loadbang prioritization
+ 
+ 
  0.1.0:
  - first public version

Index: absattr.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/absattr/absattr.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** absattr.cpp	9 Aug 2005 10:31:08 -0000	1.3
--- absattr.cpp	24 May 2006 12:21:20 -0000	1.4
***************
*** 3,7 ****
  absattr - patcher attributes
  
! Copyright (c) 2002-2005 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
--- 3,7 ----
  absattr - patcher attributes
  
! Copyright (c) 2002-2006 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 9,13 ****
  */
  
! #define VERSION "0.1.0"
  
  #include <flext.h>
--- 9,13 ----
  */
  
! #define VERSION "0.2.0"
  
  #include <flext.h>
***************
*** 18,21 ****
--- 18,22 ----
  
  #include <map>
+ #include <set>
  
  class absattr
***************
*** 26,30 ****
  public:
      absattr(int argc,const t_atom *argv)
! //        : loadbang(lb)
      {
          AddInAnything("bang/get/set");
--- 27,32 ----
  public:
      absattr(int argc,const t_atom *argv)
!           : parent(0),prior(0)
!           , loadbang(true)
      {
          AddInAnything("bang/get/set");
***************
*** 35,56 ****
  
  		// process default values (only attributes can have default values)
! 		Process(argc,argv);
  
  		// process canvas arguments
          AtomListStatic<20> args;
          GetCanvasArgs(args);
!         Process(args.Count(),args.Atoms());
      }
  
!     //! dump parameters
!     void m_bang()
      {
!         ToOutList(0,args);
!         for(AttrMap::const_iterator it = attrs.begin(); it != attrs.end(); ++it) {
!             const AtomList &lst = it->second;
!             ToOutAnything(1,it->first,lst.Count(),lst.Atoms());
          }
      }
  
      void m_dump() { DumpAttr(0); }
  
--- 37,77 ----
  
  		// process default values (only attributes can have default values)
! 		Process(argc,argv,false);
  
  		// process canvas arguments
          AtomListStatic<20> args;
          GetCanvasArgs(args);
!         Process(args.Count(),args.Atoms(),true);
! 
!         // add to loadbang registry
!         Objects &o = loadbangs[parent].obj;
!         o.insert(this);
      }
  
!     ~absattr()
      {
!         // remove from loadbang registry
!         Loadbangs::iterator it = loadbangs.find(parent);
!         if(it != loadbangs.end()) {
!             Objects &o = it->second.obj;
!             for(Objects::iterator oit = o.begin(); oit != o.end(); ++oit) {
!                 if(*oit == this) {
!                     // found
!                     o.erase(oit);
!                     break;
!                 }
!             }
!             FLEXT_ASSERT(oit != o.end());
!             if(o.empty()) loadbangs.erase(it);
          }
+         else
+             error("%s - not found in loadbang registry");
      }
  
+     //! dump parameters
+     void m_bang() { BangAttr(0); }
+ 
+     void m_bangx() { BangAttr(1); }
+ 
      void m_dump() { DumpAttr(0); }
  
***************
*** 76,84 ****
      typedef std::map<const t_symbol *,AtomList> AttrMap;
  
! //    bool loadbang;
      AtomList args;
      AttrMap attrs;  
  
! //    virtual void CbLoadbang() { if(loadbang) m_bang(); }
  
      void DumpAttr(int ix)
--- 97,160 ----
      typedef std::map<const t_symbol *,AtomList> AttrMap;
  
!     int parent;  // don't change after inserting into registry
!     float prior; // don't change after inserting into registry
!     bool loadbang;
! 
      AtomList args;
      AttrMap attrs;  
  
!     class Compare
!     {
!     public:
!         bool operator()(const absattr *a,const absattr *b) const { return a->prior == b->prior?a < b:a->prior < b->prior; }
!     };
! 
!     typedef std::set<absattr *,Compare> Objects;
! 
!     struct Loadbang 
!     {
!         double lasttime;
!         Objects obj;
!     };
! 
!     typedef std::map<int,Loadbang> Loadbangs;
! 
!     static Loadbangs loadbangs;
! 
!     virtual void CbLoadbang() 
!     { 
!         // all loadbangs have the same logical time
!     	double time = GetTime();
! 
!         Loadbangs::iterator it = loadbangs.find(parent);
!         if(it != loadbangs.end()) {
!             Loadbang &lb = it->second;
!             // found
!             if(lb.lasttime < time) {
!                 // bang all objects with the same parent in the prioritized order
!                 for(Objects::iterator oit = lb.obj.begin(); oit != lb.obj.end(); ++oit) {
!                     absattr *o = *oit;
!                     FLEXT_ASSERT(o);
!                     if(o->loadbang) o->m_bang();
!                 }
! 
!                 // set timestamp
!                 lb.lasttime = time;
!             }
!         }
!         else
!             error("%s - not found in database");
!     }
! 
!     void BangAttr(int ix)
!     {
!         if(ix == 0)
!             ToOutList(ix,args);
! 
!         for(AttrMap::const_iterator it = attrs.begin(); it != attrs.end(); ++it) {
!             const AtomList &lst = it->second;
!             ToOutAnything(1+ix,it->first,lst.Count(),lst.Atoms());
!         }
!     }
  
      void DumpAttr(int ix)
***************
*** 117,124 ****
      static bool IsAttr(const t_atom &at) { return IsSymbol(at) && *GetString(at) == '@'; }
  
!     void Process(int argc,const t_atom *argv)
      {
!         int cnt;
!         for(cnt = 0; cnt < argc && !IsAttr(argv[cnt]); ++cnt) {}
  
          args.Set(cnt,argv,0,true);
--- 193,199 ----
      static bool IsAttr(const t_atom &at) { return IsSymbol(at) && *GetString(at) == '@'; }
  
!     void Process(int argc,const t_atom *argv,bool ext)
      {
!         int cnt = CheckAttrib(argc,argv);
  
          args.Set(cnt,argv,0,true);
***************
*** 130,138 ****
              --argc,++argv;
  
!             for(cnt = 0; cnt < argc && !IsAttr(argv[cnt]); ++cnt) {}
! 
              if(cnt) {
!                 AtomList &lst = attrs[attr];
!                 lst.Set(cnt,argv,0,true);
                  argc -= cnt,argv += cnt;
              }
--- 205,230 ----
              --argc,++argv;
  
!             cnt = CheckAttrib(argc,argv);
              if(cnt) {
!                 if(attr == sym_loadbang) {
!                     if(ext) {
!                         if(cnt == 2 && CanbeInt(argv[0]) && CanbeFloat(argv[1])) {
!                             parent = GetAInt(argv[0]);
!                             prior = GetAFloat(argv[1]);
!                         }
!                         else
!                             post("%s - expected: @loadbang [parent-id ($0)] priority",thisName());
!                     }
!                     else {
!                         if(cnt == 1 && CanbeBool(*argv))
!                             loadbang = GetABool(*argv);
!                         else
!                             post("%s - expected: @loadbang 0/1",thisName());
!                     }
!                 }
!                 else {
!                     AtomList &lst = attrs[attr];
!                     lst.Set(cnt,argv,0,true);
!                 }
                  argc -= cnt,argv += cnt;
              }
***************
*** 145,152 ****
--- 237,246 ----
  
      static const t_symbol *sym_attributes;
+     static const t_symbol *sym_loadbang;
  
      FLEXT_CALLBACK(m_bang);
      FLEXT_CALLBACK_S(m_get);
      FLEXT_CALLBACK(m_dump);
+     FLEXT_CALLBACK(m_bangx);
      FLEXT_CALLBACK_S(m_getx);
      FLEXT_CALLBACK(m_dumpx);
***************
*** 156,159 ****
--- 250,254 ----
      {
          sym_attributes = MakeSymbol("attributes");
+         sym_loadbang = MakeSymbol("loadbang");
  
          FLEXT_CADDBANG(cl,0,m_bang);
***************
*** 161,164 ****
--- 256,260 ----
          FLEXT_CADDMETHOD_(cl,0,"getattributes",m_dump);
          FLEXT_CADDMETHOD_(cl,0,"set",m_set);
+         FLEXT_CADDBANG(cl,1,m_bangx);
          FLEXT_CADDMETHOD_(cl,1,"get",m_getx);
          FLEXT_CADDMETHOD_(cl,1,"getattributes",m_dumpx);
***************
*** 168,172 ****
--- 264,270 ----
  
  const t_symbol *absattr::sym_attributes;
+ const t_symbol *absattr::sym_loadbang;
  
+ absattr::Loadbangs absattr::loadbangs;
  
  FLEXT_NEW_V("absattr",absattr)





More information about the Pd-cvs mailing list