~rabbits/orca-toy

89b33504a5924aa42ea9d1ab30832009796f39c2 — neauoire 2 years ago 863d375
Fixed load issue
3 files changed, 21 insertions(+), 11 deletions(-)

M README.md
M orca.c
M sim.c
M README.md => README.md +10 -2
@@ 1,8 1,16 @@
# Orca(toy)

Orca is an [esoteric programming language](https://en.wikipedia.org/wiki/Esoteric_programming_language) 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.
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.

This is a single-file implementation of the basic operators created for educational purposes. To try a complete environment with client and server, see [Orca](https://git.sr.ht/~rabbits/orca).
This is a minimalist implementation of the basic operators created for educational purposes. To try a complete environment with client and server, see [Orca](https://git.sr.ht/~rabbits/orca).

## Build

You must have [SDL2](https://wiki.libsdl.org/) and [portmidi](http://portmedia.sourceforge.net/portmidi/).

```
cc orca.c sim.c -std=c89 -O2 -DNDEBUG -g0 -s -Wall -L/usr/local/lib -lSDL2 -o orca
```

## Operators


M orca.c => orca.c +2 -2
@@ 44,7 44,7 @@ Uint32 theme[] = {
	0xFFFFFF,
	0x72DEC2,
	0x666666,
	0x222222};
	0xffb545};

Uint8 icons[][8] = {
	{0x38, 0x7c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x00},


@@ 521,7 521,7 @@ main(int argc, char *argv[])
	initgrid(&g, HOR, VER);
	select(0, 0, 1, 1);

	if(argc > 0)
	if(argc > 1)
		if(!loadgrid(&g, fopen(argv[1], "r")))
			return error("Load", "Failure");


M sim.c => sim.c +9 -7
@@ 582,19 582,20 @@ rungrid(Grid *g)
int
loadgrid(Grid *g, FILE *f)
{
	int x = 0, y = 0;
	char c;
	g->l = 0;
	if(!f)
		return 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;
			x = 0;
			y++;
		} else {
			g->type[g->l] = 0;
			g->data[g->l++] = c;
			set(g, x, y, c);
			x++;
		}
	}
	return g->w > 2 && g->h > 2;
	return 1;
}

void


@@ 611,4 612,5 @@ initgrid(Grid *g, int w, int h)
	}
	g->msg[0] = '\0';
	g->msg_len = 0;
	printf("Resize: %dx%d\n", g->w, g->h);
}