about summary refs log tree commit diff stats
path: root/023boolean.cc
Commit message (Collapse)AuthorAgeFilesLines
* 2803Kartik K. Agaram2016-03-211-3/+3
| | | | | Show more thorough information about instructions in the trace, but keep the original form in error messages.
* 2773 - switch to 'int'Kartik K. Agaram2016-03-131-7/+7
| | | | This should eradicate the issue of 2771.
* 2735 - define recipes using 'def'Kartik K. Agaram2016-03-081-10/+10
| | | | | | | | | | | | I'm dropping all mention of 'recipe' terminology from the Readme. That way I hope to avoid further bike-shedding discussions while I very slowly decide on the right terminology with my students. I could be smarter in my error messages and use 'recipe' when code uses it and 'function' otherwise. But what about other words like ingredient? It would all add complexity that I'm not yet sure is worthwhile. But I do want separate experiences for veteran programmers reading about Mu on github and for people learning programming using Mu.
* 2713 - require booleans for boolean operationsKartik K. Agaram2016-02-261-0/+23
| | | | | Thanks Ella Couch for finding this bug. It's helped me find errors in mu's code itself.
* 2712Kartik K. Agaram2016-02-261-4/+4
|
* 2685Kartik K. Agaram2016-02-191-1/+1
| | | | | | | | | | | | | | | | Stack of plans for cleaning up replace_type_ingredients() and a couple of other things, from main problem to subproblems: include type names in the type_tree rather than in the separate properties vector make type_tree and string_tree real cons cells, with separate leaf nodes redo the vocabulary for dumping various objects: do we really need to_string and debug_string? can we have a version with *all* information? can we have to_string not call debug_string? This commit nibbles at the edges of the final task, switching from member method syntax to global function like almost everything else. I'm mostly using methods just for STL in this project.
* 2377 - stop using operator[] in mapKartik K. Agaram2015-11-061-7/+7
| | | | | | | | | | | | | | | | I'm still seeing all sorts of failures in turning on layer 11 of edit/, so I'm backing away and nailing down every culprit I run into. First up: stop accidentally inserting empty objects into maps during lookups. Commands run: $ sed -i 's/\(Recipe_ordinal\|Recipe\|Type_ordinal\|Type\|Memory\)\[\([^]]*\)\] = \(.*\);/put(\1, \2, \3);/' 0[1-9]* $ vi 075scenario_console.cc # manually fix up Memory[Memory[CONSOLE]] $ sed -i 's/\(Memory\)\[\([^]]*\)\]/get_or_insert(\1, \2)/' 0[1-9]* $ sed -i 's/\(Recipe_ordinal\|Type_ordinal\)\[\([^]]*\)\]/get(\1, \2)/' 0[1-9]* $ sed -i 's/\(Recipe\|Type\)\[\([^]]*\)\]/get(\1, \2)/' 0[1-9]* Now mu dies pretty quickly because of all the places I try to lookup a missing value.
* 2258 - separate warnings from errorsKartik K. Agaram2015-10-061-4/+4
| | | | | | | At the lowest level I'm reluctantly starting to see the need for errors that stop the program in its tracks. Only way to avoid memory corruption and security issues. But beyond that core I still want to be as lenient as possible at higher levels of abstraction.
* 2226 - standardize warning formatKartik K. Agaram2015-10-011-4/+4
| | | | | | | | Always show recipe name where error occurred. But don't show internal 'interactive' name for sandboxes, that's just confusing. What started out as warnings are now ossifying into errors that halt all execution. Is this how things went with C and Unix as well?
* 2222Kartik K. Agaram2015-09-301-3/+3
|
* 2221Kartik K. Agaram2015-09-301-16/+36
|
* 2214Kartik K. Agaram2015-09-281-0/+123
> been created scenario clicking-on-a-sandbox-moves-it-to-editor [ $close-trace # trace too long assume-screen 40/width, 10/height # basic recipe 1:address:array:character <- new [ recipe foo [ add 2, 2 ]] # run it 2:address:array:character <- new [foo] assume-console [ press F4 ] 3:address:programming-environment-data <- new-programming-environment screen:address, 1:address:array:character, 2:address:array:character event-loop screen:address, console:address, 3:address:programming-environment-data screen-should-contain [ . run (F4) . . . .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━. . add 2, 2 x. .] foo . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊4 . . ┊━━━━━━━━━━━━━━━━━━━. . . ] # click somewhere on the sandbox assume-console [ left-click 3, 30 ] run [ event-loop screen:address, console:address, 3:address:programming-environment-data ] # it pops back into editor screen-should-contain [ . run (F4) . . foo . .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━. . add 2, 2 . .] . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ . . . . . ] # cursor should be in the right place assume-console [ type [0] ] run [ event-loop screen:address, console:address, 3:address:programming-environment-data ] screen-should-contain [ . run (F4) . . 0foo . .recipe foo [ ┊━━━━━━━━━━━━━━━━━━━. . add 2, 2 . .] . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊ . . . . . ] ] after <global-touch> [ # below sandbox editor? pop appropriate sandbox contents back into sandbox editor { sandbox-left-margin:number <- get *current-sandbox, left:offset click-column:number <- get *t, column:offset on-sandbox-side?:boolean <- greater-or-equal click-column, sandbox-left-margin break-unless on-sandbox-side? first-sandbox:address:sandbox-data <- get *env, sandbox:offset break-unless first-sandbox first-sandbox-begins:number <- get *first-sandbox, starting-row-on-screen:offset click-row:number <- get *t, row:offset below-sandbox-editor?:boolean <- greater-or-equal click-row, first-sandbox-begins break-unless below-sandbox-editor? empty-sandbox-editor?:boolean <- empty-editor? current-sandbox break-unless empty-sandbox-editor? # don't clobber existing contents # identify the sandbox to edit and remove it from the sandbox list sandbox:address:sandbox-data <- extract-sandbox env, click-row text:address:array:character <- get *sandbox, data:offset current-sandbox <- insert-text current-sandbox, text hide-screen screen screen <- render-sandbox-side screen, env screen <- update-cursor screen, recipes, current-sandbox, *sandbox-in-focus? show-screen screen loop +next-event:label } ] recipe empty-editor? [ local-scope editor:address:editor-data <- next-ingredient head:address:duplex-list <- get *editor, data:offset first:address:duplex-list <- next-duplex head result:boolean <- not first reply result ] recipe extract-sandbox [ local-scope env:address:programming-environment-data <- next-ingredient click-row:number <- next-ingredient # assert click-row >= sandbox.starting-row-on-screen sandbox:address:address:sandbox-data <- get-address *env, sandbox:offset start:number <- get **sandbox, starting-row-on-screen:offset clicked-on-sandboxes?:boolean <- greater-or-equal click-row, start assert clicked-on-sandboxes?, [extract-sandbox called on click to sandbox editor] { next-sandbox:address:sandbox-data <- get **sandbox, next-sandbox:offset break-unless next-sandbox # if click-row < sandbox.next-sandbox.starting-row-on-screen, break next-start:number <- get *next-sandbox, starting-row-on-screen:offset found?:boolean <- lesser-than click-row, next-start break-if found? sandbox <- get-address **sandbox, next-sandbox:offset loop } # snip sandbox out of its list result:address:sandbox-data <- copy *sandbox *sandbox <- copy next-sandbox # position cursor in sandbox editor sandbox-in-focus?:address:boolean <- get-address *env, sandbox-in-focus?:offset *sandbox-in-focus? <- copy 1/true reply result ] scenario sandbox-with-print-can-be-edited [ $close-trace # trace too long assume-screen 100/width, 20/height # left editor is empty 1:address:array:character <- new [] # right editor contains an instruction 2:address:array:character <- new [print-integer screen:address, 4] 3:address:programming-environment-data <- new-programming-environment screen:address, 1:address:array:character, 2:address:array:character # run the sandbox assume-console [ press F4 ] event-loop screen:address, console:address, 3:address:programming-environment-data screen-should-contain [ . run (F4) . . . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. . x. . print-integer screen:address, 4 . . screen: . . .4 . . . . . . . . . . . . . . . . . . . ┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. . . ] # edit the sandbox assume-console [ left-click 3, 70 ] run [ event-loop screen:address, console:address, 3:address:programming-environment-data ] screen-should-contain [ . run (F4) . . print-integer screen:address, 4 . .┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┊━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━. . . . . ] ]