Compare commits
6 Commits
1b7bb91cf1
...
main
Author | SHA1 | Date | |
---|---|---|---|
573a366766 | |||
6b14c50e65 | |||
6fa0ea91bd | |||
4e15cb9ff1 | |||
1f1a11f886 | |||
2d1c5ee458 |
2
README.md
Normal file
2
README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# GolemED
|
||||||
|
A clone of the famous ED text editor in 
|
Submodule lib/IronGolem updated: f05f3945fe...e417a01f9a
7
src/commands/dec.🗿
Normal file
7
src/commands/dec.🗿
Normal file
@ -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;
|
||||||
|
}
|
7
src/commands/inc.🗿
Normal file
7
src/commands/inc.🗿
Normal file
@ -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;
|
||||||
|
}
|
28
src/commands/write.🗿
Normal file
28
src/commands/write.🗿
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
puterr(str)
|
||||||
|
{
|
||||||
|
local ptr = str;
|
||||||
|
|
||||||
|
loop
|
||||||
|
{
|
||||||
|
if ([ptr] == 0)
|
||||||
|
break;
|
||||||
|
err [ptr];
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
err '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd_write(data, args)
|
||||||
|
{
|
||||||
|
local i = 0;
|
||||||
|
|
||||||
|
if ([data + LOCATION_LENGTH] == 0)
|
||||||
|
return 0;
|
||||||
|
loop
|
||||||
|
{
|
||||||
|
if (i == [data + LOCATION_LENGTH])
|
||||||
|
return 0;
|
||||||
|
puterr([[[data + LOCATION_ARRAY] + i] + MAP_VALUE]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
12
src/main.🗿
12
src/main.🗿
@ -45,9 +45,9 @@ get_number(data, str)
|
|||||||
if ([[str]] == '$')
|
if ([[str]] == '$')
|
||||||
{
|
{
|
||||||
if (start == 0 - 1)
|
if (start == 0 - 1)
|
||||||
start = data + LOCATION_LENGTH;
|
start = [data + LOCATION_LENGTH] - 1;
|
||||||
else
|
else
|
||||||
stop = data + LOCATION_LENGTH;
|
stop = [data + LOCATION_LENGTH] - 1;
|
||||||
[str] = [str] + 1;
|
[str] = [str] + 1;
|
||||||
}
|
}
|
||||||
else if (isdigit([[str]]))
|
else if (isdigit([[str]]))
|
||||||
@ -170,12 +170,18 @@ main()
|
|||||||
cmd_delete(data, NULL);
|
cmd_delete(data, NULL);
|
||||||
else if (strcmp(cmd, "h") == 0)
|
else if (strcmp(cmd, "h") == 0)
|
||||||
cmd_help(data, NULL);
|
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
|
else
|
||||||
error(data, "cmd not foud");
|
error(data, "cmd not foud");
|
||||||
free(cmd);
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
free(cmd);
|
||||||
free(ranges);
|
free(ranges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user