From 8962b1a80a85ca751ac4fab5b2d9e09fae6fd6d0 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 7 Sep 2010 16:57:22 +0000 Subject: reorganized libdir loader into its own folder based on the Makefile library template svn path=/trunk/; revision=13981 --- externals/loaders/README | 25 ----------- externals/loaders/TODO | 26 ----------- externals/loaders/libdir.c | 107 --------------------------------------------- 3 files changed, 158 deletions(-) delete mode 100644 externals/loaders/TODO delete mode 100644 externals/loaders/libdir.c (limited to 'externals') diff --git a/externals/loaders/README b/externals/loaders/README index 7b64a5b5..a29c178a 100644 --- a/externals/loaders/README +++ b/externals/loaders/README @@ -1,28 +1,3 @@ ------- -libdir ------- - - -This package provides support for the libdir format of libraries that is used -in Pd-extended. It should work with any version of Pd 0.40 or newer. - -To install, copy the files for your platform into your "extra" folder and the -help patches to the "doc/5.reference" folder. You will need to load the -libdir.dll/libdir.pd_linux/libdir.pd_darwin as a library before trying to load -any libdirs. The libdirs have to be in the global classpath in order to be -found. - -You can add a library two ways: - - add this text to one of the fields in the "Startup" prefs: libdir - - load it on the command line with this: -lib libdir - -For more info on the structure of libdirs, see this webpage: - -http://puredata.org/docs/developer/Libdir - -If you want to compile these yourself, it will be much easier to compile it -out of the pure-data CVS. Otherwise, just drop these into any working -externals build system and they should compile, they are very simple C files. --------- hexloader diff --git a/externals/loaders/TODO b/externals/loaders/TODO deleted file mode 100644 index e8c3c4da..00000000 --- a/externals/loaders/TODO +++ /dev/null @@ -1,26 +0,0 @@ - -- implement [classpath] which adds a path to the global path, like what - [declare -stdpath] does. The idea is that the global path serves as a - Java-style classpath. and the local path serves as the namespace. - - - inlet accepts bang to output classpath on outlet - - inlet accepts messages to add items to the classpath - - follows same interface as [textfile], [qlist] - -- implement [import] which adds the libdir path to the canvas path, similar - [declare -lib] does, except that it only looks in the global path (aka - classpath) - - - inlet accepts bang to output canvas path on outlet - - inlet accepts messages to add items to the canvas path - - follows same interface as [textfile], [qlist] - -- make [libdir] load libdirs when they are called with [import] and [declare - -lib] and [declare -stdlib]. - -- [libdir] loader should only add the libdir to the helppath, not the - additional doc/5.reference path to the helppath. The idea is that libdirs - are self-contained. - - -- test binary on 0.41 test diff --git a/externals/loaders/libdir.c b/externals/loaders/libdir.c deleted file mode 100644 index 942464d1..00000000 --- a/externals/loaders/libdir.c +++ /dev/null @@ -1,107 +0,0 @@ -#include "m_pd.h" -#include "s_stuff.h" -#include "g_canvas.h" -#include -#include -#include - -/* this object requires Pd 0.40.3 or later */ - -/* WARNING: KLUDGE! */ -/* - * this struct is not publically defined (its in g_canvas.c) so I need to - * include this here. Its from Pd 0.41-test03 2006-11-19. */ -struct _canvasenvironment -{ - t_symbol *ce_dir; /* directory patch lives in */ - int ce_argc; /* number of "$" arguments */ - t_atom *ce_argv; /* array of "$" arguments */ - int ce_dollarzero; /* value of "$0" */ - t_namelist *ce_path; /* search path */ -}; - - -static char *version = "$Revision: 1.8 $"; - -/* This loader opens a directory with a -meta.pd file 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 - * anywhere in the global classpath. - * - * 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. - */ - -static int libdir_loader(t_canvas *canvas, char *classname) -{ - int fd = -1; - char helppathname[FILENAME_MAX]; - char fullclassname[FILENAME_MAX], dirbuf[FILENAME_MAX]; - char *nameptr; - t_canvasenvironment *canvasenvironment; - -/* look for meta file (classname)/(classname)-meta.pd */ - strncpy(fullclassname, classname, FILENAME_MAX - 6); - strcat(fullclassname, "/"); - strncat(fullclassname, classname, FILENAME_MAX - strlen(fullclassname) - 6); - strcat(fullclassname, "-meta"); - - /* if this is being called from a canvas, then add the library path to the - * canvas-local path */ - if(canvas) - { - canvasenvironment = canvas_getenv(canvas); - /* setting the canvas to NULL causes it to ignore any canvas-local path */ - if ((fd = canvas_open(NULL, fullclassname, ".pd", - dirbuf, &nameptr, FILENAME_MAX, 0)) < 0) - { - return (0); - } - close(fd); - if(sys_isabsolutepath(dirbuf)) // only include actual full paths - canvasenvironment->ce_path = namelist_append(canvasenvironment->ce_path, - dirbuf, 0); - if(sys_verbose) - post("libdir_loader: added '%s' to the canvas-local objectclass path", - classname); - } - else - { - if ((fd = open_via_path(".", fullclassname, ".pd", - dirbuf, &nameptr, FILENAME_MAX, 0)) < 0) - { - return (0); - } - close(fd); - sys_searchpath = namelist_append(sys_searchpath, dirbuf, 0); - strncpy(helppathname, sys_libdir->s_name, FILENAME_MAX-30); - helppathname[FILENAME_MAX-30] = 0; - strcat(helppathname, "/doc/5.reference/"); - strcat(helppathname, classname); - sys_helppath = namelist_append(sys_helppath, helppathname, 0); - post("libdir_loader: added '%s' to the global objectclass path", - classname); -// post("\tThis is deprecated behavior."); - } - /* post("libdir_loader loaded fullclassname: '%s'\n", fullclassname); */ - if (sys_verbose) - post("Loaded libdir '%s' from '%s'", classname, dirbuf); - - return (1); -} - -void libdir_setup(void) -{ -/* relies on t.grill's loader functionality, fully added in 0.40 */ - sys_register_loader(libdir_loader); - post("libdir loader %s",version); - post("\tcompiled on "__DATE__" at "__TIME__ " "); - post("\tcompiled against Pd version %d.%d.%d.%s", PD_MAJOR_VERSION, - PD_MINOR_VERSION, PD_BUGFIX_VERSION, PD_TEST_VERSION); -} -- cgit v1.2.1