Permalink
Browse files

1926

http://250bpm.com/blog:57

Funnily, the new idea I finally came up with in 'read' was already
mirrored above in recipe 'write'.
  • Loading branch information...
akkartik committed Aug 3, 2015
1 parent 2bdb6b4 commit c79f434177f901c1f002c136f65ad79724bdc78c
Showing with 7 additions and 11 deletions.
  1. +1 −1 060string.mu
  2. +1 −1 061channel.mu
  3. +4 −8 071print.mu
  4. +1 −1 edit.mu
View
@@ -621,7 +621,7 @@ recipe trim [
# result = new character[end+1 - start]
new-len:number <- subtract end, start, -1
result:address:array:character <- new character:type, new-len
# i = start, j = 0
# copy the untrimmed parts between start and end
i:number <- copy start
j:number <- copy 0
{
View
@@ -94,7 +94,7 @@ recipe read [
full:address:number <- get-address *chan, first-full:offset
circular-buffer:address:array:location <- get *chan, data:offset
result:location <- index *circular-buffer, *full
# increment full
# mark its slot as empty
*full <- add *full, 1
{
# wrap full around to 0 if necessary
View
@@ -434,13 +434,12 @@ recipe cursor-down [
{
break-unless sc
{
# if row < height-1
# increment row unless it's already all the way down
height:number <- get *sc, num-rows:offset
row:address:number <- get-address *sc, cursor-row:offset
max:number <- subtract height, 1
at-bottom?:boolean <- greater-or-equal *row, max
break-if at-bottom?
# row = row+1
*row <- add *row, 1
}
reply sc/same-as-ingredient:0
@@ -457,11 +456,10 @@ recipe cursor-up [
{
break-unless sc
{
# if row > 0
# decrement row unless it's already all the way up
row:address:number <- get-address *sc, cursor-row:offset
at-top?:boolean <- lesser-or-equal *row, 0
break-if at-top?
# row = row-1
*row <- subtract *row, 1
}
reply sc/same-as-ingredient:0
@@ -478,13 +476,12 @@ recipe cursor-right [
{
break-unless sc
{
# if column < width-1
# increment column unless it's already all the way to the right
width:number <- get *sc, num-columns:offset
column:address:number <- get-address *sc, cursor-column:offset
max:number <- subtract width, 1
at-bottom?:boolean <- greater-or-equal *column, max
break-if at-bottom?
# column = column+1
*column <- add *column, 1
}
reply sc/same-as-ingredient:0
@@ -501,11 +498,10 @@ recipe cursor-left [
{
break-unless sc
{
# if column > 0
# decrement column unless it's already all the way to the left
column:address:number <- get-address *sc, cursor-column:offset
at-top?:boolean <- lesser-or-equal *column, 0
break-if at-top?
# column = column-1
*column <- subtract *column, 1
}
reply sc/same-as-ingredient:0
View
@@ -2994,7 +2994,7 @@ recipe restore-sandboxes [
expected-response:address:address:array:character <- get-address **curr, expected-response:offset
*expected-response <- copy contents
}
# increment loop variables
+continue
idx <- add idx, 1
curr <- get-address **curr, next-sandbox:offset
loop

0 comments on commit c79f434

Please sign in to comment.