From aaa2e0f39c08a94ce64b5b316e7dac4d4d6df00d Mon Sep 17 00:00:00 2001 From: VictorMiasnikov Date: Thu, 22 Sep 2022 14:15:44 +0300 Subject: [PATCH] Examples of using cp866 code page and utf-8 Examples of using cp866 code page and utf-8 --- examples/hellocp866/src/Hellocp866.m3 | 142 +++++++++ examples/hellocp866/src/m3makefile | 28 ++ examples/helloutf8/src/Helloutf8.m3 | 403 ++++++++++++++++++++++++++ examples/helloutf8/src/m3makefile | 28 ++ 4 files changed, 601 insertions(+) create mode 100644 examples/hellocp866/src/Hellocp866.m3 create mode 100644 examples/hellocp866/src/m3makefile create mode 100644 examples/helloutf8/src/Helloutf8.m3 create mode 100644 examples/helloutf8/src/m3makefile diff --git a/examples/hellocp866/src/Hellocp866.m3 b/examples/hellocp866/src/Hellocp866.m3 new file mode 100644 index 0000000000..cfb2ee5cf8 --- /dev/null +++ b/examples/hellocp866/src/Hellocp866.m3 @@ -0,0 +1,142 @@ + + +MODULE Hellocp866 EXPORTS Main; +(* Each module must have a name, which is declared in the "MODULE" + statement. By convention, the main module for an executable + program exports the interface "Main", as does the "Hello" module here. + + Each module can also import interfaces exported by other modules. + This is how you reuse code from libraries or your own modules. + Here, we have imported interface "IO" which is a simple + input/output interface. + + From the browser, you can learn what the imported interfaces do + by following the link associated with their name. *) + +IMPORT IO; + +(* The main body of a module or the initialization section includes + statements that are executed at the begining of the program. + In this case, we are the main module, and all we do is print + "Hello World!" on standard output. + + Demo of using: + +D:\cm3\src\examples\hellocp866>chcp 866 +Active code page: 866 + +D:\cm3\src\examples\hellocp866>.\AMD64_NT\hellocp866.exe + +-? . ! +-? . 㦤 業 墮! +-? . 㦤 業 墮! + + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + --> + +Box drawing alignment tests: + ~ + ͻ Ŀ ~~ ~~ ~~~~~~~ ~~~~ ~ ~ ~~~ ~ ~ ~~~~~~~ + Ŀ ͻ ͸ ~ķ ~~Ŀ~ ~~~~ ~~~~~~~ ~~~ ~ ~~~~~~~ + ~ ~ ~ ~ ~ ~ ~~~~ ~ ~ ~~~ ~ ~~~~~~~ + ̵ ~ ƹ ö Ǵ Ŵ ~״ ~~~~~~ ~~~~ ~~ ~ ~~~~ ~ ~ ~~~~~~~ + ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ + ٺ ͼ ; ~Ľ ~~~ ~ ~ ~ ~ ~ ~ ~ + ͼ ~~ ~~ ~~~~~~~ ~~ ~ ~~~~ ~ ~~~~~~ + + +D:\cm3\src\examples\hellocp866> +*) + +BEGIN + + IO.Put (" \n"); + IO.Put ("-? . !\n"); + IO.Put ("-? . 㦤 業 墮!\n"); + IO.Put ("-? . 㦤 業 墮!\n"); + IO.Put (" \n"); + + + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + IO.PutChar(''); IO.Put (" "); IO.PutChar(''); IO.Put ("-->"); IO.PutChar(W''); IO.Put (" "); IO.PutChar(W''); IO.Put ("\n"); + + IO.Put (" \n"); + IO.Put ("Box drawing alignment tests: \n"); + IO.Put (" ~ \n"); + IO.Put (" ͻ Ŀ ~~ ~~ ~~~~~~~ ~~~~ ~ ~ ~~~ ~ ~ ~~~~~~~\n"); + IO.Put (" Ŀ ͻ ͸ ~ķ ~~Ŀ~ ~~~~ ~~~~~~~ ~~~ ~ ~~~~~~~\n"); + IO.Put (" ~ ~ ~ ~ ~ ~ ~~~~ ~ ~ ~~~ ~ ~~~~~~~\n"); + IO.Put (" ̵ ~ ƹ ö Ǵ Ŵ ~״ ~~~~~~ ~~~~ ~~ ~ ~~~~ ~ ~ ~~~~~~~\n"); + IO.Put (" ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ \n"); + IO.Put (" ٺ ͼ ; ~Ľ ~~~ ~ ~ ~ ~ ~ ~ ~ \n"); + IO.Put (" ͼ ~~ ~~ ~~~~~~~ ~~ ~ ~~~~ ~ ~~~~~~\n"); + IO.Put (" \n"); + +END Hellocp866. + +(* Don't forget to include the module name in the last "END" in your + program. *) + + \ No newline at end of file diff --git a/examples/hellocp866/src/m3makefile b/examples/hellocp866/src/m3makefile new file mode 100644 index 0000000000..c9f39d5729 --- /dev/null +++ b/examples/hellocp866/src/m3makefile @@ -0,0 +1,28 @@ + +% Each package contains an m3makefile which describes +% the components of a package and how it should be +% built. + +% It turns out that this program is simple enough +% that you don't need an m3makefile. If you run +% cm3 in the directory, even if you didn't have +% an m3makefile, it'd figure out what it has to do. +% So, this file is here for pedgagogical reasons. + +% To build most programs, you first have to +% install the standard Modula-3 libraries. + +import ("libm3") + +% An implementation is a module that doesn't export +% an interface under its name. + +implementation ("Hellocp866") + +% Each package can have a README file or an index.html which +% will be viewable from CM3_IDE user interface. This is very +% handy for external documentation. You don't have to +% include the external documentation as part of the package. + +program ("hellocp866") + diff --git a/examples/helloutf8/src/Helloutf8.m3 b/examples/helloutf8/src/Helloutf8.m3 new file mode 100644 index 0000000000..8d795656bc --- /dev/null +++ b/examples/helloutf8/src/Helloutf8.m3 @@ -0,0 +1,403 @@ + + +MODULE Helloutf8 EXPORTS Main; +(* Each module must have a name, which is declared in the "MODULE" + statement. By convention, the main module for an executable + program exports the interface "Main", as does the "Hello" module here. + + Each module can also import interfaces exported by other modules. + This is how you reuse code from libraries or your own modules. + Here, we have imported interface "IO" which is a simple + input/output interface. + + From the browser, you can learn what the imported interfaces do + by following the link associated with their name. *) + +IMPORT IO; + +(* The main body of a module or the initialization section includes + statements that are executed at the begining of the program. + In this case, we are the main module, and all we do is print + "Hello World!" on standard output. + + Demo of using: +D:\cm3\src\examples\helloutf8>chcp 65001 +Active code page: 65001 + +D:\cm3\src\examples\helloutf8>.\AMD64_NT\helloutf8.exe +ЭКС-ГРАФ? ПЛЮШ ИЗЪЯТ. БЬЁМ ЧУЖДЫЙ ЦЕН ХВОЩ! +Экс-граф? Плюш изъят. Бьём чуждый цен хвощ! +экс-граф? плюш изъят. бьём чуждый цен хвощ! + +*) + +BEGIN + IO.Put ("ЭКС-ГРАФ? ПЛЮШ ИЗЪЯТ. БЬЁМ ЧУЖДЫЙ ЦЕН ХВОЩ!\n"); + IO.Put ("Экс-граф? Плюш изъят. Бьём чуждый цен хвощ!\n"); + IO.Put ("экс-граф? плюш изъят. бьём чуждый цен хвощ!\n"); + + IO.Put (" \n"); + IO.Put ("https://github.com/dse/font-testing-resources/commit/7071b33fbeb693fe0b238b201054e4f3b538d67c \n"); + IO.Put ("https://github.com/dse/font-testing-resources/tree/7071b33fbeb693fe0b238b201054e4f3b538d67c \n"); + IO.Put ("[ \n"); + IO.Put ("https://github.com/dse/font-testing-resources/archive/7071b33fbeb693fe0b238b201054e4f3b538d67c.zip \n"); + IO.Put ("] \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put ("words.txt \n"); + IO.Put ("{{ \n"); + IO.Put ("## The Weird Words and Phrases Designers Use to Test Their Fonts (Wired, 2017-05-18) \n"); + IO.Put (" \n"); + IO.Put ("Xiïte \n"); + IO.Put ("HAMBURGEFONTSIV \n"); + IO.Put ("zwykły #look at Polish letters \n"); + IO.Put ("minimom \n"); + IO.Put ("Högertrafikomläggningen \n"); + IO.Put ("Handgloves \n"); + IO.Put ("WAVERLY HAWAIIAN HAVANA PLYWOOD \n"); + IO.Put ("Château d’Yquem \n"); + IO.Put ("VANWAYMAN \n"); + IO.Put ("difficult waffles \n"); + IO.Put ("HOEFLER \n"); + IO.Put ("}} \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put ("digits.txt \n"); + IO.Put ("{{ \n"); + IO.Put ("0000000 000102030405060708090 \n"); + IO.Put ("1111111 101112131415161718191 \n"); + IO.Put ("2222222 202122232425262728292 \n"); + IO.Put ("3333333 303132333435363738393 \n"); + IO.Put ("4444444 404142434445464748494 \n"); + IO.Put ("5555555 505152535455565758595 \n"); + IO.Put ("6666666 606162636465666768696 \n"); + IO.Put ("7777777 707172737475767778797 \n"); + IO.Put ("8888888 808182838485868788898 \n"); + IO.Put ("9999999 909192939495969798999 \n"); + IO.Put (" \n"); + IO.Put ("(1)(2)(3)(4)(5)(6)(7)(8)(9)(0) \n"); + IO.Put (" \n"); + IO.Put ("$00 $10 $20 $30 $40 $50 $60 $70 $80 $90 \n"); + IO.Put (" \n"); + IO.Put ("£00 £10 £20 £30 £40 £50 £60 £70 £80 £90 \n"); + IO.Put (" \n"); + IO.Put ("00¢ 11¢ 22¢ 33¢ 44¢ 55¢ 66¢ 77¢ 88¢ 99¢ \n"); + IO.Put (" \n"); + IO.Put ("€00 €10 €20 €30 €40 €50 €60 €70 €80 €90 \n"); + IO.Put (" \n"); + IO.Put ("00% 0‰ 0-0.0,0…0° \n"); + IO.Put ("11% 1‰ 1-1.1,1…1° \n"); + IO.Put ("12% 2‰ 2-2.2,2…2° \n"); + IO.Put ("13% 3‰ 3-3.3,3…3° \n"); + IO.Put ("14% 4‰ 4-4.4,4…4° \n"); + IO.Put ("15% 5‰ 5-5.5,5…5° \n"); + IO.Put ("16% 6‰ 6-6.6,6…6° \n"); + IO.Put ("17% 7‰ 7-7.7,7…7° \n"); + IO.Put ("18% 8‰ 8-8.8,8…8° \n"); + IO.Put ("19% 9‰ 9-9.9,9…9° \n"); + IO.Put ("}} \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put ("polish-alphabet.txt \n"); + IO.Put ("{{ \n"); + IO.Put ("A a \n"); + IO.Put ("Ą ą \n"); + IO.Put ("B b \n"); + IO.Put ("C c \n"); + IO.Put ("Ć ć \n"); + IO.Put ("D d \n"); + IO.Put ("E e \n"); + IO.Put ("Ę ę \n"); + IO.Put ("F f \n"); + IO.Put ("G g \n"); + IO.Put ("H h \n"); + IO.Put ("I i \n"); + IO.Put ("J j \n"); + IO.Put ("K k \n"); + IO.Put ("L l \n"); + IO.Put ("Ł ł \n"); + IO.Put ("M m \n"); + IO.Put ("N n \n"); + IO.Put ("Ń ń \n"); + IO.Put ("O o \n"); + IO.Put ("Ó ó \n"); + IO.Put ("P p \n"); + IO.Put ("R r \n"); + IO.Put ("S s \n"); + IO.Put ("Ś ś \n"); + IO.Put ("T t \n"); + IO.Put ("U u \n"); + IO.Put ("W w \n"); + IO.Put ("Y y \n"); + IO.Put ("Z z \n"); + IO.Put ("Ź ź \n"); + IO.Put ("Ż ż \n"); + IO.Put ("}} \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put ("А а \n"); + IO.Put ("Б б \n"); + IO.Put ("В в \n"); + IO.Put ("Г г \n"); + IO.Put ("Д д \n"); + IO.Put ("Е е \n"); + IO.Put ("Ё ё \n"); + IO.Put ("Ж ж \n"); + IO.Put ("З з \n"); + IO.Put ("И и \n"); + IO.Put ("Й й \n"); + IO.Put ("К к \n"); + IO.Put ("Л л \n"); + IO.Put ("М м \n"); + IO.Put ("Н н \n"); + IO.Put ("О о \n"); + IO.Put ("П п \n"); + IO.Put ("Р р \n"); + IO.Put ("С с \n"); + IO.Put ("Т т \n"); + IO.Put ("У у \n"); + IO.Put ("Ф ф \n"); + IO.Put ("Х х \n"); + IO.Put ("Ц ц \n"); + IO.Put ("Ч ч \n"); + IO.Put ("Ш ш \n"); + IO.Put ("Щ щ \n"); + IO.Put ("Ъ ъ \n"); + IO.Put ("Ы ы \n"); + IO.Put ("Ь ь \n"); + IO.Put ("Э э \n"); + IO.Put ("Ю ю \n"); + IO.Put ("Я я \n"); + IO.Put (" \n"); + IO.Put ("В ЧАЩАХ ЮГА ЖИЛ БЫ ЦИТРУС? ДА, НО ФАЛЬШИВЫЙ ЭКЗЕМПЛЯР! \n"); + IO.Put ("ЭХ, ЧУЖАК, ОБЩИЙ СЪЁМ ЦЕН ШЛЯП (ЮФТЬ) – ВДРЫЗГ! \n"); + IO.Put ("ЛЮБЯ, СЪЕШЬ ЩИПЦЫ, — ВЗДОХНЁТ МЭР, — КАЙФ ЖГУЧ! \n"); + IO.Put ("РАЗЪЯРЕННЫЙ ЧТЕЦ ЭГОИСТИЧНО БЬЁТ ПЯТЬЮ ЖЕРДЯМИ ШУСТРОГО ФЕХТОВАЛЬЩИКА. \n"); + IO.Put ("НАШ БАНК ВЧЕРА ЖЕ ВЫПЛАТИЛ Ф.Я. ЭЙХГОЛЬДУ КОМИССИЮ ЗА ЦЕННЫЕ ВЕЩИ. \n"); + IO.Put (" \n"); + IO.Put ("В чащах юга жил бы цитрус? Да, но фальшивый экземпляр! \n"); + IO.Put ("Эх, чужак, общий съём цен шляп (юфть) – вдрызг! \n"); + IO.Put ("Любя, съешь щипцы, — вздохнёт мэр, — Кайф жгуч! \n"); + IO.Put ("Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. \n"); + IO.Put ("Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. \n"); + IO.Put ("}} \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put ("utf-8-test.txt \n"); + IO.Put ("{{ \n"); + IO.Put ("Original by Markus Kuhn, adapted for HTML by Martin Dürst. \n"); + IO.Put (" \n"); + IO.Put ("UTF-8 encoded sample plain-text file \n"); + IO.Put ("‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ \n"); + IO.Put (" \n"); + IO.Put ("Markus Kuhn [ˈmaʳkʊs kuːn] — 1999-08-20 \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put ("The ASCII compatible UTF-8 encoding of ISO 10646 and Unicode \n"); + IO.Put ("plain-text files is defined in RFC 2279 and in ISO 10646-1 Annex R. \n"); + IO.Put (" \n"); + IO.Put (" \n"); + IO.Put ("Using Unicode/UTF-8, you can write in emails and source code things such as \n"); + IO.Put (" \n"); + IO.Put ("Mathematics and Sciences: \n"); + IO.Put (" \n"); + IO.Put (" ∮ E⋅da = Q, n → ∞, ∑ f(i) = ∏ g(i), ∀x∈ℝ: ⌈x⌉ = −⌊−x⌋, α ∧ ¬β = ¬(¬α ∨ β), \n"); + IO.Put (" \n"); + IO.Put (" ℕ ⊆ ℕ₀ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ, ⊥ < a ≠ b ≡ c ≤ d ≪ ⊤ ⇒ (A ⇔ B), \n"); + IO.Put (" \n"); + IO.Put (" 2H₂ + O₂ ⇌ 2H₂O, R = 4.7 kΩ, ⌀ 200 mm \n"); + IO.Put (" \n"); + IO.Put ("Linguistics and dictionaries: \n"); + IO.Put (" \n"); + IO.Put (" ði ıntəˈnæʃənəl fəˈnɛtık əsoʊsiˈeıʃn \n"); + IO.Put (" Y [ˈʏpsilɔn], Yen [jɛn], Yoga [ˈjoːgɑ] \n"); + IO.Put (" \n"); + IO.Put ("APL: \n"); + IO.Put (" \n"); + IO.Put (" ((V⍳V)=⍳⍴V)/V←,V ⌷←⍳→⍴∆∇⊃‾⍎⍕⌈ \n"); + IO.Put (" \n"); + IO.Put ("Nicer typography in plain text files: \n"); + IO.Put (" \n"); + IO.Put (" ╔══════════════════════════════════════════╗ \n"); + IO.Put (" ║ ║ \n"); + IO.Put (" ║ • ‘single’ and “double” quotes ║ \n"); + IO.Put (" ║ ║ \n"); + IO.Put (" ║ • Curly apostrophes: “We’ve been here” ║ \n"); + IO.Put (" ║ ║ \n"); + IO.Put (" ║ • Latin-1 apostrophe and accents: `´` ║ \n"); + IO.Put (" ║ ║ \n"); + IO.Put (" ║ • ‚deutsche‘ „Anführungszeichen“ ║ \n"); + IO.Put (" ║ ║ \n"); + IO.Put (" ║ • †, ‡, ‰, •, 3–4, —, −5/+5, ™, … ║ \n"); + IO.Put (" ║ ║ \n"); + IO.Put (" ║ • ASCII safety test: 1lI|, 0OD, 8B ║ \n"); + IO.Put (" ║ ╭─────────╮ ║ \n"); + IO.Put (" ║ • the euro symbol: │ 14.95 € │ ║ \n"); + IO.Put (" ║ ╰─────────╯ ║ \n"); + IO.Put (" ╚══════════════════════════════════════════╝ \n"); + IO.Put (" \n"); + IO.Put ("Greek (in Polytonic): \n"); + IO.Put (" \n"); + IO.Put (" The Greek anthem: \n"); + IO.Put (" \n"); + IO.Put (" Σὲ γνωρίζω ἀπὸ τὴν κόψη \n"); + IO.Put (" τοῦ σπαθιοῦ τὴν τρομερή, \n"); + IO.Put (" σὲ γνωρίζω ἀπὸ τὴν ὄψη \n"); + IO.Put (" ποὺ μὲ βία μετράει τὴ γῆ. \n"); + IO.Put (" \n"); + IO.Put (" ᾿Απ᾿ τὰ κόκκαλα βγαλμένη \n"); + IO.Put (" τῶν ῾Ελλήνων τὰ ἱερά \n"); + IO.Put (" καὶ σὰν πρῶτα ἀνδρειωμένη \n"); + IO.Put (" χαῖρε, ὦ χαῖρε, ᾿Ελευθεριά! \n"); + IO.Put (" \n"); + IO.Put (" From a speech of Demosthenes in the 4th century BC: \n"); + IO.Put (" \n"); + IO.Put (" Οὐχὶ ταὐτὰ παρίσταταί μοι γιγνώσκειν, ὦ ἄνδρες ᾿Αθηναῖοι, \n"); + IO.Put (" ὅταν τ᾿ εἰς τὰ πράγματα ἀποβλέψω καὶ ὅταν πρὸς τοὺς \n"); + IO.Put (" λόγους οὓς ἀκούω· τοὺς μὲν γὰρ λόγους περὶ τοῦ \n"); + IO.Put (" τιμωρήσασθαι Φίλιππον ὁρῶ γιγνομένους, τὰ δὲ πράγματ᾿ \n"); + IO.Put (" εἰς τοῦτο προήκοντα, ὥσθ᾿ ὅπως μὴ πεισόμεθ᾿ αὐτοὶ \n"); + IO.Put (" πρότερον κακῶς σκέψασθαι δέον. οὐδέν οὖν ἄλλο μοι δοκοῦσιν \n"); + IO.Put (" οἱ τὰ τοιαῦτα λέγοντες ἢ τὴν ὑπόθεσιν, περὶ ἧς βουλεύεσθαι, \n"); + IO.Put (" οὐχὶ τὴν οὖσαν παριστάντες ὑμῖν ἁμαρτάνειν. ἐγὼ δέ, ὅτι μέν \n"); + IO.Put (" ποτ᾿ ἐξῆν τῇ πόλει καὶ τὰ αὑτῆς ἔχειν ἀσφαλῶς καὶ Φίλιππον \n"); + IO.Put (" τιμωρήσασθαι, καὶ μάλ᾿ ἀκριβῶς οἶδα· ἐπ᾿ ἐμοῦ γάρ, οὐ πάλαι \n"); + IO.Put (" γέγονεν ταῦτ᾿ ἀμφότερα· νῦν μέντοι πέπεισμαι τοῦθ᾿ ἱκανὸν \n"); + IO.Put (" προλαβεῖν ἡμῖν εἶναι τὴν πρώτην, ὅπως τοὺς συμμάχους \n"); + IO.Put (" σώσομεν. ἐὰν γὰρ τοῦτο βεβαίως ὑπάρξῃ, τότε καὶ περὶ τοῦ \n"); + IO.Put (" τίνα τιμωρήσεταί τις καὶ ὃν τρόπον ἐξέσται σκοπεῖν· πρὶν δὲ \n"); + IO.Put (" τὴν ἀρχὴν ὀρθῶς ὑποθέσθαι, μάταιον ἡγοῦμαι περὶ τῆς \n"); + IO.Put (" τελευτῆς ὁντινοῦν ποιεῖσθαι λόγον. \n"); + IO.Put (" \n"); + IO.Put (" Δημοσθένους, Γ´ ᾿Ολυνθιακὸς \n"); + IO.Put (" \n"); + IO.Put ("Georgian: \n"); + IO.Put (" \n"); + IO.Put (" From a Unicode conference invitation: \n"); + IO.Put (" \n"); + IO.Put (" გთხოვთ ახლავე გაიაროთ რეგისტრაცია Unicode-ის მეათე საერთაშორისო \n"); + IO.Put (" კონფერენციაზე დასასწრებად, რომელიც გაიმართება 10-12 მარტს, \n"); + IO.Put (" ქ. მაინცში, გერმანიაში. კონფერენცია შეჰკრებს ერთად მსოფლიოს \n"); + IO.Put (" ექსპერტებს ისეთ დარგებში როგორიცაა ინტერნეტი და Unicode-ი, \n"); + IO.Put (" ინტერნაციონალიზაცია და ლოკალიზაცია, Unicode-ის გამოყენება \n"); + IO.Put (" ოპერაციულ სისტემებსა, და გამოყენებით პროგრამებში, შრიფტებში, \n"); + IO.Put (" ტექსტების დამუშავებასა და მრავალენოვან კომპიუტერულ სისტემებში. \n"); + IO.Put (" \n"); + IO.Put ("Russian: \n"); + IO.Put (" \n"); + IO.Put (" From a Unicode conference invitation: \n"); + IO.Put (" \n"); + IO.Put (" Зарегистрируйтесь сейчас на Десятую Международную Конференцию по \n"); + IO.Put (" Unicode, которая состоится 10-12 марта 1997 года в Майнце в Германии. \n"); + IO.Put (" Конференция соберет широкий круг экспертов по вопросам глобального \n"); + IO.Put (" Интернета и Unicode, локализации и интернационализации, воплощению и \n"); + IO.Put (" применению Unicode в различных операционных системах и программных \n"); + IO.Put (" приложениях, шрифтах, верстке и многоязычных компьютерных системах. \n"); + IO.Put (" \n"); + IO.Put ("Thai (UCS Level 2): \n"); + IO.Put (" \n"); + IO.Put (" Excerpt from a poetry on The Romance of The Three Kingdoms (a Chinese \n"); + IO.Put (" classic `San Gua`): \n"); + IO.Put (" \n"); + IO.Put (" [----------------------------|------------------------] \n"); + IO.Put (" ๏ แผ่นดินฮั่นเสื่อมโทรมแสนสังเวช พระปกเกศกองบู๊กู้ขึ้นใหม่ \n"); + IO.Put (" สิบสองกษัตริย์ก่อนหน้าแลถัดไป สององค์ไซร้โง่เขลาเบาปัญญา \n"); + IO.Put (" ทรงนับถือขันทีเป็นที่พึ่ง บ้านเมืองจึงวิปริตเป็นนักหนา \n"); + IO.Put (" โฮจิ๋นเรียกทัพทั่วหัวเมืองมา หมายจะฆ่ามดชั่วตัวสำคัญ \n"); + IO.Put (" เหมือนขับไสไล่เสือจากเคหา รับหมาป่าเข้ามาเลยอาสัญ \n"); + IO.Put (" ฝ่ายอ้องอุ้นยุแยกให้แตกกัน ใช้สาวนั้นเป็นชนวนชื่นชวนใจ \n"); + IO.Put (" พลันลิฉุยกุยกีกลับก่อเหตุ ช่างอาเพศจริงหนาฟ้าร้องไห้ \n"); + IO.Put (" ต้องรบราฆ่าฟันจนบรรลัย ฤๅหาใครค้ำชูกู้บรรลังก์ ฯ \n"); + IO.Put (" \n"); + IO.Put (" (The above is a two-column text. If combining characters are handled \n"); + IO.Put (" correctly, the lines of the second column should be aligned with the \n"); + IO.Put (" | character above.) \n"); + IO.Put (" \n"); + IO.Put ("Ethiopian: \n"); + IO.Put (" \n"); + IO.Put (" Proverbs in the Amharic language: \n"); + IO.Put (" \n"); + IO.Put (" ሰማይ አይታረስ ንጉሥ አይከሰስ። \n"); + IO.Put (" ብላ ካለኝ እንደአባቴ በቆመጠኝ። \n"); + IO.Put (" ጌጥ ያለቤቱ ቁምጥና ነው። \n"); + IO.Put (" ደሀ በሕልሙ ቅቤ ባይጠጣ ንጣት በገደለው። \n"); + IO.Put (" የአፍ ወለምታ በቅቤ አይታሽም። \n"); + IO.Put (" አይጥ በበላ ዳዋ ተመታ። \n"); + IO.Put (" ሲተረጉሙ ይደረግሙ። \n"); + IO.Put (" ቀስ በቀስ፥ ዕንቁላል በእግሩ ይሄዳል። \n"); + IO.Put (" ድር ቢያብር አንበሳ ያስር። \n"); + IO.Put (" ሰው እንደቤቱ እንጅ እንደ ጉረቤቱ አይተዳደርም። \n"); + IO.Put (" እግዜር የከፈተውን ጉሮሮ ሳይዘጋው አይድርም። \n"); + IO.Put (" የጎረቤት ሌባ፥ ቢያዩት ይስቅ ባያዩት ያጠልቅ። \n"); + IO.Put (" ሥራ ከመፍታት ልጄን ላፋታት። \n"); + IO.Put (" ዓባይ ማደሪያ የለው፥ ግንድ ይዞ ይዞራል። \n"); + IO.Put (" የእስላም አገሩ መካ የአሞራ አገሩ ዋርካ። \n"); + IO.Put (" ተንጋሎ ቢተፉ ተመልሶ ባፉ። \n"); + IO.Put (" ወዳጅህ ማር ቢሆን ጨርስህ አትላሰው። \n"); + IO.Put (" እግርህን በፍራሽህ ልክ ዘርጋ። \n"); + IO.Put (" \n"); + IO.Put ("Runes: \n"); + IO.Put (" \n"); + IO.Put (" ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ \n"); + IO.Put (" \n"); + IO.Put (" (Old English, which transcribed into Latin reads `He cwaeth that he \n"); + IO.Put (" bude thaem lande northweardum with tha Westsae.` and means `He said \n"); + IO.Put (" that he lived in the northern land near the Western Sea.`) \n"); + IO.Put (" \n"); + IO.Put ("Braille: \n"); + IO.Put (" \n"); + IO.Put (" ⡌⠁⠧⠑ ⠼⠁⠒ ⡍⠜⠇⠑⠹⠰⠎ ⡣⠕⠌ \n"); + IO.Put (" \n"); + IO.Put (" ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠙⠑⠁⠙⠒ ⠞⠕ ⠃⠑⠛⠔ ⠺⠊⠹⠲ ⡹⠻⠑ ⠊⠎ ⠝⠕ ⠙⠳⠃⠞ \n"); + IO.Put (" ⠱⠁⠞⠑⠧⠻ ⠁⠃⠳⠞ ⠹⠁⠞⠲ ⡹⠑ ⠗⠑⠛⠊⠌⠻ ⠕⠋ ⠙⠊⠎ ⠃⠥⠗⠊⠁⠇ ⠺⠁⠎ \n"); + IO.Put (" ⠎⠊⠛⠝⠫ ⠃⠹ ⠹⠑ ⠊⠇⠻⠛⠹⠍⠁⠝⠂ ⠹⠑ ⠊⠇⠻⠅⠂ ⠹⠑ ⠥⠝⠙⠻⠞⠁⠅⠻⠂ \n"); + IO.Put (" ⠁⠝⠙ ⠹⠑ ⠡⠊⠑⠋ ⠍⠳⠗⠝⠻⠲ ⡎⠊⠗⠕⠕⠛⠑ ⠎⠊⠛⠝⠫ ⠊⠞⠲ ⡁⠝⠙ \n"); + IO.Put (" ⡎⠊⠗⠕⠕⠛⠑⠰⠎ ⠝⠁⠍⠑ ⠺⠁⠎ ⠛⠕⠕⠙ ⠥⠏⠕⠝ ⠰⡡⠁⠝⠛⠑⠂ ⠋⠕⠗ ⠁⠝⠹⠹⠔⠛ ⠙⠑ \n"); + IO.Put (" ⠡⠕⠎⠑ ⠞⠕ ⠏⠥⠞ ⠙⠊⠎ ⠙⠁⠝⠙ ⠞⠕⠲ \n"); + IO.Put (" \n"); + IO.Put (" ⡕⠇⠙ ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ \n"); + IO.Put (" \n"); + IO.Put (" ⡍⠔⠙⠖ ⡊ ⠙⠕⠝⠰⠞ ⠍⠑⠁⠝ ⠞⠕ ⠎⠁⠹ ⠹⠁⠞ ⡊ ⠅⠝⠪⠂ ⠕⠋ ⠍⠹ \n"); + IO.Put (" ⠪⠝ ⠅⠝⠪⠇⠫⠛⠑⠂ ⠱⠁⠞ ⠹⠻⠑ ⠊⠎ ⠏⠜⠞⠊⠊⠥⠇⠜⠇⠹ ⠙⠑⠁⠙ ⠁⠃⠳⠞ \n"); + IO.Put (" ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ ⡊ ⠍⠊⠣⠞ ⠙⠁⠧⠑ ⠃⠑⠲ ⠔⠊⠇⠔⠫⠂ ⠍⠹⠎⠑⠇⠋⠂ ⠞⠕ \n"); + IO.Put (" ⠗⠑⠛⠜⠙ ⠁ ⠊⠕⠋⠋⠔⠤⠝⠁⠊⠇ ⠁⠎ ⠹⠑ ⠙⠑⠁⠙⠑⠌ ⠏⠊⠑⠊⠑ ⠕⠋ ⠊⠗⠕⠝⠍⠕⠝⠛⠻⠹ \n"); + IO.Put (" ⠔ ⠹⠑ ⠞⠗⠁⠙⠑⠲ ⡃⠥⠞ ⠹⠑ ⠺⠊⠎⠙⠕⠍ ⠕⠋ ⠳⠗ ⠁⠝⠊⠑⠌⠕⠗⠎ \n"); + IO.Put (" ⠊⠎ ⠔ ⠹⠑ ⠎⠊⠍⠊⠇⠑⠆ ⠁⠝⠙ ⠍⠹ ⠥⠝⠙⠁⠇⠇⠪⠫ ⠙⠁⠝⠙⠎ \n"); + IO.Put (" ⠩⠁⠇⠇ ⠝⠕⠞ ⠙⠊⠌⠥⠗⠃ ⠊⠞⠂ ⠕⠗ ⠹⠑ ⡊⠳⠝⠞⠗⠹⠰⠎ ⠙⠕⠝⠑ ⠋⠕⠗⠲ ⡹⠳ \n"); + IO.Put (" ⠺⠊⠇⠇ ⠹⠻⠑⠋⠕⠗⠑ ⠏⠻⠍⠊⠞ ⠍⠑ ⠞⠕ ⠗⠑⠏⠑⠁⠞⠂ ⠑⠍⠏⠙⠁⠞⠊⠊⠁⠇⠇⠹⠂ ⠹⠁⠞ \n"); + IO.Put (" ⡍⠜⠇⠑⠹ ⠺⠁⠎ ⠁⠎ ⠙⠑⠁⠙ ⠁⠎ ⠁ ⠙⠕⠕⠗⠤⠝⠁⠊⠇⠲ \n"); + IO.Put (" \n"); + IO.Put (" (The first couple of paragraphs of {A Christmas Carol} by Dickens) \n"); + IO.Put (" \n"); + IO.Put ("Compact font selection example text: \n"); + IO.Put (" \n"); + IO.Put (" ABCDEFGHIJKLMNOPQRSTUVWXYZ /0123456789 \n"); + IO.Put (" abcdefghijklmnopqrstuvwxyz £©µÀÆÖÞßéöÿ \n"); + IO.Put (" –—‘“”„†•…‰™œŠŸž€ ΑΒΓΔΩαβγδω АБВГДабвгд \n"); + IO.Put (" ∀∂∈ℝ∧∪≡∞ ↑↗↨↻⇣ ┐┼╔╘░►☺♀ fi�⑀₂ἠḂӥẄɐː⍎אԱა \n"); + IO.Put (" \n"); + IO.Put ("Greetings in various languages: \n"); + IO.Put (" \n"); + IO.Put (" Hello world, Καλημέρα κόσμε, コンニチハ \n"); + IO.Put (" \n"); + IO.Put ("Box drawing alignment tests: █ \n"); + IO.Put (" ▉ \n"); + IO.Put (" ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳ \n"); + IO.Put (" ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳ \n"); + IO.Put (" ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳ \n"); + IO.Put (" ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳ \n"); + IO.Put (" ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎ \n"); + IO.Put (" ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏ \n"); + IO.Put (" ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█ \n"); + IO.Put (" \n"); + IO.Put ("}} \n"); + +END Helloutf8. + +(* Don't forget to include the module name in the last "END" in your + program. *) diff --git a/examples/helloutf8/src/m3makefile b/examples/helloutf8/src/m3makefile new file mode 100644 index 0000000000..46d5e0f4fe --- /dev/null +++ b/examples/helloutf8/src/m3makefile @@ -0,0 +1,28 @@ + +% Each package contains an m3makefile which describes +% the components of a package and how it should be +% built. + +% It turns out that this program is simple enough +% that you don't need an m3makefile. If you run +% cm3 in the directory, even if you didn't have +% an m3makefile, it'd figure out what it has to do. +% So, this file is here for pedgagogical reasons. + +% To build most programs, you first have to +% install the standard Modula-3 libraries. + +import ("libm3") + +% An implementation is a module that doesn't export +% an interface under its name. + +implementation ("Helloutf8") + +% Each package can have a README file or an index.html which +% will be viewable from CM3_IDE user interface. This is very +% handy for external documentation. You don't have to +% include the external documentation as part of the package. + +program ("helloutf8") +