Changeset 489d3ba for doc/theses/mike_brooks_MMath/programs
- Timestamp:
- Nov 15, 2024, 5:48:11 PM (10 months ago)
- Branches:
- master
- Children:
- e255902b
- Parents:
- 2325b57
- 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 5 5 #define str(s) #s 6 6 7 ofstream outfile; 8 7 9 void demo1() { 8 10 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@."; 13 12 14 13 #define S1 string s1 = "abc" … … 21 20 assert( s1a == "abc" ); 22 21 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\\\\"; 34 40 35 41 #define S1s1 s1 [1] = '+' 36 42 S1s1; 37 43 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\\\\"; 39 45 40 46 #define S1As1 s1a[1] = '-' 41 47 S1As1; 42 48 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\\\\"; 44 50 45 51 #define S2s1 s2 [1] = '|' 46 52 S2s1; 47 53 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\\\\"; 58 66 59 67 #define S1qrs s1 = "qrs" 60 68 S1qrs; 61 69 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\\\\"; 63 71 64 72 #define S1Atuv s1a = "tuv" 65 73 S1Atuv; 66 74 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\\\\"; 68 76 69 77 #define S2wxy s2 = "wxy" 70 78 S2wxy; 71 79 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\\\\"; 82 92 83 93 #define S1S2 s1 = s2 … … 86 96 assert( s1a == "wxy" ); 87 97 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\\\\"; 89 99 90 100 #define S1aaa s1 = "aaa" … … 93 103 assert( s1a == "aaa" ); 94 104 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\\\\"; 96 106 97 107 #define S2S1 s2 = s1 … … 100 110 assert( s1a == "aaa" ); 101 111 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\\\\"; 103 113 104 114 #define S2bbb s2 = "bbb" … … 107 117 assert( s1a == "aaa" ); 108 118 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\\\\"; 110 120 111 121 #define S2S1a s2 = s1a … … 114 124 assert( s1a == "aaa" ); 115 125 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\\\\"; 117 127 118 128 #define S2ccc s2 = "ccc" … … 121 131 assert( s1a == "aaa" ); 122 132 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\\\\"; 124 134 125 135 #define S1xxx s1 = "xxx" … … 128 138 assert( s1a == "xxx" ); 129 139 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 ); 133 144 } 134 145 135 146 136 147 void 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\\\\"; 141 153 142 154 #define D2_s1_abcd string s1 = "abcd" 143 155 D2_s1_abcd; 144 sout| xstr(D2_s1_abcd) | "\t\\\\";156 outfile | xstr(D2_s1_abcd) | "\t\\\\"; 145 157 146 158 #define D2_s1mid_s1 string s1_mid = s1(1,2)`shareEdits 147 159 D2_s1mid_s1; 148 sout| xstr(D2_s1mid_s1) | "\t\\\\";160 outfile | xstr(D2_s1mid_s1) | "\t\\\\"; 149 161 150 162 #define D2_s2_s1 string s2 = s1(1,2) … … 153 165 assert( s1_mid == "bc" ); 154 166 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\\\\"; 164 178 165 179 #define D2_s1_plus s1 [1] = '+' … … 168 182 assert( s1_mid == "+c" ); 169 183 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\\\\"; 171 185 172 186 #define D2_s1mid_minus s1_mid[0] = '-' … … 175 189 assert( s1_mid == "-c" ); 176 190 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\\\\"; 178 192 179 193 #define D2_s2_pipe s2 [0] = '|' … … 182 196 assert( s1_mid == "-c" ); 183 197 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\\\\"; 193 209 194 210 #define D2_s1mid_ff s1_mid = "ff" … … 197 213 assert( s1_mid == "ff" ); 198 214 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\\\\"; 200 216 201 217 #define D2_s2_gg s2 = "gg" … … 204 220 assert( s1_mid == "ff" ); 205 221 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\\\\"; 219 237 220 238 assert( s1 == "affd" ); 221 239 // 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\\\\"; 223 241 224 242 #define D2_s1mid_hhhh s1_mid = "hhhh" … … 226 244 assert( s1 == "ahhhhd" ); 227 245 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\\\\"; 229 247 230 248 #define D2_s1mid_i s1_mid = "i" … … 232 250 assert( s1 == "aid" ); 233 251 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\\\\"; 235 253 236 254 #define D2_s1mid_empty s1_mid = "" … … 238 256 assert( s1 == "ad" ); 239 257 // 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\\\\"; 241 259 242 260 #define D2_s1mid_jj s1_mid = "jj" … … 244 262 assert( s1 == "ajjd" ); 245 263 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\\\\"; 254 274 255 275 #define D2_s1bgn_s1 string s1_bgn = s1(0, 1)`shareEdits 256 276 D2_s1bgn_s1; 257 sout| xstr(D2_s1bgn_s1) | "\t\\\\";277 outfile | xstr(D2_s1bgn_s1) | "\t\\\\"; 258 278 259 279 #define D2_s1end_s1 string s1_end = s1(3, 1)`shareEdits … … 263 283 assert( s1_mid == "jj" ); 264 284 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\\\\"; 266 286 267 287 #define D1_s1bgn_zzz s1_bgn = "zzzz" … … 271 291 assert( s1_mid == "jj" ); 272 292 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\\\\"; 281 303 282 304 #define D2_s1crs_s1 string s1_crs = s1(3, 2)`shareEdits … … 287 309 assert( s1_mid == "jj" ); 288 310 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\\\\"; 290 312 291 313 #define D2_s1crs_ppp s1_crs = "+++" … … 296 318 assert( s1_mid == "j" ); 297 319 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 ); 302 324 303 325 // "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." … … 379 401 demo1(); 380 402 demo2(); 381 printf("%% %s done running\n", argv[0]);403 // printf("%% %s done running\n", argv[0]); 382 404 }
Note:
See TracChangeset
for help on using the changeset viewer.