> > > > > dada è stato divorato dai coccodrilli, Giambo è partito per Creta... sul fòro non ci sono quasi più messaggi. 
> > > >
> > > > Fra l'altro, io sono impegnato, sto scrivendo un mucchio per le istruzioni di L.in.oleum 3.
> > > > Ho quasi finito. Non so se mi sono venute bene, ma di certo mi sono venute spiritose. 
> > >
> > >
> > > proott x | 1..10
> > > gnanf
> > > gorgl
> > >
> >
> > - E invece e` bello!
> > - Non e` bello cio` che e` bello ma e` bello cio` che piace!
> > - A me la Mariarosa mi piace!
> > - Ecco, allora te la sposi tu.
>
> hai mai pensato a un traduttore lolcode > linoleum?
Scarsamente utile: c'e` poca differenza.
Allego prova (subroutine realmente parte del pacchetto di librerie di default).
\inlet super "bye" as "subroutine":
breakpoint that waits for user signal and then quits application
\synopses:
bye;
\abstract:
This is a subroutine that makes sure all keys are released, then waits a key press,
then for its release, and finally ends the running application: it may be used when
a quick-and-dirty breakpoint is needed, e.g. as the endpoint of fatal junctions, no
matter if of 'call' or 'true' kind since this subroutine will not return anyway, or
invoked alone when, being shared in the superglobal namespace, it could take a tag-
like appearence, i.e.
bye;
Its function might be self-explanatory: killing your application wherever you put a
call to 'bye', with the most particular advantage of being trivial to identify e.g.
in example code targetting an audience of beginners; user-side, the subroutine does
what's possible, for example by reacting to situations where the display is totally
disabled, i.e. held in standby mode, with popping a visible display window, showing
a tiny icon inviting the user to press any key; however, where the display is found
in text mode, and assumed to already contain some form of output, the only thing it
could do is a read of the stdin handle, which - for system-side reasons - generally
ends when the user presses a SPECIFIC key: "Enter", or combination thereof: usually
Ctrl + C. In other circumstances, a "key" may not necessarily be a keyboard key, as
it will also check pointing device keys. Oh... don't mind the LOLspeak names, a bit
of humor mightn't hurt. :3
\code:
"super: inlet: bye"
(this will be a one-unit buffer to read from stdin)
spare: v * 1;
(branch for cases: no [engage] flag means stand-by mode, [graphics] induces 'bye' to simply wait a key)
a = display status;
a - engage ? popzicon;
a + graphics ? doihazkeypres;
(if none of the above, we're in text mode, so print something like "program terminated", then read [stdin])
say 't bye message';
with,
file command = read file;
file name = stdin;
file block pointer = v;
file block size = bytes per unit;
call: isokernel;
(end the program)
kthxbye;
"popzicon"
(turns on the display and shows the "press any key" icon)
with,
display status | [engage + graphics];
display command = retrace bitmap;
display origin = r bye icon;
display width = bits per unit;
display height = bits per unit;
as,
a = display available width;
a - display width;
a > 1;
a & bnot [bits per unit - 1];
display x position = a;
display y position = middle;
display live region = whole display;
call: isokernel;
"doihazkeypres"
(this branch begins to wait for a user's signal, by first looping tightly until all keys are released)
chekz4allz;
b + on ? doihazkeypres;
"canihazkeypress"
(after making sure no keys were still pressed as the program went 'bye', wait for an intentional keypress)
chekz4allz;
(a 10-millisecond nap per iteration might leave us ready to react while letting our CPU run other programs)
with,
thread command = suspend thread;
thread suspend timeout = 10;
call: isokernel;
b - on ? canihazkeypress;
"ihazkey"
(finally, wait for the release of the key before closing the program)
chekz4allz;
b + on ? i(stil)hazkey;
"super: kthxbye"
(this branch is a 3-line instant program breaker, and is left in the superglobal namespace just in case)
$ = thread stacktop;
% = success;
leave;
"chekz4allz"
(this routine tests the known means of user input for a signal, starting with all of the 128 keyboard keys)
a = 127;
b # b;
"izkeyprezd"
b | a [key a];
a ^ izkeyprezd;
(to then proceed testing the three buttons associated with the primary pointing device, usually the mouse)
with,
pointer command = read pointer;
call: isokernel;
as,
c = pointer status;
d = c;
e = c;
' c > [log2 [primary button] - [log2 [on]]];
' d > [log2 [secondary button] - [log2 [on]]];
' e > [log2 [tertiary button] - [log2 [on]]];
b | c;
b | d;
b | e;
(as of the above code, whatever key was found pressed will have set the [on] flag of on return)
leave;