Ignore:
Timestamp:
Nov 15, 2024, 5:48:11 PM (10 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
e255902b
Parents:
2325b57
Message:

change how latex code generated from sharing-demo.cfa

Location:
doc/theses/mike_brooks_MMath/programs
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/programs/sharing-demo.cfa

    r2325b57 r489d3ba  
    55#define str(s) #s
    66
     7ofstream outfile;
     8
    79void demo1() {
    810        sout | sepOff;
    9         sout | "Consider two strings @s1@ and @s1a@ that are in an aliasing relationship, and a third, @s2@, made by a simple copy from @s1@.";
    10         sout | "\\par\\noindent";
    11         sout | "\\begin{tabular}{llll}";
    12         sout | "\t\t\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
     11//      sout | "Consider two strings @s1@ and @s1a@ that are in an aliasing relationship, and a third, @s2@, made by a simple copy from @s1@.";
    1312
    1413        #define S1 string s1  = "abc"
     
    2120        assert( s1a == "abc" );
    2221        assert( s2 == "abc" );
    23         sout | xstr(S1) | "\t\\\\";
    24         sout | xstr(S1A) | "\t\\\\";
    25         sout | xstr(S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
    26         sout | "\\end{tabular}";
    27         sout | "\\par\\noindent";
    28 
    29         sout | "Aliasing (@`shareEdits@) means that changes flow in both directions; with a simple copy, they do not.";
    30         sout | "\\par\\noindent";
    31         sout | "\\begin{tabular}{llll}";
    32         sout | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
    33         sout | "\t\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     22
     23        open( outfile, "build/sharing1.tex" );
     24        outfile | "\\begin{cquote}";
     25        outfile | "\\begin{tabular}{@{}llll@{}}";
     26        outfile | "\t\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
     27        outfile | xstr(S1) | "\t\\\\";
     28        outfile | xstr(S1A) | "\t\\\\";
     29        outfile | xstr(S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
     30        outfile | "\\end{tabular}";
     31        outfile | "\\end{cquote}";
     32        close( outfile );
     33
     34//      sout | "Aliasing (@`shareEdits@) means that changes flow in both directions; with a simple copy, they do not.";
     35        open( outfile, "build/sharing2.tex" );
     36        outfile | "\\begin{cquote}";
     37        outfile | "\\begin{tabular}{@{}llll@{}}";
     38        outfile | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
     39        outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    3440
    3541        #define S1s1 s1 [1] = '+'
    3642        S1s1;
    3743        assert( s1 == "a+c" );
    38         sout | xstr(S1s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     44        outfile | xstr(S1s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    3945
    4046        #define S1As1 s1a[1] = '-'
    4147        S1As1;
    4248        assert( s1a == "a-c" );
    43         sout | xstr(S1As1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     49        outfile | xstr(S1As1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    4450
    4551        #define S2s1 s2 [1] = '|'
    4652        S2s1;
    4753        assert( s2 == "a|c" );
    48         sout | xstr(S2s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
    49         sout | "\\end{tabular}";
    50         sout | "\\par\\noindent";
    51 
    52         sout | "Assignment of a value is just a modificiation."
    53                    "\nThe aliasing relationship is established at construction and is unaffected by assignment of a value.";
    54         sout | "\\par\\noindent";
    55         sout | "\\begin{tabular}{llll}";
    56         sout | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
    57         sout | "\t\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     54        outfile | xstr(S2s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
     55        outfile | "\\end{tabular}";
     56        outfile | "\\end{cquote}";
     57        close( outfile );
     58
     59//      sout | "Assignment of a value is just a modificiation."
     60//                 "\nThe aliasing relationship is established at construction and is unaffected by assignment of a value.";
     61        open( outfile, "build/sharing3.tex" );
     62        outfile | "\\begin{cquote}";
     63        outfile | "\\begin{tabular}{llll}";
     64        outfile | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
     65        outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    5866
    5967        #define S1qrs s1  = "qrs"
    6068        S1qrs;
    6169        assert( s1 == "qrs" );
    62         sout | xstr(S1qrs) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     70        outfile | xstr(S1qrs) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    6371
    6472        #define S1Atuv s1a = "tuv"
    6573        S1Atuv;
    6674        assert( s1a == "tuv" );
    67         sout | xstr(S1Atuv) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     75        outfile | xstr(S1Atuv) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    6876
    6977        #define S2wxy s2  = "wxy"
    7078        S2wxy;
    7179        assert( s2 == "wxy" );
    72         sout | xstr(S2wxy) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
    73         sout | "\\end{tabular}";
    74         sout | "\\par\\noindent";
    75 
    76         sout | "Assignment from a string is just assignment of a value."
    77                    "\nWhether of not the RHS participates in aliasing is irrelevant.  Any aliasing of the LHS is unaffected.";
    78         sout | "\\par\\noindent";
    79         sout | "\\begin{tabular}{llll}";
    80         sout | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
    81         sout | "\t\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     80        outfile | xstr(S2wxy) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2;
     81        outfile | "\\end{tabular}";
     82        outfile | "\\end{cquote}";
     83        close( outfile );
     84
     85//      sout | "Assignment from a string is just assignment of a value."
     86//                 "\nWhether of not the RHS participates in aliasing is irrelevant.  Any aliasing of the LHS is unaffected.";
     87        open( outfile, "build/sharing4.tex" );
     88        outfile | "\\begin{cquote}";
     89        outfile | "\\begin{tabular}{llll}";
     90        outfile | "\t\t& @s1@\t& @s1a@\t& @s2@\t\\\\";
     91        outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    8292
    8393        #define S1S2 s1  = s2
     
    8696        assert( s1a == "wxy" );
    8797        assert( s2 == "wxy" );
    88         sout | xstr(S1S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     98        outfile | xstr(S1S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    8999
    90100        #define S1aaa s1  = "aaa"
     
    93103        assert( s1a == "aaa" );
    94104        assert( s2 == "wxy" );
    95         sout | xstr(S1aaa) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     105        outfile | xstr(S1aaa) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    96106
    97107        #define S2S1 s2  = s1
     
    100110        assert( s1a == "aaa" );
    101111        assert( s2 == "aaa" );
    102         sout | xstr(S2S1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     112        outfile | xstr(S2S1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    103113
    104114        #define S2bbb s2  = "bbb"
     
    107117        assert( s1a == "aaa" );
    108118        assert( s2 == "bbb" );
    109         sout | xstr(S2bbb) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     119        outfile | xstr(S2bbb) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    110120
    111121        #define S2S1a s2  = s1a
     
    114124        assert( s1a == "aaa" );
    115125        assert( s2 == "aaa" );
    116         sout | xstr(S2S1a) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     126        outfile | xstr(S2S1a) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    117127
    118128        #define S2ccc s2  = "ccc"
     
    121131        assert( s1a == "aaa" );
    122132        assert( s2 == "ccc" );
    123         sout | xstr(S2ccc) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     133        outfile | xstr(S2ccc) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    124134
    125135        #define S1xxx s1  = "xxx"
     
    128138        assert( s1a == "xxx" );
    129139        assert( s2 == "ccc" );
    130         sout | xstr(S1xxx) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
    131         sout | "\\end{tabular}";
    132         sout | "\\par";
     140        outfile | xstr(S1xxx) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\";
     141        outfile | "\\end{tabular}";
     142        outfile | "\\end{cquote}";
     143        close( outfile );
    133144}
    134145
    135146
    136147void demo2() {
    137         sout | "Consider new strings @s1_mid@ being an alias for a run in the middle of @s1@, along with @s2@, made by a simple copy from the middle of @s1@.";
    138         sout | "\\par\\noindent";
    139         sout | "\\begin{tabular}{llll}";
    140         sout | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
     148//      sout | "Consider new strings @s1_mid@ being an alias for a run in the middle of @s1@, along with @s2@, made by a simple copy from the middle of @s1@.";
     149        open( outfile, "build/sharing5.tex" );
     150        outfile | "\\begin{cquote}";
     151        outfile | "\\begin{tabular}{llll}";
     152        outfile | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
    141153
    142154        #define D2_s1_abcd string s1     = "abcd"
    143155        D2_s1_abcd;
    144         sout | xstr(D2_s1_abcd) | "\t\\\\";
     156        outfile | xstr(D2_s1_abcd) | "\t\\\\";
    145157
    146158        #define D2_s1mid_s1 string s1_mid = s1(1,2)`shareEdits
    147159        D2_s1mid_s1;
    148         sout | xstr(D2_s1mid_s1) | "\t\\\\";
     160        outfile | xstr(D2_s1mid_s1) | "\t\\\\";
    149161
    150162        #define D2_s2_s1 string s2     = s1(1,2)
     
    153165        assert( s1_mid == "bc" );
    154166        assert( s2 == "bc" );
    155         sout | xstr(D2_s2_s1) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
    156         sout | "\\end{tabular}";
    157         sout | "\\par\\noindent";
    158 
    159         sout | "Again, @`shareEdits@ passes changes in both directions; copy does not.  Note the difference in index values, with the \\emph{b} position being 1 in the longer string and 0 in the shorter strings.  In the case of s1 aliasing with @s1_mid@, the very same character is being accessed by different postitions.";
    160         sout | "\\par\\noindent";
    161         sout | "\\begin{tabular}{llll}";
    162         sout | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
    163         sout | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
     167        outfile | xstr(D2_s2_s1) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
     168        outfile | "\\end{tabular}";
     169        outfile | "\\end{cquote}";
     170        close( outfile );
     171
     172//      sout | "Again, @`shareEdits@ passes changes in both directions; copy does not.  Note the difference in index values, with the \\emph{b} position being 1 in the longer string and 0 in the shorter strings.  In the case of s1 aliasing with @s1_mid@, the very same character is being accessed by different postitions.";
     173        open( outfile, "build/sharing6.tex" );
     174        outfile | "\\begin{cquote}";
     175        outfile | "\\begin{tabular}{llll}";
     176        outfile | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
     177        outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
    164178
    165179        #define D2_s1_plus s1    [1] = '+'
     
    168182        assert( s1_mid == "+c" );
    169183        assert( s2 == "bc" );
    170         sout | xstr(D2_s1_plus) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
     184        outfile | xstr(D2_s1_plus) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
    171185
    172186        #define D2_s1mid_minus s1_mid[0] = '-'
     
    175189        assert( s1_mid == "-c" );
    176190        assert( s2 == "bc" );
    177         sout | xstr(D2_s1mid_minus) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
     191        outfile | xstr(D2_s1mid_minus) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
    178192
    179193        #define D2_s2_pipe s2    [0] = '|'
     
    182196        assert( s1_mid == "-c" );
    183197        assert( s2 == "|c" );
    184         sout | xstr(D2_s2_pipe) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
    185         sout | "\\end{tabular}";
    186         sout | "\\par\\noindent";
    187 
    188         sout | "Once again, assignment of a value is a modificiation that flows through the aliasing relationship, without affecting its structure.";
    189         sout | "\\par\\noindent";
    190         sout | "\\begin{tabular}{llll}";
    191         sout | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
    192         sout | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
     198        outfile | xstr(D2_s2_pipe) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
     199        outfile | "\\end{tabular}";
     200        outfile | "\\end{cquote}";
     201        close( outfile );
     202
     203//      sout | "Once again, assignment of a value is a modificiation that flows through the aliasing relationship, without affecting its structure.";
     204        open( outfile, "build/sharing7.tex" );
     205        outfile | "\\begin{cquote}";
     206        outfile | "\\begin{tabular}{llll}";
     207        outfile | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\";
     208        outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
    193209
    194210        #define D2_s1mid_ff s1_mid = "ff"
     
    197213        assert( s1_mid == "ff" );
    198214        assert( s2 == "|c" );
    199         sout | xstr(D2_s1mid_ff) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
     215        outfile | xstr(D2_s1mid_ff) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
    200216
    201217        #define D2_s2_gg s2     = "gg"
     
    204220        assert( s1_mid == "ff" );
    205221        assert( s2 == "gg" );
    206         sout | xstr(D2_s2_gg) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
    207         sout | "\\end{tabular}";
    208         sout | "\\par\\noindent";
    209 
    210         sout | "In the \\emph{ff} step, which is a positive example of flow across an aliasing relationship, the result is straightforward to accept because the flow direction is from contained (small) to containing (large).  The following rules for edits through aliasing substrings will guide how to flow in the opposite direction.";
    211         sout | "\\par";
    212 
    213 
    214         sout | "Growth and shrinkage are natural extensions.  An empty substring is a real thing, at a well-defined location, whose meaning is extrapolated from the examples so far.  The intended metaphor is to operating a GUI text editor.  Having an aliasing substring is like using the mouse to select a few words.  Assigning onto an aliasign substring is like typing from having a few words selected:  depending how much you type, the file being edited can get shorter or longer.";
    215         sout | "\\par\\noindent";
    216         sout | "\\begin{tabular}{lll}";
    217         sout | "\t\t\t\t& @s1@\t& @s1_mid@\t\\\\";
    218         sout | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
     222        outfile | xstr(D2_s2_gg) | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\";
     223        outfile | "\\end{tabular}";
     224        outfile | "\\end{cquote}";
     225        close( outfile );
     226
     227//      sout | "In the \\emph{ff} step, which is a positive example of flow across an aliasing relationship, the result is straightforward to accept because the flow direction is from contained (small) to containing (large).  The following rules for edits through aliasing substrings will guide how to flow in the opposite direction.";
     228//      sout | "\\par";
     229
     230
     231//      sout | "Growth and shrinkage are natural extensions.  An empty substring is a real thing, at a well-defined location, whose meaning is extrapolated from the examples so far.  The intended metaphor is to operating a GUI text editor.  Having an aliasing substring is like using the mouse to select a few words.  Assigning onto an aliasign substring is like typing from having a few words selected:  depending how much you type, the file being edited can get shorter or longer.";
     232        open( outfile, "build/sharing8.tex" );
     233        outfile | "\\begin{cquote}";
     234        outfile | "\\begin{tabular}{lll}";
     235        outfile | "\t\t\t\t& @s1@\t& @s1_mid@\t\\\\";
     236        outfile | "\\multicolumn{1}{r}{initial} & " | s1 | "\t& " | s1_mid | "\t\\\\";
    219237
    220238        assert( s1 == "affd" );
    221239//      assert( s1_mid == "fc" );                                                                                                        // ????????? bug?
    222         sout | xstr(D2_s2_gg) | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
     240        outfile | xstr(D2_s2_gg) | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
    223241
    224242        #define D2_s1mid_hhhh s1_mid = "hhhh"
     
    226244        assert( s1 == "ahhhhd" );
    227245        assert( s1_mid == "hhhh" );
    228         sout  | xstr(D2_s1mid_hhhh)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
     246        outfile  | xstr(D2_s1mid_hhhh)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
    229247
    230248        #define D2_s1mid_i s1_mid = "i"
     
    232250        assert( s1 == "aid" );
    233251        assert( s1_mid == "i" );
    234         sout  | xstr(D2_s1mid_i)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
     252        outfile  | xstr(D2_s1mid_i)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
    235253
    236254        #define D2_s1mid_empty s1_mid = ""
     
    238256        assert( s1 == "ad" );
    239257        // assert( s1_mid == "" );    ------ Should be so, but fails
    240         sout  | xstr(D2_s1mid_empty)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
     258        outfile  | xstr(D2_s1mid_empty)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
    241259
    242260        #define D2_s1mid_jj s1_mid = "jj"
     
    244262        assert( s1 == "ajjd" );
    245263        assert( s1_mid == "jj" );
    246         sout  | xstr(D2_s1mid_jj)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
    247         sout | "\\end{tabular}";
    248         sout | "\\par\\noindent";
    249 
    250         sout | "Multiple portions can be aliased.  When there are several aliasing substrings at once, the text editor analogy becomes an online multi-user editor.  I should be able to edit a paragraph in one place (changing the document's length), without my edits affecting which letters are within a mouse-selection that you had made previously, somewhere else.";
    251         sout | "\\par\\noindent";
    252         sout | "\\begin{tabular}{lllll}";
    253         sout | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_mid@\t& @s1_end@\t\\\\";
     264        outfile  | xstr(D2_s1mid_jj)  | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\";
     265        outfile | "\\end{tabular}";
     266        outfile | "\\end{cquote}";
     267        close( outfile );
     268
     269//      sout | "Multiple portions can be aliased.  When there are several aliasing substrings at once, the text editor analogy becomes an online multi-user editor.  I should be able to edit a paragraph in one place (changing the document's length), without my edits affecting which letters are within a mouse-selection that you had made previously, somewhere else.";
     270        open( outfile, "build/sharing9.tex" );
     271        outfile | "\\begin{cquote}";
     272        outfile | "\\begin{tabular}{lllll}";
     273        outfile | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_mid@\t& @s1_end@\t\\\\";
    254274
    255275        #define D2_s1bgn_s1     string s1_bgn = s1(0, 1)`shareEdits
    256276        D2_s1bgn_s1;
    257         sout  | xstr(D2_s1bgn_s1)  | "\t\\\\";
     277        outfile  | xstr(D2_s1bgn_s1)  | "\t\\\\";
    258278
    259279        #define D2_s1end_s1 string s1_end = s1(3, 1)`shareEdits
     
    263283        assert( s1_mid == "jj" );
    264284        assert( s1_end == "d" );
    265         sout  | xstr(D2_s1end_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
     285        outfile  | xstr(D2_s1end_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
    266286
    267287        #define D1_s1bgn_zzz s1_bgn = "zzzz"
     
    271291        assert( s1_mid == "jj" );
    272292        assert( s1_end == "d" );
    273         sout  | xstr(D1_s1bgn_zzz)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
    274         sout | "\\end{tabular}";
    275         sout | "\\par\\noindent";
    276 
    277         sout | "When an edit happens on an aliasing substring that overlaps another, an effect is unavoidable.  Here, the passive party sees its selection shortened, to exclude the characters that were not part of the original selection.";
    278         sout | "\\par\\noindent";
    279         sout | "\\begin{tabular}{llllll}";
    280         sout | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_crs@\t& @s1_mid@\t& @s1_end@\t\\\\";
     293        outfile  | xstr(D1_s1bgn_zzz)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
     294        outfile | "\\end{tabular}";
     295        outfile | "\\end{cquote}";
     296        close( outfile );
     297
     298//      sout | "When an edit happens on an aliasing substring that overlaps another, an effect is unavoidable.  Here, the passive party sees its selection shortened, to exclude the characters that were not part of the original selection.";
     299        open( outfile, "build/sharing10.tex" );
     300        outfile | "\\begin{cquote}";
     301        outfile | "\\begin{tabular}{llllll}";
     302        outfile | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_crs@\t& @s1_mid@\t& @s1_end@\t\\\\";
    281303
    282304        #define D2_s1crs_s1 string s1_crs = s1(3, 2)`shareEdits
     
    287309        assert( s1_mid == "jj" );
    288310        assert( s1_end == "d" );
    289         sout  | xstr(D2_s1crs_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
     311        outfile  | xstr(D2_s1crs_s1)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
    290312
    291313        #define D2_s1crs_ppp s1_crs = "+++"
     
    296318        assert( s1_mid == "j" );
    297319        assert( s1_end == "d" );
    298         sout  | xstr(D2_s1crs_ppp)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
    299         sout | "\\end{tabular}";
    300         sout | "\\par\\noindent";
    301         sout | "TODO: finish typesetting the demo";
     320        outfile  | xstr(D2_s1crs_ppp)  | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\";
     321        outfile | "\\end{tabular}";
     322        outfile | "\\end{cquote}";
     323        close( outfile );
    302324
    303325        // "This shortening behaviour means that a modification has to occur entirely inside a substring, to show up in that substring.  Sharing changes through the intersection of partially overlapping aliases is still possible, so long as the receiver's boundary is not inside the edit."
     
    379401        demo1();
    380402        demo2();
    381         printf("%% %s done running\n", argv[0]);
     403//      printf("%% %s done running\n", argv[0]);
    382404}
Note: See TracChangeset for help on using the changeset viewer.