ZX-News #27
08 апреля 1997
  Софт  

Macros - Programming language MACROS-text editor, IS-Edit.

<b>Macros</b> - Programming language MACROS-text editor, IS-Edit.
                 MACROS



               (C) Yuri Buravtsov (OneSOFT)

                        812/01.14


          PROGRAMMING LANGUAGE

                  MACROS

       TEXT EDITOR iS-EDIT



  Many will agree with me that the editor
texts in the world's best operating system environment
for the Speccy is most convenient. Will not
enumerate all its merits, and the more defects, although their 
list is much easier. Editor is extremely easy for editing both 
large and small text. 


  But besides the obvious features editor, there is one, which 
is very little attention is paid and, therefore, about

there are very few performance
fortunate. This is a macro editor.


  The very concept of a macro or macro means that it is a 
sequence of characters that can be would enter from the 
keyboard, but instead , the sequence is entered by pressing two 
or three keys. It is stored in a file. With the technology 
itself to create and use macros in general, users may be 
familiar with communications program Macro-Modem. However, in 
the isdose it will be somewhat more difficult, but as a 
consequence, the spectrum of possibilities richer.



  So what is this mysterious macro iS-Editor? In principle, 
nothing special. Only here with his help You can use all 
features of a text editor, it is thus not touching the 
keyboard. True, before enjoy a lazy contemplation of the

macro, you have to create it. Issues and is dedicated to 
creating art. 


  The article is not for nothing called "programming language 
...". In fact make the car think - this is programming. Language

This smacks of some Assembler
only much simpler. Of course, in the case
Error machine does not hang, but the text may spoil. So, before 
you write macro, you should run it first on the

piece of paper, then, so to speak, and debug ottrassirovat 
manual input from the keyboard. With the arrival of sufficient 
experiences with the macros need for a piece of paper 
disappear. 


  The system iS-DOS on the work device in
the same directory with the editor, ie usually
EDIT \, there is such a file - ed4 (+). Ovr. This
overlay macros. There is another faylets -
ed_mac.txt, which themselves are chains and macros. While in 
the editor, you call this overlay is a combination of keys

Ext / Enter (for the keyboard driver from the family 
tt_ext.key), while the top lights up the word "MAC". Overlay 
loads memory file with macros, and waits

from you some keys to one of
which "suspended" a certain string.
This chain, for example, can do a search
and replacement of the text, format text
change the settings editor, draw
graphics and even change the color menyushek
editor.


  But! Before you start make those same chain, you need to have 
on hand at least some of the codes most often keystrokes and 
response to their depression. About it will inform you the 
following table: 


                                 Table 1

   Shortcut keys, codes, and the reaction

Code Combination Reaction

 04 CS / 3 (Inv) Ins / Ovr
 05 CS / 4 (True) Home
 06 CS / 2 (Caps) BIG / small
 07 CS / 1 (Edit) Lat / Eng
 08 CS / 5 (Left) Cursor left
 09 CS / 8 (Right) The cursor to the right
 0A CS / 6 (Down) Cursor down
 0B CS / 7 (Up) Cursor up
 0C CS / 0 (Del) BackSpace
 0D Enter LineFeed / EndOfInput
 0E Ext / Enter a Macro
 0F CS / 9 (Graph) End
 1910 SS / A (Stop) Escape / PageDown
 11 SS / Enter Call ed0 (+). Ovr
 12 SS / Space MainPrefix
 13 SS / W (Erase) Del right
 14 SS / E (Ins) Ins on the right
 15 SS / Q (PgUp) PageUp
 16 CS / Space
 17 CS / Enter Tabulation
 18 Ext / 5 The word left
 1A Ext / 7 allocation unit
 1B Ext / 8 On the right word
 20 Space Space ...



  If you forget the code of some key
you remind him programm
S: RES / KEY / ktest.com.


  I will not describe the "hot" keys
used in a variety of menu editor
you must be familiar with the HELP -
it's all about them in detail is painted. I just
cite a few examples of the use
macros in the preparation of network messages and
when responding to them.


  Suppose we need to send someone myltse, this will form the 
"cap" letters. Deploy the for this, for example, key

"H" - Head. You are one click you write the name of the aria, 
then the name of one of your favorite friends. Dessert - date 
and time - as long as will not touch, leave the final word.


hArea: # 0E

            launch overlay "the new"

          printing field arias

        call key

1PRIVATE # 0E!
2NETMAIL # 0E!
3SPBZXNET.GENERAL # 0E! List vozmozh4SPB.CODE # 0E! 
GOVERNMENTAL arias 5HARDWARE.ZX # 0E!

