summaryrefslogtreecommitdiff
path: root/process_multiples.c
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-04-04 14:05:20 +0200
committerOskar <[email protected]>2024-04-04 14:05:20 +0200
commita24e39c9c1022a37cab2a6f877f61373812a6c98 (patch)
treebddab9cf9e6f768d89ea5842bafc6d01d6a5a449 /process_multiples.c
parent88febb6bb171f780c80d73a41982d86aa2e87fc8 (diff)
call_L_immediate now implemented. L with immediate numbers seem to work
pretty well now. Not comprehensively tested yet. Will do later.
Diffstat (limited to 'process_multiples.c')
-rw-r--r--process_multiples.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/process_multiples.c b/process_multiples.c
index 8af048c..a472e5b 100644
--- a/process_multiples.c
+++ b/process_multiples.c
@@ -17,6 +17,34 @@ int check_L_linecount(uint64_t Flines, uint64_t focus) {
return _VALID;
}
+uint64_t call_L_immediate(char *multiple, uint64_t focus, uint64_t Flines) {
+
+ char new_multiple[32] = { '\0' };
+
+ int i = 0;
+ int j = 1;
+ for( ; multiple[j] != '\n' ; i++, j++) {
+ new_multiple[i] = multiple[j];
+ }
+
+ char *endptr;
+ uint64_t new_focus = strtol(new_multiple, &endptr, 10);
+ errno = 0;
+ if (errno == ERANGE) {
+ return focus;
+ }
+ if (endptr == new_multiple) {
+ return focus;
+ }
+
+ if(check_L_linecount(Flines, new_focus) == _INVALID) {
+ return focus;
+ }
+
+ return new_focus;
+
+}
+
uint64_t call_L_plus_minus_continue(char *multiple, uint64_t focus, uint64_t Flines) {
char new_multiple[32] = { '\0' };
@@ -130,6 +158,8 @@ uint64_t call_L(char *multiple, uint64_t focus, uint64_t Flines) {
if (imm == _IMM_NUMBER) {
fprintf(stdout, "immediate\n");
+ focus = call_L_immediate(multiple, focus, Flines);
+ return focus;
}