From 9e751bb8c0cdf771d34c839cb6591d892b8e62de Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 7 Mar 2017 01:41:48 -0800 Subject: 3761 --- html/088file.mu.html | 139 ++++++++++++++++++++++++++------------------------- 1 file changed, 70 insertions(+), 69 deletions(-) (limited to 'html/088file.mu.html') diff --git a/html/088file.mu.html b/html/088file.mu.html index 6025332d..30eaf372 100644 --- a/html/088file.mu.html +++ b/html/088file.mu.html @@ -15,14 +15,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color a { text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } -.muData { color: #ffff00; } -.muControl { color: #c0a020; } +.muRecipe { color: #ff8700; } .Special { color: #c00000; } +.Conceal { color: #4e4e4e; } .Delimiter { color: #800080; } .Comment { color: #9090ff; } .Constant { color: #00a0a0; } .LineNr { color: #444444; } -.muRecipe { color: #ff8700; } +.muControl { color: #c0a020; } +.muData { color: #ffff00; } --> @@ -82,10 +83,10 @@ if ('onhashchange' in window) { 23 load-ingredients 24 error? <- copy 0/false 25 { - 26 break-unless resources - 27 # fake file system - 28 contents, error? <- start-reading-from-fake-resource resources, filename - 29 return + 26 ¦ break-unless resources + 27 ¦ # fake file system + 28 ¦ contents, error? <- start-reading-from-fake-resource resources, filename + 29 ¦ return 30 } 31 # real file system 32 file:num <- $open-file-for-reading filename @@ -101,10 +102,10 @@ if ('onhashchange' in window) { 42 return-if error?, 0/contents 43 buf:&:buffer <- new-buffer 30/capacity 44 { - 45 c:char, done?:bool, source <- read source - 46 break-if done? - 47 buf <- append buf, c - 48 loop + 45 ¦ c:char, done?:bool, source <- read source + 46 ¦ break-if done? + 47 ¦ buf <- append buf, c + 48 ¦ loop 49 } 50 contents <- buffer-to-array buf 51 ] @@ -117,17 +118,17 @@ if ('onhashchange' in window) { 58 data:&:@:resource <- get *resources, data:offset 59 len:num <- length *data 60 { - 61 done?:bool <- greater-or-equal i, len - 62 break-if done? - 63 tmp:resource <- index *data, i - 64 i <- add i, 1 - 65 curr-resource:text <- get tmp, name:offset - 66 found?:bool <- equal resource, curr-resource - 67 loop-unless found? - 68 contents:&:source:char, sink:&:sink:char <- new-channel 30 - 69 curr-contents:text <- get tmp, contents:offset - 70 start-running receive-from-text curr-contents, sink - 71 return + 61 ¦ done?:bool <- greater-or-equal i, len + 62 ¦ break-if done? + 63 ¦ tmp:resource <- index *data, i + 64 ¦ i <- add i, 1 + 65 ¦ curr-resource:text <- get tmp, name:offset + 66 ¦ found?:bool <- equal resource, curr-resource + 67 ¦ loop-unless found? + 68 ¦ contents:&:source:char, sink:&:sink:char <- new-channel 30 + 69 ¦ curr-contents:text <- get tmp, contents:offset + 70 ¦ start-running receive-from-text curr-contents, sink + 71 ¦ return 72 } 73 return 0/not-found, 1/error 74 ] @@ -136,10 +137,10 @@ if ('onhashchange' in window) { 77 local-scope 78 load-ingredients 79 { - 80 c:char, eof?:bool <- $read-from-file file - 81 break-if eof? - 82 sink <- write sink, c - 83 loop + 80 ¦ c:char, eof?:bool <- $read-from-file file + 81 ¦ break-if eof? + 82 ¦ sink <- write sink, c + 83 ¦ loop 84 } 85 sink <- close sink 86 file <- $close-file file @@ -151,12 +152,12 @@ if ('onhashchange' in window) { 92 i:num <- copy 0 93 len:num <- length *contents 94 { - 95 done?:bool <- greater-or-equal i, len - 96 break-if done? - 97 c:char <- index *contents, i - 98 sink <- write sink, c - 99 i <- add i, 1 -100 loop + 95 ¦ done?:bool <- greater-or-equal i, len + 96 ¦ break-if done? + 97 ¦ c:char <- index *contents, i + 98 ¦ sink <- write sink, c + 99 ¦ i <- add i, 1 +100 ¦ loop 101 } 102 sink <- close sink 103 ] @@ -167,18 +168,18 @@ if ('onhashchange' in window) { 108 error? <- copy 0/false 109 source:&:source:char, sink:&:sink:char <- new-channel 30 110 { -111 break-unless resources -112 # fake file system -113 routine-id <- start-running transmit-to-fake-resource resources, filename, source -114 return +111 ¦ break-unless resources +112 ¦ # fake file system +113 ¦ routine-id <- start-running transmit-to-fake-resource resources, filename, source +114 ¦ return 115 } 116 # real file system 117 file:num <- $open-file-for-writing filename 118 return-unless file, 0/sink, 0/routine-id, 1/error? 119 { -120 break-if file -121 msg:text <- append [no such file: ] filename -122 assert file, msg +120 ¦ break-if file +121 ¦ msg:text <- append [no such file: ] filename +122 ¦ assert file, msg 123 } 124 routine-id <- start-running transmit-to-file file, source 125 ] @@ -193,12 +194,12 @@ if ('onhashchange' in window) { 134 i:num <- copy 0 135 len:num <- length *contents 136 { -137 done?:bool <- greater-or-equal i, len -138 break-if done? -139 c:char <- index *contents, i -140 sink-file <- write sink-file, c -141 i <- add i, 1 -142 loop +137 ¦ done?:bool <- greater-or-equal i, len +138 ¦ break-if done? +139 ¦ c:char <- index *contents, i +140 ¦ sink-file <- write sink-file, c +141 ¦ i <- add i, 1 +142 ¦ loop 143 } 144 close sink-file 145 # make sure to wait for the file to be actually written to disk @@ -210,10 +211,10 @@ if ('onhashchange' in window) { 151 local-scope 152 load-ingredients 153 { -154 c:char, done?:bool, source <- read source -155 break-if done? -156 $write-to-file file, c -157 loop +154 ¦ c:char, done?:bool, source <- read source +155 ¦ break-if done? +156 ¦ $write-to-file file, c +157 ¦ loop 158 } 159 file <- $close-file file 160 ] @@ -226,10 +227,10 @@ if ('onhashchange' in window) { 167 # compute new file contents 168 buf:&:buffer <- new-buffer 30 169 { -170 c:char, done?:bool, source <- read source -171 break-if done? -172 buf <- append buf, c -173 loop +170 ¦ c:char, done?:bool, source <- read source +171 ¦ break-if done? +172 ¦ buf <- append buf, c +173 ¦ loop 174 } 175 contents:text <- buffer-to-array buf 176 new-resource:resource <- merge filename, contents @@ -240,18 +241,18 @@ if ('onhashchange' in window) { 181 i:num <- copy 0 182 len:num <- length *data 183 { -184 done?:bool <- greater-or-equal i, len -185 break-if done? -186 tmp:resource <- index *data, i -187 curr-filename <- get tmp, name:offset -188 found?:bool <- equal filename, curr-filename -189 { -190 break-unless found? -191 put-index *data, i, new-resource -192 jump +unlock-and-exit -193 } -194 i <- add i, 1 -195 loop +184 ¦ done?:bool <- greater-or-equal i, len +185 ¦ break-if done? +186 ¦ tmp:resource <- index *data, i +187 ¦ curr-filename <- get tmp, name:offset +188 ¦ found?:bool <- equal filename, curr-filename +189 ¦ { +190 ¦ ¦ break-unless found? +191 ¦ ¦ put-index *data, i, new-resource +192 ¦ ¦ jump +unlock-and-exit +193 ¦ } +194 ¦ i <- add i, 1 +195 ¦ loop 196 } 197 # if file didn't already exist, make room for it 198 new-len:num <- add len, 1 @@ -260,10 +261,10 @@ if ('onhashchange' in window) { 201 # copy over old files 202 i:num <- copy 0 203 { -204 done?:bool <- greater-or-equal i, len -205 break-if done? -206 tmp:resource <- index *data, i -207 put-index *new-data, i, tmp +204 ¦ done?:bool <- greater-or-equal i, len +205 ¦ break-if done? +206 ¦ tmp:resource <- index *data, i +207 ¦ put-index *new-data, i, tmp 208 } 209 # write new file 210 put-index *new-data, len, new-resource -- cgit 1.4.1-2-gfad0