diff --git a/src/commands/dec.🗿 b/src/commands/dec.🗿 new file mode 100644 index 0000000..f16c837 --- /dev/null +++ b/src/commands/dec.🗿 @@ -0,0 +1,7 @@ +cmd_dec(data, args) +{ + if ([data + LOCATION_CURRENT_LINE] != 0) + error("no line"); + else + [data + LOCATION_CURRENT_LINE] = [data + LOCATION_CURRENT_LINE] - 1; +} diff --git a/src/commands/inc.🗿 b/src/commands/inc.🗿 new file mode 100644 index 0000000..1b7f387 --- /dev/null +++ b/src/commands/inc.🗿 @@ -0,0 +1,7 @@ +cmd_inc(data, args) +{ + if ([data + LOCATION_CURRENT_LINE] == [data + LOCATION_LENGTH]) + error(data, "no line"); + else + [data + LOCATION_CURRENT_LINE] = [data + LOCATION_CURRENT_LINE] + 1; +} diff --git a/src/main.🗿 b/src/main.🗿 index 89024ea..809294a 100644 --- a/src/main.🗿 +++ b/src/main.🗿 @@ -172,6 +172,10 @@ main() cmd_help(data, NULL); else if (strcmp(cmd, "w") == 0) cmd_write(data, NULL); + else if (strcmp(cmd, "+") == 0) + cmd_inc(data, NULL); + else if (strcmp(cmd, "-") == 0) + cmd_dec(data, NULL); else error(data, "cmd not foud"); }