Working on it

This commit is contained in:
Pentium44 2021-05-18 23:02:25 -07:00
parent e2a3beafe0
commit c199aa618b
2 changed files with 39 additions and 36 deletions

View File

@ -37,7 +37,7 @@ at this moment!
* cat "file.txt" "Data to write to end of file.txt"
* Basic math expressions
* calc "45 / 5"` or `calc "255.3 * 442.77"
* calc "45 / 5" or calc "255.3 * 442.77"
* Of course addition and subtraction as well
* Time example:
@ -48,8 +48,8 @@ at this moment!
* isfile "examples/functions.ss" -> returns 1, its there
* File manipulation functions
* move "file1" "file2" -> Renames/moves file1 to file2 (mv)
* chdir "/home/user" -> Changes directory to /home/user (cd)
* move "file1" "file2" -> Renames/moves file1 to file2 (mv alias)
* chdir "/home/user" -> Changes directory to /home/user (cd alias)
* backdir -> Moves you back one directory (..)
* showpath -> Returns current working directory (pwd alias)
* showdir -> Lists current directory (ls alias)
@ -62,8 +62,8 @@ at this moment!
* exec "ls -al" (alias to ~"ls -al")
* Slidescript compression functions, example:
* compress "archivename" "file1 file2 dir1 dir2" -> file1, 2, dir1, 2 archived, compressed,
and saved in in 'archivename.tar.ss'
* compress "archivename" "file1 file2 dir1 dir2" -> file1, 2, and dir1, 2 archived, compressed,
and saved in 'archivename.tar.ss'
* decompress "archivename.tar.ss" -> decompresses 'archivename.tar.ss'
* Print example:
@ -89,7 +89,7 @@ at this moment!
* md5 "file.txt" -> outputs filename and md5 hash
* Layered piping
* md5 "file.txt" | encrypt "%PIPE" | write "file.txt.md5.enc" "%PIPE%" -> writes output of md5 to file.txt.md5
* md5 "file.txt" | encrypt "%PIPE%" | write "file.txt.md5.enc" "%PIPE%" -> writes output of md5 to file.txt.md5
* Networking functions
* netlisten "<port>" "<search>" "<respond>" -> listens on <port> and replies <respond> on <search> found from outside
@ -119,9 +119,12 @@ This section will obviously expand and adapt to the direction of the language. T
* Add in-script functions
* Add script including
* Loops, and if statements
* More networking function flexibility
* File pull / file push functionality
* File pull / file push functionality (via network sockets)
* Micro text editor
* IRC server, bot, and client built in
* Web server additions (pulled from chttpd)
* PATH variable support for use as a shell in some cases
-----
Done
@ -140,6 +143,7 @@ List of finished features, in a rough summary.
* Some simple functions
* Shebang handling
* Variable support
* If, ifn, loop, and comp statements
-----
Changelog

View File

@ -71,7 +71,7 @@ char *process_line(char *line)
if(tok_srch == NULL)
{
x_warn("ss:warn:loop statement requires arguments");
x_warn("ss:warn:if statement requires arguments");
return NULL;
}
@ -80,7 +80,7 @@ char *process_line(char *line)
strcmp(tok_srch, " \n") == 0 ||
strcmp(tok_srch, " ") == 0)
{
x_warn("ss:warn:loop syntax error, missing argument?");
x_warn("ss:warn:if syntax error, missing argument?");
return NULL;
}
@ -91,7 +91,7 @@ char *process_line(char *line)
tok_srch = strtok(NULL, ";");
if(tok_srch == NULL)
{
x_warn("ss:warn:loop syntax error, missing last argument?");
x_warn("ss:warn:if syntax error, missing last argument?");
return NULL;
}
@ -119,7 +119,7 @@ char *process_line(char *line)
if(tok_srch == NULL)
{
x_warn("ss:warn:loop statement requires arguments");
x_warn("ss:warn:ifn statement requires a compare argument.");
return NULL;
}
@ -128,30 +128,35 @@ char *process_line(char *line)
strcmp(tok_srch, " \n") == 0 ||
strcmp(tok_srch, " ") == 0)
{
x_warn("ss:warn:loop syntax error, missing argument?");
x_warn("ss:warn:ifn syntax error, missing function call?");
return NULL;
}
compbuf = qmalloc(QM_SS, (strlen(parse_vars(tok_srch)) + 1));
compbuf = qmalloc(QM_SS, (strlen(tok_srch) + 1));
*compbuf = '\0';
strcat(compbuf, parse_vars(tok_srch));
strcat(compbuf, tok_srch);
printf("toksrch: %s\n", tok_srch);
tok_srch = strtok(NULL, ";");
if(tok_srch == NULL)
{
x_warn("ss:warn:loop syntax error, missing last argument?");
return NULL;
}
printf("toksrch: %s\n", tok_srch);
dobuf = qmalloc(QM_SS, (strlen(parse_vars(tok_srch)) + 1));
if( (strncmp("false", parse_vars(parse_bq(compbuf)), 5) == 0)
|| (strncmp("0", parse_vars(parse_bq(compbuf)), 1) == 0))
{
while(tok_srch != NULL)
{
dobuf = qmalloc(QM_SS, (strlen(tok_srch) + 1));
*dobuf = '\0';
strcat(dobuf, parse_vars(tok_srch));
strcat(dobuf, tok_srch);
if((strncmp("false", compbuf, 4) == 0) || (strncmp("0", compbuf, 1) == 0))
{
proc_return = process_line(parse_vars(dobuf));
printf("%s\n", proc_return);
fflush(stdout);
//proc_return = process_line(parse_vars(dobuf));
//if(proc_return != NULL) {
// printf("%s\n", proc_return);
// fflush(stdout);
//}
printf("toksrch: %s\n", tok_srch);
tok_srch = strtok(NULL, ";");
}
}
return NULL;
@ -445,7 +450,7 @@ char *process_line(char *line)
retbuf = qmalloc(QM_SS, dirstr_size);
sprintf(retbuf, "%s\n", "ss:showdir:");
sprintf(retbuf, "%s", "");
for (int ii = 0; ii < nn; ii++)
{
@ -820,12 +825,6 @@ char *process_line(char *line)
parsed = parse_vars(tok_srch);
if(parsed != NULL)
{
if(strtok(NULL, "\"") == NULL)
{
x_warn("ss:warn:print syntax error, missing end quote?");
return NULL;
}
return parsed;
}
else