Home » Archimedes archive » Acorn User » AU 1998-05 A.adf » Regulars » StarInfo/Fletcher/EEhelp

StarInfo/Fletcher/EEhelp

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-05 A.adf » Regulars
Filename: StarInfo/Fletcher/EEhelp
Read OK:
File size: 2567 bytes
Load address: 0000
Exec address: 0000
File contents
                                  EEdit
                                  =====
                                  
Introduction
------------
You'll be asking yourself what is EEdit by now I'd imagine. It's a very
little program that was relatively hard to write, and basically it allows you
to edit files from the command line. Instead of the 'normal' way that this
might be done (using a full screen, single-tasking editor - eg pico), eedit
returns to the desktop and allows you to edit the file in the comfort of your
favourite editor (so long as you like Zap or StrongEd!).

This may not seem useful at first, but if you want to automatically start an
edit of a file from an Obey file or similar then this is likely to be the
only way you can do it (short of using the 'full screen' editors).


Usage
-----
It's very simple to use really. Just place EE inside your Library structure
(if you use a directory structure, then I suggest that 'Prog' or similar
would be a good category) and to edit a file type :
  *EE <file>

This will attempt to use whatever editors are currently present to edit the
file. If there are no editors capable of editing that type of file the
editing session will abort and you will return to the command line. To force
a file to be edited in as if it were another type, use :
  *EE -t <type> <file>

where <type> is a three digit hex number. If you wanted (for example) to edit
the !Boot.!Boot file on your computer you might use :
  *EE -t FFF Boot:!Boot

One in the editing session, saving or discarding the file will return you to
the command line with the file updated or unmodified (respectively). If you
run the command from within a TaskWindow the window will remain active,
awaiting a key press or the return of the data. You can use R to forcibly
return the data (updated) to the task, or A to abort. Escape will also abort
the session.

Note: It is not dangerous to close the taskwindow, or kill the EETask task
that starts as these will be trapped and dealt with accordingly.


Building EE into other programs
-------------------------------
Whilst it's quite obvious that you could start EE from within a command line
C program by using system("ee <file>"), I have written a small C library
which will allow you to start an external edit from within your C code. This
is currently used in GMail 1.19 to provide it's editor.

Note on desktop/taskwindow interaction
--------------------------------------
Whilst this is not the first program to be able to perform operations in the
desktop from the command line or from within a taskwindow, it is possibly the
most useful (aside, perhaps, from Java).

If anyone wishes to write a CLI program that can interact with the desktop
they might be interested to know how this can be achieved...

