about summary refs log tree commit diff stats
path: root/029tools.cc
Commit message (Collapse)AuthorAgeFilesLines
* 2377 - stop using operator[] in mapKartik K. Agaram2015-11-061-20/+20
| | | | | | | | | | | | | | | | 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.
* 2347Kartik K. Agaram2015-11-021-0/+2
|
* 2313Kartik K. Agaram2015-10-291-2/+2
|
* 2272Kartik K. Agaram2015-10-191-2/+18
|
* 2271 - bugfix: traces cross-contaminating errorsKartik K. Agaram2015-10-191-1/+1
| | | | | | | | | | | | | | | | | | There were several places where we push a call on to a routine without incrementing call-stack depth, which was used to compute the depth at which to trace an instruction. So sometimes you ended up one depth lower than you started a call with. Do this enough times and instructions that should be traced at level 100 end up at level 0 and pop up as errors. Solution: since call-stack depth is only used for tracing, include it in the trace stream and make sure we reset it along with the trace stream. Then catch all places where we forget to increment call-stack depth and make sure we catch such places in the future. When I first ran into this with Caleb I thought there must be some way that we're writing some output into the warnings result. I didn't recognize that the spurious output as part of the trace, just at the wrong level.
* 2260 - start tracing by depth rather than labelKartik K. Agaram2015-10-061-7/+6
| | | | Now we can collect all traces, just modulating the depth.
* 2258 - separate warnings from errorsKartik K. Agaram2015-10-061-21/+21
| | | | | | | 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.
* 2253 - start reorganizing tracesKartik K. Agaram2015-10-051-31/+0
|
* 2232Kartik K. Agaram2015-10-011-0/+44
|
* 2226 - standardize warning formatKartik K. Agaram2015-10-011-7/+7
| | | | | | | | 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?
* 2225Kartik K. Agaram2015-10-011-18/+30
|
* 2199 - stop printing numbers in scientific notationKartik K. Agaram2015-09-141-2/+2
| | | | | | | | | | | Turns out the default format for printing floating point numbers is neither 'scientific' nor 'fixed' even though those are the only two options offered. Reading the C++ standard I found out that the default (modulo locale changes) is basically the same as the printf "%g" format. And "%g" is basically the shorter of: a) %f with trailing zeros trimmed b) %e So we'll just do %f and trim trailing zeros.
* 2095Kartik K. Agaram2015-08-281-1/+0
| | | | | | | | | | | | Finally terminate the experiment of keeping debug prints around. I'm also going to give up on maintaining counts. What we really need is two kinds of tracing: a) For tests, just the domain-specific facts, organized by labels. b) For debugging, just transient dumps to stdout. b) only works if stdout is clean by default. Hmm, I think this means 'stash' should be the transient kind of trace.
* 2079Kartik K. Agaram2015-08-261-20/+0
| | | | Cleanup 2078.
* 2078 - update entire screen on tb_present()Kartik K. Agaram2015-08-261-0/+20
| | | | | | | | | | | | | | | | | | | Termbox had been taking shortcuts when it thinks the screen hasn't changed, which doesn't work if some other process messes up the screen. The Go version has a Sync method in addition to Flush/tb_present for precisely this eventuality. But it feels like an unnecessary optimization given C's general speed. Just drop it altogether. --- This took me a long time to track down, and interestingly I found myself writing a new tracing primitive before I remembered how to selectively trace just certain layers during manual tests. I'm scared of generating traces not because of performance but because of the visual noise. Be aware of this. I'm going to clean up $log now. Maybe I should also stop using $print..
* 2064Kartik K. Agaram2015-08-241-3/+3
| | | | Adjust spaces in 'stash'.
* 1990 - extra ingredient for 'trace' depthKartik K. Agaram2015-08-131-8/+18
| | | | Now we can make use of all the depths from 1 to 99.
* 1989 - drop the default label for 'trace'Kartik K. Agaram2015-08-131-21/+8
|
* 1975 - let's start using traces in lessonsKartik K. Agaram2015-08-101-0/+47
| | | | | More friendly way to 'stash' stuff in the trace so that you can toggle lines of code to see their stashed traces.
* 1974Kartik K. Agaram2015-08-101-0/+6
|
* 1923Kartik K. Agaram2015-08-021-1/+1
| | | | | | | | | | Still iterating on the right way to handle incorrect number of ingredients. My first idea of creating null results doesn't really work once they're used in later instructions. Just add a warning at one place in the run loop, but otherwise only add products when there's something to save in them. Undoes some work around commit 1886.
* 1922Kartik K. Agaram2015-08-021-1/+1
|
* 1921 - show trace by clicking on codeKartik K. Agaram2015-08-021-8/+15
| | | | | | | Region to click on to edit is now reduced to just the menu bar for the sandbox (excluding the 'x' for deleting the sandbox). The symmetry there might be useful, but we'll see if the relative click area is in line with how commonly the actions are performed.
* 1886 - gracefully handle malformed ingredientsKartik K. Agaram2015-07-291-1/+1
| | | | | | | | For example: x:number <- index y:address:array:number, 3 (forgetting to do a lookup) Thanks Caleb Couch.
* 1871Kartik K. Agaram2015-07-281-3/+0
|
* 1868 - start using naked literals everywhereKartik K. Agaram2015-07-281-1/+1
| | | | First step to reducing typing burden. Next step: inferring types.
* 1867 - keep tests from corrupting lesson/ directoryKartik K. Agaram2015-07-281-1/+4
|
* 1864Kartik K. Agaram2015-07-281-11/+0
|
* 1860 - new primitive: $systemKartik K. Agaram2015-07-271-0/+216
Also reorganize my miscellaneous hacky primitives.