<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 05/19/2013 11:47 PM, J Oliver wrote:<br>
</div>
<blockquote
cite="mid:C96643D5-7F7F-49CA-9976-69E5EA5AC512@gmail.com"
type="cite">
<div><span class="Apple-style-span" style="orphans: 2; text-align:
-webkit-auto; text-indent: 0px; widows: 2;
-webkit-text-decorations-in-effect: none; "><span
class="Apple-style-span" style="orphans: 2; text-align:
-webkit-auto; text-indent: 0px; widows: 2;
-webkit-text-decorations-in-effect: none; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space; "><span
class="Apple-style-span" style="orphans: 2; text-align:
-webkit-auto; text-indent: 0px; widows: 2;
-webkit-text-decorations-in-effect: none; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode:
space; -webkit-line-break: after-white-space; "><span
class="Apple-style-span" style="orphans: 2;
text-align: -webkit-auto; text-indent: 0px; widows:
2; -webkit-text-decorations-in-effect: none; ">
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space; ">
<div style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: normal; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size:
medium; ">Hello all, </div>
<div style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: normal; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size:
medium; "><br>
</div>
<div style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: normal; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size:
medium; ">I need to create a textfile from
inside an external and I need to give the
computer a path with a message like:</div>
<div style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: normal; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size:
medium; "><br>
</div>
<div style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: normal; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size:
medium; ">path /home/path/file.txt</div>
<div style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: normal; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size:
medium; "><br>
</div>
<div style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: normal; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size:
medium; ">I am therefore creating a method for
path with:</div>
<div style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: Helvetica;
font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal;
line-height: normal; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; font-size:
medium; "><br>
</div>
<div><span class="Apple-tab-span"
style="white-space: pre; "> </span>class_addmethod(testtext_class,
(t_method)testtext_path, gensym("path"),
A_GIMME, 0); </div>
<div><br>
</div>
<div>
<div>Or should I use A_DEFSYMBOL ?</div>
</div>
</div>
</span></div>
</span></div>
</span></span></div>
</blockquote>
<br>
I'd use A_DEFSYMBOL if you want the user to be able to send a "path"
message with no args,<br>
and A_SYMBOL if you want to require them to specify some path.<br>
<br>
<blockquote
cite="mid:C96643D5-7F7F-49CA-9976-69E5EA5AC512@gmail.com"
type="cite">
<div><span class="Apple-style-span" style="orphans: 2; text-align:
-webkit-auto; text-indent: 0px; widows: 2;
-webkit-text-decorations-in-effect: none; "><span
class="Apple-style-span" style="orphans: 2; text-align:
-webkit-auto; text-indent: 0px; widows: 2;
-webkit-text-decorations-in-effect: none; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space; "><span
class="Apple-style-span" style="orphans: 2; text-align:
-webkit-auto; text-indent: 0px; widows: 2;
-webkit-text-decorations-in-effect: none; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode:
space; -webkit-line-break: after-white-space; "><span
class="Apple-style-span" style="orphans: 2;
text-align: -webkit-auto; text-indent: 0px; widows:
2; -webkit-text-decorations-in-effect: none; ">
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space; ">
<div><br>
</div>
</div>
</span></div>
</span></div>
</span></span>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space; "><span
class="Apple-style-span" style="orphans: 2; text-align:
-webkit-auto; text-indent: 0px; widows: 2;
-webkit-text-decorations-in-effect: none; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space; "><span
class="Apple-style-span" style="orphans: 2; text-align:
-webkit-auto; text-indent: 0px; widows: 2;
-webkit-text-decorations-in-effect: none; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode:
space; -webkit-line-break: after-white-space; ">
<div>But then how can I read the atom inside the
external?</div>
</div>
</span></div>
</span><br class="Apple-interchange-newline">
</div>
I am using:</div>
<div><br>
</div>
<div>
<div>void testtext_path(t_testtext *x, t_atom *s){</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>char
teststring[1000];</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>atom_string(s,
teststring, 1000);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>post(teststring);</div>
<div>}</div>
<div><br>
</div>
<div>but then I get the following printout:</div>
<div><br>
</div>
<div>
<div>
<div>consistency check failed: atom_string</div>
<div>333333@ÿÿÿÿs</div>
</div>
<div><br>
</div>
<div>I'm not sure where to move with this. anybody has any
suggestions?</div>
</div>
</div>
</blockquote>
<br>
I don't have time to check it but I'd imagine the problem is that
A_GIMME assumes the method wants the following args: t_testtext*,
t_symbol*, int, and a t_atom*<br>
<br>
where the t_symbol* refers to the selector that was used to call the
method-- in this case, the word "path". (That can come in handy,
btw, as you can have methods "chocolate" and "vanilla" point to the
same foo_icecream function and branch based on which selector was
used.)<br>
<br>
However, you only specified two arguments for that method, and one
of them is t_atom* so I guess it implicitly casts from the t_symbol*
it receives. (I think the compiler warns you about stuff like this
but I'm no expert so maybe I'm wrong.)<br>
<br>
Then inside atom_string (in m_atom.c) it switches based on
a->a_type, but your "a" doesn't have an a_type because it's
really a t_symbol*. Thus none of the cases match and so the
function ends up calling the "bug" function that prints out the
error you see.<br>
<br>
Essentially you tried to build a string using a reference to an atom
that's not really an atom, so Pd complained that you weren't being
consistent.<br>
<br>
-Jonathan<br>
<br>
<blockquote
cite="mid:C96643D5-7F7F-49CA-9976-69E5EA5AC512@gmail.com"
type="cite">
<div>
<div>
<div><br>
</div>
<div>best,</div>
<div><br>
</div>
<div>J</div>
<div><br>
</div>
<div>Here's the info for atom_string:</div>
<div>
<h3 style="color: rgb(0, 0, 0); font-family: Times;
font-style: normal; font-variant: normal; letter-spacing:
normal; line-height: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px;"><a moz-do-not-send="true"
name="SECTION00091900000000000000">atom_string</a></h3>
<pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">void atom_string(t_atom *a, char *buf, unsigned int bufsize);
</pre>
<span style="color: rgb(0, 0, 0); font-family: Times;
font-size: medium; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space:
normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; display: inline !important; float: none;">Converts an
atom </span><code style="color: rgb(0, 0, 0); font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans:
auto; text-align: start; text-indent: 0px; text-transform:
none; white-space: normal; widows: auto; word-spacing:
0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;">a</code><span
style="color: rgb(0, 0, 0); font-family: Times; font-size:
medium; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows:
auto; word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; display: inline
!important; float: none;"> into a </span><tt style="color:
rgb(0, 0, 0); font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: auto; text-align: start; text-indent:
0px; text-transform: none; white-space: normal; widows:
auto; word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;">C</tt><span style="color:
rgb(0, 0, 0); font-family: Times; font-size: medium;
font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; display: inline
!important; float: none;">-string </span><code
style="color: rgb(0, 0, 0); font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px;">buf</code><span style="color: rgb(0, 0, 0);
font-family: Times; font-size: medium; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; display: inline !important; float: none;">. The
memory to this char-Buffer has to be reserved manually and
its length has to be declared in </span><code
style="color: rgb(0, 0, 0); font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px;">bufsize</code><span style="color: rgb(0, 0, 0);
font-family: Times; font-size: medium; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; display: inline !important; float: none;">.</span>
<div style="color: rgb(0, 0, 0); font-family: Times;
font-size: medium; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: normal; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; word-spacing:
0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; "><br
class="webkit-block-placeholder">
</div>
</div>
<div>in: <a moz-do-not-send="true"
href="http://pdstatic.iem.at/externals-HOWTO/node9.html#SECTION00092200000000000000">http://pdstatic.iem.at/externals-HOWTO/node9.html#SECTION00092200000000000000</a></div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br class="Apple-interchange-newline">
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:Pd-list@iem.at">Pd-list@iem.at</a> mailing list
UNSUBSCRIBE and account-management -> <a class="moz-txt-link-freetext" href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a>
</pre>
</blockquote>
<br>
</body>
</html>