<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<pre style="white-space: pre-wrap; color: rgb(0, 0, 0); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">
TRACES
</pre>
<p>------------------------------------</p>
<p><u>Case 1: absolute path</u><br>
</p>
<p>new_anything<br>
</p>
<p>-> sys_load_lib:<br>
</p>
<p>if (sys_isabsolutepath(classname))<br>
{<br>
/* this is just copied from sys_open_absolute()<br>
LATER avoid code duplication */<br>
char dirbuf[MAXPDSTRING], *z = strrchr(classname, '/');<br>
int dirlen;<br>
if (!z)<br>
return (0);<br>
dirlen = z - classname;<br>
if (dirlen > MAXPDSTRING-1)<br>
dirlen = MAXPDSTRING-1;<br>
strncpy(dirbuf, classname, dirlen);<br>
dirbuf[dirlen] = 0;<br>
data.classname=classname+(dirlen+1);<br>
sys_loadlib_iter(dirbuf, &data);<br>
}</p>
<p>"/..path.." and "basename" are passed separately, "/..path.."
fills the role of the search path.<br>
</p>
<p>-> sys_loadlib_iter <br>
</p>
<p>-> sys_do_load_abs <br>
</p>
<p>-> class_new: added two methods, "basename" and
"/..path../basename".</p>
<p>---<br>
</p>
<p>For example if you try to instantiate a "/..path../float", the
following error is thrown: <br>
</p>
<p>"consistency check failed: class_addmethod: objectmaker_float:
bad argument types"</p>
<p>Because it tries to add the method "float" to pd_objectmaker
using 'class_addmethod', and all special methods are handled
different:<br>
</p>
<p>[...]<br>
</p>
<p>else if (sel == &s_float)<br>
{<br>
if (argtype != A_FLOAT || va_arg(ap, t_atomtype)) goto
phooey;<br>
class_doaddfloat(c, fn);<br>
}</p>
<p>[...]<br>
</p>
<p>It fails to replace the built-in "float" method because the
argtype for abstractions is A_GIMME, but in other situations it
could be replaced successfully.<br>
</p>
<p>------------------------------------<br>
</p>
<p><u>Case 2: relative path</u></p>
<p>new_anything<br>
</p>
<p>-> sys_load_lib <br>
</p>
<p>data.classname = classname;<br>
if(!data.ok)<br>
canvas_path_iterate(canvas,
(t_canvas_path_iterator)sys_loadlib_iter, &data);<br>
</p>
<p>-> canvas_path_iterate: the different sources (canvas path,
search paths, global paths, ...) are passed as the directory and
the relative path as the classname<br>
</p>
<p>-> sys_loadlib_iter</p>
<p>-> sys_do_load_abs <br>
</p>
<p>-> class_new: added two identical methods, "..relative
path..". Because 'class_loadsym' is the relative path as well.<br>
</p>
<p>In this case, the classname is the relative path so the method
"basename" is not added and therefore there's no name clash with
the built-in special methods (e.j. "float"), and the error
described above is not thrown.</p>
<p>------------------------------------</p>
<p>In conclusion, absolute and relative paths are treated
differently.<br>
</p>
<p><br>
</p>
</body>
</html>