diff options
Diffstat (limited to 'anim/tools')
| -rw-r--r-- | anim/tools/chart.py | 4 | ||||
| -rw-r--r-- | anim/tools/heap.c | 31 |
2 files changed, 34 insertions, 1 deletions
diff --git a/anim/tools/chart.py b/anim/tools/chart.py index 4f58312..998e704 100644 --- a/anim/tools/chart.py +++ b/anim/tools/chart.py @@ -42,7 +42,9 @@ none, beside, subject = split(0, 0, 14, 17, 8, 4), split(152, 152, 8, 17, 8), sp motion.REGIONS.update({ "fib": {**subject, **words}, "sort": {**subject, **words}, - "syscalls": {**subject, **words}, + # The band is the calls so far; the disassembly a descent. + "syscalls": {**beside, **words}, + "heap": {**subject, **words}, "list": {**subject, **words}, # The band's drawing is the backtrace, then the kernel's side. "sqlite": {**subject, **words}, diff --git a/anim/tools/heap.c b/anim/tools/heap.c new file mode 100644 index 0000000..3c95f07 --- /dev/null +++ b/anim/tools/heap.c @@ -0,0 +1,31 @@ +#include <stdlib.h> + +typedef struct node { + long value; + struct node *next; +} node; + +node *head; + +void push(long value) { + node *n = malloc(sizeof *n); + n->value = value; + n->next = head; + head = n; +} + +void pop(void) { + node *n = head; + head = n->next; + free(n); +} + +int main(void) { + push(7); + push(12); + push(9); + pop(); + pop(); + push(25); + return 0; +} |
