summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--process_multiples.c28
-rw-r--r--process_multiples.h6
-rw-r--r--startmode.c2
-rw-r--r--test/testgrounds/newlinetest3
5 files changed, 34 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 2604198..1be84f3 100644
--- a/Makefile
+++ b/Makefile
@@ -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!
+
+
+