[PD-cvs] externals/grill/pool pool-0.2.dtd,NONE,1.1 data.cpp,1.11,1.12 main.cpp,1.11,1.12 pool.cpp,1.14,1.15 pool.pd,1.9,1.10 pool.vcproj,1.3,1.4 readme.txt,1.13,1.14 pool.dtd,1.2,NONE

xovo at users.sourceforge.net xovo at users.sourceforge.net
Wed Dec 17 04:37:57 CET 2003


Update of /cvsroot/pure-data/externals/grill/pool
In directory sc8-pr-cvs1:/tmp/cvs-serv14151

Modified Files:
	data.cpp main.cpp pool.cpp pool.pd pool.vcproj readme.txt 
Added Files:
	pool-0.2.dtd 
Removed Files:
	pool.dtd 
Log Message:
 ""

--- NEW FILE: pool-0.2.dtd ---
<!ELEMENT pool (dir|value)*)>
<!ELEMENT dir (key+,dir*,value*)>
<!ELEMENT value (key+,data?)>
<!ELEMENT key (#CDATA)>
<!ELEMENT data (#CDATA)>

Index: data.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/data.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** data.cpp	6 Dec 2003 03:38:13 -0000	1.11
--- data.cpp	17 Dec 2003 03:37:55 -0000	1.12
***************
*** 280,285 ****
              if(fl.good()) {
                  fl << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" << endl;
! //                fl << "<!DOCTYPE pool SYSTEM \"http://www.parasitaere-kapazitaeten.net/ext/pool/pool.dtd\">" << endl;
!                 fl << "<!DOCTYPE pool SYSTEM \"pool.dtd\">" << endl;
                  fl << "<pool>" << endl;
                  BL ret = pd->SvDirXML(fl,depth,tmp);
--- 280,284 ----
              if(fl.good()) {
                  fl << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" << endl;
!                 fl << "<!DOCTYPE pool SYSTEM \"http://www.parasitaere-kapazitaeten.net/ext/pool/pool-0.2.dtd\">" << endl;
                  fl << "<pool>" << endl;
                  BL ret = pd->SvDirXML(fl,depth,tmp);

Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/main.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** main.cpp	9 Dec 2003 03:38:54 -0000	1.11
--- main.cpp	17 Dec 2003 03:37:55 -0000	1.12
***************
*** 44,48 ****
  	V m_getdir();
  
! 	V m_mkdir(I argc,const A *argv,BL abs = true);		// make and change to dir
  	V m_chdir(I argc,const A *argv,BL abs = true);		// change to dir
  	V m_rmdir(I argc,const A *argv,BL abs = true);		// remove dir
--- 44,49 ----
  	V m_getdir();
  
! 	V m_mkdir(I argc,const A *argv,BL abs = true,BL chg = false); // make (and change) to dir
! 	V m_mkchdir(I argc,const A *argv) { m_mkdir(argc,argv,true,true); } // make and change to dir
  	V m_chdir(I argc,const A *argv,BL abs = true);		// change to dir
  	V m_rmdir(I argc,const A *argv,BL abs = true);		// remove dir
***************
*** 50,53 ****
--- 51,55 ----
  
  	V m_mksub(I argc,const A *argv) { m_mkdir(argc,argv,false); }
+ 	V m_mkchsub(I argc,const A *argv) { m_mkdir(argc,argv,false,true); }
  	V m_chsub(I argc,const A *argv) { m_chdir(argc,argv,false); }
  	V m_rmsub(I argc,const A *argv) { m_rmdir(argc,argv,false); }
***************
*** 163,170 ****
--- 165,174 ----
  	FLEXT_CALLBACK_V(m_mkdir)
  	FLEXT_CALLBACK_V(m_chdir)
+ 	FLEXT_CALLBACK_V(m_mkchdir)
  	FLEXT_CALLBACK_V(m_updir)
  	FLEXT_CALLBACK_V(m_rmdir)
  	FLEXT_CALLBACK_V(m_mksub)
  	FLEXT_CALLBACK_V(m_chsub)
+ 	FLEXT_CALLBACK_V(m_mkchsub)
  	FLEXT_CALLBACK_V(m_rmsub)
  
***************
*** 241,248 ****
--- 245,254 ----
  	FLEXT_CADDMETHOD_(c,0,"mkdir",m_mkdir);
  	FLEXT_CADDMETHOD_(c,0,"chdir",m_chdir);
+ 	FLEXT_CADDMETHOD_(c,0,"mkchdir",m_mkchdir);
  	FLEXT_CADDMETHOD_(c,0,"rmdir",m_rmdir);
  	FLEXT_CADDMETHOD_(c,0,"updir",m_updir);
  	FLEXT_CADDMETHOD_(c,0,"mksub",m_mksub);
  	FLEXT_CADDMETHOD_(c,0,"chsub",m_chsub);
+ 	FLEXT_CADDMETHOD_(c,0,"mkchsub",m_mkchsub);
  	FLEXT_CADDMETHOD_(c,0,"rmsub",m_rmsub);
  
***************
*** 381,388 ****
  V pool::m_getdir() { getdir(MakeSymbol("getdir")); }
  
! V pool::m_mkdir(I argc,const A *argv,BL abs)
  {
  	if(!ValChk(argc,argv))
! 		post("%s - mkdir: invalid directory name",thisName());
  	else {
  		AtomList ndir;
--- 387,395 ----
  V pool::m_getdir() { getdir(MakeSymbol("getdir")); }
  
! V pool::m_mkdir(I argc,const A *argv,BL abs,BL chg)
  {
+     const char *nm = chg?"mkchdir":"mkdir";
  	if(!ValChk(argc,argv))
! 		post("%s - %s: invalid directory name",thisName(),nm);
  	else {
  		AtomList ndir;
***************
*** 390,395 ****
  		else (ndir = curdir).Append(argc,argv);
  		if(!pl->MkDir(ndir,vcnt,dcnt)) {
! 			post("%s - mkdir: directory couldn't be created",thisName());
  		}
  	}
  
--- 397,405 ----
  		else (ndir = curdir).Append(argc,argv);
  		if(!pl->MkDir(ndir,vcnt,dcnt)) {
! 			post("%s - %s: directory couldn't be created",thisName(),nm);
  		}
+         else if(chg) 
+             // change to newly created directory
+             curdir = ndir;
  	}
  

Index: pool.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/pool.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** pool.cpp	15 Dec 2003 03:37:53 -0000	1.14
--- pool.cpp	17 Dec 2003 03:37:55 -0000	1.15
***************
*** 538,544 ****
  	for(I i = 1; !is.eof(); ++i) {
  		AtomList d,k,*v = new AtomList;
! 		BL r = ReadAtoms(is,d,',');
! 		r = r && ReadAtoms(is,k,',') && k.Count() == 1;
! 		r = r && ReadAtoms(is,*v,'\n') && v->Count();
  
  		if(r) {
--- 538,545 ----
  	for(I i = 1; !is.eof(); ++i) {
  		AtomList d,k,*v = new AtomList;
! 		BL r = 
!             ReadAtoms(is,d,',') && 
!             ReadAtoms(is,k,',') && k.Count() == 1 && 
!             ReadAtoms(is,*v,'\n');
  
  		if(r) {
***************
*** 594,631 ****
  };
  
! static bool gettag(istream &is,xmltag &t)
  {
!     while(isspace(is.peek())) is.get();
!     if(is.peek() == '<') {
!         is.get();
!         char tmp[256];
!         is.getline(tmp,sizeof tmp,'>');
!         char *tb = tmp,*te = tmp+strlen(tmp)-1,*tf;
  
!         for(; isspace(*tb); ++tb);
!         if(*tb == '/') {
!             t.type = xmltag::t_end;
!             for(++tb; isspace(*tb); ++tb);
          }
!         else {
!             for(; isspace(*te); --te);
!             if(*te == '/') {
!                 for(--te; isspace(*te); --te);
!                 t.type = xmltag::t_empty;
              }
-             else
-                 t.type = xmltag::t_start;
          }
  
!         for(tf = tb; tf <= te && *tf && !isspace(*tf); ++tf);
!         t.tag.assign(tb,tf-tb);
!         while(isspace(*tf)) ++tf;
!         t.attr.assign(tf,te-tf+1);
!         return true;
!     }
!     else {
!         t.Clear();
!         return false;
      }
  }
  
--- 595,678 ----
  };
  
! static bool gettag(istream &is,xmltag &tag)
  {
!     static const char *commstt = "<!--",*commend = "-->";
  
!     for(;;) {
!         // eat whitespace
!         while(isspace(is.peek())) is.get();
! 
!         // no tag begin -> break
!         if(is.peek() != '<') break;
!         is.get(); // swallow <
! 
!         char tmp[1024],*t = tmp;
! 
!         // parse for comment start
!         const char *c = commstt;
!         while(*++c) {
!             if(*c != is.peek()) break;
!             *(t++) = is.get();
          }
! 
!         if(!*c) { // is comment
!             char cmp[2] = {0,0};
!             for(int ic = 0; ; ic = (++ic)%2) {
!                 char c = is.get();
!                 if(c == '>') {
!                     for(int i = 0; i < 2 && cmp[(ic+i)%2] == commend[i]; ++i);
!                     if(i == 2) break; // comment end!
!                 }
!                 else
!                     cmp[ic] = c;
              }
          }
+         else {
+             // parse until > with consideration of "s
+             bool intx = false;
+             for(;;) {
+                 *t = is.get();
+                 if(*t == '"') intx = !intx;
+                 else if(*t == '>' && !intx) {
+                     *t = 0;
+                     break;
+                 }
+                 t++;
+             }
  
!             // look for tag slashes
! 
!             char *tb = tmp,*te = t-1,*tf;
! 
!             for(; isspace(*tb); ++tb);
!             if(*tb == '/') { 
!                 // slash at the beginning -> end tag
!                 tag.type = xmltag::t_end;
!                 for(++tb; isspace(*tb); ++tb);
!             }
!             else {
!                 for(; isspace(*te); --te);
!                 if(*te == '/') { 
!                     // slash at the end -> empty tag
!                     for(--te; isspace(*te); --te);
!                     tag.type = xmltag::t_empty;
!                 }
!                 else 
!                     // no slash -> begin tag
!                     tag.type = xmltag::t_start;
!             }
! 
!             // copy tag text without slashes
!             for(tf = tb; tf <= te && *tf && !isspace(*tf); ++tf);
!             tag.tag.assign(tb,tf-tb);
!             while(isspace(*tf)) ++tf;
!             tag.attr.assign(tf,te-tf+1);
! 
!             return true;
!         }
      }
+ 
+     tag.Clear();
+     return false;
  }
  
***************
*** 648,651 ****
--- 695,700 ----
      AtomList d,k,v;
      bool inpool = false,inval = false,inkey = false,indata = false;
+     const t_symbol *empty = MakeSymbol("");
+ 
  	while(!is.eof()) {
          xmltag tag;
***************
*** 698,703 ****
              if(tag == "dir") {
                  if(tag.type == xmltag::t_start) {
                      // initialize dir key as empty
!                     t_atom at; SetString(at,"");
                      d.Append(at);
                  }
--- 747,756 ----
              if(tag == "dir") {
                  if(tag.type == xmltag::t_start) {
+                     // warn if last directory key was not given
+                     if(d.Count() && GetSymbol(d[d.Count()-1]) == empty)
+                         post("pool - XML load: dir key must be given prior to subdirs, ignoring items");
+ 
                      // initialize dir key as empty
!                     t_atom at; SetSymbol(at,empty);
                      d.Append(at);
                  }
***************
*** 717,728 ****
          			if(depth < 0 || d.Count() <= depth) {
                          // NOW set value
!                         const char *ds = d.Count()?GetString(d[d.Count()-1]):NULL;
!                         if(!ds || !*ds)
!                             post("pool - XML load: dir key must be given prior to dir values");
                          else {
! 				            pooldir *nd = mkdir?AddDir(d):GetDir(d);
! 				            if(nd) {
!                                 // only use first word of key
!                                 if(k.Count() == 1)
                                      nd->SetVal(k[0],new AtomList(v));
                                  else
--- 770,790 ----
          			if(depth < 0 || d.Count() <= depth) {
                          // NOW set value
! 
!                         int fnd;
!                         for(fnd = d.Count()-1; fnd >= 0; --fnd)
!                             if(GetSymbol(d[fnd]) == empty) break;
! 
!                         // look if last dir key has been given
!                         if(fnd >= 0) {
!                             if(fnd == d.Count()-1)
!                                 post("pool - XML load: dir key must be given prior to values");
! 
!                             // else: one directoy level has been left unintialized, ignore items
!                         }
                          else {
!                             // only use first word of key
!                             if(k.Count() == 1) {
! 		        		        pooldir *nd = mkdir?AddDir(d):GetDir(d);
!         				        if(nd) 
                                      nd->SetVal(k[0],new AtomList(v));
                                  else

Index: pool.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/pool.pd,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** pool.pd	6 Dec 2003 03:38:13 -0000	1.9
--- pool.pd	17 Dec 2003 03:37:55 -0000	1.10
***************
*** 1,3 ****
! #N canvas 12 3 946 702 12;
  #X msg 296 105 set 1 2 3;
  #X obj 308 619 print K;
--- 1,3 ----
! #N canvas 12 3 948 704 12;
  #X msg 296 105 set 1 2 3;
  #X obj 308 619 print K;
***************
*** 55,86 ****
  #X text 673 378 (depth may be given);
  #X text 295 258 set but don't replace;
! #N canvas 0 0 520 546 dirs 0;
! #X msg 109 27 mkdir fld1;
! #X msg 111 122 chdir;
! #X msg 110 217 updir;
! #X msg 111 354 getsub -1;
! #X text 110 7 make absolute dir;
! #X text 109 51 make relative dir;
! #X msg 110 72 mksub fld2;
! #X text 109 104 change to absolute dir;
! #X msg 110 165 chsub fld2;
! #X text 108 146 change to relative dir;
! #X text 106 198 change to upper dir;
! #X text 107 250 remove absolute dir;
! #X msg 108 269 rmdir fld1;
! #X msg 110 308 rmsub fld2;
! #X text 109 289 remove relative dir;
! #X text 109 336 get subdirs;
! #X text 251 380 -1 ... infinite;
! #X text 167 213 depth may be given;
! #X text 168 229 default=1;
! #X text 209 349 depth may be given;
! #X text 207 365 default=1;
! #X text 108 377 count subdirs;
! #X msg 111 398 cntsub -1;
! #X msg 111 458 getdir;
! #X text 110 438 get current dir;
! #X text 176 458 always absolute;
! #X obj 11 239 s \$0-pool;
  #X connect 0 0 26 0;
  #X connect 1 0 26 0;
--- 55,90 ----
  #X text 673 378 (depth may be given);
  #X text 295 258 set but don't replace;
! #N canvas 472 45 416 627 dirs 0;
! #X msg 111 40 mkdir fld1;
! #X msg 113 135 chdir;
! #X msg 109 331 updir;
! #X msg 110 468 getsub -1;
! #X text 112 20 make absolute dir;
! #X text 111 64 make relative dir;
! #X msg 112 85 mksub fld2;
! #X text 111 117 change to absolute dir;
! #X msg 112 178 chsub fld2;
! #X text 110 159 change to relative dir;
! #X text 105 312 change to upper dir;
! #X text 106 364 remove absolute dir;
! #X msg 107 383 rmdir fld1;
! #X msg 109 422 rmsub fld2;
! #X text 108 403 remove relative dir;
! #X text 108 450 get subdirs;
! #X text 250 494 -1 ... infinite;
! #X text 166 327 depth may be given;
! #X text 167 343 default=1;
! #X text 208 463 depth may be given;
! #X text 206 479 default=1;
! #X text 107 491 count subdirs;
! #X msg 110 512 cntsub -1;
! #X msg 110 572 getdir;
! #X text 109 552 get current dir;
! #X text 175 572 always absolute;
! #X obj 13 252 s \$0-pool;
! #X msg 111 231 mkchdir fld1;
! #X text 112 211 make and change to absolute dir;
! #X msg 109 276 mkchsub fld2;
! #X text 110 256 make and change to relative dir;
  #X connect 0 0 26 0;
  #X connect 1 0 26 0;
***************
*** 93,96 ****
--- 97,102 ----
  #X connect 22 0 26 0;
  #X connect 23 0 26 0;
+ #X connect 27 0 26 0;
+ #X connect 29 0 26 0;
  #X restore 716 496 pd dirs;
  #X text 713 470 directory operations;
***************
*** 188,193 ****
  #X text 174 517 data is shared among pool objects with the same name
  ;
! #X obj 26 10 cnv 15 850 40 empty empty pool 10 22 0 24 -260818 -1 0
! ;
  #X text 272 33 http://www.parasitaere-kapazitaeten.net;
  #X obj 456 541 print A;
--- 194,199 ----
  #X text 174 517 data is shared among pool objects with the same name
  ;
! #X obj 26 10 cnv 15 850 40 empty empty empty 10 22 0 24 -260818 -1
! 0;
  #X text 272 33 http://www.parasitaere-kapazitaeten.net;
  #X obj 456 541 print A;
***************
*** 208,212 ****
  #X text 328 466 (see attributes in properties dialog);
  #X text 715 638 console printout;
! #N canvas 0 0 553 284 print 0;
  #X obj 21 231 s \$0-pool;
  #X msg 109 80 printall;
--- 214,218 ----
  #X text 328 466 (see attributes in properties dialog);
  #X text 715 638 console printout;
! #N canvas 0 0 559 290 print 0;
  #X obj 21 231 s \$0-pool;
  #X msg 109 80 printall;

Index: pool.vcproj
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/pool.vcproj,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pool.vcproj	3 Sep 2003 02:38:08 -0000	1.3
--- pool.vcproj	17 Dec 2003 03:37:55 -0000	1.4
***************
*** 396,402 ****
  		</File>
  		<File
- 			RelativePath="pool.dtd">
- 		</File>
- 		<File
  			RelativePath="pool.h">
  		</File>
--- 396,399 ----

Index: readme.txt
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/readme.txt,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** readme.txt	6 Dec 2003 03:38:13 -0000	1.13
--- readme.txt	17 Dec 2003 03:37:55 -0000	1.14
***************
*** 66,69 ****
--- 66,70 ----
  - relative file names will be based on the folder of the current patcher
  - added printall, printrec, printroot messages for console printout
+ - added mkchdir, mkchsub to create and change to directories at once
  
  0.1.0:
***************
*** 73,80 ****
  
  BUGS:
! - pool does not handle symbols with spaces or all digits
  
  
  TODO list:
  
  general:
--- 74,82 ----
  
  BUGS:
! - pool does not handle symbols with spaces, colons or all digits
  
  
  TODO list:
+ - check for invalid symbols (spaces, colons)
  
  general:

--- pool.dtd DELETED ---






More information about the Pd-cvs mailing list