diff options
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | process_multiples.c | 65 | ||||
-rw-r--r-- | process_multiples.h | 6 | ||||
-rw-r--r-- | startmode.c | 24 | ||||
-rwxr-xr-x | test/7ed-TESTING | bin | 0 -> 70208 bytes |
5 files changed, 95 insertions, 4 deletions
@@ -16,8 +16,8 @@ clean: rm -f test/smode tests: - echo "CC 7ed.c functions.c startmode.c editmode.c ---> test/$(TESTTARGET)" - $(CC) $(CFLAGS_TESTBIN) 7ed.c functions.c startmode.c editmode.c input.c i_validation.c -o test/$(TESTTARGET) + echo "CC 7ed.c functions.c startmode.c editmode.c i_validation.c process_multiples.c ---> test/$(TESTTARGET)" + $(CC) $(CFLAGS_TESTBIN) 7ed.c functions.c startmode.c editmode.c input.c i_validation.c process_multiples.c -o test/$(TESTTARGET) install: cp $(TARGET) $(INSTALL_DIRECTORY) diff --git a/process_multiples.c b/process_multiples.c index ade2a67..dc950f2 100644 --- a/process_multiples.c +++ b/process_multiples.c @@ -7,3 +7,68 @@ #include "input.h" #include "i_validation.h" #include <stdint.h> + +int call_L_plus_continue(char *multiple) { + + fprintf(stdout, "+ or - CONTINUE %s\n", multiple); + return 0; +} + +uint64_t call_L_plus_minus_only(uint64_t focus, char p_or_m) { + switch (p_or_m) { + case '+': + return focus+1; + break; + case '-': + return focus-1; + break; + } + + return _NA; +} + +uint64_t call_L(char *multiple, uint64_t focus) { + + int imm = _IMM_NUMBER; + + if (multiple[1] == '\n') { + imm = _NA; + fprintf(stdout, "L only\n"); + } + + if (multiple[1] == '+' || multiple[1] == '-') { + imm = _NA; + if (multiple[2] == '\n') { // This is where - and + only inputs happen and get processed + focus = call_L_plus_minus_only(focus, multiple[1]); + return focus; + } + call_L_plus_continue(multiple); + + } + + if (imm == _IMM_NUMBER) { + fprintf(stdout, "immediate\n"); + } + + + return focus; +} + +int call_N(char *multiple) { + + fprintf(stdout, "%s\n", multiple); + return 0; +} + +int call_X(char *multiple) { + + fprintf(stdout, "%s\n", multiple); + return 0; +} + +int call_D(char *multiple) { + + fprintf(stdout, "%s\n", multiple); + return 0; +} + diff --git a/process_multiples.h b/process_multiples.h new file mode 100644 index 0000000..9f78e4b --- /dev/null +++ b/process_multiples.h @@ -0,0 +1,6 @@ +#include <stdint.h> + +uint64_t call_L(char *multiple, uint64_t focus); +int call_N(char *multiple); +int call_X(char *multiple); +int call_D(char *multiple);
\ No newline at end of file diff --git a/startmode.c b/startmode.c index 3b4179b..de89743 100644 --- a/startmode.c +++ b/startmode.c @@ -6,6 +6,7 @@ #include "7ed.h" #include "input.h" #include "i_validation.h" +#include "process_multiples.h" #include <stdint.h> int ncat(char filename[]) { @@ -106,8 +107,27 @@ int startmode(char filename[]) { call_singles(single, focus, filename); break; case _MULTIPLE: - fprintf(stdout, "multiple\n"); - fprintf(stdout, "%s", multiple); + //fprintf(stdout, "multiple\n"); + //fprintf(stdout, "%s", multiple); + switch(multiple[0]) { + case 'l': + case 'L': + focus = call_L(multiple, focus); + break; + case 'n': + case 'N': + call_N(multiple); + break; + case 'x': + case 'X': + call_X(multiple); + break; + case 'd': + case 'D': + call_D(multiple); + break; + } + free(multiple); break; case _FAIL: diff --git a/test/7ed-TESTING b/test/7ed-TESTING Binary files differnew file mode 100755 index 0000000..d89facd --- /dev/null +++ b/test/7ed-TESTING |