home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
wp
/
accent12.zip
/
ACCENT12.S
< prev
next >
Wrap
Text File
|
1993-06-15
|
5KB
|
159 lines
/**************** Foreign-Character Macros **************************
For TSE (The Semware Editor), pre-release version 1.0
Author: David Mayerovitch
macro version 1.0 07 June 1993
macro version 1.1 12 June 1993
- added Spanish, more French characters
- removed International
macro version 1.2 15 June 1993
- added Spanish ordinals
This pair of macros provides a quick and convenient way of entering
foreign-language and other special characters.
mSelectLanguage() presents a menu of languages or other
special-character sets for the user to choose from. I have assigned
this macro to <Alt `>.
mAccenter() enables the entry of the special characters belonging to
the selected set. I have assigned this macro to the key <`>. Call
this the trigger key.
These macros do what you do when writing foreign characters by hand:
first write the basic letterform, then add the diacritical mark.
Example: If the selected language is French and you want to enter
the character <é> (e with accent aigu): type the basic character
<e>, then press the trigger key. A pop-up menu appears:
┌──────────┐
│ Aigu é │
│ Grave è │
│ Circ ê │
│ Umlaut ë │
└──────────┘
The hotkeys A, G, C, and U generate the four possible e-based
accented characters in French. Press <A> and the <e> just
typed will be replaced with <é>.
When there is only one possible accented version of the character
just typed (e.g. ü in German), the macro automatically inserts it
without popping up a menu.
The macros as presented here offer the following character sets:
French: à â ç Ç é è ê ë É î ï ô ù û
German: ä Ä ö ü Ü
Spanish: á é í ó ú ñ Ñ ¿ ¡
Currency: c/C --> ¢ (cents) l/L --> £ (pounds) y/Y --> ¥ (yen)
French is the default: it is automatically selected when the macro
is loaded. Change the default by changing the global variable
Language (see macro source below).
You may easily edit the macros to provide any substitutions you
want. Strings as well as single characters may be substituted: the
string "integer" could be expanded from "i", or your name from your
initial. Modify the language menu to provide character sets of your
choice - math, Greek, graphics, and so on.
If you have occasional need for characters from different languages,
you might group them into a single International set rather than
switching languages. The tradeoff would be that you'd have fewer
automatic substitutions and more menu choices.
If a printable key such as <`> is chosen as the trigger for
mAccenter(), the Literal() command (assigned to <Ctrl P> in the
factory configuration of TSE) may be used whenever the character
itself is required in the text.
Comments and improvements are welcome.
********************************************************************/
// global variable:
integer language = 1 // French is default
// make it 3 and you have Spanish default
// LANGUAGE SELECTION ROUTINES:
menu langMenu()
history
"&French" "&German" "&Spanish"
"", , Divide "&Currency"
end
proc mSelectLanguage()
langMenu() language = MenuOption()
end
// CHARACTER SUBSTITUTION ROUTINES:
proc sub(string newstring)
// replaces current char by newstring, forcing insert.
DelChar() InsertText(newstring,_insert_)
end
menu FrenchAMenu()
"&Grave à", sub('à') "&Circ â", sub('â')
end
menu FrenchEMenu()
"&Aigu é", sub('é') "&Grave è", sub('è') "&Circ ê", sub('ê')
"&Umlaut ë", sub('ë')
end
menu FrenchIMenu()
"&Circ î", sub('î') "&Umlaut ï", sub('ï')
end
menu FrenchUMenu()
"&Grave ù" , sub('ù') "&Circ û", sub('û')
end
menu SpanishOMenu()
"&Accent ó", sub('ó') "&Ordinal º", sub('º')
end
menu SpanishAMenu()
"&Accent á", sub('á') "&Ordinal ª", sub('ª')
end
proc French()
case Chr(CurrChar())
when 'a' FrenchAMenu() when 'e' FrenchEMenu()
when 'i' FrenchIMenu() when 'u' FrenchUMenu()
when 'E' sub('É') when 'c' sub('ç') when 'C' sub('Ç')
when 'i' sub('î') when 'o' sub('ô')
otherwise Right() endcase
end
proc German()
case Chr(CurrChar())
when 'a' sub('ä') when 'A' sub('Ä') when 'o' sub('ö')
when 'O' sub('Ö') when 'u' sub('ü') when 'U' sub('Ü')
otherwise Right() endcase
end
proc Spanish()
case Chr(CurrChar())
when 'a' SpanishAMenu() when 'o' SpanishOMenu()
when 'e' sub('é') when 'i' sub('í')
when 'o' when 'u' sub('ú') when 'n' sub('ñ')
when 'N' sub('Ñ')
when '?' sub('¿') when '/' sub('¿') // unshifted ? key
when '!' sub('¡') when '1' sub('¡') // unshifted ! key
otherwise Right() endcase
end
proc Currency()
case UpCase(Chr(CurrChar()))
when 'C' sub('¢') // cents
when 'L' sub('£') // pounds
when 'Y' sub('¥') // yen
otherwise Right() endcase
end
proc mAccenter()
Left()
Case language
when 1 French() when 2 German() when 3 Spanish()
when 5 Currency()
endcase
end
<`> mAccenter()
<Alt `> mSelectLanguage()
/************************** End of macros **************************/