/* * $Id: stdx.i,v 1.4 2006/05/20 17:21:30 dhmunro Exp $ * Perform any post-initialization tasks. */ /* Copyright (c) 2005, The Regents of the University of California. * All rights reserved. * This file is part of yorick (http://yorick.sourceforge.net). * Read the accompanying LICENSE file for details. */ /* When Yorick starts, std.i is included, then any pkg.i files for compiled-in packages, then this file stdx.i, and finally the user customization file custom.i. For now, the only thing which must be done here is the critical job changing from the startup search path YORICK_PATH to the normal include file search path (which, among other things, allows custom.i to be found). This path can be overridden from custom.i, which runs after this. */ set_path; /* set compiled-in default include path */ /* the following is a hack for windows... */ func fix_path(p) /* DOCUMENT fix_path(p) * Replaces multiple occurences of directory separators (either * "/" or "\") in path P by a single "/" anr returns the result. * * SEE ALSO: streplace, strgrep, set_path, get_path, cd, lsdir. */ { /* Replace all backslash characters by a slash. */ c = strchar(p); i = where(c == '\\'); if (is_array(i)) { c(i) = '/'; p = strchar(c); } /* Replace all multiple occurences of slash characters by a single slash. */ pat = "//+"; rep = "/"; do { sel = strgrep(pat, p, n=30); if (max(sel(2,..)) < 0) { break; } p = streplace(p, sel, rep); } while (max(sel(0,..)) >= 0); return p; } set_path, fix_path(get_path()); /* end of hack */ /* with yorick-1.6, add the i-start directories * these are mostly intended for files containing autoloads, * but other initialization code could appear there as well * - optional packages should place autoload files in these directories * (Y_SITE for interpreted only packages, Y_HOME for plugin packages) * - note that these all come before custom.i * - eventually, this mechanism may replace custom.i */ include_all, Y_SITE+"i-start"; if (Y_HOME!=Y_SITE) include_all, Y_HOME+"i-start"; if (!batch()) include_all, Y_USER+"i-start";