From e5c7f525f8373647888f9c0e0a2ab52506ed58cd Mon Sep 17 00:00:00 2001 From: Pentium44 Date: Mon, 12 Apr 2021 03:51:48 -0700 Subject: [PATCH] Call this v0.5.3 --- Makefile | 2 +- Makefile.musl | 2 +- README.txt | 3 +++ src/inc/deps.h | 32 ++++++++++++++++++++++++++++++++ src/lexer.c | 8 ++++++++ 5 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 576111a..f8c1c54 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # (C) Copyright 2014-2021 Chris Dorman, some rights reserved (GPLv2) # Some changes and tweaks from Menchers -VERSION = \"0.5.2\" +VERSION = \"0.5.3\" VERSION_EXTRA = \"$(EXTRA)\" PREFIX ?= /usr diff --git a/Makefile.musl b/Makefile.musl index 7653de9..d5dee94 100644 --- a/Makefile.musl +++ b/Makefile.musl @@ -2,7 +2,7 @@ # (C) Copyright 2014-2021 Chris Dorman, some rights reserved (GPLv2) # Some changes and tweaks from Menchers -VERSION = \"0.5.2\" +VERSION = \"0.5.3\" VERSION_EXTRA = \"$(EXTRA)\" PREFIX ?= /usr diff --git a/README.txt b/README.txt index 86eb2b7..01a51ca 100644 --- a/README.txt +++ b/README.txt @@ -134,6 +134,7 @@ Done List of finished features, in a rough summary. +* Added help, and version functions * Simple syntax checking and error reporting, its a lazy language, syntax can sway. * Most syntax errors will produce warnings instead of terminating process * Up to 32 layer function piping @@ -151,6 +152,8 @@ Changelog Changes between version bumps in SlideScript. Hoping to have a lightweight top-down scripting language by V1.0.0 release! From there it will be molding and preserving the art. +* V0.5.3 + * Added version, and help command * V0.5.2 * Bugfixes and tweaks diff --git a/src/inc/deps.h b/src/inc/deps.h index fa2ba94..d919c1e 100644 --- a/src/inc/deps.h +++ b/src/inc/deps.h @@ -77,3 +77,35 @@ #define ENCOFFSET 3 #define ENCSTEPODD 2 #define ENCSTEPEVEN 2 + +// HELP PRINTOUT + +#define FUNCTION_HELP "-[Main Functions]-\nlist:\n" \ + " print \"\" |" \ + " sleep |" \ + " encode \"\"\n" \ + " decode \"\" |" \ + " compress \"\" \"\"\n" \ + " decompress \"\" |" \ + " calc \" <+/-*> \"\n" \ + " move \"\" \"\" |" \ + " chdir \"\" |" \ + " showdir |" \ + " showpath\n" \ + " isdir \"\" |" \ + " isfile \"\" |" \ + " delete \"\"\n" \ + " nethttp \"\" \"\" (1 forks, 0 nofork)\n" \ + " read \"\" |" \ + " write \"\" \"\"\n" \ + " cat \"\" \"\" |" \ + " exec \"\"\n" \ + "\n-[Variables, Pipes, and Backquoting]-\nExample:\n" \ + " FORK=`isfile \"index.html\"` -> returns 1 on find\n" \ + " write \"port.txt\" \"8888\" -> writes '8888' to port.txt\n" \ + " read \"port.txt\" | nethttp \"%PIPE%\" \"%FORK%\"\n\n" \ + "This an example of how piping works, along with variables and \n" \ + "backquote function execution. Return values are saved as variables.\n" \ + "\n-[Specials]-\nExample:\n" \ + "comp: \"\" \"\" -> returns (true|false)\n" \ + "loop: ; -> loops function for 'int' times\n" diff --git a/src/lexer.c b/src/lexer.c index 3c5eacf..e1b61c3 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -52,9 +52,17 @@ char *process_line(char *line) return NULL; } + // Check for main calls from user in interactive else if(strncmp("exit", tok_srch, 4) == 0) syn_error("ss:exit called"); + else if(strncmp("version", tok_srch, 7) == 0) + printf("ss:version: %s, type 'help' for function list\n", VERSION); + + else if(strncmp("help", tok_srch, 4) == 0) + printf("ss:help:\n%s", FUNCTION_HELP); + + // Lets add if and loop statements, make this // Somewhat usable as a language in other instances