summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <[email protected]>2018-05-24 10:37:55 +0100
committerKatolaZ <[email protected]>2018-05-24 10:37:55 +0100
commitd95e611ed47253c7cf2b170537d5aa400ffc8093 (patch)
treeb0c7a0e630d037223b1c5b841feb89178714eace
parent3a10703698af22f44a44d0a1bdd5fda28e4a4712 (diff)
Last commit before "," refactoring
-rw-r--r--TODO.org7
-rw-r--r--main.c6
2 files changed, 8 insertions, 5 deletions
diff --git a/TODO.org b/TODO.org
index 1600c0c..9d20a5f 100644
--- a/TODO.org
+++ b/TODO.org
@@ -34,8 +34,8 @@
* IN-PROGRESS Addresses [11/14]
-** TODO Probably rethink (and rewrite) addressing
-** TODO Test "," extensively
+** TODO Probably rethink (and/or rewrite) addressing -- see below
+** TODO Reimplement "," (assign addr2=addr1 in there!!!!)
** DONE Reimplement offsets [3/3]
*** DONE "," does not work as expected in "1,+10n"
*** DONE addresses like "+1,+2" do not work properly
@@ -51,6 +51,7 @@
** DONE $
** DONE .
** DONE ;
-** IN-PROGRESS Offsets (+-) [0/2]
+** IN-PROGRESS Offsets (+-) [0/3]
+*** TODO Test offsets like 1++++n
*** TODO Test offsets like 1+10+10
*** TODO test offsets like 10+-++--10
diff --git a/main.c b/main.c
index cc4289c..fe26675 100644
--- a/main.c
+++ b/main.c
@@ -61,7 +61,7 @@ int get_addr(const char **cmd){
addr2 = addr1;
addr1 = num;
break;
- case ',': /* range 1 */
+ case ',': /* range 1 */ /* refactor to set addr2 = addr1 */
fprintf(stderr, " >>>> comma: addr1: %d addr2: %d pos: %d\n", addr1, addr2, pos);
comma = 1;
if (addr1 ==-1)
@@ -112,7 +112,9 @@ int get_addr(const char **cmd){
case '+':
fprintf(stderr, " >>>> +/-: addr1: %d addr2: %d pos: %d\n", addr1, addr2, pos);
addr2 = addr1;
- addr1 = pos;
+ /* the assignment below breaks stuff like 1++++ */
+ if (addr1 < 0)
+ addr1 = pos;
c ++;
c = skip_blank(&c);
if (! isdigit(*c)){