6SPB.SPECCY # 0E!

                 macro call! "

               the name of the aria

! # 0Dfrom: Vasya Pupkin # 0Dto: # 0E

                        sender's name

                        "Default"

                     "Newline"

xSanya Gubkin # 0E "
yKolya Shlupkin # 0E "mailing list
zFedya Glupkin # 0E "


  If necessary, we can add pointovye address.

"# 0Dsubj: I am in life is cool! # 0D # 0E @


  You can certainly enter sabzh like
enter the name of the aria and the recipient's name, for 
example: 

7Schas as a scare! .. # 0E @
8Para News' Abydno # 0E @

and so on.


  But back to AutoInput macro @:

@ # 0Ddate: D # 0Dtime: T # 0D # 0D # 0E $


  Here we have the date and time of conditional asked,
then to record them when entering oridzhina.


  After the last chain in the
displayed as follows:


Area: NETMAIL - we pressed "2"
from: Vasya Pupkin
to: Fedya Glupkin - we press "z"
subj: I am in life is cool!
date: D
time: T

_ - Cursor here



  The following macro avtovyzyvaetsya from the previous one. 
And now make sure these instructions: 

$ Hello, # 12 qqqqqduaaaaaau

                            copy

                           cursor down

                        recovery

                       deleting a row

                     cursor up

               combination SS / Space + Space


  The key combination SS / Space + Space - one of the key. She 
calls the main command menu (prefix), and then makes it active 
for as long as no "click" gap.



  Cursor up, we find ourselves in a box "to".
We do want to ask your friend
name, which can be obtained from the already finished "caps." 
How do we copy this name? You can use the block overlay, but 
the method presented here several beautiful. Delete a row, we 
pound her into buffer, from which it can be copied as many 
times. Here we would like copied it directly under the label 
"Hello,". Now remove all the excess:


# 05 # 1B # 1B # 1B # 12w # 18 # 08 # 120

                           Remove the left

                           of the cursor

                       retreat space

                    retreating word

                 delete everything after

                 Name

              step into the top names

       exit the command menu

     cursor to the beginning of the line


  After running the chain pointer
is in the beginning of a line that says "Fedya".
It remains only to insert the macro has
something:

# 0C # 0F!!! # 0D # 0D

    transfer "Fedya" at the end of "Hello,"


  So what happens on the screen:


time: T


  Hello, Fedya!!!

_ - Cursor here



  Now you and formed a "cap" letters.
Like it? Wait, then there will still be ...


  By the way, since version iS-DOS 4.0 in
macro, the opportunity to repeat
common code sequences. This is done by running:


   # R <repeat> <the length of the latter.> 


  For example, in the above chain
instead of "aaaaaa" can write "# R61a".
As you can see, the new form of writing
shorter than the original on a byte! And if so,
For example, such a sequence:


          $*%$*%$*%$*%$*%$*%$*%


  Element "$*%" occurs seven times, therefore, be the sequence
written as follows:


                 # R73 $ *%


  Gain - eighteen bytes.


  And now I will say one thing very necessary
condition for the correctness of the chain.
The fact that the old keyboard driver
have a buffer length of 32 bytes, and the new -
tt_x +. key - 64 bytes. If your chain is not
uladyvaetsya in the buffer, it can be divided into several 
parts of the size of the buffer length, while at the end of the 
previous chain put the sequence: # 0E <> symbol, and the 
following chain must begin with that letter. So

way, the macro calls itself. As a symbol it is desirable to use 
some non-Latin code; Latin codes are useful for us to start 
other conversations. 


  Another nuance. When you call a macro from
Ask yourself out of the prefixes, and then
resume again, because macro is called only when a "pure" when 
editing text. For example: 

 # 12 aqduaaqqaaqqawqaq # 0EYU

                            Call extension
                            tion of the chain

                        output of a prefix
U # 12 aqaqaqaqa

      resumption of the prefix


  Now suppose that we have made another all that
think of me:) and the letter remained only
decorate tearlaynom, yes oridzhinom. Let
this will make the macro name
"E" - End:

e # 05 --- iS-DOS v4.5 with the macro # 0D * Origi
n: Super Station (812/99.99) # 12t # 0D # 0B

                                 cursor

                                 Home

                                 File


  Remember, we have postponed at last enter date and time? It 
seems the time has come this do ...



  A few words on how to enter dates. From version
