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" * cat "file.txt" "Data to write to end of file.txt"
* Basic math expressions * 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 * Of course addition and subtraction as well
* Time example: * Time example:
@ -48,8 +48,8 @@ at this moment!
* isfile "examples/functions.ss" -> returns 1, its there * isfile "examples/functions.ss" -> returns 1, its there
* File manipulation functions * File manipulation functions
* move "file1" "file2" -> Renames/moves file1 to file2 (mv) * move "file1" "file2" -> Renames/moves file1 to file2 (mv alias)
* chdir "/home/user" -> Changes directory to /home/user (cd) * chdir "/home/user" -> Changes directory to /home/user (cd alias)
* backdir -> Moves you back one directory (..) * backdir -> Moves you back one directory (..)
* showpath -> Returns current working directory (pwd alias) * showpath -> Returns current working directory (pwd alias)
* showdir -> Lists current directory (ls alias) * showdir -> Lists current directory (ls alias)
@ -62,8 +62,8 @@ at this moment!
* exec "ls -al" (alias to ~"ls -al") * exec "ls -al" (alias to ~"ls -al")
* Slidescript compression functions, example: * Slidescript compression functions, example:
* compress "archivename" "file1 file2 dir1 dir2" -> file1, 2, dir1, 2 archived, compressed, * compress "archivename" "file1 file2 dir1 dir2" -> file1, 2, and dir1, 2 archived, compressed,
and saved in in 'archivename.tar.ss' and saved in 'archivename.tar.ss'
* decompress "archivename.tar.ss" -> decompresses 'archivename.tar.ss' * decompress "archivename.tar.ss" -> decompresses 'archivename.tar.ss'
* Print example: * Print example:
@ -89,7 +89,7 @@ at this moment!
* md5 "file.txt" -> outputs filename and md5 hash * md5 "file.txt" -> outputs filename and md5 hash
* Layered piping * 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 * Networking functions
* netlisten "<port>" "<search>" "<respond>" -> listens on <port> and replies <respond> on <search> found from outside * 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 in-script functions
* Add script including * Add script including
* Loops, and if statements
* More networking function flexibility * 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 Done
@ -140,6 +143,7 @@ List of finished features, in a rough summary.
* Some simple functions * Some simple functions
* Shebang handling * Shebang handling
* Variable support * Variable support
* If, ifn, loop, and comp statements
----- -----
Changelog Changelog

View File

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