- Timestamp:
- Mar 10, 2024, 11:21:18 AM (3 months ago)
- Branches:
- master
- Children:
- 9398177
- Parents:
- b64d0f4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/programs/sharing-demo.cfa
rb64d0f4 r5546f50b 37 37 assert( s1 == "a+c" ); 38 38 sout | xstr(S1s1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; 39 39 40 40 #define S1As1 s1a[1] = '-' 41 41 S1As1; 42 42 assert( s1a == "a-c" ); 43 43 sout | xstr(S1As1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; 44 44 45 45 #define S2s1 s2 [1] = '|' 46 46 S2s1; … … 49 49 sout | "\\end{tabular}"; 50 50 sout | "\\par\\noindent"; 51 51 52 52 sout | "Assignment of a value is just a modificiation." 53 53 "\nThe aliasing relationship is established at construction and is unaffected by assignment of a value."; … … 61 61 assert( s1 == "qrs" ); 62 62 sout | xstr(S1qrs) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; 63 63 64 64 #define S1Atuv s1a = "tuv" 65 65 S1Atuv; 66 66 assert( s1a == "tuv" ); 67 67 sout | xstr(S1Atuv) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; 68 68 69 69 #define S2wxy s2 = "wxy" 70 70 S2wxy; … … 87 87 assert( s2 == "wxy" ); 88 88 sout | xstr(S1S2) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; 89 89 90 90 #define S1aaa s1 = "aaa" 91 91 S1aaa; … … 94 94 assert( s2 == "wxy" ); 95 95 sout | xstr(S1aaa) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; 96 96 97 97 #define S2S1 s2 = s1 98 98 S2S1; … … 101 101 assert( s2 == "aaa" ); 102 102 sout | xstr(S2S1) | "\t& " | s1 | "\t& " | s1a | "\t& " | s2 | "\t\\\\"; 103 103 104 104 #define S2bbb s2 = "bbb" 105 105 S2bbb; … … 191 191 sout | "\t\t\t\t& @s1@\t& @s1_mid@\t& @s2@\t\\\\"; 192 192 sout | "\t& " | s1 | "\t& " | s1_mid | "\t& " | s2 | "\t\\\\"; 193 193 194 194 #define D2_s1mid_ff s1_mid = "ff" 195 195 D2_s1mid_ff; … … 207 207 sout | "\\end{tabular}"; 208 208 sout | "\\par\\noindent"; 209 209 210 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 211 sout | "\\par"; … … 233 233 assert( s1_mid == "i" ); 234 234 sout | xstr(D2_s1mid_i) | "\t& " | s1 | "\t& " | s1_mid | "\t\\\\"; 235 235 236 236 #define D2_s1mid_empty s1_mid = "" 237 237 D2_s1mid_empty; … … 247 247 sout | "\\end{tabular}"; 248 248 sout | "\\par\\noindent"; 249 249 250 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 251 sout | "\\par\\noindent"; … … 279 279 sout | "\\begin{tabular}{llllll}"; 280 280 sout | "\t\t\t\t& @s1@\t& @s1_bgn@\t& @s1_crs@\t& @s1_mid@\t& @s1_end@\t\\\\"; 281 281 282 282 #define D2_s1crs_s1 string s1_crs = s1(3, 2)`shareEdits 283 283 D2_s1crs_s1; … … 288 288 assert( s1_end == "d" ); 289 289 sout | xstr(D2_s1crs_s1) | "\t& " | s1 | "\t& " | s1_bgn | "\t& " | s1_crs | "\t& " | s1_mid | "\t& " | s1_end | "\t\\\\"; 290 290 291 291 #define D2_s1crs_ppp s1_crs = "+++" 292 292 D2_s1crs_ppp; … … 316 316 317 317 // "The extreme form of this shortening happens when a bystander alias is a proper substring of an edit. The bystander becomes an empty substring." 318 318 319 319 string all = "They said hello again"; 320 320 string greet = all(10,5)`shareEdits; … … 327 327 assert( greet_end == "o" ); 328 328 329 329 330 330 greet = "sup"; 331 331 assert( all == "They said sup again" ); … … 334 334 // assert( greet_end == "" ); 335 335 336 336 337 337 338 338 … … 342 342 343 343 344 344 345 345 greet_bgn = "what"; 346 346 … … 353 353 // assert( greet_end == "" ); ------ Should be so, but fails 354 354 355 355 356 356 greet_end = "..."; 357 357 … … 365 365 assert( greet_end == "..." ); 366 366 367 367 368 368 369 369
Note: See TracChangeset
for help on using the changeset viewer.