4.5 date by the team macro "D" without
parameters. Good thing, but its production has not been taken 
into account the possibility processing letters, so for us 
there is nedostatochek: for example, on May 9 this year it will 
be written like this: "09/05/1997". Then there is no "dash" and 
without additions zero. Therefore, creating a macro processing 
date: 

0 # W # 08 # 08 # 0C-# 08 # 08 # 0C-0 # 08 # 08 # 08 # 08 # 0C


  The date must be processed at the beginning of the text, 
because at the end of the macro is removal of excess, ie if the 
number We - the tenth, then our additional

zero is removed without any issues. By the way,
chain is shown for the period January -
September "and the chain for the period October - December" 
differs from the first absence of the two codes, that looks 
like this: 

0 # W # 08 # 08 # 0C-# 08 # 08 # 0C-# 08 # 08 # 08 # 0C


  Do not forget to put at the beginning of the chain
macro "# 12t # 0D # 0B". It forms an empty
line over the field "Area".


  KSAT, if the files have different chains, but under the same 
name, then performed the first Met. Such

property allows us to introduce our two "datnye" chain and the 
ability to swap them from time to time. Just think, two times a 
year! .. 


  Now we will move the date to its rightful
Place:

# 20 # 12 daaaaauq # 1B # 1B # 12w # 05 # 0A # 0C
# 0A # 12w # 1920


  And now the cursor is blinking in the "time",
prompting you to enter a time:


Area: NETMAIL
from: Vasya Pupkin
to: Fedya Glupkin
subj: I am in life is cool!
date: 09-05-97
time: _ - cursor here


  Hello, Fedya!!!


  No, well, you look out on the Subj ...

--- IS-DOS v4.5 with a macro
 * Origin: Super Station (812/99.99)



  That's all you can do "Dry exit".


  Now let's talk about the response to the letter.
Let us - the recipient, and we received it
letter. Above all, we swap the contents of the fields "from" 
and "to", then an introduction, background, quotas in 
necessary, and then respond oridzhinim. I call this chain of 
"j" - Joy ... ;) 

j # 12t # 0A # 1B # 1B # 12 w # R61au # 0F # 0D # 0D # 12 u
# R61quq # 1B # 1B # 12 wu # R52aau # R81q0 # 0C # 0B
# 120 # 0C # 12 aaaaduaaaauqqqqqduaaaaauaaa # 20


  After these actions happening on the screen
such a picture:


Area: NETMAIL
from: Fedya Glupkin
to: Vasya Pupkin
subj: I am in life is cool!
date: 09-05-97
time: 12:34

from: Vasya Pupkin

date: 09-05-97
time: 12:34
from: Vasya Pupkin
to: Fedya Glupkin


  Hello, Fedya!!!


  No, well, you look out on the Subj ...

--- IS-DOS v4.5 with a macro
 * Origin: Super Station (812/99.99)



  All this we nakopirovali for further
"Traditsionirovaniya" letters. Remove all
too much, leaving a blank space on the left:

# 05 # R66 # 1B # 1B # 08 # 120 # 0B # 0A # 1B # 1B # 12w


time: 12:34

 Vasya Pupkin

 09-05-97
 12:34
 Vasya Pupkin
 Fedya Glupkin


  Hello, Fedya!!!



  Now let's write a greeting and the background
(All as avtovyzovom macro):

# 05 Big friendly hello to you, # 0F!!! # 0D
# 0A "One day in the icy ..." numbers that way
# 0A # 05 # 0C # 0F exactly # 0A # 05 # 0C # 0F # 0A # 05 # 0C
# 1B # 1B # 1B # 12w wrote (a) to # 0A # 05 # 0C # 1B # 1B
# 1B # 12w # 0F: # 0A # 0A # 05


  That's what we have now got:


time: 12:34


  Big friendly hello to you, Vasya!!!


  "One day in the icy ..." numbers that way
04.05.1997 at exactly 12:34 Vasya Pupkin wrote (a) to Fedya 
Glupkin: 


  Hello, Fedya!!!



  Well, like all the "cap" and
"Posleshapochnym delirium."


  In this example, we meet the man who wrote to us, such a 
device - the exchange of places the contents of the fields 
"from" and "to" - allows you to save pointovy address, if

Of course, he was. But if you are involved in
echo-conference, and you decide to answer
a letter from one person to another, the field
"From" need to insert your name. Then
there can be done to separate the macro eh
with a special function.


  Now - kvoting. Principle kvotinga macro based on the premises 
