[PD-cvs] externals/loaders/hexloader Makefile, 1.2, 1.3 hexloader.c, 1.4, 1.5
IOhannes m zmölnig
zmoelnig at users.sourceforge.net
Wed Nov 28 19:58:09 CET 2007
Update of /cvsroot/pure-data/externals/loaders/hexloader
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29332
Modified Files:
Makefile hexloader.c
Log Message:
do not handle abstraction that can be handled by pd-proper
Index: Makefile
===================================================================
RCS file: /cvsroot/pure-data/externals/loaders/hexloader/Makefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile 19 Apr 2007 13:40:34 -0000 1.2
--- Makefile 28 Nov 2007 18:58:07 -0000 1.3
***************
*** 4,8 ****
# path to pd
## change this according to your setup!
! PDROOT=../../../pd
# here we find the sources of pd (and evtl. the pd.lib)
--- 4,9 ----
# path to pd
## change this according to your setup!
! #PDROOT=../../../pd
! PDROOT=/Net/iem/Benutzer/zmoelnig/src/pd-0.41-0test08
# here we find the sources of pd (and evtl. the pd.lib)
Index: hexloader.c
===================================================================
RCS file: /cvsroot/pure-data/externals/loaders/hexloader/hexloader.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** hexloader.c 17 Oct 2007 14:31:26 -0000 1.4
--- hexloader.c 28 Nov 2007 18:58:07 -0000 1.5
***************
*** 670,684 ****
int extindex=0;
char*extent=patch_extent[extindex];
! while(extent!=0) {
! if ((fd = open_via_path(".", altname, extent, dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) {
! t_symbol*s;
! close (fd);
! t_filepath*fp=hexloader_loadpatch(dirbuf, nameptr, altname, classname);
! if(fp) {
! return fp;
}
}
- extindex++;
- extent=patch_extent[extindex];
}
altnames=altnames->next;
--- 670,686 ----
int extindex=0;
char*extent=patch_extent[extindex];
! if(strcmp(altname, classname)) { /* we only try if it is worth trying... */
! while(extent!=0) {
! if ((fd = open_via_path(".", altname, extent, dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) {
! t_symbol*s;
! close (fd);
! t_filepath*fp=hexloader_loadpatch(dirbuf, nameptr, altname, classname);
! if(fp) {
! return fp;
! }
}
+ extindex++;
+ extent=patch_extent[extindex];
}
}
altnames=altnames->next;
***************
*** 688,691 ****
--- 690,699 ----
}
+
+ /**
+ * this is the actual loader:
+ * we first try to load an external with alternative (hexified) names
+ * if this fails, we fall back to load a patch with athese names
+ */
static int hexloader_doloader(t_canvas *canvas, filelist_t*altnames0, char*classname)
{
***************
*** 704,707 ****
--- 712,735 ----
/**
+ * recursive use of our powers:
+ * try to load the object with alternative (hexified) names using other available loaders
+ * when it comes to us, we just return 0...
+ */
+ static int hexloader_callothers(t_canvas *canvas, filelist_t*altnames) {
+ int result=0;
+ while(altnames) {
+ char*altname=altnames->name;
+ verbose(2, "calling sys_load with '%s'", altname);
+ result=sys_load_lib(canvas, altname);
+ if(result==1) {
+ return 1;
+ }
+ altnames=altnames->next;
+ }
+ return 0;
+ }
+
+
+ /**
* the loader
*
***************
*** 722,727 ****
altnames=hexloader_getalternatives(classname);
! /* do the loading */
! result=hexloader_doloader(canvas, altnames, classname);
/* clean up */
--- 750,762 ----
altnames=hexloader_getalternatives(classname);
! /* try other loaders with our power */
! if(result==0){
! result=hexloader_callothers(canvas, altnames);
! }
!
! /* do the loading ourselves */
! if(result==0) {
! result=hexloader_doloader(canvas, altnames, classname);
! }
/* clean up */
***************
*** 738,745 ****
filelist_t*altnames=0;
! post("hexloader: disguising as '%s'", s->s_name);
if(!pd_objectmaker) {
! post("BUG: no pd_objectmaker found");
return 0;
}
--- 773,780 ----
filelist_t*altnames=0;
! verbose(1, "hexloader: disguising as '%s'", s->s_name);
if(!pd_objectmaker) {
! error("BUG: no pd_objectmaker found");
return 0;
}
More information about the Pd-cvs
mailing list