~rabbits/orca-toy

d2a54b460792d433b41aa1878e76df09220303d9 — neauoire 9 months ago bae038a
Added first real icon
4 files changed, 27 insertions(+), 10 deletions(-)

M README.md
M build.sh
M cli.c
M orca.c
M README.md => README.md +1 -1
@@ 1,4 1,4 @@
# Orca(toy)
# Orca

Orca is an [esoteric programming language](https://wiki.xxiivv.com/orca) designed to quickly create procedural sequencers, in which every letter of the alphabet is an operation, where lowercase letters operate on bang, uppercase letters operate each frame.


M build.sh => build.sh +3 -4
@@ 14,10 14,9 @@ rm -f ./orca
# cc cli.c sim.c -std=c89 -O2 -DNDEBUG -g0 -s -Wall -o cli
# ./cli demo.orca

# orca

cc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined -L/usr/local/lib -lSDL2 -lportmidi orca.c sim.c -o orca
# cc orca.c sim.c -std=c89 -O2 -DNDEBUG -g0 -s -Wall -L/usr/local/lib -lSDL2 -o orca
# client
# cc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined -L/usr/local/lib -lSDL2 -lportmidi orca.c sim.c -o orca
cc -std=c89 -O2 -DNDEBUG -g0 -s -Wall -L/usr/local/lib -lSDL2 -lportmidi orca.c sim.c -o orca

# Size
echo "Size: $(du -sk ./orca)"

M cli.c => cli.c +19 -1
@@ 33,6 33,24 @@ printgrid(Grid *g)
}

int
opengrid(Grid *g, FILE *f)
{
	char c;
	g->l = 0;
	while((c = fgetc(f)) != EOF && g->l < MAXSZ) {
		if(c == '\n') {
			if(g->w == 0)
				g->w = g->l;
			g->h = g->l / g->w;
		} else {
			g->type[g->l] = 0;
			g->data[g->l++] = c;
		}
	}
	return g->w > 2 && g->h > 2;
}

int
main(int argc, char *argv[])
{
	FILE *f;


@@ 47,7 65,7 @@ main(int argc, char *argv[])
	f = fopen(argv[1], "r");
	if(!f)
		return error("Missing input.");
	if(!loadgrid(&g, f))
	if(!opengrid(&g, f))
		return error("Invalid grid");
	while(g.f < limit) {
		rungrid(&g);

M orca.c => orca.c +4 -4
@@ 51,8 51,8 @@ Uint32 theme[] = {
	0xffb545};

Uint8 icons[][8] = {
	{0x38, 0x7c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x00},
	{0x38, 0x44, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00},
	{0x86, 0xc6, 0xe6, 0xf6, 0xe6, 0xc6, 0x86, 0x00}, /* play */
	{0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00}, /* pause */
	{0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00},
	{0x06, 0x18, 0x20, 0x40, 0x40, 0x80, 0x80, 0x00},
	{0x02, 0x02, 0x04, 0x38, 0x40, 0x80, 0x80, 0x00},


@@ 182,7 182,7 @@ void
drawui(Uint32 *dst)
{
	int bottom = VER * 8 + 8;
	drawicon(dst, 0, bottom, icons[PAUSE == 1 ? 4 : 0], 1);
	drawicon(dst, 0, bottom, icons[PAUSE == 1 ? 1 : 0], 1);
}

void


@@ 496,7 496,7 @@ dokey(SDL_Event *event)
	case SDLK_5: insert('5'); break;
	case SDLK_6: insert('6'); break;
	case SDLK_7: insert('7'); break;
	case SDLK_8: insert('8'); break;
	case SDLK_8: insert(shift ? '*' : '8'); break;
	case SDLK_9: insert('9'); break;
	case SDLK_a: ctrl ? select(0, 0, g.w, g.h) : insert(shift ? 'A' : 'a'); break;
	case SDLK_b: insert(shift ? 'B' : 'b'); break;