AMADEUS html plain
Editor macro facilities
Click mouse right button to open/close items
general
A set of macro definitions can be described to facilitate editing.
A macro definition consists of macro command, macro body and
(optional) macro comment (e.g. name). The set of macro definitions is
given in the last (possible single) branch of a sketchy text. This sketchy
text must be activated by menu function "File + Import macro" [see in
"Help + Actions", MAIN MENU FUNCTIONS, File] to enable
search for macros (from this sketchy text). Only one set of macro
definitions can be active at a time. The active set is valid for all frames.
While editing, pressing the key "Alt" initiates input of macro command:
all (ordinary non-space) characters typed until "Alt" is released, form
the macro command. When "Alt" is released, corresponding to the
command macro definition is searched in the active set; if found, the
body of macro definition is inserted at current caret: first, it is copied to
clipboard and, second, pasted at current caret.
There are no macros with parameters.
representation of macro definitions
Let ST be a sketchy text, which will be used to solve macros, i.e.
will be imported by the menu function "File + Import macro".
In such case, any sketch in the last (possible single) branch of ST
will be considered as a collection (subset) of macro definitions.
A particular macro definition is represented as a branch of some
collection of macro definitions. In the following, a sample general
structure for representing a set of 7 macro definitions is given.
In this example, the set is split into 2 subsets.
ST - sketchy text containing macro definitions (an overview)
an arbitrary branch (optional), ignored while searching for macros
macro definitions (the last branch in ST)
. .
optional group of primitive heads, ignored while searching macros
. .
optional group of primitives, ignored while searching macros
macro collection (subset) I
. . .
optional group of primitive heads, ignored while searching
branch: macro definition 1
branch: macro definition 2
branch: macro definition 3
. .
optional group of primitives, ignored while searching for macros
macro collection (subset) II
. . .
optional group of primitive heads, ignored while searching
branch: macro definition 4
branch: macro definition 5
branch: macro definition 6
branch: macro definition 7
. .
optional group of primitives, ignored while searching for macros
Let B be a branch representing a macro definition. Then the comment
of branch B must start with corresponding macro command, and may be
suffixed by one or more spaces followed by macro comment.
The macro body (to be inserted when the macro is executed) is defined
as follows:
macro body
? head of B is not empty,
macro body = all primitive heads of branch B;
in this case the body of branch B is insignificant.
Hint (for developing of such macro definition): in this case, the
primitive heads form the macro body (to be inserted into any head);
therefore such macro definition should be assigned to base "None"
enabling to toggle through all primitive head types
<======
B is headless
? body of B is empty
macro body = ;
empty (nothing will be inserted)
<======
B is headless and its body is not empty
? body of B consists of a single primitive
? comment of B is empty (does not contain any charcter)
macro body = text of this single primitive
this is the case for inserting a character or group of characters
<======
B is headless and its body is not empty
and there are more than one member in body
or the single member is a sketch
or the single member is a primitive with comment
macro body = all members of branch B
Note. Search for macros proceeds downwards, so only the first
occurrence of macro definitions with the same command is available.
a sample set of macro definitions
German letters
a
A
o
O
u
U
text fragments
/ backslash in TeX
imp
cmn main sketchy text for canvas c
bz body size
l length()
primitives
Note that the single primitive (in sop) is commented (by a space)
sop print line
System.out.println(" " + );
fori i = 0, 1, . . .
* int i = 0; i < ; i++
forj j = 0, 1, . . .
* int j = 0; i < ; i++
structures
main
main
public static void main(String[] argv)
ife if . . . else . . .
me my excercises
Excercise nr.
import java.util.*;
class Excercise. . .
class Excercise. . .
static
static
Testing the methods above
public static void main(String[] argv)
how to use it
This set of macro definitions is located in the last branch.
So it is possible to test it as follows.
"File + Export plain HTML"
export this sketchy text
"File + Import macro"
import the sketchy text (just exported) as macro
After that, in any window, "Alt+command" excecutes the macro
command. For instance, "Alt+a" inserts "ä".