From 899919470fe997388b195b005b31dd29d7d2c06d Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 19 Mar 2009 12:06:53 +0000 Subject: Linewrap and conventions in src/dirax.c --- src/dirax.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/dirax.c b/src/dirax.c index 439d03b..2924380 100644 --- a/src/dirax.c +++ b/src/dirax.c @@ -35,12 +35,14 @@ #include "displaywindow.h" #include "reproject.h" + typedef enum { DIRAX_INPUT_NONE, DIRAX_INPUT_LINE, DIRAX_INPUT_PROMPT } DirAxInputType; + static void dirax_parseline(const char *line, ControlContext *ctx) { int i, rf; @@ -121,6 +123,7 @@ static void dirax_parseline(const char *line, ControlContext *ctx) ctx->dirax_read_cell = 0; } + static void dirax_sendline(const char *line, ControlContext *ctx) { char *copy; @@ -136,6 +139,8 @@ static void dirax_sendline(const char *line, ControlContext *ctx) printf("DX: Sent '%s'\n", copy); /* No newline here */ free(copy); } + + /* Send a "user" command to DirAx, failing if DirAx is not idle */ static void dirax_sendline_if_idle(const char *line, ControlContext *ctx) { @@ -147,6 +152,7 @@ static void dirax_sendline_if_idle(const char *line, ControlContext *ctx) dirax_sendline(line, ctx); } + static void dirax_send_next(ControlContext *ctx) { switch ( ctx->dirax_step ) { @@ -201,6 +207,7 @@ static void dirax_send_next(ControlContext *ctx) } } + static gboolean dirax_readable(GIOChannel *dirax, GIOCondition condition, ControlContext *ctx) { @@ -345,11 +352,13 @@ static gboolean dirax_readable(GIOChannel *dirax, GIOCondition condition, } + void dirax_stop(ControlContext *ctx) { dirax_sendline_if_idle("end\n", ctx); } + void dirax_rerun(ControlContext *ctx) { dirax_sendline_if_idle("go\n", ctx); @@ -425,11 +434,9 @@ void dirax_invoke(ControlContext *ctx) ctx); displaywindow_update_dirax(ctx, ctx->dw); - - return; - } + /* Despite being part of the same module, this has very little to do with * invoking DirAx */ ReflectionList *dirax_load(const char *filename) @@ -503,6 +510,7 @@ ReflectionList *dirax_load(const char *filename) return list; } + int dirax_is_drxfile(const char *filename) { @@ -538,5 +546,4 @@ int dirax_is_drxfile(const char *filename) fclose(fh); return 0; - } -- cgit v1.2.3