Top Prev Next Up Down TEST
ExTau
An example of how the preprocessor changes code and what the change
looks like
001| with
Ada.Text_IO;
002| with Y2018.Text.Core; use
Y2018.Text.Core;
003| with Y2018.Text.Core.Str; use
Y2018.Text.Core.Str;
004| with Y2018.Text.Core.CVarPack; use
Y2018.Text.Core.CVarPack;
005| with Y2018.Text.Jets.MatchPack;
006| with Y2018.Text.Jets.PatternPack;
007| --with DSECT;
008| procedure ExTau is
009| __y:CVar;
010| __function h(s:CVar) return CVar
is
011| _____t:CFix:=""c & s;
012| _____r:CVar:=null_CVar;
013| __begin
014| _____for i in t'First(1) ..
t'Last(1) loop
015| ________r:=r & "_" &
CodePoint2Hex8CFix(t(i));
016| _____end loop;
017| _____return r;
018| __end h;
019| begin
020| __y:=null_CVar &"\a"c;
021| __Ada.Text_IO.Put_Line("a>"
& y & "<" & h(y) );
022| __y:=null_CVar &"\A"c;
023| __Ada.Text_IO.Put_Line("A>"
& y & "<" & h(y) );
024| __y:=null_CVar &"\b"c;
025| __Ada.Text_IO.Put_Line("b>"
& y & "<" & h(y) );
026| __y:=null_CVar &"\B"c;
027| __Ada.Text_IO.Put_Line("B>"
& y & "<" & h(y) );
028| __y:=null_CVar &"\c9"c;
029| __Ada.Text_IO.Put_Line("c>"
& y & "<" & h(y) );
030| __y:=null_CVar &"\d"c;
031| __Ada.Text_IO.Put_Line("d>"
& y & "<" & h(y) );
032| __y:=null_CVar &"\D"c;
033| __Ada.Text_IO.Put_Line("D>"
& y & "<" & h(y) );
034| __y:=null_CVar &"\e"c;
035| __Ada.Text_IO.Put_Line("e>"
& y & "<" & h(y) );
036| __y:=null_CVar &"\E"c;
037| __Ada.Text_IO.Put_Line("E>"
& y & "<" & h(y) );
038| __y:=null_CVar &"\f"c;
039| __Ada.Text_IO.Put_Line("f>"
& y & "<" & h(y) );
040| __y:=null_CVar &"\F"c;
041| __Ada.Text_IO.Put_Line("F>"
& y & "<" & h(y) );
042| __y:=null_CVar &"\g"c;
043| __Ada.Text_IO.Put_Line("g>"
& y & "<" & h(y) );
044| __y:=null_CVar &"\G"c;
045| __Ada.Text_IO.Put_Line("G>"
& y & "<" & h(y) );
046| __y:=null_CVar &"\h"c;
047| __Ada.Text_IO.Put_Line("h>"
& y & "<" & h(y) );
048| __y:=null_CVar &"\H"c;
049| __Ada.Text_IO.Put_Line("H>"
& y & "<" & h(y) );
050| __y:=null_CVar &"\k"c;
051| __Ada.Text_IO.Put_Line("k>"
& y & "<" & h(y) );
052| __y:=null_CVar &"\n"c;
053| __Ada.Text_IO.Put_Line("n>"
& y & "<" & h(y) );
054| __y:=null_CVar &"\N"c;
055| __Ada.Text_IO.Put_Line("N>"
& y & "<" & h(y) );
056| __y:=null_CVar &"\p{L}"c;
057| __Ada.Text_IO.Put_Line("p>"
& y & "<" & h(y) );
058| __y:=null_CVar &"\P{L}"c;
059| __Ada.Text_IO.Put_Line("P>"
& y & "<" & h(y) );
060| __y:=null_CVar &"\q"c;
061| __Ada.Text_IO.Put_Line("q>"
& y & "<" & h(y) );
062| __y:=null_CVar &"\Q"c;
063| __Ada.Text_IO.Put_Line("Q>"
& y & "<" & h(y) );
064| __y:=null_CVar &"\r"c; -- will
generate carrige return CR
065| __Ada.Text_IO.Put_Line("r>"
& y & "<" & h(y) );
066| __y:=null_CVar &"\R"c;
067| __Ada.Text_IO.Put_Line("R>"
& y & "<" & h(y) );
068| __y:=null_CVar &"\s"c;
069| __Ada.Text_IO.Put_Line("s>"
& y & "<" & h(y) );
070| __y:=null_CVar &"\S"c;
071| __Ada.Text_IO.Put_Line("S>"
& y & "<" & h(y) );
072| __y:=null_CVar &"\t"c;
073| __Ada.Text_IO.Put_Line("t>"
& y & "<" & h(y) );
074| __y:=null_CVar &"\T"c;
075| __Ada.Text_IO.Put_Line("T>"
& y & "<" & h(y) );
076| __y:=null_CVar &"\u2654"c; --
WHITE KING
077| __Ada.Text_IO.Put_Line("u>"
& y & "<" & h(y) );
078| __y:=null_CVar &"\U2654"c; --
WHITE KING
079| __Ada.Text_IO.Put_Line("U>"
& y & "<" & h(y) );
080| __y:=null_CVar &"\v002655"c;
-- WHITE QUEEN
081| __Ada.Text_IO.Put_Line("v>"
& y & "<" & h(y) );
082| __y:=null_CVar &"\V002655"c;
-- WHITE QUEEN
083| __Ada.Text_IO.Put_Line("V>"
& y & "<" & h(y) );
084| __y:=null_CVar &"\w"c;
085| __Ada.Text_IO.Put_Line("w>"
& y & "<" & h(y) );
086| __y:=null_CVar &"\W"c;
087| __Ada.Text_IO.Put_Line("W>"
& y & "<" & h(y) );
088| __y:=null_CVar &"\x3F"c; -- ?
question mark
089| __Ada.Text_IO.Put_Line("x>"
& y & "<" & h(y) );
090| __y:=null_CVar &"\X3F"c; -- ?
question mark
091| __Ada.Text_IO.Put_Line("X>"
& y & "<" & h(y) );
092| __y:=null_CVar &"\z"c;
093| __Ada.Text_IO.Put_Line("z>"
& y & "<" & h(y) );
094| __y:=null_CVar &"\Z"c;
095| __Ada.Text_IO.Put_Line("Z>"
& y & "<" & h(y) );
096| __y:=null_CVar &"\o123"c;
097| __Ada.Text_IO.Put_Line("o>"
& y & "<" & h(y) );
098| __y:=null_CVar &"\O123"c;
099| __Ada.Text_IO.Put_Line("O>"
& y & "<" & h(y) );
100| __y:=null_CVar &"\\\"c;
101|
__Ada.Text_IO.Put_Line("(backslash)>" & y & "<" &
h(y) );
102| end ExTau;
Result
Running export LD_LIBRARY_PATH=lib;bin/extau in TEST
directory.
Procedure CodePoint2Hex8CFix(t(i)) is
used for the translation to hexadecimal for every codepoint. Value
'_______5C' is hexadecimal for '\' (backslash).
001|
a>\a<_______5C_______61
002| A>\A<_______5C_______41
003| b><________8
004| B>\B<_______5C_______42
005|
c>\c9<_______5C_______63_______39
006| d>\d<_______5C_______64
007| D>\D<_______5C_______44
008| e>\e<_______5C_______65
009| E>\E<_______5C_______45
010| f><________C
011| F>\F<_______5C_______46
012| g>\g<_______5C_______67
013| G>\G<_______5C_______47
014| h>\h<_______5C_______68
015| H>\H<_______5C_______48
016| k>\k<_______5C_______6B
017| n>
018| <________A
019| N>\N<_______5C_______4E
020|
p>\p{L}<_______5C_______70_______7B_______4C_______7D
021|
P>\P{L}<_______5C_______50_______7B_______4C_______7D
022| q>\q<_______5C_______71
023| Q>\Q<_______5C_______51
024| r>
<________D
025| R>\R<_______5C_______52
026| s>\s<_______5C_______73
027| S>\S<_______5C_______53
028| t> <________9
029| T>\T<_______5C_______54
030| u>♔<_____2654
031|
U>\U2654<_______5C_______55_______32_______36_______35_______34
032|
v>♕<_____2655
033|
V>\V002655<_______5C_______56_______30_______30_______32_______36_______35_______35
034| w>\w<_______5C_______77
035| W>\W<_______5C_______57
036| x>?<_______3F
037|
X>\X3F<_______5C_______58_______33_______46
038| z>\z<_______5C_______7A
039| Z>\Z<_______5C_______5A
040|
o>\o123<_______5C_______6F_______31_______32_______33
041|
O>\O123<_______5C_______4F_______31_______32_______33
042| (backslash)>\\<_______5C_______5C
Rows in red:
003 : backspace
010 : form feed
017 and 018
: line feed (test on a Linux platform)
024 : cariage return
030 : hexadecimal value of WHITE KING
032 : hexadecimal value of WHITE QUEEN
036 : hexadecimal value of question
mark
042 : three backslashes changes to two,
first two is a backslash pair and the third is not folled by one of
the reserved characters
This test also shows that one backslash can be used as is if it
is not folled by any of characters 'b', 'f', 'n', 'r', 'u', 'v',
'x' and '\'.