Firstly, you find out if you are inside a task or not by doing
'Wimp_Initialise'. This will return an error if you are in a task (which
might happen if you were being run from within a TaskWindow or another
application. You should record your task handle and also the fact that the
call failed or succeeded (so that you can closedown if you need to later). 

It might be advisable to Wimp_AddMessages /if/ you were already in a task, as
otherwise you might never receive anything.

Then, you should check if you are in a TaskWindow using TaskWindow_TaskInfo.
You should now start the filter (more details below). If you are, you need to
display a message and read keys (INKEY style) until a 'flag' is set to say
you should exit. If you are not in a taskwindow, you should perform a
Wimp_Poll loop, checking for the same 'flag' being set. The loop should
respond to only the quit message, for which it might set the flag to mark. 

On the flag being set you should exit your loop, stop the filter and perform
Wimp_CloseDown (if required), then return to whatever you were doing.

You should register the filter with the task you are in (not the handle you
got back from Wimp_Initialise as this may be invalid) - you can read this
using Wimp_ReadSysInfo. The filter should perform 'interesting' operations
after all polls (rather than at only null polls - as the task may have these
disabled; you'd need a PreFilter to turn them on if you wanted to do it that
way) [EEdit does not quite do this, but then nobody's perfect :-) ]. You
should trap the TW_Morite and Quit usermessages to remove your filter. If you
were in a taskwindow the program would never see anything, but would exit
safely because the filter would not be present, and if you were in the CLI
the filter would exit and then the program would receive the quit message
and similarly exit. You should NOT fault multiple removals of the filter -
use the X variant.

Obviously, you'd probably want to use a state system (as EEdit does) rather
than just flags to mark return conditions, but the general principle holds.
One other matter of note is that you /can/ have the filter in the same space
as the Task itself - there is no requirement to move the filter into RMA.
However, you must remember that a program like 'Empty Tasks' is very likely
to kill the desktop if it pages such a task out of memory. There is a simple
solution to this - don't do it :-)

Hopefully that will help people wishing to write similar code. For those mad
enough, the source code is included in JFPatch format.


Final comments
--------------
Remember, it is not an exercise in futility to simply try something that has
never been done. Rather than just using the incredible power of your
computer, try to push it. There's an advert on telly at the moment (which I
don't like) but the sentiment is good - 'Don't just immitate, innovate', so
try writing something that has never been done before. And if anyone else
writes another Address Book program and then expects people to pay for it
I'll scream ! This is not a PC market, guys (and gals), we're have an
incredibly powerful machine at our fingertips which is not being exploited.

Next time you see a program running slowly on your machine and you're
thinking 'Oh, it's ok because it's doing lots of work' please bare in mind
this little snippet - 

"Every time a character needs outputing to the screen it passes into the
'SWI' decoding routine, which passes it to the OS_WriteC routine, which
passes it through to WrchV which goes through all the routines hooked on to
that vector to the code to display it on the screen. These then take account
of the screen mode, graphics cursor activation, control codes, etc and displa
it (or redirect it to a file - a similarly complex procedure), then returns
back through the SWI routines (possibly performing callbacks) and then to the
caller. This occurs for every character. And if you use OS_WriteS rather than
OS_WriteC it simply calls OS_WriteC lots of times, going through the whole
thing for every character."

Anyone who has programmed that side of things will know this (as will anyone
who programmed the BBC as the principle is the same). The thing is that so
much is going on for a single character output and yet it is still fast. Type
*Help . and watch as the screen fills with flashing characters (actually
you'll have to hold down shift otherwise it'll stop!). If you're not
surprised by the speed (and I'll admit that I was once I thought about it),
then I'll remind you that I'm using an A5000. If that still doesn't surprise
you then, I'll tell you another little tale :

"Fonts in the Desktop is something people have tried to do for Pre-RPCs for a
long time with varying degrees of success. However, I know of only one person
who ever tried it the way I did (other than me, and I forget their name). By
redirecting the WrchV and checking all the system variables then producing a
font via Font_Paint rather than system character and returning to the
original caller."

What surprised me most was not the fact that it worked (although that did
quite a bit), but the speed of it. Even doing this ridiculous level of
patching the desktop /still/ isn't particularly slow; it's possible now to
see the Pinboard menu redraw, but let's remember that every character is now
passing through the Font manager and has a few calls to OS_Byte and similar
routines chucked in there for good measure. It takes about 1� seconds to
redraw my current Mode 31 screen (full pinboard and three Filer Windows) but
that's not much more than the normal time anyhow. There are some problems
with sprite redirection, but that's only to be expected.

Why am I telling you this ? You should remember everytime you see a program
running slowly that it's not just the complexity of what it does, but the way
it's been written. In my example I was writing assembler by hand, but if you
see a C program's insides you'll know how yuckily it's been written. Simple
things like strcpy followed by strlen can optimise to a single call in hand
written assembler. They may not take long, but it all adds up. Similarly
something like :
  for (i=0; i<strlen(x); i++) { ... }

Is so amazingly bad that it really needs some thinking about. I reckon that
that comes out at O(2n) for that single loop, when it could be O(n) with a
tiny bit of thought. Ok, so not everybody wants to write code that way, and
most would rather the code worked than spent hours/days getting it to be
fast, but /do/ bare this in mind when a company says it can't make a program
any faster - they may not be telling the complete truth :-)

<end of sermon!>

Contact
-------
If you want to contact me, I am emailable at gerph@innocent.com - this
address is likely to remain for the forseeable future.



00000000  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000020  20 20 45 45 64 69 74 0a  20 20 20 20 20 20 20 20  |  EEdit.        |
00000030  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000040  20 20 20 20 20 20 20 20  20 20 3d 3d 3d 3d 3d 0a  |          =====.|
00000050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000070  20 20 0a 49 6e 74 72 6f  64 75 63 74 69 6f 6e 0a  |  .Introduction.|
00000080  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 59 6f 75  |------------.You|
00000090  27 6c 6c 20 62 65 20 61  73 6b 69 6e 67 20 79 6f  |'ll be asking yo|
000000a0  75 72 73 65 6c 66 20 77  68 61 74 20 69 73 20 45  |urself what is E|
000000b0  45 64 69 74 20 62 79 20  6e 6f 77 20 49 27 64 20  |Edit by now I'd |
000000c0  69 6d 61 67 69 6e 65 2e  20 49 74 27 73 20 61 20  |imagine. It's a |
000000d0  76 65 72 79 0a 6c 69 74  74 6c 65 20 70 72 6f 67  |very.little prog|
000000e0  72 61 6d 20 74 68 61 74  20 77 61 73 20 72 65 6c  |ram that was rel|
000000f0  61 74 69 76 65 6c 79 20  68 61 72 64 20 74 6f 20  |atively hard to |
00000100  77 72 69 74 65 2c 20 61  6e 64 20 62 61 73 69 63  |write, and basic|
00000110  61 6c 6c 79 20 69 74 20  61 6c 6c 6f 77 73 20 79  |ally it allows y|
00000120  6f 75 0a 74 6f 20 65 64  69 74 20 66 69 6c 65 73  |ou.to edit files|
00000130  20 66 72 6f 6d 20 74 68  65 20 63 6f 6d 6d 61 6e  | from the comman|
00000140  64 20 6c 69 6e 65 2e 20  49 6e 73 74 65 61 64 20  |d line. Instead |
00000150  6f 66 20 74 68 65 20 27  6e 6f 72 6d 61 6c 27 20  |of the 'normal' |
00000160  77 61 79 20 74 68 61 74  20 74 68 69 73 0a 6d 69  |way that this.mi|
00000170  67 68 74 20 62 65 20 64  6f 6e 65 20 28 75 73 69  |ght be done (usi|
00000180  6e 67 20 61 20 66 75 6c  6c 20 73 63 72 65 65 6e  |ng a full screen|
00000190  2c 20 73 69 6e 67 6c 65  2d 74 61 73 6b 69 6e 67  |, single-tasking|
000001a0  20 65 64 69 74 6f 72 20  2d 20 65 67 20 70 69 63  | editor - eg pic|
000001b0  6f 29 2c 20 65 65 64 69  74 0a 72 65 74 75 72 6e  |o), eedit.return|
000001c0  73 20 74 6f 20 74 68 65  20 64 65 73 6b 74 6f 70  |s to the desktop|
000001d0  20 61 6e 64 20 61 6c 6c  6f 77 73 20 79 6f 75 20  | and allows you |
000001e0  74 6f 20 65 64 69 74 20  74 68 65 20 66 69 6c 65  |to edit the file|
000001f0  20 69 6e 20 74 68 65 20  63 6f 6d 66 6f 72 74 20  | in the comfort |
00000200  6f 66 20 79 6f 75 72 0a  66 61 76 6f 75 72 69 74  |of your.favourit|
00000210  65 20 65 64 69 74 6f 72  20 28 73 6f 20 6c 6f 6e  |e editor (so lon|
00000220  67 20 61 73 20 79 6f 75  20 6c 69 6b 65 20 5a 61  |g as you like Za|
00000230  70 20 6f 72 20 53 74 72  6f 6e 67 45 64 21 29 2e  |p or StrongEd!).|
00000240  0a 0a 54 68 69 73 20 6d  61 79 20 6e 6f 74 20 73  |..This may not s|
00000250  65 65 6d 20 75 73 65 66  75 6c 20 61 74 20 66 69  |eem useful at fi|
00000260  72 73 74 2c 20 62 75 74  20 69 66 20 79 6f 75 20  |rst, but if you |
00000270  77 61 6e 74 20 74 6f 20  61 75 74 6f 6d 61 74 69  |want to automati|
00000280  63 61 6c 6c 79 20 73 74  61 72 74 20 61 6e 0a 65  |cally start an.e|
00000290  64 69 74 20 6f 66 20 61  20 66 69 6c 65 20 66 72  |dit of a file fr|
000002a0  6f 6d 20 61 6e 20 4f 62  65 79 20 66 69 6c 65 20  |om an Obey file |
000002b0  6f 72 20 73 69 6d 69 6c  61 72 20 74 68 65 6e 20  |or similar then |
000002c0  74 68 69 73 20 69 73 20  6c 69 6b 65 6c 79 20 74  |this is likely t|
000002d0  6f 20 62 65 20 74 68 65  0a 6f 6e 6c 79 20 77 61  |o be the.only wa|
000002e0  79 20 79 6f 75 20 63 61  6e 20 64 6f 20 69 74 20  |y you can do it |
000002f0  28 73 68 6f 72 74 20 6f  66 20 75 73 69 6e 67 20  |(short of using |
00000300  74 68 65 20 27 66 75 6c  6c 20 73 63 72 65 65 6e  |the 'full screen|
00000310  27 20 65 64 69 74 6f 72  73 29 2e 0a 0a 0a 55 73  |' editors)....Us|
00000320  61 67 65 0a 2d 2d 2d 2d  2d 0a 49 74 27 73 20 76  |age.-----.It's v|
00000330  65 72 79 20 73 69 6d 70  6c 65 20 74 6f 20 75 73  |ery simple to us|
00000340  65 20 72 65 61 6c 6c 79  2e 20 4a 75 73 74 20 70  |e really. Just p|
00000350  6c 61 63 65 20 45 45 20  69 6e 73 69 64 65 20 79  |lace EE inside y|
00000360  6f 75 72 20 4c 69 62 72  61 72 79 20 73 74 72 75  |our Library stru|
00000370  63 74 75 72 65 0a 28 69  66 20 79 6f 75 20 75 73  |cture.(if you us|
00000380  65 20 61 20 64 69 72 65  63 74 6f 72 79 20 73 74  |e a directory st|
00000390  72 75 63 74 75 72 65 2c  20 74 68 65 6e 20 49 20  |ructure, then I |
000003a0  73 75 67 67 65 73 74 20  74 68 61 74 20 27 50 72  |suggest that 'Pr|
000003b0  6f 67 27 20 6f 72 20 73  69 6d 69 6c 61 72 0a 77  |og' or similar.w|
000003c0  6f 75 6c 64 20 62 65 20  61 20 67 6f 6f 64 20 63  |ould be a good c|
000003d0  61 74 65 67 6f 72 79 29  20 61 6e 64 20 74 6f 20  |ategory) and to |
000003e0  65 64 69 74 20 61 20 66  69 6c 65 20 74 79 70 65  |edit a file type|
000003f0  20 3a 0a 20 20 2a 45 45  20 3c 66 69 6c 65 3e 0a  | :.  *EE <file>.|
00000400  0a 54 68 69 73 20 77 69  6c 6c 20 61 74 74 65 6d  |.This will attem|
00000410  70 74 20 74 6f 20 75 73  65 20 77 68 61 74 65 76  |pt to use whatev|
00000420  65 72 20 65 64 69 74 6f  72 73 20 61 72 65 20 63  |er editors are c|
00000430  75 72 72 65 6e 74 6c 79  20 70 72 65 73 65 6e 74  |urrently present|
00000440  20 74 6f 20 65 64 69 74  20 74 68 65 0a 66 69 6c  | to edit the.fil|
00000450  65 2e 20 49 66 20 74 68  65 72 65 20 61 72 65 20  |e. If there are |
00000460  6e 6f 20 65 64 69 74 6f  72 73 20 63 61 70 61 62  |no editors capab|
00000470  6c 65 20 6f 66 20 65 64  69 74 69 6e 67 20 74 68  |le of editing th|
00000480  61 74 20 74 79 70 65 20  6f 66 20 66 69 6c 65 20  |at type of file |
00000490  74 68 65 0a 65 64 69 74  69 6e 67 20 73 65 73 73  |the.editing sess|
000004a0  69 6f 6e 20 77 69 6c 6c  20 61 62 6f 72 74 20 61  |ion will abort a|
000004b0  6e 64 20 79 6f 75 20 77  69 6c 6c 20 72 65 74 75  |nd you will retu|
000004c0  72 6e 20 74 6f 20 74 68  65 20 63 6f 6d 6d 61 6e  |rn to the comman|
000004d0  64 20 6c 69 6e 65 2e 20  54 6f 20 66 6f 72 63 65  |d line. To force|
000004e0  0a 61 20 66 69 6c 65 20  74 6f 20 62 65 20 65 64  |.a file to be ed|
000004f0  69 74 65 64 20 69 6e 20  61 73 20 69 66 20 69 74  |ited in as if it|
00000500  20 77 65 72 65 20 61 6e  6f 74 68 65 72 20 74 79  | were another ty|
00000510  70 65 2c 20 75 73 65 20  3a 0a 20 20 2a 45 45 20  |pe, use :.  *EE |
00000520  2d 74 20 3c 74 79 70 65  3e 20 3c 66 69 6c 65 3e  |-t <type> <file>|
00000530  0a 0a 77 68 65 72 65 20  3c 74 79 70 65 3e 20 69  |..where <type> i|
00000540  73 20 61 20 74 68 72 65  65 20 64 69 67 69 74 20  |s a three digit |
00000550  68 65 78 20 6e 75 6d 62  65 72 2e 20 49 66 20 79  |hex number. If y|
00000560  6f 75 20 77 61 6e 74 65  64 20 28 66 6f 72 20 65  |ou wanted (for e|
00000570  78 61 6d 70 6c 65 29 20  74 6f 20 65 64 69 74 0a  |xample) to edit.|
00000580  74 68 65 20 21 42 6f 6f  74 2e 21 42 6f 6f 74 20  |the !Boot.!Boot |
00000590  66 69 6c 65 20 6f 6e 20  79 6f 75 72 20 63 6f 6d  |file on your com|
000005a0  70 75 74 65 72 20 79 6f  75 20 6d 69 67 68 74 20  |puter you might |
000005b0  75 73 65 20 3a 0a 20 20  2a 45 45 20 2d 74 20 46  |use :.  *EE -t F|
000005c0  46 46 20 42 6f 6f 74 3a  21 42 6f 6f 74 0a 0a 4f  |FF Boot:!Boot..O|
000005d0  6e 65 20 69 6e 20 74 68  65 20 65 64 69 74 69 6e  |ne in the editin|
000005e0  67 20 73 65 73 73 69 6f  6e 2c 20 73 61 76 69 6e  |g session, savin|
000005f0  67 20 6f 72 20 64 69 73  63 61 72 64 69 6e 67 20  |g or discarding |
00000600  74 68 65 20 66 69 6c 65  20 77 69 6c 6c 20 72 65  |the file will re|
00000610  74 75 72 6e 20 79 6f 75  20 74 6f 0a 74 68 65 20  |turn you to.the |
00000620  63 6f 6d 6d 61 6e 64 20  6c 69 6e 65 20 77 69 74  |command line wit|
00000630  68 20 74 68 65 20 66 69  6c 65 20 75 70 64 61 74  |h the file updat|
00000640  65 64 20 6f 72 20 75 6e  6d 6f 64 69 66 69 65 64  |ed or unmodified|
00000650  20 28 72 65 73 70 65 63  74 69 76 65 6c 79 29 2e  | (respectively).|
00000660  20 49 66 20 79 6f 75 0a  72 75 6e 20 74 68 65 20  | If you.run the |
00000670  63 6f 6d 6d 61 6e 64 20  66 72 6f 6d 20 77 69 74  |command from wit|
00000680  68 69 6e 20 61 20 54 61  73 6b 57 69 6e 64 6f 77  |hin a TaskWindow|
00000690  20 74 68 65 20 77 69 6e  64 6f 77 20 77 69 6c 6c  | the window will|
000006a0  20 72 65 6d 61 69 6e 20  61 63 74 69 76 65 2c 0a  | remain active,.|
000006b0  61 77 61 69 74 69 6e 67  20 61 20 6b 65 79 20 70  |awaiting a key p|
000006c0  72 65 73 73 20 6f 72 20  74 68 65 20 72 65 74 75  |ress or the retu|
000006d0  72 6e 20 6f 66 20 74 68  65 20 64 61 74 61 2e 20  |rn of the data. |
000006e0  59 6f 75 20 63 61 6e 20  75 73 65 20 52 20 74 6f  |You can use R to|
000006f0  20 66 6f 72 63 69 62 6c  79 0a 72 65 74 75 72 6e  | forcibly.return|
00000700  20 74 68 65 20 64 61 74  61 20 28 75 70 64 61 74  | the data (updat|
00000710  65 64 29 20 74 6f 20 74  68 65 20 74 61 73 6b 2c  |ed) to the task,|
00000720  20 6f 72 20 41 20 74 6f  20 61 62 6f 72 74 2e 20  | or A to abort. |
00000730  45 73 63 61 70 65 20 77  69 6c 6c 20 61 6c 73 6f  |Escape will also|
00000740  20 61 62 6f 72 74 0a 74  68 65 20 73 65 73 73 69  | abort.the sessi|
00000750  6f 6e 2e 0a 0a 4e 6f 74  65 3a 20 49 74 20 69 73  |on...Note: It is|
00000760  20 6e 6f 74 20 64 61 6e  67 65 72 6f 75 73 20 74  | not dangerous t|
00000770  6f 20 63 6c 6f 73 65 20  74 68 65 20 74 61 73 6b  |o close the task|
00000780  77 69 6e 64 6f 77 2c 20  6f 72 20 6b 69 6c 6c 20  |window, or kill |
00000790  74 68 65 20 45 45 54 61  73 6b 20 74 61 73 6b 0a  |the EETask task.|
000007a0  74 68 61 74 20 73 74 61  72 74 73 20 61 73 20 74  |that starts as t|
000007b0  68 65 73 65 20 77 69 6c  6c 20 62 65 20 74 72 61  |hese will be tra|
000007c0  70 70 65 64 20 61 6e 64  20 64 65 61 6c 74 20 77  |pped and dealt w|
000007d0  69 74 68 20 61 63 63 6f  72 64 69 6e 67 6c 79 2e  |ith accordingly.|
000007e0  0a 0a 0a 42 75 69 6c 64  69 6e 67 20 45 45 20 69  |...Building EE i|
000007f0  6e 74 6f 20 6f 74 68 65  72 20 70 72 6f 67 72 61  |nto other progra|
00000800  6d 73 0a 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ms.-------------|
00000810  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000820  2d 2d 0a 57 68 69 6c 73  74 20 69 74 27 73 20 71  |--.Whilst it's q|
00000830  75 69 74 65 20 6f 62 76  69 6f 75 73 20 74 68 61  |uite obvious tha|
00000840  74 20 79 6f 75 20 63 6f  75 6c 64 20 73 74 61 72  |t you could star|
00000850  74 20 45 45 20 66 72 6f  6d 20 77 69 74 68 69 6e  |t EE from within|
00000860  20 61 20 63 6f 6d 6d 61  6e 64 20 6c 69 6e 65 0a  | a command line.|
00000870  43 20 70 72 6f 67 72 61  6d 20 62 79 20 75 73 69  |C program by usi|
00000880  6e 67 20 73 79 73 74 65  6d 28 22 65 65 20 3c 66  |ng system("ee <f|
00000890  69 6c 65 3e 22 29 2c 20  49 20 68 61 76 65 20 77  |ile>"), I have w|
000008a0  72 69 74 74 65 6e 20 61  20 73 6d 61 6c 6c 20 43  |ritten a small C|
000008b0  20 6c 69 62 72 61 72 79  0a 77 68 69 63 68 20 77  | library.which w|
000008c0  69 6c 6c 20 61 6c 6c 6f  77 20 79 6f 75 20 74 6f  |ill allow you to|
000008d0  20 73 74 61 72 74 20 61  6e 20 65 78 74 65 72 6e  | start an extern|
000008e0  61 6c 20 65 64 69 74 20  66 72 6f 6d 20 77 69 74  |al edit from wit|
000008f0  68 69 6e 20 79 6f 75 72  20 43 20 63 6f 64 65 2e  |hin your C code.|
00000900  20 54 68 69 73 0a 69 73  20 63 75 72 72 65 6e 74  | This.is current|
00000910  6c 79 20 75 73 65 64 20  69 6e 20 47 4d 61 69 6c  |ly used in GMail|
00000920  20 31 2e 31 39 20 74 6f  20 70 72 6f 76 69 64 65  | 1.19 to provide|
00000930  20 69 74 27 73 20 65 64  69 74 6f 72 2e 0a 0a 4e  | it's editor...N|
00000940  6f 74 65 20 6f 6e 20 64  65 73 6b 74 6f 70 2f 74  |ote on desktop/t|
00000950  61 73 6b 77 69 6e 64 6f  77 20 69 6e 74 65 72 61  |askwindow intera|
00000960  63 74 69 6f 6e 0a 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ction.----------|
00000970  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |----------------|
00000980  2d 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 0a 57 68 69  |------------.Whi|
00000990  6c 73 74 20 74 68 69 73  20 69 73 20 6e 6f 74 20  |lst this is not |
000009a0  74 68 65 20 66 69 72 73  74 20 70 72 6f 67 72 61  |the first progra|
000009b0  6d 20 74 6f 20 62 65 20  61 62 6c 65 20 74 6f 20  |m to be able to |
000009c0  70 65 72 66 6f 72 6d 20  6f 70 65 72 61 74 69 6f  |perform operatio|
000009d0  6e 73 20 69 6e 20 74 68  65 0a 64 65 73 6b 74 6f  |ns in the.deskto|
000009e0  70 20 66 72 6f 6d 20 74  68 65 20 63 6f 6d 6d 61  |p from the comma|
000009f0  6e 64 20 6c 69 6e 65 20  6f 72 20 66 72 6f 6d 20  |nd line or from |
00000a00  77 69 74 68 69 6e 20 61  20 74 61 73 6b 77 69 6e  |within a taskwin|
00000a10  64 6f 77 2c 20 69 74 20  69 73 20 70 6f 73 73 69  |dow, it is possi|
00000a20  62 6c 79 20 74 68 65 0a  6d 6f 73 74 20 75 73 65  |bly the.most use|
00000a30  66 75 6c 20 28 61 73 69  64 65 2c 20 70 65 72 68  |ful (aside, perh|
00000a40  61 70 73 2c 20 66 72 6f  6d 20 4a 61 76 61 29 2e  |aps, from Java).|
00000a50  0a 0a 49 66 20 61 6e 79  6f 6e 65 20 77 69 73 68  |..If anyone wish|
00000a60  65 73 20 74 6f 20 77 72  69 74 65 20 61 20 43 4c  |es to write a CL|
00000a70  49 20 70 72 6f 67 72 61  6d 20 74 68 61 74 20 63  |I program that c|
00000a80  61 6e 20 69 6e 74 65 72  61 63 74 20 77 69 74 68  |an interact with|
00000a90  20 74 68 65 20 64 65 73  6b 74 6f 70 0a 74 68 65  | the desktop.the|
00000aa0  79 20 6d 69 67 68 74 20  62 65 20 69 6e 74 65 72  |y might be inter|
00000ab0  65 73 74 65 64 20 74 6f  20 6b 6e 6f 77 20 68 6f  |ested to know ho|
00000ac0  77 20 74 68 69 73 20 63  61 6e 20 62 65 20 61 63  |w this can be ac|
00000ad0  68 69 65 76 65 64 2e 2e  2e 0a 0a 46 69 72 73 74  |hieved.....First|
00000ae0  6c 79 2c 20 79 6f 75 20  66 69 6e 64 20 6f 75 74  |ly, you find out|
00000af0  20 69 66 20 79 6f 75 20  61 72 65 20 69 6e 73 69  | if you are insi|
00000b00  64 65 20 61 20 74 61 73  6b 20 6f 72 20 6e 6f 74  |de a task or not|
00000b10  20 62 79 20 64 6f 69 6e  67 0a 27 57 69 6d 70 5f  | by doing.'Wimp_|
00000b20  49 6e 69 74 69 61 6c 69  73 65 27 2e 20 54 68 69  |Initialise'. Thi|
00000b30  73 20 77 69 6c 6c 20 72  65 74 75 72 6e 20 61 6e  |s will return an|
00000b40  20 65 72 72 6f 72 20 69  66 20 79 6f 75 20 61 72  | error if you ar|
00000b50  65 20 69 6e 20 61 20 74  61 73 6b 20 28 77 68 69  |e in a task (whi|
00000b60  63 68 0a 6d 69 67 68 74  20 68 61 70 70 65 6e 20  |ch.might happen |
00000b70  69 66 20 79 6f 75 20 77  65 72 65 20 62 65 69 6e  |if you were bein|
00000b80  67 20 72 75 6e 20 66 72  6f 6d 20 77 69 74 68 69  |g run from withi|
00000b90  6e 20 61 20 54 61 73 6b  57 69 6e 64 6f 77 20 6f  |n a TaskWindow o|
00000ba0  72 20 61 6e 6f 74 68 65  72 0a 61 70 70 6c 69 63  |r another.applic|
00000bb0  61 74 69 6f 6e 2e 20 59  6f 75 20 73 68 6f 75 6c  |ation. You shoul|
00000bc0  64 20 72 65 63 6f 72 64  20 79 6f 75 72 20 74 61  |d record your ta|
00000bd0  73 6b 20 68 61 6e 64 6c  65 20 61 6e 64 20 61 6c  |sk handle and al|
00000be0  73 6f 20 74 68 65 20 66  61 63 74 20 74 68 61 74  |so the fact that|
00000bf0  20 74 68 65 0a 63 61 6c  6c 20 66 61 69 6c 65 64  | the.call failed|
00000c00  20 6f 72 20 73 75 63 63  65 65 64 65 64 20 28 73  | or succeeded (s|
00000c10  6f 20 74 68 61 74 20 79  6f 75 20 63 61 6e 20 63  |o that you can c|
00000c20  6c 6f 73 65 64 6f 77 6e  20 69 66 20 79 6f 75 20  |losedown if you |
00000c30  6e 65 65 64 20 74 6f 20  6c 61 74 65 72 29 2e 20  |need to later). |
00000c40  0a 0a 49 74 20 6d 69 67  68 74 20 62 65 20 61 64  |..It might be ad|
00000c50  76 69 73 61 62 6c 65 20  74 6f 20 57 69 6d 70 5f  |visable to Wimp_|
00000c60  41 64 64 4d 65 73 73 61  67 65 73 20 2f 69 66 2f  |AddMessages /if/|
00000c70  20 79 6f 75 20 77 65 72  65 20 61 6c 72 65 61 64  | you were alread|
00000c80  79 20 69 6e 20 61 20 74  61 73 6b 2c 20 61 73 0a  |y in a task, as.|
00000c90  6f 74 68 65 72 77 69 73  65 20 79 6f 75 20 6d 69  |otherwise you mi|
00000ca0  67 68 74 20 6e 65 76 65  72 20 72 65 63 65 69 76  |ght never receiv|
00000cb0  65 20 61 6e 79 74 68 69  6e 67 2e 0a 0a 54 68 65  |e anything...The|
00000cc0  6e 2c 20 79 6f 75 20 73  68 6f 75 6c 64 20 63 68  |n, you should ch|
00000cd0  65 63 6b 20 69 66 20 79  6f 75 20 61 72 65 20 69  |eck if you are i|
00000ce0  6e 20 61 20 54 61 73 6b  57 69 6e 64 6f 77 20 75  |n a TaskWindow u|
00000cf0  73 69 6e 67 20 54 61 73  6b 57 69 6e 64 6f 77 5f  |sing TaskWindow_|
00000d00  54 61 73 6b 49 6e 66 6f  2e 0a 59 6f 75 20 73 68  |TaskInfo..You sh|
00000d10  6f 75 6c 64 20 6e 6f 77  20 73 74 61 72 74 20 74  |ould now start t|
00000d20  68 65 20 66 69 6c 74 65  72 20 28 6d 6f 72 65 20  |he filter (more |
00000d30  64 65 74 61 69 6c 73 20  62 65 6c 6f 77 29 2e 20  |details below). |
00000d40  49 66 20 79 6f 75 20 61  72 65 2c 20 79 6f 75 20  |If you are, you |
00000d50  6e 65 65 64 20 74 6f 0a  64 69 73 70 6c 61 79 20  |need to.display |
00000d60  61 20 6d 65 73 73 61 67  65 20 61 6e 64 20 72 65  |a message and re|
00000d70  61 64 20 6b 65 79 73 20  28 49 4e 4b 45 59 20 73  |ad keys (INKEY s|
00000d80  74 79 6c 65 29 20 75 6e  74 69 6c 20 61 20 27 66  |tyle) until a 'f|
00000d90  6c 61 67 27 20 69 73 20  73 65 74 20 74 6f 20 73  |lag' is set to s|
00000da0  61 79 0a 79 6f 75 20 73  68 6f 75 6c 64 20 65 78  |ay.you should ex|
00000db0  69 74 2e 20 49 66 20 79  6f 75 20 61 72 65 20 6e  |it. If you are n|
00000dc0  6f 74 20 69 6e 20 61 20  74 61 73 6b 77 69 6e 64  |ot in a taskwind|
00000dd0  6f 77 2c 20 79 6f 75 20  73 68 6f 75 6c 64 20 70  |ow, you should p|
00000de0  65 72 66 6f 72 6d 20 61  0a 57 69 6d 70 5f 50 6f  |erform a.Wimp_Po|
00000df0  6c 6c 20 6c 6f 6f 70 2c  20 63 68 65 63 6b 69 6e  |ll loop, checkin|
00000e00  67 20 66 6f 72 20 74 68  65 20 73 61 6d 65 20 27  |g for the same '|
00000e10  66 6c 61 67 27 20 62 65  69 6e 67 20 73 65 74 2e  |flag' being set.|
00000e20  20 54 68 65 20 6c 6f 6f  70 20 73 68 6f 75 6c 64  | The loop should|
00000e30  0a 72 65 73 70 6f 6e 64  20 74 6f 20 6f 6e 6c 79  |.respond to only|
00000e40  20 74 68 65 20 71 75 69  74 20 6d 65 73 73 61 67  | the quit messag|
00000e50  65 2c 20 66 6f 72 20 77  68 69 63 68 20 69 74 20  |e, for which it |
00000e60  6d 69 67 68 74 20 73 65  74 20 74 68 65 20 66 6c  |might set the fl|
00000e70  61 67 20 74 6f 20 6d 61  72 6b 2e 20 0a 0a 4f 6e  |ag to mark. ..On|
00000e80  20 74 68 65 20 66 6c 61  67 20 62 65 69 6e 67 20  | the flag being |
00000e90  73 65 74 20 79 6f 75 20  73 68 6f 75 6c 64 20 65  |set you should e|
00000ea0  78 69 74 20 79 6f 75 72  20 6c 6f 6f 70 2c 20 73  |xit your loop, s|
00000eb0  74 6f 70 20 74 68 65 20  66 69 6c 74 65 72 20 61  |top the filter a|
00000ec0  6e 64 20 70 65 72 66 6f  72 6d 0a 57 69 6d 70 5f  |nd perform.Wimp_|
00000ed0  43 6c 6f 73 65 44 6f 77  6e 20 28 69 66 20 72 65  |CloseDown (if re|
00000ee0  71 75 69 72 65 64 29 2c  20 74 68 65 6e 20 72 65  |quired), then re|
00000ef0  74 75 72 6e 20 74 6f 20  77 68 61 74 65 76 65 72  |turn to whatever|
00000f00  20 79 6f 75 20 77 65 72  65 20 64 6f 69 6e 67 2e  | you were doing.|
00000f10  0a 0a 59 6f 75 20 73 68  6f 75 6c 64 20 72 65 67  |..You should reg|
00000f20  69 73 74 65 72 20 74 68  65 20 66 69 6c 74 65 72  |ister the filter|
00000f30  20 77 69 74 68 20 74 68  65 20 74 61 73 6b 20 79  | with the task y|
00000f40  6f 75 20 61 72 65 20 69  6e 20 28 6e 6f 74 20 74  |ou are in (not t|
00000f50  68 65 20 68 61 6e 64 6c  65 20 79 6f 75 0a 67 6f  |he handle you.go|
00000f60  74 20 62 61 63 6b 20 66  72 6f 6d 20 57 69 6d 70  |t back from Wimp|
00000f70  5f 49 6e 69 74 69 61 6c  69 73 65 20 61 73 20 74  |_Initialise as t|
00000f80  68 69 73 20 6d 61 79 20  62 65 20 69 6e 76 61 6c  |his may be inval|
00000f90  69 64 29 20 2d 20 79 6f  75 20 63 61 6e 20 72 65  |id) - you can re|
00000fa0  61 64 20 74 68 69 73 0a  75 73 69 6e 67 20 57 69  |ad this.using Wi|
00000fb0  6d 70 5f 52 65 61 64 53  79 73 49 6e 66 6f 2e 20  |mp_ReadSysInfo. |
00000fc0  54 68 65 20 66 69 6c 74  65 72 20 73 68 6f 75 6c  |The filter shoul|
00000fd0  64 20 70 65 72 66 6f 72  6d 20 27 69 6e 74 65 72  |d perform 'inter|
00000fe0  65 73 74 69 6e 67 27 20  6f 70 65 72 61 74 69 6f  |esting' operatio|
00000ff0  6e 73 0a 61 66 74 65 72  20 61 6c 6c 20 70 6f 6c  |ns.after all pol|
00001000  6c 73 20 28 72 61 74 68  65 72 20 74 68 61 6e 20  |ls (rather than |
00001010  61 74 20 6f 6e 6c 79 20  6e 75 6c 6c 20 70 6f 6c  |at only null pol|
00001020  6c 73 20 2d 20 61 73 20  74 68 65 20 74 61 73 6b  |ls - as the task|
00001030  20 6d 61 79 20 68 61 76  65 20 74 68 65 73 65 0a  | may have these.|
00001040  64 69 73 61 62 6c 65 64  3b 20 79 6f 75 27 64 20  |disabled; you'd |
00001050  6e 65 65 64 20 61 20 50  72 65 46 69 6c 74 65 72  |need a PreFilter|
00001060  20 74 6f 20 74 75 72 6e  20 74 68 65 6d 20 6f 6e  | to turn them on|
00001070  20 69 66 20 79 6f 75 20  77 61 6e 74 65 64 20 74  | if you wanted t|
00001080  6f 20 64 6f 20 69 74 20  74 68 61 74 0a 77 61 79  |o do it that.way|
00001090  29 20 5b 45 45 64 69 74  20 64 6f 65 73 20 6e 6f  |) [EEdit does no|
000010a0  74 20 71 75 69 74 65 20  64 6f 20 74 68 69 73 2c  |t quite do this,|
000010b0  20 62 75 74 20 74 68 65  6e 20 6e 6f 62 6f 64 79  | but then nobody|
000010c0  27 73 20 70 65 72 66 65  63 74 20 3a 2d 29 20 5d  |'s perfect :-) ]|
000010d0  2e 20 59 6f 75 0a 73 68  6f 75 6c 64 20 74 72 61  |. You.should tra|
000010e0  70 20 74 68 65 20 54 57  5f 4d 6f 72 69 74 65 20  |p the TW_Morite |
000010f0  61 6e 64 20 51 75 69 74  20 75 73 65 72 6d 65 73  |and Quit usermes|
00001100  73 61 67 65 73 20 74 6f  20 72 65 6d 6f 76 65 20  |sages to remove |
00001110  79 6f 75 72 20 66 69 6c  74 65 72 2e 20 49 66 20  |your filter. If |
00001120  79 6f 75 0a 77 65 72 65  20 69 6e 20 61 20 74 61  |you.were in a ta|
00001130  73 6b 77 69 6e 64 6f 77  20 74 68 65 20 70 72 6f  |skwindow the pro|
00001140  67 72 61 6d 20 77 6f 75  6c 64 20 6e 65 76 65 72  |gram would never|
00001150  20 73 65 65 20 61 6e 79  74 68 69 6e 67 2c 20 62  | see anything, b|
00001160  75 74 20 77 6f 75 6c 64  20 65 78 69 74 0a 73 61  |ut would exit.sa|
00001170  66 65 6c 79 20 62 65 63  61 75 73 65 20 74 68 65  |fely because the|
00001180  20 66 69 6c 74 65 72 20  77 6f 75 6c 64 20 6e 6f  | filter would no|
00001190  74 20 62 65 20 70 72 65  73 65 6e 74 2c 20 61 6e  |t be present, an|
000011a0  64 20 69 66 20 79 6f 75  20 77 65 72 65 20 69 6e  |d if you were in|
000011b0  20 74 68 65 20 43 4c 49  0a 74 68 65 20 66 69 6c  | the CLI.the fil|
000011c0  74 65 72 20 77 6f 75 6c  64 20 65 78 69 74 20 61  |ter would exit a|
000011d0  6e 64 20 74 68 65 6e 20  74 68 65 20 70 72 6f 67  |nd then the prog|
000011e0  72 61 6d 20 77 6f 75 6c  64 20 72 65 63 65 69 76  |ram would receiv|
000011f0  65 20 74 68 65 20 71 75  69 74 20 6d 65 73 73 61  |e the quit messa|
00001200  67 65 0a 61 6e 64 20 73  69 6d 69 6c 61 72 6c 79  |ge.and similarly|
00001210  20 65 78 69 74 2e 20 59  6f 75 20 73 68 6f 75 6c  | exit. You shoul|
00001220  64 20 4e 4f 54 20 66 61  75 6c 74 20 6d 75 6c 74  |d NOT fault mult|
00001230  69 70 6c 65 20 72 65 6d  6f 76 61 6c 73 20 6f 66  |iple removals of|
00001240  20 74 68 65 20 66 69 6c  74 65 72 20 2d 0a 75 73  | the filter -.us|
00001250  65 20 74 68 65 20 58 20  76 61 72 69 61 6e 74 2e  |e the X variant.|
00001260  0a 0a 4f 62 76 69 6f 75  73 6c 79 2c 20 79 6f 75  |..Obviously, you|
00001270  27 64 20 70 72 6f 62 61  62 6c 79 20 77 61 6e 74  |'d probably want|
00001280  20 74 6f 20 75 73 65 20  61 20 73 74 61 74 65 20  | to use a state |
00001290  73 79 73 74 65 6d 20 28  61 73 20 45 45 64 69 74  |system (as EEdit|
000012a0  20 64 6f 65 73 29 20 72  61 74 68 65 72 0a 74 68  | does) rather.th|
000012b0  61 6e 20 6a 75 73 74 20  66 6c 61 67 73 20 74 6f  |an just flags to|
000012c0  20 6d 61 72 6b 20 72 65  74 75 72 6e 20 63 6f 6e  | mark return con|
000012d0  64 69 74 69 6f 6e 73 2c  20 62 75 74 20 74 68 65  |ditions, but the|
000012e0  20 67 65 6e 65 72 61 6c  20 70 72 69 6e 63 69 70  | general princip|
000012f0  6c 65 20 68 6f 6c 64 73  2e 0a 4f 6e 65 20 6f 74  |le holds..One ot|
00001300  68 65 72 20 6d 61 74 74  65 72 20 6f 66 20 6e 6f  |her matter of no|
00001310  74 65 20 69 73 20 74 68  61 74 20 79 6f 75 20 2f  |te is that you /|
00001320  63 61 6e 2f 20 68 61 76  65 20 74 68 65 20 66 69  |can/ have the fi|
00001330  6c 74 65 72 20 69 6e 20  74 68 65 20 73 61 6d 65  |lter in the same|
00001340  20 73 70 61 63 65 0a 61  73 20 74 68 65 20 54 61  | space.as the Ta|
00001350  73 6b 20 69 74 73 65 6c  66 20 2d 20 74 68 65 72  |sk itself - ther|
00001360  65 20 69 73 20 6e 6f 20  72 65 71 75 69 72 65 6d  |e is no requirem|
00001370  65 6e 74 20 74 6f 20 6d  6f 76 65 20 74 68 65 20  |ent to move the |
00001380  66 69 6c 74 65 72 20 69  6e 74 6f 20 52 4d 41 2e  |filter into RMA.|
00001390  0a 48 6f 77 65 76 65 72  2c 20 79 6f 75 20 6d 75  |.However, you mu|
000013a0  73 74 20 72 65 6d 65 6d  62 65 72 20 74 68 61 74  |st remember that|
000013b0  20 61 20 70 72 6f 67 72  61 6d 20 6c 69 6b 65 20  | a program like |
000013c0  27 45 6d 70 74 79 20 54  61 73 6b 73 27 20 69 73  |'Empty Tasks' is|
000013d0  20 76 65 72 79 20 6c 69  6b 65 6c 79 0a 74 6f 20  | very likely.to |
000013e0  6b 69 6c 6c 20 74 68 65  20 64 65 73 6b 74 6f 70  |kill the desktop|
000013f0  20 69 66 20 69 74 20 70  61 67 65 73 20 73 75 63  | if it pages suc|
00001400  68 20 61 20 74 61 73 6b  20 6f 75 74 20 6f 66 20  |h a task out of |
00001410  6d 65 6d 6f 72 79 2e 20  54 68 65 72 65 20 69 73  |memory. There is|
00001420  20 61 20 73 69 6d 70 6c  65 0a 73 6f 6c 75 74 69  | a simple.soluti|
00001430  6f 6e 20 74 6f 20 74 68  69 73 20 2d 20 64 6f 6e  |on to this - don|
00001440  27 74 20 64 6f 20 69 74  20 3a 2d 29 0a 0a 48 6f  |'t do it :-)..Ho|
00001450  70 65 66 75 6c 6c 79 20  74 68 61 74 20 77 69 6c  |pefully that wil|
00001460  6c 20 68 65 6c 70 20 70  65 6f 70 6c 65 20 77 69  |l help people wi|
00001470  73 68 69 6e 67 20 74 6f  20 77 72 69 74 65 20 73  |shing to write s|
00001480  69 6d 69 6c 61 72 20 63  6f 64 65 2e 20 46 6f 72  |imilar code. For|
00001490  20 74 68 6f 73 65 20 6d  61 64 0a 65 6e 6f 75 67  | those mad.enoug|
000014a0  68 2c 20 74 68 65 20 73  6f 75 72 63 65 20 63 6f  |h, the source co|
000014b0  64 65 20 69 73 20 69 6e  63 6c 75 64 65 64 20 69  |de is included i|
000014c0  6e 20 4a 46 50 61 74 63  68 20 66 6f 72 6d 61 74  |n JFPatch format|
000014d0  2e 0a 0a 0a 46 69 6e 61  6c 20 63 6f 6d 6d 65 6e  |....Final commen|
000014e0  74 73 0a 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 2d 2d  |ts.-------------|
000014f0  2d 0a 52 65 6d 65 6d 62  65 72 2c 20 69 74 20 69  |-.Remember, it i|
00001500  73 20 6e 6f 74 20 61 6e  20 65 78 65 72 63 69 73  |s not an exercis|
00001510  65 20 69 6e 20 66 75 74  69 6c 69 74 79 20 74 6f  |e in futility to|
00001520  20 73 69 6d 70 6c 79 20  74 72 79 20 73 6f 6d 65  | simply try some|
00001530  74 68 69 6e 67 20 74 68  61 74 20 68 61 73 0a 6e  |thing that has.n|
00001540  65 76 65 72 20 62 65 65  6e 20 64 6f 6e 65 2e 20  |ever been done. |
00001550  52 61 74 68 65 72 20 74  68 61 6e 20 6a 75 73 74  |Rather than just|
00001560  20 75 73 69 6e 67 20 74  68 65 20 69 6e 63 72 65  | using the incre|
00001570  64 69 62 6c 65 20 70 6f  77 65 72 20 6f 66 20 79  |dible power of y|
00001580  6f 75 72 0a 63 6f 6d 70  75 74 65 72 2c 20 74 72  |our.computer, tr|
00001590  79 20 74 6f 20 70 75 73  68 20 69 74 2e 20 54 68  |y to push it. Th|
000015a0  65 72 65 27 73 20 61 6e  20 61 64 76 65 72 74 20  |ere's an advert |
000015b0  6f 6e 20 74 65 6c 6c 79  20 61 74 20 74 68 65 20  |on telly at the |
000015c0  6d 6f 6d 65 6e 74 20 28  77 68 69 63 68 20 49 0a  |moment (which I.|
000015d0  64 6f 6e 27 74 20 6c 69  6b 65 29 20 62 75 74 20  |don't like) but |
000015e0  74 68 65 20 73 65 6e 74  69 6d 65 6e 74 20 69 73  |the sentiment is|
000015f0  20 67 6f 6f 64 20 2d 20  27 44 6f 6e 27 74 20 6a  | good - 'Don't j|
00001600  75 73 74 20 69 6d 6d 69  74 61 74 65 2c 20 69 6e  |ust immitate, in|
00001610  6e 6f 76 61 74 65 27 2c  20 73 6f 0a 74 72 79 20  |novate', so.try |
00001620  77 72 69 74 69 6e 67 20  73 6f 6d 65 74 68 69 6e  |writing somethin|
00001630  67 20 74 68 61 74 20 68  61 73 20 6e 65 76 65 72  |g that has never|
00001640  20 62 65 65 6e 20 64 6f  6e 65 20 62 65 66 6f 72  | been done befor|
00001650  65 2e 20 41 6e 64 20 69  66 20 61 6e 79 6f 6e 65  |e. And if anyone|
00001660  20 65 6c 73 65 0a 77 72  69 74 65 73 20 61 6e 6f  | else.writes ano|
00001670  74 68 65 72 20 41 64 64  72 65 73 73 20 42 6f 6f  |ther Address Boo|
00001680  6b 20 70 72 6f 67 72 61  6d 20 61 6e 64 20 74 68  |k program and th|
00001690  65 6e 20 65 78 70 65 63  74 73 20 70 65 6f 70 6c  |en expects peopl|
000016a0  65 20 74 6f 20 70 61 79  20 66 6f 72 20 69 74 0a  |e to pay for it.|
000016b0  49 27 6c 6c 20 73 63 72  65 61 6d 20 21 20 54 68  |I'll scream ! Th|
000016c0  69 73 20 69 73 20 6e 6f  74 20 61 20 50 43 20 6d  |is is not a PC m|
000016d0  61 72 6b 65 74 2c 20 67  75 79 73 20 28 61 6e 64  |arket, guys (and|
000016e0  20 67 61 6c 73 29 2c 20  77 65 27 72 65 20 68 61  | gals), we're ha|
000016f0  76 65 20 61 6e 0a 69 6e  63 72 65 64 69 62 6c 79  |ve an.incredibly|
00001700  20 70 6f 77 65 72 66 75  6c 20 6d 61 63 68 69 6e  | powerful machin|
00001710  65 20 61 74 20 6f 75 72  20 66 69 6e 67 65 72 74  |e at our fingert|
00001720  69 70 73 20 77 68 69 63  68 20 69 73 20 6e 6f 74  |ips which is not|
00001730  20 62 65 69 6e 67 20 65  78 70 6c 6f 69 74 65 64  | being exploited|
00001740  2e 0a 0a 4e 65 78 74 20  74 69 6d 65 20 79 6f 75  |...Next time you|
00001750  20 73 65 65 20 61 20 70  72 6f 67 72 61 6d 20 72  | see a program r|
00001760  75 6e 6e 69 6e 67 20 73  6c 6f 77 6c 79 20 6f 6e  |unning slowly on|
00001770  20 79 6f 75 72 20 6d 61  63 68 69 6e 65 20 61 6e  | your machine an|
00001780  64 20 79 6f 75 27 72 65  0a 74 68 69 6e 6b 69 6e  |d you're.thinkin|
00001790  67 20 27 4f 68 2c 20 69  74 27 73 20 6f 6b 20 62  |g 'Oh, it's ok b|
000017a0  65 63 61 75 73 65 20 69  74 27 73 20 64 6f 69 6e  |ecause it's doin|
000017b0  67 20 6c 6f 74 73 20 6f  66 20 77 6f 72 6b 27 20  |g lots of work' |
000017c0  70 6c 65 61 73 65 20 62  61 72 65 20 69 6e 20 6d  |please bare in m|
000017d0  69 6e 64 0a 74 68 69 73  20 6c 69 74 74 6c 65 20  |ind.this little |
000017e0  73 6e 69 70 70 65 74 20  2d 20 0a 0a 22 45 76 65  |snippet - .."Eve|
000017f0  72 79 20 74 69 6d 65 20  61 20 63 68 61 72 61 63  |ry time a charac|
00001800  74 65 72 20 6e 65 65 64  73 20 6f 75 74 70 75 74  |ter needs output|
00001810  69 6e 67 20 74 6f 20 74  68 65 20 73 63 72 65 65  |ing to the scree|
00001820  6e 20 69 74 20 70 61 73  73 65 73 20 69 6e 74 6f  |n it passes into|
00001830  20 74 68 65 0a 27 53 57  49 27 20 64 65 63 6f 64  | the.'SWI' decod|
00001840  69 6e 67 20 72 6f 75 74  69 6e 65 2c 20 77 68 69  |ing routine, whi|
00001850  63 68 20 70 61 73 73 65  73 20 69 74 20 74 6f 20  |ch passes it to |
00001860  74 68 65 20 4f 53 5f 57  72 69 74 65 43 20 72 6f  |the OS_WriteC ro|
00001870  75 74 69 6e 65 2c 20 77  68 69 63 68 0a 70 61 73  |utine, which.pas|
00001880  73 65 73 20 69 74 20 74  68 72 6f 75 67 68 20 74  |ses it through t|
00001890  6f 20 57 72 63 68 56 20  77 68 69 63 68 20 67 6f  |o WrchV which go|
000018a0  65 73 20 74 68 72 6f 75  67 68 20 61 6c 6c 20 74  |es through all t|
000018b0  68 65 20 72 6f 75 74 69  6e 65 73 20 68 6f 6f 6b  |he routines hook|
000018c0  65 64 20 6f 6e 20 74 6f  0a 74 68 61 74 20 76 65  |ed on to.that ve|
000018d0  63 74 6f 72 20 74 6f 20  74 68 65 20 63 6f 64 65  |ctor to the code|
000018e0  20 74 6f 20 64 69 73 70  6c 61 79 20 69 74 20 6f  | to display it o|
000018f0  6e 20 74 68 65 20 73 63  72 65 65 6e 2e 20 54 68  |n the screen. Th|
00001900  65 73 65 20 74 68 65 6e  20 74 61 6b 65 20 61 63  |ese then take ac|
00001910  63 6f 75 6e 74 0a 6f 66  20 74 68 65 20 73 63 72  |count.of the scr|
00001920  65 65 6e 20 6d 6f 64 65  2c 20 67 72 61 70 68 69  |een mode, graphi|
00001930  63 73 20 63 75 72 73 6f  72 20 61 63 74 69 76 61  |cs cursor activa|
00001940  74 69 6f 6e 2c 20 63 6f  6e 74 72 6f 6c 20 63 6f  |tion, control co|
00001950  64 65 73 2c 20 65 74 63  20 61 6e 64 20 64 69 73  |des, etc and dis|
00001960  70 6c 61 0a 69 74 20 28  6f 72 20 72 65 64 69 72  |pla.it (or redir|
00001970  65 63 74 20 69 74 20 74  6f 20 61 20 66 69 6c 65  |ect it to a file|
00001980  20 2d 20 61 20 73 69 6d  69 6c 61 72 6c 79 20 63  | - a similarly c|
00001990  6f 6d 70 6c 65 78 20 70  72 6f 63 65 64 75 72 65  |omplex procedure|
000019a0  29 2c 20 74 68 65 6e 20  72 65 74 75 72 6e 73 0a  |), then returns.|
000019b0  62 61 63 6b 20 74 68 72  6f 75 67 68 20 74 68 65  |back through the|
000019c0  20 53 57 49 20 72 6f 75  74 69 6e 65 73 20 28 70  | SWI routines (p|
000019d0  6f 73 73 69 62 6c 79 20  70 65 72 66 6f 72 6d 69  |ossibly performi|
000019e0  6e 67 20 63 61 6c 6c 62  61 63 6b 73 29 20 61 6e  |ng callbacks) an|
000019f0  64 20 74 68 65 6e 20 74  6f 20 74 68 65 0a 63 61  |d then to the.ca|
00001a00  6c 6c 65 72 2e 20 54 68  69 73 20 6f 63 63 75 72  |ller. This occur|
00001a10  73 20 66 6f 72 20 65 76  65 72 79 20 63 68 61 72  |s for every char|
00001a20  61 63 74 65 72 2e 20 41  6e 64 20 69 66 20 79 6f  |acter. And if yo|
00001a30  75 20 75 73 65 20 4f 53  5f 57 72 69 74 65 53 20  |u use OS_WriteS |
00001a40  72 61 74 68 65 72 20 74  68 61 6e 0a 4f 53 5f 57  |rather than.OS_W|
00001a50  72 69 74 65 43 20 69 74  20 73 69 6d 70 6c 79 20  |riteC it simply |
00001a60  63 61 6c 6c 73 20 4f 53  5f 57 72 69 74 65 43 20  |calls OS_WriteC |
00001a70  6c 6f 74 73 20 6f 66 20  74 69 6d 65 73 2c 20 67  |lots of times, g|
00001a80  6f 69 6e 67 20 74 68 72  6f 75 67 68 20 74 68 65  |oing through the|
00001a90  20 77 68 6f 6c 65 0a 74  68 69 6e 67 20 66 6f 72  | whole.thing for|
00001aa0  20 65 76 65 72 79 20 63  68 61 72 61 63 74 65 72  | every character|
00001ab0  2e 22 0a 0a 41 6e 79 6f  6e 65 20 77 68 6f 20 68  |."..Anyone who h|
00001ac0  61 73 20 70 72 6f 67 72  61 6d 6d 65 64 20 74 68  |as programmed th|
00001ad0  61 74 20 73 69 64 65 20  6f 66 20 74 68 69 6e 67  |at side of thing|
00001ae0  73 20 77 69 6c 6c 20 6b  6e 6f 77 20 74 68 69 73  |s will know this|
00001af0  20 28 61 73 20 77 69 6c  6c 20 61 6e 79 6f 6e 65  | (as will anyone|
00001b00  0a 77 68 6f 20 70 72 6f  67 72 61 6d 6d 65 64 20  |.who programmed |
00001b10  74 68 65 20 42 42 43 20  61 73 20 74 68 65 20 70  |the BBC as the p|
00001b20  72 69 6e 63 69 70 6c 65  20 69 73 20 74 68 65 20  |rinciple is the |
00001b30  73 61 6d 65 29 2e 20 54  68 65 20 74 68 69 6e 67  |same). The thing|
00001b40  20 69 73 20 74 68 61 74  20 73 6f 0a 6d 75 63 68  | is that so.much|
00001b50  20 69 73 20 67 6f 69 6e  67 20 6f 6e 20 66 6f 72  | is going on for|
00001b60  20 61 20 73 69 6e 67 6c  65 20 63 68 61 72 61 63  | a single charac|
00001b70  74 65 72 20 6f 75 74 70  75 74 20 61 6e 64 20 79  |ter output and y|
00001b80  65 74 20 69 74 20 69 73  20 73 74 69 6c 6c 20 66  |et it is still f|
00001b90  61 73 74 2e 20 54 79 70  65 0a 2a 48 65 6c 70 20  |ast. Type.*Help |
00001ba0  2e 20 61 6e 64 20 77 61  74 63 68 20 61 73 20 74  |. and watch as t|
00001bb0  68 65 20 73 63 72 65 65  6e 20 66 69 6c 6c 73 20  |he screen fills |
00001bc0  77 69 74 68 20 66 6c 61  73 68 69 6e 67 20 63 68  |with flashing ch|
00001bd0  61 72 61 63 74 65 72 73  20 28 61 63 74 75 61 6c  |aracters (actual|
00001be0  6c 79 0a 79 6f 75 27 6c  6c 20 68 61 76 65 20 74  |ly.you'll have t|
00001bf0  6f 20 68 6f 6c 64 20 64  6f 77 6e 20 73 68 69 66  |o hold down shif|
00001c00  74 20 6f 74 68 65 72 77  69 73 65 20 69 74 27 6c  |t otherwise it'l|
00001c10  6c 20 73 74 6f 70 21 29  2e 20 49 66 20 79 6f 75  |l stop!). If you|
00001c20  27 72 65 20 6e 6f 74 0a  73 75 72 70 72 69 73 65  |'re not.surprise|
00001c30  64 20 62 79 20 74 68 65  20 73 70 65 65 64 20 28  |d by the speed (|
00001c40  61 6e 64 20 49 27 6c 6c  20 61 64 6d 69 74 20 74  |and I'll admit t|
00001c50  68 61 74 20 49 20 77 61  73 20 6f 6e 63 65 20 49  |hat I was once I|
00001c60  20 74 68 6f 75 67 68 74  20 61 62 6f 75 74 20 69  | thought about i|
00001c70  74 29 2c 0a 74 68 65 6e  20 49 27 6c 6c 20 72 65  |t),.then I'll re|
00001c80  6d 69 6e 64 20 79 6f 75  20 74 68 61 74 20 49 27  |mind you that I'|
00001c90  6d 20 75 73 69 6e 67 20  61 6e 20 41 35 30 30 30  |m using an A5000|
00001ca0  2e 20 49 66 20 74 68 61  74 20 73 74 69 6c 6c 20  |. If that still |
00001cb0  64 6f 65 73 6e 27 74 20  73 75 72 70 72 69 73 65  |doesn't surprise|
00001cc0  0a 79 6f 75 20 74 68 65  6e 2c 20 49 27 6c 6c 20  |.you then, I'll |
00001cd0  74 65 6c 6c 20 79 6f 75  20 61 6e 6f 74 68 65 72  |tell you another|
00001ce0  20 6c 69 74 74 6c 65 20  74 61 6c 65 20 3a 0a 0a  | little tale :..|
00001cf0  22 46 6f 6e 74 73 20 69  6e 20 74 68 65 20 44 65  |"Fonts in the De|
00001d00  73 6b 74 6f 70 20 69 73  20 73 6f 6d 65 74 68 69  |sktop is somethi|
00001d10  6e 67 20 70 65 6f 70 6c  65 20 68 61 76 65 20 74  |ng people have t|
00001d20  72 69 65 64 20 74 6f 20  64 6f 20 66 6f 72 20 50  |ried to do for P|
00001d30  72 65 2d 52 50 43 73 20  66 6f 72 20 61 0a 6c 6f  |re-RPCs for a.lo|
00001d40  6e 67 20 74 69 6d 65 20  77 69 74 68 20 76 61 72  |ng time with var|
00001d50  79 69 6e 67 20 64 65 67  72 65 65 73 20 6f 66 20  |ying degrees of |
00001d60  73 75 63 63 65 73 73 2e  20 48 6f 77 65 76 65 72  |success. However|
00001d70  2c 20 49 20 6b 6e 6f 77  20 6f 66 20 6f 6e 6c 79  |, I know of only|
00001d80  20 6f 6e 65 20 70 65 72  73 6f 6e 0a 77 68 6f 20  | one person.who |
00001d90  65 76 65 72 20 74 72 69  65 64 20 69 74 20 74 68  |ever tried it th|
00001da0  65 20 77 61 79 20 49 20  64 69 64 20 28 6f 74 68  |e way I did (oth|
00001db0  65 72 20 74 68 61 6e 20  6d 65 2c 20 61 6e 64 20  |er than me, and |
00001dc0  49 20 66 6f 72 67 65 74  20 74 68 65 69 72 20 6e  |I forget their n|
00001dd0  61 6d 65 29 2e 20 42 79  0a 72 65 64 69 72 65 63  |ame). By.redirec|
00001de0  74 69 6e 67 20 74 68 65  20 57 72 63 68 56 20 61  |ting the WrchV a|
00001df0  6e 64 20 63 68 65 63 6b  69 6e 67 20 61 6c 6c 20  |nd checking all |
00001e00  74 68 65 20 73 79 73 74  65 6d 20 76 61 72 69 61  |the system varia|
00001e10  62 6c 65 73 20 74 68 65  6e 20 70 72 6f 64 75 63  |bles then produc|
00001e20  69 6e 67 20 61 0a 66 6f  6e 74 20 76 69 61 20 46  |ing a.font via F|
00001e30  6f 6e 74 5f 50 61 69 6e  74 20 72 61 74 68 65 72  |ont_Paint rather|
00001e40  20 74 68 61 6e 20 73 79  73 74 65 6d 20 63 68 61  | than system cha|
00001e50  72 61 63 74 65 72 20 61  6e 64 20 72 65 74 75 72  |racter and retur|
00001e60  6e 69 6e 67 20 74 6f 20  74 68 65 0a 6f 72 69 67  |ning to the.orig|
00001e70  69 6e 61 6c 20 63 61 6c  6c 65 72 2e 22 0a 0a 57  |inal caller."..W|
00001e80  68 61 74 20 73 75 72 70  72 69 73 65 64 20 6d 65  |hat surprised me|
00001e90  20 6d 6f 73 74 20 77 61  73 20 6e 6f 74 20 74 68  | most was not th|
00001ea0  65 20 66 61 63 74 20 74  68 61 74 20 69 74 20 77  |e fact that it w|
00001eb0  6f 72 6b 65 64 20 28 61  6c 74 68 6f 75 67 68 20  |orked (although |
00001ec0  74 68 61 74 20 64 69 64  0a 71 75 69 74 65 20 61  |that did.quite a|
00001ed0  20 62 69 74 29 2c 20 62  75 74 20 74 68 65 20 73  | bit), but the s|
00001ee0  70 65 65 64 20 6f 66 20  69 74 2e 20 45 76 65 6e  |peed of it. Even|
00001ef0  20 64 6f 69 6e 67 20 74  68 69 73 20 72 69 64 69  | doing this ridi|
00001f00  63 75 6c 6f 75 73 20 6c  65 76 65 6c 20 6f 66 0a  |culous level of.|
00001f10  70 61 74 63 68 69 6e 67  20 74 68 65 20 64 65 73  |patching the des|
00001f20  6b 74 6f 70 20 2f 73 74  69 6c 6c 2f 20 69 73 6e  |ktop /still/ isn|
00001f30  27 74 20 70 61 72 74 69  63 75 6c 61 72 6c 79 20  |'t particularly |
00001f40  73 6c 6f 77 3b 20 69 74  27 73 20 70 6f 73 73 69  |slow; it's possi|
00001f50  62 6c 65 20 6e 6f 77 20  74 6f 0a 73 65 65 20 74  |ble now to.see t|
00001f60  68 65 20 50 69 6e 62 6f  61 72 64 20 6d 65 6e 75  |he Pinboard menu|
00001f70  20 72 65 64 72 61 77 2c  20 62 75 74 20 6c 65 74  | redraw, but let|
00001f80  27 73 20 72 65 6d 65 6d  62 65 72 20 74 68 61 74  |'s remember that|
00001f90  20 65 76 65 72 79 20 63  68 61 72 61 63 74 65 72  | every character|
00001fa0  20 69 73 20 6e 6f 77 0a  70 61 73 73 69 6e 67 20  | is now.passing |
00001fb0  74 68 72 6f 75 67 68 20  74 68 65 20 46 6f 6e 74  |through the Font|
00001fc0  20 6d 61 6e 61 67 65 72  20 61 6e 64 20 68 61 73  | manager and has|
00001fd0  20 61 20 66 65 77 20 63  61 6c 6c 73 20 74 6f 20  | a few calls to |
00001fe0  4f 53 5f 42 79 74 65 20  61 6e 64 20 73 69 6d 69  |OS_Byte and simi|
00001ff0  6c 61 72 0a 72 6f 75 74  69 6e 65 73 20 63 68 75  |lar.routines chu|
00002000  63 6b 65 64 20 69 6e 20  74 68 65 72 65 20 66 6f  |cked in there fo|
00002010  72 20 67 6f 6f 64 20 6d  65 61 73 75 72 65 2e 20  |r good measure. |
00002020  49 74 20 74 61 6b 65 73  20 61 62 6f 75 74 20 31  |It takes about 1|
00002030  bd 20 73 65 63 6f 6e 64  73 20 74 6f 0a 72 65 64  |. seconds to.red|
00002040  72 61 77 20 6d 79 20 63  75 72 72 65 6e 74 20 4d  |raw my current M|
00002050  6f 64 65 20 33 31 20 73  63 72 65 65 6e 20 28 66  |ode 31 screen (f|
00002060  75 6c 6c 20 70 69 6e 62  6f 61 72 64 20 61 6e 64  |ull pinboard and|
00002070  20 74 68 72 65 65 20 46  69 6c 65 72 20 57 69 6e  | three Filer Win|
00002080  64 6f 77 73 29 20 62 75  74 0a 74 68 61 74 27 73  |dows) but.that's|
00002090  20 6e 6f 74 20 6d 75 63  68 20 6d 6f 72 65 20 74  | not much more t|
000020a0  68 61 6e 20 74 68 65 20  6e 6f 72 6d 61 6c 20 74  |han the normal t|
000020b0  69 6d 65 20 61 6e 79 68  6f 77 2e 20 54 68 65 72  |ime anyhow. Ther|
000020c0  65 20 61 72 65 20 73 6f  6d 65 20 70 72 6f 62 6c  |e are some probl|
000020d0  65 6d 73 0a 77 69 74 68  20 73 70 72 69 74 65 20  |ems.with sprite |
000020e0  72 65 64 69 72 65 63 74  69 6f 6e 2c 20 62 75 74  |redirection, but|
000020f0  20 74 68 61 74 27 73 20  6f 6e 6c 79 20 74 6f 20  | that's only to |
00002100  62 65 20 65 78 70 65 63  74 65 64 2e 0a 0a 57 68  |be expected...Wh|
00002110  79 20 61 6d 20 49 20 74  65 6c 6c 69 6e 67 20 79  |y am I telling y|
00002120  6f 75 20 74 68 69 73 20  3f 20 59 6f 75 20 73 68  |ou this ? You sh|
00002130  6f 75 6c 64 20 72 65 6d  65 6d 62 65 72 20 65 76  |ould remember ev|
00002140  65 72 79 74 69 6d 65 20  79 6f 75 20 73 65 65 20  |erytime you see |
00002150  61 20 70 72 6f 67 72 61  6d 0a 72 75 6e 6e 69 6e  |a program.runnin|
00002160  67 20 73 6c 6f 77 6c 79  20 74 68 61 74 20 69 74  |g slowly that it|
00002170  27 73 20 6e 6f 74 20 6a  75 73 74 20 74 68 65 20  |'s not just the |
00002180  63 6f 6d 70 6c 65 78 69  74 79 20 6f 66 20 77 68  |complexity of wh|
00002190  61 74 20 69 74 20 64 6f  65 73 2c 20 62 75 74 20  |at it does, but |
000021a0  74 68 65 20 77 61 79 0a  69 74 27 73 20 62 65 65  |the way.it's bee|
000021b0  6e 20 77 72 69 74 74 65  6e 2e 20 49 6e 20 6d 79  |n written. In my|
000021c0  20 65 78 61 6d 70 6c 65  20 49 20 77 61 73 20 77  | example I was w|
000021d0  72 69 74 69 6e 67 20 61  73 73 65 6d 62 6c 65 72  |riting assembler|
000021e0  20 62 79 20 68 61 6e 64  2c 20 62 75 74 20 69 66  | by hand, but if|
000021f0  20 79 6f 75 0a 73 65 65  20 61 20 43 20 70 72 6f  | you.see a C pro|
00002200  67 72 61 6d 27 73 20 69  6e 73 69 64 65 73 20 79  |gram's insides y|
00002210  6f 75 27 6c 6c 20 6b 6e  6f 77 20 68 6f 77 20 79  |ou'll know how y|
00002220  75 63 6b 69 6c 79 20 69  74 27 73 20 62 65 65 6e  |uckily it's been|
00002230  20 77 72 69 74 74 65 6e  2e 20 53 69 6d 70 6c 65  | written. Simple|
00002240  0a 74 68 69 6e 67 73 20  6c 69 6b 65 20 73 74 72  |.things like str|
00002250  63 70 79 20 66 6f 6c 6c  6f 77 65 64 20 62 79 20  |cpy followed by |
00002260  73 74 72 6c 65 6e 20 63  61 6e 20 6f 70 74 69 6d  |strlen can optim|
00002270  69 73 65 20 74 6f 20 61  20 73 69 6e 67 6c 65 20  |ise to a single |
00002280  63 61 6c 6c 20 69 6e 20  68 61 6e 64 0a 77 72 69  |call in hand.wri|
00002290  74 74 65 6e 20 61 73 73  65 6d 62 6c 65 72 2e 20  |tten assembler. |
000022a0  54 68 65 79 20 6d 61 79  20 6e 6f 74 20 74 61 6b  |They may not tak|
000022b0  65 20 6c 6f 6e 67 2c 20  62 75 74 20 69 74 20 61  |e long, but it a|
000022c0  6c 6c 20 61 64 64 73 20  75 70 2e 20 53 69 6d 69  |ll adds up. Simi|
000022d0  6c 61 72 6c 79 0a 73 6f  6d 65 74 68 69 6e 67 20  |larly.something |
000022e0  6c 69 6b 65 20 3a 0a 20  20 66 6f 72 20 28 69 3d  |like :.  for (i=|
000022f0  30 3b 20 69 3c 73 74 72  6c 65 6e 28 78 29 3b 20  |0; i<strlen(x); |
00002300  69 2b 2b 29 20 7b 20 2e  2e 2e 20 7d 0a 0a 49 73  |i++) { ... }..Is|
00002310  20 73 6f 20 61 6d 61 7a  69 6e 67 6c 79 20 62 61  | so amazingly ba|
00002320  64 20 74 68 61 74 20 69  74 20 72 65 61 6c 6c 79  |d that it really|
00002330  20 6e 65 65 64 73 20 73  6f 6d 65 20 74 68 69 6e  | needs some thin|
00002340  6b 69 6e 67 20 61 62 6f  75 74 2e 20 49 20 72 65  |king about. I re|
00002350  63 6b 6f 6e 20 74 68 61  74 0a 74 68 61 74 20 63  |ckon that.that c|
00002360  6f 6d 65 73 20 6f 75 74  20 61 74 20 4f 28 32 6e  |omes out at O(2n|
00002370  29 20 66 6f 72 20 74 68  61 74 20 73 69 6e 67 6c  |) for that singl|
00002380  65 20 6c 6f 6f 70 2c 20  77 68 65 6e 20 69 74 20  |e loop, when it |
00002390  63 6f 75 6c 64 20 62 65  20 4f 28 6e 29 20 77 69  |could be O(n) wi|
000023a0  74 68 20 61 0a 74 69 6e  79 20 62 69 74 20 6f 66  |th a.tiny bit of|
000023b0  20 74 68 6f 75 67 68 74  2e 20 4f 6b 2c 20 73 6f  | thought. Ok, so|
000023c0  20 6e 6f 74 20 65 76 65  72 79 62 6f 64 79 20 77  | not everybody w|
000023d0  61 6e 74 73 20 74 6f 20  77 72 69 74 65 20 63 6f  |ants to write co|
000023e0  64 65 20 74 68 61 74 20  77 61 79 2c 20 61 6e 64  |de that way, and|
000023f0  0a 6d 6f 73 74 20 77 6f  75 6c 64 20 72 61 74 68  |.most would rath|
00002400  65 72 20 74 68 65 20 63  6f 64 65 20 77 6f 72 6b  |er the code work|
00002410  65 64 20 74 68 61 6e 20  73 70 65 6e 74 20 68 6f  |ed than spent ho|
00002420  75 72 73 2f 64 61 79 73  20 67 65 74 74 69 6e 67  |urs/days getting|
00002430  20 69 74 20 74 6f 20 62  65 0a 66 61 73 74 2c 20  | it to be.fast, |
00002440  62 75 74 20 2f 64 6f 2f  20 62 61 72 65 20 74 68  |but /do/ bare th|
00002450  69 73 20 69 6e 20 6d 69  6e 64 20 77 68 65 6e 20  |is in mind when |
00002460  61 20 63 6f 6d 70 61 6e  79 20 73 61 79 73 20 69  |a company says i|
00002470  74 20 63 61 6e 27 74 20  6d 61 6b 65 20 61 20 70  |t can't make a p|
00002480  72 6f 67 72 61 6d 0a 61  6e 79 20 66 61 73 74 65  |rogram.any faste|
00002490  72 20 2d 20 74 68 65 79  20 6d 61 79 20 6e 6f 74  |r - they may not|
000024a0  20 62 65 20 74 65 6c 6c  69 6e 67 20 74 68 65 20  | be telling the |
000024b0  63 6f 6d 70 6c 65 74 65  20 74 72 75 74 68 20 3a  |complete truth :|
000024c0  2d 29 0a 0a 3c 65 6e 64  20 6f 66 20 73 65 72 6d  |-)..<end of serm|
000024d0  6f 6e 21 3e 0a 0a 43 6f  6e 74 61 63 74 0a 2d 2d  |on!>..Contact.--|
000024e0  2d 2d 2d 2d 2d 0a 49 66  20 79 6f 75 20 77 61 6e  |-----.If you wan|
000024f0  74 20 74 6f 20 63 6f 6e  74 61 63 74 20 6d 65 2c  |t to contact me,|
00002500  20 49 20 61 6d 20 65 6d  61 69 6c 61 62 6c 65 20  | I am emailable |
00002510  61 74 20 67 65 72 70 68  40 69 6e 6e 6f 63 65 6e  |at gerph@innocen|
00002520  74 2e 63 6f 6d 20 2d 20  74 68 69 73 0a 61 64 64  |t.com - this.add|
00002530  72 65 73 73 20 69 73 20  6c 69 6b 65 6c 79 20 74  |ress is likely t|
00002540  6f 20 72 65 6d 61 69 6e  20 66 6f 72 20 74 68 65  |o remain for the|
00002550  20 66 6f 72 73 65 65 61  62 6c 65 20 66 75 74 75  | forseeable futu|
00002560  72 65 2e 0a 0a 0a 0a                              |re.....|
00002567