at the beginning of quoted lines rare sequence of symbols, and 
when you enter oridzhina it is replaced by the initials of the 
sender: 

q # 05yY # 0A # 12T # 0Eq

                  loop

              test for empty string

        agree, a rare word ... :)


  This chain is a fragment of quotas
text to the first blank line or until you
do not press the space bar.


  However, this chain is not designed for auto-format text, and 
if the length of the quoted string exceeds the length specified 
in the settings editor, as well as mode "DOC", then the chain 
can get stuck at all: it "casts" line down, and then again goes 
to her. In this case, you are either configure the settings 
editor, or use the following instead of the previous chain: 

q # 05 # 0D # 0ByY # 05 # 0A # 0C # 0A # 12T # 0Eq


  This chain is running a bit slower than its first version, but
You can not climb into the parameters. By the way, slazit in 
options is very simple: 

# 12pr100 # 0D # 10

                "Push" SS / A

             "Push" Enter

         set equal to one hundred characters

        Hotkey right border

       enter the parameters


  Do not worry, that the letter was "spoiled"
input oridzhina will look like the most respectable manner.


  If we need to repeat the quote, then do this:

c # 05 # 12fM # 0C> # 0A>> # 0De # 0EC
C # 12f # 05nSe # 0A # 12T # 0EC


  The first chain initializes overlay
Search and loops to the second chain
a blank line.


  But here you are too lazy to quote all all
letter, especially if it has the same type character, then you 
remove part of the text and call the macro "s" - Skip:


s # 0D [skipped] # 0D


  Or something like that. Then, all as
typically, you write the answer and - here it is, with oridzhin 
tearlaynom: 

o # 12t # 12fM # 0C Origin: # 0Dne # 0B # 11mAADD


                                  removal

                    Search old oridzhina


  It was the removal of the old oridzhina with tearlaynom, and 
removed the first met and everything else before the end of the 
text. Convenient for removal cited oridzhinov letters coming 
from other networks. Length "before the end of the text" a 
number of characters "A", in our case - forty lines. But hardly 
on this indicator in the letters can anything be ... Removing 
we were doing irrevocable, ie, edit_aux.wet file is not created.



  We extend the macro:

# 05 Regards, Fedya. # 0D # 0D --- iS-DOS v
4.5 with macro # 0D * Origin: GigaStation (8
12/99.98) # 12 taaduqqu # 1B # 1B # 08 # 120 # 1B # 1B
# 0D # 09 # 12w # 0B # 09 # 12w # 05 # 0A # 0C


  Here we have created a temporary row
which formed the initials of the quoted. Now "zapihnem" them 
instead of this absurd "YY"-I:


# 12 tfM # 11> # 0AyY # 0D0, etd # 0D # 0B


  If you write in Fido, then you probably
will hold a "letter," H "-ization", ie
such an event, which will replace all
Russian letters "H" ("en") on the Latin "H"
("Al") to those not "flying". In our
If it is convenient to do so after printing oridzhina by 
searching with the replacement from end to beginning, because 
still later have to "jump" in the beginning. The chain looks 
like this: 

# 12 fM # 0CN # 0AH # 0D "

                    search and replace

                    from end to beginning

                Latin

            Russian


  Immediately after this call chain that,
which prints have oridzhin.


  It remains only to call a macro that
We head to date.


  That's all that can be a macro. Not so
little, right? In conclusion, I will give a couple of
Guidelines for their makrosnyh chains.


  1. Create the initial version on
paper. When you have a richer experience, the
the need for a piece of paper will disappear (though at
Assembler looks like?).


  2. What you have written down on paper, and ottrassiruyte 
otladte manually step by step, enter codes from the keyboard, 
of course:) 


  3. If the chain is made correctly and
more editing you do not intend,
then we can form three-character code # 
replace the physical single-byte code.
This is done either overlay ed6 (+). Ovr, either through 
demon.com. 


  4. Yuzayte iS-DOS! This is the best system for handling mail 
(and not just should be ... :)



        __________________________



              




Other articles:

Ot edition - A new newspaper in the BBS - XA-Xafon.

Lit.stranichka - Diary. Don loud. (Continued)

Macros - Programming language MACROS-text editor, IS-Edit.

Exchange of experience - Control characters and sequence of control characters in the standard printers Epson.

Ads - Advertisements and announcements ...

List BBS - A list of BBS. Opened a new Creative Station.



Similar articles:
what-where-how much - ppogpammy I ppibavilos pretty much ...
Zakroma homeland - Application of the newspaper.

В этот день...   21 November