From 719a91ab240a851aa964bc8eb988c8fba5ffb715 Mon Sep 17 00:00:00 2001 From: Geir Okkenhaug Jerstad Date: Sun, 18 Aug 2024 11:09:05 +0200 Subject: [PATCH] adde Makefile --- .../core.c.blob | Bin 8129 -> 0 bytes tortoise/Makefile | 20 ++++++++ tortoise/core.c | 45 ------------------ tortoise/tortoise | Bin 16032 -> 16072 bytes .../core.c => tortoise.c} | 45 +++++++++++++++++- 5 files changed, 64 insertions(+), 46 deletions(-) delete mode 100644 tortoise/.ccls-cache/@home@geir@code@scheme@tortoise/core.c.blob create mode 100644 tortoise/Makefile delete mode 100644 tortoise/core.c rename tortoise/{.ccls-cache/@home@geir@code@scheme@tortoise/core.c => tortoise.c} (53%) diff --git a/tortoise/.ccls-cache/@home@geir@code@scheme@tortoise/core.c.blob b/tortoise/.ccls-cache/@home@geir@code@scheme@tortoise/core.c.blob deleted file mode 100644 index fb206c02e83d713bae7753a54891c34b891b2c04..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8129 zcmcIpU2G#)6`paXj*~c9D=}8;IL@qh6*)2HrK5{wP!n?8ua7cFdysBw!80}5n!(D82n~l9w?e>Oq(%q~* z+_t2qf$N%7t!$o>j#niewPkE+MxY~3!d}<&kvRz0Xr53#Z&N*P9(S5XwYIa@&@GI$ zdZ*sp)3mPC)HG>hvr?_B$2hXKwkAiW1AvrwPu7&$mK0dqmff)=16#qa)U*Ol>e%i! zwwe;qf;1qbd-}ie&YfYxoLtAg2mI?mt<*4V)vvU;1Vd=mw@s`m9jqfovjYoq&e((B zb&x0f*hH?vI{JFoM_xyDMnc}7w0d-pVE+H=mqGiohYU~-J4~tzDhP`mXalK!;37{V z*{W@^1BN03R)e}X0@+z_Z+ABJ4ZXhW)aqNElRGTXqU@9kl0eWNDPwk2(BRn{vt zD9E}@eyLH8jQ!RCHKMxB5&V55jS}2MzU}ymV|#d)F?3WG_n-g5eT;!U-wiZhaXW^s zZL`Dfr%+-k49YU4R{^5gMN4rb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1b=Z6k#0e%meeeC22cnOULnr3kS=f}&ap!? zhvo%-E<0Bg`1zyr6_CnOQWt)`bNbQ{>DfxQ2Bg38tt&tN>NkJ!;Lv+><+*#{y*QIS zildH8LO6Hd`LpL9;7Xfk%&e7Qt(JzFkak8&Mr>to)&a{hA -#include -#include - -static const int WIDTH = 10; -static const int HEIGHT = 10; - -static FILE* -start_gnuplot() { - FILE* output; - int pipes[2]; - pid_t pid; - - pipe(pipes); - pid = fork(); - - if (!pid) { - dup2 (pipes[0], STDIN_FILENO); - execlp ("gnuplot", NULL); - return; /* Not reached. */ - } - - output = fdopen(pipes[1], "w"); - - fprintf (output, "set multiplot\n"); - fprintf (output, "set parametric\n"); - fprintf (output, "set xrange [-%d:%d]\n", WIDTH, WIDTH); - fprintf (output, "set yrange [-%d:%d]\n", HEIGHT, HEIGHT); - fprintf (output, "set size ratio -1\n"); - fprintf (output, "unset xtics\n"); - fprintf (output, "unset ytics\n"); - fflush (output); - - return output; - } - -static FILE* global_output; - -int main(int argc, char *argv[]) { - global_output = start_gnuplot(); - - return EXIT_SUCCESS; -} diff --git a/tortoise/tortoise b/tortoise/tortoise index d8b40fa510a0aae3e9ea0974819ecd585bf54e26..1358568a836d009b9ace8c58332e41ba563926dd 100755 GIT binary patch delta 1036 zcmZWnK}-`-5S_mTX)9f}-I#4fWFb}{(9*@mqD`TVL`w_@4;n8ZNQfb+7O_2O#7H#J zhGN9wK%$2pOpG^4FTg?IV(?-@Vl*BMTuiDS6b~3Qah<>2^?*Ow`TxI}H#7U@7beyw z9(vs&PaOCvTY&pBEgMe1&A`BKLk|l&lB|49VlRuZ7dXj&y7Ouo%d2tYkT2$heo;8c zuq1tKo{lYw0Lk2kr9I?*$@$4#-LW7*>B%2mPfo=G{5*!M?uLdSA=-9wI`-KGpskc{ z(fw5LQVTUx(=9eie7rrUP@t z9_7s^MCp#uBdWG;<`kt9qCK&<$mF(aha|_z4X}yV1KomGE-nS$2);T(7y3 z4GYkUiI9S7XGOmNB8-{Rn@;GY1IG)y@Y5!~xeFg6oL7;|D&~~nGBQo^@xSHStPbgF ztO9D9!j^d_jx|CUc%TPIwI=osXNb39M7hBlY?%e{16PS>$1@!YyNX+yqWP(y1j@hq zR%9FD9-#)jrZyJdVQ~8lJ7Cx}PExj;IA5W#DV*<6d~?KgQ&upa6`vtr&v<;HO(x?NdxPVA2tc^c{c5fna$GA%C>E?R;0KA883iNzd6e%3e=(S z|6lLN^&<)kbL%@rF&?3s?> z+S^C}I!<}tdcrH=IJPsh1LKE3HU3*>KYIZlrJOI*<--Eqn~DT7>tER&0q z4ii?-F_Ociyt@loIHE4ntPDTdpkKZ#<@~xwwTy6o6P6^eZ=-rGMVyWfNVa0Vj;>2A zgoAM{&&NpM2eaBksSv)J<5MpDSQRh2@RP_ATK)`G8SIA}8Iz(txkDkJR%24DJfwhu z3RABBWzNm_N>mj{<7^_5e0L%}V6z$0lo~qMAXX&zZ z(CDw2dnJlg4EJiGgH%jR(^L&e8hBk>?qRuC zV^8>m{F0augrKWuS#a<}yvm{W@RJ;;yM!t(J_#{@D_DKPt9@GNYqh5&S57Cs2K9Uw zoOh|pS;?-AUi{dnu?}JTktO*_3Bh<$**AIR+WDSIYczS;W38qpJggJDjaXytf@}pR zj1#PY&yAR`_7Vjw8!2B=uW%?@;q-mRyjb?AxSMLiwaj?)riWOOw2>; #include #include +#include static const int WIDTH = 10; static const int HEIGHT = 10; +static double x, y; +static double direction; +static int pendown; + static FILE* start_gnuplot() { @@ -38,8 +43,46 @@ start_gnuplot() { static FILE* global_output; +static void tortoise_reset () { + x = y = 0.0; + direction = 0.0; + pendown = 1; + + fprintf(global_output, "clear\n"); + fflush(global_output); +} + + int main(int argc, char *argv[]) { global_output = start_gnuplot(); - + tortoise_reset (); return EXIT_SUCCESS; } + +static void draw_line(FILE *output, double x1, double y1, double x2, + double y2) { + fprintf(output, "plot [0:1] %f + %f * t, %f + %f * t notitle\n", + x1, x2 -x1, y1, y2 -y1); + fflush(output); +} + +static void tortoise_pendown() { + pendown = 1; +} + +static void tortoise_penup() { + pendown = 0; +} + +static void tortoise_move(double length) { + double newX, newY; + + newX = x + length * cos (direction); + newY = y + length * sin (direction); + + if (pendown) + draw_line(global_output, x, y, newX, newY); + + x = newX; + y = newY; +}