diff --git a/README.md b/README.md index f056e1b..84d8a4c 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,17 @@ +> Z-Sharp is no longer in development! This project was never meant to go beyond the scope of a simple thing I could make pong in, yet people continue to ask for features and fixes, and I continue to oblige. So sadly, even though this was a cool project in which I learned a lot, it will be ending now. I will eventually make some docs and standards for the syntax, and will still leave this repository open. This way anybody can make their own interpreter or compiler for it. I will also still accept pull requests for any changes to this repository. + ## Introduction -Z-Sharp is a custom programming language I made because I don't like c++ very much (Z-Sharp's interpreter is written in c++ though). Z-Sharp scripts have the file extension .ZS. The base syntax and formatting I would say is quite similar to C# or Python, but differs as task complexity increases. It has support for graphics using SDL2, and by default is not enabled. +Z-Sharp is a custom programming language I made because I don't like c++ very much (Z-Sharp's interpreter is written in c++ though). Z-Sharp scripts have the file extension .ZS. The base syntax and formatting I would say is quite similar to C# or Python, but differs as task complexity increases. It also has support for graphics using SDL2. Before using Z#: There is ***no documentation***, ***strings*** barely work, ***performance*** isn't great, the syntax is ***very specific***, and most errors just cause it to ***crash without warning***. I am just a *single developer* working on this during my free time; between school, other projects, and YouTube. Z-Sharp will most likely never be finished, since it was really supposed to end when the video was published about it. If you are trying to use a common programming language feature, ask yourself this: ***Is this feature required to play pong?*** If not, then most likely that feature ***has not been implemented yet***. I initially only made the language so I could create pong and make a video about it, so it really is the ***bare minimum***. +## Documentation and getting started: +[The docs and tutorial](https://spazelectro.github.io/ZSharpDocs/#/README) + ## Installation Downloading or installing is very simple, here is how depending on your version and operating system: ### Windows diff --git a/ZSharp/ZS.h b/ZSharp/ZS.h index 0e1b68b..18d9e02 100644 --- a/ZSharp/ZS.h +++ b/ZSharp/ZS.h @@ -145,14 +145,6 @@ func GetKey(keyName) return b } -// WIP -//func SplitThread(function) -//{ -// ZS.System.SplitThread(function) -//} - - - //////////////////////////// // ↓ MADE BY KAPUTCHINO ↓ // //////////////////////////// @@ -213,5 +205,19 @@ func Perm(n, r) return Fac(n) / Fac(n - r) } +////////////////////////////////////////// +// ↓ MADE BY CONCHETUMARE_PRODUCTIONS ↓ // +////////////////////////////////////////// +func GetPercent(value, percent) +{ + float temp = value * percent / 100 + return temp +} +//gets 100% of number +func PercentToHundred(value, percent) +{ + float temp = value * 100 / percent + return temp +} )" ; diff --git a/ZSharp/builtin.h b/ZSharp/builtin.h index 4fda055..72f0669 100644 --- a/ZSharp/builtin.h +++ b/ZSharp/builtin.h @@ -1,6 +1,14 @@ #ifndef BUILTIN_H #define BUILTIN_H +#if defined(__unix__) +#define UNIX true +#define WINDOWS false +#elif defined(_MSC_VER) +#define UNIX false +#define WINDOWS true +#endif + #include #include #include @@ -13,6 +21,7 @@ #include #include #include +#include // for console command printing #include "strops.h" #include "graphics.h" @@ -467,6 +476,13 @@ boost::any ZSFunction(const string& name, const vector& args) Vec2 v(AnyAsFloat(args.at(0)), AnyAsFloat(args.at(1))); return v; } + else if (name == "ZS.System.Command"){ + string command = StringRaw(AnyAsString(args.at(0))); + //int command_len = command.length(); + //char* command_char_arr=new char[command_len + 1]; + //strcpy(command_char_arr, command.c_str()); // string into char arr + int k = system(command.c_str()); + } else LogWarning("ZS function \'" + name + "\' does not exist."); diff --git a/examples/console_application.zs b/examples/console_application.zs new file mode 100644 index 0000000..07d48b9 --- /dev/null +++ b/examples/console_application.zs @@ -0,0 +1,5 @@ +func Main() +{ + Printl("this is a test:") + ZS.System.Command("cls") +} \ No newline at end of file