1. unresolvable problem

------=_NextPart_000_0008_01BFB14D.FC120220
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

function which calls itself cant return varibale which changes itself =
each time

my actual function with which i am stuck:
(i want function to display text colored , characters converted from =
ascii code in one color, others in some other color)
=20

--returns {text,numberOfMembers}
function print_format3( object o )

    -- returns object formatted for wPrint
    sequence s

    atom num
    num=3D0 --each time function is called it is set to 0

    if atom( o ) then
        -- number
  if o >=3D ' ' and o <=3D '}' then
   return sprintf( "'%s'", o )
  else  =20
   return sprintf( "%d", o )
  end if
    else
        -- list
        s =3D "{"
        for i =3D 1 to length( o ) do
            s =3D s & print_format2( o[i] ) --function called AGAIN (num =
is set back to 0)

   --HERE! variable would=20
    -- increase each time and would be then returned=20
    --along with text :{text,variable}

    num+=3D1
           =20

            if i < length( o ) then
                s =3D s & ","
            end if
        end for
        s =3D s & "}"
        return s
    end if

end function

Anybody has any suggestions? I can't use global variable.(?)

------=_NextPart_000_0008_01BFB14D.FC120220
        charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3D"Lucida Casual" size=3D2>
<DIV><FONT face=3D"Lucida Casual" size=3D2>function which calls itself =
cant return=20
varibale which changes itself each time</FONT></DIV></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2>my actual function with which =
i am=20
stuck:</FONT></DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2>(i want function to display =
text colored=20
, characters converted from ascii code in one color, others in some =
other=20
color)</FONT></DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2></FONT>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2>--returns=20
{text,numberOfMembers}<BR>function print_format3( object o =
)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2>&nbsp;&nbsp;&nbsp; -- returns =
object=20
formatted for wPrint<BR>&nbsp;&nbsp;&nbsp; sequence s</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2>&nbsp;&nbsp;&nbsp; atom =
num</FONT></DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2><STRONG>&nbsp;&nbsp;&nbsp; =
num=3D0 --each=20
time function is called it is set to 0</STRONG></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2>&nbsp;&nbsp;&nbsp; if atom( o =
)=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- =
number<BR>&nbsp;&nbsp;if o=20
&gt;=3D ' ' and o &lt;=3D '}' then<BR>&nbsp;&nbsp;&nbsp;return sprintf( =
"'%s'", o=20
)<BR>&nbsp;&nbsp;else&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;return =
sprintf(=20
"%d", o )<BR>&nbsp;&nbsp;end if<BR>&nbsp;&nbsp;&nbsp;=20
else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --=20
list<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s =3D=20
"{"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for i =3D 1 to length( =
o )=20
do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
s =3D s=20
&amp; print_format2( o[i] ) <STRONG>--function called AGAIN (num is set =
back to=20
0)</STRONG></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Lucida Casual" =
size=3D2><STRONG>&nbsp;&nbsp;&nbsp;--HERE!=20
variable would</STRONG>=20
<DIV><STRONG><FONT face=3D"Lucida Casual" size=3D2>&nbsp;&nbsp;&nbsp;=20
--&nbsp;increase each time and would be then returned =
</FONT></STRONG></DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2><STRONG>&nbsp;&nbsp;&nbsp; =
--along with=20
text :{text,variable}</STRONG></FONT></DIV>
<DIV>&nbsp;</DIV></FONT></DIV>
<DIV><STRONG><FONT face=3D"Lucida Casual" size=3D2>&nbsp;&nbsp;&nbsp;=20
num+=3D1</FONT></STRONG></DIV>
<DIV><FONT face=3D"Lucida Casual"=20
p;&nbsp;<BR></FONT><FONT=20
face=3D"Lucida Casual"=20
nbsp;&nbsp;&nbsp;&nbsp;=20
if i &lt; length( o )=20
;&nbsp;&nbsp;&nbsp;&nbsp;=20
s =3D s &amp;=20
 end=20
if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end=20
for<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s =3D s &amp;=20
"}"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return =
s<BR>&nbsp;&nbsp;&nbsp;=20
end if</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2>end function</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3D"Lucida Casual" size=3D2>
<DIV><FONT face=3D"Lucida Casual" size=3D2>Anybody has any suggestions? =
I can't use=20

------=_NextPart_000_0008_01BFB14D.FC120220--

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu