🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #12011

Re: Supporting the clipboard (Re: Jerry declares the 2000 as 'the most improved computer')

#12011
From: Michael Witbrock
Date: Wed, 29 Mar 1989 16:13
62 lines
3181 bytes
> *Excerpts from ext.nn.comp.sys.amiga.tech: 19-Mar-89 Supporting the clipboard*
> *(R.. Chris Siebenmann@ziebmef (2450)*

>  There's no IFF routines that will write to the clipboard, and it's
> not at all obvious how to write them.
>
>  You see, the clipboard requires you to put IFF data into it. Now IFF
> is a perfectly good structure for data; it's nicely recursive 'cause
> it's made up of things inside things (and so on..), includes a decent
> amount of error checking, and is very nice overall. However, each
> thing in an IFF data stream has to include its size (including the
> sizes of all sub-things inside it) ... at the beginning of itself. And
> the clipboard.device doesn't appear to support random seeking around
> to write data (when writing to a file, the IFF routines seek back to
> the start of a hunk and write the size once they know it).
>  This makes it remarkably difficult to write a complicated recursive
> data structure out in IFF chunks to the clipboard, of course. You
> basically have to "write" it twice, once to find out the sizes of all
> the hunks, and the second time to do the real writing with the real
> sizes.
>  Faced with this problem, we punted
I had a similar problem with recursive screen output. It's actually not too
difficult to do at all, providing that your output routines are recursive.

for each output routine
  foo(bar baz)

add two params      DoOutput (boolean) and
                              Size (int)

and have it return the size of the object it writes out.

i.e. int  foo(bar baz DoOutput Size)

repleace each call to foo with two

size= foo (bar, baz, FALSE, 0)
if (size!= foo(bar,baz,TRUE,size) { /*SOMETHING BAD HAPPENED*/}

replace each output statement in foo by

if (DoOutput){
   output statement
}
returnedsize += size of output object;


Making these changes is guaranteed correct for code without side effects (which
suck in recursive (or other) code anyhow). It is very easy and fast to do, and
it adds hardly any extra code. It has a less than 100% overhead on the original
operation.

Maybe we can have our clipboards supported now. Please.....

michael
Michael J Witbrock                        /
School of Computer Science               /
Carnegie Mellon University              /\
Pittsburgh PA 15213-3890 U.S.A         /  \

/* sorry if this is difficult to read, it was written with messages, which is
proportional width*/
Technical Details
Message-ID: <gYAE33y00hke00oGlE@cs.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!labrea!rutgers!rochester!pt.cs.cmu.edu!andrew.cmu.edu!<UNAUTHENTICATED>+
References: <8903011852.AA16426@jade.berkeley.edu> <6193@columbia.edu> <10901@well.UUCP> <794@zehntel.UUCP> <10923@well.UUCP> <6206@cbmvax.UUCP>, <1989Mar19.023257.20564@ziebmef.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!labrea!rutgers!rochester!pt.cs.cmu.edu!andrew.cmu.edu!<UNAUTHENTICATED>+
From: mjw@cs.cmu.edu (Michael Witbrock)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Supporting the clipboard (Re: Jerry declares the 2000 as 'the most improved computer')
Message-ID: <gYAE33y00hke00oGlE@cs.cmu.edu>
Date: 29 Mar 89 16:13:55 GMT
References: <8903011852.AA16426@jade.berkeley.edu> <6193@columbia.edu> <10901@well.UUCP> <794@zehntel.UUCP> <10923@well.UUCP> <6206@cbmvax.UUCP>,
 <1989Mar19.023257.20564@ziebmef.uucp>
Organization: Carnegie Mellon, Pittsburgh, PA
Lines: 62
In-Reply-To: <1989Mar19.023257.20564@ziebmef.uucp>