On Wed, 2004-03-31 at 06:23, Majorinc, Kazimir wrote:
> Is there any such function, something like
> 
> procedure do_nothing(X)
> end
> 
> built in or in library?  Because, it seems suitable to suppress program 
> output using write:=do_nothing. Is there any other trick to achieve the 
> same? (Until better solution is found, those in need can use the following 
> freeware version.)
> 
> procedure do_nothing(X)
>     write("Please register to get rid of this message.")
> end

Incidently, here's another approach.  It's not in the do_nothing()
style, but performs a similar function:

   global writeFlag

   procedure controllableWrite(a[])
       static realWrite
       initial {
             realWrite := proc("write")
             write := controllableWrite
             }
       if \writeFlag then suspend realWrite ! a
   end

Now you can turn write(...) on and off by setting/clearing
the value of writeFlag.  Of course, you'd want to do
something similar for writes(...).

You can also write the above without the need for the
static variable realWrite, but the resulting code,
while clever, is prone to giving headaches.

As a minor challenge to the group - can you see how?

-- 
Steve Wampler -- [EMAIL PROTECTED]
The gods that smiled on your birth are now laughing out loud.


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to