diff options
author | Oskar <[email protected]> | 2024-04-05 13:48:29 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-04-05 13:48:29 +0200 |
commit | 918acf5dc55fa27f2ba4121b8dd07fd5cde036bd (patch) | |
tree | 23447c51fc613bfced52e48bcab00d9251142c40 | |
parent | 06936a1b2c59ccc6b13e32e52dea60c5cabb547d (diff) |
Working on 'N' now. Works pretty well. But it's not finished so i cant
say how well it will go when i do N plus continue or N immediate.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | process_multiples.c | 28 | ||||
-rw-r--r-- | process_multiples.h | 6 | ||||
-rw-r--r-- | startmode.c | 2 | ||||
-rw-r--r-- | test/testgrounds/newlinetest | 3 |
5 files changed, 34 insertions, 7 deletions
@@ -1,5 +1,5 @@ CC=gcc -CFLAGS_TESTBIN=-Wfatal-errors -Wall -Werror -Wextra -g -fsanitize=address +CFLAGS_TESTBIN=-O3 -Wfatal-errors -Wall -Werror -Wextra -g -fsanitize=address CFLAGS=-O2 -flto -march=native -DNDEBUG -fomit-frame-pointer -s -static TARGET=7ed TESTTARGET=7ed-TESTING diff --git a/process_multiples.c b/process_multiples.c index 6c3b6b7..e59811c 100644 --- a/process_multiples.c +++ b/process_multiples.c @@ -165,9 +165,33 @@ uint64_t call_L(char *multiple, uint64_t focus, uint64_t Flines) { return focus; } -int call_N(char *multiple) { +uint64_t call_N(char *multiple, uint64_t focus, uint64_t Flines, char *filename) { - fprintf(stdout, "%s\n", multiple); + int imm = _IMM_NUMBER; + + if (multiple[1] == '\n') { // N will add just 1 line. + imm = _NA; + new_line(filename, focus); + return 0; + } + + if (multiple[1] == '+') { // N+ is the same as N. It will only add 1 line. + imm = _NA; + if (multiple[2] == '\n') { + new_line(filename, focus); + return 0; + } + + // N plus continue. Still figuring out how this is gonna work. + return 0; + } + + if (imm == _IMM_NUMBER) { + // N immediate, I will make its on function for it i think. + return 0; + } + + fprintf(stdout, "%s %ld\n", multiple, Flines); return 0; } diff --git a/process_multiples.h b/process_multiples.h index f509f5a..6dc4067 100644 --- a/process_multiples.h +++ b/process_multiples.h @@ -1,6 +1,6 @@ #include <stdint.h> uint64_t call_L(char *multiple, uint64_t focus, uint64_t Flines); -int call_N(char *multiple); -int call_X(char *multiple); -int call_D(char *multiple);
\ No newline at end of file +uint64_t call_N(char *multiple, uint64_t focus, uint64_t Flines, char *filename); +uint64_t call_X(char *multiple); +uint64_t call_D(char *multiple);
\ No newline at end of file diff --git a/startmode.c b/startmode.c index e76b991..80b5427 100644 --- a/startmode.c +++ b/startmode.c @@ -123,7 +123,7 @@ int startmode(char filename[]) { break; case 'n': case 'N': - call_N(multiple); + call_N(multiple, focus, Flines, filename); break; case 'x': case 'X': diff --git a/test/testgrounds/newlinetest b/test/testgrounds/newlinetest index 766a493..521113e 100644 --- a/test/testgrounds/newlinetest +++ b/test/testgrounds/newlinetest @@ -9,3 +9,6 @@ 9 10 WOW! + + + |